19 #include "TGeoVolume.h"
20 #include "TGeoShape.h"
38 std::cout<<
"Info in (PndGeoHandling::Instance): Making a new instance using the framework."<<std::endl;
52 this->SetName(
"PndGeoHandling");
53 this->SetTitle(
"FairTask");
57 std::cout <<
"PndGeoHandling. No FairRun object found. If used in a macro take another constructor." << std::endl;
65 if (!run) Fatal(
"PndGeoHandling",
"No FairRun object found.");
67 if (!
fRtdb) Fatal(
"PndGeoHandling",
"No runtime database found.");
69 if (
fRunId < 0) Error(
"PndGeoHandling",
"No valid run ID? %i",
fRunId);
72 if (!
fGeoMan) Fatal(
"PndGeoHandling",
"No gGeoManager found.");
74 if ( !
fSensorNamePar) Fatal(
"PndGeoHandling",
"No PndSensorNamePar parameters found.");
120 TFile f(mcFile.Data());
121 TTree*
t = (TTree*)f.Get(
"cbmsim");
123 t->SetBranchStatus(
"MCEventHeader.",1);
124 t->SetBranchAddress(
"MCEventHeader.", &header);
128 t->SetBranchStatus(
"MCEventHeader.",0);
139 std::cout <<
"PndGeoHandling::GetSensorNamePar()" << std::endl;
149 parInput1->
open(parFileName.Data(),
"UPDATE");
199 TObjString myPath(path.Data());
206 std::cout <<
"-E- PndGeoHandling::GetShortID: SensorNamePar is missing!" << std::endl;
216 std::cout <<
"-E- PndGeoHandling::GetPath(Int_t shortID): Missing SensorNamePar" << std::endl;
262 TGeoVolume* vol =
fGeoMan->FindVolumeFast(name);
265 result += vol->GetNumber();
271 TString actPath =
fGeoMan->GetPath();
274 if (startPath ==
""){
279 if (
fGeoMan->cd(startPath.Data())== 0)
291 TGeoNode* myNode =
fGeoMan->GetCurrentNode();
299 Int_t nDaughters = myNode->GetNdaughters();
300 for (Int_t i = 0; i < nDaughters; i++){
312 TString actPath =
fGeoMan->GetPath();
315 TGeoHMatrix* currMatrix =
fGeoMan->GetCurrentMatrix();
316 temp = currMatrix->GetTranslation();
317 o.SetXYZ(temp[0], temp[1], temp[2]);
322 fGeoMan->LocalToMasterVect(temp, result);
323 u.SetXYZ(result[0], result[1], result[2]);
328 fGeoMan->LocalToMasterVect(temp, result);
329 v.SetXYZ(result[0], result[1], result[2]);
331 if(actPath!=
"" && actPath!=
" ")
fGeoMan->cd(actPath);
344 TString actPath =
fGeoMan->GetPath();
347 TGeoVolume* actVolume = gGeoManager->GetCurrentVolume();
348 TGeoBBox* actBox = (TGeoBBox*)(actVolume->GetShape());
349 dim.SetX(actBox->GetDX());
350 dim.SetY(actBox->GetDY());
351 dim.SetZ(actBox->GetDZ());
353 if(actPath!=
"" && actPath!=
" ")
fGeoMan->cd(actPath);
366 TString actPath =
fGeoMan->GetPath();
369 TGeoHMatrix* currMatrix =
fGeoMan->GetCurrentMatrix();
370 if(actPath!=
"" && actPath!=
" ")
fGeoMan->cd(actPath);
395 temp[0] = master.X();
396 temp[1] = master.Y();
397 temp[2] = master.Z();
399 TString actPath =
fGeoMan->GetPath();
401 fGeoMan->MasterToLocal(temp, result);
402 if(actPath !=
"" && actPath !=
" ")
fGeoMan->cd(actPath);
403 return TVector3(result[0],result[1],result[2]);
421 TString actPath =
fGeoMan->GetPath();
423 fGeoMan->LocalToMaster(temp, result);
424 if(actPath !=
"" && actPath !=
" ")
fGeoMan->cd(actPath);
425 return TVector3(result[0],result[1],result[2]);
436 TString actPath =
fGeoMan->GetPath();
439 TMatrixD result = rot;
444 std::cout<<
" -I- PndGeoHandling::MasterToLocalErrorsPath: print matrices: master, rotation, result=R*M*R^T"<<std::endl;
449 if(actPath !=
"" && actPath !=
" ")
fGeoMan->cd(actPath);
461 TString actPath =
fGeoMan->GetPath();
464 TMatrixD result = rot;
469 std::cout<<
" -I- PndGeoHandling::LocalToMasterErrorsPath: print matrices: master, rotation, result=R^T*M*R"<<std::endl;
474 if(actPath !=
"" && actPath !=
" ")
fGeoMan->cd(actPath);
480 TMatrixD rot(3,3,
fGeoMan->GetCurrentMatrix()->GetRotationMatrix());
499 const char* oldpath =
fGeoMan->GetPath();
502 TString pathname =
fGeoMan->GetPath();
510 TGeoNode *currentNode =
fGeoMan->GetCurrentNode();
511 if (currentNode == node)
return;
512 for (Int_t iNod=0; iNod<currentNode->GetNdaughters();iNod++)
516 if (
fGeoMan->GetCurrentNode() == node)
return;
523 TGeoNode *currentNode =
fGeoMan->GetCurrentNode();
524 TString nodeName(currentNode->GetName());
525 if (nodeName.Contains(name)){
528 for (Int_t iNod = 0; iNod < currentNode->GetNdaughters(); iNod++) {
531 nodeName =
fGeoMan->GetCurrentNode()->GetName();
532 if (nodeName.Contains(name)){
542 TGeoNode *currentNode =
fGeoMan->GetCurrentNode();
543 TString nodeName(currentNode->GetName());
549 if (sepString.size() > 0 && sepString[sepString.size() - 1].find(
"PartAss") == std::string::npos){
550 TObjString* myName =
new TObjString(
fGeoMan->GetPath());
554 for (Int_t iNod = 0; iNod < currentNode->GetNdaughters(); iNod++) {
562 std::cout <<
"-E- PndMvdGeoHandling::DiveDownToFillSensNamePar: fSensorNamePar does not exist!" << std::endl;
579 std::cout <<
"-I- PndMvdGeoHandling::CreateUniqueSensorId: StartNode: " <<
fGeoMan->GetPath() << std::endl;
586 for (
unsigned int i = 0; i < listOfSensitives.size(); i++){
587 if (path.Contains(listOfSensitives[i].c_str()))