Thank you, as well!
So detector properties itself do not matter? In case there are any available(?). I assume there are as many features possible/available as I am able to define within the code? Or are there already any built-in/ready to use features which are good to use?
In my case I constructed a G4box which I assigned to a sensitive detector. So I conclude my detector
is actually just a box that does nothing but killing each particle it enters?
This is my code:
MySensitiveDetector::MySensitiveDetector(G4String name) : G4VSensitiveDetector(name)
{}
MySensitiveDetector::~MySensitiveDetector()
{}
G4bool MySensitiveDetector::ProcessHits(G4Step *aStep, G4TouchableHistory *ROhist)
{
G4Track *track = aStep->GetTrack();
track->SetTrackStatus(fStopAndKill);
G4StepPoint *preStepPoint = aStep->GetPreStepPoint();
G4StepPoint *postStepPoint = aStep->GetPostStepPoint();
G4ThreeVector posPhoton = preStepPoint->GetPosition();
if(preStepPoint->GetStepStatus() == fGeomBoundary)
{
const G4VTouchable *touchable = aStep->GetPreStepPoint()->GetTouchable();
G4int history_depth = touchable->GetHistoryDepth();
G4int evt = G4RunManager::GetRunManager()->GetCurrentEvent()->GetEventID();
G4double partEdep = aStep->GetTotalEnergyDeposit();
G4double energy = preStepPoint->GetTotalEnergy();
//Convert from MeV to keV
partEdep *= 1000;
energy *= 1000;
// show only each 100th particle
G4EventManager* evMan = G4EventManager::GetEventManager();
if(evMan->GetConstCurrentEvent()->GetEventID() % 100 == 0)
{
evMan->KeepTheCurrentEvent();
}
G4AnalysisManager *man = G4AnalysisManager::Instance();
// Total energy
man->FillNtupleDColumn(0, 0, energy);
man->AddNtupleRow(0);
// Distinguishing detectors
if(history_depth < 5)
{
if(touchable->GetReplicaNumber(1) == 200){man->FillNtupleDColumn(1, 0, energy); man->AddNtupleRow(1);}
if(touchable->GetReplicaNumber(1) == 210){man->FillNtupleDColumn(2, 0, energy); man->AddNtupleRow(2);}
if(touchable->GetReplicaNumber(1) == 220){man->FillNtupleDColumn(3, 0, energy); man->AddNtupleRow(3);}
}
}
return true;
}