12.07.2015 Views

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

Geant4 User's Guide for Application Developers - Geant4 - CERN

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Detector Definition and ResponseExample 4.15. An example of defining primitive sensitivity classes taken fromExN07DetectorConstruction.void ExN07DetectorConstruction::SetupDetectors(){G4String filterName, particleName;G4SDParticleFilter* gammaFilter =new G4SDParticleFilter(filterName="gammaFilter",particleName="gamma");G4SDParticleFilter* electronFilter =new G4SDParticleFilter(filterName="electronFilter",particleName="e-");G4SDParticleFilter* positronFilter =new G4SDParticleFilter(filterName="positronFilter",particleName="e+");G4SDParticleFilter* epFilter = new G4SDParticleFilter(filterName="epFilter");epFilter->add(particleName="e-");epFilter->add(particleName="e+");<strong>for</strong>(G4int i=0;iSetFilter(gammaFilter);det->RegisterPrimitive(primitive);primitive = new G4PSNofSecondary("nElectron",j);primitive->SetFilter(electronFilter);det->RegisterPrimitive(primitive);primitive = new G4PSNofSecondary("nPositron",j);primitive->SetFilter(positronFilter);det->RegisterPrimitive(primitive);primitive = new G4PSMinKinEAtGeneration("minEkinGamma",j);primitive->SetFilter(gammaFilter);det->RegisterPrimitive(primitive);primitive = new G4PSMinKinEAtGeneration("minEkinElectron",j);primitive->SetFilter(electronFilter);det->RegisterPrimitive(primitive);primitive = new G4PSMinKinEAtGeneration("minEkinPositron",j);primitive->SetFilter(positronFilter);det->RegisterPrimitive(primitive);primitive = new G4PSTrackLength("trackLength",j);primitive->SetFilter(epFilter);det->RegisterPrimitive(primitive);primitive = new G4PSNofStep("nStep",j);primitive->SetFilter(epFilter);det->RegisterPrimitive(primitive);G4SDManager::GetSDMpointer()->AddNewDetector(det);if(j==0){ layerLogical[i]->SetSensitiveDetector(det); }else{ gapLogical[i]->SetSensitiveDetector(det); }}}}Each G4THitsMap object can be accessed from G4HCofThisEvent with a unique collection ID number. ThisID number can be obtained from G4SDManager::GetCollectionID() with a name of G4MultiFunctionalDetector131

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!