157 {
158 std::set<TgcChamber> to_ret{};
159 std::cout<<
"Read the Tgc geometry tree dump from "<<
inputFile<<std::endl;
161 if (!inFile || !
inFile->IsOpen()) {
162 std::cerr<<
"runTgcComparison() "<<__LINE__<<
": Failed to open "<<
inputFile<<std::endl;
163 return to_ret;
164 }
167 std::cerr<<
"runTgcComparison() "<<__LINE__<<
": The file "<<
inputFile<<
" does not contain the 'TgcGeoModelTree'"<<std::endl;
168 return to_ret;
169 }
171 TTreeReaderValue<unsigned short> stationIndex{
treeReader,
"stationIndex"};
174 TTreeReaderValue<std::string> stationDesign{
treeReader,
"stationDesign"};
175 TTreeReaderValue<uint8_t> nGasGaps{
treeReader,
"nGasGaps"};
176
177 TTreeReaderValue<float> shortWidth{
treeReader,
"ChamberWidthS"};
178 TTreeReaderValue<float> longWidth{
treeReader,
"ChamberWidthL"};
179 TTreeReaderValue<float> height{
treeReader,
"ChamberHeight"};
180 TTreeReaderValue<float> thickness{
treeReader,
"ChamberThickness"};
182 TTreeReaderValue<std::vector<float>> geoModelTransformX{
treeReader,
"GeoModelTransformX"};
183 TTreeReaderValue<std::vector<float>> geoModelTransformY{
treeReader,
"GeoModelTransformY"};
184 TTreeReaderValue<std::vector<float>> geoModelTransformZ{
treeReader,
"GeoModelTransformZ"};
185
186 TTreeReaderValue<std::vector<float>> alignableNodeX{
treeReader,
"AlignableNodeX"};
187 TTreeReaderValue<std::vector<float>> alignableNodeY{
treeReader,
"AlignableNodeY"};
188 TTreeReaderValue<std::vector<float>> alignableNodeZ{
treeReader,
"AlignableNodeZ"};
189
190
191 TTreeReaderValue<std::vector<float>> gangCenterX{
treeReader,
"gangCenterX"};
192 TTreeReaderValue<std::vector<float>> gangCenterY{
treeReader,
"gangCenterY"};
193 TTreeReaderValue<std::vector<float>> gangCenterZ{
treeReader,
"gangCenterZ"};
194
195 TTreeReaderValue<std::vector<float>> gangLocalPosX{
treeReader,
"gangLocalPosX"};
196 TTreeReaderValue<std::vector<float>> gangLocalPosY{
treeReader,
"gangLocalPosY"};
197
198
199 TTreeReaderValue<std::vector<float>> stripCenterX{
treeReader,
"stripCenterX"};
200 TTreeReaderValue<std::vector<float>> stripCenterY{
treeReader,
"stripCenterY"};
201 TTreeReaderValue<std::vector<float>> stripCenterZ{
treeReader,
"stripCenterZ"};
202
203 TTreeReaderValue<std::vector<float>> stripBottomX{
treeReader,
"stripBottomX"};
204 TTreeReaderValue<std::vector<float>> stripBottomY{
treeReader,
"stripBottomY"};
205 TTreeReaderValue<std::vector<float>> stripBottomZ{
treeReader,
"stripBottomZ"};
206
207 TTreeReaderValue<std::vector<float>> stripTopX{
treeReader,
"stripTopX"};
208 TTreeReaderValue<std::vector<float>> stripTopY{
treeReader,
"stripTopY"};
209 TTreeReaderValue<std::vector<float>> stripTopZ{
treeReader,
"stripTopZ"};
210
211 TTreeReaderValue<std::vector<float>> stripLocalCenterX{
treeReader,
"stripLocalCenterX"};
212 TTreeReaderValue<std::vector<float>> stripLocalCenterY{
treeReader,
"stripLocalCenterY"};
213 TTreeReaderValue<std::vector<float>> stripLocalBottomX{
treeReader,
"stripLocalBottomX"};
214 TTreeReaderValue<std::vector<float>> stripLocalBottomY{
treeReader,
"stripLocalBottomY"};
215 TTreeReaderValue<std::vector<float>> stripLocalTopX{
treeReader,
"stripLocalTopX"};
216 TTreeReaderValue<std::vector<float>> stripLocalTopY{
treeReader,
"stripLocalTopY"};
217
218 TTreeReaderValue<std::vector<uint8_t>> stripGasGap{
treeReader,
"stripGasGap"};
219 TTreeReaderValue<std::vector<unsigned int>> stripNum{
treeReader,
"stripNumber"};
220
221
222 TTreeReaderValue<std::vector<uint8_t>> gangGasGap{
treeReader,
"gangGasGap"};
223 TTreeReaderValue<std::vector<unsigned int>> gangNum{
treeReader,
"gangNumber"};
224 TTreeReaderValue<std::vector<uint8_t>> gangNumWires{
treeReader,
"gangNumWires"};
225 TTreeReaderValue<std::vector<float>> gangLength{
treeReader,
"gangLength"};
226
227 TTreeReaderValue<std::vector<float>> layerCol0Theta{
treeReader,
"layerLinearCol0Theta"};
228 TTreeReaderValue<std::vector<float>> layerCol0Phi{
treeReader,
"layerLinearCol0Phi"};
229
230 TTreeReaderValue<std::vector<float>> layerCol1Theta{
treeReader,
"layerLinearCol1Theta"};
231 TTreeReaderValue<std::vector<float>> layerCol1Phi{
treeReader,
"layerLinearCol1Phi"};
232
233 TTreeReaderValue<std::vector<float>> layerCol2Theta{
treeReader,
"layerLinearCol2Theta"};
234 TTreeReaderValue<std::vector<float>> layerCol2Phi{
treeReader,
"layerLinearCol2Phi"};
235
236 TTreeReaderValue<std::vector<float>> layerTransX{
treeReader,
"layerTranslationX"};
237 TTreeReaderValue<std::vector<float>> layerTransY{
treeReader,
"layerTranslationY"};
238 TTreeReaderValue<std::vector<float>> layerTransZ{
treeReader,
"layerTranslationZ"};
239
240 TTreeReaderValue<std::vector<bool>> layerMeasPhi{
treeReader,
"layerMeasPhi"};
241 TTreeReaderValue<std::vector<uint8_t>> layerNumber{
treeReader,
"layerNumber"};
242
243 TTreeReaderValue<std::vector<float>> layShortWidth{
treeReader,
"layerWidthS"};
244 TTreeReaderValue<std::vector<float>> layLongWidth{
treeReader,
"layerWidthL"};
245 TTreeReaderValue<std::vector<float>> layHeight{
treeReader,
"layerHeight"};
246 TTreeReaderValue<std::vector<uint16_t>> layerNumWires{
treeReader,
"layerNumWires"};
247
250
251 newchamber.
stIdx = (*stationIndex);
252 newchamber.
eta = (*stationEta);
253 newchamber.
phi = (*stationPhi);
254 newchamber.
techName = (*stationDesign);
257 newchamber.
height = (*height);
260 Amg::Vector3D geoTrans{(*geoModelTransformX)[0], (*geoModelTransformY)[0], (*geoModelTransformZ)[0]};
262 geoRot.col(0) =
Amg::Vector3D((*geoModelTransformX)[1], (*geoModelTransformY)[1], (*geoModelTransformZ)[1]);
263 geoRot.col(1) =
Amg::Vector3D((*geoModelTransformX)[2], (*geoModelTransformY)[2], (*geoModelTransformZ)[2]);
264 geoRot.col(2) =
Amg::Vector3D((*geoModelTransformX)[3], (*geoModelTransformY)[3], (*geoModelTransformZ)[3]);
266
267 geoRot.col(0) =
Amg::Vector3D((*alignableNodeX)[1], (*alignableNodeY)[1], (*alignableNodeZ)[1]);
268 geoRot.col(1) =
Amg::Vector3D((*alignableNodeX)[2], (*alignableNodeY)[2], (*alignableNodeZ)[2]);
269 geoRot.col(2) =
Amg::Vector3D((*alignableNodeX)[3], (*alignableNodeY)[3], (*alignableNodeZ)[3]);
270 geoTrans =
Amg::Vector3D{(*alignableNodeX)[0], (*alignableNodeY)[0], (*alignableNodeZ)[0]};
272
273
274 for (
size_t g = 0;
g < gangGasGap->size(); ++
g) {
276 newGang.
gasGap = (*gangGasGap)[
g];
277 newGang.
number = (*gangNum)[
g];
281 newGang.
length = (*gangLength)[
g];
282 auto insert_itr = newchamber.
etaWires.insert(std::move(newGang));
283 if (!insert_itr.second) {
284 std::stringstream
err{};
285 err<<
"runTgcComparison() "<<__LINE__<<
": The wire "<<(*insert_itr.first)
286 <<" has already been inserted. "<<std::endl;
287 throw std::runtime_error(
err.str());
288 }
289 }
290
291 for (
size_t s = 0;
s < stripNum->size(); ++
s) {
294 strip.number = (*stripNum) [
s];
295
298
301
304
305 auto insert_itr = newchamber.
strips.insert(std::move(
strip));
306 if (!insert_itr.second) {
307 std::stringstream
err{};
308 err<<
"runTgcComparison() "<<__LINE__<<
": The strip "<<(*insert_itr.first)
309 <<" has already been inserted. "<<std::endl;
310 throw std::runtime_error(
err.str());
311 }
312 }
313 for (
size_t l = 0 ;
l < layerMeasPhi->size(); ++
l) {
315 layRot.col(0) =
makeDir((*layerCol0Theta)[l], (*layerCol0Phi)[l]);
316 layRot.col(1) =
makeDir((*layerCol1Theta)[l], (*layerCol1Phi)[l]);
317 layRot.col(2) =
makeDir((*layerCol2Theta)[l], (*layerCol2Phi)[l]);
321 layTrans.
gasGap = (*layerNumber)[
l];
322 layTrans.
measPhi = (*layerMeasPhi)[
l];
325 layTrans.
height = (*layHeight)[
l];
327 auto insert_itr = newchamber.
transforms.insert(std::move(layTrans));
328 if (!insert_itr.second) {
329 std::stringstream
err{};
330 err<<
"runTgcComparison() "<<__LINE__<<
": The layer transformation "<<(*insert_itr.first)
331 <<" has already been inserted. "<<std::endl;
332 throw std::runtime_error(
err.str());
333 }
334 }
335
336 auto insert_itr = to_ret.insert(std::move(newchamber));
337 if (!insert_itr.second) {
338 std::stringstream
err{};
339 err<<
"runTgcComparison() "<<__LINE__<<
": The chamber "<<(*insert_itr.first)
340 <<" has already been inserted. "<<std::endl;
341 throw std::runtime_error(
err.str());
342 }
343 }
344 return to_ret;
345}
Eigen::Matrix< double, 3, 3 > RotationMatrix3D
Amg::Transform3D getTransformFromRotTransl(Amg::RotationMatrix3D rot, Amg::Vector3D transl_vec)
constexpr uint8_t stationPhi
station Phi 1 to 8
constexpr uint8_t stationEta
1 to 3
l
Printing final latex table to .tex output file.
Amg::Vector3D makeDir(const double theta, const double phi)
Helper macro to compare the output from the readout geometry dumps: python -m MuonGeoModelTest....
std::set< WireGang > etaWires
std::set< RadialStrip > strips
Amg::Transform3D alignableTransform
Transformation of the underlying Alignable node.
Amg::Transform3D geoModelTransform
Transformation of the underlying GeoModel element.
std::set< LayerTrans > transforms