143 std::set<RpcChamber> to_ret{};
144 std::cout<<
"Read the Rpc geometry tree dump from "<<
inputFile<<std::endl;
147 std::cerr<<__FILE__<<
":"<<__LINE__<<
" Failed to open "<<
inputFile<<std::endl;
152 std::cerr<<__FILE__<<
":"<<__LINE__<<
" The file "<<
inputFile<<
" does not contain the 'RpcGeoModelTree'"<<std::endl;
156 TTreeReaderValue<unsigned short> stationIndex{
treeReader,
"stationIndex"};
159 TTreeReaderValue<uint8_t> stationDoubletR{
treeReader,
"stationDoubletR"};
160 TTreeReaderValue<uint8_t> stationDoubletZ{
treeReader,
"stationDoubletZ"};
161 TTreeReaderValue<uint8_t> stationDoubletPhi{
treeReader,
"stationDoubletPhi"};
162 TTreeReaderValue<std::string> chamberDesign{
treeReader,
"chamberDesign"};
166 TTreeReaderValue<uint8_t> numStripsEta{
treeReader,
"numEtaStrips"};
167 TTreeReaderValue<uint8_t> numStripsPhi{
treeReader,
"numPhiStrips"};
170 TTreeReaderValue<uint8_t> numPhiPanels{
treeReader,
"numPhiPanels"};
174 TTreeReaderValue<float> stripEtaPitch{
treeReader,
"stripEtaPitch"};
175 TTreeReaderValue<float> stripPhiPitch{
treeReader,
"stripPhiPitch"};
176 TTreeReaderValue<float> stripEtaWidth{
treeReader,
"stripEtaWidth"};
177 TTreeReaderValue<float> stripPhiWidth{
treeReader,
"stripPhiWidth"};
178 TTreeReaderValue<float> stripEtaLength{
treeReader,
"stripEtaLength"};
179 TTreeReaderValue<float> stripPhiLength{
treeReader,
"stripPhiLength"};
182 TTreeReaderValue<std::vector<float>> geoModelTransformX{
treeReader,
"GeoModelTransformX"};
183 TTreeReaderValue<std::vector<float>> geoModelTransformY{
treeReader,
"GeoModelTransformY"};
184 TTreeReaderValue<std::vector<float>> geoModelTransformZ{
treeReader,
"GeoModelTransformZ"};
186 TTreeReaderValue<std::vector<float>> alignableNodeX{
treeReader,
"AlignableNodeX"};
187 TTreeReaderValue<std::vector<float>> alignableNodeY{
treeReader,
"AlignableNodeY"};
188 TTreeReaderValue<std::vector<float>> alignableNodeZ{
treeReader,
"AlignableNodeZ"};
192 TTreeReaderValue<std::vector<float>> stripRotTranslationX{
treeReader,
"stripRotTranslationX"};
193 TTreeReaderValue<std::vector<float>> stripRotTranslationY{
treeReader,
"stripRotTranslationY"};
194 TTreeReaderValue<std::vector<float>> stripRotTranslationZ{
treeReader,
"stripRotTranslationZ"};
197 TTreeReaderValue<std::vector<float>> stripRotCol1X{
treeReader,
"stripRotLinearCol1X"};
198 TTreeReaderValue<std::vector<float>> stripRotCol1Y{
treeReader,
"stripRotLinearCol1Y"};
199 TTreeReaderValue<std::vector<float>> stripRotCol1Z{
treeReader,
"stripRotLinearCol1Z"};
201 TTreeReaderValue<std::vector<float>> stripRotCol2X{
treeReader,
"stripRotLinearCol2X"};
202 TTreeReaderValue<std::vector<float>> stripRotCol2Y{
treeReader,
"stripRotLinearCol2Y"};
203 TTreeReaderValue<std::vector<float>> stripRotCol2Z{
treeReader,
"stripRotLinearCol2Z"};
205 TTreeReaderValue<std::vector<float>> stripRotCol3X{
treeReader,
"stripRotLinearCol3X"};
206 TTreeReaderValue<std::vector<float>> stripRotCol3Y{
treeReader,
"stripRotLinearCol3Y"};
207 TTreeReaderValue<std::vector<float>> stripRotCol3Z{
treeReader,
"stripRotLinearCol3Z"};
209 TTreeReaderValue<std::vector<uint8_t>> stripRotGasGap{
treeReader,
"stripRotGasGap"};
210 TTreeReaderValue<std::vector<uint8_t>> stripRotDblPhi{
treeReader,
"stripRotDoubletPhi"};
211 TTreeReaderValue<std::vector<bool>> stripRotMeasPhi{
treeReader,
"stripRotMeasPhi"};
213 TTreeReaderValue<std::vector<float>> stripPosX{
treeReader,
"stripPosX"};
214 TTreeReaderValue<std::vector<float>> stripPosY{
treeReader,
"stripPosY"};
215 TTreeReaderValue<std::vector<float>> stripPosZ{
treeReader,
"stripPosZ"};
217 TTreeReaderValue<std::vector<float>> stripLocPosX{
treeReader,
"stripLocPosX"};
218 TTreeReaderValue<std::vector<float>> stripLocPosY{
treeReader,
"stripLocPosY"};
221 TTreeReaderValue<std::vector<bool>> stripPosMeasPhi{
treeReader,
"stripPosMeasPhi"};
222 TTreeReaderValue<std::vector<uint8_t>> stripPosGasGap{
treeReader,
"stripPosGasGap"};
223 TTreeReaderValue<std::vector<uint8_t>> stripPosNum{
treeReader,
"stripPosNum"};
224 TTreeReaderValue<std::vector<uint8_t>> stripDblPhi{
treeReader,
"stripPosDoubletPhi"};
230 newchamber.design = (*chamberDesign);
231 newchamber.id.eta = (*stationEta);
232 newchamber.id.phi = (*stationPhi);
233 newchamber.id.doubletPhi = (*stationDoubletPhi);
234 newchamber.id.doubletR = (*stationDoubletR);
235 newchamber.id.doubletZ = (*stationDoubletZ);
237 newchamber.stripPitchEta = (*stripEtaPitch);
238 newchamber.stripPitchPhi = (*stripPhiPitch);
239 newchamber.stripWidthEta = (*stripEtaWidth);
240 newchamber.stripWidthPhi = (*stripPhiWidth);
241 newchamber.stripLengthEta = (*stripEtaLength);
242 newchamber.stripLengthPhi = (*stripPhiLength);
244 newchamber.numStripsEta = (*numStripsEta);
245 newchamber.numStripsPhi = (*numStripsPhi);
247 newchamber.numPhiPanels = (*numPhiPanels);
248 newchamber.numLayers = (*numLayers);
251 Amg::Vector3D geoTrans{(*geoModelTransformX)[0], (*geoModelTransformY)[0], (*geoModelTransformZ)[0]};
253 geoRot.col(0) =
Amg::Vector3D((*geoModelTransformX)[1], (*geoModelTransformY)[1], (*geoModelTransformZ)[1]);
254 geoRot.col(1) =
Amg::Vector3D((*geoModelTransformX)[2], (*geoModelTransformY)[2], (*geoModelTransformZ)[2]);
255 geoRot.col(2) =
Amg::Vector3D((*geoModelTransformX)[3], (*geoModelTransformY)[3], (*geoModelTransformZ)[3]);
258 geoRot.col(0) =
Amg::Vector3D((*alignableNodeX)[1], (*alignableNodeY)[1], (*alignableNodeZ)[1]);
259 geoRot.col(1) =
Amg::Vector3D((*alignableNodeX)[2], (*alignableNodeY)[2], (*alignableNodeZ)[2]);
260 geoRot.col(2) =
Amg::Vector3D((*alignableNodeX)[3], (*alignableNodeY)[3], (*alignableNodeZ)[3]);
261 geoTrans =
Amg::Vector3D{(*alignableNodeX)[0], (*alignableNodeY)[0], (*alignableNodeZ)[0]};
265 for (
size_t s = 0;
s < stripPosX->size(); ++
s){
268 newStrip.locPos =
Amg::Vector2D{(*stripLocPosX)[
s], (*stripLocPosY)[
s]};
270 newStrip.gasGap = (*stripPosGasGap)[
s];
271 newStrip.doubletPhi = (*stripDblPhi)[
s];
272 newStrip.measPhi = (*stripPosMeasPhi)[
s];
273 newStrip.strip = (*stripPosNum)[
s];
274 newchamber.strips.insert(std::move(newStrip));
276 for (
size_t l = 0;
l < stripRotMeasPhi->size(); ++
l){
278 newLayer.
measPhi = (*stripRotMeasPhi)[
l];
279 newLayer.gasGap = (*stripRotGasGap)[
l];
280 newLayer.doubletPhi = (*stripRotDblPhi)[
l];
282 Amg::Vector3D translation{(*stripRotTranslationX)[
l],(*stripRotTranslationY)[
l],(*stripRotTranslationZ)[
l]};
283 stripRot.col(0) =
Amg::Vector3D((*stripRotCol1X)[
l],(*stripRotCol1Y)[
l], (*stripRotCol1Z)[
l]);
284 stripRot.col(1) =
Amg::Vector3D((*stripRotCol2X)[
l],(*stripRotCol2Y)[
l], (*stripRotCol2Z)[
l]);
285 stripRot.col(2) =
Amg::Vector3D((*stripRotCol3X)[
l],(*stripRotCol3Y)[
l], (*stripRotCol3Z)[
l]);
287 newchamber.layers.insert(std::move(newLayer));
290 auto insert_itr = to_ret.insert(std::move(newchamber));
291 if (!insert_itr.second) {
292 std::stringstream
err{};
293 err<<__FILE__<<
":"<<__LINE__<<
" The chamber "<<(*insert_itr.first).
id
294 <<
" has already been inserted. "<<std::endl;
295 throw std::runtime_error(
err.str());
298 std::cout<<
"File parsing is finished. Found in total "<<to_ret.size()<<
" readout element dumps "<<std::endl;