125 std::set<MdtChamber> to_ret{};
126 std::cout<<
"Read the Mdt geometry tree dump from "<<
inputFile<<std::endl;
129 std::cerr<<__FILE__<<
":"<<__LINE__<<
" Failed to open "<<
inputFile<<std::endl;
134 std::cerr<<__FILE__<<
":"<<__LINE__<<
" The file "<<
inputFile<<
" does not contain the 'MdtGeoModelTree'"<<std::endl;
138 TTreeReaderValue<unsigned short> stationIndex{
treeReader,
"stationIndex"};
141 TTreeReaderValue<short> stationML{
treeReader,
"stationMultiLayer"};
142 TTreeReaderValue<std::string> chamberDesign{
treeReader,
"chamberDesign"};
144 TTreeReaderValue<double> tubeRadius{
treeReader,
"tubeRadius"};
145 TTreeReaderValue<double> tubePitch{
treeReader,
"tubePitch"};
146 TTreeReaderValue<unsigned short> numTubes{
treeReader,
"numTubes"};
149 TTreeReaderValue<std::vector<float>> geoModelTransformX{
treeReader,
"GeoModelTransformX"};
150 TTreeReaderValue<std::vector<float>> geoModelTransformY{
treeReader,
"GeoModelTransformY"};
151 TTreeReaderValue<std::vector<float>> geoModelTransformZ{
treeReader,
"GeoModelTransformZ"};
153 TTreeReaderValue<std::vector<float>> alignableNodeX{
treeReader,
"AlignableNodeX"};
154 TTreeReaderValue<std::vector<float>> alignableNodeY{
treeReader,
"AlignableNodeY"};
155 TTreeReaderValue<std::vector<float>> alignableNodeZ{
treeReader,
"AlignableNodeZ"};
159 TTreeReaderValue<std::vector<unsigned short>> tubeLayer{
treeReader,
"tubeLayer"};
160 TTreeReaderValue<std::vector<unsigned short>> tubeNumber{
treeReader,
"tubeNumber"};
163 TTreeReaderValue<std::vector<double>> activeTubeLength{
treeReader,
"activeTubeLength"};
164 TTreeReaderValue<std::vector<double>> wireLength{
treeReader,
"wireLength"};
166 TTreeReaderValue<std::vector<float>> tubeTransformTransX{
treeReader,
"tubeTransformTranslationX"};
167 TTreeReaderValue<std::vector<float>> tubeTransformTransY{
treeReader,
"tubeTransformTranslationY"};
168 TTreeReaderValue<std::vector<float>> tubeTransformTransZ{
treeReader,
"tubeTransformTranslationZ"};
170 TTreeReaderValue<std::vector<float>> tubeTransformCol0X{
treeReader,
"tubeTransformLinearCol1X"};
171 TTreeReaderValue<std::vector<float>> tubeTransformCol0Y{
treeReader,
"tubeTransformLinearCol1Y"};
172 TTreeReaderValue<std::vector<float>> tubeTransformCol0Z{
treeReader,
"tubeTransformLinearCol1Z"};
174 TTreeReaderValue<std::vector<float>> tubeTransformCol1X{
treeReader,
"tubeTransformLinearCol2X"};
175 TTreeReaderValue<std::vector<float>> tubeTransformCol1Y{
treeReader,
"tubeTransformLinearCol2Y"};
176 TTreeReaderValue<std::vector<float>> tubeTransformCol1Z{
treeReader,
"tubeTransformLinearCol2Z"};
178 TTreeReaderValue<std::vector<float>> tubeTransformCol2X{
treeReader,
"tubeTransformLinearCol3X"};
179 TTreeReaderValue<std::vector<float>> tubeTransformCol2Y{
treeReader,
"tubeTransformLinearCol3Y"};
180 TTreeReaderValue<std::vector<float>> tubeTransformCol2Z{
treeReader,
"tubeTransformLinearCol3Z"};
182 TTreeReaderValue<std::vector<float>> readOutPosX{
treeReader,
"readOutPosX"};
183 TTreeReaderValue<std::vector<float>> readOutPosY{
treeReader,
"readOutPosY"};
184 TTreeReaderValue<std::vector<float>> readOutPosZ{
treeReader,
"readOutPosZ"};
190 newchamber.id.eta = (*stationEta);
191 newchamber.id.phi = (*stationPhi);
192 newchamber.id.multilayer = (*stationML);
193 newchamber.design = (*chamberDesign);
195 newchamber.tubeRadius = (*tubeRadius);
196 newchamber.tubePitch = (*tubePitch);
198 newchamber.numTubes = (*numTubes);
199 newchamber.numLayers = (*numLayers);
202 geoRot.col(0) =
Amg::Vector3D((*geoModelTransformX)[1], (*geoModelTransformY)[1], (*geoModelTransformZ)[1]);
203 geoRot.col(1) =
Amg::Vector3D((*geoModelTransformX)[2], (*geoModelTransformY)[2], (*geoModelTransformZ)[2]);
204 geoRot.col(2) =
Amg::Vector3D((*geoModelTransformX)[3], (*geoModelTransformY)[3], (*geoModelTransformZ)[3]);
205 Amg::Vector3D geoTrans{(*geoModelTransformX)[0], (*geoModelTransformY)[0], (*geoModelTransformZ)[0]};
208 geoRot.col(0) =
Amg::Vector3D((*alignableNodeX)[1], (*alignableNodeY)[1], (*alignableNodeZ)[1]);
209 geoRot.col(1) =
Amg::Vector3D((*alignableNodeX)[2], (*alignableNodeY)[2], (*alignableNodeZ)[2]);
210 geoRot.col(2) =
Amg::Vector3D((*alignableNodeX)[3], (*alignableNodeY)[3], (*alignableNodeZ)[3]);
211 geoTrans =
Amg::Vector3D{(*alignableNodeX)[0], (*alignableNodeY)[0], (*alignableNodeZ)[0]};
216 for (
size_t t = 0;
t < tubeLayer->size(); ++
t){
218 TubePositioning newTube{};
220 newTube.tubeNum = (*tubeNumber)[
t];
221 newTube.tubeLength = (*tubeLength)[
t];
222 newTube.wireLength = (*wireLength)[
t];
224 tubeRot.col(0) =
Amg::Vector3D((*tubeTransformCol0X)[
t],(*tubeTransformCol0Y)[
t], (*tubeTransformCol0Z)[
t]);
225 tubeRot.col(1) =
Amg::Vector3D((*tubeTransformCol1X)[
t],(*tubeTransformCol1Y)[
t], (*tubeTransformCol1Z)[
t]);
226 tubeRot.col(2) =
Amg::Vector3D((*tubeTransformCol2X)[
t],(*tubeTransformCol2Y)[
t], (*tubeTransformCol2Z)[
t]);
227 Amg::Vector3D tubeTrans{(*tubeTransformTransX)[
t],(*tubeTransformTransY)[
t], (*tubeTransformTransZ)[
t]};
229 newTube.readoutPos =
Amg::Vector3D{(*readOutPosX)[
t],(*readOutPosY)[
t],(*readOutPosZ)[
t]};
230 newchamber.insertTube(std::move(newTube));
233 auto insert_itr = to_ret.insert(std::move(newchamber));
234 if (!insert_itr.second) {
235 std::stringstream
err{};
236 err<<__FILE__<<
":"<<__LINE__<<
" The chamber "<<(*insert_itr.first).
id
237 <<
" has already been inserted. "<<std::endl;
238 throw std::runtime_error(
err.str());
241 std::cout<<
"File parsing is finished. Found in total "<<to_ret.size()<<
" readout element dumps "<<std::endl;