ATLAS Offline Software
runsTgcGeoComparison.cxx
Go to the documentation of this file.
1 
2 /*
3  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
4 */
14 #include <GaudiKernel/SystemOfUnits.h>
16 #include "CxxUtils/starts_with.h"
17 #include <string>
18 #include <set>
19 #include <vector>
20 #include <map>
21 #include <iostream>
22 #include <cmath>
23 
25 #include <TFile.h>
26 #include <TTreeReader.h>
27 
28 using namespace MuonGMR4;
29 using namespace ActsTrk;
30 
31 constexpr double tolerance = 100.*Gaudi::Units::micrometer;
32 
34 struct sTgcChamber{
36  sTgcChamber() = default;
37 
39  std::string stationName{};
40  int stationIndex{0};
41  int stationEta{0};
42  int stationPhi{0};
43  int stationMultilayer{0};
44  std::string design{};
45 
47  bool operator<(const sTgcChamber& other) const {
48  if (stationIndex != other.stationIndex) return stationIndex < other.stationIndex;
49  if (stationEta != other.stationEta) return stationEta < other.stationEta;
50  if (stationPhi != other.stationPhi) return stationPhi < other.stationPhi;
51  return stationMultilayer < other.stationMultilayer;
52  }
53 
55  Amg::Transform3D geoModelTransform{Amg::Transform3D::Identity()};
56 
58  unsigned int numLayers{0};
59  double yCutout{0.f};
60  double gasTck{0.f};
61 
63  double sChamberLength{0.f};
64  double lChamberLength{0.f};
65  double chamberHeight{0.f};
66  double sGapLength{0.f};
67  double lGapLength{0.f};
68  double gapHeight{0.f};
69 
70 
72  std::vector<unsigned int> numWires;
73  std::vector<uint> firstWireGroupWidth;
74  std::vector<uint> numWireGroups;
75  std::vector<float> wireCutout;
76  double wirePitch{0.f};
77  double wireWidth{0.f};
78  uint wireGroupWidth{0};
79 
81  unsigned int numStrips{0};
82  double stripPitch{0.f};
83  double stripWidth{0.f};
84  std::vector<float> firstStripPitch;
85 
87  struct sTgcChannel{
93  unsigned int channelNumber{0};
95  unsigned int gasGap{0};
97  unsigned int channelType{0};
99  double channelLen{0};
101  bool operator<(const sTgcChannel& other) const {
102  if (gasGap != other.gasGap) return gasGap < other.gasGap;
103  if (channelType != other.channelType) return channelType < other.channelType;
104  return channelNumber < other.channelNumber;
105  }
106  };
107 
109  double sPadLength{0.f};
110  double lPadLength{0.f};
111  double anglePadPhi{0.f};
112  double beamlineRadius{0.f};
113 
114  std::vector<int> padNumber;
115  std::vector<uint> numPads;
116  std::vector<uint> numPadEta;
117  std::vector<uint> numPadPhi;
118  std::vector<float> firstPadHeight;
119  std::vector<float> padHeight;
120  std::vector<float> padPhiShift;
121  std::vector<float> firstPadPhiDiv;
122 
124  struct sTgcPad{
130  Amg::Vector2D localPadCornerBL{Amg::Vector2D::Zero()};
131  Amg::Vector2D localPadCornerBR{Amg::Vector2D::Zero()};
132  Amg::Vector2D localPadCornerTL{Amg::Vector2D::Zero()};
133  Amg::Vector2D localPadCornerTR{Amg::Vector2D::Zero()};
135  Amg::Vector3D globalPadCornerBL{Amg::Vector3D::Zero()};
136  Amg::Vector3D globalPadCornerBR{Amg::Vector3D::Zero()};
137  Amg::Vector3D globalPadCornerTL{Amg::Vector3D::Zero()};
138  Amg::Vector3D globalPadCornerTR{Amg::Vector3D::Zero()};
142  int padNumber{0};
144  short padEta{0};
146  short padPhi{0};
148  unsigned int gasGap{0};
149 
151  bool operator<(const sTgcPad& other) const {
152  if (gasGap != other.gasGap) return gasGap < other.gasGap;
153  if (padPhi != other.padPhi) return padPhi < other.padPhi;
154  return padEta < other.padEta;
155  }
156  };
157 
159  struct sTgcLayer {
161  unsigned int gasGap{0};
163  Amg::Transform3D transform{Amg::Transform3D::Identity()};
165  bool operator<(const sTgcLayer& other) const {
166  return gasGap < other.gasGap;
167  }
168  };
169  std::set<sTgcChannel> channels{};
170  std::set<sTgcPad> pads{};
171  std::set<sTgcLayer> layers{};
172 
173 };
174 
175 
178 std::ostream& operator<<(std::ostream& ostr, const sTgcChamber& chamb) {
179  static const std::map<int, std::string> stationDict{
180  {57, "STS"}, {58, "STL"}
181  };
182  ostr<<"sTgc chamber "<<stationDict.at(chamb.stationIndex)<<"("<<chamb.design<<") "<<chamb.stationName;
183  return ostr;
184 }
185 
186 std::ostream& operator<<(std::ostream& ostr,const sTgcChamber::sTgcChannel & channel) {
187  ostr<<"channel (gasGap/number): ";
188  ostr<<channel.gasGap<<"/";
189  ostr<<channel.channelNumber<<", ";
190  ostr<<channel.channelType<<", ";
191  ostr<<" global Position: "<<Amg::toString(channel.globalPosition, 2)<<", ";
192  ostr<<" local Position: "<<Amg::toString(channel.localPosition, 2);
193  return ostr;
194 }
195 
196 std::ostream& operator<<(std::ostream& ostr,const sTgcChamber::sTgcPad & pad) {
197  ostr<<"pad (gasGap/padEta/padPhi): ";
198  ostr<<pad.gasGap<<"/";
199  ostr<<pad.padEta<<"/"<<pad.padPhi<<", ";
200  ostr<<"global position: "<<Amg::toString(pad.globalPosition, 2);
201  ostr<<"Bottom-left globalPadCorner: "<<Amg::toString(pad.globalPadCornerBL, 2);
202  ostr<<"Bottom-right globalpadCorner: "<<Amg::toString(pad.globalPadCornerBR, 2);
203  ostr<<"Top-left globalpadCorner: "<<Amg::toString(pad.globalPadCornerTL, 2);
204  ostr<<"Top-right globalpadCorner: "<<Amg::toString(pad.globalPadCornerTR, 2);
205 
206  ostr<<"local position: "<<Amg::toString(pad.localPosition, 2);
207  ostr<<"Bottom-left localPadCorner: "<<Amg::toString(pad.localPadCornerBL, 2);
208  ostr<<"Bottom-right localpadCorner: "<<Amg::toString(pad.localPadCornerBR, 2);
209  ostr<<"Top-left localpadCorner: "<<Amg::toString(pad.localPadCornerTL, 2);
210  ostr<<"Top-right localpadCorner: "<<Amg::toString(pad.localPadCornerTR, 2);
211  return ostr;
212 }
213 
214 std::ostream& operator<<(std::ostream& ostr,const sTgcChamber::sTgcLayer & layer) {
215  ostr<<"stgclayer (gasGap/channelType): ";
216  ostr<<layer.gasGap<<", ";
217  ostr<<"transform: "<<Amg::toString(layer.transform);
218  return ostr;
219 }
220 
221 std::set<sTgcChamber> readTreeDump(const std::string& inputFile) {
222  std::set<sTgcChamber> to_ret{};
223  std::cout<<"Read the sTgc geometry tree dump from "<<inputFile<<std::endl;
224  std::unique_ptr<TFile> inFile{TFile::Open(inputFile.c_str())};
225  if (!inFile || !inFile->IsOpen()) {
226  std::cerr<<__FILE__<<":"<<__LINE__<<" Failed to open "<<inputFile<<std::endl;
227  return to_ret;
228  }
229  TTreeReader treeReader("sTgcGeoModelTree", inFile.get());
230  if (treeReader.IsInvalid()){
231  std::cerr<<__FILE__<<":"<<__LINE__<<" The file "<<inputFile<<" does not contain the 'sTgcGeoModelTree'"<<std::endl;
232  return to_ret;
233  }
234 
236  TTreeReaderValue<short> stationIndex{treeReader, "stationIndex"};
237  TTreeReaderValue<short> stationEta{treeReader, "stationEta"};
238  TTreeReaderValue<short> stationPhi{treeReader, "stationPhi"};
239  TTreeReaderValue<short> stationMultilayer{treeReader, "stationMultilayer"};
240  TTreeReaderValue<std::string> chamberDesign{treeReader,"chamberDesign"};
241 
243  TTreeReaderValue<short> numLayers{treeReader, "numLayers"};
244  TTreeReaderValue<float> yCutout{treeReader, "yCutout"};
245  TTreeReaderValue<float> gasTck{treeReader, "gasTck"};
247  TTreeReaderValue<float> sChamberLength{treeReader, "sChamberLength"};
248  TTreeReaderValue<float> lChamberLength{treeReader, "lChamberLength"};
249  TTreeReaderValue<float> chamberHeight{treeReader, "chamberHeight"};
251  TTreeReaderValue<float> sGapLength{treeReader, "sGapLength"};
252  TTreeReaderValue<float> lGapLength{treeReader, "lGapLength"};
253  TTreeReaderValue<float> gapHeight{treeReader, "gapHeight"};
254 
256  TTreeReaderValue<std::vector<uint>> numWires{treeReader, "numWires"};
257  TTreeReaderValue<std::vector<uint>> firstWireGroupWidth{treeReader, "firstWireGroupWidth"};
258  TTreeReaderValue<std::vector<uint>> numWireGroups{treeReader, "numWireGroups"};
259  TTreeReaderValue<std::vector<float>> wireCutout{treeReader, "wireCutout"};
260  TTreeReaderValue<float> wirePitch{treeReader, "wirePitch"};
261  TTreeReaderValue<float> wireWidth{treeReader, "wireWidth"};
262  TTreeReaderValue<uint> wireGroupWidth{treeReader, "wireGroupWidth"};
263 
264  TTreeReaderValue<std::vector<float>> globalWireGroupPosX{treeReader, "globalWireGroupPosX"};
265  TTreeReaderValue<std::vector<float>> globalWireGroupPosY{treeReader, "globalWireGroupPosY"};
266  TTreeReaderValue<std::vector<float>> globalWireGroupPosZ{treeReader, "globalWireGroupPosZ"};
267 
268  TTreeReaderValue<std::vector<float>> localWireGroupPosX{treeReader, "localWireGroupPosX"};
269  TTreeReaderValue<std::vector<float>> localWireGroupPosY{treeReader, "localWireGroupPosY"};
270 
271  TTreeReaderValue<std::vector<uint8_t>> wireGroupNum{treeReader, "wireGroupNum"};
272  TTreeReaderValue<std::vector<uint8_t>> wireGroupGasGap{treeReader, "wireGroupGasGap"};
273 
275  TTreeReaderValue<uint> numStrips{treeReader, "numStrips"};
276  TTreeReaderValue<float> stripPitch{treeReader, "stripPitch"};
277  TTreeReaderValue<float> stripWidth{treeReader, "stripWidth"};
278 
279  TTreeReaderValue<std::vector<float>> globalStripPosX{treeReader, "globalStripPosX"};
280  TTreeReaderValue<std::vector<float>> globalStripPosY{treeReader, "globalStripPosY"};
281  TTreeReaderValue<std::vector<float>> globalStripPosZ{treeReader, "globalStripPosZ"};
282 
283  TTreeReaderValue<std::vector<float>> localStripPosX{treeReader, "localStripPosX"};
284  TTreeReaderValue<std::vector<float>> localStripPosY{treeReader, "localStripPosY"};
285 
286  TTreeReaderValue<std::vector<uint>> stripNum{treeReader, "stripNumber"};
287  TTreeReaderValue<std::vector<uint8_t>> stripGasGap{treeReader, "stripGasGap"};
288  TTreeReaderValue<std::vector<float>> stripLengths{treeReader, "stripLengths"};
289 
291  TTreeReaderValue<float> sPadLength{treeReader, "sPadLength"};
292  TTreeReaderValue<float> lPadLength{treeReader, "lPadLength"};
293  TTreeReaderValue<float> anglePadPhi{treeReader, "anglePadPhi"};
294  TTreeReaderValue<float> beamlineRadius{treeReader, "beamlineRadius"};
295  TTreeReaderValue<std::vector<uint>> numPads{treeReader, "numPads"};
296  TTreeReaderValue<std::vector<uint>> numPadEta{treeReader, "numPadEta"};
297  TTreeReaderValue<std::vector<uint>> numPadPhi{treeReader, "numPadPhi"};
298  TTreeReaderValue<std::vector<float>> firstPadHeight{treeReader, "firstPadHeight"};
299  TTreeReaderValue<std::vector<float>> padHeight{treeReader, "padHeight"};
300  TTreeReaderValue<std::vector<float>> padPhiShift{treeReader, "padPhiShift"};
301  TTreeReaderValue<std::vector<float>> firstPadPhiDiv{treeReader, "firstPadPhiDiv"};
302 
303  TTreeReaderValue<std::vector<float>> globalPadCornerBRX{treeReader, "globalPadCornerBRX"};
304  TTreeReaderValue<std::vector<float>> globalPadCornerBRY{treeReader, "globalPadCornerBRY"};
305  TTreeReaderValue<std::vector<float>> globalPadCornerBRZ{treeReader, "globalPadCornerBRZ"};
306 
307  TTreeReaderValue<std::vector<float>> globalPadCornerBLX{treeReader, "globalPadCornerBLX"};
308  TTreeReaderValue<std::vector<float>> globalPadCornerBLY{treeReader, "globalPadCornerBLY"};
309  TTreeReaderValue<std::vector<float>> globalPadCornerBLZ{treeReader, "globalPadCornerBLZ"};
310 
311  TTreeReaderValue<std::vector<float>> globalPadCornerTRX{treeReader, "globalPadCornerTRX"};
312  TTreeReaderValue<std::vector<float>> globalPadCornerTRY{treeReader, "globalPadCornerTRY"};
313  TTreeReaderValue<std::vector<float>> globalPadCornerTRZ{treeReader, "globalPadCornerTRZ"};
314 
315  TTreeReaderValue<std::vector<float>> globalPadCornerTLX{treeReader, "globalPadCornerTLX"};
316  TTreeReaderValue<std::vector<float>> globalPadCornerTLY{treeReader, "globalPadCornerTLY"};
317  TTreeReaderValue<std::vector<float>> globalPadCornerTLZ{treeReader, "globalPadCornerTLZ"};
318 
319  TTreeReaderValue<std::vector<float>> globalPadPosX{treeReader, "globalPadPosX"};
320  TTreeReaderValue<std::vector<float>> globalPadPosY{treeReader, "globalPadPosY"};
321  TTreeReaderValue<std::vector<float>> globalPadPosZ{treeReader, "globalPadPosZ"};
322 
323  TTreeReaderValue<std::vector<float>> localPadCornerBRX{treeReader, "localPadCornerBRX"};
324  TTreeReaderValue<std::vector<float>> localPadCornerBRY{treeReader, "localPadCornerBRY"};
325 
326  TTreeReaderValue<std::vector<float>> localPadCornerBLX{treeReader, "localPadCornerBLX"};
327  TTreeReaderValue<std::vector<float>> localPadCornerBLY{treeReader, "localPadCornerBLY"};
328 
329  TTreeReaderValue<std::vector<float>> localPadCornerTRX{treeReader, "localPadCornerTRX"};
330  TTreeReaderValue<std::vector<float>> localPadCornerTRY{treeReader, "localPadCornerTRY"};
331 
332  TTreeReaderValue<std::vector<float>> localPadCornerTLX{treeReader, "localPadCornerTLX"};
333  TTreeReaderValue<std::vector<float>> localPadCornerTLY{treeReader, "localPadCornerTLY"};
334 
335  TTreeReaderValue<std::vector<float>> localPadPosX{treeReader, "localPadPosX"};
336  TTreeReaderValue<std::vector<float>> localPadPosY{treeReader, "localPadPosY"};
337 
338  TTreeReaderValue<std::vector<float>> hitPositionX{treeReader, "hitPositionX"};
339  TTreeReaderValue<std::vector<float>> hitPositionY{treeReader, "hitPositionY"};
340  TTreeReaderValue<std::vector<int>> padNumber{treeReader, "padNumber"};
341 
342  TTreeReaderValue<std::vector<uint8_t>> padGasGap{treeReader, "padGasGap"};
343  TTreeReaderValue<std::vector<uint>> padEta{treeReader, "padEtaNumber"};
344  TTreeReaderValue<std::vector<uint>> padPhi{treeReader, "padPhiNumber"};
345 
347  TTreeReaderValue<std::vector<float>> geoModelTransformX{treeReader, "GeoModelTransformX"};
348  TTreeReaderValue<std::vector<float>> geoModelTransformY{treeReader, "GeoModelTransformY"};
349  TTreeReaderValue<std::vector<float>> geoModelTransformZ{treeReader, "GeoModelTransformZ"};
351  TTreeReaderValue<std::vector<float>> stripRotCol1X{treeReader, "stripRotLinearCol1X"};
352  TTreeReaderValue<std::vector<float>> stripRotCol1Y{treeReader, "stripRotLinearCol1Y"};
353  TTreeReaderValue<std::vector<float>> stripRotCol1Z{treeReader, "stripRotLinearCol1Z"};
354 
355  TTreeReaderValue<std::vector<float>> stripRotCol2X{treeReader, "stripRotLinearCol2X"};
356  TTreeReaderValue<std::vector<float>> stripRotCol2Y{treeReader, "stripRotLinearCol2Y"};
357  TTreeReaderValue<std::vector<float>> stripRotCol2Z{treeReader, "stripRotLinearCol2Z"};
358 
359  TTreeReaderValue<std::vector<float>> stripRotCol3X{treeReader, "stripRotLinearCol3X"};
360  TTreeReaderValue<std::vector<float>> stripRotCol3Y{treeReader, "stripRotLinearCol3Y"};
361  TTreeReaderValue<std::vector<float>> stripRotCol3Z{treeReader, "stripRotLinearCol3Z"};
362 
363  TTreeReaderValue<std::vector<float>> stripRotTransX{treeReader, "stripRotTranslationX"};
364  TTreeReaderValue<std::vector<float>> stripRotTransY{treeReader, "stripRotTranslationY"};
365  TTreeReaderValue<std::vector<float>> stripRotTransZ{treeReader, "stripRotTranslationZ"};
366 
367  TTreeReaderValue<std::vector<uint8_t>> stripRotGasGap{treeReader, "stripRotGasGap"};
368 
370  TTreeReaderValue<std::vector<float>> wireGroupRotCol1X{treeReader, "wireGroupRotLinearCol1X"};
371  TTreeReaderValue<std::vector<float>> wireGroupRotCol1Y{treeReader, "wireGroupRotLinearCol1Y"};
372  TTreeReaderValue<std::vector<float>> wireGroupRotCol1Z{treeReader, "wireGroupRotLinearCol1Z"};
373 
374  TTreeReaderValue<std::vector<float>> wireGroupRotCol2X{treeReader, "wireGroupRotLinearCol2X"};
375  TTreeReaderValue<std::vector<float>> wireGroupRotCol2Y{treeReader, "wireGroupRotLinearCol2Y"};
376  TTreeReaderValue<std::vector<float>> wireGroupRotCol2Z{treeReader, "wireGroupRotLinearCol2Z"};
377 
378  TTreeReaderValue<std::vector<float>> wireGroupRotCol3X{treeReader, "wireGroupRotLinearCol3X"};
379  TTreeReaderValue<std::vector<float>> wireGroupRotCol3Y{treeReader, "wireGroupRotLinearCol3Y"};
380  TTreeReaderValue<std::vector<float>> wireGroupRotCol3Z{treeReader, "wireGroupRotLinearCol3Z"};
381 
382  TTreeReaderValue<std::vector<float>> wireGroupRotTransX{treeReader, "wireGroupRotTranslationX"};
383  TTreeReaderValue<std::vector<float>> wireGroupRotTransY{treeReader, "wireGroupRotTranslationY"};
384  TTreeReaderValue<std::vector<float>> wireGroupRotTransZ{treeReader, "wireGroupRotTranslationZ"};
385 
386  TTreeReaderValue<std::vector<uint8_t>> wireGroupRotGasGap{treeReader, "wireGroupRotGasGap"};
387 
389  TTreeReaderValue<std::vector<float>> padRotCol1X{treeReader, "padRotLinearCol1X"};
390  TTreeReaderValue<std::vector<float>> padRotCol1Y{treeReader, "padRotLinearCol1Y"};
391  TTreeReaderValue<std::vector<float>> padRotCol1Z{treeReader, "padRotLinearCol1Z"};
392 
393  TTreeReaderValue<std::vector<float>> padRotCol2X{treeReader, "padRotLinearCol2X"};
394  TTreeReaderValue<std::vector<float>> padRotCol2Y{treeReader, "padRotLinearCol2Y"};
395  TTreeReaderValue<std::vector<float>> padRotCol2Z{treeReader, "padRotLinearCol2Z"};
396 
397  TTreeReaderValue<std::vector<float>> padRotCol3X{treeReader, "padRotLinearCol3X"};
398  TTreeReaderValue<std::vector<float>> padRotCol3Y{treeReader, "padRotLinearCol3Y"};
399  TTreeReaderValue<std::vector<float>> padRotCol3Z{treeReader, "padRotLinearCol3Z"};
400 
401  TTreeReaderValue<std::vector<float>> padRotTransX{treeReader, "padRotTranslationX"};
402  TTreeReaderValue<std::vector<float>> padRotTransY{treeReader, "padRotTranslationY"};
403  TTreeReaderValue<std::vector<float>> padRotTransZ{treeReader, "padRotTranslationZ"};
404 
405  TTreeReaderValue<std::vector<uint8_t>> padRotGasGap{treeReader, "padRotGasGap"};
406 
407  while (treeReader.Next()) {
408  sTgcChamber newchamber{};
409 
411  newchamber.stationIndex = (*stationIndex);
412  newchamber.stationEta = (*stationEta);
413  newchamber.stationPhi = (*stationPhi);
414  newchamber.stationMultilayer = (*stationMultilayer);
415  newchamber.design = (*chamberDesign);
416 
418  newchamber.numLayers = (*numLayers);
419  newchamber.yCutout = (*yCutout);
420  newchamber.gasTck = (*gasTck);
421 
423  newchamber.sGapLength = (*sGapLength);
424  newchamber.lGapLength = (*lGapLength);
425  newchamber.gapHeight = (*gapHeight);
427  newchamber.sChamberLength = (*sChamberLength);
428  newchamber.lChamberLength = (*lChamberLength);
429  newchamber.chamberHeight = (*chamberHeight);
430 
432  newchamber.numWires = (*numWires);
433  newchamber.firstWireGroupWidth = (*firstWireGroupWidth);
434  newchamber.numWireGroups = (*numWireGroups);
435  newchamber.wireCutout = (*wireCutout);
436  newchamber.wirePitch = (*wirePitch);
437  newchamber.wireWidth = (*wireWidth);
438  newchamber.wireGroupWidth = (*wireGroupWidth);
439 
441  newchamber.numStrips = (*numStrips);
442  newchamber.stripPitch = (*stripPitch);
443  newchamber.stripWidth = (*stripWidth);
444 
446  newchamber.sPadLength = (*sPadLength);
447  newchamber.lPadLength = (*lPadLength);
448  newchamber.anglePadPhi = (*anglePadPhi);
449  newchamber.beamlineRadius = (*beamlineRadius);
450  newchamber.numPads = (*numPads);
451  newchamber.numPadEta = (*numPadEta);
452  newchamber.numPadPhi = (*numPadPhi);
453  newchamber.firstPadHeight = (*firstPadHeight);
454  newchamber.padHeight = (*padHeight);
455  newchamber.padPhiShift = (*padPhiShift);
456  newchamber.firstPadPhiDiv = (*firstPadPhiDiv);
457 
458  Amg::Vector3D geoTrans{(*geoModelTransformX)[0], (*geoModelTransformY)[0], (*geoModelTransformZ)[0]};
459  Amg::RotationMatrix3D geoRot{Amg::RotationMatrix3D::Identity()};
460  geoRot.col(0) = Amg::Vector3D((*geoModelTransformX)[1], (*geoModelTransformY)[1], (*geoModelTransformZ)[1]);
461  geoRot.col(1) = Amg::Vector3D((*geoModelTransformX)[2], (*geoModelTransformY)[2], (*geoModelTransformZ)[2]);
462  geoRot.col(2) = Amg::Vector3D((*geoModelTransformX)[3], (*geoModelTransformY)[3], (*geoModelTransformZ)[3]);
463  newchamber.geoModelTransform = Amg::getTransformFromRotTransl(std::move(geoRot), std::move(geoTrans));
464 
465  //WireGroups
466  for (size_t wg = 0; wg < globalWireGroupPosX->size(); ++wg){
467  sTgcChamber::sTgcChannel newWireGroup{};
468  newWireGroup.localPosition = Amg::Vector2D{(*localWireGroupPosX)[wg], (*localWireGroupPosY)[wg]};
469  newWireGroup.globalPosition = Amg::Vector3D{(*globalWireGroupPosX)[wg], (*globalWireGroupPosY)[wg], (*globalWireGroupPosZ)[wg]};
470  newWireGroup.gasGap = (*wireGroupGasGap)[wg];
471  newWireGroup.channelNumber = (*wireGroupNum)[wg];
472  newWireGroup.channelType = 2;
474  if (newWireGroup.channelNumber > 0) continue;
475  newchamber.channels.insert(std::move(newWireGroup));
476  }
477 
478  //Strips Filling in global positions
479  for (size_t s = 0; s < globalStripPosX->size(); ++s){
480  sTgcChamber::sTgcChannel newStrip{};
481  newStrip.localPosition = Amg::Vector2D{(*localStripPosX)[s], (*localStripPosY)[s]};
482  newStrip.globalPosition = Amg::Vector3D{(*globalStripPosX)[s], (*globalStripPosY)[s], (*globalStripPosZ)[s]};
483  newStrip.gasGap = (*stripGasGap)[s];
484  newStrip.channelNumber = (*stripNum)[s];
485  newStrip.channelType = 1;
486  newStrip.channelLen = (*stripLengths)[s];
488  if (newStrip.channelNumber > 0) continue;
489  newchamber.channels.insert(std::move(newStrip));
490  }
491 
492 
493  //Pads
494  for (size_t p = 0; p < globalPadPosX->size(); ++p){
495  sTgcChamber::sTgcPad newPad{};
496 
497  newPad.globalPosition = Amg::Vector3D{(*globalPadPosX)[p], (*globalPadPosY)[p], (*globalPadPosZ)[p]};
498  newPad.globalPadCornerBR = Amg::Vector3D{(*globalPadCornerBRX)[p], (*globalPadCornerBRY)[p], (*globalPadCornerBRZ)[p]};
499  newPad.globalPadCornerBL = Amg::Vector3D{(*globalPadCornerBLX)[p], (*globalPadCornerBLY)[p], (*globalPadCornerBLZ)[p]};
500  newPad.globalPadCornerTR = Amg::Vector3D{(*globalPadCornerTRX)[p], (*globalPadCornerTRY)[p], (*globalPadCornerTRZ)[p]};
501  newPad.globalPadCornerTL = Amg::Vector3D{(*globalPadCornerTLX)[p], (*globalPadCornerTLY)[p], (*globalPadCornerTLZ)[p]};
502 
503  newPad.localPosition = Amg::Vector2D{(*localPadPosX)[p], (*localPadPosY)[p]};
504  newPad.localPadCornerBR = Amg::Vector2D{(*localPadCornerBRX)[p], (*localPadCornerBRY)[p]};
505  newPad.localPadCornerBL = Amg::Vector2D{(*localPadCornerBLX)[p], (*localPadCornerBLY)[p]};
506  newPad.localPadCornerTR = Amg::Vector2D{(*localPadCornerTRX)[p], (*localPadCornerTRY)[p]};
507  newPad.localPadCornerTL = Amg::Vector2D{(*localPadCornerTLX)[p], (*localPadCornerTLY)[p]};
508 
509  newPad.hitPosition = Amg::Vector2D{(*hitPositionX)[p], (*hitPositionY)[p]};
510  newPad.padNumber = (*padNumber)[p];
511  newPad.gasGap = (*padGasGap)[p];
512  newPad.padEta = (*padEta)[p];
513  newPad.padPhi = (*padPhi)[p];
515  if (newPad.padEta > 1 || newPad.padPhi > 6) continue;
516  newchamber.pads.insert(std::move(newPad));
517  }
518 
519  for (size_t l = 0; l < stripRotGasGap->size(); ++l){
520  sTgcChamber::sTgcLayer stripLayer{};
521  stripLayer.gasGap = (*stripRotGasGap)[l];
522  Amg::RotationMatrix3D stripRot{Amg::RotationMatrix3D::Identity()};
523  stripRot.col(0) = Amg::Vector3D((*stripRotCol1X)[l],(*stripRotCol1Y)[l], (*stripRotCol1Z)[l]);
524  stripRot.col(1) = Amg::Vector3D((*stripRotCol2X)[l],(*stripRotCol2Y)[l], (*stripRotCol2Z)[l]);
525  stripRot.col(2) = Amg::Vector3D((*stripRotCol3X)[l],(*stripRotCol3Y)[l], (*stripRotCol3Z)[l]);
526  Amg::Vector3D layTrans{(*stripRotTransX)[l], (*stripRotTransY)[l], (*stripRotTransZ)[l]};
527  stripLayer.transform = Amg::getTransformFromRotTransl(std::move(stripRot), std::move(layTrans));
528  newchamber.layers.insert(std::move(stripLayer));
529  }
530 
531  for (size_t l = 0; l < wireGroupRotGasGap->size(); ++l){
532  sTgcChamber::sTgcLayer wireGroupLayer{};
533  wireGroupLayer.gasGap = (*wireGroupRotGasGap)[l];
534  Amg::RotationMatrix3D wireGroupRot{Amg::RotationMatrix3D::Identity()};
535  wireGroupRot.col(0) = Amg::Vector3D((*wireGroupRotCol1X)[l],(*wireGroupRotCol1Y)[l], (*wireGroupRotCol1Z)[l]);
536  wireGroupRot.col(1) = Amg::Vector3D((*wireGroupRotCol2X)[l],(*wireGroupRotCol2Y)[l], (*wireGroupRotCol2Z)[l]);
537  wireGroupRot.col(2) = Amg::Vector3D((*wireGroupRotCol3X)[l],(*wireGroupRotCol3Y)[l], (*wireGroupRotCol3Z)[l]);
538  Amg::Vector3D layTrans{(*wireGroupRotTransX)[l], (*wireGroupRotTransY)[l], (*wireGroupRotTransZ)[l]};
539  wireGroupLayer.transform = Amg::getTransformFromRotTransl(std::move(wireGroupRot), std::move(layTrans));
540  newchamber.layers.insert(std::move(wireGroupLayer));
541  }
542 
543  for (size_t l = 0; l < padRotGasGap->size(); ++l){
544  sTgcChamber::sTgcLayer padLayer{};
545  padLayer.gasGap = (*padRotGasGap)[l];
546  Amg::RotationMatrix3D padRot{Amg::RotationMatrix3D::Identity()};
547  padRot.col(0) = Amg::Vector3D((*padRotCol1X)[l],(*padRotCol1Y)[l], (*padRotCol1Z)[l]);
548  padRot.col(1) = Amg::Vector3D((*padRotCol2X)[l],(*padRotCol2Y)[l], (*padRotCol2Z)[l]);
549  padRot.col(2) = Amg::Vector3D((*padRotCol3X)[l],(*padRotCol3Y)[l], (*padRotCol3Z)[l]);
550  Amg::Vector3D layTrans{(*padRotTransX)[l], (*padRotTransY)[l], (*padRotTransZ)[l]};
551  padLayer.transform = Amg::getTransformFromRotTransl(std::move(padRot), std::move(layTrans));
552  newchamber.layers.insert(std::move(padLayer));
553  }
554 
555  auto insert_itr = to_ret.insert(std::move(newchamber));
556  if (!insert_itr.second) {
557  std::stringstream err{};
558  err<<__FILE__<<":"<<__LINE__<<" The chamber "<<(*insert_itr.first).stationIndex
559  <<" has already been inserted. "<<std::endl;
560  throw std::runtime_error(err.str());
561  }
562  }
563  std::cout<<"File parsing is finished. Found in total "<<to_ret.size()<<" readout element dumps "<<std::endl;
564  return to_ret;
565 }
566 
567 #define TEST_BASICPROP(attribute, propName) \
568  if (std::abs(1.*test.attribute - 1.*reference.attribute) > tolerance) { \
569  std::cerr<<"sTgcGeoModelComparison() "<<__LINE__<<": The chamber "<<reference \
570  <<" differs w.r.t "<<propName<<" "<< reference.attribute \
571  <<" (ref) vs. " <<test.attribute << " (test)" << std::endl; \
572  chamberOkay = false; \
573  }
574 
575 int main( int argc, char** argv ) {
576  std::string refFile{}, testFile{};
577 
578  for (int arg = 1; arg < argc; ++arg) {
579  std::string the_arg{argv[arg]};
580  if (the_arg == "--refFile" && arg +1 < argc) {
581  refFile = std::string{argv[arg+1]};
582  ++arg;
583  } else if (the_arg == "--testFile" && arg + 1 < argc) {
584  testFile = std::string{argv[arg+1]};
585  ++arg;
586  }
587  }
588  if (refFile.empty()) {
589  std::cerr<<"Please parse the path of the reference file via --refFile "<<std::endl;
590  return EXIT_FAILURE;
591  }
592  if (testFile.empty()) {
593  std::cerr<<"Please parse the path of the test file via --testFile "<<std::endl;
594  return EXIT_FAILURE;
595  }
597  if (!CxxUtils::starts_with (refFile, "root://")) refFile = PathResolver::FindCalibFile(refFile);
600  std::set<sTgcChamber> refChambers = readTreeDump(refFile);
601  if (refChambers.empty()) {
602  std::cerr<<"The file "<<refFile<<" should contain at least one chamber "<<std::endl;
603  return EXIT_FAILURE;
604  }
605  std::set<sTgcChamber> testChambers = readTreeDump(testFile);
606  if (testChambers.empty()) {
607  std::cerr<<"The file "<<testFile<<" should contain at least one chamber "<<std::endl;
608  return EXIT_FAILURE;
609  }
610  int return_code = EXIT_SUCCESS;
612  for (const sTgcChamber& reference : refChambers) {
613  std::set<sTgcChamber>::const_iterator test_itr = testChambers.find(reference);
614 
615  if (test_itr == testChambers.end()) {
616  std::cerr<<"The chamber "<<reference<<" is not part of the testing "<<std::endl;
617  return_code = EXIT_FAILURE;
618  continue;
619  }
620  bool chamberOkay = true;
621  const sTgcChamber& test = {*test_itr};
622 
623  TEST_BASICPROP(numLayers, "number of gas gaps");
624  TEST_BASICPROP(yCutout, "yCutout of the Chamber");
625  TEST_BASICPROP(gasTck, "thickness of the gas gap");
626 
628  TEST_BASICPROP(sChamberLength, "Chamber length on the short side");
629  TEST_BASICPROP(lChamberLength, "Chamber length on the long side");
630  TEST_BASICPROP(chamberHeight, "Chamber height");
631  TEST_BASICPROP(sGapLength, "GasGap length on the short side");
632  TEST_BASICPROP(lGapLength, "GasGap length on the long side");
633  TEST_BASICPROP(gapHeight, "GasGap Height");
634 
635  TEST_BASICPROP(wirePitch, "pitch of a single wire");
636  TEST_BASICPROP(wireWidth, "width of a single wire");
637  TEST_BASICPROP(wireGroupWidth, "number of wires in a normal wiregroup");
638 
639  TEST_BASICPROP(numStrips, "number of strips in a chamber");
640  TEST_BASICPROP(stripPitch, "pitch of a normal strip");
641  TEST_BASICPROP(stripWidth, "width of a normal strip");
642  TEST_BASICPROP(sPadLength, "gasGap length on the short side for pads and wires");
643  TEST_BASICPROP(lPadLength, "gasGap length on the long side for pads and wires");
644  TEST_BASICPROP(anglePadPhi, "angular width of a pad in phi direction");
645  TEST_BASICPROP(beamlineRadius, "distance from the gapCenter to beamline");
646 
647  int c = 0;
648  using sTgcLayer = sTgcChamber::sTgcLayer;
649  for (const sTgcLayer& refLayer : reference.layers) {
650  std::set<sTgcLayer>::const_iterator lay_itr = test.layers.find(refLayer);
651  if (lay_itr == test.layers.end()) {
652  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
653  <<refLayer<<" is not found. "<<std::endl;
654  chamberOkay = false;
655  continue;
656  }
657  const sTgcLayer& testLayer{*lay_itr};
658  const Amg::Transform3D layAlignment = testLayer.transform.inverse() *
659  refLayer.transform;
661  TEST_BASICPROP(numWires[c], "number of wires in the layer "<< c + 1 << " are ");
662  TEST_BASICPROP(firstWireGroupWidth[c], "number of wires in first wire group in the layer "<< c + 1 << " are ");
664  TEST_BASICPROP(numPads[c], "number of pads in the layer "<< c + 1 << " are ");
665  TEST_BASICPROP(numPadEta[c], "number of pads in the eta direction in the layer "<< c + 1 << " are ");
666  TEST_BASICPROP(numPadPhi[c], "number of in the phi direction in the layer "<< c + 1 << " are ");
667  TEST_BASICPROP(firstPadHeight[c], "height of the first pad row in the layer "<< c + 1 << " are ");
668  TEST_BASICPROP(padHeight[c], "height of pads in the rest of the rows in the layer "<< c + 1 << " are ");
669  TEST_BASICPROP(padPhiShift[c], "shift of inner pad edges in phi direction in the layer "<< c + 1 << " are ");
670  TEST_BASICPROP(firstPadPhiDiv[c], "angular position of the outer edge of the first pad in the layer "<< c + 1 << " are ");
671  ++c;
672 
674  std::cout <<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
675  << "The test layer transform for layer "<< c << " is: " << Amg::toString(testLayer.transform)
676  << " and the reference layer transform is: " << Amg::toString(refLayer.transform) <<std::endl;
677 
678  if (!Amg::doesNotDeform(layAlignment)) {
679  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
680  <<"the layer "<<testLayer<<" is misaligned w.r.t. reference by "
681  <<Amg::toString(layAlignment)<<std::endl;
682  chamberOkay = false;
683  continue;
684  }
685  }
686 
687  using sTgcChannel = sTgcChamber::sTgcChannel;
688  for (const sTgcChannel& refChannel : reference.channels) {
689  std::set<sTgcChannel>::const_iterator channel_itr = test.channels.find(refChannel);
690  if (channel_itr == test.channels.end()) {
691  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
692  <<refChannel<<" is not found. "<<std::endl;
693  chamberOkay = false;
694  continue;
695  }
696  const sTgcChannel& testChannel{*channel_itr};
697 
698  const Amg::Vector3D diffGlobalPos{testChannel.globalPosition - refChannel.globalPosition};
699  const Amg::Vector2D diffLocalPos{testChannel.localPosition - refChannel.localPosition};
700  if (diffGlobalPos.mag() > tolerance) {
701  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"channel (gasGap/number): "
702  <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " global position: "
703  <<Amg::toString(testChannel.globalPosition, 2)<<" should be located at "<<Amg::toString(refChannel.globalPosition, 2)
704  <<" displacement: "<<Amg::toString(diffGlobalPos,2)<<std::endl;
705  chamberOkay = false;
706  }
707  if (diffLocalPos.mag() > tolerance) {
708  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"channel (gasGap/number): "
709  <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " local position: "
710  <<Amg::toString(testChannel.localPosition, 2)<<" should be located at "<<Amg::toString(refChannel.localPosition, 2)
711  <<" displacement: "<<Amg::toString(diffLocalPos,2)<<std::endl;
712  chamberOkay = false;
713  }
714  const double diffChannelLen{testChannel.channelLen - refChannel.channelLen};
715  if (std::abs(diffChannelLen) > tolerance) {
716  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"channel (gasGap/number): "
717  <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " Run 4 strip Length: "
718  <<testChannel.channelLen<<" Run 3 strip Length "<<refChannel.channelLen
719  <<" displacement: "<<diffChannelLen<<std::endl;
720  chamberOkay = false;
721  }
722  }
723 
724  using sTgcPad = sTgcChamber::sTgcPad;
725  for (const sTgcPad& refPad : reference.pads) {
726  std::set<sTgcPad>::const_iterator pad_itr = test.pads.find(refPad);
727  if (pad_itr == test.pads.end()) {
728  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
729  <<refPad<<" is not found. "<<std::endl;
730  chamberOkay = false;
731  continue;
732  }
733  const sTgcPad& testPad{*pad_itr};
735  const Amg::Vector2D diffLocalPadPos{testPad.localPosition - refPad.localPosition};
736  if (diffLocalPadPos.mag() > tolerance) {
737  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
738  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " local position: "
739  <<Amg::toString(testPad.localPosition, 2)<<" should be located at "<<Amg::toString(refPad.localPosition, 2)
740  <<" displacement: "<<Amg::toString(diffLocalPadPos,2)<<std::endl;
741  chamberOkay = false;
742  }
744  const Amg::Vector2D diffLocalPadCornerBL{testPad.localPadCornerBL - refPad.localPadCornerBL};
745  if (diffLocalPadCornerBL.mag() > tolerance) {
746  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
747  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-left corner: "
748  <<Amg::toString(testPad.localPadCornerBL, 2)<<" should be located at "<<Amg::toString(refPad.localPadCornerBL, 2)
749  <<" displacement: "<<Amg::toString(diffLocalPadCornerBL,2)<<std::endl;
750  chamberOkay = false;
751  }
753  const Amg::Vector2D diffLocalPadCornerBR{testPad.localPadCornerBR - refPad.localPadCornerBR};
754  if (diffLocalPadCornerBR.mag() > tolerance) {
755  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
756  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-right corner: "
757  <<Amg::toString(testPad.localPadCornerBR, 2)<<" should be located at "<<Amg::toString(refPad.localPadCornerBR, 2)
758  <<" displacement: "<<Amg::toString(diffLocalPadCornerBR,2)<<std::endl;
759  chamberOkay = false;
760  }
762  const Amg::Vector2D diffLocalPadCornerTL{testPad.localPadCornerTL - refPad.localPadCornerTL};
763  if (diffLocalPadCornerTL.mag() > tolerance) {
764  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
765  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-left corner: "
766  <<Amg::toString(testPad.localPadCornerTL, 2)<<" should be located at "<<Amg::toString(refPad.localPadCornerTL, 2)
767  <<" displacement: "<<Amg::toString(diffLocalPadCornerTL,2)<<std::endl;
768  chamberOkay = false;
769  }
771  const Amg::Vector2D diffLocalPadCornerTR{testPad.localPadCornerTR - refPad.localPadCornerTR};
772  if (diffLocalPadCornerTR.mag() > tolerance) {
773  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
774  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-right corner: "
775  <<Amg::toString(testPad.localPadCornerTR, 2)<<" should be located at "<<Amg::toString(refPad.localPadCornerTR, 2)
776  <<" displacement: "<<Amg::toString(diffLocalPadCornerTR,2)<<std::endl;
777  chamberOkay = false;
778  }
779 
781  const Amg::Vector3D diffGlobalPadPos{testPad.globalPosition - refPad.globalPosition};
782  if (diffGlobalPadPos.mag() > tolerance) {
783  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
784  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " global position: "
785  <<Amg::toString(testPad.globalPosition, 2)<<" should be located at "<<Amg::toString(refPad.globalPosition, 2)
786  <<" displacement: "<<Amg::toString(diffGlobalPadPos,2)<<std::endl;
787  chamberOkay = false;
788  }
790  const Amg::Vector3D diffGlobalPadCornerBL{testPad.globalPadCornerBL - refPad.globalPadCornerBL};
791  if (diffGlobalPadCornerBL.mag() > tolerance) {
792  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
793  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-left corner: "
794  <<Amg::toString(testPad.globalPadCornerBL, 2)<<" should be located at "<<Amg::toString(refPad.globalPadCornerBL, 2)
795  <<" displacement: "<<Amg::toString(diffGlobalPadCornerBL,2)<<std::endl;
796  chamberOkay = false;
797  }
798 
800  const Amg::Vector3D diffGlobalPadCornerBR{testPad.globalPadCornerBR - refPad.globalPadCornerBR};
801  if (diffGlobalPadCornerBR.mag() > tolerance) {
802  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
803  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-right corner: "
804  <<Amg::toString(testPad.globalPadCornerBR, 2)<<" should be located at "<<Amg::toString(refPad.globalPadCornerBR, 2)
805  <<" displacement: "<<Amg::toString(diffGlobalPadCornerBR,2)<<std::endl;
806  chamberOkay = false;
807  }
809  const Amg::Vector3D diffGlobalPadCornerTL{testPad.globalPadCornerTL - refPad.globalPadCornerTL};
810  if (diffGlobalPadCornerTL.mag() > tolerance) {
811  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
812  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-left corner: "
813  <<Amg::toString(testPad.globalPadCornerTL, 2)<<" should be located at "<<Amg::toString(refPad.globalPadCornerTL, 2)
814  <<" displacement: "<<Amg::toString(diffGlobalPadCornerTL,2)<<std::endl;
815  chamberOkay = false;
816  }
818  const Amg::Vector3D diffGlobalPadCornerTR{testPad.globalPadCornerTR - refPad.globalPadCornerTR};
819  if (diffGlobalPadCornerTR.mag() > tolerance) {
820  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
821  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-right corner: "
822  <<Amg::toString(testPad.globalPadCornerTR, 2)<<" should be located at "<<Amg::toString(refPad.globalPadCornerTR, 2)
823  <<" displacement: "<<Amg::toString(diffGlobalPadCornerTR,2)<<std::endl;
824  chamberOkay = false;
825  }
827  const Amg::Vector2D diffHitPosition{testPad.hitPosition - refPad.hitPosition};
828  if (diffHitPosition.mag() > tolerance) {
829  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
830  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " Hit Position: "
831  <<Amg::toString(testPad.hitPosition, 2) <<" should be "<<Amg::toString(refPad.hitPosition, 2) <<" displacement: "<< Amg::toString(diffHitPosition, 2) <<std::endl;
832  chamberOkay = false;
833  }
835  const int diffPadNumber{testPad.padNumber - refPad.padNumber};
836  if (std::abs(diffPadNumber) > 0 || testPad.padNumber < 0 || refPad.padNumber < 0) {
837  std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
838  <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " padNumber: "
839  <<testPad.padNumber <<" should be "<<refPad.padNumber <<" displacement: "<< diffPadNumber
840  << " Hit Position: "<< Amg::toString(testPad.hitPosition, 2) << " BL Corner: "
841  << Amg::toString(testPad.localPadCornerBL, 2) << std::endl;
842  chamberOkay = false;
843  }
844 
845  if (!chamberOkay) {
846  return_code = EXIT_FAILURE;
847  }
848  }
849  }
850  return return_code;
851 }
852 
853 
dumpTgcDigiDeadChambers.gasGap
list gasGap
Definition: dumpTgcDigiDeadChambers.py:33
sTgcChamber::sTgcLayer
Helper struct to assess that the layers are properly oriented.
Definition: runsTgcGeoComparison.cxx:159
sTgcChamber::wireCutout
std::vector< float > wireCutout
Definition: runsTgcGeoComparison.cxx:75
python.SystemOfUnits.s
int s
Definition: SystemOfUnits.py:131
CxxUtils::starts_with
bool starts_with(const char *s, const char *prefix)
Test whether one null-terminated byte string starts with another.
PathResolver::FindCalibFile
static std::string FindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.h:108
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
sTgcChamber::padHeight
std::vector< float > padHeight
Definition: runsTgcGeoComparison.cxx:119
plotting.yearwise_efficiency.channel
channel
Definition: yearwise_efficiency.py:28
sTgcChamber::operator<
bool operator<(const sTgcChamber &other) const
Sorting operator to insert the object into std::set.
Definition: runsTgcGeoComparison.cxx:47
dumpTgcDigiDeadChambers.stationName
dictionary stationName
Definition: dumpTgcDigiDeadChambers.py:30
Amg::Vector2D
Eigen::Matrix< double, 2, 1 > Vector2D
Definition: GeoPrimitives.h:48
readTreeDump
std::set< sTgcChamber > readTreeDump(const std::string &inputFile)
Definition: runsTgcGeoComparison.cxx:221
makeTOC.inFile
string inFile
Definition: makeTOC.py:5
sTgcChamber::sTgcLayer::operator<
bool operator<(const sTgcLayer &other) const
Ordering operator.
Definition: runsTgcGeoComparison.cxx:165
sTgcChamber::sTgcPad::globalPadCornerBL
Amg::Vector3D globalPadCornerBL
global pad corner positions
Definition: runsTgcGeoComparison.cxx:135
module_driven_slicing.layers
layers
Definition: module_driven_slicing.py:114
sTgcChamber::sTgcPad::localPadCornerBR
Amg::Vector2D localPadCornerBR
Definition: runsTgcGeoComparison.cxx:131
sTgcChamber::sTgcChannel::operator<
bool operator<(const sTgcChannel &other) const
Ordering operator to use the wireGroup with set.
Definition: runsTgcGeoComparison.cxx:101
TEST_BASICPROP
#define TEST_BASICPROP(attribute, propName)
Definition: runsTgcGeoComparison.cxx:567
plotIsoValidation.treeReader
treeReader
Definition: plotIsoValidation.py:127
sTgcChamber::sTgcPad
Definition: runsTgcGeoComparison.cxx:124
UploadAMITag.l
list l
Definition: UploadAMITag.larcaf.py:158
sTgcChamber::numPadPhi
std::vector< uint > numPadPhi
Definition: runsTgcGeoComparison.cxx:117
reference
Definition: hcg.cxx:437
TrigInDetValidation_Base.test
test
Definition: TrigInDetValidation_Base.py:144
LArCellConditions.argv
argv
Definition: LArCellConditions.py:112
sTgcChamber::sTgcPad::localPadCornerBL
Amg::Vector2D localPadCornerBL
local pad corner positions
Definition: runsTgcGeoComparison.cxx:130
sTgcChamber::sTgcPad::padEta
short padEta
Pad Eta number.
Definition: runsTgcGeoComparison.cxx:144
sTgcChamber::sTgcPad::padPhi
short padPhi
Pad Phi number.
Definition: runsTgcGeoComparison.cxx:146
dq_defect_copy_defect_database.channels
def channels
Definition: dq_defect_copy_defect_database.py:56
sTgcChamber::sTgcPad::gasGap
unsigned int gasGap
Gas gap of the Pad.
Definition: runsTgcGeoComparison.cxx:148
sTgcChamber::sTgcPad::localPadCornerTR
Amg::Vector2D localPadCornerTR
Definition: runsTgcGeoComparison.cxx:133
sTgcChamber::numPadEta
std::vector< uint > numPadEta
Definition: runsTgcGeoComparison.cxx:116
Amg::getTransformFromRotTransl
Amg::Transform3D getTransformFromRotTransl(Amg::RotationMatrix3D rot, Amg::Vector3D transl_vec)
Definition: GeoPrimitivesHelpers.h:172
GeoPrimitives.h
uint
unsigned int uint
Definition: LArOFPhaseFill.cxx:20
sTgcChamber::firstPadHeight
std::vector< float > firstPadHeight
Definition: runsTgcGeoComparison.cxx:118
sTgcChamber::firstWireGroupWidth
std::vector< uint > firstWireGroupWidth
Definition: runsTgcGeoComparison.cxx:73
Amg::toString
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Definition: GeoPrimitivesToStringConverter.h:40
MuonGMR4
Definition: ChamberAssembleTool.h:16
sTgcChamber::design
std::string design
Definition: runsTgcGeoComparison.cxx:44
dqt_zlumi_pandas.err
err
Definition: dqt_zlumi_pandas.py:193
CaloCondBlobAlgs_fillNoiseFromASCII.inputFile
string inputFile
Definition: CaloCondBlobAlgs_fillNoiseFromASCII.py:17
sTgcChamber::firstPadPhiDiv
std::vector< float > firstPadPhiDiv
Definition: runsTgcGeoComparison.cxx:121
sTgcChamber::numPads
std::vector< uint > numPads
Definition: runsTgcGeoComparison.cxx:115
TRT::Hit::layer
@ layer
Definition: HitInfo.h:79
Amg::Transform3D
Eigen::Affine3d Transform3D
Definition: GeoPrimitives.h:46
Amg::doesNotDeform
bool doesNotDeform(const Amg::Transform3D &trans)
Checks whether the linear part of the transformation rotates or stetches any of the basis vectors.
Definition: GeoPrimitivesHelpers.h:338
Amg::transform
Amg::Vector3D transform(Amg::Vector3D &v, Amg::Transform3D &tr)
Transform a point from a Trasformation3D.
Definition: GeoPrimitivesHelpers.h:156
sTgcChamber::sTgcPad::localPosition
Amg::Vector2D localPosition
local pad postion
Definition: runsTgcGeoComparison.cxx:126
sTgcChamber::numWires
std::vector< unsigned int > numWires
Definition: runsTgcGeoComparison.cxx:72
python.SystemOfUnits.micrometer
int micrometer
Definition: SystemOfUnits.py:71
DQHistogramMergeRegExp.argc
argc
Definition: DQHistogramMergeRegExp.py:20
starts_with.h
C++20-like starts_with/ends_with for strings.
create_dcsc_inputs_sqlite.arg
list arg
Definition: create_dcsc_inputs_sqlite.py:48
tolerance
Definition: suep_shower.h:17
sTgcChamber::sTgcPad::globalPadCornerBR
Amg::Vector3D globalPadCornerBR
Definition: runsTgcGeoComparison.cxx:136
sTgcChamber::sTgcChamber
sTgcChamber()=default
Default constructor.
PathResolver.h
sTgcChamber::sTgcPad::operator<
bool operator<(const sTgcPad &other) const
Ordering operator to use the Pad with set.
Definition: runsTgcGeoComparison.cxx:151
sTgcChamber::sTgcPad::globalPadCornerTL
Amg::Vector3D globalPadCornerTL
Definition: runsTgcGeoComparison.cxx:137
sTgcChamber
Helper struct to represent a full sTgc chamber.
Definition: runsTgcGeoComparison.cxx:34
sTgcChamber::sTgcChannel
Definition: runsTgcGeoComparison.cxx:87
HI::TowerBins::numLayers
constexpr unsigned int numLayers()
Definition: HIEventDefs.h:23
Amg::Vector3D
Eigen::Matrix< double, 3, 1 > Vector3D
Definition: GeoPrimitives.h:47
main
int main(int argc, char **argv)
Definition: runsTgcGeoComparison.cxx:575
sTgcChamber::sTgcPad::localPadCornerTL
Amg::Vector2D localPadCornerTL
Definition: runsTgcGeoComparison.cxx:132
sTgcChamber::numWireGroups
std::vector< uint > numWireGroups
Definition: runsTgcGeoComparison.cxx:74
InDetDD::other
@ other
Definition: InDetDD_Defs.h:16
Amg::RotationMatrix3D
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Definition: GeoPrimitives.h:49
GeoPrimitivesHelpers.h
sTgcChamber::stationIndex
int stationIndex
Definition: runsTgcGeoComparison.cxx:40
GeoPrimitivesToStringConverter.h
sTgcChamber::padNumber
std::vector< int > padNumber
Definition: runsTgcGeoComparison.cxx:114
sTgcChamber::padPhiShift
std::vector< float > padPhiShift
Definition: runsTgcGeoComparison.cxx:120
sTgcChamber::stationName
std::string stationName
Definition: runsTgcGeoComparison.cxx:39
MuonDetectorDefs.h
ActsTrk
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
Definition: MuonDetectorBuilderTool.cxx:34
CscCalibQuery.testFile
testFile
Definition: CscCalibQuery.py:274
sTgcChamber::sTgcLayer::gasGap
unsigned int gasGap
Gas gap number of the layer.
Definition: runsTgcGeoComparison.cxx:161
MuonGMR4::operator<<
std::ostream & operator<<(std::ostream &ostr, const CutOutArea &cut)
Definition: CutOutArea.h:23
sTgcChamber::sTgcPad::globalPosition
Amg::Vector3D globalPosition
global pad postion
Definition: runsTgcGeoComparison.cxx:128
sTgcChamber::firstStripPitch
std::vector< float > firstStripPitch
Definition: runsTgcGeoComparison.cxx:84
sTgcChamber::sTgcChannel::localPosition
Amg::Vector2D localPosition
local strip postion
Definition: runsTgcGeoComparison.cxx:89
python.compressB64.c
def c
Definition: compressB64.py:93
generate::Zero
void Zero(TH1D *hin)
Definition: generate.cxx:32
sTgcChamber::sTgcPad::globalPadCornerTR
Amg::Vector3D globalPadCornerTR
Definition: runsTgcGeoComparison.cxx:138