13#include "ReadBoostRoot.hh"
14#include "G4HCofThisEvent.hh"
16#include "G4ThreeVector.hh"
17#include "G4SDManager.hh"
19#include "G4UnitsTable.hh"
24#include "GaudiKernel/ISvcLocator.h"
25#include "GaudiKernel/Bootstrap.h"
26#include "GaudiKernel/MsgStream.h"
29#include "G4LossTableManager.hh"
30#include "G4ElectronIonPair.hh"
41 collectionName.insert(
"BesTofHitsCollection");
42 collectionName.insert(
"BesTofHitsList");
43 elIonPair =
new G4ElectronIonPair();
57 (SensitiveDetectorName,collectionName[0]);
66 m_trackIndexes.clear();
75 HLID = G4SDManager::GetSDMpointer()->
76 GetCollectionID(collectionName[1]);
79 G4HCofThisEvent* HCE = evt->GetHCofThisEvent();
80 HCE->AddHitsCollection(HLID,m_besTofList);
88 G4double chg=aStep->GetTrack()->GetDefinition()->GetPDGCharge();
89 G4double edep = aStep->GetTotalEnergyDeposit();
90 G4double stepL=aStep->GetStepLength();
91 G4double deltaT=aStep->GetDeltaTime();
92 G4StepPoint* preStep = aStep->GetPreStepPoint();
93 G4ThreeVector pDirection=preStep->GetMomentumDirection();
94 G4String particleName = aStep->GetTrack()->GetDefinition()->GetParticleName();
95 G4Material* scinMaterial = aStep->GetTrack()->GetMaterial();
96 G4double charge = aStep->GetTrack()->GetDefinition()->GetPDGCharge();
97 G4int pdgcode = aStep->GetTrack()->GetDefinition()->GetPDGEncoding();
99 if (chg==0&&edep==0&&stepL==0)
104 G4int trackId = aStep->GetTrack()->GetTrackID();
107 newHit->
SetG4Index(aStep->GetTrack()->GetTrackID());
111 newHit->
SetTrackL(aStep->GetTrack()->GetTrackLength());
112 G4ThreeVector pos=preStep->GetPosition();
114 G4double globalTime=preStep->GetGlobalTime();
126 G4TouchableHistory* theTouchable
127 = (G4TouchableHistory*)(preStep->GetTouchable());
132 G4String name = theTouchable->GetVolume(0)->GetName();
134 G4int partId, scinNb, number,help_mrpc,module_mrpc ;
136 number = theTouchable->GetReplicaNumber(2);
137 help_mrpc = theTouchable->GetReplicaNumber(3);
141 if(name==
"physical_sensitive_detector_west_1")
146 else if(name==
"physical_sensitive_detector_west_2")
151 else if(name==
"physical_sensitive_detector_east_1")
156 else if(name==
"physical_sensitive_detector_east_2")
162 else if(name==
"logical_sensitive_detector_west_1")
165 scinNb = (help_mrpc)*(-0.5)+18.5;
167 else if(name==
"logical_sensitive_detector_west_2")
170 scinNb = (help_mrpc)*(-0.5)+18;
172 else if(name==
"logical_sensitive_detector_east_1")
175 scinNb = (help_mrpc)*(0.5)+0.5;
178 else if(name==
"logical_sensitive_detector_east_2")
181 scinNb =( help_mrpc)*(0.5)+1;
184 else if (name==
"physicalScinBr1")
189 else if (name==
"physicalScinBr2")
194 else if (name==
"physicalScinEcWest")
199 else if (name==
"physicalScinEcEast")
206 else if (name==
"logicalScinBr1" ||name==
"logicalScinBr2")
209 scinNb = (527-number)/3;
211 else if (name==
"logicalScinEcEast")
215 scinNb = (95-number)/2;
217 else if (name==
"logicalScinEcWest")
220 scinNb = (95-number)/2;
242 G4int trackIndex, g4TrackId;
248 m_besTofCollection->insert(newHit);
255 G4int trackIndex, g4TrackId;
258 if (m_trackIndex != trackIndex)
260 m_trackIndex = trackIndex;
271 G4int pdg =
abs(aStep->GetTrack()->GetDefinition()->GetPDGEncoding());
272 if (pdg==12 || pdg==14 || pdg==16)
274 if (flag && aStep->GetTrack()->GetTrackID()==g4TrackId)
276 m_trackIndexes.push_back(trackIndex);
279 m_besTofList->insert(truHit);
283 if (edep<=0)
delete newHit;
295 static G4int HCID=-1;
298 HCID = G4SDManager::GetSDMpointer()->
299 GetCollectionID(collectionName[0]);
301 HCE->AddHitsCollection(HCID,m_besTofCollection);
313 G4double FanoFactor = 0.2;
314 G4double meanion = eipair->MeanNumberOfIonsAlongStep(step);
315 G4double sig = std::sqrt(FanoFactor*meanion);
316 G4int nion = G4int(G4RandGauss::shoot(meanion,sig) + 0.5);
double abs(const EvtComplex &c)
G4THitsCollection< BesTofHit > BesTofHitsCollection
void GetCurrentTrackIndex(G4int &trackIndex, G4int &g4TrackId) const
void SetPos(G4ThreeVector pos)
void SetDeltaT(G4double deltaT)
void SetCharge(G4double charge)
void SetPDGcode(G4int pdgcode)
void SetTrackIndex(G4int trackIndex)
void SetPDirection(G4ThreeVector pDirection)
void SetPartId(G4int partId)
void SetModule_mrpc(G4int module_mrpc)
void SetScinNb(G4int scinNb)
void SetStepL(G4double stepL)
void SetTrackL(G4double length)
void SetTime(G4double time)
void SetEdep(G4double edep)
void SetMomentum(G4ThreeVector momentum)
void SetG4Index(G4int index)
void BeginOfTruthEvent(const G4Event *)
virtual void Initialize(G4HCofThisEvent *HCE)
virtual void EndOfEvent(G4HCofThisEvent *HCE)
void EndOfTruthEvent(const G4Event *)
G4int SampleNumberOfIonsAlongStep(const G4Step *, G4ElectronIonPair *)
virtual G4bool ProcessHits(G4Step *aStep, G4TouchableHistory *)