14.10.2011 Kamil Sedlak

1) change in the way how random time scattering in APD is
   generated for optical photons - now the events should be
   reproducible irrespective of whether the random time is
   or is not requested.
2) indroducing a possibility to simulate optical photons, but
   not to process them - this option, however, does not seem
   to speed up the simulation significantly.
This commit is contained in:
sedlak 2011-10-14 08:11:54 +00:00
parent 781fb2022c
commit 89c6f27ae1
5 changed files with 25 additions and 10 deletions

View File

@ -54,6 +54,12 @@ class musrParameters {
static G4bool boolG4GeneralParticleSource; // if true, G4GeneralParticleSource will be initialised instead of G4ParticleGun
// - needed for the radioactive source
static G4bool boolG4OpticalPhotons; // if true, optical photons will be used (in the sensitive scintillators)
static G4bool boolG4OpticalPhotonsUnprocess; // if true, optical photons will not be processed - it might be
// usefull if the user wants to preselect some interesting events,
// and then to run the time-consuming processing of opt. photons
// again only for the interesting events. This way the random number
// generator can generate the reproducible events.
// This option only works with "boolG4OpticalPhotons".
static G4bool field_DecayWithSpin; // if true, then the routins for calculating the magnetic field will
// use more precise argument. This variable is set to "true" by
// the SteppinAction and reset to "false" in the GetFieldValue.

View File

@ -105,7 +105,7 @@ class musrScintSD : public G4VSensitiveDetector
OPSAhistoNbin=nBins; OPSAhistoMin=min; OPSAhistoMax=max;
OPSAhistoBinWidth=(max-min)/nBins; OPSAhistoBinWidth1000=OPSAhistoBinWidth*1000;
}
void ProcessOpticalPhoton(G4Step*);
void ProcessOpticalPhoton(G4Step* aStep, G4double APDcellsTimeVariation);
void EndOfEvent_OptiacalPhotons();
void ReadInPulseShapeArray(const char* filename);
void FindCFDtime(G4double& OPSA_CFD_time, G4double& OPSA_CFD_ampl, G4double timeOfFirstPhoton);

View File

@ -1422,7 +1422,7 @@ G4VPhysicalVolume* musrDetectorConstruction::Construct() {
}
}
else if ((strcmp(tmpString1,"process")==0)||(strcmp(tmpString1,"G4OpticalPhotons")==0)
else if ((strcmp(tmpString1,"process")==0)||(strcmp(tmpString1,"G4OpticalPhotons")==0)||(strcmp(tmpString1,"G4OpticalPhotonsUnprocess")==0)
||(strcmp(tmpString1,"materialPropertiesTable")==0)||(strcmp(tmpString1,"setMaterialPropertiesTable")==0)) {
; // processes are interpreded later in musrPhysicsList.cc
}

View File

@ -78,6 +78,9 @@ musrParameters::musrParameters(G4String steeringFileName)
if (strcmp(tmpString1,"G4OpticalPhotons")==0){
if (strcmp(tmpString2,"true")==0){ musrParameters::boolG4OpticalPhotons = true; }
}
if (strcmp(tmpString1,"G4OpticalPhotonsUnprocess")==0){
if (strcmp(tmpString2,"true")==0){ musrParameters::boolG4OpticalPhotonsUnprocess = true; }
}
if (strcmp(tmpString1,"region")==0) {
boolG4RegionRequested = true;
}
@ -115,6 +118,7 @@ G4bool musrParameters::killAllGammas=false;
G4bool musrParameters::killAllNeutrinos=true;
G4bool musrParameters::boolG4GeneralParticleSource=false;
G4bool musrParameters::boolG4OpticalPhotons=false;
G4bool musrParameters::boolG4OpticalPhotonsUnprocess=false;
//cks G4bool musrParameters::includeMuoniumProcesses =true; // TS
//G4bool musrParameters::boolG4GeneralParticleSource=true;
G4int musrParameters::nrOfEventsToBeGenerated=0;

View File

@ -121,10 +121,12 @@ void musrScintSD::Initialize(G4HCofThisEvent* HCE) {
// In case of optical photons, delete all optHitDetectorMap* from the previous event (if they exist).
if (musrParameters::boolG4OpticalPhotons) {
for (optHitMapType::const_iterator it=optHitMap.begin() ; it != optHitMap.end(); it++ ) {
delete (it->second);
if (!musrParameters::boolG4OpticalPhotonsUnprocess) {
for (optHitMapType::const_iterator it=optHitMap.begin() ; it != optHitMap.end(); it++ ) {
delete (it->second);
}
optHitMap.clear();
}
optHitMap.clear();
}
}
@ -145,7 +147,8 @@ G4bool musrScintSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
G4String particleName=aTrack->GetDefinition()->GetParticleName();
// if (particleName=="opticalphoton") {G4cout<<"UFON JE TU: edep="<<edep<<G4endl; return false;}
if (particleName=="opticalphoton") {
ProcessOpticalPhoton(aStep);
G4double APDcellsTimeVariation = G4RandGauss::shoot(0,APDcellsTimeVariationSigma);
if (!musrParameters::boolG4OpticalPhotonsUnprocess) ProcessOpticalPhoton(aStep,APDcellsTimeVariation);
return false;
}
@ -201,7 +204,7 @@ G4bool musrScintSD::ProcessHits(G4Step* aStep,G4TouchableHistory*)
//....oooOO0OOooo........oooOO0OOooo........oooOO0OOooo........oooOO0OOooo......
void musrScintSD::ProcessOpticalPhoton(G4Step* aStep) {
void musrScintSD::ProcessOpticalPhoton(G4Step* aStep, G4double APDcellsTimeVariation) {
// //Was the photon absorbed by the absorption process ?
// const G4VProcess* process = aStep->GetPostStepPoint()->GetProcessDefinedStep();
// G4String processName = (process) ? process->GetProcessName() : "Unknown";
@ -210,7 +213,6 @@ void musrScintSD::ProcessOpticalPhoton(G4Step* aStep) {
// G4cout<<"\n ABSORPTION\n";
// }
G4OpBoundaryProcessStatus boundaryStatus=Undefined;
static G4OpBoundaryProcess* boundaryProc=NULL;
//find the boundary process only once
@ -269,7 +271,8 @@ void musrScintSD::ProcessOpticalPhoton(G4Step* aStep) {
// whether a given cell already fired - if so, do not store the photon.
G4bool APDcellAlreadyFired = false;
G4int APDcellID = 0;
if (APDcellsTimeVariationRequested) tmpTime += G4RandGauss::shoot(0,APDcellsTimeVariationSigma);
if (APDcellsTimeVariationRequested) tmpTime += APDcellsTimeVariation;
// if (APDcellsTimeVariationRequested) tmpTime += G4RandGauss::shoot(0,APDcellsTimeVariationSigma);
if (APDcellsEffectRequested) {
APDcellID = FindAPDcellID(aStep);
@ -543,7 +546,9 @@ void musrScintSD::EndOfEvent(G4HCofThisEvent*) {
} //end "if (NbHits>0)"
// Analyse optical photons if they were produced
if (musrParameters::boolG4OpticalPhotons) EndOfEvent_OptiacalPhotons();
if (musrParameters::boolG4OpticalPhotons) {
if (!musrParameters::boolG4OpticalPhotonsUnprocess) EndOfEvent_OptiacalPhotons();
}
}