9 #include "ERTelescope.h" 11 #include "TClonesArray.h" 12 #include "TParticle.h" 13 #include "TVirtualMC.h" 16 #include "FairRootManager.h" 18 #include "FairRunSim.h" 19 #include "FairRuntimeDb.h" 20 #include "FairLogger.h" 22 #include "ERTelescopeGeoComponentSensetive.h" 29 flGeoPar =
new TList();
30 flGeoPar->SetName( GetName());
31 fQTelescopeSetup = ERTelescopeSetup::Instance();
40 flGeoPar =
new TList();
41 flGeoPar->SetName( GetName());
42 fQTelescopeSetup = ERTelescopeSetup::Instance();
44 fVerboseLevel = verbose;
60 FairDetector::Initialize();
65 gMC->GetTransformation(gMC->CurrentVolPath(), matrix);
66 Double_t globalPos[3],localPos[3];
67 fPosIn.Vect().GetXYZ(globalPos);
68 matrix.MasterToLocal(globalPos,localPos);
69 TVector3 pos_in_local_cs;
70 pos_in_local_cs.SetXYZ(localPos[0],localPos[1],localPos[2]);
71 new(clref[clref.GetEntriesFast()])
ERPoint(
75 TVector3(fPosOut.X(), fPosOut.Y(), fPosOut.Z()),
77 TVector3(fMomOut.Px(), fMomOut.Py(), fMomOut.Pz()),
82 fQTelescopeSetup->ConstructGeometry();
83 SetGeometryFileName(fQTelescopeSetup->GetGeoFileName());
84 ConstructRootGeometry();
88 if ( gMC->IsTrackEntering() ) {
91 gMC->TrackPosition(
fPosIn);
92 gMC->TrackMomentum(
fMomIn);
93 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
94 fTime = gMC->TrackTime() * 1.0e09;
96 fMot0TrackID = gMC->GetStack()->GetCurrentTrack()->GetMother(0);
97 fMass = gMC->ParticleMass(gMC->TrackPid()) * 1000;
98 fPDG = gMC->TrackPid();
100 fEloss += gMC->Edep() * 1000.;
101 if ((gMC->IsTrackExiting() ||
102 gMC->IsTrackStop() ||
103 gMC->IsTrackDisappeared()) &&
fEloss > 0.) {
104 gMC->TrackPosition(fPosOut);
105 gMC->TrackMomentum(fMomOut);
106 const TString path = gMC->CurrentVolPath();
109 LOG(FATAL) <<
"[ERTelescope] Not found setup component for sensetive volume path" 110 << path << FairLogger::endl;
111 for (
const auto orientation : component->GetOrientationsAroundZ()) {
112 for (
const auto channelSide : component->GetChannelSides()) {
113 fChannel = component->GetChannelFromSensetiveNodePath(path, orientation);
114 auto* pointCollection =
115 fPoints[component->GetVolumeName()][component->GetBranchName(ERDataObjectType::Point, orientation, channelSide)];
127 if (fVerboseLevel > 1) {
134 FairRootManager* ioman = FairRootManager::Instance();
136 Fatal(
"Init",
"IO manager is not set");
137 for (
const auto* component : fQTelescopeSetup->GetAllComponents()) {
138 if (!dynamic_cast<const ERTelescopeGeoComponentSensetive*>(component))
140 for (
const auto branchName : component->GetBranchNames(ERDataObjectType::Point)) {
141 LOG(DEBUG) <<
"[ERTelescope] Register branch " << branchName
142 <<
" for component " << component->GetVolumeName() << FairLogger::endl;
143 fPoints[component->GetVolumeName()][branchName] =
144 new TClonesArray(
"ERPoint", consts::approx_telescope_point_number);
145 ioman->Register(branchName,
"Telescope", fPoints[component->GetVolumeName()][branchName], kTRUE);
178 for(
auto& componentPoints : fPoints) {
179 for (
auto& branchPoints : componentPoints.second) {
180 branchPoints.second->Clear();
204 TString volName = name;
205 if(volName.BeginsWith(
"Sensitive")) {
Int_t fMot0TrackID
track index
Int_t fChannel
energy loss
virtual void Print(Option_t *option="") const
virtual void ConstructGeometry()
Builds geometry and writes it to temporary file trough parameters from ERBeamDetSetup class object...
TLorentzVector fMomIn
position
TLorentzVector fPosIn
mass
virtual void BeginEvent()
virtual Bool_t ProcessHits(FairVolume *vol=0)
Int_t fEventID
geometry version
Int_t fTrackID
event index
virtual TClonesArray * GetCollection(Int_t iColl) const
void AddPoint(TClonesArray &clref)
virtual void Initialize()
virtual void CopyClones(TClonesArray *cl1, TClonesArray *cl2, Int_t offset)
virtual void EndOfEvent()
The data class for storing pieces of charged tracks in sensitive volumes in NeuRad.
Double_t fMass
0th mother track index
virtual Bool_t CheckIfSensitive(std::string name)
The base class for detector simulation in er sim.