12 #include "FairRunAna.h"
13 #include "FairRuntimeDb.h"
15 #include "TDirectory.h"
20 #include "TGeoManager.h"
21 #include "TGeoMatrix.h"
22 #include "TGeoMedium.h"
24 #include "TGeoShape.h"
25 #include "TGeoSphere.h"
26 #include "TGeoVolume.h"
27 #include "TProfile2D.h"
44 , fNofMuchStations(-1)
73 cout <<
"Getting MUCH layout for parallel version of tracking...\n";
77 TString(gSystem->Getenv(
"VMCWORKDIR")) + TString(
"/parameters");
78 TString matBudgetFile = parDir +
"/littrack/much_v12b.silicon.root";
79 TFile* oldFile = gFile;
80 TDirectory* oldDirectory = gDirectory;
81 TFile* file =
new TFile(matBudgetFile,
"READ");
87 TGeoNode* much =
nullptr;
88 TObjArray* nodes = gGeoManager->GetTopVolume()->GetNodes();
89 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
90 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
91 if (TString(node->GetName())
92 .Contains(
"much", TString::kIgnoreCase)) {
98 TObjArray* muchNodes = much->GetNodes();
99 Int_t currentStation = 0;
100 Int_t currentLayer = 0;
101 for (Int_t iMuchNode = 0; iMuchNode < muchNodes->GetEntriesFast();
103 const TGeoNode* muchNode =
104 static_cast<const TGeoNode*
>(muchNodes->At(iMuchNode));
106 if (TString(muchNode->GetName()).Contains(
"station")) {
107 TObjArray* layerNodes = muchNode->GetNodes();
109 for (Int_t iLayerNode = 0; iLayerNode < layerNodes->GetEntriesFast();
111 const TGeoNode* layer =
112 static_cast<const TGeoNode*
>(layerNodes->At(iLayerNode));
114 Double_t z = much->GetMatrix()->GetTranslation()[2]
115 + muchNode->GetMatrix()->GetTranslation()[2]
116 + layer->GetMatrix()->GetTranslation()[2];
119 TProfile2D* profile =
121 ? hm.
P2(
"hrl_ThicknessSilicon_MuchAbsorber_"
122 + Cbm::ToString<Int_t>(currentStation) +
"_P2")
123 : hm.
P2(
"hrl_ThicknessSilicon_Much_"
124 + Cbm::ToString<Int_t>(currentLayer) +
"_P2");
145 gDirectory = oldDirectory;
150 cout <<
"Finish getting MUCH layout for parallel version of tracking\n";
166 cout <<
"Getting TRD layout for parallel version of tracking...\n";
170 TString(gSystem->Getenv(
"VMCWORKDIR")) + TString(
"/parameters");
171 TString matBudgetFile = parDir +
"/littrack/trd_v13p_3e.silicon.root";
172 TFile* oldFile = gFile;
173 TDirectory* oldDirectory = gDirectory;
174 TFile* file =
new TFile(matBudgetFile,
"READ");
180 Double_t startZPosition = 100.;
188 Int_t nofVirtualStations = 31;
189 for (Int_t iStation = 0; iStation < nofVirtualStations; iStation++) {
190 Double_t z = startZPosition + iStation * dZ;
197 if (iStation == 10) station.
SetMaterial(richMaterial);
204 for (Int_t iStation = 0; iStation < nofStations; iStation++) {
206 TProfile2D* profile = hm.
P2(
"hrl_ThicknessSilicon_Trd_"
207 + Cbm::ToString<Int_t>(iStation) +
"_P2");
222 gDirectory = oldDirectory;
227 cout <<
"Finish getting TRD layout for parallel version of tracking\n";
235 TString(gSystem->Getenv(
"VMCWORKDIR")) + TString(
"/parameters");
236 TString matBudgetFile = parDir +
"/littrack/rich_v08a.silicon.root";
237 TFile* oldFile = gFile;
238 TDirectory* oldDirectory = gDirectory;
239 TFile* file =
new TFile(matBudgetFile,
"READ");
243 TProfile2D* profile = hm.
P2(
"hrl_ThicknessSilicon_Rich_P2");
248 gDirectory = oldDirectory;
254 const TProfile2D* profile,
256 Double_t maximumValue) {
274 Int_t nofBinsX = profile->GetNbinsX();
275 Int_t nofBinsY = profile->GetNbinsY();
280 Bool_t isSet =
false;
281 for (Int_t iBinX = 1; iBinX <= nofBinsX; iBinX++) {
282 for (Int_t iBinY = 1; iBinY <= nofBinsY; iBinY++) {
283 Double_t content = profile->GetBinContent(iBinX, iBinY);
285 minShrinkBinX =
std::min(iBinX, minShrinkBinX);
286 maxShrinkBinX =
std::max(iBinX, maxShrinkBinX);
287 minShrinkBinY =
std::min(iBinY, minShrinkBinY);
288 maxShrinkBinY =
std::max(iBinY, maxShrinkBinY);
294 Int_t nofShrinkBinsX = maxShrinkBinX - minShrinkBinX + 1;
295 Int_t nofShrinkBinsY = maxShrinkBinY - minShrinkBinY + 1;
296 vector<vector<fscal>> material(nofShrinkBinsX);
297 for (Int_t
i = 0;
i < nofShrinkBinsX;
i++)
298 material[
i].resize(nofShrinkBinsY);
300 for (Int_t iX = minShrinkBinX; iX <= maxShrinkBinX; iX++) {
301 for (Int_t iY = minShrinkBinY; iY <= maxShrinkBinY; iY++) {
302 Double_t content = profile->GetBinContent(iX, iY);
303 if (maximumValue > 0 && content > maximumValue) content = maximumValue;
304 material[iX - minShrinkBinX][iY - minShrinkBinY] = content;
307 Double_t xmin = profile->GetXaxis()->GetBinLowEdge(minShrinkBinX);
308 Double_t xmax = profile->GetXaxis()->GetBinUpEdge(maxShrinkBinX);
309 Double_t ymin = profile->GetYaxis()->GetBinLowEdge(minShrinkBinY);
310 Double_t ymax = profile->GetYaxis()->GetBinUpEdge(maxShrinkBinY);
312 material, xmin, xmax, ymin, ymax, nofShrinkBinsX, nofShrinkBinsY);
316 static Bool_t firstTime =
true;
318 Int_t layerCounter = 0;
319 TObjArray* topNodes =
fGeo->GetTopNode()->GetNodes();
320 for (Int_t iTopNode = 0; iTopNode < topNodes->GetEntriesFast();
322 TGeoNode* topNode =
static_cast<TGeoNode*
>(topNodes->At(iTopNode));
323 if (TString(topNode->GetName()).Contains(
"trd")) {
324 TObjArray* layers = topNode->GetNodes();
325 for (Int_t iLayer = 0; iLayer < layers->GetEntriesFast(); iLayer++) {
326 TGeoNode* layer =
static_cast<TGeoNode*
>(layers->At(iLayer));
327 if (TString(layer->GetName()).Contains(
"layer")) { layerCounter++; }
338 static Bool_t firstTime =
true;
341 TGeoNode* much =
nullptr;
342 TObjArray* nodes = gGeoManager->GetTopVolume()->GetNodes();
343 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
344 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
345 if (TString(node->GetName())
346 .Contains(
"much", TString::kIgnoreCase)) {
355 TObjArray* muchNodes = much->GetNodes();
356 for (Int_t iMuchNode = 0; iMuchNode < muchNodes->GetEntriesFast();
358 const TGeoNode* muchNode =
359 static_cast<const TGeoNode*
>(muchNodes->At(iMuchNode));
360 if (TString(muchNode->GetName()).Contains(
"station")) {
362 if (TString(muchNode->GetName()).Contains(
"muchstation")) {
363 TObjArray* layerNodes = muchNode->GetNodes();
367 TObjArray* muchSubNodes = muchNode->GetNodes();
368 for (Int_t iMuchSubNode = 0;
369 iMuchSubNode < muchSubNodes->GetEntriesFast();
371 const TGeoNode* muchSubNode =
372 static_cast<const TGeoNode*
>(muchSubNodes->At(iMuchSubNode));
373 TObjArray* layerNodes = muchSubNode->GetNodes();
385 static Bool_t firstTime =
true;
388 const TGeoNode* much =
static_cast<const TGeoNode*
>(
389 fGeo->GetTopNode()->GetNodes()->FindObject(
"much_0"));
394 TObjArray* muchNodes = much->GetNodes();
395 for (Int_t iMuchNode = 0; iMuchNode < muchNodes->GetEntriesFast();
397 const TGeoNode* muchNode =
398 static_cast<const TGeoNode*
>(muchNodes->At(iMuchNode));
399 if (TString(muchNode->GetName()).Contains(
"absorber")) {
401 if (TString(muchNode->GetName()).Contains(
"muchabsorber")) {
405 TObjArray* muchSubNodes = muchNode->GetNodes();
420 static Bool_t firstTime =
true;
423 TGeoNode* topNode = gGeoManager->GetTopVolume()->FindNode(
"pipevac1_0");
425 TObjArray* nodes = topNode->GetNodes();
426 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
427 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
428 if (TString(node->GetName()).Contains(
"mvdstation")) {
433 TObjArray* nodes = gGeoManager->GetTopNode()->GetNodes();
434 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
435 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
436 TString nodeName = node->GetName();
438 if (nodeName.Contains(
"pipe")) {
439 TObjArray* nodes2 = node->GetNodes();
440 for (Int_t iiNode = 0; iiNode < nodes2->GetEntriesFast(); iiNode++) {
441 TGeoNode* node2 = (TGeoNode*) nodes2->At(iiNode);
442 TString nodeName2 = node2->GetName();
444 if (nodeName2.Contains(
"pipevac1")) {
446 TObjArray* nodes3 = node2->GetNodes();
447 for (Int_t iiiNode = 0; iiiNode < nodes3->GetEntriesFast();
449 TGeoNode* node3 = (TGeoNode*) nodes3->At(iiiNode);
450 TString nodeName3 = node3->GetName();
452 if (nodeName3.Contains(
"mvd")) {
457 TObjArray* nodes4 = node3->GetNodes();
458 for (Int_t iiiiNode = 0; iiiiNode < nodes4->GetEntriesFast();
460 TGeoNode* node4 = (TGeoNode*) nodes4->At(iiiiNode);
461 TString nodeName4 = node4->GetName();
481 static Bool_t firstTime =
true;
484 TObjArray* nodes = gGeoManager->GetTopVolume()->GetNodes();
485 for (Int_t iNode = 0; iNode < nodes->GetEntriesFast(); iNode++) {
486 TGeoNode* node = (TGeoNode*) nodes->At(iNode);
487 if (TString(node->GetName()).Contains(
"STS_")) {
500 static Bool_t firstTime =
true;
501 static vector<Int_t> sumOfLayers;
504 const TGeoNode* much =
static_cast<const TGeoNode*
>(
505 fGeo->GetTopNode()->GetNodes()->FindObject(
"much_0"));
510 map<Int_t, Int_t> nofLayersPerStation;
511 TObjArray* muchNodes = much->GetNodes();
512 for (Int_t iMuchNode = 0; iMuchNode < muchNodes->GetEntriesFast();
514 const TGeoNode* muchNode =
515 static_cast<const TGeoNode*
>(muchNodes->At(iMuchNode));
516 if (TString(muchNode->GetName()).Contains(
"station")) {
518 if (TString(muchNode->GetName()).Contains(
"muchstation")) {
520 std::atoi(
string(muchNode->GetName() + 11, 2).c_str()) - 1;
521 TObjArray* layerNodes = muchNode->GetNodes();
522 nofLayersPerStation[station] = layerNodes->GetEntriesFast();
525 TObjArray* muchSubNodes = muchNode->GetNodes();
526 for (Int_t iMuchSubNode = 0;
527 iMuchSubNode < muchSubNodes->GetEntriesFast();
529 const TGeoNode* muchSubNode =
530 static_cast<const TGeoNode*
>(muchSubNodes->At(iMuchSubNode));
532 std::atoi(
string(muchSubNode->GetName() + 11, 2).c_str()) - 1;
533 TObjArray* layerNodes = muchSubNode->GetNodes();
534 nofLayersPerStation[station] += layerNodes->GetEntriesFast();
539 map<Int_t, Int_t>::const_iterator it;
541 sumOfLayers.push_back(0);
542 for (it = nofLayersPerStation.begin(); it != nofLayersPerStation.end();
545 sumOfLayers.push_back(sum);
549 return sumOfLayers[station] + layer;