|
|
|||
Warning, file /epic-lfhcal-tbana/NewStructure/PlotHelper_1MLayer.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef PLOTTHELPER_1MLAYER_H 0002 #define PLOTTHELPER_1MLAYER_H 0003 0004 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 0005 // dedicated class for all 8M layer plotting functions 0006 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 0007 0008 // //__________________________________________________________________________________________________________ 0009 // // Plot Trigger Primitive with Fits for Full layer 0010 // //__________________________________________________________________________________________________________ 0011 // void PlotTriggerPrimWithFits8MLayer (TCanvas* canvas2Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, 0012 // Double_t* relSizeP, Int_t textSizePixel, 0013 // std::map<int,TileSpectra> spectra, Setup* setupT, 0014 // double avMip, double facLow, double facHigh, 0015 // Double_t xPMin, Double_t xPMax, Double_t scaleYMax, 0016 // int layer, int mod, TString nameOutput, RunInfo currRunInfo){ 0017 // 0018 // Double_t maxY = 0; 0019 // std::map<int, TileSpectra>::iterator ithSpectra; 0020 // std::map<int, TileSpectra>::iterator ithSpectraTrigg; 0021 // 0022 // int nRow = setupT->GetNMaxRow()+1; 0023 // int nCol = setupT->GetNMaxColumn()+1; 0024 // int skipped = 0; 0025 // for (int r = 0; r < nRow; r++){ 0026 // for (int c = 0; c < nCol; c++){ 0027 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0028 // ithSpectra=spectra.find(tempCellID); 0029 // if(ithSpectra==spectra.end()){ 0030 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0031 // continue; 0032 // } 0033 // TH1D* tempHist = ithSpectra->second.GetTriggPrim(); 0034 // if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax); 0035 // } 0036 // } 0037 // 0038 // for (int r = 0; r < nRow; r++){ 0039 // for (int c = 0; c < nCol; c++){ 0040 // canvas2Panel->cd(); 0041 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0042 // int p = setupT->GetChannelInLayer(tempCellID); 0043 // pads[p]->Draw(); 0044 // pads[p]->cd(); 0045 // pads[p]->SetLogy(); 0046 // ithSpectra=spectra.find(tempCellID); 0047 // if(ithSpectra==spectra.end()){ 0048 // skipped++; 0049 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0050 // pads[p]->Clear(); 0051 // pads[p]->Draw(); 0052 // if (p ==7 ){ 0053 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-2.*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP[p], 42); 0054 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-3.*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP[p], 42); 0055 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4.*relSizeP[p], "Trigger primitives", true, 0.85*relSizeP[p], 42); 0056 // } 0057 // continue; 0058 // } 0059 // TH1D* tempHist = ithSpectra->second.GetTriggPrim(); 0060 // SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63); 0061 // SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE); 0062 // tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax); 0063 // tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY); 0064 // 0065 // tempHist->Draw("pe"); 0066 // short bctemp = ithSpectra->second.GetCalib()->BadChannel; 0067 // if (bctemp != -64 && bctemp < 3){ 0068 // Color_t boxCol = kGray; 0069 // if (bctemp == 1) 0070 // boxCol = kGray+1; 0071 // else if (bctemp == 0) 0072 // boxCol = kGray+2; 0073 // TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 ); 0074 // badChannelArea->Draw(); 0075 // tempHist->Draw("same,axis"); 0076 // tempHist->Draw("same,pe"); 0077 // } 0078 // 0079 // TString label = Form("row %d col %d", r, c); 0080 // if (p == 7){ 0081 // label = Form("row %d col %d layer %d", r, c, layer); 0082 // } 0083 // TLatex *labelChannel = new TLatex(topRCornerX[p]-0.045,topRCornerY[p]-1.2*relSizeP[p],label); 0084 // SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31); 0085 // labelChannel->Draw(); 0086 // 0087 // TBox* triggArea = CreateBox(kBlue-8, avMip*facLow, 0.7, avMip*facHigh,scaleYMax*maxY, 1001 ); 0088 // triggArea->Draw(); 0089 // 0090 // DrawLines(avMip*facLow, avMip*facLow,0.7, scaleYMax*maxY, 1, 1, 7); 0091 // DrawLines(avMip*facHigh, avMip*facHigh,0.7, scaleYMax*maxY, 1, 1, 7); 0092 // tempHist->Draw("same,axis"); 0093 // tempHist->Draw("same,pe"); 0094 // 0095 // if (p ==7 ){ 0096 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-2.*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP[p], 42); 0097 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-3.*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP[p], 42); 0098 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4.*relSizeP[p], "Trigger primitives", true, 0.85*relSizeP[p], 42); 0099 // } 0100 // } 0101 // } 0102 // if (skipped < 6) 0103 // canvas2Panel->SaveAs(nameOutput.Data()); 0104 // } 0105 // 0106 //__________________________________________________________________________________________________________ 0107 // Plot Noise with Fits for Full layer 0108 //__________________________________________________________________________________________________________ 0109 void PlotNoiseWithFits1MLayer (TCanvas* canvas2Panel, Double_t topRCornerX, Double_t topRCornerY, Double_t relSizeP, Int_t textSizePixel, 0110 std::map<int,TileSpectra> spectra, Setup* setupT, bool isHG, 0111 Double_t xPMin, Double_t xPMax, Double_t scaleYMax, int layer, int mod, TString nameOutput, RunInfo currRunInfo){ 0112 0113 Double_t maxY = 0; 0114 std::map<int, TileSpectra>::iterator ithSpectra; 0115 0116 int skipped = 0; 0117 int tempCellID = setupT->GetCellID(0,0, layer, mod); 0118 ithSpectra=spectra.find(tempCellID); 0119 if(ithSpectra==spectra.end()){ 0120 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t layer " << layer << "\t module " << mod << std::endl; 0121 skipped++; 0122 return; 0123 } 0124 TH1D* tempHist = nullptr; 0125 if (isHG){ 0126 tempHist = ithSpectra->second.GetHG(); 0127 } else { 0128 tempHist = ithSpectra->second.GetLG(); 0129 } 0130 if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax); 0131 0132 canvas2Panel->cd(); 0133 canvas2Panel->SetLogy(); 0134 SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63); 0135 SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE); 0136 tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax); 0137 tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY); 0138 0139 tempHist->Draw("pe"); 0140 short bctemp = ithSpectra->second.GetCalib()->BadChannel; 0141 if (bctemp != -64 && bctemp < 3){ 0142 Color_t boxCol = kGray; 0143 if (bctemp == 1) 0144 boxCol = kGray+1; 0145 else if (bctemp == 0) 0146 boxCol = kGray+2; 0147 TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 ); 0148 badChannelArea->SetFillColorAlpha(boxCol, 0.35); 0149 badChannelArea->Draw(); 0150 tempHist->Draw("same,axis"); 0151 tempHist->Draw("same,pe"); 0152 } 0153 0154 TString label = Form("layer %d", layer); 0155 TLatex *labelChannel = new TLatex(topRCornerX-0.04,topRCornerY-1.2*relSizeP,label); 0156 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31); 0157 0158 0159 TF1* fit = nullptr; 0160 if (isHG){ 0161 fit = ithSpectra->second.GetBackModel(1); 0162 } else { 0163 fit = ithSpectra->second.GetBackModel(0); 0164 } 0165 if (fit){ 0166 SetStyleFit(fit , xPMin, xPMax, 7, 7, kBlack); 0167 fit->Draw("same"); 0168 TLegend* legend = GetAndSetLegend2( topRCornerX-8*relSizeP, topRCornerY-4*0.85*relSizeP-0.4*relSizeP, topRCornerX-0.04, topRCornerY-0.6*relSizeP,0.85*textSizePixel, 1, label, 43,0.2); 0169 legend->AddEntry(fit, "Gauss noise fit", "l"); 0170 legend->AddEntry((TObject*)0, Form("#mu = %2.2f #pm %2.2f",fit->GetParameter(1), fit->GetParError(1) ) , " "); 0171 legend->AddEntry((TObject*)0, Form("#sigma = %2.2f #pm %2.2f",fit->GetParameter(2), fit->GetParError(2) ) , " "); 0172 legend->Draw(); 0173 0174 } else { 0175 labelChannel->Draw(); 0176 } 0177 0178 if (xPMin < -5) DrawLines(0, 0,0.7, scaleYMax*maxY, 2, kGray+1, 10); 0179 DrawLatex(topRCornerX-0.04, topRCornerY-4*0.85*relSizeP-1.4*relSizeP, GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP, 42); 0180 DrawLatex(topRCornerX-0.04, topRCornerY-4*0.85*relSizeP-2.2*relSizeP, GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP, 42); 0181 canvas2Panel->SaveAs(nameOutput.Data()); 0182 } 0183 // 0184 // 0185 // //__________________________________________________________________________________________________________ 0186 // // Plot Noise extracted from collision data 0187 // //__________________________________________________________________________________________________________ 0188 // void PlotNoiseAdvWithFits8MLayer (TCanvas* canvas2Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSizeP, Int_t textSizePixel, 0189 // std::map<int,TileSpectra> spectra, std::map<int,TileSpectra> spectraTrigg, bool isHG, 0190 // Double_t xPMin, Double_t xPMax, Double_t scaleYMax, int layer, int mod, TString nameOutput, RunInfo currRunInfo){ 0191 // 0192 // Double_t maxY = 0; 0193 // std::map<int, TileSpectra>::iterator ithSpectra; 0194 // std::map<int, TileSpectra>::iterator ithSpectraTrigg; 0195 // 0196 // Setup* setupT = Setup::GetInstance(); 0197 // int nRow = setupT->GetNMaxRow()+1; 0198 // int nCol = setupT->GetNMaxColumn()+1; 0199 // int skipped = 0; 0200 // for (int r = 0; r < nRow; r++){ 0201 // for (int c = 0; c < nCol; c++){ 0202 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0203 // ithSpectra=spectra.find(tempCellID); 0204 // if(ithSpectra==spectra.end()){ 0205 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0206 // continue; 0207 // } 0208 // TH1D* tempHist = nullptr; 0209 // if (isHG){ 0210 // tempHist = ithSpectra->second.GetHG(); 0211 // } else { 0212 // tempHist = ithSpectra->second.GetLG(); 0213 // } 0214 // if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax); 0215 // } 0216 // } 0217 // for (int r = 0; r < nRow; r++){ 0218 // for (int c = 0; c < nCol; c++){ 0219 // canvas2Panel->cd(); 0220 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0221 // int p = setupT->GetChannelInLayer(tempCellID); 0222 // pads[p]->Draw(); 0223 // pads[p]->cd(); 0224 // pads[p]->SetLogy(); 0225 // ithSpectra=spectra.find(tempCellID); 0226 // if(ithSpectra==spectra.end()){ 0227 // skipped++; 0228 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0229 // pads[p]->Clear(); 0230 // pads[p]->Draw(); 0231 // if (p ==7 ){ 0232 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-1.4*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP[p], 42); 0233 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-2.2*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP[p], 42); 0234 // } 0235 // continue; 0236 // } 0237 // ithSpectraTrigg=spectraTrigg.find(tempCellID); 0238 // TH1D* tempHist = nullptr; 0239 // if (isHG){ 0240 // tempHist = ithSpectra->second.GetHG(); 0241 // } else { 0242 // tempHist = ithSpectra->second.GetLG(); 0243 // } 0244 // SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63); 0245 // SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE); 0246 // tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax); 0247 // tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY); 0248 // 0249 // tempHist->Draw("pe"); 0250 // short bctemp = ithSpectra->second.GetCalib()->BadChannel; 0251 // if (bctemp != -64 && bctemp < 3){ 0252 // Color_t boxCol = kGray; 0253 // if (bctemp == 1) 0254 // boxCol = kGray+1; 0255 // else if (bctemp == 0) 0256 // boxCol = kGray+2; 0257 // TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 ); 0258 // badChannelArea->Draw(); 0259 // tempHist->Draw("same,axis"); 0260 // tempHist->Draw("same,pe"); 0261 // } 0262 // 0263 // TH1D* tempHistT = nullptr; 0264 // if (isHG){ 0265 // tempHistT = ithSpectraTrigg->second.GetHG(); 0266 // } else { 0267 // tempHistT = ithSpectraTrigg->second.GetLG(); 0268 // } 0269 // SetMarkerDefaults(tempHistT, 24, 1, kRed+1, kRed+1, kFALSE); 0270 // tempHistT->Draw("same,pe"); 0271 // 0272 // TString label = Form("row %d col %d", r, c); 0273 // if (p == 7){ 0274 // label = Form("row %d col %d layer %d", r, c, layer); 0275 // } 0276 // TLatex *labelChannel = new TLatex(topRCornerX[p]-0.045,topRCornerY[p]-1.2*relSizeP[p],label); 0277 // SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31); 0278 // 0279 // 0280 // TF1* fit = nullptr; 0281 // bool isTrigFit = false; 0282 // if (isHG){ 0283 // fit = ithSpectraTrigg->second.GetBackModel(1); 0284 // if (!fit){ 0285 // fit = ithSpectra->second.GetBackModel(1); 0286 // 0287 // } else { 0288 // isTrigFit = true; 0289 // } 0290 // } else { 0291 // fit = ithSpectraTrigg->second.GetBackModel(0); 0292 // if (!fit){ 0293 // fit = ithSpectra->second.GetBackModel(0); 0294 // } else { 0295 // isTrigFit = true; 0296 // } 0297 // } 0298 // if (fit){ 0299 // if (isTrigFit) 0300 // SetStyleFit(fit , 0, 2000, 7, 3, kRed+3); 0301 // else 0302 // SetStyleFit(fit , 0, 2000, 7, 7, kBlue+3); 0303 // fit->Draw("same"); 0304 // TLegend* legend = GetAndSetLegend2( topRCornerX[p]-10*relSizeP[p], topRCornerY[p]-4*0.85*relSizeP[p]-0.4*relSizeP[p], topRCornerX[p]-0.04, topRCornerY[p]-0.6*relSizeP[p],0.85*textSizePixel, 1, label, 43,0.1); 0305 // if (isTrigFit) 0306 // legend->AddEntry(fit, "Gauss noise fit, trigg.", "l"); 0307 // else 0308 // legend->AddEntry(fit, "Gauss noise fit", "l"); 0309 // legend->AddEntry((TObject*)0, Form("#mu = %2.2f #pm %2.2f",fit->GetParameter(1), fit->GetParError(1) ) , " "); 0310 // legend->AddEntry((TObject*)0, Form("#sigma = %2.2f #pm %2.2f",fit->GetParameter(2), fit->GetParError(2) ) , " "); 0311 // legend->Draw(); 0312 // } else { 0313 // labelChannel->Draw(); 0314 // } 0315 // 0316 // DrawLines(0, 0,0.7, scaleYMax*maxY, 2, kGray+1, 10); 0317 // if (p ==7 ){ 0318 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-1.4*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP[p], 42); 0319 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-2.2*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP[p], 42); 0320 // } 0321 // 0322 // } 0323 // } 0324 // if (skipped < 6) 0325 // canvas2Panel->SaveAs(nameOutput.Data()); 0326 // } 0327 // 0328 // //__________________________________________________________________________________________________________ 0329 // // Plot Mip with Fits for Full layer 0330 // //__________________________________________________________________________________________________________ 0331 // void PlotMipWithFits8MLayer (TCanvas* canvas2Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSizeP, Int_t textSizePixel, 0332 // std::map<int,TileSpectra> spectra, std::map<int,TileSpectra> spectraTrigg, Setup* setupT, bool isHG, 0333 // Double_t xPMin, Double_t xPMax, Double_t scaleYMax, int layer, int mod, TString nameOutput, RunInfo currRunInfo){ 0334 // 0335 // Double_t maxY = 0; 0336 // std::map<int, TileSpectra>::iterator ithSpectra; 0337 // std::map<int, TileSpectra>::iterator ithSpectraTrigg; 0338 // 0339 // int nRow = setupT->GetNMaxRow()+1; 0340 // int nCol = setupT->GetNMaxColumn()+1; 0341 // int skipped = 0; 0342 // for (int r = 0; r < nRow; r++){ 0343 // for (int c = 0; c < nCol; c++){ 0344 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0345 // ithSpectra=spectra.find(tempCellID); 0346 // if(ithSpectra==spectra.end()){ 0347 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0348 // continue; 0349 // } 0350 // TH1D* tempHist = nullptr; 0351 // if (isHG){ 0352 // tempHist = ithSpectra->second.GetHG(); 0353 // } else { 0354 // tempHist = ithSpectra->second.GetLG(); 0355 // } 0356 // if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax); 0357 // } 0358 // } 0359 // 0360 // for (int r = 0; r < nRow; r++){ 0361 // for (int c = 0; c < nCol; c++){ 0362 // canvas2Panel->cd(); 0363 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0364 // int p = setupT->GetChannelInLayer(tempCellID); 0365 // pads[p]->Draw(); 0366 // pads[p]->cd(); 0367 // pads[p]->SetLogy(); 0368 // ithSpectra=spectra.find(tempCellID); 0369 // if(ithSpectra==spectra.end()){ 0370 // skipped++; 0371 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0372 // pads[p]->Clear(); 0373 // pads[p]->Draw(); 0374 // if (p ==7 ){ 0375 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-1.4*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP[p], 42); 0376 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-2.2*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP[p], 42); 0377 // } 0378 // continue; 0379 // } 0380 // ithSpectraTrigg=spectraTrigg.find(tempCellID); 0381 // TH1D* tempHist = nullptr; 0382 // double noiseWidth = 0; 0383 // if (isHG){ 0384 // tempHist = ithSpectra->second.GetHG(); 0385 // noiseWidth = ithSpectra->second.GetCalib()->PedestalSigH; 0386 // } else { 0387 // tempHist = ithSpectra->second.GetLG(); 0388 // noiseWidth = ithSpectra->second.GetCalib()->PedestalSigL; 0389 // } 0390 // SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63); 0391 // SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE); 0392 // tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax); 0393 // tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY); 0394 // 0395 // tempHist->Draw("pe"); 0396 // short bctemp = ithSpectra->second.GetCalib()->BadChannel; 0397 // if (bctemp != -64 && bctemp < 3){ 0398 // Color_t boxCol = kGray; 0399 // if (bctemp == 1) 0400 // boxCol = kGray+1; 0401 // else if (bctemp == 0) 0402 // boxCol = kGray+2; 0403 // TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 ); 0404 // badChannelArea->Draw(); 0405 // tempHist->Draw("same,axis"); 0406 // tempHist->Draw("same,pe"); 0407 // } 0408 // 0409 // TH1D* tempHistT = nullptr; 0410 // 0411 // if (isHG){ 0412 // tempHistT = ithSpectraTrigg->second.GetHG(); 0413 // } else { 0414 // tempHistT = ithSpectraTrigg->second.GetLG(); 0415 // } 0416 // SetMarkerDefaults(tempHistT, 24, 1, kRed+1, kRed+1, kFALSE); 0417 // tempHistT->Draw("same,pe"); 0418 // 0419 // TString label = Form("row %d col %d", r, c); 0420 // if (p == 7){ 0421 // label = Form("row %d col %d layer %d", r, c, layer); 0422 // } 0423 // TLatex *labelChannel = new TLatex(topRCornerX[p]-0.045,topRCornerY[p]-1.2*relSizeP[p],label); 0424 // SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31); 0425 // 0426 // 0427 // TF1* fit = nullptr; 0428 // bool isTrigFit = false; 0429 // double maxFit = 0; 0430 // if (isHG){ 0431 // fit = ithSpectraTrigg->second.GetSignalModel(1); 0432 // if (!fit){ 0433 // fit = ithSpectra->second.GetSignalModel(1); 0434 // if (fit){ 0435 // maxFit = ithSpectra->second.GetCalib()->ScaleH; 0436 // } 0437 // } else { 0438 // isTrigFit = true; 0439 // maxFit = ithSpectraTrigg->second.GetCalib()->ScaleH; 0440 // } 0441 // } else { 0442 // fit = ithSpectraTrigg->second.GetSignalModel(0); 0443 // if (!fit){ 0444 // fit = ithSpectra->second.GetSignalModel(0); 0445 // if (fit){ 0446 // maxFit = ithSpectra->second.GetCalib()->ScaleL; 0447 // } 0448 // } else { 0449 // isTrigFit = true; 0450 // maxFit = ithSpectraTrigg->second.GetCalib()->ScaleL; 0451 // } 0452 // } 0453 // if (fit){ 0454 // if (isTrigFit) 0455 // SetStyleFit(fit , 0, 2000, 7, 3, kRed+3); 0456 // else 0457 // SetStyleFit(fit , 0, 2000, 7, 7, kBlue+3); 0458 // fit->Draw("same"); 0459 // TLegend* legend = GetAndSetLegend2( topRCornerX[p]-10*relSizeP[p], topRCornerY[p]-4*0.85*relSizeP[p]-0.4*relSizeP[p], topRCornerX[p]-0.04, topRCornerY[p]-0.6*relSizeP[p],0.85*textSizePixel, 1, label, 43,0.1); 0460 // if (isTrigFit) 0461 // legend->AddEntry(fit, "Landau-Gauss fit, trigg.", "l"); 0462 // else 0463 // legend->AddEntry(fit, "Landau-Gauss fit", "l"); 0464 // legend->AddEntry((TObject*)0, Form("#scale[0.8]{L MPV = %2.2f #pm %2.2f}",fit->GetParameter(1), fit->GetParError(1) ) , " "); 0465 // legend->AddEntry((TObject*)0, Form("#scale[0.8]{Max = %2.2f}", maxFit ) , " "); 0466 // legend->Draw(); 0467 // DrawLines(maxFit, maxFit,0.7, scaleYMax*maxY/10, 5, kRed+3, 7); 0468 // } else { 0469 // labelChannel->Draw(); 0470 // } 0471 // 0472 // DrawLines(noiseWidth*3, noiseWidth*3,0.7, scaleYMax*maxY, 2, kGray+1, 10); 0473 // DrawLines(noiseWidth*5, noiseWidth*5,0.7, scaleYMax*maxY, 2, kGray+1, 6); 0474 // 0475 // if (p ==7 ){ 0476 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-1.4*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP[p], 42); 0477 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-2.2*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP[p], 42); 0478 // } 0479 // } 0480 // } 0481 // if (skipped < 6) 0482 // canvas2Panel->SaveAs(nameOutput.Data()); 0483 // } 0484 // 0485 // //__________________________________________________________________________________________________________ 0486 // // Plot Spectra with Fits for Full layer 0487 // //__________________________________________________________________________________________________________ 0488 // void PlotSpectra8MLayer (TCanvas* canvas2Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSizeP, Int_t textSizePixel, 0489 // std::map<int,TileSpectra> spectra, int isHG, 0490 // Double_t xPMin, Double_t xPMax, Double_t scaleYMax, int layer, int mod, TString nameOutput, RunInfo currRunInfo){ 0491 // 0492 // Double_t maxY = 0; 0493 // std::map<int, TileSpectra>::iterator ithSpectra; 0494 // Setup* setupT = Setup::GetInstance(); 0495 // 0496 // int nRow = setupT->GetNMaxRow()+1; 0497 // int nCol = setupT->GetNMaxColumn()+1; 0498 // int skipped = 0; 0499 // for (int r = 0; r < nRow; r++){ 0500 // for (int c = 0; c < nCol; c++){ 0501 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0502 // ithSpectra=spectra.find(tempCellID); 0503 // if(ithSpectra==spectra.end()){ 0504 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0505 // continue; 0506 // } 0507 // TH1D* tempHist = nullptr; 0508 // if (isHG == 0){ 0509 // tempHist = ithSpectra->second.GetHG(); 0510 // } else if (isHG == 1){ 0511 // tempHist = ithSpectra->second.GetLG(); 0512 // } else { 0513 // tempHist = ithSpectra->second.GetComb(); 0514 // } 0515 // if (maxY < FindLargestBin1DHist(tempHist, xPMin , xPMax)) maxY = FindLargestBin1DHist(tempHist, xPMin , xPMax); 0516 // } 0517 // } 0518 // 0519 // for (int r = 0; r < nRow; r++){ 0520 // for (int c = 0; c < nCol; c++){ 0521 // canvas2Panel->cd(); 0522 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0523 // int p = setupT->GetChannelInLayer(tempCellID); 0524 // pads[p]->Draw(); 0525 // pads[p]->cd(); 0526 // pads[p]->SetLogy(); 0527 // ithSpectra=spectra.find(tempCellID); 0528 // if(ithSpectra==spectra.end()){ 0529 // skipped++; 0530 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0531 // pads[p]->Clear(); 0532 // pads[p]->Draw(); 0533 // if (p ==7 ){ 0534 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-1.4*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP[p], 42); 0535 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-2.2*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP[p], 42); 0536 // } 0537 // continue; 0538 // } 0539 // TH1D* tempHist = nullptr; 0540 // double noiseWidth = 0; 0541 // if (isHG == 0){ 0542 // tempHist = ithSpectra->second.GetHG(); 0543 // noiseWidth = ithSpectra->second.GetCalib()->PedestalSigH; 0544 // } else if (isHG == 1){ 0545 // tempHist = ithSpectra->second.GetLG(); 0546 // noiseWidth = ithSpectra->second.GetCalib()->PedestalSigL; 0547 // } else { 0548 // tempHist = ithSpectra->second.GetComb(); 0549 // } 0550 // SetStyleHistoTH1ForGraphs( tempHist, tempHist->GetXaxis()->GetTitle(), tempHist->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63); 0551 // SetMarkerDefaults(tempHist, 20, 1, kBlue+1, kBlue+1, kFALSE); 0552 // tempHist->GetXaxis()->SetRangeUser(xPMin,xPMax); 0553 // tempHist->GetYaxis()->SetRangeUser(0.7,scaleYMax*maxY); 0554 // 0555 // tempHist->Draw("pe"); 0556 // short bctemp = ithSpectra->second.GetCalib()->BadChannel; 0557 // if (bctemp != -64 && bctemp < 3){ 0558 // Color_t boxCol = kGray; 0559 // if (bctemp == 1) 0560 // boxCol = kGray+1; 0561 // else if (bctemp == 0) 0562 // boxCol = kGray+2; 0563 // TBox* badChannelArea = CreateBox(boxCol, xPMin, 0.7, xPMax,scaleYMax*maxY, 1001 ); 0564 // badChannelArea->Draw(); 0565 // tempHist->Draw("same,axis"); 0566 // tempHist->Draw("same,pe"); 0567 // } 0568 // 0569 // TString label = Form("row %d col %d", r, c); 0570 // if (p == 7){ 0571 // label = Form("row %d col %d layer %d", r, c, layer); 0572 // } 0573 // TLatex *labelChannel = new TLatex(topRCornerX[p]-0.045,topRCornerY[p]-1.2*relSizeP[p],label); 0574 // SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,31); 0575 // labelChannel->Draw(); 0576 // 0577 // if (isHG < 2){ 0578 // DrawLines(noiseWidth*3, noiseWidth*3,0.7, scaleYMax*maxY, 2, kGray+1, 10); 0579 // DrawLines(noiseWidth*5, noiseWidth*5,0.7, scaleYMax*maxY, 2, kGray+1, 6); 0580 // } else { 0581 // DrawLines(0.3, 0.3, 0.7, scaleYMax*maxY, 2, kGray+1, 10); 0582 // } 0583 // if (p ==7 ){ 0584 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-1.4*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), true, 0.85*relSizeP[p], 42); 0585 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-4*0.85*relSizeP[p]-2.2*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), true, 0.85*relSizeP[p], 42); 0586 // } 0587 // } 0588 // } 0589 // if (skipped < 6) 0590 // canvas2Panel->SaveAs(nameOutput.Data()); 0591 // } 0592 // 0593 // //__________________________________________________________________________________________________________ 0594 // // Plot Corr with Fits for Full layer 0595 // //__________________________________________________________________________________________________________ 0596 // void PlotCorrWithFits8MLayer (TCanvas* canvas2Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSizeP, Int_t textSizePixel, 0597 // std::map<int,TileSpectra> spectra, int option, 0598 // Double_t xPMin, Double_t xPMax, Double_t maxY, int layer, int mod, TString nameOutput, RunInfo currRunInfo){ 0599 // 0600 // Setup* setupT = Setup::GetInstance(); 0601 // 0602 // std::map<int, TileSpectra>::iterator ithSpectra; 0603 // int nRow = setupT->GetNMaxRow()+1; 0604 // int nCol = setupT->GetNMaxColumn()+1; 0605 // int skipped = 0; 0606 // 0607 // for (int r = 0; r < nRow; r++){ 0608 // for (int c = 0; c < nCol; c++){ 0609 // canvas2Panel->cd(); 0610 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0611 // int p = setupT->GetChannelInLayer(tempCellID); 0612 // pads[p]->Draw(); 0613 // pads[p]->SetLogy(0); 0614 // pads[p]->cd(); 0615 // 0616 // ithSpectra=spectra.find(tempCellID); 0617 // if(ithSpectra==spectra.end()){ 0618 // skipped++; 0619 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0620 // pads[p]->Clear(); 0621 // pads[p]->Draw(); 0622 // if (p ==7 ){ 0623 // DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSizeP[p]-1.4*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), false, 0.85*relSizeP[p], 42); 0624 // DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSizeP[p]-2.2*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), false, 0.85*relSizeP[p], 42); 0625 // } 0626 // continue; 0627 // } 0628 // TProfile* tempProfile = nullptr; 0629 // if (option == 1 || option == 2){ 0630 // tempProfile = ithSpectra->second.GetHGLGcorr(); 0631 // } else { 0632 // tempProfile = ithSpectra->second.GetLGHGcorr(); 0633 // } 0634 // if (!tempProfile) continue; 0635 // TH1D* dummyhist = new TH1D("dummyhist", "", tempProfile->GetNbinsX(), tempProfile->GetXaxis()->GetXmin(), tempProfile->GetXaxis()->GetXmax()); 0636 // SetStyleHistoTH1ForGraphs( dummyhist, tempProfile->GetXaxis()->GetTitle(), tempProfile->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.5, 510, 510, 43, 63); 0637 // 0638 // 0639 // // SetStyleTProfile( tempProfile, tempProfile->GetXaxis()->GetTitle(), tempProfile->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.1, 510, 510, 43, 63); 0640 // SetMarkerDefaultsProfile(tempProfile, 20, 1, kBlue+1, kBlue+1); 0641 // Int_t maxX = 3900; 0642 // if (option == 0 || option == 2 ) 0643 // maxX = 340; 0644 // if (option == 2){ 0645 // dummyhist->GetYaxis()->SetRangeUser(-maxY,maxY); 0646 // dummyhist->GetXaxis()->SetRangeUser(xPMin,maxX); 0647 // } else { 0648 // dummyhist->GetYaxis()->SetRangeUser(0,maxY); 0649 // dummyhist->GetXaxis()->SetRangeUser(0,maxX); 0650 // } 0651 // 0652 // 0653 // dummyhist->Draw("axis"); 0654 // 0655 // short bctemp = ithSpectra->second.GetCalib()->BadChannel; 0656 // if (bctemp != -64 && bctemp < 3){ 0657 // Color_t boxCol = kGray; 0658 // if (bctemp == 1) 0659 // boxCol = kGray+1; 0660 // else if (bctemp == 0) 0661 // boxCol = kGray+2; 0662 // TBox* badChannelArea = CreateBox(boxCol, 0, 0, maxX,maxY, 1001 ); 0663 // badChannelArea->Draw(); 0664 // dummyhist->Draw("axis,same"); 0665 // } 0666 // 0667 // tempProfile->Draw("pe, same"); 0668 // 0669 // TString label = Form("row %d col %d", r, c); 0670 // if (p == 7){ 0671 // label = Form("row %d col %d layer %d", r, c, layer); 0672 // } 0673 // TLatex *labelChannel = new TLatex(topRCornerX[p]+0.045,topRCornerY[p]-1.2*relSizeP[p],label); 0674 // SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,11); 0675 // 0676 // 0677 // TF1* fit = nullptr; 0678 // if (option == 1 ){ 0679 // fit = ithSpectra->second.GetCorrModel(1); 0680 // } else if (option == 0 ){ 0681 // fit = ithSpectra->second.GetCorrModel(0); 0682 // } 0683 // if (fit){ 0684 // Double_t rangeFit[2] = {0,0}; 0685 // fit->GetRange(rangeFit[0], rangeFit[1]); 0686 // SetStyleFit(fit , rangeFit[0], rangeFit[1], 7, 3, kRed+3); 0687 // fit->Draw("same"); 0688 // TLegend* legend = GetAndSetLegend2( topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSizeP[p]-0.4*relSizeP[p], topRCornerX[p]+6*relSizeP[p], topRCornerY[p]-0.6*relSizeP[p],0.85*textSizePixel, 1, label, 43,0.1); 0689 // legend->AddEntry(fit, "linear fit, trigg.", "l"); 0690 // legend->AddEntry((TObject*)0, Form("#scale[0.8]{b = %2.3f #pm %2.4f}",fit->GetParameter(0), fit->GetParError(0) ) , " "); 0691 // legend->AddEntry((TObject*)0, Form("#scale[0.8]{a = %2.3f #pm %2.4f}",fit->GetParameter(1), fit->GetParError(1) ) , " "); 0692 // legend->Draw(); 0693 // } else { 0694 // labelChannel->Draw(); 0695 // } 0696 // 0697 // if (option == 2){ 0698 // DrawLines(xPMin,maxX,0, 0, 2, kGray+1, 10); 0699 // } 0700 // if (p ==7 ){ 0701 // DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSizeP[p]-1.4*relSizeP[p], GetStringFromRunInfo(currRunInfo, 2), false, 0.85*relSizeP[p], 42); 0702 // DrawLatex(topRCornerX[p]+0.045, topRCornerY[p]-4*0.85*relSizeP[p]-2.2*relSizeP[p], GetStringFromRunInfo(currRunInfo, 3), false, 0.85*relSizeP[p], 42); 0703 // } 0704 // } 0705 // } 0706 // if (skipped < 6) 0707 // canvas2Panel->SaveAs(nameOutput.Data()); 0708 // } 0709 // 0710 //__________________________________________________________________________________________________________ 0711 // Plot Corr with Fits for Full layer 2D 0712 //__________________________________________________________________________________________________________ 0713 void PlotCorr2D1MLayer (TCanvas* canvas2Panel, Double_t topRCornerX, Double_t topRCornerY, Double_t relSizeP, Int_t textSizePixel, 0714 std::map<int,TileSpectra> spectra, 0715 Double_t xPMin, Double_t xPMax, Double_t maxY, int layer, int mod, TString nameOutput, RunInfo currRunInfo){ 0716 0717 Setup* setupT = Setup::GetInstance(); 0718 0719 std::map<int, TileSpectra>::iterator ithSpectra; 0720 int skipped = 0; 0721 ReadOut::Type rotype = ReadOut::Type::Undef; 0722 0723 0724 canvas2Panel->cd(); 0725 int tempCellID = setupT->GetCellID(0,0, layer, mod); 0726 canvas2Panel->SetLogy(0); 0727 canvas2Panel->SetLogz(1); 0728 0729 Int_t offset = 1; 0730 0731 ithSpectra=spectra.find(tempCellID); 0732 if(ithSpectra==spectra.end()){ 0733 skipped++; 0734 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t layer " << layer << "\t module " << mod << std::endl; 0735 return; 0736 } else { 0737 rotype = ithSpectra->second.GetROType(); 0738 } 0739 TProfile* tempProfile = ithSpectra->second.GetLGHGcorr(); 0740 TH2D* temp2D = ithSpectra->second.GetCorr(); 0741 0742 SetStyleHistoTH2ForGraphs( temp2D, temp2D->GetXaxis()->GetTitle(), temp2D->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.5, 510, 510, 43, 63); 0743 SetMarkerDefaultsProfile(tempProfile, 24, 0.7, kRed+2, kRed+2); 0744 0745 std::cout << "min: " << xPMin << "\t" << xPMax << std::endl; 0746 temp2D->GetYaxis()->SetRangeUser(-10,maxY); 0747 temp2D->GetXaxis()->SetRangeUser(xPMin,xPMax); 0748 temp2D->Draw("col"); 0749 0750 short bctemp = ithSpectra->second.GetCalib()->BadChannel; 0751 if (bctemp != -64 && bctemp < 3){ 0752 Color_t boxCol = kGray; 0753 if (bctemp == 1) 0754 boxCol = kGray+1; 0755 else if (bctemp == 0) 0756 boxCol = kGray+2; 0757 TBox* badChannelArea = CreateBox(boxCol, 0, 0, xPMax,maxY, 1001 ); 0758 badChannelArea->Draw(); 0759 temp2D->Draw("axis,same"); 0760 } 0761 0762 TString xTit = temp2D->GetXaxis()->GetTitle(); 0763 if (xTit.Contains("ample") != 0){ 0764 tempProfile->Draw("pe, same"); 0765 } 0766 0767 TString label = Form("layer %d", layer); 0768 TLatex *labelChannel = new TLatex(topRCornerX,topRCornerY-1.2*relSizeP,label); 0769 SetStyleTLatex( labelChannel, 0.85*textSizePixel,4,1,43,kTRUE,11); 0770 0771 TF1* fit = ithSpectra->second.GetCorrModel(0); 0772 if (rotype == ReadOut::Type::Hgcroc) 0773 fit = ithSpectra->second.GetCorrModel(1); 0774 if (fit){ 0775 offset=4; 0776 Double_t rangeFit[2] = {0,0}; 0777 fit->GetRange(rangeFit[0], rangeFit[1]); 0778 SetStyleFit(fit , rangeFit[0], rangeFit[1], 7, 3, kRed+3); 0779 fit->Draw("same"); 0780 TLegend* legend = nullptr; 0781 if (rotype == ReadOut::Type::Caen){ 0782 legend = GetAndSetLegend2( topRCornerX, topRCornerY-4*0.85*relSizeP-0.4*relSizeP, topRCornerX+6*relSizeP, topRCornerY-0.6*relSizeP,0.85*textSizePixel, 1, label, 43,0.1); 0783 legend->AddEntry(fit, "linear fit, trigg.", "l"); 0784 legend->AddEntry((TObject*)0, Form("#scale[0.8]{b = %2.3f #pm %2.4f}",fit->GetParameter(0), fit->GetParError(0) ) , " "); 0785 legend->AddEntry((TObject*)0, Form("#scale[0.8]{a = %2.3f #pm %2.4f}",fit->GetParameter(1), fit->GetParError(1) ) , " "); 0786 } else { 0787 legend = GetAndSetLegend2( topRCornerX, topRCornerY-3*0.85*relSizeP-0.4*relSizeP, topRCornerX+6*relSizeP, topRCornerY-0.6*relSizeP,0.85*textSizePixel, 1, label, 43,0.1); 0788 legend->AddEntry(fit, "const fit", "l"); 0789 legend->AddEntry((TObject*)0, Form("#scale[0.8]{a = %2.3f #pm %2.4f}",fit->GetParameter(0), fit->GetParError(0) ) , " "); 0790 } 0791 legend->Draw(); 0792 } else { 0793 labelChannel->Draw(); 0794 } 0795 0796 DrawLatex(topRCornerX, topRCornerY-offset*0.85*relSizeP-1.4*relSizeP, GetStringFromRunInfo(currRunInfo, 2), false, 0.85*relSizeP, 42); 0797 DrawLatex(topRCornerX, topRCornerY-offset*0.85*relSizeP-2.2*relSizeP, GetStringFromRunInfo(currRunInfo, 3), false, 0.85*relSizeP, 42); 0798 canvas2Panel->SaveAs(nameOutput.Data()); 0799 } 0800 // 0801 // //__________________________________________________________________________________________________________ 0802 // // Plot Corr with Fits for Full layer 0803 // //__________________________________________________________________________________________________________ 0804 // void PlotTrending8MLayer (TCanvas* canvas2Panel, TPad* pads[8], Double_t* topRCornerX, Double_t* topRCornerY, Double_t* relSizeP, Int_t textSizePixel, 0805 // std::map<int,TileTrend> trending, int optionTrend, 0806 // Double_t xPMin, Double_t xPMax, int layer, int mod, TString nameOutput, TString nameOutputSummary, RunInfo currRunInfo, Int_t detailedPlot = 1){ 0807 // 0808 // Setup* setupT = Setup::GetInstance(); 0809 // 0810 // std::map<int, TileTrend>::iterator ithTrend; 0811 // int nRow = setupT->GetNMaxRow()+1; 0812 // int nCol = setupT->GetNMaxColumn()+1; 0813 // int skipped = 0; 0814 // bool isSameVoltage = true; 0815 // double commanVoltage = 0; 0816 // 0817 // Double_t minY = 9999; 0818 // Double_t maxY = 0.; 0819 // 0820 // for (int r = 0; r < nRow; r++){ 0821 // for (int c = 0; c < nCol; c++){ 0822 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0823 // ithTrend=trending.find(tempCellID); 0824 // if (optionTrend == 0){ 0825 // if(minY>ithTrend->second.GetMinHGped()) minY=ithTrend->second.GetMinHGped(); 0826 // if(maxY<ithTrend->second.GetMaxHGped()) maxY=ithTrend->second.GetMaxHGped(); 0827 // } else if (optionTrend == 1){ 0828 // if(minY>ithTrend->second.GetMinLGped()) minY=ithTrend->second.GetMinLGped(); 0829 // if(maxY<ithTrend->second.GetMaxLGped()) maxY=ithTrend->second.GetMaxLGped(); 0830 // } else if (optionTrend == 2){ 0831 // if(minY>ithTrend->second.GetMinHGscale()) minY=ithTrend->second.GetMinHGscale(); 0832 // if(maxY<ithTrend->second.GetMaxHGscale()) maxY=ithTrend->second.GetMaxHGscale(); 0833 // } else if (optionTrend == 3){ 0834 // if(minY>ithTrend->second.GetMinLGscale()) minY=ithTrend->second.GetMinLGscale(); 0835 // if(maxY<ithTrend->second.GetMaxLGscale()) maxY=ithTrend->second.GetMaxLGscale(); 0836 // } else if (optionTrend == 4){ 0837 // if(minY>ithTrend->second.GetMinLGHGcorr()) minY=ithTrend->second.GetMinLGHGcorr(); 0838 // if(maxY<ithTrend->second.GetMaxLGHGcorr()) maxY=ithTrend->second.GetMaxLGHGcorr(); 0839 // } else if (optionTrend == 5){ 0840 // if(minY>ithTrend->second.GetMinHGLGcorr()) minY=ithTrend->second.GetMinHGLGcorr(); 0841 // if(maxY<ithTrend->second.GetMaxHGLGcorr()) maxY=ithTrend->second.GetMaxHGLGcorr(); 0842 // } else if (optionTrend == 6){ 0843 // if(minY>ithTrend->second.GetMinTrigg()) minY=ithTrend->second.GetMinTrigg(); 0844 // if(maxY<ithTrend->second.GetMaxTrigg()) maxY=ithTrend->second.GetMaxTrigg(); 0845 // } else if (optionTrend == 7){ 0846 // if(minY>ithTrend->second.GetMinSBSignal()) minY=ithTrend->second.GetMinSBSignal(); 0847 // if(maxY<ithTrend->second.GetMaxSBSignal()) maxY=ithTrend->second.GetMaxSBSignal(); 0848 // } else if (optionTrend == 8){ 0849 // if(minY>ithTrend->second.GetMinSBNoise()) minY=ithTrend->second.GetMinSBNoise(); 0850 // if(maxY<ithTrend->second.GetMaxSBNoise()) maxY=ithTrend->second.GetMaxSBNoise(); 0851 // } else if (optionTrend == 9){ 0852 // if(minY>ithTrend->second.GetMinHGMPV()) minY=ithTrend->second.GetMinHGMPV(); 0853 // if(maxY<ithTrend->second.GetMaxHGMPV()) maxY=ithTrend->second.GetMaxHGMPV(); 0854 // } else if (optionTrend == 10){ 0855 // if(minY>ithTrend->second.GetMinLGMPV()) minY=ithTrend->second.GetMinLGMPV(); 0856 // if(maxY<ithTrend->second.GetMaxLGMPV()) maxY=ithTrend->second.GetMaxLGMPV(); 0857 // } else if (optionTrend == 11){ 0858 // if(minY>ithTrend->second.GetMinHGLSigma()) minY=ithTrend->second.GetMinHGLSigma(); 0859 // if(maxY<ithTrend->second.GetMaxHGLSigma()) maxY=ithTrend->second.GetMaxHGLSigma(); 0860 // } else if (optionTrend == 12){ 0861 // if(minY>ithTrend->second.GetMinLGLSigma()) minY=ithTrend->second.GetMinLGLSigma(); 0862 // if(maxY<ithTrend->second.GetMaxLGLSigma()) maxY=ithTrend->second.GetMaxLGLSigma(); 0863 // } else if (optionTrend == 13){ 0864 // if(minY>ithTrend->second.GetMinHGGSigma()) minY=ithTrend->second.GetMinHGGSigma(); 0865 // if(maxY<ithTrend->second.GetMaxHGGSigma()) maxY=ithTrend->second.GetMaxHGGSigma(); 0866 // } else if (optionTrend == 14){ 0867 // if(minY>ithTrend->second.GetMinLGGSigma()) minY=ithTrend->second.GetMinLGGSigma(); 0868 // if(maxY<ithTrend->second.GetMaxLGGSigma()) maxY=ithTrend->second.GetMaxLGGSigma(); 0869 // } else if (optionTrend == 15){ 0870 // if(minY>ithTrend->second.GetMinHGpedwidth()) minY=ithTrend->second.GetMinHGpedwidth(); 0871 // if(maxY<ithTrend->second.GetMaxHGpedwidth()) maxY=ithTrend->second.GetMaxHGpedwidth(); 0872 // } else if (optionTrend == 16){ 0873 // if(minY>ithTrend->second.GetMinLGpedwidth()) minY=ithTrend->second.GetMinLGpedwidth(); 0874 // if(maxY<ithTrend->second.GetMaxLGpedwidth()) maxY=ithTrend->second.GetMaxLGpedwidth(); 0875 // } else if (optionTrend == 17){ 0876 // if(minY>ithTrend->second.GetMinLGHGOffset()) minY=ithTrend->second.GetMinLGHGOffset(); 0877 // if(maxY<ithTrend->second.GetMaxLGHGOffset()) maxY=ithTrend->second.GetMaxLGHGOffset(); 0878 // } else if (optionTrend == 18){ 0879 // if(minY>ithTrend->second.GetMinHGLGOffset()) minY=ithTrend->second.GetMinHGLGOffset(); 0880 // if(maxY<ithTrend->second.GetMaxHGLGOffset()) maxY=ithTrend->second.GetMaxHGLGOffset(); 0881 // } 0882 // for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){ 0883 // if (r == 0 && c == 0){ 0884 // if (rc == 0){ 0885 // commanVoltage = ithTrend->second.GetVoltage(rc); 0886 // } else { 0887 // if (commanVoltage != ithTrend->second.GetVoltage(rc)) isSameVoltage = false; 0888 // } 0889 // } 0890 // } 0891 // } 0892 // } 0893 // if (minY == 9999 && maxY == 0.){ 0894 // std::cout <<"Something went wrong! No ranges set for layer " << layer << " \t trend plotting option: " << optionTrend << "\t ABORTING!" << std::endl; 0895 // return; 0896 // } 0897 // // prep for log scale 0898 // if (optionTrend == 6){ 0899 // if (minY ==0 ) minY = 1; 0900 // else minY = minY/5.; 0901 // maxY= maxY*5.; 0902 // } else if (optionTrend == 17 || optionTrend == 18 ){ 0903 // minY = 1.1*minY; 0904 // maxY = 2*maxY; 0905 // } else { 0906 // minY = 0.9*minY; 0907 // maxY = 1.1*maxY; 0908 // } 0909 // for (int r = 0; r < nRow; r++){ 0910 // for (int c = 0; c < nCol; c++){ 0911 // 0912 // canvas2Panel->cd(); 0913 // int tempCellID = setupT->GetCellID(r,c, layer, mod); 0914 // int p = setupT->GetChannelInLayer(tempCellID); 0915 // 0916 // TString label = Form("row %d col %d", r, c); 0917 // TString label2 = Form("Common V_{op} = %2.1f V", commanVoltage); 0918 // if (p == 7){ 0919 // label = Form("row %d col %d layer %d", r, c, layer); 0920 // } 0921 // 0922 // pads[p]->Draw(); 0923 // 0924 // if (optionTrend == 6){ 0925 // pads[p]->SetLogy(1); 0926 // } else { 0927 // pads[p]->SetLogy(0); 0928 // } 0929 // 0930 // pads[p]->cd(); 0931 // ithTrend=trending.find(tempCellID); 0932 // if(ithTrend==trending.end()){ 0933 // skipped++; 0934 // std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t row " << r << "\t column " << c << "\t layer " << layer << "\t module " << mod << std::endl; 0935 // pads[p]->Clear(); 0936 // pads[p]->Draw(); 0937 // if (p ==4 ){ 0938 // TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", GetStringFromRunInfo(currRunInfo, 9).Data()); 0939 // TString lab2 = GetStringFromRunInfo(currRunInfo, 8); 0940 // TString lab3 = GetStringFromRunInfo(currRunInfo, 10); 0941 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSizeP[p]-1*0.85*relSizeP[p], lab1, true, 0.85*textSizePixel, 43); 0942 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSizeP[p]-2*0.85*relSizeP[p], lab2, true, 0.85*textSizePixel, 43); 0943 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSizeP[p]-3*0.85*relSizeP[p], lab3, true, 0.85*textSizePixel, 43); 0944 // } 0945 // continue; 0946 // } 0947 // TGraphErrors* tempGraph = nullptr; 0948 // if (optionTrend == 0) tempGraph = ithTrend->second.GetHGped(); 0949 // else if (optionTrend == 1) tempGraph = ithTrend->second.GetLGped(); 0950 // else if (optionTrend == 2) tempGraph = ithTrend->second.GetHGScale(); 0951 // else if (optionTrend == 3) tempGraph = ithTrend->second.GetLGScale(); 0952 // else if (optionTrend == 4) tempGraph = ithTrend->second.GetLGHGcorr(); 0953 // else if (optionTrend == 5) tempGraph = ithTrend->second.GetHGLGcorr(); 0954 // else if (optionTrend == 6) tempGraph = ithTrend->second.GetTrigger(); 0955 // else if (optionTrend == 7) tempGraph = ithTrend->second.GetSBSignal(); 0956 // else if (optionTrend == 8) tempGraph = ithTrend->second.GetSBNoise(); 0957 // else if (optionTrend == 9) tempGraph = ithTrend->second.GetHGLMPV(); 0958 // else if (optionTrend == 10) tempGraph = ithTrend->second.GetLGLMPV(); 0959 // else if (optionTrend == 11) tempGraph = ithTrend->second.GetHGLSigma(); 0960 // else if (optionTrend == 12) tempGraph = ithTrend->second.GetLGLSigma(); 0961 // else if (optionTrend == 13) tempGraph = ithTrend->second.GetHGGSigma(); 0962 // else if (optionTrend == 14) tempGraph = ithTrend->second.GetLGGSigma(); 0963 // else if (optionTrend == 15) tempGraph = ithTrend->second.GetHGpedwidth(); 0964 // else if (optionTrend == 16) tempGraph = ithTrend->second.GetLGpedwidth(); 0965 // else if (optionTrend == 17) tempGraph = ithTrend->second.GetLGHGOff(); 0966 // else if (optionTrend == 18) tempGraph = ithTrend->second.GetHGLGOff(); 0967 // if (!tempGraph) continue; 0968 // TH1D* dummyhist = new TH1D("dummyhist", "", 100, xPMin, xPMax); 0969 // SetStyleHistoTH1ForGraphs( dummyhist, tempGraph->GetXaxis()->GetTitle(), tempGraph->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.5, 510, 510, 43, 63); 0970 // // if (optionTrend == 6)std::cout << "\t" << tempGraph->GetXaxis()->GetTitle() << "\t" << tempGraph->GetYaxis()->GetTitle() << std::endl; 0971 // SetMarkerDefaultsTGraphErr(tempGraph, 20, 1, kBlue+1, kBlue+1); 0972 // dummyhist->GetYaxis()->SetRangeUser(minY,maxY); 0973 // dummyhist->Draw("axis"); 0974 // tempGraph->Draw("pe, same"); 0975 // 0976 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSizeP[p], label, true, 0.85*textSizePixel, 43); 0977 // if (isSameVoltage && p == 7){ 0978 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSizeP[p]-1*0.85*relSizeP[p], label2, true, 0.85*textSizePixel, 43); 0979 // } 0980 // if (p ==4 ){ 0981 // TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", GetStringFromRunInfo(currRunInfo, 9).Data()); 0982 // TString lab2 = GetStringFromRunInfo(currRunInfo, 8); 0983 // TString lab3 = GetStringFromRunInfo(currRunInfo, 10); 0984 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSizeP[p]-1*0.85*relSizeP[p], lab1, true, 0.85*textSizePixel, 43); 0985 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSizeP[p]-2*0.85*relSizeP[p], lab2, true, 0.85*textSizePixel, 43); 0986 // DrawLatex(topRCornerX[p]-0.045, topRCornerY[p]-1.2*relSizeP[p]-3*0.85*relSizeP[p], lab3, true, 0.85*textSizePixel, 43); 0987 // } 0988 // } 0989 // } 0990 // if (skipped < 8){ 0991 // if(detailedPlot) canvas2Panel->SaveAs(nameOutput.Data()); 0992 // if (layer == 0) canvas2Panel->Print(Form("%s.pdf[",nameOutputSummary.Data())); 0993 // canvas2Panel->Print(Form("%s.pdf",nameOutputSummary.Data())); 0994 // if (layer == setupT->GetNMaxLayer()) canvas2Panel->Print(Form("%s.pdf]",nameOutputSummary.Data())); 0995 // } 0996 // } 0997 // 0998 // //__________________________________________________________________________________________________________ 0999 // // Plot Run overlay for all 8 tiles for all runs available 1000 // //__________________________________________________________________________________________________________ 1001 void PlotRunOverlay1MLayer (TCanvas* canvas2Panel, Double_t topRCornerX, Double_t topLCornerX, Double_t topRCornerY, Double_t relSizeP, Int_t textSizePixel, 1002 std::map<int,TileTrend> trending, int nruns, int optionTrend, 1003 Double_t xPMin, Double_t xPMax, int layer, int mod, TString nameOutput, TString nameOutputSummary, RunInfo currRunInfo, Int_t detailedPlot = 1, bool plotMean = false){ 1004 1005 Setup* setupT = Setup::GetInstance(); 1006 1007 std::map<int, TileTrend>::iterator ithTrend; 1008 int nCol = setupT->GetNMaxColumn()+1; 1009 int skipped = 0; 1010 1011 Double_t maxY = 0.; 1012 Double_t minY = 9999.; 1013 bool isSameVoltage = true; 1014 double commanVoltage = 0; 1015 int tempCellID = setupT->GetCellID(0,0, layer, mod); 1016 ithTrend=trending.find(tempCellID); 1017 if(ithTrend==trending.end()){ 1018 skipped++; 1019 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t layer " << layer << "\t module " << mod << std::endl; 1020 return; 1021 } 1022 if (optionTrend == 0){ // HG 1023 if(maxY<ithTrend->second.GetMaxHGSpec()) maxY=ithTrend->second.GetMaxHGSpec(); 1024 if(minY>ithTrend->second.GetMinHGSpec()) minY=ithTrend->second.GetMinHGSpec(); 1025 } else if (optionTrend == 1){ //LG 1026 if(maxY<ithTrend->second.GetMaxLGSpec()) maxY=ithTrend->second.GetMaxLGSpec(); 1027 if(minY>ithTrend->second.GetMinLGSpec()) minY=ithTrend->second.GetMinLGSpec(); 1028 } 1029 1030 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){ 1031 if (rc == 0){ 1032 commanVoltage = ithTrend->second.GetVoltage(rc); 1033 } else { 1034 if (commanVoltage != ithTrend->second.GetVoltage(rc)) isSameVoltage = false; 1035 } 1036 } 1037 1038 if (maxY == 0 && minY == 9999.){ 1039 std::cout <<"Something went wrong! No ranges set for layer " << layer << " \t trend plotting option: " << optionTrend << "\t ABORTING!" << std::endl; 1040 return; 1041 } 1042 maxY = 3*maxY; 1043 TH1D* histos[30]; 1044 1045 Int_t columns = 4; 1046 double lineBottom = (7+0.1); 1047 double scaleTextSize = 0.75; 1048 if (nruns < 5) lineBottom = (1+0.1); 1049 else if (nruns < 9) lineBottom = (2+0.1); 1050 else if (nruns < 13) lineBottom = (3+0.1); 1051 else if (nruns < 17) lineBottom = (4+0.1); 1052 else if (nruns < 21) lineBottom = (5+0.1); 1053 else if (nruns < 25) lineBottom = (6+0.1); 1054 1055 if (plotMean) { 1056 columns = 2; 1057 lineBottom = (7+0.1); 1058 if (nruns < 3) lineBottom = (1+0.1); 1059 else if (nruns < 5) lineBottom = (2+0.1); 1060 else if (nruns < 7) lineBottom = (3+0.1); 1061 else if (nruns < 9) lineBottom = (4+0.1); 1062 else if (nruns < 11) lineBottom = (5+0.1); 1063 else if (nruns < 13) lineBottom = (6+0.1); 1064 scaleTextSize = 0.65; 1065 } 1066 1067 double startLegY = topRCornerY-lineBottom*relSizeP; 1068 double endLegY = topRCornerY-relSizeP; 1069 1070 TLegend* legend = GetAndSetLegend2( 0.6, startLegY, topRCornerX, endLegY, 1071 scaleTextSize*textSizePixel, columns, "",43,0.25); 1072 1073 1074 canvas2Panel->cd(); 1075 canvas2Panel->SetLogy(1); 1076 1077 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){ 1078 int tmpRunNr = ithTrend->second.GetRunNr(rc); 1079 histos[rc] = nullptr; 1080 if (tmpRunNr != -1) { 1081 if (optionTrend == 0){ // HG 1082 histos[rc] = ithTrend->second.GetHGTriggRun(ithTrend->second.GetRunNr(rc)); 1083 } else if (optionTrend == 1){ // LG 1084 histos[rc] = ithTrend->second.GetLGTriggRun(ithTrend->second.GetRunNr(rc)); 1085 } 1086 } 1087 if (histos[rc]){ 1088 SetStyleHistoTH1ForGraphs( histos[rc], histos[rc]->GetXaxis()->GetTitle(), histos[rc]->GetYaxis()->GetTitle(), 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.95, 1.3, 510, 510, 43, 63); 1089 SetLineDefaults(histos[rc], GetColorLayer(rc), 2, GetLineStyleLayer(rc)); 1090 if(rc == 0){ 1091 histos[rc]->GetXaxis()->SetRangeUser(xPMin,xPMax); 1092 histos[rc]->GetYaxis()->SetRangeUser(minY,maxY); 1093 histos[rc]->Draw("hist"); 1094 } else { 1095 histos[rc]->Draw("same,hist"); 1096 } 1097 if (plotMean){ 1098 DrawLines(histos[rc]->GetMean(), histos[rc]->GetMean(),minY, 0.2*maxY, 4,GetColorLayer(rc) ,GetLineStyleLayer(rc)); 1099 std::cout << tmpRunNr << "\t" << histos[rc]->GetMean() << std::endl; 1100 legend->AddEntry(histos[rc],Form("%d (%.1f)",tmpRunNr,histos[rc]->GetMean() ),"l"); 1101 } else { 1102 legend->AddEntry(histos[rc],Form("%d",tmpRunNr),"l"); 1103 } 1104 } 1105 } 1106 if (histos[0]) histos[0]->Draw("axis,same"); 1107 1108 legend->Draw(); 1109 TString label = Form("layer %d", layer); 1110 TString label2 = Form("Common V_{op} = %2.1f V", commanVoltage); 1111 TString beamline = GetStringFromRunInfo(currRunInfo, 9).Data(); 1112 TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", beamline.Data()); 1113 // labeling inside the panels & legend drawing 1114 DrawLatex(topRCornerX, topRCornerY-(lineBottom+1.3)*relSizeP, label, true, 0.75*textSizePixel, 43); 1115 if (isSameVoltage ){ 1116 DrawLatex(topRCornerX, topRCornerY-(lineBottom+0.5)*relSizeP, label2, true, 0.75*textSizePixel, 43); 1117 } 1118 if (beamline.Contains("ORNL")) lab1 = beamline; 1119 TString lab2 = GetStringFromRunInfo(currRunInfo, 8); 1120 TString lab3 = GetStringFromRunInfo(currRunInfo, 10); 1121 DrawLatex(topLCornerX, topRCornerY-relSizeP-1*0.75*relSizeP, lab1, false, 0.85*textSizePixel, 43); 1122 DrawLatex(topLCornerX, topRCornerY-relSizeP-2*0.75*relSizeP, lab2, false, 0.85*textSizePixel, 43); 1123 DrawLatex(topLCornerX, topRCornerY-relSizeP-3*0.75*relSizeP, lab3, false, 0.85*textSizePixel, 43); 1124 if(detailedPlot) canvas2Panel->SaveAs(nameOutput.Data()); 1125 if (layer == 0) canvas2Panel->Print(Form("%s.pdf[",nameOutputSummary.Data())); 1126 canvas2Panel->Print(Form("%s.pdf",nameOutputSummary.Data())); 1127 if (layer == setupT->GetNMaxLayer()) canvas2Panel->Print(Form("%s.pdf]",nameOutputSummary.Data())); 1128 } 1129 1130 //__________________________________________________________________________________________________________ 1131 // Plot Run overlay for all 8 tiles for all runs available 1132 //__________________________________________________________________________________________________________ 1133 void PlotRunOverlayProfile1MLayer (TCanvas* canvas2Panel, Double_t topRCornerX, Double_t topLCornerX, Double_t topRCornerY, Double_t relSizeP, Int_t textSizePixel, 1134 std::map<int,TileTrend> trending, int nruns, 1135 Double_t xPMin, Double_t xPMax, Double_t yPMin, Double_t yPMax, int layer, int mod, TString nameOutput, TString nameOutputSummary, RunInfo currRunInfo, Int_t detailedPlot = 1, bool scaleInt = false ){ 1136 1137 Setup* setupT = Setup::GetInstance(); 1138 1139 std::map<int, TileTrend>::iterator ithTrend; 1140 int nRow = setupT->GetNMaxRow()+1; 1141 int nCol = setupT->GetNMaxColumn()+1; 1142 int skipped = 0; 1143 1144 bool isSameVoltage = true; 1145 double commanVoltage = 0; 1146 1147 int tempCellID = setupT->GetCellID(0,0, layer, mod); 1148 ithTrend=trending.find(tempCellID); 1149 if(ithTrend==trending.end()){ 1150 std::cout << "WARNING: skipping cell ID: " << tempCellID << "\t layer " << layer << "\t module " << mod << std::endl; 1151 return; 1152 } 1153 1154 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){ 1155 if (rc == 0){ 1156 commanVoltage = ithTrend->second.GetVoltage(rc); 1157 } else { 1158 if (commanVoltage != ithTrend->second.GetVoltage(rc)) isSameVoltage = false; 1159 } 1160 } 1161 TProfile* profs[30]; 1162 1163 double lineBottom = (7); 1164 if (nruns < 5) lineBottom = (1); 1165 else if (nruns < 9) lineBottom = (2); 1166 else if (nruns < 13) lineBottom = (3); 1167 else if (nruns < 17) lineBottom = (4); 1168 else if (nruns < 21) lineBottom = (5); 1169 else if (nruns < 25) lineBottom = (6); 1170 1171 canvas2Panel->cd(); 1172 canvas2Panel->SetLogy(0); 1173 ithTrend=trending.find(tempCellID); 1174 1175 TString label = Form("layer %d", layer); 1176 TString label2 = Form("Common V_{op} = %2.1f V", commanVoltage); 1177 1178 Double_t yPosStart = topRCornerY; 1179 double startLegY = yPosStart -lineBottom*relSizeP; 1180 double endLegY = yPosStart; 1181 TLegend* legend = GetAndSetLegend2( topRCornerX, startLegY, 0.55, endLegY, 1182 0.75*textSizePixel, 4, "",43,0.25); 1183 TH1D* dummyhist; 1184 for (int rc = 0; rc < ithTrend->second.GetNRuns() && rc < 30; rc++ ){ 1185 int tmpRunNr = ithTrend->second.GetRunNr(rc); 1186 profs[rc] = nullptr; 1187 if (tmpRunNr != -1) { 1188 profs[rc] = ithTrend->second.GetLGHGTriggRun(ithTrend->second.GetRunNr(rc)); 1189 if (scaleInt) profs[rc]->Scale(1/profs[rc]->Integral()); 1190 std::cout << profs[rc] << std::endl; 1191 } 1192 if (profs[rc]){ 1193 if (rc == 0){ 1194 TString yTitle = profs[rc]->GetYaxis()->GetTitle(); 1195 if (scaleInt) yTitle = Form("%s/ integral", yTitle.Data()); 1196 dummyhist = new TH1D("dummyhist", "", profs[rc]->GetNbinsX(), profs[rc]->GetXaxis()->GetXmin(), profs[rc]->GetXaxis()->GetXmax()); 1197 SetStyleHistoTH1ForGraphs( dummyhist, profs[rc]->GetXaxis()->GetTitle(), yTitle, 0.85*textSizePixel, textSizePixel, 0.85*textSizePixel, textSizePixel,0.9, 1.5, 510, 510, 43, 63); 1198 dummyhist->GetXaxis()->SetRangeUser(xPMin,xPMax); 1199 dummyhist->GetYaxis()->SetRangeUser(yPMin,yPMax); 1200 dummyhist->Draw("axis"); 1201 } 1202 1203 SetLineDefaults(profs[rc], GetColorLayer(rc), 2, GetLineStyleLayer(rc)); 1204 profs[rc]->SetMarkerStyle(24); 1205 if (rc < 10) 1206 profs[rc]->SetMarkerStyle(24); 1207 else 1208 profs[rc]->SetMarkerStyle(25); 1209 profs[rc]->Draw("same,pe"); 1210 legend->AddEntry(profs[rc],Form("%d",tmpRunNr),"p"); 1211 } 1212 } 1213 if (dummyhist) dummyhist->Draw("axis,same"); 1214 1215 // labeling inside the panels & legend drawing 1216 if (isSameVoltage){ 1217 DrawLatex(topRCornerX, yPosStart-(lineBottom+0.5)*relSizeP, label2, false, 0.75*textSizePixel, 43); 1218 } 1219 1220 legend->Draw(); 1221 TString beamline = GetStringFromRunInfo(currRunInfo, 9).Data(); 1222 TString lab1 = Form("#it{#bf{LFHCal TB:}} %s", beamline.Data()); 1223 if (beamline.Contains("ORNL")) 1224 lab1 = beamline; 1225 TString lab2 = GetStringFromRunInfo(currRunInfo, 8); 1226 TString lab3 = GetStringFromRunInfo(currRunInfo, 10); 1227 DrawLatex(topLCornerX, yPosStart-1*0.75*relSizeP, lab1, true, 0.75*textSizePixel, 43); 1228 DrawLatex(topLCornerX, yPosStart-2*0.75*relSizeP, lab2, true, 0.75*textSizePixel, 43); 1229 DrawLatex(topLCornerX, yPosStart-3*0.75*relSizeP, lab3, true, 0.75*textSizePixel, 43); 1230 DrawLatex(topLCornerX, yPosStart-4*0.75*relSizeP, label, true, 0.75*textSizePixel, 43); 1231 1232 if(detailedPlot) canvas2Panel->SaveAs(nameOutput.Data()); 1233 if (layer == 0) canvas2Panel->Print(Form("%s.pdf[",nameOutputSummary.Data())); 1234 canvas2Panel->Print(Form("%s.pdf",nameOutputSummary.Data())); 1235 if (layer == setupT->GetNMaxLayer()) canvas2Panel->Print(Form("%s.pdf]",nameOutputSummary.Data())); 1236 } 1237 1238 #endif 1239
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|