StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
TestShow.C
1 #include "calibFmsShow.C"
2 
3 void TestShow(bool PRINT = true)
4 {
5  //How to use prepared QA functions
6 
7  map<int, int> iToCh[4];
8  map<int, int> chToBS[4];
9  map<int, int> chToCellStat[4];
10  map<int, float> chToGainCorr[4];
11  map<int, float> chToGain[4];
12  map<int, st_pos> chToPos[4];
13  GetMapIndexToCh ("./FmsMapBase.txt", iToCh);
14  GetMapChToBS ("./FmsMapBitShift.txt", chToBS);
15  GetMapChToCellStat("./FmsCellStat.txt", chToCellStat);
16  GetMapChToGainCorr("./FmsGainCorr.txt", chToGainCorr);
17  GetMapChToGain ("./FmsMapBase.txt", chToGain);
18  GetMapChToPos ("./FmsMapBase.txt", chToPos);
19 
20  //Mark channels of interest
21  vector<int> Marked[4];
22  Marked[0].push_back(22);
23  Marked[0].push_back(45);
24  Marked[2].push_back(46);
25  Marked[2].push_back(52);
26  Marked[3].push_back(11);
27 
28  //Draw ADC QA
29  //-------------------------------------------
30 
31  #if 0
32  //Prepare each cell's info
33  map<int, string> cellInfo[4];
34  for (unsigned int a=0; a<4; a++)
35  for (unsigned int b=0; b<iToCh[a].size(); b++)
36  {
37  const int ch = iToCh[a][b];
38  const int bs = chToBS[a][ch];
39  string tempInfo = Form("d%i_ch%i, BS=%i", a+8, ch, bs);
40  cellInfo[a].insert(pair<int, string>(ch, tempInfo));
41  }
42 
43  //Prepare marked channels list
44  vector<int> MarkedBad[4];
45  for (unsigned int a=0; a<4; a++)
46  for (unsigned int b=0; b<iToCh[a].size(); b++)
47  {
48  const int ch = iToCh[a][b];
49  const int cs = chToCellStat[a][ch];
50  if (cs == BAD) MarkedBad[a].push_back(ch);
51  }
52 
53  //Prepare mass distributions: will be drawn on top of ADCs as a crosscheck
54  const char* inFile = "/star/u/ckimstar/work/fms_calib/RUN15pptrans_final/xChecks/fmsCalib_day8081.root";
55  TFile* F = TFile::Open(inFile);
56  TH2F* H2_mass[4];
57  for (int a=0; a<4; a++) H2_mass[a] = (TH2F*)F->Get(Form("mass_d%i_fine", a+8));
58 
59  //List of ROOT files contain ADC vs. ch histograms
60  const char* inList = "./inListQa_day8081.txt";
61 
62  //DrawAdcQa(iToCh, inList, PRINT, cellInfo);
63  //DrawAdcQa(iToCh, inList, PRINT, cellInfo, chToBS, chToGain, chToGainCorr);
64  //DrawAdcQa(iToCh, inList, PRINT, cellInfo, chToBS, chToGain, chToGainCorr, MarkedBad);
65  //DrawAdcQa(iToCh, inList, PRINT, cellInfo, chToBS, chToGain, chToGainCorr, DumVecI, H2_mass);
66  #endif
67 
68  //Draw 2D map
69  //-------------------------------------------
70 
71  #if 0
72  bool smallOnly = false;
73  bool showEta = true;
74  DrawMap(iToCh, chToPos, "Test1");
75  DrawMap(iToCh, chToPos, "Test2", smallOnly, showEta, PRINT, DumMapF, chToCellStat, Marked);
76  DrawMap(iToCh, chToPos, "Test3", smallOnly, showEta, PRINT, chToGainCorr, DumMapI, Marked);
77  DrawMap(iToCh, chToPos, "Test4", smallOnly, showEta, PRINT, chToGainCorr, chToCellStat, DumVecI);
78  DrawMap(iToCh, chToPos, "TestA", smallOnly, showEta, PRINT, chToGainCorr, chToCellStat, Marked);
79  #endif
80 
81  //Draw gainCorr comparison
82  //-------------------------------------------
83 
84  #if 0
85  map<int, int> chToCS[2][4];
86  map<int, float> chToGC[2][4];
87  const char* inPath = "/star/u/ckimstar/work/fms_calib/RUN15pptrans_final";
88  GetMapChToCellStat(Form("%s/cellStat/FmsCellStat_day7779.txt", inPath), chToCS[0]);
89  GetMapChToCellStat(Form("%s/cellStat/FmsCellStat_day8081.txt", inPath), chToCS[1]);
90  GetMapChToGainCorr(Form("%s/gainCorr/FmsGainCorr_day7779_fin.txt", inPath), chToGC[0]);
91  GetMapChToGainCorr(Form("%s/gainCorr/FmsGainCorr_day8081_fin.txt", inPath), chToGC[1]);
92 
93  bool excBadDead = true;
94  bool convOnly = true;
95  DrawCompGainCorr(iToCh, chToCS, chToGC, "Sample1", "Sample2", PRINT, excBadDead, convOnly);
96  #endif
97 
98  //Draw comparison of mass
99  //-------------------------------------------
100 
101  #if 0
102  const int nComp = 9;
103  TFile* F[nComp];
104  TH2F* H2_mass[nComp][4];
105 
106  //Retrieve target TH2
107  for (int i=0; i<nComp; i++)
108  {
109  const char* inPath = "/gpfs01/star/subsysg/FPS/ckimstar/out_iterations/Iterations_day8081_0820";
110  F[i] = TFile::Open(Form("%s/fmsCalib_%i.root", inPath, i));
111  for (int a=0; a<4; a++)
112  {
113  H2_mass[i][a] = (TH2F*)F[i]->Get(Form("mass_d%i_fine", a+8));
114  H2_mass[i][a]->SetTitle(Form("Test_%i", i)); //Will be used as legend title
115  }
116  }
117 
118  //Additional info will be shown in cell by cell title
119  map<int, string> cellInfo[4];
120  for (unsigned int a=0; a<4; a++)
121  for (unsigned int b=0; b<iToCh[a].size(); b++)
122  {
123  const int ch = iToCh[a][b];
124  const int bitShift = chToBS[a][ch];
125  const int cellStat = chToCellStat[a][ch];
126  const float gainCorr = chToGainCorr[a][ch];
127  string tempInfo = Form("d%i_ch%i, BS=%i, STAT=%i, GC=%4.3f", a+8, ch, bitShift, cellStat, gainCorr);
128  cellInfo[a].insert(pair<int, string>(ch, tempInfo));
129  }
130 
131  //Draw separately, channel by channel: run in batch mode if you don't use marked cells list
132  //DrawCompMassSep(iToCh, nComp, H2_mass, false, true, cellInfo, Marked);
133  //DrawCompMassSep(iToCh, nComp, H2_mass, false, false, cellInfo);
134  #endif
135 
136  //Draw progress of convergence over iterations
137  //--------------------------------------------
138 
139  #if 0
140  const int nIter = 9;
141  const char* inPath = "/gpfs01/star/subsysg/FPS/ckimstar/out_iterations/Iterations_day8081_0820";
142  bool excBadDead = true;
143 
144  //DrawConvProgress(nIter, inPath, iToCh);
145  //DrawConvProgress(nIter, inPath, iToCh, excBadDead, PRINT);
146  #endif
147 
148  //Draw mass distribution vs. iteration index
149  //-------------------------------------------
150 
151  #if 0
152  //This function designed seriously inefficient way due to ROOT enforces STUPID interactive session
153  //If you're not using marked cells list, I STRONGLY RECOMMEND EXECUTE IN BATCH MODE for your mental health
154 
155  const int nIter = 9;
156  const char* inPath = "/gpfs01/star/subsysg/FPS/ckimstar/out_iterations/Iterations_day8081_0820";
157  map<int, int> chToCSIter[4];
158  GetMapChToCellStat(Form("%s/FmsCellStat_fin.txt", inPath), chToCSIter);
159 
160  //DrawIterMass(nIter, inPath, iToCh, chToCSIter, PRINT);
161  //DrawIterMass(nIter, inPath, iToCh, chToCSIter, PRINT, Marked);
162  #endif
163 
164  //Print all channel by channel mass distribution in an iteration index: use batch mode
165  //------------------------------------------------------------------------------------
166 
167  #if 0
168  const int iIter = 0;
169  const char* inPath = "/gpfs01/star/subsysg/FPS/ckimstar/out_iterations/Iterations_day8081_0820";
170 
171  //DrawIterMassSingle(iIter, inPath);
172  //DrawIterMassSingle(iIter, inPath, Marked, "iterMassSingle");
173  #endif
174 
175  //Draw calibration related parameters vs. iteration index
176  //-------------------------------------------------------
177 
178  #if 0
179  const int nIter = 9;
180  const char* inPath = "/gpfs01/star/subsysg/FPS/ckimstar/out_iterations/Iterations_day8081_0820";
181 
182  //DrawIterPars(nIter, inPath, iToCh, chToCellStat, true);
183  //DrawIterPars(nIter, inPath, iToCh, chToCellStat, false, Marked);
184  #endif
185 
186  return;
187 }//Main