ATLAS Offline Software
Loading...
Searching...
No Matches
runsTgcGeoComparison.cxx
Go to the documentation of this file.
1
2/*
3 Copyright (C) 2002-2026 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#include "Acts/Utilities/UnitVectors.hpp"
29#include "Acts/Definitions/Units.hpp"
30
31
32using namespace MuonGMR4;
33using namespace ActsTrk;
34
35Amg::Vector3D makeDir(const double theta, const double phi) {
36 using namespace Acts::UnitLiterals;
37 return Acts::makeDirectionFromPhiTheta(phi *1._degree, theta* 1._degree);
38}
39
40constexpr double tolerance = 100.*Gaudi::Units::micrometer;
41
45 sTgcChamber() = default;
46
49 int stationEta{0};
50 int stationPhi{0};
52 std::string design{};
53
55 Amg::Transform3D alignableTransform{Amg::Transform3D::Identity()};
56
58 bool operator<(const sTgcChamber& other) const {
59 if (stationIndex != other.stationIndex) return stationIndex < other.stationIndex;
60 if (stationEta != other.stationEta) return stationEta < other.stationEta;
61 if (stationPhi != other.stationPhi) return stationPhi < other.stationPhi;
62 return stationMultilayer < other.stationMultilayer;
63 }
64
66 Amg::Transform3D geoModelTransform{Amg::Transform3D::Identity()};
67
69 unsigned int numLayers{0};
70 double yCutout{0.f};
71 double gasTck{0.f};
72
74 double sChamberLength{0.f};
75 double lChamberLength{0.f};
76 double chamberHeight{0.f};
77 double sGapLength{0.f};
78 double lGapLength{0.f};
79 double gapHeight{0.f};
80
81
83 std::vector<unsigned int> numWires;
84 std::vector<uint> firstWireGroupWidth;
85 std::vector<uint> numWireGroups;
86 std::vector<float> wireCutout;
87 double wirePitch{0.f};
88 double wireWidth{0.f};
90
92 unsigned int numStrips{0};
93 double stripPitch{0.f};
94 double stripWidth{0.f};
95 std::vector<float> firstStripPitch;
96
100 Amg::Vector2D localPosition{Amg::Vector2D::Zero()};
102 Amg::Vector3D globalPosition{Amg::Vector3D::Zero()};
104 unsigned int channelNumber{0};
106 unsigned int gasGap{0};
108 unsigned int channelType{0};
110 double channelLen{0};
112 bool operator<(const sTgcChannel& other) const {
113 if (gasGap != other.gasGap) return gasGap < other.gasGap;
114 if (channelType != other.channelType) return channelType < other.channelType;
115 return channelNumber < other.channelNumber;
116 }
117 };
118
120 double sPadLength{0.f};
121 double lPadLength{0.f};
122 double anglePadPhi{0.f};
123 double beamlineRadius{0.f};
124
125 std::vector<int> padNumber;
126 std::vector<uint> numPads;
127 std::vector<uint> numPadEta;
128 std::vector<uint> numPadPhi;
129 std::vector<float> firstPadHeight;
130 std::vector<float> padHeight;
131 std::vector<float> padPhiShift;
132 std::vector<float> firstPadPhiDiv;
133
135 struct sTgcPad{
137 Amg::Vector2D localPosition{Amg::Vector2D::Zero()};
139 Amg::Vector3D globalPosition{Amg::Vector3D::Zero()};
141 Amg::Vector2D localPadCornerBL{Amg::Vector2D::Zero()};
142 Amg::Vector2D localPadCornerBR{Amg::Vector2D::Zero()};
143 Amg::Vector2D localPadCornerTL{Amg::Vector2D::Zero()};
144 Amg::Vector2D localPadCornerTR{Amg::Vector2D::Zero()};
146 Amg::Vector3D globalPadCornerBL{Amg::Vector3D::Zero()};
147 Amg::Vector3D globalPadCornerBR{Amg::Vector3D::Zero()};
148 Amg::Vector3D globalPadCornerTL{Amg::Vector3D::Zero()};
149 Amg::Vector3D globalPadCornerTR{Amg::Vector3D::Zero()};
151 Amg::Vector2D hitPosition{Amg::Vector2D::Zero()};
153 int padNumber{0};
155 short padEta{0};
157 short padPhi{0};
159 unsigned int gasGap{0};
160
162 bool operator<(const sTgcPad& other) const {
163 if (gasGap != other.gasGap) return gasGap < other.gasGap;
164 if (padPhi != other.padPhi) return padPhi < other.padPhi;
165 return padEta < other.padEta;
166 }
167 };
168
170 struct sTgcLayer {
172 unsigned int gasGap{0};
175 chType_t chType{chType_t::Wire};
177 Amg::Transform3D transform{Amg::Transform3D::Identity()};
179 bool operator<(const sTgcLayer& other) const {
180 if (chType != other.chType) return chType < other.chType;
181 return gasGap < other.gasGap;
182 }
183 };
184 std::set<sTgcChannel> channels{};
185 std::set<sTgcPad> pads{};
186 std::set<sTgcLayer> layers{};
187
188};
189
190
193std::ostream& operator<<(std::ostream& ostr, const sTgcChamber& chamb) {
194 static const std::map<int, std::string> stationDict{
195 {57, "STS"}, {58, "STL"}
196 };
197 ostr<<"sTgc chamber "<<stationDict.at(chamb.stationIndex)<<", eta: "<<chamb.stationEta
198 <<", ml: "<<chamb.stationMultilayer;
199 return ostr;
200}
201
202std::ostream& operator<<(std::ostream& ostr,const sTgcChamber::sTgcChannel & channel) {
203 ostr<<"channel (gasGap/number): ";
204 ostr<<channel.gasGap<<"/";
205 ostr<<channel.channelNumber<<", ";
206 ostr<<channel.channelType<<", ";
207 ostr<<" global Position: "<<Amg::toString(channel.globalPosition, 2)<<", ";
208 ostr<<" local Position: "<<Amg::toString(channel.localPosition, 2);
209 return ostr;
210}
211
212std::ostream& operator<<(std::ostream& ostr,const sTgcChamber::sTgcPad & pad) {
213 ostr<<"pad (gasGap/padEta/padPhi): ";
214 ostr<<pad.gasGap<<"/";
215 ostr<<pad.padEta<<"/"<<pad.padPhi<<", ";
216 ostr<<"global position: "<<Amg::toString(pad.globalPosition, 2);
217 ostr<<"Bottom-left globalPadCorner: "<<Amg::toString(pad.globalPadCornerBL, 2);
218 ostr<<"Bottom-right globalpadCorner: "<<Amg::toString(pad.globalPadCornerBR, 2);
219 ostr<<"Top-left globalpadCorner: "<<Amg::toString(pad.globalPadCornerTL, 2);
220 ostr<<"Top-right globalpadCorner: "<<Amg::toString(pad.globalPadCornerTR, 2);
221
222 ostr<<"local position: "<<Amg::toString(pad.localPosition, 2);
223 ostr<<"Bottom-left localPadCorner: "<<Amg::toString(pad.localPadCornerBL, 2);
224 ostr<<"Bottom-right localpadCorner: "<<Amg::toString(pad.localPadCornerBR, 2);
225 ostr<<"Top-left localpadCorner: "<<Amg::toString(pad.localPadCornerTL, 2);
226 ostr<<"Top-right localpadCorner: "<<Amg::toString(pad.localPadCornerTR, 2);
227 return ostr;
228}
229
230std::ostream& operator<<(std::ostream& ostr,const sTgcChamber::sTgcLayer & layer) {
231 ostr<<"(gasGap/channelType): ";
232 ostr<<layer.gasGap<<", ";
233 switch (layer.chType) {
235 ostr<<"pad, ";
236 break;
238 ostr<<"wire, ";
239 break;
241 ostr<<"strip, ";
242 break;
243
244 };
245 //ostr<<"transform: "<<Amg::toString(layer.transform);
246 return ostr;
247}
248
249std::set<sTgcChamber> readTreeDump(const std::string& inputFile) {
250 std::set<sTgcChamber> to_ret{};
251 std::cout<<"Read the sTgc geometry tree dump from "<<inputFile<<std::endl;
252 std::unique_ptr<TFile> inFile{TFile::Open(inputFile.c_str())};
253 if (!inFile || !inFile->IsOpen()) {
254 std::cerr<<__FILE__<<":"<<__LINE__<<" Failed to open "<<inputFile<<std::endl;
255 return to_ret;
256 }
257 TTreeReader treeReader("sTgcGeoModelTree", inFile.get());
258 if (treeReader.IsInvalid()){
259 std::cerr<<__FILE__<<":"<<__LINE__<<" The file "<<inputFile<<" does not contain the 'sTgcGeoModelTree'"<<std::endl;
260 return to_ret;
261 }
262
264 TTreeReaderValue<short> stationIndex{treeReader, "stationIndex"};
265 TTreeReaderValue<short> stationEta{treeReader, "stationEta"};
266 TTreeReaderValue<short> stationPhi{treeReader, "stationPhi"};
267 TTreeReaderValue<short> stationMultilayer{treeReader, "stationMultilayer"};
268 TTreeReaderValue<std::string> chamberDesign{treeReader,"chamberDesign"};
269
271 TTreeReaderValue<short> numLayers{treeReader, "numLayers"};
272 TTreeReaderValue<float> yCutout{treeReader, "yCutout"};
273 TTreeReaderValue<float> gasTck{treeReader, "gasTck"};
275 TTreeReaderValue<float> sChamberLength{treeReader, "sChamberLength"};
276 TTreeReaderValue<float> lChamberLength{treeReader, "lChamberLength"};
277 TTreeReaderValue<float> chamberHeight{treeReader, "chamberHeight"};
279 TTreeReaderValue<float> sGapLength{treeReader, "sGapLength"};
280 TTreeReaderValue<float> lGapLength{treeReader, "lGapLength"};
281 TTreeReaderValue<float> gapHeight{treeReader, "gapHeight"};
282
284 TTreeReaderValue<std::vector<uint>> numWires{treeReader, "numWires"};
285 TTreeReaderValue<std::vector<uint>> firstWireGroupWidth{treeReader, "firstWireGroupWidth"};
286 TTreeReaderValue<std::vector<uint>> numWireGroups{treeReader, "numWireGroups"};
287 TTreeReaderValue<std::vector<float>> wireCutout{treeReader, "wireCutout"};
288 TTreeReaderValue<float> wirePitch{treeReader, "wirePitch"};
289 TTreeReaderValue<float> wireWidth{treeReader, "wireWidth"};
290 TTreeReaderValue<uint> wireGroupWidth{treeReader, "wireGroupWidth"};
291
292 TTreeReaderValue<std::vector<float>> globalWireGroupPosX{treeReader, "globalWireGroupPosX"};
293 TTreeReaderValue<std::vector<float>> globalWireGroupPosY{treeReader, "globalWireGroupPosY"};
294 TTreeReaderValue<std::vector<float>> globalWireGroupPosZ{treeReader, "globalWireGroupPosZ"};
295
296 TTreeReaderValue<std::vector<float>> localWireGroupPosX{treeReader, "localWireGroupPosX"};
297 TTreeReaderValue<std::vector<float>> localWireGroupPosY{treeReader, "localWireGroupPosY"};
298
299 TTreeReaderValue<std::vector<uint8_t>> wireGroupNum{treeReader, "wireGroupNum"};
300 TTreeReaderValue<std::vector<uint8_t>> wireGroupGasGap{treeReader, "wireGroupGasGap"};
301
303 TTreeReaderValue<uint> numStrips{treeReader, "numStrips"};
304 TTreeReaderValue<float> stripPitch{treeReader, "stripPitch"};
305 TTreeReaderValue<float> stripWidth{treeReader, "stripWidth"};
306
307 TTreeReaderValue<std::vector<float>> globalStripPosX{treeReader, "globalStripPosX"};
308 TTreeReaderValue<std::vector<float>> globalStripPosY{treeReader, "globalStripPosY"};
309 TTreeReaderValue<std::vector<float>> globalStripPosZ{treeReader, "globalStripPosZ"};
310
311 TTreeReaderValue<std::vector<float>> localStripPosX{treeReader, "localStripPosX"};
312 TTreeReaderValue<std::vector<float>> localStripPosY{treeReader, "localStripPosY"};
313
314 TTreeReaderValue<std::vector<uint>> stripNum{treeReader, "stripNumber"};
315 TTreeReaderValue<std::vector<uint8_t>> stripGasGap{treeReader, "stripGasGap"};
316 TTreeReaderValue<std::vector<float>> stripLengths{treeReader, "stripLengths"};
317
319 TTreeReaderValue<float> sPadLength{treeReader, "sPadLength"};
320 TTreeReaderValue<float> lPadLength{treeReader, "lPadLength"};
321 TTreeReaderValue<float> anglePadPhi{treeReader, "anglePadPhi"};
322 TTreeReaderValue<float> beamlineRadius{treeReader, "beamlineRadius"};
323 TTreeReaderValue<std::vector<uint>> numPads{treeReader, "numPads"};
324 TTreeReaderValue<std::vector<uint>> numPadEta{treeReader, "numPadEta"};
325 TTreeReaderValue<std::vector<uint>> numPadPhi{treeReader, "numPadPhi"};
326 TTreeReaderValue<std::vector<float>> firstPadHeight{treeReader, "firstPadHeight"};
327 TTreeReaderValue<std::vector<float>> padHeight{treeReader, "padHeight"};
328 TTreeReaderValue<std::vector<float>> padPhiShift{treeReader, "padPhiShift"};
329 TTreeReaderValue<std::vector<float>> firstPadPhiDiv{treeReader, "firstPadPhiDiv"};
330
331 TTreeReaderValue<std::vector<float>> globalPadCornerBRX{treeReader, "globalPadCornerBRX"};
332 TTreeReaderValue<std::vector<float>> globalPadCornerBRY{treeReader, "globalPadCornerBRY"};
333 TTreeReaderValue<std::vector<float>> globalPadCornerBRZ{treeReader, "globalPadCornerBRZ"};
334
335 TTreeReaderValue<std::vector<float>> globalPadCornerBLX{treeReader, "globalPadCornerBLX"};
336 TTreeReaderValue<std::vector<float>> globalPadCornerBLY{treeReader, "globalPadCornerBLY"};
337 TTreeReaderValue<std::vector<float>> globalPadCornerBLZ{treeReader, "globalPadCornerBLZ"};
338
339 TTreeReaderValue<std::vector<float>> globalPadCornerTRX{treeReader, "globalPadCornerTRX"};
340 TTreeReaderValue<std::vector<float>> globalPadCornerTRY{treeReader, "globalPadCornerTRY"};
341 TTreeReaderValue<std::vector<float>> globalPadCornerTRZ{treeReader, "globalPadCornerTRZ"};
342
343 TTreeReaderValue<std::vector<float>> globalPadCornerTLX{treeReader, "globalPadCornerTLX"};
344 TTreeReaderValue<std::vector<float>> globalPadCornerTLY{treeReader, "globalPadCornerTLY"};
345 TTreeReaderValue<std::vector<float>> globalPadCornerTLZ{treeReader, "globalPadCornerTLZ"};
346
347 TTreeReaderValue<std::vector<float>> globalPadPosX{treeReader, "globalPadPosX"};
348 TTreeReaderValue<std::vector<float>> globalPadPosY{treeReader, "globalPadPosY"};
349 TTreeReaderValue<std::vector<float>> globalPadPosZ{treeReader, "globalPadPosZ"};
350
351 TTreeReaderValue<std::vector<float>> localPadCornerBRX{treeReader, "localPadCornerBRX"};
352 TTreeReaderValue<std::vector<float>> localPadCornerBRY{treeReader, "localPadCornerBRY"};
353
354 TTreeReaderValue<std::vector<float>> localPadCornerBLX{treeReader, "localPadCornerBLX"};
355 TTreeReaderValue<std::vector<float>> localPadCornerBLY{treeReader, "localPadCornerBLY"};
356
357 TTreeReaderValue<std::vector<float>> localPadCornerTRX{treeReader, "localPadCornerTRX"};
358 TTreeReaderValue<std::vector<float>> localPadCornerTRY{treeReader, "localPadCornerTRY"};
359
360 TTreeReaderValue<std::vector<float>> localPadCornerTLX{treeReader, "localPadCornerTLX"};
361 TTreeReaderValue<std::vector<float>> localPadCornerTLY{treeReader, "localPadCornerTLY"};
362
363 TTreeReaderValue<std::vector<float>> localPadPosX{treeReader, "localPadPosX"};
364 TTreeReaderValue<std::vector<float>> localPadPosY{treeReader, "localPadPosY"};
365
366 TTreeReaderValue<std::vector<float>> hitPositionX{treeReader, "hitPositionX"};
367 TTreeReaderValue<std::vector<float>> hitPositionY{treeReader, "hitPositionY"};
368 TTreeReaderValue<std::vector<int>> padNumber{treeReader, "padNumber"};
369
370 TTreeReaderValue<std::vector<uint8_t>> padGasGap{treeReader, "padGasGap"};
371 TTreeReaderValue<std::vector<uint>> padEta{treeReader, "padEtaNumber"};
372 TTreeReaderValue<std::vector<uint>> padPhi{treeReader, "padPhiNumber"};
373
375 TTreeReaderValue<std::vector<float>> geoModelTransformX{treeReader, "GeoModelTransformX"};
376 TTreeReaderValue<std::vector<float>> geoModelTransformY{treeReader, "GeoModelTransformY"};
377 TTreeReaderValue<std::vector<float>> geoModelTransformZ{treeReader, "GeoModelTransformZ"};
378
379 TTreeReaderValue<std::vector<float>> alignableNodeX{treeReader, "AlignableNodeX"};
380 TTreeReaderValue<std::vector<float>> alignableNodeY{treeReader, "AlignableNodeY"};
381 TTreeReaderValue<std::vector<float>> alignableNodeZ{treeReader, "AlignableNodeZ"};
383 TTreeReaderValue<std::vector<float>> stripRotCol0Theta{treeReader, "stripRotLinearCol0Theta"};
384 TTreeReaderValue<std::vector<float>> stripRotCol0Phi{treeReader, "stripRotLinearCol0Phi"};
385
386 TTreeReaderValue<std::vector<float>> stripRotCol1Theta{treeReader, "stripRotLinearCol1Theta"};
387 TTreeReaderValue<std::vector<float>> stripRotCol1Phi{treeReader, "stripRotLinearCol1Phi"};
388
389 TTreeReaderValue<std::vector<float>> stripRotCol2Theta{treeReader, "stripRotLinearCol2Theta"};
390 TTreeReaderValue<std::vector<float>> stripRotCol2Phi{treeReader, "stripRotLinearCol2Phi"};
391
392 TTreeReaderValue<std::vector<float>> stripRotTransX{treeReader, "stripRotTranslationX"};
393 TTreeReaderValue<std::vector<float>> stripRotTransY{treeReader, "stripRotTranslationY"};
394 TTreeReaderValue<std::vector<float>> stripRotTransZ{treeReader, "stripRotTranslationZ"};
395
396 TTreeReaderValue<std::vector<uint8_t>> stripRotGasGap{treeReader, "stripRotGasGap"};
397
399 TTreeReaderValue<std::vector<float>> wireGroupRotCol1X{treeReader, "wireGroupRotLinearCol1X"};
400 TTreeReaderValue<std::vector<float>> wireGroupRotCol1Y{treeReader, "wireGroupRotLinearCol1Y"};
401 TTreeReaderValue<std::vector<float>> wireGroupRotCol1Z{treeReader, "wireGroupRotLinearCol1Z"};
402
403 TTreeReaderValue<std::vector<float>> wireGroupRotCol2X{treeReader, "wireGroupRotLinearCol2X"};
404 TTreeReaderValue<std::vector<float>> wireGroupRotCol2Y{treeReader, "wireGroupRotLinearCol2Y"};
405 TTreeReaderValue<std::vector<float>> wireGroupRotCol2Z{treeReader, "wireGroupRotLinearCol2Z"};
406
407 TTreeReaderValue<std::vector<float>> wireGroupRotCol3X{treeReader, "wireGroupRotLinearCol3X"};
408 TTreeReaderValue<std::vector<float>> wireGroupRotCol3Y{treeReader, "wireGroupRotLinearCol3Y"};
409 TTreeReaderValue<std::vector<float>> wireGroupRotCol3Z{treeReader, "wireGroupRotLinearCol3Z"};
410
411 TTreeReaderValue<std::vector<float>> wireGroupRotTransX{treeReader, "wireGroupRotTranslationX"};
412 TTreeReaderValue<std::vector<float>> wireGroupRotTransY{treeReader, "wireGroupRotTranslationY"};
413 TTreeReaderValue<std::vector<float>> wireGroupRotTransZ{treeReader, "wireGroupRotTranslationZ"};
414
415 TTreeReaderValue<std::vector<uint8_t>> wireGroupRotGasGap{treeReader, "wireGroupRotGasGap"};
416
418 TTreeReaderValue<std::vector<float>> padRotCol1X{treeReader, "padRotLinearCol1X"};
419 TTreeReaderValue<std::vector<float>> padRotCol1Y{treeReader, "padRotLinearCol1Y"};
420 TTreeReaderValue<std::vector<float>> padRotCol1Z{treeReader, "padRotLinearCol1Z"};
421
422 TTreeReaderValue<std::vector<float>> padRotCol2X{treeReader, "padRotLinearCol2X"};
423 TTreeReaderValue<std::vector<float>> padRotCol2Y{treeReader, "padRotLinearCol2Y"};
424 TTreeReaderValue<std::vector<float>> padRotCol2Z{treeReader, "padRotLinearCol2Z"};
425
426 TTreeReaderValue<std::vector<float>> padRotCol3X{treeReader, "padRotLinearCol3X"};
427 TTreeReaderValue<std::vector<float>> padRotCol3Y{treeReader, "padRotLinearCol3Y"};
428 TTreeReaderValue<std::vector<float>> padRotCol3Z{treeReader, "padRotLinearCol3Z"};
429
430 TTreeReaderValue<std::vector<float>> padRotTransX{treeReader, "padRotTranslationX"};
431 TTreeReaderValue<std::vector<float>> padRotTransY{treeReader, "padRotTranslationY"};
432 TTreeReaderValue<std::vector<float>> padRotTransZ{treeReader, "padRotTranslationZ"};
433
434 TTreeReaderValue<std::vector<uint8_t>> padRotGasGap{treeReader, "padRotGasGap"};
435
436 while (treeReader.Next()) {
437 sTgcChamber newchamber{};
438
440 newchamber.stationIndex = (*stationIndex);
441 newchamber.stationEta = (*stationEta);
442 newchamber.stationPhi = (*stationPhi);
443 newchamber.stationMultilayer = (*stationMultilayer);
444 newchamber.design = (*chamberDesign);
445
447 newchamber.numLayers = (*numLayers);
448 newchamber.yCutout = (*yCutout);
449 newchamber.gasTck = (*gasTck);
450
452 newchamber.sGapLength = (*sGapLength);
453 newchamber.lGapLength = (*lGapLength);
454 newchamber.gapHeight = (*gapHeight);
456 newchamber.sChamberLength = (*sChamberLength);
457 newchamber.lChamberLength = (*lChamberLength);
458 newchamber.chamberHeight = (*chamberHeight);
459
461 newchamber.numWires = (*numWires);
462 newchamber.firstWireGroupWidth = (*firstWireGroupWidth);
463 newchamber.numWireGroups = (*numWireGroups);
464 newchamber.wireCutout = (*wireCutout);
465 newchamber.wirePitch = (*wirePitch);
466 newchamber.wireWidth = (*wireWidth);
467 newchamber.wireGroupWidth = (*wireGroupWidth);
468
470 newchamber.numStrips = (*numStrips);
471 newchamber.stripPitch = (*stripPitch);
472 newchamber.stripWidth = (*stripWidth);
473
475 newchamber.sPadLength = (*sPadLength);
476 newchamber.lPadLength = (*lPadLength);
477 newchamber.anglePadPhi = (*anglePadPhi);
478 newchamber.beamlineRadius = (*beamlineRadius);
479 newchamber.numPads = (*numPads);
480 newchamber.numPadEta = (*numPadEta);
481 newchamber.numPadPhi = (*numPadPhi);
482 newchamber.firstPadHeight = (*firstPadHeight);
483 newchamber.padHeight = (*padHeight);
484 newchamber.padPhiShift = (*padPhiShift);
485 newchamber.firstPadPhiDiv = (*firstPadPhiDiv);
486
487 Amg::Vector3D geoTrans{(*geoModelTransformX)[0], (*geoModelTransformY)[0], (*geoModelTransformZ)[0]};
488 Amg::RotationMatrix3D geoRot{Amg::RotationMatrix3D::Identity()};
489 geoRot.col(0) = Amg::Vector3D((*geoModelTransformX)[1], (*geoModelTransformY)[1], (*geoModelTransformZ)[1]);
490 geoRot.col(1) = Amg::Vector3D((*geoModelTransformX)[2], (*geoModelTransformY)[2], (*geoModelTransformZ)[2]);
491 geoRot.col(2) = Amg::Vector3D((*geoModelTransformX)[3], (*geoModelTransformY)[3], (*geoModelTransformZ)[3]);
492 newchamber.geoModelTransform = Amg::getTransformFromRotTransl(std::move(geoRot), std::move(geoTrans));
493
494 geoRot.col(0) = Amg::Vector3D((*alignableNodeX)[1], (*alignableNodeY)[1], (*alignableNodeZ)[1]);
495 geoRot.col(1) = Amg::Vector3D((*alignableNodeX)[2], (*alignableNodeY)[2], (*alignableNodeZ)[2]);
496 geoRot.col(2) = Amg::Vector3D((*alignableNodeX)[3], (*alignableNodeY)[3], (*alignableNodeZ)[3]);
497 geoTrans = Amg::Vector3D{(*alignableNodeX)[0], (*alignableNodeY)[0], (*alignableNodeZ)[0]};
498 newchamber.alignableTransform = Amg::getTransformFromRotTransl(std::move(geoRot), std::move(geoTrans));
499 //WireGroups
500 for (size_t wg = 0; wg < globalWireGroupPosX->size(); ++wg){
501 sTgcChamber::sTgcChannel newWireGroup{};
502 newWireGroup.localPosition = Amg::Vector2D{(*localWireGroupPosX)[wg], (*localWireGroupPosY)[wg]};
503 newWireGroup.globalPosition = Amg::Vector3D{(*globalWireGroupPosX)[wg], (*globalWireGroupPosY)[wg], (*globalWireGroupPosZ)[wg]};
504 newWireGroup.gasGap = (*wireGroupGasGap)[wg];
505 newWireGroup.channelNumber = (*wireGroupNum)[wg];
506 newWireGroup.channelType = 2;
508 if (newWireGroup.channelNumber > 0) continue;
509 newchamber.channels.insert(std::move(newWireGroup));
510 }
511
512 //Strips Filling in global positions
513 for (size_t s = 0; s < globalStripPosX->size(); ++s){
514 sTgcChamber::sTgcChannel newStrip{};
515 newStrip.localPosition = Amg::Vector2D{(*localStripPosX)[s], (*localStripPosY)[s]};
516 newStrip.globalPosition = Amg::Vector3D{(*globalStripPosX)[s], (*globalStripPosY)[s], (*globalStripPosZ)[s]};
517 newStrip.gasGap = (*stripGasGap)[s];
518 newStrip.channelNumber = (*stripNum)[s];
519 newStrip.channelType = 1;
520 newStrip.channelLen = (*stripLengths)[s];
522 if (newStrip.channelNumber > 0) continue;
523 newchamber.channels.insert(std::move(newStrip));
524 }
525
526
527 //Pads
528 for (size_t p = 0; p < globalPadPosX->size(); ++p){
529 sTgcChamber::sTgcPad newPad{};
530
531 newPad.globalPosition = Amg::Vector3D{(*globalPadPosX)[p], (*globalPadPosY)[p], (*globalPadPosZ)[p]};
532 newPad.globalPadCornerBR = Amg::Vector3D{(*globalPadCornerBRX)[p], (*globalPadCornerBRY)[p], (*globalPadCornerBRZ)[p]};
533 newPad.globalPadCornerBL = Amg::Vector3D{(*globalPadCornerBLX)[p], (*globalPadCornerBLY)[p], (*globalPadCornerBLZ)[p]};
534 newPad.globalPadCornerTR = Amg::Vector3D{(*globalPadCornerTRX)[p], (*globalPadCornerTRY)[p], (*globalPadCornerTRZ)[p]};
535 newPad.globalPadCornerTL = Amg::Vector3D{(*globalPadCornerTLX)[p], (*globalPadCornerTLY)[p], (*globalPadCornerTLZ)[p]};
536
537 newPad.localPosition = Amg::Vector2D{(*localPadPosX)[p], (*localPadPosY)[p]};
538 newPad.localPadCornerBR = Amg::Vector2D{(*localPadCornerBRX)[p], (*localPadCornerBRY)[p]};
539 newPad.localPadCornerBL = Amg::Vector2D{(*localPadCornerBLX)[p], (*localPadCornerBLY)[p]};
540 newPad.localPadCornerTR = Amg::Vector2D{(*localPadCornerTRX)[p], (*localPadCornerTRY)[p]};
541 newPad.localPadCornerTL = Amg::Vector2D{(*localPadCornerTLX)[p], (*localPadCornerTLY)[p]};
542
543 newPad.hitPosition = Amg::Vector2D{(*hitPositionX)[p], (*hitPositionY)[p]};
544 newPad.padNumber = (*padNumber)[p];
545 newPad.gasGap = (*padGasGap)[p];
546 newPad.padEta = (*padEta)[p];
547 newPad.padPhi = (*padPhi)[p];
549 if (newPad.padEta > 1 || newPad.padPhi > 6) continue;
550 newchamber.pads.insert(std::move(newPad));
551 }
552
553 for (size_t l = 0; l < stripRotGasGap->size(); ++l){
554 sTgcChamber::sTgcLayer stripLayer{};
556 stripLayer.gasGap = (*stripRotGasGap)[l];
557 Amg::RotationMatrix3D stripRot{Amg::RotationMatrix3D::Identity()};
558 stripRot.col(0) = makeDir((*stripRotCol0Theta)[l], (*stripRotCol0Phi)[l]);
559 stripRot.col(1) = makeDir((*stripRotCol1Theta)[l], (*stripRotCol1Phi)[l]);
560 stripRot.col(2) = makeDir((*stripRotCol2Theta)[l], (*stripRotCol2Phi)[l]);
561 Amg::Vector3D layTrans{(*stripRotTransX)[l], (*stripRotTransY)[l], (*stripRotTransZ)[l]};
562 stripLayer.transform = Amg::getTransformFromRotTransl(std::move(stripRot), std::move(layTrans));
563 newchamber.layers.insert(std::move(stripLayer));
564 }
565
566 for (size_t l = 0; l < wireGroupRotGasGap->size(); ++l){
567 sTgcChamber::sTgcLayer wireGroupLayer{};
569 wireGroupLayer.gasGap = (*wireGroupRotGasGap)[l];
570 Amg::RotationMatrix3D wireGroupRot{Amg::RotationMatrix3D::Identity()};
571 wireGroupRot.col(0) = Amg::Vector3D((*wireGroupRotCol1X)[l],(*wireGroupRotCol1Y)[l], (*wireGroupRotCol1Z)[l]);
572 wireGroupRot.col(1) = Amg::Vector3D((*wireGroupRotCol2X)[l],(*wireGroupRotCol2Y)[l], (*wireGroupRotCol2Z)[l]);
573 wireGroupRot.col(2) = Amg::Vector3D((*wireGroupRotCol3X)[l],(*wireGroupRotCol3Y)[l], (*wireGroupRotCol3Z)[l]);
574 Amg::Vector3D layTrans{(*wireGroupRotTransX)[l], (*wireGroupRotTransY)[l], (*wireGroupRotTransZ)[l]};
575 wireGroupLayer.transform = Amg::getTransformFromRotTransl(std::move(wireGroupRot), std::move(layTrans));
576 newchamber.layers.insert(std::move(wireGroupLayer));
577 }
578
579 for (size_t l = 0; l < padRotGasGap->size(); ++l){
580 sTgcChamber::sTgcLayer padLayer{};
582 padLayer.gasGap = (*padRotGasGap)[l];
583 Amg::RotationMatrix3D padRot{Amg::RotationMatrix3D::Identity()};
584 padRot.col(0) = Amg::Vector3D((*padRotCol1X)[l],(*padRotCol1Y)[l], (*padRotCol1Z)[l]);
585 padRot.col(1) = Amg::Vector3D((*padRotCol2X)[l],(*padRotCol2Y)[l], (*padRotCol2Z)[l]);
586 padRot.col(2) = Amg::Vector3D((*padRotCol3X)[l],(*padRotCol3Y)[l], (*padRotCol3Z)[l]);
587 Amg::Vector3D layTrans{(*padRotTransX)[l], (*padRotTransY)[l], (*padRotTransZ)[l]};
588 padLayer.transform = Amg::getTransformFromRotTransl(std::move(padRot), std::move(layTrans));
589 newchamber.layers.insert(std::move(padLayer));
590 }
591
592 auto insert_itr = to_ret.insert(std::move(newchamber));
593 if (!insert_itr.second) {
594 std::stringstream err{};
595 err<<__FILE__<<":"<<__LINE__<<" The chamber "<<(*insert_itr.first).stationIndex
596 <<" has already been inserted. "<<std::endl;
597 throw std::runtime_error(err.str());
598 }
599 }
600 std::cout<<"File parsing is finished. Found in total "<<to_ret.size()<<" readout element dumps "<<std::endl;
601 return to_ret;
602}
603
604#define TEST_BASICPROP(attribute, propName) \
605 if (std::abs(1.*test.attribute - 1.*reference.attribute) > tolerance) { \
606 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": The chamber "<<reference \
607 <<" differs w.r.t "<<propName<<" "<< reference.attribute \
608 <<" (ref) vs. " <<test.attribute << " (test)" << std::endl; \
609 chamberOkay = false; \
610 }
611
612int main1( int argc, char** argv ) {
613 std::string refFile{}, testFile{};
614
615 for (int arg = 1; arg < argc; ++arg) {
616 std::string the_arg{argv[arg]};
617 if (the_arg == "--refFile" && arg +1 < argc) {
618 refFile = std::string{argv[arg+1]};
619 ++arg;
620 } else if (the_arg == "--testFile" && arg + 1 < argc) {
621 testFile = std::string{argv[arg+1]};
622 ++arg;
623 }
624 }
625 if (refFile.empty()) {
626 std::cerr<<"Please parse the path of the reference file via --refFile "<<std::endl;
627 return EXIT_FAILURE;
628 }
629 if (testFile.empty()) {
630 std::cerr<<"Please parse the path of the test file via --testFile "<<std::endl;
631 return EXIT_FAILURE;
632 }
634 if (!refFile.starts_with( "root://")) refFile = PathResolver::FindCalibFile(refFile);
635 if (!testFile.starts_with( "root://")) testFile = PathResolver::FindCalibFile(testFile);
637 std::set<sTgcChamber> refChambers = readTreeDump(refFile);
638 if (refChambers.empty()) {
639 std::cerr<<"The file "<<refFile<<" should contain at least one chamber "<<std::endl;
640 return EXIT_FAILURE;
641 }
642 std::set<sTgcChamber> testChambers = readTreeDump(testFile);
643 if (testChambers.empty()) {
644 std::cerr<<"The file "<<testFile<<" should contain at least one chamber "<<std::endl;
645 return EXIT_FAILURE;
646 }
647 int return_code = EXIT_SUCCESS;
649 for (const sTgcChamber& reference : refChambers) {
650 std::set<sTgcChamber>::const_iterator test_itr = testChambers.find(reference);
651
652 if (test_itr == testChambers.end()) {
653 std::cerr<<"The chamber "<<reference<<" is not part of the testing "<<std::endl;
654 return_code = EXIT_FAILURE;
655 continue;
656 }
657 bool chamberOkay = true;
658 const sTgcChamber& test = {*test_itr};
659
660 const Amg::Transform3D alignableDistort = test.alignableTransform.inverse()*(reference.alignableTransform );
661 if (!Amg::doesNotDeform(alignableDistort) || alignableDistort.translation().mag() > tolerance) {
662 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": The alignable nodes are at differnt places for "
663 <<test<<". " <<Amg::toString(alignableDistort, true)<<std::endl;
664 chamberOkay = false;
665 }
666
667 TEST_BASICPROP(numLayers, "number of gas gaps");
668 TEST_BASICPROP(yCutout, "yCutout of the Chamber");
669 TEST_BASICPROP(gasTck, "thickness of the gas gap");
670
672 TEST_BASICPROP(sChamberLength, "Chamber length on the short side");
673 TEST_BASICPROP(lChamberLength, "Chamber length on the long side");
674 TEST_BASICPROP(chamberHeight, "Chamber height");
675 TEST_BASICPROP(sGapLength, "GasGap length on the short side");
676 TEST_BASICPROP(lGapLength, "GasGap length on the long side");
677 TEST_BASICPROP(gapHeight, "GasGap Height");
678
679 TEST_BASICPROP(wirePitch, "pitch of a single wire");
680 TEST_BASICPROP(wireWidth, "width of a single wire");
681 TEST_BASICPROP(wireGroupWidth, "number of wires in a normal wiregroup");
682
683 TEST_BASICPROP(numStrips, "number of strips in a chamber");
684 TEST_BASICPROP(stripPitch, "pitch of a normal strip");
685 TEST_BASICPROP(stripWidth, "width of a normal strip");
686 TEST_BASICPROP(sPadLength, "gasGap length on the short side for pads and wires");
687 TEST_BASICPROP(lPadLength, "gasGap length on the long side for pads and wires");
688 TEST_BASICPROP(anglePadPhi, "angular width of a pad in phi direction");
689 TEST_BASICPROP(beamlineRadius, "distance from the gapCenter to beamline");
690
691 int c = 0;
692 using sTgcLayer = sTgcChamber::sTgcLayer;
693 for (const sTgcLayer& refLayer : reference.layers) {
694 std::set<sTgcLayer>::const_iterator lay_itr = test.layers.find(refLayer);
695 if (lay_itr == test.layers.end()) {
696 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
697 <<refLayer<<" is not found. "<<std::endl;
698 chamberOkay = false;
699 continue;
700 }
701 const sTgcLayer& testLayer{*lay_itr};
702 const Amg::Transform3D layAlignment = refLayer.transform.inverse() *
703 testLayer.transform;
705 if (false)
706 std::cout <<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
707 << "The test layer transform for layer "<< c << " is: " << Amg::toString(testLayer.transform)
708 << " and the reference layer transform is: " << Amg::toString(refLayer.transform)
709 <<"difference: "<<Amg::toString(layAlignment)<<std::endl;
710
711 if (!Amg::isIdentity(layAlignment)) {
712 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
713 <<"the layer "<<testLayer<<" is misaligned w.r.t. reference by "
714 <<Amg::toString(layAlignment)<<std::endl;
715 chamberOkay = false;
716 continue;
717 }
719 TEST_BASICPROP(numWires[c], "number of wires in the layer "<< c + 1 << " are ");
720 TEST_BASICPROP(firstWireGroupWidth[c], "number of wires in first wire group in the layer "<< c + 1 << " are ");
722 TEST_BASICPROP(numPads[c], "number of pads in the layer "<< c + 1 << " are ");
723 TEST_BASICPROP(numPadEta[c], "number of pads in the eta direction in the layer "<< c + 1 << " are ");
724 TEST_BASICPROP(numPadPhi[c], "number of in the phi direction in the layer "<< c + 1 << " are ");
725 TEST_BASICPROP(firstPadHeight[c], "height of the first pad row in the layer "<< c + 1 << " are ");
726 TEST_BASICPROP(padHeight[c], "height of pads in the rest of the rows in the layer "<< c + 1 << " are ");
727 TEST_BASICPROP(padPhiShift[c], "shift of inner pad edges in phi direction in the layer "<< c + 1 << " are ");
728 TEST_BASICPROP(firstPadPhiDiv[c], "angular position of the outer edge of the first pad in the layer "<< c + 1 << " are ");
729 c = (c+1)% 4;
730 }
731
732 using sTgcChannel = sTgcChamber::sTgcChannel;
733 for (const sTgcChannel& refChannel : reference.channels) {
734 std::set<sTgcChannel>::const_iterator channel_itr = test.channels.find(refChannel);
735 if (channel_itr == test.channels.end()) {
736 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
737 <<refChannel<<" is not found. "<<std::endl;
738 chamberOkay = false;
739 continue;
740 }
741 const sTgcChannel& testChannel{*channel_itr};
742
743 const Amg::Vector3D diffGlobalPos{testChannel.globalPosition - refChannel.globalPosition};
744 const Amg::Vector2D diffLocalPos{testChannel.localPosition - refChannel.localPosition};
745 if (diffGlobalPos.mag() > tolerance) {
746 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"channel (gasGap/number): "
747 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " global position: "
748 <<Amg::toString(testChannel.globalPosition, 2)<<" should be located at "<<Amg::toString(refChannel.globalPosition, 2)
749 <<" displacement: "<<Amg::toString(diffGlobalPos,2)<<std::endl;
750 chamberOkay = false;
751 }
752 if (diffLocalPos.mag() > tolerance) {
753 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"channel (gasGap/number): "
754 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " local position: "
755 <<Amg::toString(testChannel.localPosition, 2)<<" should be located at "<<Amg::toString(refChannel.localPosition, 2)
756 <<" displacement: "<<Amg::toString(diffLocalPos,2)<<std::endl;
757 chamberOkay = false;
758 }
759 const double diffChannelLen{testChannel.channelLen - refChannel.channelLen};
760 if (std::abs(diffChannelLen) > tolerance) {
761 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"channel (gasGap/number): "
762 <<testChannel.gasGap<<"/"<<testChannel.channelNumber<<", chType: "<<testChannel.channelType<<", "<< " Run 4 strip Length: "
763 <<testChannel.channelLen<<" Run 3 strip Length "<<refChannel.channelLen
764 <<" displacement: "<<diffChannelLen<<std::endl;
765 chamberOkay = false;
766 }
767 }
768
769 using sTgcPad = sTgcChamber::sTgcPad;
770 for (const sTgcPad& refPad : reference.pads) {
771 std::set<sTgcPad>::const_iterator pad_itr = test.pads.find(refPad);
772 if (pad_itr == test.pads.end()) {
773 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "
774 <<refPad<<" is not found. "<<std::endl;
775 chamberOkay = false;
776 continue;
777 }
778 const sTgcPad& testPad{*pad_itr};
780 const Amg::Vector2D diffLocalPadPos{testPad.localPosition - refPad.localPosition};
781 if (diffLocalPadPos.mag() > tolerance) {
782 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
783 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " local position: "
784 <<Amg::toString(testPad.localPosition, 2)<<" should be located at "<<Amg::toString(refPad.localPosition, 2)
785 <<" displacement: "<<Amg::toString(diffLocalPadPos,2)<<std::endl;
786 chamberOkay = false;
787 }
789 const Amg::Vector2D diffLocalPadCornerBL{testPad.localPadCornerBL - refPad.localPadCornerBL};
790 if (diffLocalPadCornerBL.mag() > tolerance) {
791 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
792 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-left corner: "
793 <<Amg::toString(testPad.localPadCornerBL, 2)<<" should be located at "<<Amg::toString(refPad.localPadCornerBL, 2)
794 <<" displacement: "<<Amg::toString(diffLocalPadCornerBL,2)<<std::endl;
795 chamberOkay = false;
796 }
798 const Amg::Vector2D diffLocalPadCornerBR{testPad.localPadCornerBR - refPad.localPadCornerBR};
799 if (diffLocalPadCornerBR.mag() > tolerance) {
800 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
801 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-right corner: "
802 <<Amg::toString(testPad.localPadCornerBR, 2)<<" should be located at "<<Amg::toString(refPad.localPadCornerBR, 2)
803 <<" displacement: "<<Amg::toString(diffLocalPadCornerBR,2)<<std::endl;
804 chamberOkay = false;
805 }
807 const Amg::Vector2D diffLocalPadCornerTL{testPad.localPadCornerTL - refPad.localPadCornerTL};
808 if (diffLocalPadCornerTL.mag() > tolerance) {
809 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
810 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-left corner: "
811 <<Amg::toString(testPad.localPadCornerTL, 2)<<" should be located at "<<Amg::toString(refPad.localPadCornerTL, 2)
812 <<" displacement: "<<Amg::toString(diffLocalPadCornerTL,2)<<std::endl;
813 chamberOkay = false;
814 }
816 const Amg::Vector2D diffLocalPadCornerTR{testPad.localPadCornerTR - refPad.localPadCornerTR};
817 if (diffLocalPadCornerTR.mag() > tolerance) {
818 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
819 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-right corner: "
820 <<Amg::toString(testPad.localPadCornerTR, 2)<<" should be located at "<<Amg::toString(refPad.localPadCornerTR, 2)
821 <<" displacement: "<<Amg::toString(diffLocalPadCornerTR,2)<<std::endl;
822 chamberOkay = false;
823 }
824
826 const Amg::Vector3D diffGlobalPadPos{testPad.globalPosition - refPad.globalPosition};
827 if (diffGlobalPadPos.mag() > tolerance) {
828 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
829 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " global position: "
830 <<Amg::toString(testPad.globalPosition, 2)<<" should be located at "<<Amg::toString(refPad.globalPosition, 2)
831 <<" displacement: "<<Amg::toString(diffGlobalPadPos,2)<<std::endl;
832 chamberOkay = false;
833 }
835 const Amg::Vector3D diffGlobalPadCornerBL{testPad.globalPadCornerBL - refPad.globalPadCornerBL};
836 if (diffGlobalPadCornerBL.mag() > tolerance) {
837 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
838 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-left corner: "
839 <<Amg::toString(testPad.globalPadCornerBL, 2)<<" should be located at "<<Amg::toString(refPad.globalPadCornerBL, 2)
840 <<" displacement: "<<Amg::toString(diffGlobalPadCornerBL,2)<<std::endl;
841 chamberOkay = false;
842 }
843
845 const Amg::Vector3D diffGlobalPadCornerBR{testPad.globalPadCornerBR - refPad.globalPadCornerBR};
846 if (diffGlobalPadCornerBR.mag() > tolerance) {
847 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
848 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " bottom-right corner: "
849 <<Amg::toString(testPad.globalPadCornerBR, 2)<<" should be located at "<<Amg::toString(refPad.globalPadCornerBR, 2)
850 <<" displacement: "<<Amg::toString(diffGlobalPadCornerBR,2)<<std::endl;
851 chamberOkay = false;
852 }
854 const Amg::Vector3D diffGlobalPadCornerTL{testPad.globalPadCornerTL - refPad.globalPadCornerTL};
855 if (diffGlobalPadCornerTL.mag() > tolerance) {
856 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
857 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-left corner: "
858 <<Amg::toString(testPad.globalPadCornerTL, 2)<<" should be located at "<<Amg::toString(refPad.globalPadCornerTL, 2)
859 <<" displacement: "<<Amg::toString(diffGlobalPadCornerTL,2)<<std::endl;
860 chamberOkay = false;
861 }
863 const Amg::Vector3D diffGlobalPadCornerTR{testPad.globalPadCornerTR - refPad.globalPadCornerTR};
864 if (diffGlobalPadCornerTR.mag() > tolerance) {
865 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
866 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " top-right corner: "
867 <<Amg::toString(testPad.globalPadCornerTR, 2)<<" should be located at "<<Amg::toString(refPad.globalPadCornerTR, 2)
868 <<" displacement: "<<Amg::toString(diffGlobalPadCornerTR,2)<<std::endl;
869 chamberOkay = false;
870 }
872 const Amg::Vector2D diffHitPosition{testPad.hitPosition - refPad.hitPosition};
873 if (diffHitPosition.mag() > tolerance) {
874 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
875 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " Hit Position: "
876 <<Amg::toString(testPad.hitPosition, 2) <<" should be "<<Amg::toString(refPad.hitPosition, 2) <<" displacement: "<< Amg::toString(diffHitPosition, 2) <<std::endl;
877 chamberOkay = false;
878 }
880 const int diffPadNumber{testPad.padNumber - refPad.padNumber};
881 if (std::abs(diffPadNumber) > 0 || testPad.padNumber < 0 || refPad.padNumber < 0) {
882 std::cerr<<"runsTgcGeoComparison() "<<__LINE__<<": in chamber "<<test<<" "<<"pad (gasGap/(padEta, padPhi)): "
883 <<testPad.gasGap<<"/("<<testPad.padEta<<", "<<testPad.padPhi<<"), "<< " padNumber: "
884 <<testPad.padNumber <<" should be "<<refPad.padNumber <<" displacement: "<< diffPadNumber
885 << " Hit Position: "<< Amg::toString(testPad.hitPosition, 2) << " BL Corner: "
886 << Amg::toString(testPad.localPadCornerBL, 2) << std::endl;
887 chamberOkay = false;
888 }
889
890 if (!chamberOkay) {
891 return_code = EXIT_FAILURE;
892 }
893 }
894 }
895 return return_code;
896}
897
898
899int main (int argc, char** argv )
900{
901 int ret = 1;
902 try {
903 ret = main1 (argc, argv);
904 }
905 catch (const std::exception& e) {
906 std::cerr << e.what() << "\n";
907 }
908 return ret;
909}
Scalar phi() const
phi method
Scalar theta() const
theta method
unsigned int uint
static std::string FindCalibFile(const std::string &logical_file_name)
int main()
Definition hello.cxx:18
The AlignStoreProviderAlg loads the rigid alignment corrections and pipes them through the readout ge...
std::string toString(const Translation3D &translation, int precision=4)
GeoPrimitvesToStringConverter.
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
bool isIdentity(const Amg::Transform3D &trans)
Checks whether the transformation is the Identity transformation.
bool doesNotDeform(const Amg::Transform3D &trans)
Checks whether the linear part of the transformation rotates or stetches any of the basis vectors.
Amg::Transform3D getTransformFromRotTransl(Amg::RotationMatrix3D rot, Amg::Vector3D transl_vec)
Eigen::Affine3d Transform3D
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
The ReadoutGeomCnvAlg converts the Run4 Readout geometry build from the GeoModelXML into the legacy M...
#define TEST_BASICPROP(attribute, propName)
std::ostream & operator<<(std::ostream &ostr, const sTgcChamber &chamb)
Translation of the station Index -> station Name.
Amg::Vector3D makeDir(const double theta, const double phi)
std::set< sTgcChamber > readTreeDump(const std::string &inputFile)
unsigned int channelNumber
wireGroup/strip number
Amg::Vector2D localPosition
local strip postion
double channelLen
Length of channel wireGroup/strip.
bool operator<(const sTgcChannel &other) const
Ordering operator to use the wireGroup with set.
unsigned int channelType
Channel type to indicate wireGroup/strip.
Amg::Vector3D globalPosition
global strip postion
unsigned int gasGap
Gas gap of the wireGroup/strip.
Helper struct to assess that the layers are properly oriented.
sTgcIdHelper::sTgcChannelTypes chType_t
channel type of the layer
bool operator<(const sTgcLayer &other) const
Ordering operator.
Amg::Transform3D transform
@ transformation
unsigned int gasGap
Gas gap number of the layer.
bool operator<(const sTgcPad &other) const
Ordering operator to use the Pad with set.
int padNumber
padNumber given the hit position
Amg::Vector2D localPadCornerBL
local pad corner positions
Amg::Vector3D globalPadCornerBL
global pad corner positions
unsigned int gasGap
Gas gap of the Pad.
Amg::Vector2D localPosition
local pad postion
short padPhi
Pad Phi number.
Amg::Vector2D hitPosition
hitPosition that is fed in to evaluate padNumber
Amg::Vector3D globalPosition
global pad postion
short padEta
Pad Eta number.
Helper struct to represent a full sTgc chamber.
sTgcChamber()=default
Default constructor.
std::vector< uint > numPadEta
std::vector< float > firstPadHeight
std::vector< uint > numPadPhi
std::vector< float > padPhiShift
unsigned int numStrips
std::vector< uint > numWireGroups
bool operator<(const sTgcChamber &other) const
Sorting operator to insert the object into std::set.
std::vector< float > padHeight
unsigned int numLayers
std::vector< int > padNumber
Amg::Transform3D alignableTransform
Transformation of the underlying Alignable node.
std::vector< float > wireCutout
std::set< sTgcChannel > channels
std::vector< unsigned int > numWires
std::vector< uint > numPads
std::vector< uint > firstWireGroupWidth
std::vector< float > firstStripPitch
std::set< sTgcPad > pads
std::set< sTgcLayer > layers
Amg::Transform3D geoModelTransform
Transformation of the underlying GeoModel element.
std::vector< float > firstPadPhiDiv
int main1()
Definition testRead.cxx:68