150 std::set<MmChamber> to_ret{};
151 std::cout<<
"Read the MicroMegas geometry tree dump from "<<
inputFile<<std::endl;
154 std::cerr<<__FILE__<<
":"<<__LINE__<<
" Failed to open "<<
inputFile<<std::endl;
159 std::cerr<<__FILE__<<
":"<<__LINE__<<
" The file "<<
inputFile<<
" does not contain the 'MmGeoModelTree'"<<std::endl;
164 TTreeReaderValue<unsigned short> stationIndex{
treeReader,
"stationIndex"};
167 TTreeReaderValue<short> multilayer{
treeReader,
"multilayer"};
172 TTreeReaderValue<std::vector<float>> stripLength{
treeReader,
"stripLength"};
174 TTreeReaderValue<std::vector<bool>> isStereo{
treeReader,
"isStereo"};
175 TTreeReaderValue<std::vector<float>> locStripCenterX{
treeReader,
"locStripCenterX"};
176 TTreeReaderValue<std::vector<float>> locStripCenterY{
treeReader,
"locStripCenterY"};
178 TTreeReaderValue<std::vector<float>> stripCenterX{
treeReader,
"stripCenterX"};
179 TTreeReaderValue<std::vector<float>> stripCenterY{
treeReader,
"stripCenterY"};
180 TTreeReaderValue<std::vector<float>> stripCenterZ{
treeReader,
"stripCenterZ"};
181 TTreeReaderValue<std::vector<float>> stripLeftEdgeX{
treeReader,
"stripLeftEdgeX"};
182 TTreeReaderValue<std::vector<float>> stripLeftEdgeY{
treeReader,
"stripLeftEdgeY"};
183 TTreeReaderValue<std::vector<float>> stripLeftEdgeZ{
treeReader,
"stripLeftEdgeZ"};
184 TTreeReaderValue<std::vector<float>> stripRightEdgeX{
treeReader,
"stripRightEdgeX"};
185 TTreeReaderValue<std::vector<float>> stripRightEdgeY{
treeReader,
"stripRightEdgeY"};
186 TTreeReaderValue<std::vector<float>> stripRightEdgeZ{
treeReader,
"stripRightEdgeZ"};
189 TTreeReaderValue<float> ActiveHeightR{
treeReader,
"ActiveHeightR"};
190 TTreeReaderValue<float> ActiveWidthS{
treeReader,
"ActiveWidthS"};
191 TTreeReaderValue<float> ActiveWidthL{
treeReader,
"ActiveWidthL"};
194 TTreeReaderValue<float> moduleHeight{
treeReader,
"moduleHeight"};
195 TTreeReaderValue<float> moduleWidthS{
treeReader,
"moduleWidthS"};
196 TTreeReaderValue<float> moduleWidthL{
treeReader,
"moduleWidthL"};
198 TTreeReaderValue<float> stripPitch{
treeReader,
"stripPitch"};
201 TTreeReaderValue<std::vector<float>> geoModelTransformX{
treeReader,
"GeoModelTransformX"};
202 TTreeReaderValue<std::vector<float>> geoModelTransformY{
treeReader,
"GeoModelTransformY"};
203 TTreeReaderValue<std::vector<float>> geoModelTransformZ{
treeReader,
"GeoModelTransformZ"};
205 TTreeReaderValue<std::vector<float>> alignableNodeX{
treeReader,
"AlignableNodeX"};
206 TTreeReaderValue<std::vector<float>> alignableNodeY{
treeReader,
"AlignableNodeY"};
207 TTreeReaderValue<std::vector<float>> alignableNodeZ{
treeReader,
"AlignableNodeZ"};
209 TTreeReaderValue<std::vector<float>> stripRotCol1X{
treeReader,
"stripRotLinearCol1X"};
210 TTreeReaderValue<std::vector<float>> stripRotCol1Y{
treeReader,
"stripRotLinearCol1Y"};
211 TTreeReaderValue<std::vector<float>> stripRotCol1Z{
treeReader,
"stripRotLinearCol1Z"};
213 TTreeReaderValue<std::vector<float>> stripRotCol2X{
treeReader,
"stripRotLinearCol2X"};
214 TTreeReaderValue<std::vector<float>> stripRotCol2Y{
treeReader,
"stripRotLinearCol2Y"};
215 TTreeReaderValue<std::vector<float>> stripRotCol2Z{
treeReader,
"stripRotLinearCol2Z"};
217 TTreeReaderValue<std::vector<float>> stripRotCol3X{
treeReader,
"stripRotLinearCol3X"};
218 TTreeReaderValue<std::vector<float>> stripRotCol3Y{
treeReader,
"stripRotLinearCol3Y"};
219 TTreeReaderValue<std::vector<float>> stripRotCol3Z{
treeReader,
"stripRotLinearCol3Z"};
221 TTreeReaderValue<std::vector<float>> stripRotTransX{
treeReader,
"stripRotTranslationX"};
222 TTreeReaderValue<std::vector<float>> stripRotTransY{
treeReader,
"stripRotTranslationY"};
223 TTreeReaderValue<std::vector<float>> stripRotTransZ{
treeReader,
"stripRotTranslationZ"};
225 TTreeReaderValue<std::vector<uint8_t>> stripRotGasGap{
treeReader,
"stripRotGasGap"};
227 TTreeReaderValue<std::vector<float>> firstStripPosX{
treeReader,
"firstStripPosX"};
228 TTreeReaderValue<std::vector<float>> firstStripPosY{
treeReader,
"firstStripPosY"};
230 TTreeReaderValue<std::vector<int>> readoutSide{
treeReader,
"stripReadoutSide"};
241 newchamber.stationEta = (*stationEta);
242 newchamber.stationPhi = (*stationPhi);
243 newchamber.multilayer = (*multilayer);
246 newchamber.ActiveHeightR = (*ActiveHeightR);
247 newchamber.ActiveWidthS = (*ActiveWidthS);
248 newchamber.ActiveWidthL = (*ActiveWidthL);
249 newchamber.stripPitch = (*stripPitch);
250 newchamber.moduleHeight = (*moduleHeight);
251 newchamber.moduleWidthS = (*moduleWidthS);
252 newchamber.moduleWidthL = (*moduleWidthL);
254 Amg::Vector3D geoTrans{(*geoModelTransformX)[0], (*geoModelTransformY)[0], (*geoModelTransformZ)[0]};
256 geoRot.col(0) =
Amg::Vector3D((*geoModelTransformX)[1], (*geoModelTransformY)[1], (*geoModelTransformZ)[1]);
257 geoRot.col(1) =
Amg::Vector3D((*geoModelTransformX)[2], (*geoModelTransformY)[2], (*geoModelTransformZ)[2]);
258 geoRot.col(2) =
Amg::Vector3D((*geoModelTransformX)[3], (*geoModelTransformY)[3], (*geoModelTransformZ)[3]);
261 geoRot.col(0) =
Amg::Vector3D((*alignableNodeX)[1], (*alignableNodeY)[1], (*alignableNodeZ)[1]);
262 geoRot.col(1) =
Amg::Vector3D((*alignableNodeX)[2], (*alignableNodeY)[2], (*alignableNodeZ)[2]);
263 geoRot.col(2) =
Amg::Vector3D((*alignableNodeX)[3], (*alignableNodeY)[3], (*alignableNodeZ)[3]);
264 geoTrans =
Amg::Vector3D{(*alignableNodeX)[0], (*alignableNodeY)[0], (*alignableNodeZ)[0]};
267 for (
size_t s = 0;
s < stripCenterX->size(); ++
s){
270 newStrip.locCenter =
Amg::Vector2D{(*locStripCenterX)[
s], (*locStripCenterY)[
s]};
271 newStrip.leftEdge =
Amg::Vector3D{(*stripLeftEdgeX)[
s], (*stripLeftEdgeY)[
s], (*stripLeftEdgeZ)[
s]};
272 newStrip.rightEdge =
Amg::Vector3D{(*stripRightEdgeX)[
s], (*stripRightEdgeY)[
s], (*stripRightEdgeZ)[
s]};
274 newStrip.gasGap = (*gasGap)[
s];
275 newStrip.channel = (*channel)[
s];
276 newStrip.isStereo = (*isStereo)[
s];
277 newStrip.stripLength = (*stripLength)[
s];
278 newchamber.channels.insert(std::move(newStrip));
281 for (
size_t l = 0;
l < stripRotGasGap->size(); ++
l){
283 newLayer.
gasGap = (*stripRotGasGap)[
l];
285 stripRot.col(0) =
Amg::Vector3D((*stripRotCol1X)[
l],(*stripRotCol1Y)[
l], (*stripRotCol1Z)[
l]);
286 stripRot.col(1) =
Amg::Vector3D((*stripRotCol2X)[
l],(*stripRotCol2Y)[
l], (*stripRotCol2Z)[
l]);
287 stripRot.col(2) =
Amg::Vector3D((*stripRotCol3X)[
l],(*stripRotCol3Y)[
l], (*stripRotCol3Z)[
l]);
288 Amg::Vector3D layTrans{(*stripRotTransX)[
l], (*stripRotTransY)[
l], (*stripRotTransZ)[
l]};
290 newLayer.firstStripPos =
Amg::Vector2D{(*firstStripPosX)[
l], (*firstStripPosY)[
l]};
291 newLayer.readoutSide = (*readoutSide)[
l];
292 newLayer.firstStrip = (*firstStrip)[
l];
293 newLayer.nStrips = (*nStrips)[
l];
295 newchamber.layers.insert(std::move(newLayer));
298 auto insert_itr = to_ret.insert(std::move(newchamber));
299 if (!insert_itr.second) {
300 std::stringstream
err{};
301 err<<__FILE__<<
":"<<__LINE__<<
" The chamber "<<(*insert_itr.first).stationIndex
302 <<
" has already been inserted. "<<std::endl;
303 throw std::runtime_error(
err.str());
306 std::cout<<
"File parsing is finished. Found in total "<<to_ret.size()<<
" readout element dumps "<<std::endl;