11 #include "TRT_G4Utilities/TRTParameters.hh"
12 #include "TRT_G4Utilities/TRTOutputFile.hh"
20 #include "G4TouchableHistory.hh"
23 #include "G4VProcess.hh"
24 #include "G4ParticleDefinition.hh"
25 #include "G4StepPoint.hh"
26 #include "G4ThreeVector.hh"
27 #include "G4Geantino.hh"
28 #include "G4ChargedGeantino.hh"
29 #include <G4EventManager.hh>
31 #include "G4Electron.hh"
32 #include "G4Positron.hh"
33 #include "G4ProcessManager.hh"
34 #include "G4ProcessVector.hh"
35 #include "G4GammaGeneralProcess.hh"
36 #include "G4NistManager.hh"
43 : G4VSensitiveDetector(
name ),
45 m_hitsWithZeroEnergyDeposit(0), m_phot(nullptr),
46 m_energyThreshold(0.0), m_probabilityThreshold(0.0), m_energyDepositCorrection(0.0),
47 m_energyThresholdKr(0.0), m_probabilityThresholdKr(0.0), m_energyDepositCorrectionKr(0.0),
48 m_energyThresholdAr(0.0), m_probabilityThresholdAr(0.0), m_energyDepositCorrectionAr(0.0),
52 m_hitID(0), m_particleEncoding(0), m_kineticEnergy(0.0),
53 m_energyDeposit(0.0), m_energyDepositInKeV(0.0), m_preStepX(0.0),
54 m_preStepY(0.0), m_preStepZ(0.0), m_postStepX(0.0), m_postStepY(0.0),
55 m_postStepZ(0.0), m_globalTime(0.0),
57 m_HitCollName( hitCollectionName ), m_pParameters(nullptr),
58 m_pProcessingOfBarrelHits(nullptr), m_pProcessingOfEndCapHits(nullptr),
59 m_pMaterialXe(nullptr), m_pMaterialKr(nullptr), m_pMaterialAr(nullptr)
64 verboseLevel = setVerboseLevel;
79 G4cout << GetName() <<
" InitializeHitProcessing()" << G4endl;
100 G4cout << GetName() <<
" Fluorescence parameters: EnergyThreshold "
102 G4cout << GetName() <<
" Fluorescence parameters: EnergyThresholdKr "
104 G4cout << GetName() <<
" Fluorescence parameters: EnergyThresholdAr "
106 G4cout << GetName() <<
" Fluorescence parameters: ProbabilityThreshold "
108 G4cout << GetName() <<
" Fluorescence parameters: ProbabilityThresholdKr "
110 G4cout << GetName() <<
" Fluorescence parameters: ProbabilityThresholdAr "
112 G4cout << GetName() <<
" Fluorescence parameters: EnergyDepositCorrection "
114 G4cout << GetName() <<
" Fluorescence parameters: EnergyDepositCorrectionKr "
116 G4cout << GetName() <<
" Fluorescence parameters: EnergyDepositCorrectionAr "
127 pParametersForBarrelHits =
129 pParametersForEndCapHits =
132 delete pParametersForBarrelHits;
133 delete pParametersForEndCapHits;
136 G4NistManager* nist = G4NistManager::Instance();
140 G4cout << GetName() <<
" Could not find Xe material (Only OK if no TRT straws are filled with Xenon)" << G4endl;
145 G4cout << GetName() <<
" Could not find Kr material (Only OK if no TRT straws are filled with Krypton)" << G4endl;
150 G4cout << GetName() <<
" Could not find Ar material (Only OK if no TRT straws are filled with Argon)" << G4endl;
155 description <<
"InitializeHitProcessing: Could not find Xe, Kr or Ar materials (Not OK!)";
156 G4Exception(
"TRTSensitiveDetector",
"NoTRTGasesFound", FatalException,
description);
161 G4cout << GetName() <<
" InitializeHitProcessing() done" << G4endl;
173 G4cout << GetName() <<
" Initialize()" << G4endl;
182 const G4ProcessVector* pVec =
183 G4Gamma::Definition()->GetProcessManager()->GetProcessList();
184 for(
size_t ip=0;
ip<pVec->entries();
ip++)
186 if((*pVec)[
ip]->GetProcessName()==
"phot")
191 if((*pVec)[
ip]->GetProcessName()==
"GammaGeneralProc")
193 G4GammaGeneralProcess *genproc =
static_cast<G4GammaGeneralProcess*
>((*pVec)[
ip]);
194 G4VEmProcess *
proc = genproc->GetEmProcess(
"phot");
195 if (
proc &&
proc->GetProcessName()==
"phot")
204 G4cout << GetName() <<
"ERROR Did not find the photoelectic process!!!" << G4endl;
209 if(
auto* eventManager = G4EventManager::GetEventManager())
218 G4cout << GetName() <<
" Initialize() done" << G4endl;
227 G4TouchableHistory* )
231 G4Track* pTrack = pStep->GetTrack();
232 G4ParticleDefinition* pParticleDefinition = pTrack->GetDefinition();
237 if ( pParticleDefinition != G4Geantino::Definition() &&
238 pParticleDefinition != G4ChargedGeantino::Definition() )
249 if(pTrack->GetCreatorProcess()==
m_phot)
261 if ( pParticleDefinition==G4Gamma::GammaDefinition() &&
262 pStep->GetPostStepPoint()->GetProcessDefinedStep()==
m_phot )
265 double current_energyThreshold = 1
E+99;
266 double current_probabilityThreshold = 2.0;
267 double current_energyDepositCorrection = 0.0;
268 G4Material *pPreStepMaterial = pStep->GetPreStepPoint()->GetMaterial();
290 description <<
"ProcessHits: Unknown prestep material";
291 G4Exception(
"TRTSensitiveDetector",
"UnknownGasFound", FatalException,
description);
300 CLHEP::RandFlat::shoot() > current_probabilityThreshold )
310 bool trackerHit =
false;
312 if ( std::fabs(pStep->GetPreStepPoint()->GetPosition().z()) <
m_boundaryZ )
347 G4cout << GetName() <<
" DeleteObjects()" << G4endl;
355 G4cout << GetName() <<
" DeleteObjects() done" << G4endl;