FairRoot/PandaRoot
PndLmdDetector.cxx
Go to the documentation of this file.
1 #include "PndLmdDetector.h"
2 
3 #include "TClonesArray.h"
4 #include "TGeoPhysicalNode.h"
5 #include "TVirtualMC.h"
6 
7 #include <iostream>
8 
9 // ----- Default constructor -------------------------------------------
12 }
13 
14 // ----- Standard constructor ------------------------------------------
16  PndSdsDetector(name, active) {
18 }
19 
20 // ----- Destructor ----------------------------------------------------
22 }
23 
24 void PndLmdDetector::SetBranchNames(char* outBranchname, char* folderName) {
25  fOutBranchName = outBranchname;
26  fFolderName = folderName;
27 }
28 
30  fOutBranchName = "LMDPoint";
31  fFolderName = "PndLmd";
32 }
33 
35  fListOfSensitives.push_back("LumActive");
36 }
37 
39  LOG(INFO) << "Modifying the geometry for the Lmd detector." << FairLogger::endl;
40 
41  TString detStr = "lmd_root";
42 
43  TGeoPNEntry* entry = gGeoManager->GetAlignableEntry(detStr.Data());
44  if (entry) {
45  LOG(INFO) << "Modifying using symlinks." << FairLogger::endl;
47  }
48  else {
49  LOG(INFO) << "Modifying using full path." << FairLogger::endl;
51  }
52  LOG(DEBUG) << "Align in total " << fAlignmentMatrices.size() << " detectors." << FairLogger::endl;
53  std::cout << "PndLmdDetector:modifyGeometry: success!\n";
54 }
55 
57  TString volPath;
58 
59  for (auto const& entry : fAlignmentMatrices) {
60  volPath = entry.first;
61 
62  gGeoManager->cd(volPath);
63 
64  TGeoNode* n3 = gGeoManager->GetCurrentNode();
65  TGeoMatrix* l3 = n3->GetMatrix();
66 
67  TGeoHMatrix nlocal = *l3 * entry.second;
68  TGeoHMatrix* nl3 = new TGeoHMatrix(nlocal); // new matrix, representing real position
69  // (from new local mis RS to the global one)
70 
71  TGeoPhysicalNode* pn3 = gGeoManager->MakePhysicalNode(volPath);
72 
73  pn3->Align(nl3);
74  }
75 }
76 
78  TString detStr;
79  for (auto const& alignment_matrix : fAlignmentMatrices) {
80  detStr = alignment_matrix.first;
81 
82  TGeoPhysicalNode* node = NULL;
83  TGeoPNEntry* entry = gGeoManager->GetAlignableEntry(detStr);
84  if (entry) {
85  node = gGeoManager->MakeAlignablePN(entry);
86  }
87 
88  TGeoMatrix* l3 = NULL;
89  if (node) {
90  l3 = node->GetMatrix();
91  }
92  else {
93  continue;
94  }
95 
96  TGeoHMatrix nlocal = *l3 * alignment_matrix.second;
97  TGeoHMatrix* nl3 = new TGeoHMatrix(nlocal); // new matrix, representing real position
98  // (from new local mis RS to the global one)
99  node->Align(nl3);
100  }
101 }
102 
104  const std::map<std::string, TGeoHMatrix>& alignmentMatrices) {
105  fAlignmentMatrices = alignmentMatrices;
106 }
107 
void SetMisalignmentMatrices(const std::map< std::string, TGeoHMatrix > &alignmentMatrices)
void ModifyGeometryByFullPath()
void ModifyGeometryBySymlink()
std::vector< std::string > fListOfSensitives
To be set by daughter classes.
TGeoManager * gGeoManager
std::map< std::string, TGeoHMatrix > fAlignmentMatrices
#define DEBUG
virtual void SetDefaultSensorNames()
virtual ~PndLmdDetector()
void SetDetectorID(DetectorId id)
virtual void SetBranchNames()
TString name
ClassImp(PndAnaContFact)
TString fOutBranchName
enables the detection of neutral particles
TString fFolderName
To be set by daughter classes.