16 #include <TMultiGraph.h> 78 const Int_t
NRGBs = 3;
79 const Int_t
NCont = 255;
81 Double_t
red[
NRGBs] = { 1.00, 1.00, 0.60};
83 Double_t
blue[
NRGBs] = { 0.99, 0.70, 0.00};
85 TColor::CreateGradientColorTable(NRGBs, stops, red, green, blue, NCont);
86 gStyle->SetNumberContours(NCont);
169 in.open(infile.c_str());
173 std::vector<std::string> newfiles;
177 newfiles.push_back(line);
180 TChain ch(
"OnMonSummary");
181 for(
unsigned int i=0;
i<newfiles.size()-1;
i++){
182 ch.Add(&newfiles[
i][0]);
189 ch.SetBranchAddress(
"fRateSummaryNt", &Nt);
191 static const unsigned int DB_size = 16;
192 static const unsigned int DCM_size = 13;
193 static const unsigned int FEB_size = 64;
194 static const unsigned int PIX_size = 33;
195 TH2D* HighRatesDCMs[DB_size];
196 TH2D* AllTheDCMs[DB_size];
197 TH2D* HighRatesFEBs[DB_size][DCM_size];
198 TH2D* AllTheFEBs[DB_size][DCM_size];
201 for(
unsigned int i = 0;
i < DB_size; ++
i) {
202 HighRatesDCMs[
i] = 0;
204 for(
unsigned int j = 0;
j < DCM_size; ++
j) {
205 HighRatesFEBs[
i][
j] = 0;
206 AllTheFEBs[
i][
j] = 0;
210 int n_entries = ch.GetEntries();
214 if(runlo==0 && runhi==0){
217 ch.GetEntry(n_entries-1);
225 int runbins = (runhi-runlo)/runsperbin;
226 int runhitbins = (runhi-runlo)*64;
228 TH1D* AllRates =
new TH1D(
"AllPixelHitRates",
229 "Rate in all Pixels;log10(rate (Hz));pixels*subrun", 70, -1, 6);
230 TH1D* AllRatesHi =
new TH1D(
"AllPixelHitRatesHi",
231 "High ADC Rate in all Pixels;log10(rate (Hz));pixels*subrun", 70, -1, 6);
232 TH1D* AllRatesLo =
new TH1D(
"AllPixelHitRatesLo",
233 "Low ADC Rate in all Pixels;log10(rate (Hz));pixels*subrun", 70, -1, 6);
234 TH1D* AllDropouts =
new TH1D(
"AllDropouts",
235 "Dropout Count per FEB;Count;FEBs*subrun", 500, 0, 500);
236 TH1D* AllDropouts13 =
new TH1D(
"AllDropouts13",
237 "Dropout Count per FEB in DB01-03;Count;FEBs*subrun", 500, 0, 500);
238 TH2D* RatesPerRun =
new TH2D(
"RatesPerRun",
239 "Rate in all Pixels per run;run;log10(rate (Hz))",runbins, runlo, runhi, 70,-1,7);
243 for (
unsigned int i = 0;
i < n_entries; ++
i)
246 if(Nt->
run!= pastrun && Nt->
run % 5 == 0){
250 double RUN = (double)(Nt->
run)+((double)(Nt->
subrun)/64.0);
253 AllRates->Fill(lograte);
254 RatesPerRun->Fill(RUN,lograte);
258 AllRatesLo->Fill(logratelo);
262 AllRatesHi->Fill(logratehi);
266 AllDropouts->Fill(dropoutFEB);
267 if (Nt->
db < 4) AllDropouts13->Fill(dropoutFEB);
269 if(AllTheDCMs[Nt->
db] == 0){
270 char ratehistoname[50];
271 sprintf(ratehistoname,
"AllTheDCMs_%.2u", Nt->
db);
272 char ratehistotitle[100];
273 sprintf(ratehistotitle,
"All rates on DCMs for DB%.2u;run;DCM", Nt->
db);
275 AllTheDCMs[Nt->
db] =
new TH2D(ratehistoname, ratehistotitle, runbins, runlo, runhi, 4, 1, 5);
277 if(AllTheFEBs[Nt->
db][Nt->
dcm] == 0){
278 char ratehistoname[50];
279 sprintf(ratehistoname,
"AllTheFEBs_%.2u_%.2u", Nt->
db, Nt->
dcm);
280 char ratehistotitle[100];
281 sprintf(ratehistotitle,
"All rates on FEBs for DB%.2u DCM%.2u;run;FEB", Nt->
db, Nt->
dcm);
282 AllTheFEBs[Nt->
db][Nt->
dcm] =
new TH2D(ratehistoname, ratehistotitle, runbins, runlo, runhi, 64, 0, 64);
284 AllTheDCMs[Nt->
db]->Fill(RUN,Nt->
dcm);
285 AllTheFEBs[Nt->
db][Nt->
dcm]->Fill(RUN,Nt->
feb);
287 if(HighRatesFEBs[Nt->
db][Nt->
dcm] == 0){
288 char hratehistoname[50];
289 sprintf(hratehistoname,
"HighRateFEB_%.2u_%.2u", Nt->
db, Nt->
dcm);
290 char ratehistotitle[100];
291 sprintf(ratehistotitle,
"Fraction of noise incidents (DB%.2u DCM%.2u);run;FEB", Nt->
db, Nt->
dcm);
292 HighRatesFEBs[Nt->
db][Nt->
dcm] =
new TH2D(hratehistoname, ratehistotitle, runbins, runlo, runhi, 64, 0, 64);
294 if(HighRatesDCMs[Nt->
db] == 0){
295 char hratehistoname[50];
296 sprintf(hratehistoname,
"HighRateDCM_%.2u", Nt->
db);
297 char ratehistotitle[100];
298 sprintf(ratehistotitle,
"Fraction of noise incidents (DB%.2u);run;DCM", Nt->
db);
300 HighRatesDCMs[Nt->
db] =
new TH2D(hratehistoname, ratehistotitle, runbins, runlo, runhi, 4, 1, 5);
302 HighRatesDCMs[Nt->
db]->Fill(RUN,Nt->
dcm);
303 HighRatesFEBs[Nt->
db][Nt->
dcm]->Fill(RUN,Nt->
feb);
309 sprintf(outfilename,
"Onmon_ana-Histos-run%.2u-%.2u.root", runlo, runhi-1);
310 TFile*
out_file =
new TFile(outfilename,
"RECREATE");
311 out_file->mkdir(
"DCMPlots");
317 AllDropouts->Write();
318 AllDropouts13->Write();
320 RatesPerRun->Write();
322 for(
unsigned int i = 1;
i < DB_size; ++
i) {
323 if( AllTheDCMs[
i] !=0 && HighRatesDCMs[
i] !=0) {
324 HighRatesDCMs[
i]->Divide(AllTheDCMs[
i]);
325 AllTheDCMs[
i]->GetYaxis()->SetNdivisions(MapYdiv);
326 HighRatesDCMs[
i]->GetYaxis()->SetNdivisions(MapYdiv);
327 HighRatesDCMs[
i]->GetYaxis()->SetLabelSize(MapLblS);
328 HighRatesDCMs[
i]->GetXaxis()->SetLabelSize(MapLblS);
329 HighRatesDCMs[
i]->GetXaxis()->SetTitleSize(MapLblS);
330 HighRatesDCMs[
i]->GetYaxis()->SetTitleSize(MapLblS);
331 HighRatesDCMs[
i]->GetYaxis()->SetTitleOffset(MapYoff);
332 HighRatesDCMs[
i]->Write();
336 out_file->cd(
"DCMPlots");
337 for(
unsigned int i = 1;
i < DB_size; ++
i) {
338 for(
unsigned int j = 1;
j < DCM_size; ++
j) {
339 if( AllTheFEBs[
i][
j] !=0 && HighRatesFEBs[
i][
j]) {
340 HighRatesFEBs[
i][
j]->Divide(AllTheFEBs[
i][j]);
341 AllTheFEBs[
i][
j]->GetYaxis()->SetNdivisions(64);
342 AllTheFEBs[
i][
j]->GetYaxis()->SetLabelSize(0.015);
343 HighRatesFEBs[
i][
j]->GetYaxis()->SetNdivisions(64);
344 HighRatesFEBs[
i][
j]->GetYaxis()->SetLabelSize(0.015);
345 HighRatesFEBs[
i][
j]->GetXaxis()->SetLabelSize(0.025);
346 HighRatesFEBs[
i][
j]->Write();
354 for(
unsigned int i = 1;
i < DB_size; ++
i) {
355 TCanvas* cPerDB =
new TCanvas(
"perDB",
"perDB",800,310);
356 if( AllTheDCMs[
i] !=0 && HighRatesDCMs[
i] !=0) {
358 AllTheDCMs[
i]->GetYaxis()->SetNdivisions(MapYdiv);
359 HighRatesDCMs[
i]->GetYaxis()->SetNdivisions(MapYdiv);
360 HighRatesDCMs[
i]->Draw(
"colz");
361 HighRatesDCMs[
i]->SetStats(0);
364 sprintf(plottitle,
"PinkPlots/DCMsNoiseHistoryDB%.2u_%.2u-%.2u.png",
i,runlo,runhi);
366 cPerDB->Print(plottitle,
"png");
370 for(
unsigned int i = 1;
i < DB_size; ++
i) {
371 for(
unsigned int j = 1;
j < DCM_size; ++
j) {
372 TCanvas* cPerDCM =
new TCanvas(
"perDCM",
"perDCM",800,600);
373 if( AllTheFEBs[
i][
j] !=0 && HighRatesFEBs[
i][
j]) {
375 AllTheFEBs[
i][
j]->GetYaxis()->SetNdivisions(64);
376 AllTheFEBs[
i][
j]->GetYaxis()->SetLabelSize(0.015);
377 HighRatesFEBs[
i][
j]->GetYaxis()->SetNdivisions(64);
378 HighRatesFEBs[
i][
j]->GetYaxis()->SetLabelSize(0.015);
379 HighRatesFEBs[
i][
j]->GetXaxis()->SetLabelSize(0.025);
380 HighRatesFEBs[
i][
j]->Draw(
"colz");
381 HighRatesFEBs[
i][
j]->SetStats(0);
384 sprintf(plottitle,
"PinkPlots/APDsNoiseHistoryDB%.2uDCM%.2u_%.2u-%.2u.png",
i,j,runlo,runhi);
386 cPerDCM->Print(plottitle,
"png");
393 TCanvas* cAllRates =
new TCanvas(
"AllRates",
"AllRates",800,500);
396 TCanvas* cAllDrops =
new TCanvas(
"AllDrops",
"AllDrops",800,500);
397 AllDropouts->SetLineColor(kPink+6);
398 AllDropouts->SetFillColor(kPink+6);
400 AllDropouts13->SetLineColor(
kBlue+1);
401 AllDropouts13->SetFillColor(
kBlue);
402 AllDropouts13->Draw(
"same");
403 TLegend *
legend =
new TLegend(0.6,0.6,0.85,0.85);
404 legend->AddEntry(AllDropouts,
"All DB",
"l");
405 legend->AddEntry(AllDropouts13,
"DB 01-03",
"l");
406 legend->SetFillStyle(4000);
407 legend->SetLineColor(0);
408 legend->SetFillColor(0);
410 cAllDrops->SetLogy();
411 cAllDrops->SetLogx();
412 AllDropouts->SetStats(0);
413 AllDropouts13->SetStats(0);
416 TCanvas* cRatePerRun =
new TCanvas(
"RatePerRun",
"RatePerRun",800,500);
417 RatesPerRun->Draw(
"colz");
419 TCanvas* cAllDCMsDB1 =
new TCanvas(
"AllDCMsDB1",
"AllDCMsDB1",1000,500);
420 cAllDCMsDB1->Divide(2);
422 AllTheFEBs[1][2]->Draw(
"colz");
423 AllTheFEBs[1][2]->SetStats(0);
425 HighRatesFEBs[1][2]->Draw(
"colz");
426 HighRatesFEBs[1][2]->SetStats(0);
428 TCanvas* cHighRatesDCMsDB1Ratio =
new TCanvas(
"HighRatesDCMsDB1Ratio",
"HighRatesDCMsDB1Ratio",800,330);
429 HighRatesDCMs[1]->Draw(
"colz");
430 HighRatesDCMs[1]->SetStats(0);
431 cHighRatesDCMsDB1Ratio->SetGridy();
433 TCanvas* cHighRatesFEBDCM1DB1Ratio =
new TCanvas(
"HighRatesFEBDCM1DB1Ratio",
"HighRatesFEBDCM1DB1Ratio",800,600);
434 HighRatesFEBs[1][2]->Draw(
"colz");
435 HighRatesFEBs[1][2]->SetStats(0);
436 cHighRatesFEBDCM1DB1Ratio->SetGridy();
void OnMonAnaHistos(int idet, const std::string &infile)
string outfilename
knobs that need extra care
out_file
Append EOF lines.