Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:18:42

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