FairRoot/PandaRoot
PndGeoHandling.cxx
Go to the documentation of this file.
1 //
2 // C++ Implementation: PndGeoHandling
3 //
4 // Description:
5 //
6 //
7 // Author: t.stockmanns <stockman@ikp455>, (C) 2007
8 //
9 // Copyright: See COPYING file that comes with this distribution
10 //
11 //
12 #include "PndGeoHandling.h"
13 #include "PndStringSeparator.h"
14 
15 #include "PndSensorNameContFact.h"
16 #include <vector>
17 #include <string>
18 #include "TROOT.h"
19 #include "TGeoVolume.h"
20 #include "TGeoShape.h"
21 #include "TGeoBBox.h"
22 #include "TList.h"
23 #include "TTree.h"
24 #include "FairMCEventHeader.h"
25 #include "FairParRootFileIo.h"
26 #include "FairBaseParSet.h"
27 
28 #include <math.h>
29 #include "stdlib.h"
30 
32 
33 
35 
37  if ( !fInstance){
38  std::cout<<"Info in (PndGeoHandling::Instance): Making a new instance using the framework."<<std::endl;
39  fInstance = new PndGeoHandling();
40  }
41  return fInstance;
42 }
43 
44 PndGeoHandling::PndGeoHandling():fGeoMan(0),fSensorNamePar(0),fRtdb(0),fLevelNames(),fLevel(0),fFullPath(true),fRunId(0),fVerbose(0)
45 {
46  if(fInstance) return;
47  fInstance = this;
48  FairRun* run = FairRun::Instance();
49 // if (!run) Fatal("PndGeoHandling","No FairRun object found. If used in a macro take another constructor.");
50 // run->AddTask((FairTask*)this);
51  if (run) {
52  this->SetName("PndGeoHandling");
53  this->SetTitle("FairTask");
54  run->AddTask((FairTask*)this);
55  fRtdb = run->GetRuntimeDb();
56 
57  }
58  else {
59  std::cout << "PndGeoHandling. No FairRun object found. If used in a macro take another constructor." << std::endl;
60  }
61 
62 }
63 
64 
65 PndGeoHandling::PndGeoHandling(PndSensorNamePar* SensorNamePar): fGeoMan(gGeoManager), fSensorNamePar(SensorNamePar),fRtdb(), fLevelNames(), fLevel(0),fFullPath(true), fRunId(0),fVerbose(0)
66 {
67  if (fInstance) return;
68  fInstance = this;
69 
70 }
71 
73 {
74  if (fRunId != 0) return; //SetParContainers was already called
75  if (fSensorNamePar != 0) return;
76  FairRun* run = FairRun::Instance();
77  if (!run) Fatal("PndGeoHandling","No FairRun object found.");
78  fRtdb = run->GetRuntimeDb();
79  if (!fRtdb) Fatal("PndGeoHandling","No runtime database found.");
80  fRunId = run->GetRunId();
81  if (fRunId < 0) Error("PndGeoHandling", "No valid run ID? %i",fRunId);
82  //if (!gGeoManager) GetGeoManager();
84  if (!fGeoMan) Fatal("PndGeoHandling","No gGeoManager found.");
85  fSensorNamePar = (PndSensorNamePar*) (fRtdb->getContainer("PndSensorNamePar"));
86  if ( ! fSensorNamePar) Fatal("PndGeoHandling","No PndSensorNamePar parameters found.");
87  fRtdb->initContainers(fRunId);
88  FairTask::SetParContainers();
89 }
90 
91 PndGeoHandling::PndGeoHandling(TString mcFile, TString parFile):fGeoMan(),fSensorNamePar(),fRtdb(),fLevelNames(),fLevel(0),fFullPath(true),fRunId(0),fVerbose(0)
92 {
93  if(fInstance) return;
94  fInstance = this;
95  InitRuntimeDb(parFile);
96  GetRunId(mcFile);
97  if (gGeoManager) {
99  } else
100  {
101  //Fatal("PndGeoHandling","No gGeoManager");
102  //return;
103  GetGeoManager();
105  }
106 
107 
109 }
110 
111 PndGeoHandling::PndGeoHandling(Int_t runId, TString parFile):fGeoMan(),fSensorNamePar(),fRtdb(),fLevelNames(),fLevel(0),fFullPath(true),fRunId(0),fVerbose(0)
112 {
113  if(fInstance) return;
114  fInstance = this;
115  InitRuntimeDb(parFile);
116  fRunId = runId;
117  if (gGeoManager) {
119  } else
120  {
121  //Fatal("PndGeoHandling","No gGeoManager");
122  //return;
123  GetGeoManager();
125  }
127 
128 }
129 
131 {
132  TFile f(mcFile.Data());
133  TTree* t = (TTree*)f.Get("pndsim");
134  FairMCEventHeader* header= new FairMCEventHeader();
135  t->SetBranchStatus("MCEventHeader.",1);
136  t->SetBranchAddress("MCEventHeader.", &header);
137  t->GetEntry(0);
138  fRunId = header->GetRunID();
139 
140  t->SetBranchStatus("MCEventHeader.",0);
141  return fRunId;
142 }
143 
145 {
146  fSensorNamePar = (PndSensorNamePar*) (fRtdb->getContainer("PndSensorNamePar"));
147 
148  fRtdb->initContainers(fRunId);
149 
150  if (fVerbose > 1){
151  std::cout << "PndGeoHandling::GetSensorNamePar()" << std::endl;
152  fRtdb->Print();
154  }
155 }
156 
158 {
159  fRtdb = FairRuntimeDb::instance();
160  FairParRootFileIo* parInput1 = new FairParRootFileIo(kTRUE);
161  parInput1->open(parFileName.Data(),"UPDATE");
162  fRtdb->setFirstInput(parInput1);
163  fRtdb->setOutput(parInput1);
164 }
165 
167 {
168  if (fRunId < 0)
169  return;
170  FairBaseParSet* par=(FairBaseParSet*)(fRtdb->getContainer("FairGeoParSet"));
171  fRtdb->initContainers(fRunId);
172  if(fVerbose>0) par->Print();
173 }
174 
175 /*
176  TString PndGeoHandling::GetCurrentID()
177  {
178  Int_t level;
179  Int_t copyNr[100];
180  Int_t volNr[100];
181  TString result;
182 
183  level = fGeoMan->GetLevel();
184  level++;
185 
186  fGeoMan->GetBranchNumbers(copyNr, volNr);
187  for (int i=0; i<level; i++){
188  result += volNr[i];
189  result += "_";
190  result += copyNr[i];
191  result += "/";
192  }
193  return result;
194  }
195  */
196 
197 /*
198  TString PndGeoHandling::GetID(TString path)
199  {
200  TString result;
201  TString currentPath = fGeoMan->GetPath();
202  fGeoMan->cd(path.Data());
203  result = GetCurrentID();
204  fGeoMan->cd(currentPath.Data());
205  return result;
206  }
207  */
208 
210 {
211  TObjString myPath(path.Data());
212  if (fSensorNamePar != 0){
213 // std::cout << "PndGeoHandling::GetShortID: " << std::endl;
214 // fSensorNamePar->Print();
215  return fSensorNamePar->SensorInList(&myPath);
216  }
217  else
218  std::cout << "-E- PndGeoHandling::GetShortID: SensorNamePar is missing!" << std::endl;
219  return -1;
220 }
221 
223 {
224  if (fSensorNamePar != 0){
225  return (fSensorNamePar->GetSensorName(shortID));
226  }
227  else {
228  std::cout << "-E- PndGeoHandling::GetPath(Int_t shortID): Missing SensorNamePar" << std::endl;
229  abort();
230  }
231 }
232 
233 /*
234  TString PndGeoHandling::GetPath(TString id)
235  {
236  TString result;
237  SetGeoManager(gGeoManager);
238  //std::cout << "-I- PndGeoHandling::GetPath : " << id.Data() << std::endl;
239  std::vector<std::string> idVector;
240  PndStringSeparator pathAna(id.Data(), "/_");
241  idVector = pathAna.GetStringVector();
242 
243  for(UInt_t i = 0; i < idVector.size(); i+=2){
244  result += "/";
245  Int_t VolId = atoi(idVector[i].c_str());
246  Int_t CopyNr = atoi(idVector[i+1].c_str());
247  // if(fVerbose>3) std::cout<<" -I- PndGeoHandling::GetPath: VolId = "<<VolId<<std::endl;
248  //std::cout << "-I- PndGeoHandling::GetPath : " << VolId;
249  //std::cout << " : " << fGeoMan->GetVolume(VolId)->GetName() << std::endl;
250  result += fGeoMan->GetVolume(VolId)->GetName();
251  result += "_";
252  result += CopyNr;
253  }
254  // if(fVerbose>2) std::cout<<" -I- PndGeoHandling::GetPath: result = "<<result.Data()<<std::endl;
255  return result;
256  }
257  */
258 
259 /*
260  Bool_t PndGeoHandling::cd(TString id)
261  {
262  return fGeoMan->cd(GetPath(id).Data());
263  }
264  */
266 {
267  return fGeoMan->cd(GetPath(id).Data());
268 }
269 
270 
272 {
273  TString result;
274  TGeoVolume* vol = fGeoMan->FindVolumeFast(name);
275  if (vol == 0)
276  return result;
277  result += vol->GetNumber();
278  return result;
279 }
280 
281 std::vector<TString> PndGeoHandling::GetNamesLevel(Int_t level, TString startPath) //, bool fullPath) //[R.K.03/2017] unused variable
282 {
283  TString actPath = fGeoMan->GetPath();
284  fLevelNames.clear();
285 
286  if (startPath == ""){
287  fGeoMan->CdTop();
288  fLevel = level;
289  }
290  else{
291  if (fGeoMan->cd(startPath.Data())== 0)
292  return fLevelNames;
293  else {
294  fLevel = fGeoMan->GetLevel() + level;
295  }
296  }
297  FillLevelNames();
298  return fLevelNames;
299 }
300 
302 {
303  TGeoNode* myNode = fGeoMan->GetCurrentNode();
304  if (fLevel == fGeoMan->GetLevel()){
305  if (fFullPath)
306  fLevelNames.push_back(fGeoMan->GetPath());
307  else
308  fLevelNames.push_back(myNode->GetName());
309  }
310  else {
311  Int_t nDaughters = myNode->GetNdaughters();
312  for (Int_t i = 0; i < nDaughters; i++){
313  fGeoMan->CdDown(i);
314  FillLevelNames();
315  fGeoMan->CdUp();
316  }
317  }
318 }
319 
320 void PndGeoHandling::GetOUVPath(TString path, TVector3& o, TVector3& u, TVector3& v)
321 {
322  Double_t result[3];
323  Double_t* temp;
324  TString actPath = fGeoMan->GetPath();
325  fGeoMan->cd(path);
326 
327  TGeoHMatrix* currMatrix = fGeoMan->GetCurrentMatrix();
328  temp = currMatrix->GetTranslation();
329  o.SetXYZ(temp[0], temp[1], temp[2]);
330 
331  temp[0] = 1;
332  temp[1] = 0;
333  temp[2] = 0;
334  fGeoMan->LocalToMasterVect(temp, result);
335  u.SetXYZ(result[0], result[1], result[2]);
336 
337  temp[0] = 0;
338  temp[1] = 1;
339  temp[2] = 0;
340  fGeoMan->LocalToMasterVect(temp, result);
341  v.SetXYZ(result[0], result[1], result[2]);
342 
343  if(actPath!="" && actPath!=" ") fGeoMan->cd(actPath);
344 }
345 
346 /*
347  void PndGeoHandling::GetOUVId(TString id, TVector3& o, TVector3& u, TVector3& v)
348  {
349  GetOUVPath(GetPath(id),o,u,v);
350  }
351  */
352 
354 {
355  TVector3 dim;
356  TString actPath = fGeoMan->GetPath();
357  fGeoMan->cd(path);
358 
359  TGeoVolume* actVolume = gGeoManager->GetCurrentVolume();
360  TGeoBBox* actBox = (TGeoBBox*)(actVolume->GetShape());
361  dim.SetX(actBox->GetDX());
362  dim.SetY(actBox->GetDY());
363  dim.SetZ(actBox->GetDZ());
364 
365  if(actPath!="" && actPath!=" ") fGeoMan->cd(actPath);
366  return dim;
367 }
368 
369 /*
370  TVector3 PndGeoHandling::GetSensorDimensionsId(TString id)
371  {
372  return GetSensorDimensionsPath(GetPath(id));
373  }
374  */
375 
377 {
378 // TString actPath = fGeoMan->GetPath();
379  fGeoMan->cd(path);
380 
381  TGeoHMatrix* currMatrix = fGeoMan->GetCurrentMatrix();
382 // if(actPath!="" && actPath!=" ") fGeoMan->cd(actPath);
383 
384  return currMatrix;
385 
386 }
387 
388 /*
389  TGeoHMatrix* PndGeoHandling::GetMatrixId(TString id)
390  {
391  return GetMatrixPath(GetPath(id));
392  }
393  */
394 
395 // ----- conversions of POINTS (not vectors) here -----
396 /*
397  TVector3 PndGeoHandling::MasterToLocalId(const TVector3& master, const TString& id)
398  { return MasterToLocalPath(master, GetPath(id) ); }
399  */
400 
401 TVector3 PndGeoHandling::MasterToLocalPath(const TVector3& master, const TString& path)
402 {
403  // if(fVerbose>1) std::cout<<" -I- PndGeoHandling::MasterToLocalPath"<<std::endl;
404  Double_t result[3];
405  Double_t temp[3];
406 
407  temp[0] = master.X();
408  temp[1] = master.Y();
409  temp[2] = master.Z();
410 
411  TString actPath = fGeoMan->GetPath();
412  fGeoMan->cd(path);
413  fGeoMan->MasterToLocal(temp, result);
414  if(actPath != "" && actPath != " ") fGeoMan->cd(actPath);
415  return TVector3(result[0],result[1],result[2]);
416 }
417 
418 
419 /*
420  TVector3 PndGeoHandling::LocalToMasterId(const TVector3& local, const TString& id)
421  { return LocalToMasterPath(local, GetPath(id) ); }
422  */
423 
424 TVector3 PndGeoHandling::LocalToMasterPath(const TVector3& local, const TString& path)
425 {
426  Double_t result[3];
427  Double_t temp[3];
428 
429  temp[0] = local.X();
430  temp[1] = local.Y();
431  temp[2] = local.Z();
432 
433  TString actPath = fGeoMan->GetPath();
434  fGeoMan->cd(path);
435  fGeoMan->LocalToMaster(temp, result);
436  if(actPath != "" && actPath != " ") fGeoMan->cd(actPath);
437  return TVector3(result[0],result[1],result[2]);
438 }
439 
440 
441 // ROTATION of error values, CAUTION - these are always psitive defined
442 /*
443  TVector3 PndGeoHandling::MasterToLocalErrorsId(const TVector3& master, const TString& id)
444  { return MasterToLocalErrorsPath(master, GetPath(id) ); }
445  */
447 {
448  TString actPath = fGeoMan->GetPath();
449  fGeoMan->cd(path);
451  TMatrixD result = rot;
452  result*=master;
453  rot.T();
454  result*=rot;
455  if(fVerbose>1){
456  std::cout<<" -I- PndGeoHandling::MasterToLocalErrorsPath: print matrices: master, rotation, result=R*M*R^T"<<std::endl;
457  master.Print();
458  rot.Print();
459  result.Print();
460  }
461  if(actPath != "" && actPath != " ") fGeoMan->cd(actPath);
462  return result;
463 }
464 
465 
466 /*
467  TVector3 PndGeoHandling::LocalToMasterErrorsId(const TVector3& local, const TString& id)
468  { return LocalToMasterErrorsPath(local, GetPath(id) ); }
469  */
470 
472 {
473  TString actPath = fGeoMan->GetPath();
474  fGeoMan->cd(path);
476  TMatrixD result = rot;
477  result.T();
478  result*=local;
479  result*=rot;
480  if(fVerbose>1){
481  std::cout<<" -I- PndGeoHandling::LocalToMasterErrorsPath: print matrices: master, rotation, result=R^T*M*R"<<std::endl;
482  local.Print();
483  rot.Print();
484  result.Print();
485  }
486  if(actPath != "" && actPath != " ") fGeoMan->cd(actPath);
487  return result;
488 }
489 
491 {
492  TMatrixD rot(3,3,fGeoMan->GetCurrentMatrix()->GetRotationMatrix());
493 // TMatrixD rot(3,3);
494 // rot[0][0] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[0];
495 // rot[0][1] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[1];
496 // rot[0][2] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[2];
497 // rot[1][0] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[3];
498 // rot[1][1] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[4];
499 // rot[1][2] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[5];
500 // rot[2][0] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[6];
501 // rot[2][1] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[7];
502 // rot[2][2] = fGeoMan->GetCurrentMatrix()->GetRotationMatrix()[8];
503  return rot;
504 }
505 
506 
508 {
509  // Find a nodes full path by going there in the gGeoManager
510  // With many volumes this becomes surely slow.
511  const char* oldpath = fGeoMan->GetPath();
512  fGeoMan->CdTop(); // dive down from top node
513  DiveDownToNode(node);
514  TString pathname = fGeoMan->GetPath();
515  fGeoMan->cd(oldpath);
516  return pathname;
517 }
518 
519 void PndGeoHandling::DiveDownToNode(TGeoNode* node)
520 {
521  // cd gGeoManager from the current node to a given node
522  TGeoNode *currentNode = fGeoMan->GetCurrentNode();
523  if (currentNode == node) return;
524  for (Int_t iNod=0; iNod<currentNode->GetNdaughters();iNod++)
525  {
526  fGeoMan->CdDown(iNod);
527  DiveDownToNode(node);
528  if (fGeoMan->GetCurrentNode() == node) return;
529  fGeoMan->CdUp();
530  }
531 }
532 
534 {
535  TGeoNode *currentNode = fGeoMan->GetCurrentNode();
536  TString nodeName(currentNode->GetName());
537  if (nodeName.Contains(name)){
538  return;
539  }
540  for (Int_t iNod = 0; iNod < currentNode->GetNdaughters(); iNod++) {
541  fGeoMan->CdDown(iNod);
543  nodeName = fGeoMan->GetCurrentNode()->GetName();
544  if (nodeName.Contains(name)){
545  return;
546  }
547  fGeoMan->CdUp();
548  }
549 }
550 
551 void PndGeoHandling::DiveDownToFillSensNamePar(std::vector<std::string> listOfSensitives)
552 {
553  if (fSensorNamePar != 0){
554  TGeoNode *currentNode = fGeoMan->GetCurrentNode();
555  TString nodeName(currentNode->GetName());
556  //std::cout << nodeName.Data() << std::endl;
557 
558  if (VolumeIsSensitive(nodeName, listOfSensitives)){
559  PndStringSeparator sep(nodeName.Data(), "/");
560  std::vector<std::string> sepString = sep.GetStringVector();
561  if (sepString.size() > 0 && sepString[sepString.size() - 1].find("PartAss") == std::string::npos){
562  TObjString* myName = new TObjString(fGeoMan->GetPath());
563  fSensorNamePar->AddSensorName(myName);
564  }
565  }
566  for (Int_t iNod = 0; iNod < currentNode->GetNdaughters(); iNod++) {
567  fGeoMan->CdDown(iNod);
568  DiveDownToFillSensNamePar(listOfSensitives);
569 
570  fGeoMan->CdUp();
571  }
572  }
573  else
574  std::cout << "-E- PndMvdGeoHandling::DiveDownToFillSensNamePar: fSensorNamePar does not exist!" << std::endl;
575 }
576 
577 void PndGeoHandling::cd(TGeoNode* node)
578 {
579  // go to a node in the gGeoManager without knowing the full path
580  // With many volumes this becomes surely slow.
581  fGeoMan->CdTop(); // dive down from top node
582  DiveDownToNode(node);
583  return;
584 }
585 
586 void PndGeoHandling::CreateUniqueSensorId(TString startName, std::vector<std::string> listOfSensitives)
587 {
588  fGeoMan->CdTop();
590  if (fVerbose > 0)
591  std::cout << "-I- PndMvdGeoHandling::CreateUniqueSensorId: StartNode: " << fGeoMan->GetPath() << std::endl;
592  DiveDownToFillSensNamePar(listOfSensitives);
593 }
594 
595 
596 bool PndGeoHandling::VolumeIsSensitive(TString& path, std::vector<std::string>& listOfSensitives)
597 {
598  for (unsigned int i = 0; i < listOfSensitives.size(); i++){
599  if (path.Contains(listOfSensitives[i].c_str()))
600  return true;
601  }
602  return false;
603 }
604 
605 
606 
607 
608 
TString FindNodePath(TGeoNode *node)
Int_t GetRunId(TString mcFile)
int fVerbose
Definition: poormantracks.C:24
void DiveDownToNode(TGeoNode *node)
void DiveDownToNodeContainingString(TString name)
runs through the GeoManager until a path is found with a substring which matches to the given string ...
cout<< "-----------------------------------------------> Quarter VOLUME<<endl;name="QuarterShape";QuarterShape=newTGeoArb8(name,dz,vertQuar);name="Quarter4Vol";TStringmedium="air";QuarterVol=newTGeoVolumeAssembly(name);name="SubunitShape";SubunitShape=newTGeoArb8(name,dz,vertSub);TStringmedium="air";name="SubunitVol";name1="SubunitVol1";name2="SubunitVol2";name3="SubunitVol3";name4="SubunitVol4";name5="SubunitVol5";name6="SubunitVol6";name7="SubunitVol7";name8="SubunitVol8";name9="SubunitVol9";SubunitVol=newTGeoVolumeAssembly(name);SubunitVol1=newTGeoVolumeAssembly(name1);SubunitVol2=newTGeoVolumeAssembly(name2);SubunitVol3=newTGeoVolumeAssembly(name3);SubunitVol4=newTGeoVolumeAssembly(name4);SubunitVol5=newTGeoVolumeAssembly(name5);SubunitVol6=newTGeoVolumeAssembly(name6);SubunitVol7=newTGeoVolumeAssembly(name7);SubunitVol8=newTGeoVolumeAssembly(name8);SubunitVol9=newTGeoVolumeAssembly(name9);name="BoxShape";BoxShape=newTGeoArb8(name,dz,vertBox);TStringmedium="air";name="BoxVol";BoxVol=newTGeoVolumeAssembly(name);name1="BoxVol1";name2="BoxVol2";name3="BoxVol3";name4="BoxVol4";BoxVol1=newTGeoVolumeAssembly(name1);BoxVol2=newTGeoVolumeAssembly(name2);BoxVol3=newTGeoVolumeAssembly(name3);BoxVol4=newTGeoVolumeAssembly(name4);for(Int_tb=0;b<kNumOfBoxes;b++){cout<<""<<endl;cout<<"---------------->BOXnumber:"<<b<<endl;if(b==0){trBox=newTGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(0.465518);rotBox.RotateY(-0.465518);}if(b==1){trBox=newTGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(-0.465518);rotBox.RotateY(0.465518);}if(b==2){trBox=newTGeoTranslation(tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(-0.465518);rotBox.RotateY(-0.465518);}if(b==3){trBox=newTGeoTranslation(-tr-kSpaceInSub-kAlveoleThickness-0.5*kSpaceInBox,tr+kSpaceInSub+kAlveoleThickness+0.5*kSpaceInBox,0.);rotBox=newTGeoRotation();rotBox.RotateX(0.465518);rotBox.RotateY(0.465518);}TGeoCombiTrans*trrotBox=newTGeoCombiTrans(trBox,rotBox);name="BoxVol";name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol->AddNode(BoxVol,b,trrotBox);if(b==1){name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol1->AddNode(BoxVol,b,trrotBox);}if(b==2){name+=b;trrotBox->SetName(name);trrotBox->RegisterYourself();SubunitVol2->AddNode(BoxVol1,b,trrotBox);}if(b==0){name+=b;trrotBox-> SetName(name)
Int_t run
Definition: autocutx.C:47
std::vector< std::string > GetStringVector(void)
Int_t i
Definition: run_full.C:25
TGeoHMatrix * GetMatrixPath(TString path)
std::vector< TString > fLevelNames
virtual void SetParContainers()
void CreateUniqueSensorId(TString startName, std::vector< std::string > listOfSensitives)
Has to be called during simulation to create unique sensor id.
Double_t par[3]
TString GetSensorName(Int_t index)
TVector3 GetSensorDimensionsPath(TString path)
Int_t SensorInList(TObjString *name)
FairRuntimeDb * fRtdb
TGeoManager * gGeoManager
TVector3 MasterToLocalPath(const TVector3 &master, const TString &id)
void FillLevelNames()
fills vector&lt;TString&gt; fLevelNames with the names (or the paths) of the volumes down to the level give...
static PndGeoHandling * fInstance
TString GetPath(Int_t shortID)
for a given shortID the path is returned
__m128 v
Definition: P4_F32vec4.h:4
Int_t AddSensorName(TObjString *name)
h_MC_angle SetTitle("MC truth: opening angle of #pi^{0}")
Class to access the naming information of the MVD.
TString GetVolumeID(TString name)
returns the volume ID for a given volume name
Double_t
TString parFile
Definition: hit_dirc.C:14
void GetOUVPath(TString path, TVector3 &o, TVector3 &u, TVector3 &v)
for a volume given by its path the o, u, v vectors for the plane are returned
TMatrixD GetCurrentRotationMatrix()
TFile * f
Definition: bump_analys.C:12
void InitRuntimeDb(TString parFileName)
TMatrixD LocalToMasterErrorsPath(const TMatrixD &local, const TString &id)
TString mcFile
Definition: runMvdTpcReco.C:22
Bool_t cd(Int_t id)
as the cd command of TGeoManager just with the ID
Int_t GetShortID(TString path)
for a given path the (unique) position of the sensor path in the fSensorNamePar-List is given...
TVector3 LocalToMasterPath(const TVector3 &local, const TString &id)
static PndGeoHandling * Instance()
TString name
FairParRootFileIo * parInput1
Definition: hit_dirc.C:67
TMatrixD MasterToLocalErrorsPath(const TMatrixD &master, const TString &id)
void DiveDownToFillSensNamePar(std::vector< std::string > listOfSensitives)
bool VolumeIsSensitive(TString &path, std::vector< std::string > &listOfSensitives)
Checks if the path contains a substring which matches one of the given strings in listOfSensitives...
ClassImp(PndAnaContFact)
TGeoRotation rot
TTree * t
Definition: bump_analys.C:13
PndSensorNamePar * fSensorNamePar
TGeoManager * fGeoMan
TMatrixT< double > TMatrixD
Definition: PndLmdDim.h:52
std::vector< TString > GetNamesLevel(Int_t level, TString startPath="")
PndGeoHandling()
default constructor. Has to be called in SetParContainers if the support of shortId is needed...
Unique match between SensorID and path in TGeoManager.