2 #if !defined(__CINT__) || defined(__MAKECINT__) 7 #include "TGraphAsymmErrors.h" 15 #include "TObjArray.h" 17 #include "TObjString.h" 23 #include "TGridResult.h" 28 #include "AliCDBManager.h" 29 #include "AliCDBEntry.h" 30 #include "AliCDBPath.h" 31 #include "AliCDBStorage.h" 33 #include "AliMUONTriggerUtilities.h" 34 #include "AliMUONDigitMaker.h" 35 #include "AliMUONVDigit.h" 36 #include "AliMUONDigitStoreV2R.h" 37 #include "AliMUONCalibrationData.h" 38 #include "AliAnalysisTriggerScalers.h" 39 #include "AliCounterCollection.h" 40 #include "AliTriggerConfiguration.h" 50 gStyle->SetCanvasColor(10);
51 gStyle->SetFrameFillColor(10);
52 gStyle->SetStatColor(10);
53 gStyle->SetFillColor(10);
54 gStyle->SetTitleFillColor(10);
56 gStyle->SetTitleXSize(0.03);
57 gStyle->SetTitleXOffset(1.1);
58 gStyle->SetTitleYSize(0.03);
59 gStyle->SetTitleYOffset(1.9);
61 gStyle->SetMarkerSize(0.7);
62 gStyle->SetHistLineWidth(2);
64 gStyle->SetPadLeftMargin(0.12);
65 gStyle->SetPadRightMargin(0.04);
66 gStyle->SetPadBottomMargin(0.12);
67 gStyle->SetPadTopMargin(0.03);
75 return ( stringToken.IsDigit() && stringToken.Length()>=6 && stringToken.Length()<=9 );
84 TAxis* axis = histo->GetXaxis();
85 if ( runAxis ==
"Y" ) axis = histo->GetYaxis();
86 else if ( runAxis ==
"Z" ) axis = histo->GetZaxis();
87 histo->LabelsOption(
"v",runAxis.Data());
88 axis->SetLabelSize(0.02);
89 for (
Int_t ibin=1; ibin<=axis->GetNbins(); ibin++ ) {
90 TString binLabel = axis->GetBinLabel(ibin);
91 if ( ! binLabel.IsNull())
continue;
92 axis->SetRange(1, ibin-1);
101 TObjArray* array = filePath.Tokenize(
"/");
105 for (
Int_t ientry=0; ientry<array->GetEntries(); ientry++ ) {
106 auxString = array->At(ientry)->GetName();
108 runNum = auxString.Atoi();
115 array = auxString.Tokenize(
"_");
117 auxString = array->Last()->GetName();
118 auxString.ReplaceAll(
".root",
"");
119 if (
IsRunNum(auxString) ) runNum = auxString.Atoi();
131 Double_t relErr = 0., relProdErrSquare = 0.;
132 for (
Int_t iprod=0; iprod<nFactors; iprod++ ) {
133 if ( iprod == exclude )
continue;
134 prod *= effErr[iprod];
135 relErr = ( effErr[iprod] >
kZero ) ? effErr[iprod+nFactors]/effErr[iprod] : 0.;
136 relProdErrSquare += relErr*relErr;
141 prodErr[1] = prod*TMath::Sqrt(relProdErrSquare);
153 if ( ich == exclude ) {
154 effErr[ich] = ( effErr1[ich] < 1. ) ? ( effErr2[ich] - effErrBoth[ich] ) / ( 1. - effErr1[ich] ) : 0.;
155 effErr[ich+
kNch] = 0;
156 if ( effErr1[ich] < 1. ) {
157 Double_t err2 = effErr2[ich+
kNch] / ( 1. - effErr1[ich] );
158 Double_t errBoth = effErrBoth[ich+
kNch] / ( 1. - effErr1[ich] );
159 Double_t err1 = effErr1[ich+
kNch] * effErr[ich] / ( 1. - effErr1[ich] );
160 effErr[ich+
kNch] = TMath::Sqrt(err2*err2 + errBoth*errBoth + err1*err1);
164 effErr[ich] = ( effErr1[ich] >
kZero ) ? effErrBoth[ich]/effErr1[ich] : 0.;
165 Double_t relErr1 = ( effErr1[ich] >
kZero ) ? effErr1[ich+kNch]/effErr1[ich] : 0.;
166 Double_t relErrBoth = ( effErrBoth[ich] >
kZero ) ? effErrBoth[ich+kNch]/effErrBoth[ich] : 0.;
167 effErr[ich+
kNch] = effErr[ich] * TMath::Sqrt(relErr1*relErr1 + relErrBoth*relErrBoth);
180 Double_t defaultEffErr[2] = {1.,0.};
184 effErrBinomial[0] = 0.;
185 effErrBinomial[1] = 0.;
187 for (
Int_t ich = -1; ich<
kNch; ich++ ) {
190 currEffErr[0] = currEffErr[0] - currEffErr44[0];
191 currEffErr[1] = TMath::Sqrt(currEffErr[1]*currEffErr[1] + currEffErr44[1]*currEffErr44[1]);
198 for (
Int_t ival=0; ival<2; ival++ ) {
199 effProd[2*ival] = currEffErr[ival];
200 effProd[2*ival+1] = ( effErr2 ) ? auxBinomial[ival] : defaultEffErr[ival];
202 if ( ich < 0 ) currEffErr44 = currEffErr;
203 else delete [] currEffErr;
204 delete [] auxBinomial;
208 effErrBinomial[0] += effErr[0];
209 effErrBinomial[1] += effErr[1]*effErr[1];
213 delete [] currEffErr44;
215 effErrBinomial[1] = TMath::Sqrt(effErrBinomial[1]);
217 return effErrBinomial;
228 if ( runNum >= 0 ) AliCDBManager::Instance()->SetRun(runNum);
229 TList* list = AliCDBManager::Instance()->GetAll(cdbDir.Data());
230 if ( list->GetEntries() == 0 ) {
231 printf(
"Warning: no entry found in %s for run %i\n",cdbDir.Data(),runNum);
241 TString storageType = AliCDBManager::Instance()->GetDefaultStorage()->GetType();
242 Bool_t isGrid = storageType.Contains(
"alien");
243 TString baseFolder = AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder();
247 TObjArray* dirNameList = ocdbDirs.Tokenize(
",");
248 for (
Int_t idir=0; idir<dirNameList->GetEntries(); idir++ ) {
249 TString fullPath = Form(
"%s/%s",baseFolder.Data(),dirNameList->At(idir)->GetName());
251 TGridResult *res = gGrid->Ls(fullPath.Data());
252 if (!res)
return 0x0;
253 for (
Int_t ires=0; ires<res->GetEntries(); ires++ ) {
254 TString currFile =
static_cast<TMap*
>(res->At(ires))->GetValue(
"name")->GetName();
255 outList->Add(
new TObjString(currFile));
260 TString fileListStr =
gSystem->GetFromPipe(Form(
"ls %s",fullPath.Data()));
261 TObjArray* fileList = fileListStr.Tokenize(
"\n");
262 for (
Int_t ires=0; ires<fileList->GetEntries(); ires++ ) {
263 TString currFile = fileList->At(ires)->GetName();
264 outList->Add(
new TObjString(currFile));
277 if ( defaultStorage.IsNull() ) {
278 printf(
"Default storage not specified. Nothing done\n");
282 if ( AliCDBManager::Instance()->IsDefaultStorageSet() ) {
283 printf(
"Default storage already set: nothing done\n");
287 if ( defaultStorage.Contains(
"alien://") || defaultStorage.Contains(
"raw://") ) {
288 if ( ! gGrid ) TGrid::Connect(
"alien://");
290 printf(
"Error: Problem connetting to grid: default storage not set\n");
295 AliCDBManager::Instance()->SetDefaultStorage(defaultStorage.Data());
297 if ( defaultStorage.Contains(
"raw://") )
return kTRUE;
301 if ( AliCDBManager::Instance()->IsDefaultStorageSet() ) {
302 TString searchDir =
"MUON/Calib/MappingData";
303 TString fullPath = Form(
"%s/%s",defaultStorage.Data(),searchDir.Data());
305 if ( ocdbList->GetEntries() == 0 ) {
306 printf(
"No entries in %s\n",fullPath.Data());
310 TString checkFile = Form(
"%s/%s",fullPath.Data(),ocdbList->At(0)->GetName());
311 checkFile.ReplaceAll(
"local://",
"");
312 checkFile.ReplaceAll(
"folder=",
"");
313 checkFile.ReplaceAll(
"Folder=",
"");
314 TFile*
file = TFile::Open(checkFile.Data());
316 printf(
"Cannot access test file: %s\n", checkFile.Data());
324 printf(
"Tried to set the default storage, but something went wrong.\n");
328 if ( ! isOk ) printf(
"Please check path %s\n",defaultStorage.Data());
337 if ( ! fileList )
return kTRUE;
338 for (
Int_t ifile=0; ifile<fileList->GetEntries(); ifile++ ) {
339 TString filename =
static_cast<TObjString*
>(fileList->At(ifile))->GetString();
340 filename.ReplaceAll(
"Run",
"");
341 TObjArray* array = filename.Tokenize(
"_");
342 Int_t firstRun =
static_cast<TObjString*
>(array->At(0))->GetString().Atoi();
343 Int_t lastRun =
static_cast<TObjString*
>(array->At(1))->GetString().Atoi();
345 Bool_t isCurrRunInside = ( currRun >= firstRun && currRun <= lastRun );
346 Bool_t isPreviousRunInside = ( previousRun >= firstRun && previousRun <= lastRun );
347 if ( isCurrRunInside != isPreviousRunInside )
return kTRUE;
357 TString physSel =
"PhysSelPass,PhysSelReject";
361 for (
Int_t ieff=0; ieff<2; ieff++ ) {
366 an.
SetEffConditions(physSel,trigClass,centrClass,trackSel,matchTrig,effType);
369 Int_t nCanvases = gROOT->GetListOfCanvases()->GetEntries();
374 TString baseName = ( ieff == 0 ) ?
"Trigger" :
"Tracker";
375 for (
Int_t ican=nCanvases; ican<gROOT->GetListOfCanvases()->GetEntries(); ican++ ) {
376 TCanvas* can =
static_cast<TCanvas*
>(gROOT->GetListOfCanvases()->At(ican));
377 can->SetName(Form(
"%s_from%s",baseName.Data(),can->GetName()));
378 can->SetTitle(Form(
"%s_from%s",baseName.Data(),can->GetTitle()));
380 TPad* pad =
new TPad(Form(
"%s_text",can->GetName()),
"",0.35,0.97,0.65,1.);
381 pad->SetFillStyle(4000);
385 tex.SetTextSize(0.75);
386 tex.DrawLatexNDC(0.1,0.1,Form(
"From %s track",baseName.Data()));
402 TString histoName =
"", histoTitle =
"";
403 for(
Int_t icath=0; icath<2; icath++){
404 TString cathName = ( icath==0 ) ?
"bendPlane" :
"nonBendPlane";
406 histoName = Form(
"%sMaskCh%i", cathName.Data(), 11+ich);
407 histoTitle = Form(
"Chamber %i - %s: fraction of masked channels", 11+ich, cathName.Data());
408 TH2* histo =
new TH2D(histoName.Data(), histoTitle.Data(),1,0.,1., 234, 0.5, 234. + 0.5);
409 histo->GetYaxis()->SetTitle(
"Board Id");
411 Int_t imask = 2*ich + icath;
412 maskedList.AddAt(histo, imask);
413 auxList.AddAt(histo->Clone(Form(
"%s_aux",histoName.Data())), imask);
417 TArrayS xyPatternAll[2];
418 for(
Int_t icath=0; icath<2; icath++){
419 xyPatternAll[icath].Set(
kNch);
420 xyPatternAll[icath].Reset(0xFFFF);
423 TList* ocdbFileList = 0x0;
424 Int_t previousRun = -1;
425 AliMUONDigitMaker* digitMaker = 0x0;
426 AliMUONDigitStoreV2R digitStore;
428 AliMUONCalibrationData* calibData = 0x0;
429 AliMUONTriggerUtilities* trigUtilities = 0x0;
430 for (
Int_t irun=0; irun<runNumArray.GetEntries(); irun++ ) {
431 TString runNumString = runNumArray.At(irun)->GetName();
432 Int_t runNumber = runNumString.Atoi();
435 AliCDBManager::Instance()->SetRun(runNumber);
437 if ( ! digitMaker ) {
438 digitMaker =
new AliMUONDigitMaker(kFALSE);
440 for (
Int_t iboard=1; iboard<=234; iboard++ ) {
441 digitMaker->TriggerDigits(iboard, xyPatternAll, digitStore, kFALSE);
445 if ( ! ocdbFileList ) ocdbFileList =
GetOCDBList(
"MUON/Calib/GlobalTriggerCrateConfig,MUON/Calib/RegionalTriggerConfig,MUON/Calib/LocalTriggerBoardMasks");
448 calibData =
new AliMUONCalibrationData (runNumber);
449 delete trigUtilities;
450 trigUtilities =
new AliMUONTriggerUtilities (calibData);
453 previousRun = runNumber;
455 TIter next(digitStore.CreateIterator());
456 AliMUONVDigit* dig = 0x0;
457 while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) ) {
458 Int_t icath = dig->Cathode();
459 Int_t detElemId = dig->DetElemId();
460 Int_t ich = detElemId/100-11;
461 Int_t iboard = dig->ManuId();
462 Int_t imask = 2*ich + icath;
463 static_cast<TH2*
>(auxList.At(imask))->Fill(runNumString.Data(),iboard,1.);
464 static_cast<TH2*
>(maskedList.At(imask))->Fill(runNumString.Data(),iboard,(
Double_t)trigUtilities->IsMasked(*dig));
468 delete trigUtilities;
472 for (
Int_t imask=0; imask<maskedList.GetEntries(); imask++ ) {
473 TH2* histo =
static_cast<TH2*
>(maskedList.At(imask));
474 histo->Divide(static_cast<TH2*>(auxList.At(imask)));
477 canName = Form(
"%sCan", histo->GetName());
478 TCanvas* can =
new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
479 can->SetRightMargin(0.14);
480 histo->SetStats(kFALSE);
481 if ( histo->GetMinimum() == 0. && histo->GetMaximum() == 0. ) histo->SetMaximum(0.1);
482 histo->DrawCopy(
"COLZ");
491 for (
Int_t ipat=0; ipat<rejectArray->GetEntries(); ++ipat ) {
492 if ( trigName.Contains(rejectArray->At(ipat)->GetName() ) )
return kFALSE;
495 for (
Int_t ipat=0; ipat<keepArray->GetEntries(); ++ipat ) {
496 if ( trigName.Contains(keepArray->At(ipat)->GetName() ) )
return kTRUE;
499 return ( keepArray->GetEntries() == 0 ) ? kTRUE : kFALSE;
503 TObjArray*
BuildListOfTrigger (
const TObjArray* triggerArray,
TString keepPattern =
"",
TString rejectPattern=
"OTHER,TRUE,PHI,ANY,EMC,-ACE-,-ABCE-,WU,MUP,SPI,SHM" )
507 selectedList->SetOwner();
508 TObjArray* rejectArray = rejectPattern.Tokenize(
",");
509 TObjArray* keepArray = keepPattern.Tokenize(
",");
511 for (
Int_t iTrig = 0; iTrig < triggerArray->GetEntries(); iTrig++ ){
512 TString currTrigName = ((TObjString*)triggerArray->At(iTrig))->GetName();
513 if (
CheckPattern(currTrigName, keepArray, rejectArray) ) selectedList->AddLast(
new TObjString(currTrigName.Data()));
528 for (
Int_t iTrig = 0; iTrig < triggerArray->GetEntries(); iTrig++ ){
529 TString currTrigName = ((TObjString*)triggerArray->At(iTrig))->GetName();
530 TObjArray* array = currTrigName.Tokenize(
"-");
531 TString collisionType = array->At(1)->GetName();
533 collisionType.Append(
"-");
534 collisionType.Prepend(
"-");
535 if ( checkTrigger.Contains(collisionType.Data()) ) {
536 foundName = currTrigName;
551 TFile *
file = TFile::Open(mergedFileName.Data());
552 AliCounterCollection* ccol = (AliCounterCollection*)((TDirectoryFile*)file->FindObjectAny(
"MUON_QA"))->FindObjectAny(
"eventCounters");
555 TString triggerListName = ccol->GetKeyWords(
"trigger");
557 TObjArray selectedTriggerArray, selectedL0TriggerArray;
558 selectedTriggerArray.SetOwner();
559 selectedL0TriggerArray.SetOwner();
561 const Int_t nScaler = 3;
562 TString sScaler[nScaler] = {
"L0B",
"L2A",
"L0BRATE"};
563 enum eScaler {kL0B = 0, kL2A=1, kL0BRATE=2};
564 Float_t maxScaler[nScaler] = {1e8,1e7,1e6};
569 TString cdbDir =
"GRP/CTP/Config";
572 TString sHistName, sHistNameFull, sTitleName;
573 Int_t nRuns = runNumArray.GetEntries();
579 for (
Int_t iRun = 0; iRun < runNumArray.GetEntries(); iRun++ ) {
581 TString sRunNr = ((TObjString*)runNumArray.At(iRun))->GetString();
582 Int_t runNr = sRunNr.Atoi();
584 AliAnalysisTriggerScalers triggerScaler(runNr);
585 AliTriggerConfiguration* tc =
static_cast<AliTriggerConfiguration*
>(triggerScaler.GetOCDBObject(cdbDir.Data(),runNr));
586 const TObjArray& trClasses = tc->GetClasses();
590 for (
Int_t itype=0; itype<2; itype++ ) {
591 TObjArray* currSelectedList = ( itype == 0 ) ? &selectedTriggerArray : &selectedL0TriggerArray;
592 TString matchTrig = ( itype == 0 ) ?
"" :
"C0TVX";
596 for (
Int_t iTrig = 0; iTrig < selectedTrigArrayForRun->GetEntries(); iTrig++ ) {
598 TString currTrigName = selectedTrigArrayForRun->At(iTrig)->GetName();
599 if ( itype == 0 && ! triggerListName.Contains(currTrigName.Data()) )
continue;
600 if ( ! currSelectedList->FindObject(currTrigName.Data()) ) currSelectedList->Add(
new TObjString(currTrigName));
603 for (
Int_t iScaler = 0; iScaler < nScaler; iScaler++ ) {
605 if ( itype == 1 && iScaler != kL0B )
continue;
608 TGraph* graph = triggerScaler.PlotTrigger(currTrigName.Data(),sScaler[iScaler].Data(),kFALSE);
610 sHistName = Form(
"%s_%s",currTrigName.Data(),sScaler[iScaler].Data());
611 sHistNameFull = Form(
"Scalers_%s",sHistName.Data());
613 TH1* hist = (
TH1*) hFromScalers.FindObject(sHistNameFull);
615 hist =
new TH1D(sHistNameFull,sHistName,nRuns,1.,1.+(
Double_t)nRuns);
616 hist->LabelsOption(
"v");
617 hist->GetXaxis()->SetLabelSize(0.02);
618 hist->SetDirectory(0);
620 hist->SetMaximum(maxScaler[0]);
621 hFromScalers.AddLast(hist);
622 hOutput.AddLast(hist);
623 if ( iScaler == kL2A ) {
624 sHistNameFull =
"QA_" + sHistName;
625 hFromQA.AddLast(hist->Clone(sHistNameFull.Data()));
629 if ( tab ) hist->SetBinContent(ibin,tab[0]);
630 hist->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
634 if ( iScaler != kL2A )
continue;
635 TH1* histCounters =
static_cast<TH1*
>(ccol->Get(
"run",Form(
"run:%s/trigger:%s",sRunNr.Data(),currTrigName.Data())));
636 sHistNameFull = sHistNameFull =
"QA_" + sHistName;
637 hist = (
TH1*) hFromQA.FindObject(sHistNameFull);
638 if ( histCounters ) hist->SetBinContent(ibin,histCounters->GetSumOfWeights());
639 hist->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
647 if ( selectedTriggerArray.GetEntries() == 0 ) {
648 printf(
"No trigger selected from trigger list %s\n",triggerListName.Data());
651 printf(
"Nr of triggers selected %i\n",selectedTriggerArray.GetEntries());
653 printf(
"Nr of T0 triggers selected %i\n",selectedL0TriggerArray.GetEntries());
657 for (
Int_t itype=0; itype<2; itype++ ) {
658 TObjArray* currList = ( itype == 0 ) ? &hFromScalers : &hFromQA;
659 for (
Int_t ihisto=0; ihisto<currList->GetEntriesFast(); ihisto++ ) {
660 TH1* histo =
static_cast<TH1*
> ( currList->At(ihisto) );
661 if (!histo)
continue;
663 for (
Int_t iRun = 0; iRun < runNumArray.GetEntries(); iRun++ ) {
664 TString sRunNr = ((TObjString*)runNumArray.At(iRun))->GetString();
666 TString binLabel = histo->GetXaxis()->GetBinLabel(ibin);
667 if ( ! binLabel.IsNull() )
continue;
668 histo->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
670 histo->SetStats(kFALSE);
676 const Int_t nHisto = 3;
677 TString sHisto[nHisto] = {
"L0BoverL0BC0TVX",
"L2AoverL0B",
"L2AQAoverSCALERS"};
678 TString sTitleHisto[nHisto] = {
"L0B trigger / L0BC0TVX",
"L2A / L0B",
"L2A from QA / L2A from SCALERS"};
682 for (
Int_t iTrig = 0; iTrig < selectedTriggerArray.GetEntries(); iTrig++ ) {
684 sHistNameFull = Form(
"Scalers_%s_L0B",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
685 TH1* histo1 =
static_cast<TH1*
> ( hFromScalers.FindObject(sHistNameFull) );
686 if (!histo1)
continue;
690 TString sTrig = ( (TObjString*) selectedTriggerArray.At(iTrig) )->GetName();
693 sHistNameFull = Form(
"Scalers_%s_L0B",sL0Trig.Data());
695 TH1* histo0 =
static_cast<TH1*
> ( hFromScalers.FindObject(sHistNameFull) );
697 sHistNameFull = Form(
"%s_%s",sHisto[0].
Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
698 TH1* histo10 = (
TH1*) histo1->Clone(sHistNameFull);
699 histo10->SetTitle(sTitleHisto[0].
Data());
701 histo10->Divide(histo0);
702 histo10->SetMaximum(10);
703 histo10->SetMinimum(1e-5);
705 hOutput.AddLast(histo10);
711 sHistNameFull = Form(
"Scalers_%s_L2A",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
712 TH1* histo2 =
static_cast<TH1*
> ( hFromScalers.FindObject(sHistNameFull) );
713 if (!histo2)
continue;
715 sHistNameFull = Form(
"%s_%s",sHisto[1].
Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
716 TH1* histo3 = (
TH1*) histo2->Clone(sHistNameFull);
717 histo3->SetTitle(sTitleHisto[1]);
719 histo3->Divide(histo1);
720 histo3->SetMaximum(1.2);
721 histo3->SetMinimum(1e-5);
723 hOutput.AddLast(histo3);
726 sHistNameFull = Form(
"QA_%s_L2A",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
727 TH1* histo4 =
static_cast<TH1*
> ( hFromQA.FindObject(sHistNameFull) );
728 if (!histo4)
continue;
730 sHistNameFull = Form(
"%s_%s",sHisto[2].
Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
731 TH1* histo5 = (
TH1*) histo4->Clone(sHistNameFull);
732 histo5->SetTitle(sTitleHisto[2]);
734 histo5->Divide(histo2);
735 histo5->SetMaximum(1.2);
736 histo5->SetMinimum(5e-1);
738 hOutput.AddLast(histo5);
742 const Int_t nCanvases = nScaler + nHisto;
744 for (
Int_t iScaler = 0; iScaler < nScaler; iScaler++) sCanvases[iScaler] = sScaler[iScaler];
745 for (
Int_t iHisto = 0; iHisto < nHisto; iHisto++) sCanvases[nScaler+iHisto] = sHisto[iHisto];
748 for (
Int_t iCan = 0; iCan < nCanvases; iCan++) {
749 TCanvas*
canvas =
new TCanvas(sCanvases[iCan],sCanvases[iCan],200,10,600,600);
750 TLegend* leg =
new TLegend(0.72,0.7,0.9,0.85);
751 leg->SetBorderSize(1);
752 if ( iCan != 4 ) canvas->SetLogy();
757 for (
Int_t iTrig = 0; iTrig < selectedTriggerArray.GetEntries(); iTrig++ ) {
759 if ( iCan < nScaler ) sHistNameFull = Form(
"Scalers_%s_%s",selectedTriggerArray.At(iTrig)->GetName(),sCanvases[iCan].Data());
760 else sHistNameFull = Form(
"%s_%s",sCanvases[iCan].
Data(),selectedTriggerArray.At(iTrig)->GetName());
761 TH1* histo1 =
static_cast<TH1*
> ( hOutput.FindObject(sHistNameFull) );
762 if (!histo1)
continue;
764 if ( icolor == 10 ) icolor++;
765 histo1->SetLineColor(icolor++);
766 histo1->Draw(optDraw);
769 leg->AddEntry(histo1,selectedTriggerArray.At(iTrig)->GetName(),
"l");
783 ifstream inFile(fileListName.Data());
785 fileNameArray.SetOwner();
786 runNumArray.SetOwner();
788 if (inFile.is_open()) {
789 while (! inFile.eof() ) {
790 currString.ReadLine(inFile);
791 if ( ! currString.Contains(
".root") ||
792 currString.BeginsWith(
"#") )
continue;
793 fileNameArray.AddLast(
new TObjString(currString.Data()));
795 runNumArray.AddLast(
new TObjString(Form(
"%i",runNum)));
800 printf(
"Fatal: cannot open input file %s\n",fileListName.Data());
811 if (
gSystem->AccessPathName(trackerQAmergedOut.Data()) ) {
812 printf(
"Warning: cannot perform scaler trending:\n merged QA from tracker\n %s\n does not exist\n",trackerQAmergedOut.Data());
815 ScalerTrending(runNumArray, trackerQAmergedOut, defaultStorage, outList);
820 if ( outFilename.IsNull() )
return;
822 TString outCanName = outFilename;
823 outCanName.ReplaceAll(
".root",
".pdf");
824 for (
Int_t ican=0; ican<outList.GetEntries(); ican++ ) {
826 if ( ican == 0 ) canName.Append(
"(");
827 else if ( ican == outList.GetEntries()-1 ) canName.Append(
")");
828 static_cast<TCanvas*
>(outList.At(ican))->
Print(canName.Data());
832 if ( outCanName.Contains(
".ps") || outCanName.Contains(
".eps") ) {
833 gSystem->Exec(Form(
"epstopdf %s", outCanName.Data()));
834 gSystem->Exec(Form(
"rm %s", outCanName.Data()));
837 TFile* outFile =
new TFile(outFilename.Data(),
"recreate");
void Print(std::ostream &o, const char *name, Double_t dT, Double_t dVM, Double_t alldT, Double_t alldVM)
Hit pattern from tracker track extrapolation.
Bool_t SetAndCheckOCDB(TString defaultStorage)
void TrigEffTrending(TString fileNameList, TList &outList)
TString FindCorrespondingTrigger(TString checkTrigger, TObjArray *triggerArray)
Double_t * GetConditionalEffErr(Double_t *effErr1, Double_t *effErr2, Double_t *effErrBoth, Int_t exclude=-1)
Output for Trig chamber effieincy.
Bool_t InitFromLocal(const char *localFileList, const char *outputName="testMTRChamberEff")
Double_t * GetProdErr(Double_t *effErr, Int_t exclude, Int_t nFactors=kNch)
Bool_t IsRunNum(TString stringToken)
Bool_t SetEffConditions(const char *physSel, const char *trigClassName, const char *centrality, Int_t itrackSel, Int_t imatch, Int_t imethod)
TObjArray * BuildListOfTrigger(const TObjArray *triggerArray, TString keepPattern="", TString rejectPattern="OTHER,TRUE,PHI,ANY,EMC,-ACE-,-ABCE-,WU,MUP,SPI,SHM")
void MaskTrending(TObjArray runNumArray, TString defaultStorage, TList &outList)
Int_t GetRunNumber(TString filePath)
Bool_t Data(TH1F *h, Double_t *rangefit, Bool_t writefit, Double_t &sgn, Double_t &errsgn, Double_t &bkg, Double_t &errbkg, Double_t &sgnf, Double_t &errsgnf, Double_t &sigmafit, Int_t &status)
Non selected tracks (includes ghosts)
Bool_t CheckOCDBFile(TString cdbDir, Int_t runNum)
Counts per cathode histogram index.
void SetRunAxisRange(TH1 *histo, TString runAxis="X")
Double_t * GetBinomial(Double_t *effErr1, Double_t *effErr2=0x0, Double_t *effErrBoth=0x0)
TFile * file
TList with histograms for a given trigger.
Bool_t IsOCDBChanged(Int_t currRun, Int_t previousRun, TList *fileList)
void DrawEffTrend(Int_t itype, Int_t irpc, Double_t maxNsigmasOutliers=-1., Double_t minEff=0.8, Double_t maxEff=1.01) const
void ScalerTrending(TObjArray runNumArray, TString mergedFileName, TString defaultStorage, TList &outList)
Hit pattern from trigger.
TList * GetOCDBList(TString ocdbDirs)
Bool_t CheckPattern(TString trigName, TObjArray *keepArray, TObjArray *rejectArray)
TString prod[]
productions to be compared, directory name
Counts per slat histogram index.
void trigEffQA(TString fileListName, TString outFilename="", TString defaultStorage="raw://", Bool_t doScalers=kFALSE, TString trackerQAmergedOut="QAresults_merged.root")