15 #include "FairGeoInterface.h"
16 #include "FairGeoLoader.h"
17 #include "FairGeoNode.h"
18 #include "FairGeoRootBuilder.h"
19 #include "FairRootManager.h"
21 #include "FairRuntimeDb.h"
22 #include "FairVolume.h"
24 #include "TClonesArray.h"
25 #include "TGeoMCGeometry.h"
27 #include "TObjArray.h"
28 #include "TParticle.h"
29 #include "TVirtualMC.h"
31 #include "FairGeoMedia.h"
32 #include "FairGeoMedium.h"
34 #include "TGeoBoolNode.h"
35 #include "TGeoCompositeShape.h"
37 #include "TGeoManager.h"
38 #include "TGeoMatrix.h"
40 #include "TGeoVolume.h"
49 #include "TGeoMatrix.h"
77 , fMuchCollection(new TClonesArray(
"CbmMuchPoint"))
79 , flGeoPar(new TList())
84 flGeoPar->SetName(GetName());
92 : FairDetector(name, active)
104 , fMuchCollection(new TClonesArray(
"CbmMuchPoint"))
106 , flGeoPar(new TList())
133 if (gMC->IsTrackEntering()) {
135 fTime = gMC->TrackTime() * 1.0e09;
137 gMC->TrackPosition(
fPosIn);
138 gMC->TrackMomentum(
fMomIn);
145 if (gMC->IsTrackExiting() || gMC->IsTrackStop()
146 || gMC->IsTrackDisappeared()) {
147 fTrackID = gMC->GetStack()->GetCurrentTrackNumber();
151 if (fVerboseLevel > 2) {
164 assert(iStation >= 0 && iStation < fPar->GetNStations());
174 if (
fELoss == 0.)
return kFALSE;
200 TString name = vol->GetName();
201 Char_t cStationNr[3] = {name[11], name[12],
' '};
202 Int_t iStation = atoi(cStationNr) - 1;
203 Int_t iLayer = TString(name[18]).Atoi() - 1;
204 Int_t iSide = (name[19] ==
'b') ? 1 : 0;
205 Char_t cModuleNr[4] = {name[26], name[27], name[28],
' '};
206 Int_t iModule = atoi(cModuleNr) - 1;
207 if (iSide != 1 && iSide != 0) printf(
"side = %i", iSide);
214 assert(detectorId > 0);
225 if (fVerboseLevel)
Print(
"");
232 FairRootManager::Instance()->Register(
249 LOG(info) << fName <<
": " << nHits <<
" points registered in this event.";
260 Int_t nEntries = cl1->GetEntriesFast();
261 LOG(info) << fName <<
": " << nEntries <<
" entries to add.";
262 TClonesArray& clref = *cl2;
264 for (Int_t
i = 0;
i < nEntries;
i++) {
266 Int_t index = oldpoint->GetTrackID() + offset;
267 oldpoint->SetTrackID(index);
271 LOG(info) << fName <<
": " << cl2->GetEntriesFast() <<
" merged entries.";
288 Int_t size = clref.GetEntriesFast();
289 if (fVerboseLevel > 1)
290 LOG(info) << fName <<
": Adding Point at (" << posIn.X() <<
", "
291 << posIn.Y() <<
", " << posIn.Z() <<
") cm, detector " << detID
292 <<
", track " << trackID <<
", energy loss " << eLoss * 1e06
296 trackID, detID, posIn, posOut, momIn, momOut, time, length, eLoss);
302 TString fileName = GetGeometryFileName();
305 if (!fileName.EndsWith(
".root")) {
306 LOG(fatal) << GetName() <<
": Geometry format of file " << fileName.Data()
307 <<
" not supported.";
310 if (fileName.Contains(
"mcbm")) {
313 LOG(info) <<
"mcbm geometry found ";
321 FairRun* fRun = FairRun::Instance();
323 Fatal(
"CreateGeometry",
"No FairRun found");
326 FairRuntimeDb* rtdb = FairRuntimeDb::instance();
336 TGeoMatrix* tempMatrix {
nullptr};
339 LOG(info) <<
"Importing MUCH geometry from ROOT file " << fgeoName.Data();
342 LOG(info) <<
"Constructing MUCH geometry from ROOT file "
344 FairModule::ConstructRootGeometry();
350 TGeoNode* ncave = gGeoManager->GetTopNode();
355 TGeoNode* nmuch = (TGeoNode*) ncave->GetNodes()->FindObject(objName);
356 fPassNodes->Add(nmuch);
359 TObjArray* nodes = nmuch->GetNodes();
361 for (Int_t
i = 0;
i < nodes->GetEntriesFast();
i++) {
362 TGeoNode* node = (TGeoNode*) nodes->At(
i);
363 TString nodeName = node->GetName();
366 TObjArray* nodes1 = node->GetNodes();
368 for (Int_t j = 0; j < nodes1->GetEntriesFast(); j++) {
369 TGeoNode* node1 = (TGeoNode*) nodes1->At(j);
370 TString node1Name = node1->GetName();
372 if (node1Name.Contains(
"absblock")) fPassNodes->Add(node);
373 if (node1Name.Contains(
"muchstation")) {
375 TObjArray* layers = node1->GetNodes();
376 for (Int_t l = 0; l < layers->GetEntriesFast(); l++) {
377 TGeoNode* layer = (TGeoNode*) layers->At(l);
379 if (!TString(layer->GetName()).Contains(
"layer"))
continue;
380 TObjArray* layerNodes = layer->GetNodes();
381 for (Int_t
m = 0;
m < layerNodes->GetEntriesFast();
m++) {
382 TGeoNode* layerNode = (TGeoNode*) layerNodes->At(
m);
383 TString layerNodeName = layerNode->GetName();
385 if (layerNodeName.Contains(
"active")) fSensNodes->Add(layerNode);
387 if (layerNodeName.Contains(
"support")) fPassNodes->Add(layerNode);
389 if (layerNodeName.Contains(
"cool")) fPassNodes->Add(layerNode);
397 fPar->setInputVersion(fRun->GetRunId(), 1);
403 TString tsname = name;
406 if (tsname.Contains(
"active")) {
407 LOG(debug1) <<
"CbmMuch::CheckIfSensitive: Register active volume: "