10 #include "TRT_G4Utilities/TRTParameters.hh"
11 #include "TRT_G4Utilities/TRTOutputFile.hh"
19 #include "G4TouchableHistory.hh"
22 #include "G4VProcess.hh"
23 #include "G4ParticleDefinition.hh"
24 #include "G4StepPoint.hh"
25 #include "G4ThreeVector.hh"
26 #include "G4Geantino.hh"
27 #include "G4ChargedGeantino.hh"
29 #include "G4Electron.hh"
30 #include "G4Positron.hh"
31 #include "G4ProcessManager.hh"
32 #include "G4ProcessVector.hh"
33 #include "G4GammaGeneralProcess.hh"
34 #include "G4NistManager.hh"
42 : G4VSensitiveDetector(
name ),
44 m_hitsWithZeroEnergyDeposit(0), m_phot(nullptr),
45 m_energyThreshold(0.0), m_probabilityThreshold(0.0), m_energyDepositCorrection(0.0),
46 m_energyThresholdKr(0.0), m_probabilityThresholdKr(0.0), m_energyDepositCorrectionKr(0.0),
47 m_energyThresholdAr(0.0), m_probabilityThresholdAr(0.0), m_energyDepositCorrectionAr(0.0),
51 m_hitID(0), m_particleEncoding(0), m_kineticEnergy(0.0),
52 m_energyDeposit(0.0), m_energyDepositInKeV(0.0), m_preStepX(0.0),
53 m_preStepY(0.0), m_preStepZ(0.0), m_postStepX(0.0), m_postStepY(0.0),
54 m_postStepZ(0.0), m_globalTime(0.0),
56 m_HitColl( hitCollectionName ), m_pParameters(nullptr),
57 m_pProcessingOfBarrelHits(nullptr), m_pProcessingOfEndCapHits(nullptr),
58 m_pMaterialXe(nullptr), m_pMaterialKr(nullptr), m_pMaterialAr(nullptr)
63 verboseLevel = setVerboseLevel;
78 G4cout << GetName() <<
" InitializeHitProcessing()" << G4endl;
99 G4cout << GetName() <<
" Fluorescence parameters: EnergyThreshold "
101 G4cout << GetName() <<
" Fluorescence parameters: EnergyThresholdKr "
103 G4cout << GetName() <<
" Fluorescence parameters: EnergyThresholdAr "
105 G4cout << GetName() <<
" Fluorescence parameters: ProbabilityThreshold "
107 G4cout << GetName() <<
" Fluorescence parameters: ProbabilityThresholdKr "
109 G4cout << GetName() <<
" Fluorescence parameters: ProbabilityThresholdAr "
111 G4cout << GetName() <<
" Fluorescence parameters: EnergyDepositCorrection "
113 G4cout << GetName() <<
" Fluorescence parameters: EnergyDepositCorrectionKr "
115 G4cout << GetName() <<
" Fluorescence parameters: EnergyDepositCorrectionAr "
126 pParametersForBarrelHits =
128 pParametersForEndCapHits =
131 delete pParametersForBarrelHits;
132 delete pParametersForEndCapHits;
135 G4NistManager* nist = G4NistManager::Instance();
139 G4cout << GetName() <<
" Could not find Xe material (Only OK if no TRT straws are filled with Xenon)" << G4endl;
144 G4cout << GetName() <<
" Could not find Kr material (Only OK if no TRT straws are filled with Krypton)" << G4endl;
149 G4cout << GetName() <<
" Could not find Ar material (Only OK if no TRT straws are filled with Argon)" << G4endl;
154 description <<
"InitializeHitProcessing: Could not find Xe, Kr or Ar materials (Not OK!)";
155 G4Exception(
"TRTSensitiveDetector",
"NoTRTGasesFound", FatalException,
description);
160 G4cout << GetName() <<
" InitializeHitProcessing() done" << G4endl;
172 G4cout << GetName() <<
" Initialize()" << G4endl;
181 const G4ProcessVector* pVec =
182 G4Gamma::Definition()->GetProcessManager()->GetProcessList();
183 for(
size_t ip=0;
ip<pVec->entries();
ip++)
185 if((*pVec)[
ip]->GetProcessName()==
"phot")
190 if((*pVec)[
ip]->GetProcessName()==
"GammaGeneralProc")
192 G4GammaGeneralProcess *genproc =
static_cast<G4GammaGeneralProcess*
>((*pVec)[
ip]);
193 G4VEmProcess *
proc = genproc->GetEmProcess(
"phot");
194 if (
proc &&
proc->GetProcessName()==
"phot")
203 G4cout << GetName() <<
"ERROR Did not find the photoelectic process!!!" << G4endl;
207 if (!
m_HitColl.isValid())
m_HitColl = std::make_unique<TRTUncompressedHitCollection>();
211 G4cout << GetName() <<
" Initialize() done" << G4endl;
220 G4TouchableHistory* )
224 G4Track* pTrack = pStep->GetTrack();
225 G4ParticleDefinition* pParticleDefinition = pTrack->GetDefinition();
230 if ( pParticleDefinition != G4Geantino::Definition() &&
231 pParticleDefinition != G4ChargedGeantino::Definition() )
242 if(pTrack->GetCreatorProcess()==
m_phot)
254 if ( pParticleDefinition==G4Gamma::GammaDefinition() &&
255 pStep->GetPostStepPoint()->GetProcessDefinedStep()==
m_phot )
258 double current_energyThreshold = 1
E+99;
259 double current_probabilityThreshold = 2.0;
260 double current_energyDepositCorrection = 0.0;
261 G4Material *pPreStepMaterial = pStep->GetPreStepPoint()->GetMaterial();
283 description <<
"ProcessHits: Unknown prestep material";
284 G4Exception(
"TRTSensitiveDetector",
"UnknownGasFound", FatalException,
description);
293 CLHEP::RandFlat::shoot() > current_probabilityThreshold )
303 bool trackerHit =
false;
305 if ( std::fabs(pStep->GetPreStepPoint()->GetPosition().z()) <
m_boundaryZ )
340 G4cout << GetName() <<
" DeleteObjects()" << G4endl;
348 G4cout << GetName() <<
" DeleteObjects() done" << G4endl;