eventAnalysis  7.0-49-g0ac7482
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TGeometrySummaryModule.cxx
Go to the documentation of this file.
2 #include <TTrackState.hxx>
3 #include <cmath>
4 #include <vector>
5 
6 #include <ND280GeomId.hxx>
7 #include <TFGDGeom.hxx>
8 #include <TGeomIdManager.hxx>
9 #include <TGeomInfo.hxx>
10 #include <TGeomVisitor.hxx>
11 #include <TOADatabase.hxx>
12 #include <TP0DGeom.hxx>
13 
16 
17 #define CVSTAG \
18  "\
19  $Name$"
20 #define CVSID \
21  "\
22 "
23 
25  const char *title) {
26  SetNameTitle(name, title);
27  fIsEnabled = kTRUE;
28  fDescription = "Summary of ROOT geometry";
30  fCVSID = CVSID;
31 }
32 
33 Bool_t ND::TGeometrySummaryModule::ProcessFirstEvent(ND::TND280Event &event) {
34  return true;
35 }
36 
38  fFGD1 = new TDetectorBoundingBox();
39  fFGD1Active = new TDetectorBoundingBox();
40  fFGD2 = new TDetectorBoundingBox();
41  fFGD2Active = new TDetectorBoundingBox();
42  fTPC1 = new TDetectorBoundingBox();
43  fTPC2 = new TDetectorBoundingBox();
44  fTPC3 = new TDetectorBoundingBox();
45  fP0D = new TDetectorBoundingBox();
46  fP0DActive = new TDetectorBoundingBox();
47  fTECAL1 = new TDetectorBoundingBox();
48  fTECAL2 = new TDetectorBoundingBox();
49  fTECAL3 = new TDetectorBoundingBox();
50  fTECAL4 = new TDetectorBoundingBox();
51  fTECAL5 = new TDetectorBoundingBox();
52  fTECAL6 = new TDetectorBoundingBox();
53  fPECAL1 = new TDetectorBoundingBox();
54  fPECAL2 = new TDetectorBoundingBox();
55  fPECAL3 = new TDetectorBoundingBox();
56  fPECAL4 = new TDetectorBoundingBox();
57  fPECAL5 = new TDetectorBoundingBox();
58  fPECAL6 = new TDetectorBoundingBox();
59  fDSECAL = new TDetectorBoundingBox();
60  fSMRD1 = new TDetectorBoundingBox();
61  fSMRD2 = new TDetectorBoundingBox();
62  fSMRD3 = new TDetectorBoundingBox();
63  fSMRD4 = new TDetectorBoundingBox();
64  fMM = new TTPCMicroMegasVolumes();
65 
66  fOutputTree->Branch("FGD1Extent",
67  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
68  &fFGD1, fBufferSize, fSplitLevel);
69  fOutputTree->Branch("FGD1Active",
70  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
71  &fFGD1Active, fBufferSize, fSplitLevel);
72  fOutputTree->Branch("FGD2Extent",
73  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
74  &fFGD2, fBufferSize, fSplitLevel);
75  fOutputTree->Branch("FGD2Active",
76  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
77  &fFGD2Active, fBufferSize, fSplitLevel);
78  fOutputTree->Branch("TPC1Extent",
79  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
80  &fTPC1, fBufferSize, fSplitLevel);
81  fOutputTree->Branch("TPC2Extent",
82  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
83  &fTPC2, fBufferSize, fSplitLevel);
84  fOutputTree->Branch("TPC3Extent",
85  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
86  &fTPC3, fBufferSize, fSplitLevel);
87  fOutputTree->Branch("P0DExtent",
88  "ND::TGeometrySummaryModule::TDetectorBoundingBox", &fP0D,
89  fBufferSize, fSplitLevel);
90  fOutputTree->Branch("P0DActive",
91  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
92  &fP0DActive, fBufferSize, fSplitLevel);
93  fOutputTree->Branch("TECAL1Extent",
94  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
95  &fTECAL1, fBufferSize, fSplitLevel);
96  fOutputTree->Branch("TECAL2Extent",
97  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
98  &fTECAL2, fBufferSize, fSplitLevel);
99  fOutputTree->Branch("TECAL3Extent",
100  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
101  &fTECAL3, fBufferSize, fSplitLevel);
102  fOutputTree->Branch("TECAL4Extent",
103  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
104  &fTECAL4, fBufferSize, fSplitLevel);
105  fOutputTree->Branch("TECAL5Extent",
106  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
107  &fTECAL5, fBufferSize, fSplitLevel);
108  fOutputTree->Branch("TECAL6Extent",
109  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
110  &fTECAL6, fBufferSize, fSplitLevel);
111  fOutputTree->Branch("PECAL1Extent",
112  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
113  &fPECAL1, fBufferSize, fSplitLevel);
114  fOutputTree->Branch("PECAL2Extent",
115  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
116  &fPECAL2, fBufferSize, fSplitLevel);
117  fOutputTree->Branch("PECAL3Extent",
118  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
119  &fPECAL3, fBufferSize, fSplitLevel);
120  fOutputTree->Branch("PECAL4Extent",
121  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
122  &fPECAL4, fBufferSize, fSplitLevel);
123  fOutputTree->Branch("PECAL5Extent",
124  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
125  &fPECAL5, fBufferSize, fSplitLevel);
126  fOutputTree->Branch("PECAL6Extent",
127  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
128  &fPECAL6, fBufferSize, fSplitLevel);
129  fOutputTree->Branch("DSECALExtent",
130  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
131  &fDSECAL, fBufferSize, fSplitLevel);
132  fOutputTree->Branch("SMRD1Extent",
133  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
134  &fSMRD1, fBufferSize, fSplitLevel);
135  fOutputTree->Branch("SMRD2Extent",
136  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
137  &fSMRD2, fBufferSize, fSplitLevel);
138  fOutputTree->Branch("SMRD3Extent",
139  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
140  &fSMRD3, fBufferSize, fSplitLevel);
141  fOutputTree->Branch("SMRD4Extent",
142  "ND::TGeometrySummaryModule::TDetectorBoundingBox",
143  &fSMRD4, fBufferSize, fSplitLevel);
144  fOutputTree->Branch("TPCMMvolumes",
145  "ND::TGeometrySummaryModule::TTPCMicroMegasVolumes", &fMM,
146  fBufferSize, fSplitLevel);
147 }
148 
149 void ND::TGeometrySummaryModule::FillBBox(ND::TGeometryId id,
150  TDetectorBoundingBox *box) {
151  TVector3 centre;
152  try {
153  centre = id.GetPosition();
154  } catch (...) {
155  box->Minimum = centre;
156  box->Maximum = centre;
157  return;
158  }
159 
160  ND::TOADatabase::Get().GeomId().CdId(id);
161  TGeoShape *vol = gGeoManager->GetCurrentVolume()->GetShape();
162  TGeoBBox *bbox = dynamic_cast<TGeoBBox *>(vol);
163  if (bbox) {
164  TVector3 corner(bbox->GetDX(), bbox->GetDY(), bbox->GetDZ());
165  TVector3 globalcorner = ND::TGeomInfo::Get().LocalToMasterVect(
166  id, corner.X(), corner.Y(), corner.Z());
167 
168  box->Minimum = centre - globalcorner;
169  box->Maximum = centre + globalcorner;
170  }
171 }
172 
173 bool ND::TGeometrySummaryModule::FillTree(ND::TND280Event &event) {
174  // reload the geometry
175  ND::TOADatabase::Get().RegisterGeometryLookup(NULL);
176  ND::TOADatabase::Get().RegisterAlignmentLookup(NULL);
177  ND::TOADatabase::Get().Geometry();
178 
179  // first do the FGDs
180  FillBBox(ND::GeomId::FGD::FGD1(), fFGD1);
181  FillBBox(ND::GeomId::FGD::FGD2(), fFGD2);
182 
183  fFGD1Active->Minimum = ND::TGeomInfo::FGD().FGD1ActiveMin();
184  fFGD1Active->Maximum = ND::TGeomInfo::FGD().FGD1ActiveMax();
185  fFGD2Active->Minimum = ND::TGeomInfo::FGD().FGD2ActiveMin();
186  fFGD2Active->Maximum = ND::TGeomInfo::FGD().FGD2ActiveMax();
187 
188  // now the P0D
189  FillBBox(ND::GeomId::P0D::Detector(), fP0D);
190 
191  fP0DActive->Minimum = ND::TGeomInfo::P0D().ActiveMin();
192  fP0DActive->Maximum = ND::TGeomInfo::P0D().ActiveMax();
193 
194  // TPCs are next
195  FillBBox(ND::GeomId::TPC::TPC1(), fTPC1);
196  FillBBox(ND::GeomId::TPC::TPC2(), fTPC2);
197  FillBBox(ND::GeomId::TPC::TPC3(), fTPC3);
198 
199  // Get Barrel ECals
200  FillBBox(ND::GeomId::TECal::Module(0, 0), fTECAL1);
201  FillBBox(ND::GeomId::TECal::Module(0, 1), fTECAL2);
202  FillBBox(ND::GeomId::TECal::Module(0, 2), fTECAL3);
203  FillBBox(ND::GeomId::TECal::Module(1, 0), fTECAL4);
204  FillBBox(ND::GeomId::TECal::Module(1, 1), fTECAL5);
205  FillBBox(ND::GeomId::TECal::Module(1, 2), fTECAL6);
206 
207  // and the P0D ECals
208  FillBBox(ND::GeomId::PECal::Module(0, 0), fPECAL1);
209  FillBBox(ND::GeomId::PECal::Module(0, 1), fPECAL2);
210  FillBBox(ND::GeomId::PECal::Module(0, 2), fPECAL3);
211  FillBBox(ND::GeomId::PECal::Module(1, 0), fPECAL4);
212  FillBBox(ND::GeomId::PECal::Module(1, 1), fPECAL5);
213  FillBBox(ND::GeomId::PECal::Module(1, 2), fPECAL6);
214 
215  // and finally the DSECAL
216  FillBBox(ND::GeomId::DSECal::Detector(), fDSECAL);
217 
218  // Add TPC MM volumes for analysisMasterTools EventDisplay
219  MMmap = ND::TGeomInfo::Get().TPC().GetMMVolumes();
220 
221  fMM->MMvolumes = MMmap;
222 
223  // Add SMRD info
224  std::vector<ND::TGeometryId> smrdGeoIds;
225  std::vector<ND::TGeomModuleBase *> smrdModules =
226  ND::TGeomInfo::Get().SMRD().GetModules();
227  for (std::vector<ND::TGeomModuleBase *>::iterator it = smrdModules.begin();
228  it != smrdModules.end(); ++it) {
229  smrdGeoIds.push_back((*it)->GetGeomId());
230  }
231 
232  int counter = 0;
233 
234  for (std::vector<ND::TGeometryId>::iterator it2 = smrdGeoIds.begin();
235  it2 != smrdGeoIds.end(); ++it2) {
236  if (counter == 0) FillBBox(*it2, fSMRD1);
237  if (counter == 1) FillBBox(*it2, fSMRD2);
238  if (counter == 2) FillBBox(*it2, fSMRD3);
239  if (counter == 3) FillBBox(*it2, fSMRD4);
240  counter++;
241  }
242 
243  return true;
244 }
245 
247 
249 
#define CVSID
ClassImp(ND::TBeamSummaryDataModule::TBeamSummaryData)
std::string fDescription
A longish descrition of the analysis.
std::string fCVSID
Defined if an official tagged version.
void SetNameTitle(char const *name, char const *title)
virtual void InitializeBranches()
Initialize Branches. Don&#39;t do anything else in this function.
TGeometrySummaryModule(const char *name="GeometrySummary", const char *title="Geometry Information Summary Module")
virtual bool FillTree(ND::TND280Event &)
Fill all the stuff that goes in the output tree.
std::string fCVSTagName
Defined if an official tagged version.
#define CVSTAG
virtual Bool_t ProcessFirstEvent(ND::TND280Event &event)
Is called after the first event is loaded in.
void FillBBox(ND::TGeometryId id, TDetectorBoundingBox *box)

Package Summary
Package Name: eventAnalysis
Package Version: 7.0-49-g0ac7482
Package Manager:

Generated on Mon Mar 25 2024 14:43:58 for eventAnalysis by doxygen 1.8.5