14 #include "FairGeoInterface.h"
15 #include "FairGeoLoader.h"
16 #include "FairGeoMedia.h"
17 #include "FairGeoNode.h"
18 #include "FairGeoVolume.h"
19 #include "FairLogger.h"
20 #include "FairRootManager.h"
22 #include "FairRuntimeDb.h"
23 #include "FairVolume.h"
25 #include "TClonesArray.h"
26 #include "TGeoManager.h"
27 #include "TGeoMaterial.h"
28 #include "TGeoMatrix.h"
30 #include "TObjArray.h"
31 #include "TVirtualMC.h"
44 , fTrdPoints(new TClonesArray(
"CbmTrdPoint"))
46 , fUseGlobalPhysicsProcesses(kTRUE)
47 , fCombiTrans(nullptr) {
64 , fTrdPoints(new TClonesArray(
"CbmTrdPoint"))
66 , fUseGlobalPhysicsProcesses(kTRUE)
67 , fCombiTrans(nullptr) {
86 FairDetector::Initialize();
90 Bool_t isSimulation = kTRUE;
98 FairRun* fRun = FairRun::Instance();
103 if (strcmp(fRun->GetName(),
"TGeant3") == 0) {
107 Int_t mat = gGeoManager->GetMaterialIndex(
"TRDgas");
108 TGeoMaterial* trdgas = gGeoManager->GetMaterial(mat);
110 Double_t mass = trdgas->GetA();
111 Double_t charge = trdgas->GetZ();
115 Int_t matIdVMC = mat + 1;
125 gMC->GetMaterial(matIdVMC, name, a, z, dens, radl, inter, par);
131 if ((TMath::Abs(mass - a) > 0.0001) || (TMath::Abs(charge - z)) > 0.0001) {
132 LOG(fatal) <<
"**********************************";
133 LOG(fatal) << TMath::Abs(mass - a) <<
" , " << TMath::Abs(charge - z);
134 LOG(fatal) <<
"Parameters from Geomanager:";
136 LOG(fatal) <<
"Parameters from Virtual Montecarlo:";
137 LOG(fatal) <<
"Name " << name <<
" Aeff=" << a <<
" Zeff=" << z;
138 Fatal(
"CbmTrd::SetSpecialPhysicsCuts",
139 "Material parameters different between TVirtualMC and TGeomanager");
144 gMC->Gstpar(matIdVMC,
"STRA", 1.0);
145 gMC->Gstpar(matIdVMC,
"PAIR", 1.0);
146 gMC->Gstpar(matIdVMC,
"COMP", 1.0);
147 gMC->Gstpar(matIdVMC,
"PHOT", 1.0);
148 gMC->Gstpar(matIdVMC,
"LOSS", 2.0);
150 gMC->Gstpar(matIdVMC,
"ANNI", 1.0);
151 gMC->Gstpar(matIdVMC,
"BREM", 1.0);
152 gMC->Gstpar(matIdVMC,
"HADR", 1.0);
154 gMC->Gstpar(matIdVMC,
"DCAY", 1.0);
155 gMC->Gstpar(matIdVMC,
"MULS", 1.0);
157 gMC->Gstpar(matIdVMC,
"DRAY", 1.0);
158 gMC->Gstpar(matIdVMC,
"RAYL", 1.0);
161 gMC->Gstpar(matIdVMC,
"CUTELE", 10.e-6);
162 gMC->Gstpar(matIdVMC,
"CUTGAM", 10.e-6);
163 gMC->Gstpar(matIdVMC,
"CUTNEU", 10.e-4);
164 gMC->Gstpar(matIdVMC,
"CUTHAD", 10.e-4);
165 gMC->Gstpar(matIdVMC,
"CUTMUO", 10.e-6);
166 gMC->Gstpar(matIdVMC,
"BCUTE", 10.e-6);
167 gMC->Gstpar(matIdVMC,
"BCUTM", 10.e-6);
168 gMC->Gstpar(matIdVMC,
"DCUTE", 10.e-6);
169 gMC->Gstpar(matIdVMC,
"DCUTM", 10.e-6);
170 gMC->Gstpar(matIdVMC,
"PPCUTM", -1.);
179 if (gMC->IsTrackEntering()) {
181 fTime = gMC->TrackTime() * 1.0e09;
183 gMC->TrackPosition(
fPosIn);
184 gMC->TrackMomentum(
fMomIn);
191 if (gMC->IsTrackExiting() || gMC->IsTrackStop()
192 || gMC->IsTrackDisappeared()) {
197 if (
fELoss == 0.)
return kFALSE;
199 Int_t trackId = gMC->GetStack()->GetCurrentTrackNumber();
203 new ((*fTrdPoints)[size])
228 if (fVerboseLevel)
Print();
237 FairRootManager::Instance()->Register(
"TrdPoint",
"Trd",
fTrdPoints, kTRUE);
255 LOG(info) << fName <<
": " << nHits <<
" points registered in this event.";
257 if (fVerboseLevel > 1) {
258 for (Int_t
i = 0;
i < nHits;
i++) {
259 (*fTrdPoints)[
i]->Print();
276 Int_t nEntries = cl1->GetEntriesFast();
277 LOG(info) <<
"CbmTrd: " << nEntries <<
" entries to add.";
278 TClonesArray& clref = *cl2;
279 for (Int_t
i = 0;
i < nEntries;
i++) {
281 Int_t index = oldpoint->GetTrackID() + offset;
282 oldpoint->SetTrackID(index);
286 LOG(info) <<
"CbmTrd: " << cl2->GetEntriesFast() <<
" merged entries.";
293 TString fileName = GetGeometryFileName();
294 if (fileName.EndsWith(
".root")) {
297 LOG(fatal) <<
"Geometry format of TRD file " << fileName.Data()
298 <<
" not supported.";
306 LOG(info) <<
"Importing TRD geometry from ROOT file " << fgeoName.Data();
309 LOG(info) <<
"Constructing TRD geometry from ROOT file " << fgeoName.Data();
310 FairModule::ConstructRootGeometry();
316 TString tsname = name;
317 if (tsname.EqualTo(
"gas")) {
318 LOG(debug) <<
"CbmTrd::CheckIfSensitive: Register active volume: "