Back to home page

sPhenix code displayed by LXR

 
 

    


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

0001 #ifndef QA_INTT_TH2INTT_H
0002 #define QA_INTT_TH2INTT_H
0003 
0004 #include <TH2Poly.h>
0005 
0006 #include <map>
0007 #include <string>
0008 #include <vector>
0009 
0010 class TLine;
0011 
0012 struct ladder_info
0013 {
0014   int FC;
0015   std::string Port;
0016   int ROC;
0017   int Direction;  // note : 0 : south, 1 : north
0018   int bin_id = 0;
0019 };
0020 
0021 struct full_ladder_info
0022 {
0023   int FC;
0024   std::string Port;
0025   int ROC;
0026   int Direction;  // note : 0 : south, 1 : north
0027   std::string Ladder;
0028 };
0029 
0030 struct ladder_pos
0031 {
0032   double x1;
0033   double y1;
0034 
0035   double x2;
0036   double y2;
0037 
0038   double x3;
0039   double y3;
0040 
0041   double x4;
0042   double y4;
0043 };
0044 
0045 static std::map<std::string, ladder_info> ladder_toinfo_map{
0046     {"B1L101S", {0, "D2", 0, 0}},  // note : intt 0
0047     {"B0L101S", {1, "C1", 0, 0}},
0048     {"B1L001S", {2, "C2", 0, 0}},
0049     {"B1L000S", {3, "B3", 0, 0}},
0050     {"B1L100S", {4, "A2", 0, 0}},
0051     {"B0L000S", {5, "B1", 0, 0}},
0052     {"B0L100S", {6, "A1", 0, 0}},
0053 
0054     {"B1L103S", {7, "C2", 1, 0}},
0055     {"B0L002S", {8, "C1", 1, 0}},
0056     {"B0L001S", {9, "A1", 1, 0}},
0057     {"B1L002S", {10, "B3", 1, 0}},
0058     {"B1L102S", {11, "A2", 1, 0}},
0059     {"B0L102S", {12, "B1", 1, 0}},
0060     {"B1L003S", {13, "D2", 1, 0}},
0061 
0062     {"B1L105S", {0, "C2", 2, 0}},  // note : intt 1
0063     {"B0L104S", {1, "C1", 2, 0}},
0064     {"B0L103S", {2, "A2", 2, 0}},
0065     {"B1L004S", {3, "B3", 2, 0}},
0066     {"B1L104S", {4, "A1", 2, 0}},
0067     {"B0L003S", {5, "B1", 2, 0}},
0068     {"B1L005S", {6, "D2", 2, 0}},
0069 
0070     {"B1L107S", {7, "C2", 3, 0}},
0071     {"B0L005S", {8, "C1", 3, 0}},
0072     {"B0L004S", {9, "A1", 3, 0}},
0073     {"B1L006S", {10, "B2", 3, 0}},
0074     {"B1L106S", {11, "A2", 3, 0}},
0075     {"B0L105S", {12, "B1", 3, 0}},
0076     {"B1L007S", {13, "D1", 3, 0}},
0077 
0078     {"B0L106S", {0, "A1", 4, 0}},  // note : intt 2
0079     {"B0L006S", {1, "B1", 4, 0}},
0080     {"B0L107S", {2, "C1", 4, 0}},
0081     {"B1L108S", {3, "A2", 4, 0}},
0082     {"B1L008S", {4, "B2", 4, 0}},
0083     {"B1L109S", {5, "C2", 4, 0}},
0084     {"B1L009S", {6, "D1", 4, 0}},
0085 
0086     {"B0L007S", {7, "A1", 5, 0}},
0087     {"B0L108S", {8, "B3", 5, 0}},
0088     {"B0L008S", {9, "C1", 5, 0}},
0089     {"B1L110S", {10, "A2", 5, 0}},
0090     {"B1L010S", {11, "B2", 5, 0}},
0091     {"B1L111S", {12, "C2", 5, 0}},
0092     {"B1L011S", {13, "C3", 5, 0}},
0093 
0094     {"B0L109S", {0, "A1", 6, 0}},  // note : intt 3
0095     {"B0L009S", {1, "B1", 6, 0}},
0096     {"B0L110S", {2, "C1", 6, 0}},
0097     {"B1L112S", {3, "A2", 6, 0}},
0098     {"B1L012S", {4, "B3", 6, 0}},
0099     {"B1L113S", {5, "C2", 6, 0}},
0100     {"B1L013S", {6, "D1", 6, 0}},
0101 
0102     {"B0L010S", {7, "A1", 7, 0}},
0103     {"B0L111S", {8, "B1", 7, 0}},
0104     {"B0L011S", {9, "C1", 7, 0}},
0105     {"B1L114S", {10, "A2", 7, 0}},
0106     {"B1L014S", {11, "B3", 7, 0}},
0107     {"B1L115S", {12, "C3", 7, 0}},
0108     {"B1L015S", {13, "D2", 7, 0}},
0109 
0110     {"B1L101N", {0, "B1", 0, 1}},  // note : intt 4
0111     {"B0L000N", {1, "C2", 0, 1}},
0112     {"B0L100N", {2, "D1", 0, 1}},
0113     {"B1L001N", {3, "A2", 0, 1}},
0114     {"B0L101N", {4, "B2", 0, 1}},
0115     {"B1L000N", {5, "C3", 0, 1}},
0116     {"B1L100N", {6, "D2", 0, 1}},
0117 
0118     {"B0L002N", {7, "B1", 1, 1}},
0119     {"B0L102N", {8, "C2", 1, 1}},
0120     {"B0L001N", {9, "D1", 1, 1}},
0121     {"B1L003N", {10, "A2", 1, 1}},
0122     {"B1L103N", {11, "B2", 1, 1}},
0123     {"B1L002N", {12, "C3", 1, 1}},
0124     {"B1L102N", {13, "B3", 1, 1}},
0125 
0126     {"B0L003N", {0, "C1", 2, 1}},  // note : intt 5
0127     {"B0L104N", {1, "B1", 2, 1}},
0128     {"B0L103N", {2, "D2", 2, 1}},
0129     {"B1L004N", {3, "D1", 2, 1}},
0130     {"B1L005N", {4, "A2", 2, 1}},
0131     {"B1L104N", {5, "C2", 2, 1}},
0132     {"B1L105N", {6, "A1", 2, 1}},
0133 
0134     {"B1L107N", {7, "C3", 3, 1}},
0135     {"B1L007N", {8, "B1", 3, 1}},
0136     {"B1L006N", {9, "C1", 3, 1}},
0137     {"B1L106N", {10, "D2", 3, 1}},
0138     {"B0L005N", {11, "A1", 3, 1}},
0139     {"B0L105N", {12, "C2", 3, 1}},
0140     {"B0L004N", {13, "D1", 3, 1}},
0141 
0142     {"B0L106N", {0, "A1", 4, 1}},  // note : intt 6
0143     {"B0L006N", {1, "C3", 4, 1}},
0144     {"B0L107N", {2, "B2", 4, 1}},
0145     {"B1L108N", {3, "D1", 4, 1}},
0146     {"B1L008N", {4, "C2", 4, 1}},
0147     {"B1L109N", {5, "B3", 4, 1}},
0148     {"B1L009N", {6, "A2", 4, 1}},
0149 
0150     {"B0L007N", {7, "D1", 5, 1}},
0151     {"B0L108N", {8, "C3", 5, 1}},
0152     {"B0L008N", {9, "A2", 5, 1}},
0153     {"B1L110N", {10, "D2", 5, 1}},
0154     {"B1L010N", {11, "C2", 5, 1}},
0155     {"B1L111N", {12, "B3", 5, 1}},
0156     {"B1L011N", {13, "A1", 5, 1}},
0157 
0158     {"B0L109N", {0, "B3", 6, 1}},  // note : intt 7
0159     {"B0L009N", {1, "C1", 6, 1}},
0160     {"B0L110N", {2, "B1", 6, 1}},
0161     {"B1L112N", {3, "D1", 6, 1}},
0162     {"B1L012N", {4, "C2", 6, 1}},
0163     {"B1L113N", {5, "B2", 6, 1}},
0164     {"B1L013N", {6, "A1", 6, 1}},
0165 
0166     {"B0L010N", {7, "B2", 7, 1}},
0167     {"B0L111N", {8, "C2", 7, 1}},
0168     {"B0L011N", {9, "B1", 7, 1}},
0169     {"B1L114N", {10, "D2", 7, 1}},
0170     {"B1L014N", {11, "C3", 7, 1}},
0171     {"B1L115N", {12, "B3", 7, 1}},
0172     {"B1L015N", {13, "A1", 7, 1}}};
0173 
0174 static std::map<std::string, full_ladder_info> serverFC_toinfo_map{
0175     {"intt0_0", {0, "D2", 0, 0, "B1L101S"}},  // note : intt 0
0176     {"intt0_1", {1, "C1", 0, 0, "B0L101S"}},
0177     {"intt0_2", {2, "C2", 0, 0, "B1L001S"}},
0178     {"intt0_3", {3, "B3", 0, 0, "B1L000S"}},
0179     {"intt0_4", {4, "A2", 0, 0, "B1L100S"}},
0180     {"intt0_5", {5, "B1", 0, 0, "B0L000S"}},
0181     {"intt0_6", {6, "A1", 0, 0, "B0L100S"}},
0182 
0183     {"intt0_7", {7, "C2", 1, 0, "B1L103S"}},
0184     {"intt0_8", {8, "C1", 1, 0, "B0L002S"}},
0185     {"intt0_9", {9, "A1", 1, 0, "B0L001S"}},
0186     {"intt0_10", {10, "B3", 1, 0, "B1L002S"}},
0187     {"intt0_11", {11, "A2", 1, 0, "B1L102S"}},
0188     {"intt0_12", {12, "B1", 1, 0, "B0L102S"}},
0189     {"intt0_13", {13, "D2", 1, 0, "B1L003S"}},
0190 
0191     {"intt1_0", {0, "C2", 2, 0, "B1L105S"}},  // note : intt 1
0192     {"intt1_1", {1, "C1", 2, 0, "B0L104S"}},
0193     {"intt1_2", {2, "A2", 2, 0, "B0L103S"}},
0194     {"intt1_3", {3, "B3", 2, 0, "B1L004S"}},
0195     {"intt1_4", {4, "A1", 2, 0, "B1L104S"}},
0196     {"intt1_5", {5, "B1", 2, 0, "B0L003S"}},
0197     {"intt1_6", {6, "D2", 2, 0, "B1L005S"}},
0198 
0199     {"intt1_7", {7, "C2", 3, 0, "B1L107S"}},
0200     {"intt1_8", {8, "C1", 3, 0, "B0L005S"}},
0201     {"intt1_9", {9, "A1", 3, 0, "B0L004S"}},
0202     {"intt1_10", {10, "B2", 3, 0, "B1L006S"}},
0203     {"intt1_11", {11, "A2", 3, 0, "B1L106S"}},
0204     {"intt1_12", {12, "B1", 3, 0, "B0L105S"}},
0205     {"intt1_13", {13, "D1", 3, 0, "B1L007S"}},
0206 
0207     {"intt2_0", {0, "A1", 4, 0, "B0L106S"}},  // note : intt 2
0208     {"intt2_1", {1, "B1", 4, 0, "B0L006S"}},
0209     {"intt2_2", {2, "C1", 4, 0, "B0L107S"}},
0210     {"intt2_3", {3, "A2", 4, 0, "B1L108S"}},
0211     {"intt2_4", {4, "B2", 4, 0, "B1L008S"}},
0212     {"intt2_5", {5, "C2", 4, 0, "B1L109S"}},
0213     {"intt2_6", {6, "D1", 4, 0, "B1L009S"}},
0214 
0215     {"intt2_7", {7, "A1", 5, 0, "B0L007S"}},
0216     {"intt2_8", {8, "B3", 5, 0, "B0L108S"}},
0217     {"intt2_9", {9, "C1", 5, 0, "B0L008S"}},
0218     {"intt2_10", {10, "A2", 5, 0, "B1L110S"}},
0219     {"intt2_11", {11, "B2", 5, 0, "B1L010S"}},
0220     {"intt2_12", {12, "C2", 5, 0, "B1L111S"}},
0221     {"intt2_13", {13, "C3", 5, 0, "B1L011S"}},
0222 
0223     {"intt3_0", {0, "A1", 6, 0, "B0L109S"}},  // note : intt 3
0224     {"intt3_1", {1, "B1", 6, 0, "B0L009S"}},
0225     {"intt3_2", {2, "C1", 6, 0, "B0L110S"}},
0226     {"intt3_3", {3, "A2", 6, 0, "B1L112S"}},
0227     {"intt3_4", {4, "B3", 6, 0, "B1L012S"}},
0228     {"intt3_5", {5, "C2", 6, 0, "B1L113S"}},
0229     {"intt3_6", {6, "D1", 6, 0, "B1L013S"}},
0230 
0231     {"intt3_7", {7, "A1", 7, 0, "B0L010S"}},
0232     {"intt3_8", {8, "B1", 7, 0, "B0L111S"}},
0233     {"intt3_9", {9, "C1", 7, 0, "B0L011S"}},
0234     {"intt3_10", {10, "A2", 7, 0, "B1L114S"}},
0235     {"intt3_11", {11, "B3", 7, 0, "B1L014S"}},
0236     {"intt3_12", {12, "C3", 7, 0, "B1L115S"}},
0237     {"intt3_13", {13, "D2", 7, 0, "B1L015S"}},
0238 
0239     {"intt4_0", {0, "B1", 0, 1, "B1L101N"}},  // note : intt 4
0240     {"intt4_1", {1, "C2", 0, 1, "B0L000N"}},
0241     {"intt4_2", {2, "D1", 0, 1, "B0L100N"}},
0242     {"intt4_3", {3, "A2", 0, 1, "B1L001N"}},
0243     {"intt4_4", {4, "B2", 0, 1, "B0L101N"}},
0244     {"intt4_5", {5, "C3", 0, 1, "B1L000N"}},
0245     {"intt4_6", {6, "D2", 0, 1, "B1L100N"}},
0246 
0247     {"intt4_7", {7, "B1", 1, 1, "B0L002N"}},
0248     {"intt4_8", {8, "C2", 1, 1, "B0L102N"}},
0249     {"intt4_9", {9, "D1", 1, 1, "B0L001N"}},
0250     {"intt4_10", {10, "A2", 1, 1, "B1L003N"}},
0251     {"intt4_11", {11, "B2", 1, 1, "B1L103N"}},
0252     {"intt4_12", {12, "C3", 1, 1, "B1L002N"}},
0253     {"intt4_13", {13, "B3", 1, 1, "B1L102N"}},
0254 
0255     {"intt5_0", {0, "C1", 2, 1, "B0L003N"}},  // note : intt 5
0256     {"intt5_1", {1, "B1", 2, 1, "B0L104N"}},
0257     {"intt5_2", {2, "D2", 2, 1, "B0L103N"}},
0258     {"intt5_3", {3, "D1", 2, 1, "B1L004N"}},
0259     {"intt5_4", {4, "A2", 2, 1, "B1L005N"}},
0260     {"intt5_5", {5, "C2", 2, 1, "B1L104N"}},
0261     {"intt5_6", {6, "A1", 2, 1, "B1L105N"}},
0262 
0263     {"intt5_7", {7, "C3", 3, 1, "B1L107N"}},
0264     {"intt5_8", {8, "B1", 3, 1, "B1L007N"}},
0265     {"intt5_9", {9, "C1", 3, 1, "B1L006N"}},
0266     {"intt5_10", {10, "D2", 3, 1, "B1L106N"}},
0267     {"intt5_11", {11, "A1", 3, 1, "B0L005N"}},
0268     {"intt5_12", {12, "C2", 3, 1, "B0L105N"}},
0269     {"intt5_13", {13, "D1", 3, 1, "B0L004N"}},
0270 
0271     {"intt6_0", {0, "A1", 4, 1, "B0L106N"}},  // note : intt 6
0272     {"intt6_1", {1, "C3", 4, 1, "B0L006N"}},
0273     {"intt6_2", {2, "B2", 4, 1, "B0L107N"}},
0274     {"intt6_3", {3, "D1", 4, 1, "B1L108N"}},
0275     {"intt6_4", {4, "C2", 4, 1, "B1L008N"}},
0276     {"intt6_5", {5, "B3", 4, 1, "B1L109N"}},
0277     {"intt6_6", {6, "A2", 4, 1, "B1L009N"}},
0278 
0279     {"intt6_7", {7, "D1", 5, 1, "B0L007N"}},
0280     {"intt6_8", {8, "C3", 5, 1, "B0L108N"}},
0281     {"intt6_9", {9, "A2", 5, 1, "B0L008N"}},
0282     {"intt6_10", {10, "D2", 5, 1, "B1L110N"}},
0283     {"intt6_11", {11, "C2", 5, 1, "B1L010N"}},
0284     {"intt6_12", {12, "B3", 5, 1, "B1L111N"}},
0285     {"intt6_13", {13, "A1", 5, 1, "B1L011N"}},
0286 
0287     {"intt7_0", {0, "B3", 6, 1, "B0L109N"}},  // note : intt 7
0288     {"intt7_1", {1, "C1", 6, 1, "B0L009N"}},
0289     {"intt7_2", {2, "B1", 6, 1, "B0L110N"}},
0290     {"intt7_3", {3, "D1", 6, 1, "B1L112N"}},
0291     {"intt7_4", {4, "C2", 6, 1, "B1L012N"}},
0292     {"intt7_5", {5, "B2", 6, 1, "B1L113N"}},
0293     {"intt7_6", {6, "A1", 6, 1, "B1L013N"}},
0294 
0295     {"intt7_7", {7, "B2", 7, 1, "B0L010N"}},
0296     {"intt7_8", {8, "C2", 7, 1, "B0L111N"}},
0297     {"intt7_9", {9, "B1", 7, 1, "B0L011N"}},
0298     {"intt7_10", {10, "D2", 7, 1, "B1L114N"}},
0299     {"intt7_11", {11, "C3", 7, 1, "B1L014N"}},
0300     {"intt7_12", {12, "B3", 7, 1, "B1L115N"}},
0301     {"intt7_13", {13, "A1", 7, 1, "B1L015N"}}};
0302 
0303 const std::map<int, std::string> layer_map = {
0304     {0, "B0L0"},
0305     {1, "B0L1"},
0306     {2, "B1L0"},
0307     {3, "B1L1"}};
0308 
0309 class TH2INTT : public TH2Poly
0310 {
0311  public:
0312   TH2INTT();
0313 
0314   void SetSerFCSContent(const std::string &server_FC, double content);
0315   double GetSerFCSContent(const std::string &server_FC);
0316   void SetSerFCIContent(int server_id, int FC_id, double content);  // note : int, server_id, FC_id
0317   double GetSerFCIContent(int server_id, int FC_id);                // note : int, server_id, FC_id
0318 
0319   void SetLadderSContent(const std::string &ladder_name, double content);
0320   double GetLadderSContent(const std::string &ladder_name);
0321   void SetLadderIContent(int barrel_id, int layer_id, int ladder_id, int side, double content);  // note : int, barrel_id, layer_id, ladder_id
0322   double GetLadderIContent(int barrel_id, int layer_id, int ladder_id, int side);                // note : int, barrel_id, layer_id, ladder_id
0323 
0324   void Draw(Option_t *option = "") override;
0325 
0326  private:
0327   std::vector<TLine *> ladder_line;
0328   void fill_ladder_line();
0329   void fill_ladder_pos_map();
0330   void fill_ladder_toinfo_map_bin();
0331 
0332   std::vector<double> px;
0333   std::vector<double> py;
0334 
0335   std::string index_word[16] = {"00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15"};
0336 
0337   // note : B0L0S, B0L1S, B1L0S, B1L1S
0338   // note : B0L0N, B0L1N, B1L0N, B1L1N
0339   std::map<std::string, std::vector<ladder_pos>> ladder_pos_map;
0340 
0341   double south_x_offset = -10;
0342   double north_x_offset = 10;
0343 
0344   double B0L0_12_r = 10.2798 / 2.;
0345   double B0L0_point1_initial = 81;
0346   double B0L0_point2_initial = 69;
0347 
0348   double B0L0_34_r = 9.9152 / 2.;
0349   double B0L0_point3_initial = 64;
0350   double B0L0_point4_initial = 86;
0351 
0352   double B0L1_12_r = 11.028 / 2.;
0353   double B0L1_point1_initial = 174 + 90;
0354   double B0L1_point2_initial = 186 + 90;
0355 
0356   double B0L1_34_r = 10.6569 / 2.;
0357   double B0L1_point3_initial = 190 + 90;
0358   double B0L1_point4_initial = 170 + 90;
0359 
0360   double B1L0_correction = 22.5 + 3.75;
0361   double B1L0_12_r = 13.6355 / 2.;
0362   double B1L0_point1_initial = 160 + 90 + B1L0_correction;
0363   double B1L0_point2_initial = 170 + 90 + B1L0_correction;
0364 
0365   double B1L0_34_r = 13.2395 / 2.;
0366   double B1L0_point3_initial = 173 + 90 + B1L0_correction;
0367   double B1L0_point4_initial = 157 + 90 + B1L0_correction;
0368 
0369   double B1L1_correction = 3.5;
0370   double B1L1_12_r = 14.4022 / 2.;
0371   double B1L1_point1_initial = 172 + 90 + B1L1_correction;
0372   double B1L1_point2_initial = 181 + 90 + B1L1_correction;
0373 
0374   double B1L1_34_r = 14.007 / 2.;
0375   double B1L1_point3_initial = 184 + 90 + B1L1_correction;
0376   double B1L1_point4_initial = 168 + 90 + B1L1_correction;
0377 };
0378 
0379 #endif