76 std::set<ActiveSensor> to_ret{};
77 std::cout<<
"Read the Acts geometry dump from "<<inputFile<<std::endl;
78 std::unique_ptr<TFile> inFile{TFile::Open(inputFile.c_str())};
79 if (!inFile || !inFile->IsOpen()) {
80 std::cerr<<__FILE__<<
":"<<__LINE__<<
" Failed to open "<<inputFile<<std::endl;
83 TTreeReader treeReader(
"ReadoutGeometryTest", inFile.get());
84 if (treeReader.IsInvalid()){
85 std::cerr<<__FILE__<<
":"<<__LINE__<<
" The file "<<inputFile<<
" does not contain the 'ReadoutGeometryTest'"<<std::endl;
89 TTreeReaderValue<Identifier::value_type> identifier{treeReader,
"identifier"};
90 TTreeReaderValue<std::uint8_t> detectorType{treeReader,
"detectorType"};
91 TTreeReaderValue<std::uint8_t> boundType{treeReader,
"boundType"};
93 TTreeReaderValue<std::vector<float>> geoModelTransformX{treeReader,
"GeoModelTransformX"};
94 TTreeReaderValue<std::vector<float>> geoModelTransformY{treeReader,
"GeoModelTransformY"};
95 TTreeReaderValue<std::vector<float>> geoModelTransformZ{treeReader,
"GeoModelTransformZ"};
97 TTreeReaderValue<std::vector<double>> boundValues{treeReader,
"boundValues"};
98 TTreeReaderValue<double> thickness{treeReader,
"thickness"};
100 while (treeReader.Next()) {
103 newElement.
id = (*identifier);
110 geoRot.col(0) =
Amg::Vector3D((*geoModelTransformX)[1], (*geoModelTransformY)[1], (*geoModelTransformZ)[1]);
111 geoRot.col(1) =
Amg::Vector3D((*geoModelTransformX)[2], (*geoModelTransformY)[2], (*geoModelTransformZ)[2]);
112 geoRot.col(2) =
Amg::Vector3D((*geoModelTransformX)[3], (*geoModelTransformY)[3], (*geoModelTransformZ)[3]);
113 Amg::Vector3D geoTrans{(*geoModelTransformX)[0], (*geoModelTransformY)[0], (*geoModelTransformZ)[0]};
116 to_ret.insert(newElement);
118 std::cout<<
"File parsing is finished. Found in total "<<to_ret.size()<<
" readout element dumps "<<std::endl;
123 std::string refFile{}, testFile{};
125 for (
int arg = 1; arg < argc; ++arg) {
126 std::string the_arg{argv[arg]};
127 if (the_arg ==
"--refFile" && arg +1 < argc) {
128 refFile = std::string{argv[arg+1]};
130 }
else if (the_arg ==
"--testFile" && arg + 1 < argc) {
131 testFile = std::string{argv[arg+1]};
135 if (refFile.empty()) {
136 std::cerr<<
"Please parse the path of the reference file via --refFile "<<std::endl;
139 if (testFile.empty()) {
140 std::cerr<<
"Please parse the path of the test file via --testFile "<<std::endl;
147 std::set<ActiveSensor> refSensors =
readTreeDump(refFile);
148 if (refSensors.empty()) {
149 std::cerr<<
"The file "<<refFile<<
" should contain at least one chamber "<<std::endl;
152 std::set<ActiveSensor> testSensors =
readTreeDump(testFile);
153 if (testSensors.empty()) {
154 std::cerr<<
"The file "<<testFile<<
" should contain at least one chamber "<<std::endl;
157 int return_code = EXIT_SUCCESS;
158 unsigned int goodSensors{0};
161 std::set<ActiveSensor>::const_iterator test_itr = testSensors.find(
reference);
162 if (test_itr == testSensors.end()) {
163 std::cerr<<
"runActsGeoComparison() "<<__LINE__<<
": The chamber "<<
reference
164 <<
" is not part of the testing "<<std::endl;
165 return_code = EXIT_FAILURE;
168 bool sensorOkay =
true;
173 std::cerr<<
"runActsGeoComparison() "<<__LINE__<<
": The detector element types are different for "<<
reference<<
" test: "<<
to_string(test.detType)<<std::endl;
177 if (test.boundType !=
reference.boundType) {
178 std::cerr<<
"runActsGeoComparison() "<<__LINE__<<
": The bound types are different for "<<
reference<<
" test: "<<test.boundType<<std::endl;
181 for (std::size_t b = 0; b < test.boundaryValues.size(); ++b) {
182 if (std::abs(
reference.boundaryValues[b] - test.boundaryValues[b]) > Acts::s_epsilon) {
183 std::cerr<<
"runActsGeoComparison() "<<__LINE__<<
": The bounds are different for "
184 <<
reference<<
" & test: "<<test.boundaryValues<<std::endl;
189 if (std::abs(test.thickness -
reference.thickness) > Acts::s_epsilon) {
190 std::cerr<<
"runActsGeoComparison() "<<__LINE__<<
": "<<
reference
191 <<
" has different thickness w.r.t the test "
192 <<
reference.thickness<<
" vs. "<< test.thickness<<std::endl;
199 std::cerr<<
"runActsGeoComparison() "<<__LINE__<<
": The chamber coordinate systems rotate differently for "
202 <<
" --- testTrf: "<<
Amg::toString(test.transform)<<std::endl;
207 if (distortion.translation().mag() > Acts::s_onSurfaceTolerance ) {
208 std::cout<<
"runActsGeoComparison() "<<__LINE__
209 <<
": The origins of the chamber coordinate systems are not exactly at the same point for "
218 if (!refSensors.count(test)) {
219 std::cerr<<
"runActsGeoComparison() "<<__LINE__<<
": "<<test<<
" is only in the test set."<<std::endl;
220 return_code = EXIT_FAILURE;
223 std::cout<<
"runActsGeoComparison() "<<__LINE__<<
": "<<goodSensors<<
"/"<<refSensors.size()
224 <<
" sensors are in perfect agreement. "<<std::endl;