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