00001 #include "BEMCPlotsPresenter.h"
00002 #include <iostream>
00003 using namespace std;
00004 #include <TH1F.h>
00005 #include <TH2F.h>
00006 #include <TCanvas.h>
00007 #include <TLine.h>
00008 #include <TArrow.h>
00009 #include <TLatex.h>
00010 #include <TString.h>
00011 #include <TBox.h>
00012 #include <TEnv.h>
00013 #include <TObjArray.h>
00014
00015 #include <StMessMgr.h>
00016 #include <GenericFile.h>
00017
00018 #include <StEmcUtil/database/StEmcDecoder.h>
00019
00020 #include "BEMCPlotsNames.h"
00021 #include "StRoot/StEmcPool/StBEMCPlots/BemcTwMask.h"
00022
00023 #define min(A, B) (((A) < (B)) ? (A) : (B))
00024 #define max(A, B) (((A) > (B)) ? (A) : (B))
00025
00026 TObjArray *BEMCPlotsCleanUp = new TObjArray();
00027 StEmcDecoder *BEMCDecoderPresenter = 0;
00028 Bool_t useDecoderForBoundaries = false;
00029
00030
00031 TH1 *GetHisto(FileType &fd, const char *name) {
00032 TH1 *hist = 0;
00033 hist = fd.file() ? (TH1 *)fd.Get(name, 0) : 0;
00034 if (hist) {
00035 hist->SetDirectory(0);
00036 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(hist);
00037 }
00038 return hist;
00039 }
00040
00041 #define FIND_HISTO(TYPE, NAME, FILE, TITLE) \
00042 TYPE *NAME = (TYPE*)GetHisto((FILE), (TITLE)); \
00043 if (!NAME) { \
00044 LOG_ERROR << "Histogram " << #NAME << " not found: " << (TITLE) << endm; \
00045 }
00046
00047
00048 void BEMCPlotsPresenter::displayStatus(FileType file, TPad *pad, int mDebug) {
00049 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00050
00051 if (!pad) return;
00052 pad->Clear();
00053 pad->cd(0);
00054
00055 FIND_HISTO(TH2F, Hist_TDC_status, file, Hist_TDC_statusName);
00056 FIND_HISTO(TH2F, Hist_SMD_status, file, Hist_SMD_statusName);
00057 FIND_HISTO(TH2F, Hist_PSD_status, file, Hist_PSD_statusName);
00058 FIND_HISTO(TH1F, Hist_BTOW_Corruption, file, Hist_BTOW_CorruptionName);
00059
00060 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00061 c->Draw();
00062 c->cd(0);
00063 c->Divide(2, 2, 0.001, 0.001);
00064
00065 c->cd(1);
00066 if (Hist_TDC_status) {
00067 Hist_TDC_status->Draw("H COLZ");
00068 }
00069 c->cd(2);
00070 if (Hist_SMD_status) {
00071 Hist_SMD_status->Draw("H COLZ");
00072 }
00073 c->cd(3);
00074 if (Hist_PSD_status) {
00075 Hist_PSD_status->Draw("H COLZ");
00076 }
00077 c->cd(4);
00078 if (Hist_BTOW_Corruption) {
00079 Hist_BTOW_Corruption->Draw("H COLZ");
00080 }
00081
00082 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00083 }
00084
00085
00086 void BEMCPlotsPresenter::displayTowers(FileType file, TPad *pad, int mDebug) {
00087 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00088
00089 if (!pad) return;
00090 pad->Clear();
00091 pad->cd(0);
00092
00093 FIND_HISTO(TH2F, Hist_btow_spectra_1, file, Hist_btow_spectra_1Name);
00094 FIND_HISTO(TH2F, Hist_btow_spectra_2, file, Hist_btow_spectra_2Name);
00095 FIND_HISTO(TH2F, Hist_btow_spectra_3, file, Hist_btow_spectra_3Name);
00096
00097 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00098 c->Draw();
00099 c->cd(0);
00100 c->Divide(1, 3, 0.001, 0.001);
00101
00102 c->cd(1);
00103 if (Hist_btow_spectra_1) {
00104 Hist_btow_spectra_1->Draw("H COLZ");
00105 }
00106 c->cd(2);
00107 if (Hist_btow_spectra_2) {
00108 Hist_btow_spectra_2->Draw("H COLZ");
00109 }
00110 c->cd(3);
00111 if (Hist_btow_spectra_3) {
00112 Hist_btow_spectra_3->Draw("H COLZ");
00113 }
00114
00115 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00116 }
00117
00118
00119 void BEMCPlotsPresenter::displaySMDPSD(FileType file, TPad *pad, int mDebug) {
00120 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00121
00122 if (!pad) return;
00123 pad->Clear();
00124 pad->cd(0);
00125
00126 FIND_HISTO(TH1F, Hist_smd_spectra, file, Hist_smd_spectraName);
00127 FIND_HISTO(TH1F, Hist_smd_spectraNonZS, file, Hist_smd_spectraNonZSName);
00128 FIND_HISTO(TH2F, Hist_smd_capacitor, file, Hist_smd_capacitorName);
00129 FIND_HISTO(TH2F, Hist_smd_sum, file, Hist_smd_sumName);
00130 FIND_HISTO(TH1F, Hist_psd_spectra, file, Hist_psd_spectraName);
00131 FIND_HISTO(TH1F, Hist_psd_spectraNonZS, file, Hist_psd_spectraNonZSName);
00132 FIND_HISTO(TH2F, Hist_psd_capacitor, file, Hist_psd_capacitorName);
00133 FIND_HISTO(TH2F, Hist_psd_sum, file, Hist_psd_sumName);
00134
00135 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00136 c->Draw();
00137 c->cd(0);
00138 c->Divide(2, 3, 0.001, 0.001);
00139
00140 c->cd(1);
00141 if (Hist_smd_spectra) {
00142 Hist_smd_spectra->Draw("H COLZ");
00143 }
00144 if (Hist_smd_spectraNonZS) {
00145 Hist_smd_spectraNonZS->SetLineColor(kRed);
00146 Hist_smd_spectraNonZS->Draw("SAME H COLZ");
00147 }
00148 c->cd(2);
00149 if (Hist_psd_spectra) {
00150 Hist_psd_spectra->Draw("H COLZ");
00151 }
00152 if (Hist_psd_spectraNonZS) {
00153 Hist_psd_spectraNonZS->SetLineColor(kRed);
00154 Hist_psd_spectraNonZS->Draw("SAME H COLZ");
00155 }
00156 c->cd(3);
00157 if (Hist_smd_capacitor) {
00158 Hist_smd_capacitor->Draw("H COLZ");
00159 }
00160 c->cd(4);
00161 if (Hist_psd_capacitor) {
00162 Hist_psd_capacitor->Draw("H COLZ");
00163 }
00164 c->cd(5);
00165 if (Hist_smd_sum) {
00166 Hist_smd_sum->Draw("H COLZ");
00167 }
00168 c->cd(6);
00169 if (Hist_psd_sum) {
00170 Hist_psd_sum->Draw("H COLZ");
00171 }
00172
00173 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00174 }
00175
00176
00177 void BEMCPlotsPresenter::displayTrigger(FileType file, TPad *pad, int mDebug) {
00178 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00179
00180 if (!pad) return;
00181 pad->Clear();
00182 pad->cd(0);
00183
00184 FIND_HISTO(TH2F, Hist_HTMAX_spectra, file, Hist_HTMAX_spectraName);
00185 FIND_HISTO(TH2F, Hist_PAMAX_spectra, file, Hist_PAMAX_spectraName);
00186 FIND_HISTO(TH1F, Hist_HTMAX_dist, file, Hist_HTMAX_distName);
00187 FIND_HISTO(TH1F, Hist_PAMAX_dist, file, Hist_PAMAX_distName);
00188
00189 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00190 c->Draw();
00191 c->cd(0);
00192 c->Divide(2, 2, 0.001, 0.001);
00193
00194 c->cd(1);
00195 if (Hist_HTMAX_spectra) {
00196 Hist_HTMAX_spectra->Draw("H COLZ");
00197 }
00198 c->cd(2);
00199 if (Hist_PAMAX_spectra) {
00200 Hist_PAMAX_spectra->Draw("H COLZ");
00201 }
00202 c->cd(3);
00203 if (Hist_HTMAX_dist) {
00204 Hist_HTMAX_dist->Draw("H COLZ");
00205 }
00206 c->cd(4);
00207 if (Hist_PAMAX_dist) {
00208 Hist_PAMAX_dist->Draw("H COLZ");
00209 }
00210
00211 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00212 }
00213
00214
00215 void BEMCPlotsPresenter::displayJet(FileType file, TPad *pad, int mDebug) {
00216 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00217
00218 if (!pad) return;
00219 pad->Clear();
00220 pad->cd(0);
00221
00222 FIND_HISTO(TH2F, Hist_JET_ped, file, Hist_JET_pedName);
00223 FIND_HISTO(TH2F, Hist_JET_spectra, file, Hist_JET_spectraName);
00224 FIND_HISTO(TH2F, Hist_JETMAX_spectra, file, Hist_JETMAX_spectraName);
00225 FIND_HISTO(TH1F, Hist_JETMAX_dist, file, Hist_JETMAX_distName);
00226
00227 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00228 c->Draw();
00229 c->cd(0);
00230 c->Divide(2, 2, 0.001, 0.001);
00231
00232 c->cd(1);
00233 if (Hist_JET_ped) {
00234 Hist_JET_ped->Draw("H COLZ");
00235 }
00236 c->cd(2);
00237 if (Hist_JET_spectra) {
00238 Hist_JET_spectra->Draw("H COLZ");
00239 }
00240 c->cd(3);
00241 if (Hist_JETMAX_spectra) {
00242 Hist_JETMAX_spectra->Draw("H COLZ");
00243 }
00244 c->cd(4);
00245 if (Hist_JETMAX_dist) {
00246 Hist_JETMAX_dist->Draw("H COLZ");
00247 }
00248
00249 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00250 }
00251
00252
00253 void BEMCPlotsPresenter::displayRawAdc(FileType file, TPad *pad, bool psd, bool zoom, BemcTwMask *twMask, Int_t mDebug) {
00254 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00255
00256 FIND_HISTO(TH2F, HistRawAdc1, file, psd ? HistRawAdcPsd1Name : (zoom ? HistRawAdc1NameZoom : HistRawAdc1Name));
00257 FIND_HISTO(TH2F, HistRawAdc2, file, psd ? HistRawAdcPsd2Name : (zoom ? HistRawAdc2NameZoom : HistRawAdc2Name));
00258 FIND_HISTO(TH2F, HistRawAdc3, file, psd ? HistRawAdcPsd3Name : (zoom ? HistRawAdc3NameZoom : HistRawAdc3Name));
00259 FIND_HISTO(TH2F, HistRawAdc4, file, psd ? HistRawAdcPsd4Name : (zoom ? HistRawAdc4NameZoom : HistRawAdc4Name));
00260
00261 if (!pad) return;
00262 pad->Clear();
00263 pad->cd(0);
00264
00265 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00266 c->Draw();
00267 c->cd(0);
00268 c->Divide(1, 4, 0.001, 0.001);
00269
00270
00271 Int_t linesColor = 16;
00272 Int_t crateMinSoftId[] = {4661, 2421, 2581, 2741, 2901, 3061, 3221, 3381, 3541, 3701, 3861, 4021, 4181, 4341, 4501, 2181, 2021, 1861, 1701, 1541, 1381, 1221, 1061, 901, 741, 581, 421, 261, 101, 1};
00273 Int_t crateMaxSoftId[] = {4800, 2580, 2740, 2900, 3060, 3220, 3380, 3540, 3700, 3860, 4020, 4180, 4340, 4500, 4660, 2340, 2180, 2020, 1860, 1700, 1540, 1380, 1220, 1060, 900, 740, 580, 420, 260, 100};
00274 Int_t pmtbxMinSoftId[] = {2261, 2181, 2101, 2021, 1941, 1861, 1781, 1701, 1621, 1541, 1461, 1381, 1301, 1221, 1141, 1061, 981, 901, 821, 741, 661, 581, 501, 421, 341, 261, 181, 101, 21, 2341,
00275 4661, 4741, 2421, 2501, 2581, 2661, 2741, 2821, 2901, 2981, 3061, 3141, 3221, 3301, 3381, 3461, 3541, 3621, 3701, 3781, 3861, 3941, 4021, 4101, 4181, 4261, 4341, 4421, 4501, 4581
00276
00277 };
00278 Int_t pmtbxMaxSoftId[] = {2340, 2260, 2180, 2100, 2020, 1940, 1860, 1780, 1700, 1620, 1540, 1460, 1380, 1300, 1220, 1140, 1060, 980, 900, 820, 740, 660, 580, 500, 420, 340, 260, 180, 100, 2400,
00279 4740, 4800, 2500, 2580, 2660, 2740, 2820, 2900, 2980, 3060, 3140, 3220, 3300, 3380, 3460, 3540, 3620, 3700, 3780, 3860, 3940, 4020, 4100, 4180, 4260, 4340, 4420, 4500, 4580, 4660
00280
00281 };
00282 if (useDecoderForBoundaries && BEMCDecoderPresenter) {
00283 for (Int_t crate = 0;crate < 30;crate++) {
00284 crateMinSoftId[crate] = 4800;
00285 crateMaxSoftId[crate] = 1;
00286 }
00287 for (Int_t crate = 0;crate < 30;crate++) {
00288 if (BEMCDecoderPresenter) {
00289 for (Int_t crateSeq = 0;crateSeq < 160;crateSeq++) {
00290 Int_t softId;
00291 if (BEMCDecoderPresenter->GetTowerIdFromCrate(crate + 1, crateSeq, softId)) {
00292 if (softId < crateMinSoftId[crate]) crateMinSoftId[crate] = softId;
00293 if (softId > crateMaxSoftId[crate]) crateMaxSoftId[crate] = softId;
00294 }
00295 }
00296 }
00297 }
00298
00299
00300 }
00301
00302 Int_t *boxMinSoftId = psd ? pmtbxMinSoftId : crateMinSoftId;
00303 Int_t *boxMaxSoftId = psd ? pmtbxMaxSoftId : crateMaxSoftId;
00304 const Char_t *boxLabelFormat = psd ? "%i" : "0x%.2X";
00305 Int_t numBoxes = psd ? (sizeof(pmtbxMinSoftId)/sizeof(pmtbxMinSoftId[0])) : (sizeof(crateMinSoftId)/sizeof(crateMinSoftId[0]));
00306
00307 c->cd(1);
00308 if (HistRawAdc1) {
00309 HistRawAdc1->SetStats(0);
00310 HistRawAdc1->Draw("COLZ");
00311 if (twMask) {
00312 TGraph &g1 = twMask->crG[0];
00313 if (g1.GetN() > 0) {
00314 g1.Draw("L");
00315
00316 g1.SetLineColor(2);
00317 }
00318
00319
00320
00321
00322
00323
00324
00325 }
00326 for (Int_t crate = 0;crate < numBoxes;crate++) {
00327 if (!((boxMaxSoftId[crate] < HistRawAdc1->GetXaxis()->GetBinLowEdge(1))
00328 || (boxMinSoftId[crate] > HistRawAdc1->GetXaxis()->GetBinUpEdge(HistRawAdc1->GetXaxis()->GetNbins())))
00329 ) {
00330 Float_t left = max(boxMinSoftId[crate], HistRawAdc1->GetXaxis()->GetBinCenter(1)) - 0.5;
00331 Float_t right = 0.5 + min(boxMaxSoftId[crate], HistRawAdc1->GetXaxis()->GetBinCenter(HistRawAdc1->GetXaxis()->GetNbins()));
00332 TLine *lCrates = new TLine(left, HistRawAdc1->GetYaxis()->GetBinLowEdge(1), left, HistRawAdc1->GetYaxis()->GetBinUpEdge(HistRawAdc1->GetYaxis()->GetNbins()));
00333 if (lCrates) {
00334 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lCrates);
00335 lCrates->SetLineColor(linesColor);
00336 lCrates->SetLineWidth(1);
00337 lCrates->Draw();
00338 }
00339 TLine *rCrates = new TLine(right, HistRawAdc1->GetYaxis()->GetBinLowEdge(1), right, HistRawAdc1->GetYaxis()->GetBinUpEdge(HistRawAdc1->GetYaxis()->GetNbins()));
00340 if (rCrates) {
00341 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(rCrates);
00342 rCrates->SetLineColor(linesColor);
00343 rCrates->SetLineWidth(1);
00344 rCrates->Draw();
00345 }
00346 TString crateLabel;
00347 crateLabel = Form(boxLabelFormat, crate + 1);
00348 TLatex *textCrate = new TLatex(left + 10, HistRawAdc1->GetYaxis()->GetBinUpEdge(HistRawAdc1->GetYaxis()->GetNbins()) * 0.8, crateLabel.Data());
00349 if (textCrate) {
00350 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textCrate);
00351 textCrate->SetTextColor(linesColor);
00352 textCrate->SetTextSize(0.14);
00353 textCrate->Draw();
00354 }
00355 }
00356 }
00357 }
00358 c->cd(2);
00359 if (HistRawAdc2) {
00360 HistRawAdc2->SetStats(0);
00361 HistRawAdc2->Draw("COLZ");
00362 if (twMask) {
00363 TGraph &g2 = twMask->crG[1];
00364 if (g2.GetN() > 0) {
00365 g2.Draw("L");
00366 g2.SetLineColor(2);
00367 }
00368 }
00369 for (Int_t crate = 0;crate < numBoxes;crate++) {
00370 if (!((boxMaxSoftId[crate] < HistRawAdc2->GetXaxis()->GetBinLowEdge(1))
00371 || (boxMinSoftId[crate] > HistRawAdc2->GetXaxis()->GetBinUpEdge(HistRawAdc2->GetXaxis()->GetNbins())))
00372 ) {
00373 Float_t left = max(boxMinSoftId[crate], HistRawAdc2->GetXaxis()->GetBinCenter(1)) - 0.5;
00374 Float_t right = 0.5 + min(boxMaxSoftId[crate], HistRawAdc2->GetXaxis()->GetBinCenter(HistRawAdc2->GetXaxis()->GetNbins()));
00375 TLine *lCrates = new TLine(left, HistRawAdc2->GetYaxis()->GetBinLowEdge(1), left, HistRawAdc2->GetYaxis()->GetBinUpEdge(HistRawAdc2->GetYaxis()->GetNbins()));
00376 if (lCrates) {
00377 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lCrates);
00378 lCrates->SetLineColor(linesColor);
00379 lCrates->SetLineWidth(1);
00380 lCrates->Draw();
00381 }
00382 TLine *rCrates = new TLine(right, HistRawAdc2->GetYaxis()->GetBinLowEdge(1), right, HistRawAdc2->GetYaxis()->GetBinUpEdge(HistRawAdc2->GetYaxis()->GetNbins()));
00383 if (rCrates) {
00384 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(rCrates);
00385 rCrates->SetLineColor(linesColor);
00386 rCrates->SetLineWidth(1);
00387 rCrates->Draw();
00388 }
00389 TString crateLabel;
00390 crateLabel = Form(boxLabelFormat, crate + 1);
00391 TLatex *textCrate = new TLatex(left + 10, HistRawAdc2->GetYaxis()->GetBinUpEdge(HistRawAdc2->GetYaxis()->GetNbins()) * 0.8, crateLabel.Data());
00392 if (textCrate) {
00393 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textCrate);
00394 textCrate->SetTextColor(linesColor);
00395 textCrate->SetTextSize(0.14);
00396 textCrate->Draw();
00397 }
00398 }
00399 }
00400 }
00401
00402 c->cd(3);
00403 if (HistRawAdc3) {
00404 HistRawAdc3->SetStats(0);
00405 HistRawAdc3->Draw("COLZ");
00406 if (twMask) {
00407 TGraph &g3 = twMask->crG[2];
00408 if (g3.GetN() > 0) {
00409 g3.Draw("L");
00410 g3.SetLineColor(2);
00411 }
00412 }
00413 for (Int_t crate = 0;crate < numBoxes;crate++) {
00414 if (!((boxMaxSoftId[crate] < HistRawAdc3->GetXaxis()->GetBinLowEdge(1))
00415 || (boxMinSoftId[crate] > HistRawAdc3->GetXaxis()->GetBinUpEdge(HistRawAdc3->GetXaxis()->GetNbins())))
00416 ) {
00417 Float_t left = max(boxMinSoftId[crate], HistRawAdc3->GetXaxis()->GetBinCenter(1)) - 0.5;
00418 Float_t right = 0.5 + min(boxMaxSoftId[crate], HistRawAdc3->GetXaxis()->GetBinCenter(HistRawAdc3->GetXaxis()->GetNbins()));
00419 TLine *lCrates = new TLine(left, HistRawAdc3->GetYaxis()->GetBinLowEdge(1), left, HistRawAdc3->GetYaxis()->GetBinUpEdge(HistRawAdc3->GetYaxis()->GetNbins()));
00420 if (lCrates) {
00421 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lCrates);
00422 lCrates->SetLineColor(linesColor);
00423 lCrates->SetLineWidth(1);
00424 lCrates->Draw();
00425 }
00426 TLine *rCrates = new TLine(right, HistRawAdc3->GetYaxis()->GetBinLowEdge(1), right, HistRawAdc3->GetYaxis()->GetBinUpEdge(HistRawAdc3->GetYaxis()->GetNbins()));
00427 if (rCrates) {
00428 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(rCrates);
00429 rCrates->SetLineColor(linesColor);
00430 rCrates->SetLineWidth(1);
00431 rCrates->Draw();
00432 }
00433 TString crateLabel;
00434 crateLabel = Form(boxLabelFormat, crate + 1);
00435 TLatex *textCrate = new TLatex(left + 10, HistRawAdc3->GetYaxis()->GetBinUpEdge(HistRawAdc3->GetYaxis()->GetNbins()) * 0.8, crateLabel.Data());
00436 if (textCrate) {
00437 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textCrate);
00438 textCrate->SetTextColor(linesColor);
00439 textCrate->SetTextSize(0.14);
00440 textCrate->Draw();
00441 }
00442 }
00443 }
00444 }
00445
00446 c->cd(4);
00447 if (HistRawAdc4) {
00448 HistRawAdc4->SetStats(0);
00449 HistRawAdc4->Draw("COLZ");
00450 if (twMask) {
00451 TGraph &g4 = twMask->crG[3];
00452 if (g4.GetN() > 0) {
00453 g4.Draw("L");
00454
00455 g4.SetLineColor(2);
00456 }
00457 }
00458 for (Int_t crate = 0;crate < numBoxes;crate++) {
00459 if (!((boxMaxSoftId[crate] < HistRawAdc4->GetXaxis()->GetBinLowEdge(1))
00460 || (boxMinSoftId[crate] > HistRawAdc4->GetXaxis()->GetBinUpEdge(HistRawAdc4->GetXaxis()->GetNbins())))
00461 ) {
00462 Float_t left = max(boxMinSoftId[crate], HistRawAdc4->GetXaxis()->GetBinCenter(1)) - 0.5;
00463 Float_t right = 0.5 + min(boxMaxSoftId[crate], HistRawAdc4->GetXaxis()->GetBinCenter(HistRawAdc4->GetXaxis()->GetNbins()));
00464 TLine *lCrates = new TLine(left, HistRawAdc4->GetYaxis()->GetBinLowEdge(1), left, HistRawAdc4->GetYaxis()->GetBinUpEdge(HistRawAdc4->GetYaxis()->GetNbins()));
00465 if (lCrates) {
00466 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lCrates);
00467 lCrates->SetLineColor(linesColor);
00468 lCrates->SetLineWidth(1);
00469 lCrates->Draw();
00470 }
00471 TLine *rCrates = new TLine(right, HistRawAdc4->GetYaxis()->GetBinLowEdge(1), right, HistRawAdc4->GetYaxis()->GetBinUpEdge(HistRawAdc4->GetYaxis()->GetNbins()));
00472 if (rCrates) {
00473 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(rCrates);
00474 rCrates->SetLineColor(linesColor);
00475 rCrates->SetLineWidth(1);
00476 rCrates->Draw();
00477 }
00478 TString crateLabel;
00479 crateLabel = Form(boxLabelFormat, crate + 1);
00480 TLatex *textCrate = new TLatex(left + 10, HistRawAdc4->GetYaxis()->GetBinUpEdge(HistRawAdc4->GetYaxis()->GetNbins()) * 0.8, crateLabel.Data());
00481 if (textCrate) {
00482 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textCrate);
00483 textCrate->SetTextColor(linesColor);
00484 textCrate->SetTextSize(0.14);
00485 textCrate->Draw();
00486 }
00487 }
00488 }
00489 }
00490 }
00491
00492
00493 void BEMCPlotsPresenter::displayJetPatchHT(FileType file, TPad *pad, Int_t mDebug) {
00494 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00495
00496 if (!pad) return;
00497 pad->Clear();
00498 pad->cd(0);
00499
00500 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00501 c->Draw();
00502 c->cd(0);
00503 c->Divide(3, 4, 0.001, 0.001);
00504
00505 for (Int_t jetPatch = 0;jetPatch < 12;jetPatch++) {
00506 c->cd(jetPatch+1);
00507 FIND_HISTO(TH1F, HistHighTowerSpectrum, file, Form(HistHighTowerSpectrumName "_%u", jetPatch));
00508 if (HistHighTowerSpectrum) {
00509 HistHighTowerSpectrum->SetStats(0);
00510 HistHighTowerSpectrum->Draw();
00511 if (HistHighTowerSpectrum->GetEntries()) gPad->SetLogy();
00512 }
00513 }
00514 }
00515
00516 void BEMCPlotsPresenter::displayJetPatchSum(FileType file, TPad *pad, Int_t mDebug) {
00517 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00518
00519 if (!pad) return;
00520 pad->Clear();
00521 pad->cd(0);
00522
00523 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00524 c->Draw();
00525 c->cd(0);
00526 c->Divide(3, 4, 0.001, 0.001);
00527
00528 for (Int_t jetPatch = 0;jetPatch < 12;jetPatch++) {
00529 c->cd(jetPatch+1);
00530 FIND_HISTO(TH1F, HistPatchSumSpectrum, file, Form(HistPatchSumSpectrumName "_%u", jetPatch));
00531 if (HistPatchSumSpectrum) {
00532 HistPatchSumSpectrum->SetStats(0);
00533 HistPatchSumSpectrum->Draw();
00534 if (HistPatchSumSpectrum->GetEntries()) gPad->SetLogy();
00535 }
00536 }
00537 }
00538
00539 void BEMCPlotsPresenter::displayL0Input(FileType file, TPad *pad, Int_t mDebug) {
00540 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00541
00542 FIND_HISTO(TH2F, HistDsmL0InputHighTower, file, HistDsmL0InputHighTowerName);
00543 FIND_HISTO(TH2F, HistDsmL0InputPatchSum, file, HistDsmL0InputPatchSumName);
00544
00545 if (!pad) return;
00546 pad->Clear();
00547 pad->cd(0);
00548
00549 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00550 c->Draw();
00551 c->cd(0);
00552 c->Divide(1, 2, 0.001, 0.001);
00553
00554
00555 Int_t linesColor = 16;
00556 c->cd(1);
00557 if (HistDsmL0InputHighTower && BEMCDecoderPresenter) {
00558 HistDsmL0InputHighTower->SetStats(0);
00559 HistDsmL0InputHighTower->Draw("COLZ");
00560 TLine *lCrates = new TLine(0, 50, 300, 50);
00561 if (lCrates) {
00562 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lCrates);
00563 lCrates->SetLineColor(linesColor);
00564 lCrates->SetLineWidth(1);
00565 lCrates->Draw();
00566 }
00567 TLatex *textCrates = new TLatex(1, 50, "BTOW Crates:");
00568 if (textCrates) {
00569 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textCrates);
00570 textCrates->SetTextColor(linesColor);
00571 textCrates->SetTextSize(0.0333);
00572 textCrates->Draw();
00573 }
00574 for (Int_t icrate = 1;icrate <= 30;icrate++) {
00575 Int_t triggerPatchBegin, triggerPatchEnd;
00576 if (BEMCDecoderPresenter->GetTriggerPatchFromCrate(icrate, 0, triggerPatchBegin) && BEMCDecoderPresenter->GetTriggerPatchFromCrate(icrate, 159, triggerPatchEnd)) {
00577 TLine *lCrateBegin = new TLine(triggerPatchBegin-0.5, 0, triggerPatchBegin-0.5, 50);
00578 if (lCrateBegin) {
00579 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lCrateBegin);
00580 lCrateBegin->SetLineColor(linesColor);
00581 lCrateBegin->SetLineWidth(1);
00582 lCrateBegin->Draw();
00583 }
00584 TString crateLabel;
00585 crateLabel = Form("%.2X", icrate);
00586 TLatex *textCrate = new TLatex(triggerPatchBegin + 1, 45, crateLabel.Data());
00587 if (textCrate) {
00588 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textCrate);
00589 textCrate->SetTextColor(linesColor);
00590 textCrate->SetTextSize(0.0333);
00591 textCrate->Draw();
00592 }
00593 }
00594 }
00595 for (Int_t ijp = 0;ijp < 12;ijp++) {
00596 Int_t maxTriggerPatch = 0;
00597 Int_t minTriggerPatch = 300;
00598 for (Int_t j = 0;j < 25;j++) {
00599 Int_t triggerPatch;
00600 if (BEMCDecoderPresenter->GetTriggerPatchFromJetPatch(ijp, j, triggerPatch)) {
00601 if (maxTriggerPatch < triggerPatch) maxTriggerPatch = triggerPatch;
00602 if (minTriggerPatch > triggerPatch) minTriggerPatch = triggerPatch;
00603 }
00604 }
00605 maxTriggerPatch++;
00606 Int_t height = (ijp%2) ? 55 : 60;
00607 TArrow *arrow = new TArrow(minTriggerPatch-0.5, height, maxTriggerPatch-0.5, height, 0.02, "<>");
00608 if (arrow) {
00609 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(arrow);
00610 arrow->SetLineColor(linesColor);
00611 arrow->SetFillColor(linesColor);
00612 arrow->Draw();
00613 }
00614 TString jpLabel;
00615 jpLabel = Form("JetPatch %u", ijp);
00616 TLatex *text = new TLatex(minTriggerPatch + 1, height + 1, jpLabel.Data());
00617 if (text) {
00618 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(text);
00619 text->SetTextColor(linesColor);
00620 text->SetTextSize(0.0333);
00621 text->Draw();
00622 }
00623 }
00624 }
00625 c->cd(2);
00626 if (HistDsmL0InputPatchSum) {
00627 HistDsmL0InputPatchSum->SetStats(0);
00628 HistDsmL0InputPatchSum->Draw("COLZ");
00629 for (Int_t icrate = 1;icrate <= 30;icrate++) {
00630 Int_t triggerPatchBegin, triggerPatchEnd;
00631 if (BEMCDecoderPresenter->GetTriggerPatchFromCrate(icrate, 0, triggerPatchBegin) && BEMCDecoderPresenter->GetTriggerPatchFromCrate(icrate, 159, triggerPatchEnd)) {
00632 TLine *lCrateBegin = new TLine(triggerPatchBegin-0.5, 0, triggerPatchBegin-0.5, 64);
00633 if (lCrateBegin) {
00634 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lCrateBegin);
00635 lCrateBegin->SetLineColor(linesColor);
00636 lCrateBegin->SetLineWidth(1);
00637 lCrateBegin->Draw();
00638 }
00639 TString crateLabel;
00640 crateLabel = Form("%.2X", icrate);
00641 TLatex *textCrate = new TLatex(triggerPatchBegin + 1, 60, crateLabel.Data());
00642 if (textCrate) {
00643 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textCrate);
00644 textCrate->SetTextColor(linesColor);
00645 textCrate->SetTextSize(0.0333);
00646 textCrate->Draw();
00647 }
00648 }
00649 }
00650 }
00651 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00652 }
00653
00654 void BEMCPlotsPresenter::displayL1Input(FileType file, TPad *pad, Int_t mDebug) {
00655 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00656
00657 FIND_HISTO(TH2F, HistDsmL1InputHighTowerBits, file, HistDsmL1InputHighTowerBitsName);
00658 FIND_HISTO(TH2F, HistDsmL1InputPatchSum, file, HistDsmL1InputPatchSumName);
00659
00660 if (!pad) return;
00661 pad->Clear();
00662 pad->cd(0);
00663
00664 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00665 c->Draw();
00666 c->cd(0);
00667 c->Divide(1, 2, 0.001, 0.001);
00668
00669
00670 Int_t linesColor = 16;
00671 c->cd(1);
00672 if (HistDsmL1InputHighTowerBits) {
00673 HistDsmL1InputHighTowerBits->SetStats(0);
00674 HistDsmL1InputHighTowerBits->Draw("COLZ");
00675 HistDsmL1InputHighTowerBits->GetXaxis()->SetNdivisions(0, false);
00676 HistDsmL1InputHighTowerBits->GetYaxis()->SetNdivisions(0, false);
00677 TLatex *textHT0 = new TLatex(-3.5, 0.5, "HT < th0");
00678 if (textHT0) {
00679 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT0);
00680 textHT0->SetTextColor(linesColor);
00681 textHT0->SetTextSize(0.0333);
00682 textHT0->Draw();
00683 }
00684 TLatex *textHT1 = new TLatex(-3.5, 1.5, "th0 < HT < th1");
00685 if (textHT1) {
00686 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT1);
00687 textHT1->SetTextColor(linesColor);
00688 textHT1->SetTextSize(0.0333);
00689 textHT1->Draw();
00690 }
00691 TLatex *textHT2 = new TLatex(-3.5, 2.5, "th1 < HT < th2");
00692 if (textHT2) {
00693 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT2);
00694 textHT2->SetTextColor(linesColor);
00695 textHT2->SetTextSize(0.0333);
00696 textHT2->Draw();
00697 }
00698 TLatex *textHT3 = new TLatex(-3.5, 3.5, "th2 < HT");
00699 if (textHT3) {
00700 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT3);
00701 textHT3->SetTextColor(linesColor);
00702 textHT3->SetTextSize(0.0333);
00703 textHT3->Draw();
00704 }
00705 TLatex *textDsmsL0 = new TLatex(-3.5, 4.0, "#splitline{#splitline{DSM Level-0}{Boards}}{BTOW Crates}");
00706 if (textDsmsL0) {
00707 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textDsmsL0);
00708 textDsmsL0->SetTextColor(linesColor);
00709 textDsmsL0->SetTextSize(0.0333);
00710 textDsmsL0->Draw();
00711 }
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726 Int_t dsmL0 = 0;
00727 Int_t ch = 0;
00728 for (Int_t idsmL1 = 0;idsmL1 < 6;idsmL1++) {
00729 for (Int_t idsmL1ch = 0;idsmL1ch < 6;idsmL1ch++) {
00730 TLine *lDsmL0Begin = new TLine(ch-0.5, 0, ch-0.5, 4.4);
00731 if (lDsmL0Begin) {
00732 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lDsmL0Begin);
00733 lDsmL0Begin->SetLineColor(linesColor);
00734 lDsmL0Begin->SetLineWidth(1);
00735 lDsmL0Begin->Draw();
00736 }
00737 TString label;
00738 Int_t crate = 0, crateSeq = 0;
00739 if (BEMCDecoderPresenter) {
00740 Int_t triggerPatch = dsmL0 * 10;
00741 BEMCDecoderPresenter->GetCrateAndSequenceFromTriggerPatch(triggerPatch, crate, crateSeq);
00742 }
00743 if (idsmL1 < 3) {
00744 label = Form("#splitline{#splitline{BW}{0%.2u}}{%.2X}", (dsmL0 % 15) + 1, crate);
00745 } else {
00746 label = Form("#splitline{#splitline{BE}{0%.2u}}{%.2X}", (dsmL0 % 15) + 1, crate);
00747 }
00748 TLatex *text = new TLatex(ch + 0.1-0.5, 4.0, label.Data());
00749 if (text) {
00750 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(text);
00751 text->SetTextColor(linesColor);
00752 text->SetTextSize(0.0333);
00753 text->Draw();
00754 }
00755
00756
00757
00758
00759
00760
00761
00762
00763
00764
00765
00766
00767
00768
00769
00770 ch++;
00771 if (idsmL1ch != 2) dsmL0++;
00772 }
00773 }
00774 for (Int_t ijp = 0;ijp < 12;ijp++) {
00775 Int_t maxCh = (ijp * 3) + 3;
00776 Int_t minCh = (ijp * 3) + 0;
00777 Float_t height = (ijp%2) ? 4.7 : 4.7;
00778 TArrow *arrow = new TArrow(minCh-0.5, height, maxCh-0.5, height, 0.02, "<>");
00779 if (arrow) {
00780 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(arrow);
00781 arrow->SetLineColor(linesColor);
00782 arrow->SetFillColor(linesColor);
00783 arrow->Draw();
00784 }
00785 TString jpLabel;
00786 jpLabel = Form("JetPatch %u", ijp);
00787 TLatex *text = new TLatex(minCh + 0.1-0.5, height + 0.1, jpLabel.Data());
00788 if (text) {
00789 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(text);
00790 text->SetTextColor(linesColor);
00791 text->SetTextSize(0.0333);
00792 text->Draw();
00793 }
00794 }
00795 TLatex *textDsmsL1 = new TLatex(-3.5, -0.4, "#splitline{DSM Level-1}{Boards}");
00796 if (textDsmsL1) {
00797 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textDsmsL1);
00798 textDsmsL1->SetTextColor(linesColor);
00799 textDsmsL1->SetTextSize(0.0333);
00800 textDsmsL1->Draw();
00801 }
00802 for (Int_t idsmL1 = 0;idsmL1 < 6;idsmL1++) {
00803 TArrow *arrow = new TArrow((idsmL1 * 6)-0.5, -0.4, (idsmL1 * 6) + 6-0.5, -0.4, 0.02, "<>");
00804 if (arrow) {
00805 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(arrow);
00806 arrow->SetLineColor(linesColor);
00807 arrow->SetFillColor(linesColor);
00808 arrow->Draw();
00809 }
00810 TString label;
00811 if (idsmL1 < 3) {
00812 label = Form("BW1%.2u", (idsmL1 % 3) + 1);
00813 } else {
00814 label = Form("BE1%.2u", (idsmL1 % 3) + 1);
00815 }
00816 TLatex *text = new TLatex((idsmL1 * 6) + 1-0.5, -0.35, label.Data());
00817 if (text) {
00818 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(text);
00819 text->SetTextColor(linesColor);
00820 text->SetTextSize(0.0333);
00821 text->Draw();
00822 }
00823 }
00824 }
00825
00826 c->cd(2);
00827 if (HistDsmL1InputPatchSum) {
00828 HistDsmL1InputPatchSum->SetStats(0);
00829 HistDsmL1InputPatchSum->Draw("COLZ");
00830 Int_t dsmL0 = 0;
00831 Int_t ch = 0;
00832 for (Int_t idsmL1 = 0;idsmL1 < 6;idsmL1++) {
00833 for (Int_t idsmL1ch = 0;idsmL1ch < 6;idsmL1ch++) {
00834 TLine *lDsmL0Begin = new TLine(ch-0.5, 0, ch-0.5, 1024);
00835 if (lDsmL0Begin) {
00836 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lDsmL0Begin);
00837 lDsmL0Begin->SetLineColor(linesColor);
00838 lDsmL0Begin->SetLineWidth(1);
00839 lDsmL0Begin->Draw();
00840 }
00841 Int_t crate = 0, crateSeq = 0;
00842 if (BEMCDecoderPresenter) {
00843 Int_t triggerPatch = dsmL0 * 10;
00844 BEMCDecoderPresenter->GetCrateAndSequenceFromTriggerPatch(triggerPatch, crate, crateSeq);
00845 }
00846 TString label;
00847 label = Form("%.2X", crate);
00848 TLatex *text = new TLatex(ch + 0.1-0.5, 900, label.Data());
00849 if (text) {
00850 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(text);
00851 text->SetTextColor(linesColor);
00852 text->SetTextSize(0.0333);
00853 text->Draw();
00854 }
00855 ch++;
00856 if (idsmL1ch != 2) dsmL0++;
00857 }
00858 }
00859 }
00860 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00861 }
00862
00863 void BEMCPlotsPresenter::displayL2Input(FileType file, TPad *pad, Int_t mDebug) {
00864 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
00865
00866 FIND_HISTO(TH2F, HistDsmL2InputHighTowerBits, file, HistDsmL2InputHighTowerBitsName);
00867 FIND_HISTO(TH2F, HistDsmL2InputPatchSumBits, file, HistDsmL2InputPatchSumBitsName);
00868 FIND_HISTO(TH2F, HistDsmL2InputPatchSum, file, HistDsmL2InputPatchSumName);
00869
00870 if (!pad) return;
00871 pad->Clear();
00872 pad->cd(0);
00873
00874 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
00875 c->Draw();
00876 c->cd(0);
00877 c->Divide(1, 3, 0.001, 0.001);
00878
00879
00880 Int_t linesColor = 16;
00881 c->cd(1);
00882
00883 if (HistDsmL2InputHighTowerBits) {
00884 HistDsmL2InputHighTowerBits->SetStats(0);
00885 HistDsmL2InputHighTowerBits->Draw("COLZ");
00886 HistDsmL2InputHighTowerBits->GetXaxis()->SetNdivisions(12, false);
00887 HistDsmL2InputHighTowerBits->GetYaxis()->SetNdivisions(0, false);
00888 TLatex *textHT0 = new TLatex(-1.4, 0.5, "HT < th0");
00889 if (textHT0) {
00890 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT0);
00891 textHT0->SetTextColor(linesColor);
00892 textHT0->SetTextSize(0.05);
00893 textHT0->Draw();
00894 }
00895 TLatex *textHT1 = new TLatex(-1.4, 1.5, "th0 < HT < th1");
00896 if (textHT1) {
00897 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT1);
00898 textHT1->SetTextColor(linesColor);
00899 textHT1->SetTextSize(0.05);
00900 textHT1->Draw();
00901 }
00902 TLatex *textHT2 = new TLatex(-1.4, 2.5, "th1 < HT < th2");
00903 if (textHT2) {
00904 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT2);
00905 textHT2->SetTextColor(linesColor);
00906 textHT2->SetTextSize(0.05);
00907 textHT2->Draw();
00908 }
00909 TLatex *textHT3 = new TLatex(-1.4, 3.5, "th2 < HT");
00910 if (textHT3) {
00911 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT3);
00912 textHT3->SetTextColor(linesColor);
00913 textHT3->SetTextSize(0.05);
00914 textHT3->Draw();
00915 }
00916 TLatex *textDsmsL1 = new TLatex(-1.4, 4.5, "#splitline{DSM Level-1}{Boards}");
00917 if (textDsmsL1) {
00918 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textDsmsL1);
00919 textDsmsL1->SetTextColor(linesColor);
00920 textDsmsL1->SetTextSize(0.05);
00921 textDsmsL1->Draw();
00922 }
00923 for (Int_t ch = 0;ch < 12;ch += 2) {
00924 TLine *lDsmL1Begin = new TLine(ch-0.5, 0, ch-0.5, 5);
00925 if (lDsmL1Begin) {
00926 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lDsmL1Begin);
00927 lDsmL1Begin->SetLineColor(linesColor);
00928 lDsmL1Begin->SetLineWidth(1);
00929 lDsmL1Begin->Draw();
00930 }
00931 TString label;
00932 if (ch < 6) {
00933 label = Form("BW1%.2u", ((ch / 2) % 3) + 1);
00934 } else {
00935 label = Form("BE1%.2u", ((ch / 2) % 3) + 1);
00936 }
00937 TLatex *text = new TLatex(ch + 0.1-0.5, 4.5, label.Data());
00938 if (text) {
00939 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(text);
00940 text->SetTextColor(linesColor);
00941 text->SetTextSize(0.05);
00942 text->Draw();
00943 }
00944 }
00945 }
00946
00947 c->cd(2);
00948 if (HistDsmL2InputPatchSumBits) {
00949 HistDsmL2InputPatchSumBits->SetStats(0);
00950 HistDsmL2InputPatchSumBits->Draw("COLZ");
00951 HistDsmL2InputPatchSumBits->GetXaxis()->SetNdivisions(12, false);
00952 HistDsmL2InputPatchSumBits->GetYaxis()->SetNdivisions(0, false);
00953 TLatex *textHT0 = new TLatex(-1.4, 0.5, "Sum < th0");
00954 if (textHT0) {
00955 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT0);
00956 textHT0->SetTextColor(linesColor);
00957 textHT0->SetTextSize(0.05);
00958 textHT0->Draw();
00959 }
00960 TLatex *textHT1 = new TLatex(-1.4, 1.5, "th0 < Sum < th1");
00961 if (textHT1) {
00962 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT1);
00963 textHT1->SetTextColor(linesColor);
00964 textHT1->SetTextSize(0.05);
00965 textHT1->Draw();
00966 }
00967 TLatex *textHT2 = new TLatex(-1.4, 2.5, "th1 < Sum < th2");
00968 if (textHT2) {
00969 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT2);
00970 textHT2->SetTextColor(linesColor);
00971 textHT2->SetTextSize(0.05);
00972 textHT2->Draw();
00973 }
00974 TLatex *textHT3 = new TLatex(-1.4, 3.5, "th2 < Sum");
00975 if (textHT3) {
00976 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(textHT3);
00977 textHT3->SetTextColor(linesColor);
00978 textHT3->SetTextSize(0.05);
00979 textHT3->Draw();
00980 }
00981 for (Int_t ch = 0;ch < 12;ch += 2) {
00982 TLine *lDsmL1Begin = new TLine(ch-0.5, 0, ch-0.5, 4);
00983 if (lDsmL1Begin) {
00984 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lDsmL1Begin);
00985 lDsmL1Begin->SetLineColor(linesColor);
00986 lDsmL1Begin->SetLineWidth(1);
00987 lDsmL1Begin->Draw();
00988 }
00989 }
00990 }
00991
00992 c->cd(3);
00993 if (HistDsmL2InputPatchSum) {
00994 HistDsmL2InputPatchSum->SetStats(0);
00995
00996
00997 HistDsmL2InputPatchSum->Draw("COLZ");
00998 for (Int_t ch = 0;ch < 6;ch++) {
00999 TLine *lDsmL1Begin = new TLine(ch-0.5, 0, ch-0.5, 256);
01000 if (lDsmL1Begin) {
01001 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lDsmL1Begin);
01002 lDsmL1Begin->SetLineColor(linesColor);
01003 lDsmL1Begin->SetLineWidth(1);
01004 lDsmL1Begin->Draw();
01005 }
01006 }
01007 }
01008
01009 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
01010 }
01011
01012 void BEMCPlotsPresenter::displayL3Input(FileType file, TPad *pad, Int_t mDebug) {
01013 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
01014
01015 FIND_HISTO(TH1F, HistDsmL3InputHighTowerBits, file, HistDsmL3InputHighTowerBitsName);
01016 FIND_HISTO(TH1F, HistDsmL3InputPatchSumBits, file, HistDsmL3InputPatchSumBitsName);
01017 FIND_HISTO(TH1F, HistDsmL3InputBackToBackBit, file, HistDsmL3InputBackToBackBitName);
01018 FIND_HISTO(TH1F, HistDsmL3InputJPsiTopoBit, file, HistDsmL3InputJPsiTopoBitName);
01019 FIND_HISTO(TH1F, HistDsmL3InputJetPatchTopoBit, file, HistDsmL3InputJetPatchTopoBitName);
01020
01021 if (!pad) return;
01022 pad->Clear();
01023 pad->cd(0);
01024
01025 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
01026 c->Draw();
01027 c->cd(0);
01028 c->Divide(2, 1, 0.001, 0.001);
01029
01030 c->cd(1);
01031 if (HistDsmL3InputHighTowerBits) {
01032
01033 HistDsmL3InputHighTowerBits->Draw();
01034 }
01035
01036 c->cd(2);
01037 if (HistDsmL3InputPatchSumBits) {
01038
01039 HistDsmL3InputPatchSumBits->Draw();
01040 }
01041
01042 }
01043
01044 void BEMCPlotsPresenter::displaySmdFeeSum(FileType file, TPad *pad, Int_t mDebug) {
01045 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
01046
01047 if (!pad) return;
01048 pad->Clear();
01049 pad->cd(0);
01050
01051
01052 Int_t linesColor = 16;
01053 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
01054 c->Draw();
01055
01056 c->Divide(1, 2, 0.001, 0.001);
01057
01058 for (int nonzs = 0;nonzs <= 1;nonzs++) {
01059 c->cd(1 + nonzs);
01060 FIND_HISTO(TH2F, HistSmdFeeSum, file, nonzs ? HistSmdFeeSumNonZSName : HistSmdFeeSumName);
01061 if (HistSmdFeeSum) {
01062 HistSmdFeeSum->SetStats(0);
01063 HistSmdFeeSum->Draw("COLZ");
01064 Int_t moduleRdo[120];
01065 if(BEMCDecoderPresenter) {
01066 Int_t RDO, index;
01067 for (Int_t module = 1;module <= 120;module++) {
01068 moduleRdo[module - 1] = -1;
01069 if (BEMCDecoderPresenter->GetSmdRDO(3, module, 1, 1, RDO, index)) {
01070 moduleRdo[module - 1] = RDO;
01071 }
01072
01073 }
01074 }
01075 Int_t curmod = 1;
01076 Int_t currdo = -1;
01077 Int_t beginrdo = -1;
01078 Int_t endrdo = -1;
01079 while (curmod <= 121) {
01080
01081 if (((curmod <= 120) && (moduleRdo[curmod - 1] != currdo)) || (curmod == 121)) {
01082 if ((currdo == -1) && (curmod <= 120)) {
01083 beginrdo = curmod;
01084 currdo = moduleRdo[curmod - 1];
01085 curmod++;
01086 } else {
01087 endrdo = curmod - 1;
01088 TLine *lRdoBegin = new TLine(beginrdo - 0.5, HistSmdFeeSum->GetYaxis()->GetBinLowEdge(1), beginrdo - 0.5, HistSmdFeeSum->GetYaxis()->GetBinUpEdge(HistSmdFeeSum->GetYaxis()->GetNbins()));
01089 if (lRdoBegin) {
01090 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lRdoBegin);
01091 lRdoBegin->SetLineColor(linesColor);
01092 lRdoBegin->SetLineWidth(1);
01093 lRdoBegin->Draw();
01094 }
01095 TLine *lRdoEnd = new TLine(endrdo + 0.5, HistSmdFeeSum->GetYaxis()->GetBinLowEdge(1), endrdo + 0.5, HistSmdFeeSum->GetYaxis()->GetBinUpEdge(HistSmdFeeSum->GetYaxis()->GetNbins()));
01096 if (lRdoEnd) {
01097 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lRdoEnd);
01098 lRdoEnd->SetLineColor(linesColor);
01099 lRdoEnd->SetLineWidth(1);
01100 lRdoEnd->Draw();
01101 }
01102 TString label;
01103 label = Form("RDO %i", currdo);
01104 TLatex *text = new TLatex(beginrdo + 1 -0.5, 0.8 * HistSmdFeeSum->GetYaxis()->GetBinUpEdge(HistSmdFeeSum->GetYaxis()->GetNbins()), label.Data());
01105 if (text) {
01106 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(text);
01107 text->SetTextColor(linesColor);
01108 text->SetTextSize(0.03);
01109 text->Draw();
01110 }
01111 currdo = -1;
01112 if (curmod > 120) curmod++;
01113 }
01114 } else {
01115 curmod++;
01116 }
01117 }
01118 }
01119 }
01120 }
01121
01122 void BEMCPlotsPresenter::displayPsdFeeSum(FileType file, TPad *pad, Int_t mDebug) {
01123 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
01124
01125 if (!pad) return;
01126 pad->Clear();
01127 pad->cd(0);
01128
01129
01130 Int_t linesColor = 16;
01131 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
01132 c->Draw();
01133
01134 c->Divide(1, 2, 0.001, 0.001);
01135
01136 for (int nonzs = 0;nonzs <= 1;nonzs++) {
01137 c->cd(1 + nonzs);
01138 FIND_HISTO(TH2F, HistPsdFeeSum, file, nonzs ? HistPsdFeeSumNonZSName : HistPsdFeeSumName);
01139 if (HistPsdFeeSum) {
01140 HistPsdFeeSum->SetStats(0);
01141 HistPsdFeeSum->Draw("COLZ");
01142 Int_t pmtRdo[60];
01143 for (Int_t box = 0;box < 60;box++) pmtRdo[box] = -1;
01144 if(BEMCDecoderPresenter) {
01145 for (Int_t rdo = 0;rdo < 4;rdo++) {
01146 for (Int_t index = 0;index < 4800;index++) {
01147 Int_t id, box, wire, Avalue;
01148 if (BEMCDecoderPresenter->GetPsdId(rdo, index, id, box, wire, Avalue)) {
01149 if ((box >= 1) && (box <= 60)) {
01150 pmtRdo[box - 1] = rdo + 8;
01151 }
01152 }
01153 }
01154 }
01155 }
01156 Int_t curmod = 1;
01157 Int_t currdo = -1;
01158 Int_t beginrdo = -1;
01159 Int_t endrdo = -1;
01160 while (curmod <= 61) {
01161
01162 if (((curmod <= 60) && (pmtRdo[curmod - 1] != currdo)) || (curmod == 61)) {
01163 if ((currdo == -1) && (curmod <= 60)) {
01164 beginrdo = curmod;
01165 currdo = pmtRdo[curmod - 1];
01166 curmod++;
01167 } else {
01168 endrdo = curmod - 1;
01169 TLine *lRdoBegin = new TLine(beginrdo - 0.5, HistPsdFeeSum->GetYaxis()->GetBinLowEdge(1), beginrdo - 0.5, HistPsdFeeSum->GetYaxis()->GetBinUpEdge(HistPsdFeeSum->GetYaxis()->GetNbins()));
01170 if (lRdoBegin) {
01171 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lRdoBegin);
01172 lRdoBegin->SetLineColor(linesColor);
01173 lRdoBegin->SetLineWidth(1);
01174 lRdoBegin->Draw();
01175 }
01176 TLine *lRdoEnd = new TLine(endrdo + 0.5, HistPsdFeeSum->GetYaxis()->GetBinLowEdge(1), endrdo + 0.5, HistPsdFeeSum->GetYaxis()->GetBinUpEdge(HistPsdFeeSum->GetYaxis()->GetNbins()));
01177 if (lRdoEnd) {
01178 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(lRdoEnd);
01179 lRdoEnd->SetLineColor(linesColor);
01180 lRdoEnd->SetLineWidth(1);
01181 lRdoEnd->Draw();
01182 }
01183 TString label;
01184 label = Form("RDO %i", currdo);
01185 TLatex *text = new TLatex(beginrdo + 0.5 -0.5, 0.8 * HistPsdFeeSum->GetYaxis()->GetBinUpEdge(HistPsdFeeSum->GetYaxis()->GetNbins()), label.Data());
01186 if (text) {
01187 if (BEMCPlotsCleanUp) BEMCPlotsCleanUp->Add(text);
01188 text->SetTextColor(linesColor);
01189 text->SetTextSize(0.03);
01190 text->Draw();
01191 }
01192 currdo = -1;
01193 if (curmod > 60) curmod++;
01194 }
01195 } else {
01196 curmod++;
01197 }
01198 }
01199 }
01200 }
01201 }
01202
01203 void BEMCPlotsPresenter::displayTriggerCorruption(FileType file, TPad *pad, bool hold, Int_t mDebug) {
01204 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
01205
01206 FIND_HISTO(TH1F, HistTriggerCorruptionHighTower, file, HistTriggerCorruptionHighTowerName);
01207 FIND_HISTO(TH1F, HistTriggerCorruptionPatchSum, file, HistTriggerCorruptionPatchSumName);
01208 FIND_HISTO(TH2F, HistDSM0HTCorr, file, HistDSM0HTCorrName);
01209 FIND_HISTO(TH2F, HistDSM0TPCorr, file, HistDSM0TPCorrName);
01210
01211 if (!pad) return;
01212 pad->Clear();
01213 pad->cd(0);
01214
01215
01216
01217 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
01218 c->Draw();
01219 c->cd(0);
01220
01221
01222 c->Divide(2, 1, 0.001, 0.001);
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232
01233
01234
01235
01236 c->cd(1);
01237 if (HistDSM0HTCorr) {
01238 HistDSM0HTCorr->SetStats(0);
01239 HistDSM0HTCorr->Draw("COLZ");
01240 }
01241 c->cd(2);
01242 if (HistDSM0TPCorr) {
01243 HistDSM0TPCorr->SetStats(0);
01244 HistDSM0TPCorr->Draw("COLZ");
01245 }
01246 }
01247
01248
01249
01250 void BEMCPlotsPresenter::displayAdcEtaPhi( FileType file, TPad *pad, Int_t mDebug)
01251 {
01252 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
01253
01254 FIND_HISTO(TH2F, Hist_ADCEtaPhi_TowHits, file, Hist_ADCEtaPhi_TowHitsName);
01255 FIND_HISTO(TH2F, Hist_ADCEtaPhi_Pre1Hits, file, Hist_ADCEtaPhi_Pre1HitsName);
01256
01257 if (!pad) return;
01258 pad->Clear();
01259 pad->cd(0);
01260
01261 TPad* c = new TPad("pad2", "apd2",0.0,0.1,1.,1.);
01262 c->Draw();
01263 c->cd(0);
01264 c->Divide(1, 2);
01265
01266 c->cd(1);
01267 if (Hist_ADCEtaPhi_TowHits) {
01268 Hist_ADCEtaPhi_TowHits->SetStats(0);
01269 Hist_ADCEtaPhi_TowHits->Draw("H COLZ");
01270 }
01271 c->cd(2);
01272 if (Hist_ADCEtaPhi_Pre1Hits) {
01273 Hist_ADCEtaPhi_Pre1Hits->SetStats(0);
01274 Hist_ADCEtaPhi_Pre1Hits->Draw("H COLZ");
01275 }
01276
01277 }
01278
01279 #undef FIND_HISTO
01280
01281
01282 void BEMCPlotsPresenter::displayTab(Int_t tab, Int_t panel, FileType file, TPad *pad, const Char_t *bemcStatusFilename, Int_t mDebug) {
01283
01284 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
01285 if (BEMCPlotsCleanUp) {
01286 BEMCPlotsCleanUp->Delete();
01287 }
01288 if (!BEMCDecoderPresenter) BEMCDecoderPresenter = new StEmcDecoder();
01289
01290 static bool first = true;
01291 static BemcTwMask *twMask = 0;
01292 if (first) {
01293 twMask = new BemcTwMask;
01294 bool twMaskFound = useBtowMask(bemcStatusFilename, twMask);
01295 if (!twMaskFound) {
01296 delete twMask;
01297 twMask=0;
01298 }
01299 first = false;
01300 }
01301
01302 if (mDebug >= 2) cout << "tab = " << tab << endl;
01303 if (mDebug >= 2) cout << "panel = " << panel << endl;
01304 if (!file.file() || (mDebug >= 2)) cout << "file = " << file.file() << endl;
01305 if (!pad || (mDebug >= 2)) cout << "pad = " << pad << endl;
01306 if (!BEMCDecoderPresenter || (mDebug >= 2)) cout << "BEMCDecoderPresenter = " << BEMCDecoderPresenter << endl;
01307
01308 if (tab == 0) {
01309 if (panel == 0) {
01310 displayStatus(file, pad, mDebug);
01311 } else if (panel == 1) {
01312 displayTowers(file, pad, mDebug);
01313 } else if (panel == 2) {
01314 displaySMDPSD(file, pad, mDebug);
01315 } else if (panel == 3) {
01316 displayTrigger(file, pad, mDebug);
01317 } else if (panel == 4) {
01318 displayJet(file, pad, mDebug);
01319 } else if (panel == 5) {
01320 displayRawAdc(file, pad, false, false, twMask, mDebug);
01321 } else if (panel == 6) {
01322 displayJetPatchHT(file, pad, mDebug);
01323 } else if (panel == 7) {
01324 displayJetPatchSum(file, pad, mDebug);
01325
01326
01327 }
01328 else if (panel == 8) {
01329 displayL1Input(file, pad, mDebug);
01330 } else if (panel == 9) {
01331 displayL2Input(file, pad, mDebug);
01332
01333
01334
01335
01336
01337
01338
01339
01340 }
01341 }
01342 if (tab == 1) {
01343 if (panel == 0) {
01344 displayRawAdc(file, pad, false, true, twMask, mDebug);
01345 } else if (panel == 1) {
01346 displayAdcEtaPhi(file, pad, mDebug);
01347 } else if (panel == 2) {
01348 displaySmdFeeSum(file, pad, mDebug);
01349 } else if (panel == 3) {
01350 displayPsdFeeSum(file, pad, mDebug);
01351 } else if (panel == 4) {
01352 displayRawAdc(file, pad, true, false, twMask, mDebug);
01353 } else if (panel == 5) {
01354 displayL0Input(file, pad, mDebug);
01355 } else if (panel == 6) {
01356 displayTriggerCorruption(file, pad, true, mDebug);
01357 }
01358 }
01359 if (mDebug >= 10) cout << __FILE__ << ":" << __LINE__ << endl;
01360 }
01361
01362 void BEMCPlotsPresenter::displayTab(int tab, int panel, FileType file, TPad *pad, int mDebug) {
01363 BEMCPlotsPresenter::displayTab(tab, panel, file, pad, gEnv->GetValue("Online.bemcStatus", "bemcStatus.txt"), mDebug);
01364 }