Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-12-17 09:21:18

0001 #include "TH2INTT.h"
0002 
0003 #include <boost/format.hpp>
0004 
0005 #include <TArrow.h>  // for TArrow
0006 #include <TLatex.h>  // for TLatex
0007 #include <TLine.h>   // for TLine
0008 
0009 #include <algorithm>  // for max
0010 #include <cmath>
0011 #include <format>
0012 #include <iostream>  // for operator<<, basic_...
0013 #include <memory>    // for allocator_traits<>...
0014 
0015 TH2INTT::TH2INTT()
0016    
0017 {
0018   TH2Poly::Initialize(-23, 23., -10., 10., 25, 25);
0019   TH2Poly::SetStats(false);
0020   TH2INTT::fill_ladder_pos_map();
0021   TH2INTT::fill_ladder_line();
0022   TH2INTT::fill_ladder_toinfo_map_bin();
0023 
0024   // note : set the bin shape
0025   for (unsigned int i = 0; i < ladder_pos_map["B0L0S"].size(); i++)
0026   {
0027     px = {ladder_pos_map["B0L0S"][i].x1, ladder_pos_map["B0L0S"][i].x2, ladder_pos_map["B0L0S"][i].x3, ladder_pos_map["B0L0S"][i].x4};
0028     py = {ladder_pos_map["B0L0S"][i].y1, ladder_pos_map["B0L0S"][i].y2, ladder_pos_map["B0L0S"][i].y3, ladder_pos_map["B0L0S"][i].y4};
0029     TH2Poly::AddBin(4, px.data(), py.data());
0030   }
0031 
0032   // note : set the bin shape
0033   for (unsigned int i = 0; i < ladder_pos_map["B0L1S"].size(); i++)
0034   {
0035     px = {ladder_pos_map["B0L1S"][i].x1, ladder_pos_map["B0L1S"][i].x2, ladder_pos_map["B0L1S"][i].x3, ladder_pos_map["B0L1S"][i].x4};
0036     py = {ladder_pos_map["B0L1S"][i].y1, ladder_pos_map["B0L1S"][i].y2, ladder_pos_map["B0L1S"][i].y3, ladder_pos_map["B0L1S"][i].y4};
0037     TH2Poly::AddBin(4, px.data(), py.data());
0038   }
0039 
0040   // note : set the bin shape
0041   for (unsigned int i = 0; i < ladder_pos_map["B1L0S"].size(); i++)
0042   {
0043     px = {ladder_pos_map["B1L0S"][i].x1, ladder_pos_map["B1L0S"][i].x2, ladder_pos_map["B1L0S"][i].x3, ladder_pos_map["B1L0S"][i].x4};
0044     py = {ladder_pos_map["B1L0S"][i].y1, ladder_pos_map["B1L0S"][i].y2, ladder_pos_map["B1L0S"][i].y3, ladder_pos_map["B1L0S"][i].y4};
0045     TH2Poly::AddBin(4, px.data(), py.data());
0046   }
0047 
0048   // note : set the bin shape
0049   for (unsigned int i = 0; i < ladder_pos_map["B1L1S"].size(); i++)
0050   {
0051     px = {ladder_pos_map["B1L1S"][i].x1, ladder_pos_map["B1L1S"][i].x2, ladder_pos_map["B1L1S"][i].x3, ladder_pos_map["B1L1S"][i].x4};
0052     py = {ladder_pos_map["B1L1S"][i].y1, ladder_pos_map["B1L1S"][i].y2, ladder_pos_map["B1L1S"][i].y3, ladder_pos_map["B1L1S"][i].y4};
0053     TH2Poly::AddBin(4, px.data(), py.data());
0054   }
0055 
0056   // note : set the bin shape
0057   for (unsigned int i = 0; i < ladder_pos_map["B0L0N"].size(); i++)
0058   {
0059     px = {ladder_pos_map["B0L0N"][i].x1, ladder_pos_map["B0L0N"][i].x2, ladder_pos_map["B0L0N"][i].x3, ladder_pos_map["B0L0N"][i].x4};
0060     py = {ladder_pos_map["B0L0N"][i].y1, ladder_pos_map["B0L0N"][i].y2, ladder_pos_map["B0L0N"][i].y3, ladder_pos_map["B0L0N"][i].y4};
0061     TH2Poly::AddBin(4, px.data(), py.data());
0062   }
0063 
0064   // note : set the bin shape
0065   for (unsigned int i = 0; i < ladder_pos_map["B0L1N"].size(); i++)
0066   {
0067     px = {ladder_pos_map["B0L1N"][i].x1, ladder_pos_map["B0L1N"][i].x2, ladder_pos_map["B0L1N"][i].x3, ladder_pos_map["B0L1N"][i].x4};
0068     py = {ladder_pos_map["B0L1N"][i].y1, ladder_pos_map["B0L1N"][i].y2, ladder_pos_map["B0L1N"][i].y3, ladder_pos_map["B0L1N"][i].y4};
0069     TH2Poly::AddBin(4, px.data(), py.data());
0070   }
0071 
0072   // note : set the bin shape
0073   for (unsigned int i = 0; i < ladder_pos_map["B1L0N"].size(); i++)
0074   {
0075     px = {ladder_pos_map["B1L0N"][i].x1, ladder_pos_map["B1L0N"][i].x2, ladder_pos_map["B1L0N"][i].x3, ladder_pos_map["B1L0N"][i].x4};
0076     py = {ladder_pos_map["B1L0N"][i].y1, ladder_pos_map["B1L0N"][i].y2, ladder_pos_map["B1L0N"][i].y3, ladder_pos_map["B1L0N"][i].y4};
0077     TH2Poly::AddBin(4, px.data(), py.data());
0078   }
0079 
0080   // note : set the bin shape
0081   for (unsigned int i = 0; i < ladder_pos_map["B1L1N"].size(); i++)
0082   {
0083     px = {ladder_pos_map["B1L1N"][i].x1, ladder_pos_map["B1L1N"][i].x2, ladder_pos_map["B1L1N"][i].x3, ladder_pos_map["B1L1N"][i].x4};
0084     py = {ladder_pos_map["B1L1N"][i].y1, ladder_pos_map["B1L1N"][i].y2, ladder_pos_map["B1L1N"][i].y3, ladder_pos_map["B1L1N"][i].y4};
0085     TH2Poly::AddBin(4, px.data(), py.data());
0086   }
0087 };
0088 
0089 void TH2INTT::Draw(Option_t *option)
0090 {
0091   TH2Poly::Draw(option);  // note : Call the base class Draw() function
0092 
0093   TLatex *side_text = new TLatex();
0094   // side_text -> SetNDC();
0095   side_text->SetTextSize(0.06);
0096   side_text->SetTextAlign(21);
0097 
0098   side_text->DrawLatex(-10, 8, "South");
0099   side_text->DrawLatex(10, 8, "North");
0100 
0101   TArrow *arx = new TArrow(-1.5, -8, 1.5, -8, 0.015, "|>");
0102   arx->SetAngle(40);
0103   arx->SetLineWidth(2);
0104   arx->Draw("");
0105 
0106   TArrow *ary = new TArrow(-1.5, -8, -1.5, -5, 0.015, "|>");
0107   ary->SetAngle(40);
0108   ary->SetLineWidth(2);
0109   ary->Draw("");
0110 
0111   TLatex *coord_text = new TLatex();
0112   coord_text->SetTextSize(0.05);
0113   coord_text->SetTextAlign(21);
0114   coord_text->DrawLatex(2, -8.5, "X");
0115   coord_text->DrawLatex(-1.5, -4.5, "Y");
0116   coord_text->DrawLatex(1, -6, "#odot Z");
0117 
0118   TLatex *note_text = new TLatex();
0119   note_text->SetTextSize(0.035);
0120   note_text->SetTextAlign(32);
0121   note_text->DrawLatex(22, -9, "View from North to South");
0122 
0123   // side_text -> DrawLatex(0.285, 0.83, "South" );
0124   // side_text -> DrawLatex(0.64, 0.83, "North" );
0125 
0126   // note : Draw the line
0127   for (auto &i : ladder_line)
0128   {
0129     i->Draw("lsame");
0130   }
0131 }
0132 
0133 void TH2INTT::fill_ladder_pos_map()
0134 {
0135   std::vector<ladder_pos> temp_vec;
0136   temp_vec.clear();
0137 
0138   // note : B0L0S
0139   for (int i = 0; i < 12; i++)
0140   {
0141     temp_vec.push_back(
0142         {B0L0_12_r * cos((B0L0_point1_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)) + south_x_offset,
0143          B0L0_12_r * sin((B0L0_point1_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)),
0144          B0L0_12_r * cos((B0L0_point2_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)) + south_x_offset,
0145          B0L0_12_r * sin((B0L0_point2_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)),
0146          B0L0_34_r * cos((B0L0_point3_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)) + south_x_offset,
0147          B0L0_34_r * sin((B0L0_point3_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)),
0148          B0L0_34_r * cos((B0L0_point4_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)) + south_x_offset,
0149          B0L0_34_r * sin((B0L0_point4_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI))});
0150   }
0151   ladder_pos_map["B0L0S"] = temp_vec;
0152   temp_vec.clear();
0153 
0154   // note : B0L1S
0155   for (int i = 0; i < 12; i++)
0156   {
0157     temp_vec.push_back({B0L1_12_r * cos((B0L1_point1_initial - i * 30) / (180. / M_PI)) + south_x_offset, B0L1_12_r * sin((B0L1_point1_initial - i * 30) / (180. / M_PI)),
0158                         B0L1_12_r * cos((B0L1_point2_initial - i * 30) / (180. / M_PI)) + south_x_offset, B0L1_12_r * sin((B0L1_point2_initial - i * 30) / (180. / M_PI)),
0159                         B0L1_34_r * cos((B0L1_point3_initial - i * 30) / (180. / M_PI)) + south_x_offset, B0L1_34_r * sin((B0L1_point3_initial - i * 30) / (180. / M_PI)),
0160                         B0L1_34_r * cos((B0L1_point4_initial - i * 30) / (180. / M_PI)) + south_x_offset, B0L1_34_r * sin((B0L1_point4_initial - i * 30) / (180. / M_PI))});
0161   }
0162   ladder_pos_map["B0L1S"] = temp_vec;
0163   temp_vec.clear();
0164 
0165   // note : B1L0S
0166   for (int i = 0; i < 16; i++)
0167   {
0168     temp_vec.push_back({B1L0_12_r * cos((B1L0_point1_initial - i * 22.5 - 22.5) / (180. / M_PI)) + south_x_offset, B1L0_12_r * sin((B1L0_point1_initial - i * 22.5 - 22.5) / (180. / M_PI)),
0169                         B1L0_12_r * cos((B1L0_point2_initial - i * 22.5 - 22.5) / (180. / M_PI)) + south_x_offset, B1L0_12_r * sin((B1L0_point2_initial - i * 22.5 - 22.5) / (180. / M_PI)),
0170                         B1L0_34_r * cos((B1L0_point3_initial - i * 22.5 - 22.5) / (180. / M_PI)) + south_x_offset, B1L0_34_r * sin((B1L0_point3_initial - i * 22.5 - 22.5) / (180. / M_PI)),
0171                         B1L0_34_r * cos((B1L0_point4_initial - i * 22.5 - 22.5) / (180. / M_PI)) + south_x_offset, B1L0_34_r * sin((B1L0_point4_initial - i * 22.5 - 22.5) / (180. / M_PI))});
0172   }
0173   ladder_pos_map["B1L0S"] = temp_vec;
0174   temp_vec.clear();
0175 
0176   // note : B1L1S
0177   for (int i = 0; i < 16; i++)
0178   {
0179     temp_vec.push_back({B1L1_12_r * cos((B1L1_point1_initial - i * 22.5) / (180. / M_PI)) + south_x_offset, B1L1_12_r * sin((B1L1_point1_initial - i * 22.5) / (180. / M_PI)),
0180                         B1L1_12_r * cos((B1L1_point2_initial - i * 22.5) / (180. / M_PI)) + south_x_offset, B1L1_12_r * sin((B1L1_point2_initial - i * 22.5) / (180. / M_PI)),
0181                         B1L1_34_r * cos((B1L1_point3_initial - i * 22.5) / (180. / M_PI)) + south_x_offset, B1L1_34_r * sin((B1L1_point3_initial - i * 22.5) / (180. / M_PI)),
0182                         B1L1_34_r * cos((B1L1_point4_initial - i * 22.5) / (180. / M_PI)) + south_x_offset, B1L1_34_r * sin((B1L1_point4_initial - i * 22.5) / (180. / M_PI))});
0183   }
0184   ladder_pos_map["B1L1S"] = temp_vec;
0185   temp_vec.clear();
0186 
0187   // note : B0L0N
0188   for (int i = 0; i < 12; i++)
0189   {
0190     temp_vec.push_back({B0L0_12_r * cos((B0L0_point1_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)) + north_x_offset, B0L0_12_r * sin((B0L0_point1_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)),
0191                         B0L0_12_r * cos((B0L0_point2_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)) + north_x_offset, B0L0_12_r * sin((B0L0_point2_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)),
0192                         B0L0_34_r * cos((B0L0_point3_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)) + north_x_offset, B0L0_34_r * sin((B0L0_point3_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)),
0193                         B0L0_34_r * cos((B0L0_point4_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI)) + north_x_offset, B0L0_34_r * sin((B0L0_point4_initial - 5 * 30 - i * 30 - 30) / (180. / M_PI))});
0194   }
0195   ladder_pos_map["B0L0N"] = temp_vec;
0196   temp_vec.clear();
0197 
0198   // note : B0L1N
0199   for (int i = 0; i < 12; i++)
0200   {
0201     temp_vec.push_back({B0L1_12_r * cos((B0L1_point1_initial - i * 30) / (180. / M_PI)) + north_x_offset, B0L1_12_r * sin((B0L1_point1_initial - i * 30) / (180. / M_PI)),
0202                         B0L1_12_r * cos((B0L1_point2_initial - i * 30) / (180. / M_PI)) + north_x_offset, B0L1_12_r * sin((B0L1_point2_initial - i * 30) / (180. / M_PI)),
0203                         B0L1_34_r * cos((B0L1_point3_initial - i * 30) / (180. / M_PI)) + north_x_offset, B0L1_34_r * sin((B0L1_point3_initial - i * 30) / (180. / M_PI)),
0204                         B0L1_34_r * cos((B0L1_point4_initial - i * 30) / (180. / M_PI)) + north_x_offset, B0L1_34_r * sin((B0L1_point4_initial - i * 30) / (180. / M_PI))});
0205   }
0206   ladder_pos_map["B0L1N"] = temp_vec;
0207   temp_vec.clear();
0208 
0209   // note : B1L0N
0210   for (int i = 0; i < 16; i++)
0211   {
0212     temp_vec.push_back({B1L0_12_r * cos((B1L0_point1_initial - i * 22.5 - 22.5) / (180. / M_PI)) + north_x_offset, B1L0_12_r * sin((B1L0_point1_initial - i * 22.5 - 22.5) / (180. / M_PI)),
0213                         B1L0_12_r * cos((B1L0_point2_initial - i * 22.5 - 22.5) / (180. / M_PI)) + north_x_offset, B1L0_12_r * sin((B1L0_point2_initial - i * 22.5 - 22.5) / (180. / M_PI)),
0214                         B1L0_34_r * cos((B1L0_point3_initial - i * 22.5 - 22.5) / (180. / M_PI)) + north_x_offset, B1L0_34_r * sin((B1L0_point3_initial - i * 22.5 - 22.5) / (180. / M_PI)),
0215                         B1L0_34_r * cos((B1L0_point4_initial - i * 22.5 - 22.5) / (180. / M_PI)) + north_x_offset, B1L0_34_r * sin((B1L0_point4_initial - i * 22.5 - 22.5) / (180. / M_PI))});
0216   }
0217   ladder_pos_map["B1L0N"] = temp_vec;
0218   temp_vec.clear();
0219 
0220   // note : B1L1N
0221   for (int i = 0; i < 16; i++)
0222   {
0223     temp_vec.push_back({B1L1_12_r * cos((B1L1_point1_initial - i * 22.5) / (180. / M_PI)) + north_x_offset, B1L1_12_r * sin((B1L1_point1_initial - i * 22.5) / (180. / M_PI)),
0224                         B1L1_12_r * cos((B1L1_point2_initial - i * 22.5) / (180. / M_PI)) + north_x_offset, B1L1_12_r * sin((B1L1_point2_initial - i * 22.5) / (180. / M_PI)),
0225                         B1L1_34_r * cos((B1L1_point3_initial - i * 22.5) / (180. / M_PI)) + north_x_offset, B1L1_34_r * sin((B1L1_point3_initial - i * 22.5) / (180. / M_PI)),
0226                         B1L1_34_r * cos((B1L1_point4_initial - i * 22.5) / (180. / M_PI)) + north_x_offset, B1L1_34_r * sin((B1L1_point4_initial - i * 22.5) / (180. / M_PI))});
0227   }
0228   ladder_pos_map["B1L1N"] = temp_vec;
0229   temp_vec.clear();
0230 }
0231 
0232 void TH2INTT::fill_ladder_line()
0233 {
0234   // note : fill the bin line, to show the shape
0235   for (unsigned int i = 0; i < ladder_pos_map["B0L0S"].size(); i++)
0236   {
0237     ladder_line.push_back(new TLine(ladder_pos_map["B0L0S"][i].x1, ladder_pos_map["B0L0S"][i].y1, ladder_pos_map["B0L0S"][i].x2, ladder_pos_map["B0L0S"][i].y2));
0238     ladder_line.push_back(new TLine(ladder_pos_map["B0L0S"][i].x2, ladder_pos_map["B0L0S"][i].y2, ladder_pos_map["B0L0S"][i].x3, ladder_pos_map["B0L0S"][i].y3));
0239     ladder_line.push_back(new TLine(ladder_pos_map["B0L0S"][i].x3, ladder_pos_map["B0L0S"][i].y3, ladder_pos_map["B0L0S"][i].x4, ladder_pos_map["B0L0S"][i].y4));
0240     ladder_line.push_back(new TLine(ladder_pos_map["B0L0S"][i].x4, ladder_pos_map["B0L0S"][i].y4, ladder_pos_map["B0L0S"][i].x1, ladder_pos_map["B0L0S"][i].y1));
0241   }
0242 
0243   // note : fill the bin line, to show the shape
0244   for (unsigned int i = 0; i < ladder_pos_map["B0L1S"].size(); i++)
0245   {
0246     ladder_line.push_back(new TLine(ladder_pos_map["B0L1S"][i].x1, ladder_pos_map["B0L1S"][i].y1, ladder_pos_map["B0L1S"][i].x2, ladder_pos_map["B0L1S"][i].y2));
0247     ladder_line.push_back(new TLine(ladder_pos_map["B0L1S"][i].x2, ladder_pos_map["B0L1S"][i].y2, ladder_pos_map["B0L1S"][i].x3, ladder_pos_map["B0L1S"][i].y3));
0248     ladder_line.push_back(new TLine(ladder_pos_map["B0L1S"][i].x3, ladder_pos_map["B0L1S"][i].y3, ladder_pos_map["B0L1S"][i].x4, ladder_pos_map["B0L1S"][i].y4));
0249     ladder_line.push_back(new TLine(ladder_pos_map["B0L1S"][i].x4, ladder_pos_map["B0L1S"][i].y4, ladder_pos_map["B0L1S"][i].x1, ladder_pos_map["B0L1S"][i].y1));
0250   }
0251 
0252   // note : fill the bin line, to show the shape
0253   for (unsigned int i = 0; i < ladder_pos_map["B1L0S"].size(); i++)
0254   {
0255     ladder_line.push_back(new TLine(ladder_pos_map["B1L0S"][i].x1, ladder_pos_map["B1L0S"][i].y1, ladder_pos_map["B1L0S"][i].x2, ladder_pos_map["B1L0S"][i].y2));
0256     ladder_line.push_back(new TLine(ladder_pos_map["B1L0S"][i].x2, ladder_pos_map["B1L0S"][i].y2, ladder_pos_map["B1L0S"][i].x3, ladder_pos_map["B1L0S"][i].y3));
0257     ladder_line.push_back(new TLine(ladder_pos_map["B1L0S"][i].x3, ladder_pos_map["B1L0S"][i].y3, ladder_pos_map["B1L0S"][i].x4, ladder_pos_map["B1L0S"][i].y4));
0258     ladder_line.push_back(new TLine(ladder_pos_map["B1L0S"][i].x4, ladder_pos_map["B1L0S"][i].y4, ladder_pos_map["B1L0S"][i].x1, ladder_pos_map["B1L0S"][i].y1));
0259   }
0260 
0261   // note : fill the bin line, to show the shape
0262   for (unsigned int i = 0; i < ladder_pos_map["B1L1S"].size(); i++)
0263   {
0264     ladder_line.push_back(new TLine(ladder_pos_map["B1L1S"][i].x1, ladder_pos_map["B1L1S"][i].y1, ladder_pos_map["B1L1S"][i].x2, ladder_pos_map["B1L1S"][i].y2));
0265     ladder_line.push_back(new TLine(ladder_pos_map["B1L1S"][i].x2, ladder_pos_map["B1L1S"][i].y2, ladder_pos_map["B1L1S"][i].x3, ladder_pos_map["B1L1S"][i].y3));
0266     ladder_line.push_back(new TLine(ladder_pos_map["B1L1S"][i].x3, ladder_pos_map["B1L1S"][i].y3, ladder_pos_map["B1L1S"][i].x4, ladder_pos_map["B1L1S"][i].y4));
0267     ladder_line.push_back(new TLine(ladder_pos_map["B1L1S"][i].x4, ladder_pos_map["B1L1S"][i].y4, ladder_pos_map["B1L1S"][i].x1, ladder_pos_map["B1L1S"][i].y1));
0268   }
0269 
0270   // note : fill the bin line, to show the shape
0271   for (unsigned int i = 0; i < ladder_pos_map["B0L0N"].size(); i++)
0272   {
0273     ladder_line.push_back(new TLine(ladder_pos_map["B0L0N"][i].x1, ladder_pos_map["B0L0N"][i].y1, ladder_pos_map["B0L0N"][i].x2, ladder_pos_map["B0L0N"][i].y2));
0274     ladder_line.push_back(new TLine(ladder_pos_map["B0L0N"][i].x2, ladder_pos_map["B0L0N"][i].y2, ladder_pos_map["B0L0N"][i].x3, ladder_pos_map["B0L0N"][i].y3));
0275     ladder_line.push_back(new TLine(ladder_pos_map["B0L0N"][i].x3, ladder_pos_map["B0L0N"][i].y3, ladder_pos_map["B0L0N"][i].x4, ladder_pos_map["B0L0N"][i].y4));
0276     ladder_line.push_back(new TLine(ladder_pos_map["B0L0N"][i].x4, ladder_pos_map["B0L0N"][i].y4, ladder_pos_map["B0L0N"][i].x1, ladder_pos_map["B0L0N"][i].y1));
0277   }
0278 
0279   // note : fill the bin line, to show the shape
0280   for (unsigned int i = 0; i < ladder_pos_map["B0L1N"].size(); i++)
0281   {
0282     ladder_line.push_back(new TLine(ladder_pos_map["B0L1N"][i].x1, ladder_pos_map["B0L1N"][i].y1, ladder_pos_map["B0L1N"][i].x2, ladder_pos_map["B0L1N"][i].y2));
0283     ladder_line.push_back(new TLine(ladder_pos_map["B0L1N"][i].x2, ladder_pos_map["B0L1N"][i].y2, ladder_pos_map["B0L1N"][i].x3, ladder_pos_map["B0L1N"][i].y3));
0284     ladder_line.push_back(new TLine(ladder_pos_map["B0L1N"][i].x3, ladder_pos_map["B0L1N"][i].y3, ladder_pos_map["B0L1N"][i].x4, ladder_pos_map["B0L1N"][i].y4));
0285     ladder_line.push_back(new TLine(ladder_pos_map["B0L1N"][i].x4, ladder_pos_map["B0L1N"][i].y4, ladder_pos_map["B0L1N"][i].x1, ladder_pos_map["B0L1N"][i].y1));
0286   }
0287 
0288   // note : fill the bin line, to show the shape
0289   for (unsigned int i = 0; i < ladder_pos_map["B1L0N"].size(); i++)
0290   {
0291     ladder_line.push_back(new TLine(ladder_pos_map["B1L0N"][i].x1, ladder_pos_map["B1L0N"][i].y1, ladder_pos_map["B1L0N"][i].x2, ladder_pos_map["B1L0N"][i].y2));
0292     ladder_line.push_back(new TLine(ladder_pos_map["B1L0N"][i].x2, ladder_pos_map["B1L0N"][i].y2, ladder_pos_map["B1L0N"][i].x3, ladder_pos_map["B1L0N"][i].y3));
0293     ladder_line.push_back(new TLine(ladder_pos_map["B1L0N"][i].x3, ladder_pos_map["B1L0N"][i].y3, ladder_pos_map["B1L0N"][i].x4, ladder_pos_map["B1L0N"][i].y4));
0294     ladder_line.push_back(new TLine(ladder_pos_map["B1L0N"][i].x4, ladder_pos_map["B1L0N"][i].y4, ladder_pos_map["B1L0N"][i].x1, ladder_pos_map["B1L0N"][i].y1));
0295   }
0296 
0297   // note : fill the bin line, to show the shape
0298   for (unsigned int i = 0; i < ladder_pos_map["B1L1N"].size(); i++)
0299   {
0300     ladder_line.push_back(new TLine(ladder_pos_map["B1L1N"][i].x1, ladder_pos_map["B1L1N"][i].y1, ladder_pos_map["B1L1N"][i].x2, ladder_pos_map["B1L1N"][i].y2));
0301     ladder_line.push_back(new TLine(ladder_pos_map["B1L1N"][i].x2, ladder_pos_map["B1L1N"][i].y2, ladder_pos_map["B1L1N"][i].x3, ladder_pos_map["B1L1N"][i].y3));
0302     ladder_line.push_back(new TLine(ladder_pos_map["B1L1N"][i].x3, ladder_pos_map["B1L1N"][i].y3, ladder_pos_map["B1L1N"][i].x4, ladder_pos_map["B1L1N"][i].y4));
0303     ladder_line.push_back(new TLine(ladder_pos_map["B1L1N"][i].x4, ladder_pos_map["B1L1N"][i].y4, ladder_pos_map["B1L1N"][i].x1, ladder_pos_map["B1L1N"][i].y1));
0304   }
0305 }
0306 
0307 void TH2INTT::fill_ladder_toinfo_map_bin()
0308 {
0309   std::string side_word;
0310   int bin_index = 1;
0311 
0312   for (int arm = 0; arm < 2; arm++)  // note : arm, 0 for south, 1 for north
0313   {
0314     side_word = (arm == 0) ? "S" : "N";
0315 
0316     for (int layer = 0; layer < 4; layer++)  // note : layer
0317     {
0318       int n_ladder = (layer < 2) ? 12 : 16;
0319 
0320       for (int HL = 0; HL < n_ladder; HL++)
0321       {
0322         ladder_toinfo_map
0323       [std::format("{}{}{}", layer_map.at(layer), index_word[HL], side_word)]
0324                 .bin_id = bin_index;
0325 
0326         // std::cout<< (boost::format("%s%s%s") %layer_map.at(layer) %index_word[HL] %side_word).str() <<" "<<bin_index<<std::endl;
0327 
0328         bin_index += 1;
0329       }
0330 
0331       // std::cout<<" "<<std::endl;
0332     }
0333     // std::cout<<" "<<std::endl;
0334   }
0335 }
0336 
0337 void TH2INTT::SetLadderSContent(const std::string &ladder_name, double content)
0338 {
0339   TH2Poly::SetBinContent(ladder_toinfo_map.at(ladder_name).bin_id, content);
0340 }
0341 
0342 void TH2INTT::SetSerFCSContent(const std::string &server_FC, double content)
0343 {
0344   TH2Poly::SetBinContent(ladder_toinfo_map.at(serverFC_toinfo_map.at(server_FC).Ladder).bin_id, content);
0345 }
0346 
0347 void TH2INTT::SetLadderIContent(int barrel_id, int layer_id, int ladder_id, int side, double content)
0348 {
0349   if (side != 0 && side != 1)
0350   {
0351     std::cout << "wrong side fill" << std::endl;
0352     return;
0353   }
0354 
0355   std::string side_word = (side == 0) ? "S" : "N";
0356   TH2Poly::SetBinContent(ladder_toinfo_map.at((boost::format("B%iL%i%s%s") % barrel_id % layer_id % index_word[ladder_id] % side_word).str()).bin_id, content);
0357 }
0358 
0359 void TH2INTT::SetSerFCIContent(int server_id, int FC_id, double content)
0360 {
0361   TH2Poly::SetBinContent(ladder_toinfo_map.at(serverFC_toinfo_map.at((boost::format("intt%i_%i") % server_id % FC_id).str()).Ladder).bin_id, content);
0362 }
0363 
0364 double TH2INTT::GetLadderSContent(const std::string &ladder_name)
0365 {
0366   return TH2Poly::GetBinContent(ladder_toinfo_map.at(ladder_name).bin_id);
0367 }
0368 
0369 double TH2INTT::GetSerFCSContent(const std::string &server_FC)
0370 {
0371   return TH2Poly::GetBinContent(ladder_toinfo_map.at(serverFC_toinfo_map.at(server_FC).Ladder).bin_id);
0372 }
0373 
0374 double TH2INTT::GetLadderIContent(int barrel_id, int layer_id, int ladder_id, int side)
0375 {
0376   if (side != 0 && side != 1)
0377   {
0378     std::cout << "wrong side fill" << std::endl;
0379     return 0;
0380   }
0381 
0382   std::string side_word = (side == 0) ? "S" : "N";
0383   return TH2Poly::GetBinContent(ladder_toinfo_map.at((boost::format("B%iL%i%s%s") % barrel_id % layer_id % index_word[ladder_id] % side_word).str()).bin_id);
0384 }
0385 
0386 double TH2INTT::GetSerFCIContent(int server_id, int FC_id)
0387 {
0388   //  return TH2Poly::GetBinContent(ladder_toinfo_map.at(serverFC_toinfo_map.at(Form("intt%i_%i", server_id, FC_id)).Ladder).bin_id);
0389   return TH2Poly::GetBinContent(ladder_toinfo_map.at(serverFC_toinfo_map.at((boost::format("intt%i_%i") % server_id % FC_id).str()).Ladder).bin_id);
0390 }