AliPhysics  vAN-20150827 (3e81cbb)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
trigEffQA.C
Go to the documentation of this file.
1 
2 #if !defined(__CINT__) || defined(__MAKECINT__)
3 // ROOT includes
4 #include "TFile.h"
5 #include "TH1.h"
6 #include "TH2.h"
7 #include "TGraphAsymmErrors.h"
8 #include "TSystem.h"
9 #include "Riostream.h"
10 #include "TCanvas.h"
11 #include "TStyle.h"
12 #include "TROOT.h"
13 #include "TLegend.h"
14 #include "TMath.h"
15 #include "TObjArray.h"
16 #include "TList.h"
17 #include "TObjString.h"
18 #include "TString.h"
19 #include "TGrid.h"
20 #include "TArrayD.h"
21 #include "TArrayI.h"
22 #include "TMap.h"
23 #include "TGridResult.h"
24 
25 #include "AliCDBManager.h"
26 #include "AliCDBEntry.h"
27 #include "AliCDBPath.h"
28 #include "AliCDBStorage.h"
29 #include "AliMUONTriggerEfficiencyCells.h"
30 #include "AliMUONTriggerChamberEfficiency.h"
31 #include "AliMUONTriggerUtilities.h"
32 #include "AliMUONDigitMaker.h"
33 #include "AliMUONVDigit.h"
34 #include "AliMUONDigitStoreV2R.h"
35 #include "AliMUONCalibrationData.h"
36 #include "AliAnalysisTriggerScalers.h"
37 #include "AliCounterCollection.h"
38 #include "AliTriggerConfiguration.h"
39 #endif
40 
41 const Int_t kNch = 4;
42 const Double_t kZero = 1.e-7; // Avoid problems when comparing to 0.
43 
44 //_____________________________________________________________________________
45 void SetMyStyle()
46 {
48  gStyle->SetCanvasColor(10);
49  gStyle->SetFrameFillColor(10);
50  gStyle->SetStatColor(10);
51  gStyle->SetFillColor(10);
52  gStyle->SetTitleFillColor(10);
53 
54  gStyle->SetTitleXSize(0.03);
55  gStyle->SetTitleXOffset(1.1);
56  gStyle->SetTitleYSize(0.03);
57  gStyle->SetTitleYOffset(1.9);
58 
59  gStyle->SetMarkerSize(0.7);
60  gStyle->SetHistLineWidth(2);
61 
62  gStyle->SetPadLeftMargin(0.12);
63  gStyle->SetPadRightMargin(0.04);
64  gStyle->SetPadBottomMargin(0.08);
65  gStyle->SetPadTopMargin(0.08);
66 
67  gROOT->ForceStyle();
68 }
69 
70 //_____________________________________________________________________________
71 Bool_t IsRunNum ( TString stringToken )
72 {
73  return ( stringToken.IsDigit() && stringToken.Length()>=6 && stringToken.Length()<=9 );
74 }
75 
76 
77 //_____________________________________________________________________________
78 void SetRunAxisRange ( TH1* histo, TString runAxis = "X" )
79 {
81  runAxis.ToUpper();
82  TAxis* axis = histo->GetXaxis();
83  if ( runAxis == "Y" ) axis = histo->GetYaxis();
84  else if ( runAxis == "Z" ) axis = histo->GetZaxis();
85  histo->LabelsOption("v",runAxis.Data());
86  axis->SetLabelSize(0.02);
87  for ( Int_t ibin=1; ibin<=axis->GetNbins(); ibin++ ) {
88  TString binLabel = axis->GetBinLabel(ibin);
89  if ( ! binLabel.IsNull()) continue;
90  axis->SetRange(1, ibin-1);
91  return;
92  }
93 }
94 
95 //_____________________________________________________________________________
96 Int_t GetRunNumber(TString filePath)
97 {
99  TObjArray* array = filePath.Tokenize("/");
100  array->SetOwner();
101  TString auxString = "";
102  Int_t runNum = -1;
103  for ( Int_t ientry=0; ientry<array->GetEntries(); ientry++ ) {
104  auxString = array->At(ientry)->GetName();
105  if ( IsRunNum(auxString) ) {
106  runNum = auxString.Atoi();
107  break;
108  }
109  }
110  delete array;
111 
112  if ( runNum < 0 ) {
113  array = auxString.Tokenize("_");
114  array->SetOwner();
115  auxString = array->Last()->GetName();
116  auxString.ReplaceAll(".root","");
117  if ( IsRunNum(auxString) ) runNum = auxString.Atoi();
118  delete array;
119  }
120 
121  return runNum;
122 }
123 
124 //_____________________________________________________________________________
125 TObjArray* ChangeFilenames ( const TObjArray &fileNameArray )
126 {
133  TObjArray* outArray = new TObjArray(fileNameArray.GetEntries());
134  outArray->SetOwner();
135  TString newBaseName = "trigChEff_ANY_Apt_allTrig.root";
136  for ( Int_t ifile=0; ifile<fileNameArray.GetEntries(); ifile++ ) {
137  TObjString* currObjString = static_cast<TObjString*>(fileNameArray.At(ifile));
138  TString currFile = currObjString->GetString();
139  TString baseName = gSystem->BaseName(currFile.Data());
140  // In the old scripts, the run number is in the QA filename
141  Int_t runNum = GetRunNumber(baseName);
142  TString newFilename = "";
143  if ( runNum < 0 ) {
144  // New central script: the re-created trigger output is in the same directory
145  newFilename = currFile;
146  newFilename.ReplaceAll(baseName.Data(),newBaseName.Data());
147  }
148  else {
149  // Old script. The re-creaated trigger output is in terminateRuns
150  TString dirName = gSystem->DirName(currFile.Data());
151  newFilename = Form("%s/terminateRuns/%i/%s",dirName.Data(),runNum,newBaseName.Data());
152  }
153  if ( gSystem->AccessPathName(newFilename.Data()) ) {
154  printf("New output not found in %s.\n", currFile.Data());
155  delete outArray;
156  outArray = 0x0;
157  break;
158  }
159  outArray->AddAt(new TObjString(newFilename),ifile);
160  }
161 
162  if ( outArray ) printf("Using re-built output in %s\n",newBaseName.Data());
163  else {
164  outArray = static_cast<TObjArray*>(fileNameArray.Clone());
165  printf("Using default output\n");
166  }
167  return outArray;
168 }
169 
170 //_____________________________________________________________________________
171 Double_t* GetProdErr(Double_t* effErr, Int_t exclude, Int_t nFactors = kNch)
172 {
174  Double_t prod = 1.;
175  Double_t relErr = 0., relProdErrSquare = 0.;
176  for ( Int_t iprod=0; iprod<nFactors; iprod++ ) {
177  if ( iprod == exclude ) continue;
178  prod *= effErr[iprod];
179  relErr = ( effErr[iprod] > kZero ) ? effErr[iprod+nFactors]/effErr[iprod] : 0.;
180  relProdErrSquare += relErr*relErr;
181  //printf("%f +- %f ", effErr[iprod], effErr[iprod+nFactors]); // alBER TO CUT
182  }
183  Double_t* prodErr = new Double_t[2];
184  prodErr[0] = prod;
185  prodErr[1] = prod*TMath::Sqrt(relProdErrSquare);
186  //printf("-> %f %f\n", prodErr[0], prodErr[1]); // REMEMBER TO CUT
187  return prodErr;
188 }
189 
190 
191 //_____________________________________________________________________________
192 Double_t* GetConditionalEffErr(Double_t* effErr1, Double_t* effErr2, Double_t* effErrBoth, Int_t exclude = -1)
193 {
195  Double_t* effErr = new Double_t[2*kNch];
196  for ( Int_t ich=0; ich<kNch; ich++ ) {
197  if ( ich == exclude ) {
198  effErr[ich] = ( effErr1[ich] < 1. ) ? ( effErr2[ich] - effErrBoth[ich] ) / ( 1. - effErr1[ich] ) : 0.;
199  effErr[ich+kNch] = 0;
200  if ( effErr1[ich] < 1. ) {
201  Double_t err2 = effErr2[ich+kNch] / ( 1. - effErr1[ich] );
202  Double_t errBoth = effErrBoth[ich+kNch] / ( 1. - effErr1[ich] );
203  Double_t err1 = effErr1[ich+kNch] * effErr[ich] / ( 1. - effErr1[ich] );
204  effErr[ich+kNch] = TMath::Sqrt(err2*err2 + errBoth*errBoth + err1*err1);
205  }
206  }
207  else {
208  effErr[ich] = ( effErr1[ich] > kZero ) ? effErrBoth[ich]/effErr1[ich] : 0.;
209  Double_t relErr1 = ( effErr1[ich] > kZero ) ? effErr1[ich+kNch]/effErr1[ich] : 0.;
210  Double_t relErrBoth = ( effErrBoth[ich] > kZero ) ? effErrBoth[ich+kNch]/effErrBoth[ich] : 0.;
211  effErr[ich+kNch] = effErr[ich] * TMath::Sqrt(relErr1*relErr1 + relErrBoth*relErrBoth);
212  }
213  //printf("%f %f %f -> %f\n", effErr1[ich], effErr2[ich], effErrBoth[ich], effErr[ich]); // REMEMBER TO CUT
214  } // loop on chambers
215  return effErr;
216 }
217 
218 
219 //_____________________________________________________________________________
220 Double_t* GetBinomial(Double_t* effErr1, Double_t* effErr2 = 0x0, Double_t* effErrBoth = 0x0)
221 {
223  Double_t effProd[4];
224  Double_t defaultEffErr[2] = {1.,0.};
225  Double_t* auxBinomial = 0x0;
226  Double_t* currEffErr44 = 0x0;
227  Double_t* effErrBinomial = new Double_t[2];
228  effErrBinomial[0] = 0.;
229  effErrBinomial[1] = 0.;
230 
231  for ( Int_t ich = -1; ich<kNch; ich++ ) {
232  Double_t* currEffErr = GetProdErr(effErr1, ich);
233  if ( ich >= 0 ) {
234  currEffErr[0] = currEffErr[0] - currEffErr44[0];
235  currEffErr[1] = TMath::Sqrt(currEffErr[1]*currEffErr[1] + currEffErr44[1]*currEffErr44[1]);
236  }
237  if ( effErr2 ) {
238  Double_t* auxEffErr = GetConditionalEffErr(effErr1, effErr2, effErrBoth, ich);
239  auxBinomial = GetBinomial(auxEffErr);
240  delete [] auxEffErr;
241  }
242  for ( Int_t ival=0; ival<2; ival++ ) {
243  effProd[2*ival] = currEffErr[ival];
244  effProd[2*ival+1] = ( effErr2 ) ? auxBinomial[ival] : defaultEffErr[ival];
245  }
246  if ( ich < 0 ) currEffErr44 = currEffErr;
247  else delete [] currEffErr;
248  delete [] auxBinomial;
249 
250  Double_t* effErr = GetProdErr(effProd, -1, 2);
251  //printf("%f * %f = %f\n", effProd[0], effProd[1], effErr[0]); // REMEMBER TO CUT
252  effErrBinomial[0] += effErr[0];
253  effErrBinomial[1] += effErr[1]*effErr[1];
254  delete [] effErr;
255  } // loop on chambers
256 
257  delete [] currEffErr44;
258 
259  effErrBinomial[1] = TMath::Sqrt(effErrBinomial[1]);
260 
261  return effErrBinomial;
262 }
263 
264 
265 //_____________________________________________________________________________
266 TH1* GetHisto(TString histoName, TFile* file, TList* histoList)
267 {
269  TH1* histo = 0x0;
270  if ( histoList )
271  histo = (TH1*)histoList->FindObject(histoName.Data());
272  else
273  histo = (TH1*)file->FindObjectAny(histoName.Data());
274 
275  return histo;
276 }
277 
278 //_____________________________________________________________________________
279 Int_t GetEffIndex ( Int_t iel, Int_t icount, Int_t ich = -1 )
280 {
282  if ( iel == 0 ) return icount;
283  return 3 + 4*3*(iel-1) + 3*ich + icount;
284 }
285 
286 //_____________________________________________________________________________
287 TList* GetOCDBList ( TString ocdbDirs )
288 {
290  TString storageType = AliCDBManager::Instance()->GetDefaultStorage()->GetType();
291  Bool_t isGrid = storageType.Contains("alien");
292  TString baseFolder = AliCDBManager::Instance()->GetDefaultStorage()->GetBaseFolder();
293 
294  TList* outList = new TList();
295  outList->SetOwner();
296  TObjArray* dirNameList = ocdbDirs.Tokenize(",");
297  for ( Int_t idir=0; idir<dirNameList->GetEntries(); idir++ ) {
298  TString fullPath = Form("%s/%s",baseFolder.Data(),dirNameList->At(idir)->GetName());
299  if ( isGrid ) {
300  TGridResult *res = gGrid->Ls(fullPath.Data());
301  if (!res) return 0x0;
302  for ( Int_t ires=0; ires<res->GetEntries(); ires++ ) {
303  TString currFile = static_cast<TMap*>(res->At(ires))->GetValue("name")->GetName();
304  outList->Add(new TObjString(currFile));
305  }
306  delete res;
307  }
308  else {
309  TString fileListStr = gSystem->GetFromPipe(Form("ls %s",fullPath.Data()));
310  TObjArray* fileList = fileListStr.Tokenize("\n");
311  for ( Int_t ires=0; ires<fileList->GetEntries(); ires++ ) {
312  TString currFile = fileList->At(ires)->GetName();
313  outList->Add(new TObjString(currFile));
314  }
315  delete fileList;
316  }
317  }
318  delete dirNameList;
319  return outList;
320 }
321 
322 //_____________________________________________________________________________
323 Bool_t SetAndCheckOCDB ( TString defaultStorage )
324 {
326  if ( defaultStorage.IsNull() ) {
327  printf("Default storage not specified. Nothing done\n");
328  return kFALSE;
329  }
330 
331  if ( AliCDBManager::Instance()->IsDefaultStorageSet() ) {
332  printf("Default storage already set: nothing done\n");
333  return kTRUE;
334  }
335 
336  if ( defaultStorage.Contains("alien://") || defaultStorage.Contains("raw://") ) {
337  if ( ! gGrid ) TGrid::Connect("alien://");
338  if ( ! gGrid ) {
339  printf("Error: Problem connetting to grid: default storage not set\n");
340  return kFALSE;
341  }
342  }
343 
344  AliCDBManager::Instance()->SetDefaultStorage(defaultStorage.Data());
345 
346  if ( defaultStorage.Contains("raw://") ) return kTRUE;
347 
348  Bool_t isOk = kTRUE;
349 
350  if ( AliCDBManager::Instance()->IsDefaultStorageSet() ) {
351  TString searchDir = "MUON/Calib/MappingData";
352  TString fullPath = Form("%s/%s",defaultStorage.Data(),searchDir.Data());
353  TList* ocdbList = GetOCDBList(searchDir);
354  if ( ocdbList->GetEntries() == 0 ) {
355  printf("No entries in %s\n",fullPath.Data());
356  isOk = kFALSE;
357  }
358  else {
359  TString checkFile = Form("%s/%s",fullPath.Data(),ocdbList->At(0)->GetName());
360  checkFile.ReplaceAll("local://","");
361  checkFile.ReplaceAll("folder=","");
362  checkFile.ReplaceAll("Folder=","");
363  TFile* file = TFile::Open(checkFile.Data());
364  if ( ! file ) {
365  printf("Cannot access test file: %s\n", checkFile.Data());
366  isOk = kFALSE;
367  }
368  delete file;
369  }
370  delete ocdbList;
371  }
372  else {
373  printf("Tried to set the default storage, but something went wrong.\n");
374  isOk = kFALSE;
375  }
376 
377  if ( ! isOk ) printf("Please check path %s\n",defaultStorage.Data());
378 
379  return isOk;
380 }
381 
382 //_____________________________________________________________________________
383 Bool_t IsOCDBChanged ( Int_t currRun, Int_t previousRun, TList* fileList )
384 {
386  if ( ! fileList ) return kTRUE;
387  for ( Int_t ifile=0; ifile<fileList->GetEntries(); ifile++ ) {
388  TString filename = static_cast<TObjString*>(fileList->At(ifile))->GetString();
389  filename.ReplaceAll("Run","");
390  TObjArray* array = filename.Tokenize("_");
391  Int_t firstRun = static_cast<TObjString*>(array->At(0))->GetString().Atoi();
392  Int_t lastRun = static_cast<TObjString*>(array->At(1))->GetString().Atoi();
393  delete array;
394  Bool_t isCurrRunInside = ( currRun >= firstRun && currRun <= lastRun );
395  Bool_t isPreviousRunInside = ( previousRun >= firstRun && previousRun <= lastRun );
396  if ( isCurrRunInside != isPreviousRunInside ) return kTRUE;
397  }
398  return kFALSE;
399 }
400 
401 //_____________________________________________________________________________
402 void TrigEffTrending(TObjArray runNumArray, TObjArray fileNameArray, TList& outCanList, TList& outList)
403 {
405  TString elementName[3] = { "Chamber", "RPC", "Board" };
406  TString countTypeName[4] = { "allTracks", "bendPlane", "nonBendPlane", "bothPlanes" };
407 
408  TString filename = "", effName = "", effTitle = "";
409 
410  SetMyStyle();
411  Double_t effValues[3][2*kNch];
412  const Int_t kNgraphs = kNch*3*2+3;
413  TObjArray effList(kNgraphs);
414  effList.SetOwner();
415  const Int_t kNeffVsRun = kNgraphs+1;
416  TObjArray effVsRunList(kNeffVsRun);
417 
418  effName = "totalEffEvolution";
419  effTitle = "Multinomial probability of firing at least 3/4 chambers";
420  TH1D* totalEff = new TH1D(effName.Data(), effTitle.Data(), 1, 0., 1.);
421  effVsRunList.AddAt(totalEff, kNeffVsRun-1);
422 
423  TString runNumString = "";
424  for ( Int_t irun=0; irun<runNumArray.GetEntries(); irun++ ) {
425  effList.Clear();
426  runNumString = runNumArray.At(irun)->GetName();
427 
428  // Search corresponding file (for sorting)
429  for ( Int_t ifile=0; ifile<fileNameArray.GetEntries(); ifile++ ) {
430  filename = fileNameArray.At(ifile)->GetName();
431  if ( filename.Contains(runNumString.Data()) ) break;
432  }
433 
434  if ( filename.Contains("alien://") && ! gGrid ) gGrid->Connect("alien://");
435 
436  //
437  // First get the list of efficiency graphs
438  //
439 
440  // Chamber efficiency
441  TFile* file = TFile::Open(filename.Data());
442  if ( ! file ) {
443  printf("Warning: cannot find %s\n", filename.Data());
444  continue;
445  }
446 
447  TList* trigEffList = (TList*)file->FindObjectAny("triggerChamberEff");
448  if ( ! trigEffList ) printf("Warning: histo list not found in %s. Check directly in file\n", filename.Data());
449  if ( trigEffList->GetEntries() == 0 ) {
450  printf("Warning: empty trigger list in file %s. Probably no MUON info there. Skip.\n", filename.Data());
451  continue;
452  }
453 
454  TH1* histoDen = 0x0;
455  for ( Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts; icount++ ) {
456  effName = countTypeName[icount] + "Count" + elementName[0];
457  if ( icount == 0 ) {
458  histoDen = GetHisto(effName, file, trigEffList);
459  continue;
460  }
461 
462  TH1* histoNum = GetHisto(effName, file, trigEffList);
463  TGraphAsymmErrors* graph = new TGraphAsymmErrors(histoNum, histoDen,"e0");
464  effName.ReplaceAll("Count","Eff");
465  graph->SetName(effName.Data());
466  effList.AddAt(graph, GetEffIndex(0, icount-1));
467  }
468  file->Close();
469 
470  if ( ! histoDen ) {
471  printf("Error: cannot find histograms in file %s. Skip to next\n", filename.Data());
472  continue;
473  }
474 
475  // RPC/board efficiency
476  AliMUONTriggerChamberEfficiency trigChEff(filename);
477  for ( Int_t iel=1; iel<3; iel++ ) {
478  for ( Int_t ich=0; ich<kNch; ich++ ) {
479  for ( Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts-1; icount++ ) {
480  TObject* obj = trigChEff.GetEffObject(2-iel, icount, ich);
481  effList.AddAt(obj->Clone(Form("%s_cloned",obj->GetName())), GetEffIndex(iel, icount, ich));
482  }
483  }
484  }
485 
486  // Fill efficiency vs run
487  for ( Int_t iel=0; iel<3; iel++ ) {
488  for ( Int_t ich=0; ich<kNch; ich++ ) {
489  for ( Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts-1; icount++ ) {
490  TGraphAsymmErrors* graph = static_cast<TGraphAsymmErrors*>(effList.At(GetEffIndex(iel, icount, ich)));
491  Int_t nPoints = ( iel == 0 ) ? 1 : graph->GetN();
492  for ( Int_t ipoint=0; ipoint<nPoints; ipoint++ ) {
493  Int_t currPoint = ( iel == 0 ) ? ich : ipoint;
494  Double_t xpt, ypt;
495  graph->GetPoint(currPoint, xpt, ypt);
496  effValues[icount][ich] = ypt;
497  Int_t ihisto = GetEffIndex(iel,icount,ich);
498  TH2* effHisto = static_cast<TH2*>(effVsRunList.At(ihisto));
499  if ( ! effHisto ) {
500  effName = Form("effEvolution%s%s", countTypeName[icount+1].Data(), elementName[iel].Data());
501  effTitle = Form("Trigger chamber efficiency vs run");
502  if ( iel>0 ) {
503  effName += Form("Ch%i", 11+ich);
504  effTitle += Form(" for chamber %i", 11+ich);
505  }
506  effHisto = new TH2D(effName.Data(), effTitle.Data(), 1, 0., 1., graph->GetN(), xpt-0.5, xpt-0.5+(Double_t)graph->GetN());
507  effVsRunList.AddAt(effHisto, ihisto);
508  }
509  Int_t currBin = effHisto->Fill(runNumString.Data(), xpt, ypt);
510  Double_t err = 0.5*(graph->GetErrorYlow(ipoint) + graph->GetErrorYhigh(ipoint));
511  Int_t binx, biny, binz;
512  effHisto->GetBinXYZ(currBin, binx, biny, binz);
513  effHisto->SetBinError(binx, biny, err);
514  effValues[icount][ich+kNch] = err;
515  } // loop on points
516  } // loop on counts
517  } // loop on chambers
518  if ( iel > 0 ) continue;
519  Double_t* binomialEff = GetBinomial(effValues[0], effValues[1], effValues[2]);
520  Int_t currBin = totalEff->Fill(runNumString, binomialEff[0]);
521  // CAVEAT!!!!
522  // Well, error calculation of the binomial efficiency is a mess...
523  // Sometimes it happens that efficiency + error > 1.
524  // In that case reduce the error.
525  totalEff->SetBinError(currBin, TMath::Min(binomialEff[1], 1.-binomialEff[0]));
526  delete [] binomialEff;
527  } // loop on detection elements
528  } // loop on runs
529 
530  // Set correct range (do not show last empty bins)
531  for ( Int_t ihisto=0; ihisto<effVsRunList.GetEntries(); ihisto++ ) {
532  TH1* histo = static_cast<TH1*>(effVsRunList.At(ihisto));
533  if ( ! histo ) continue;
534  SetRunAxisRange(histo);
535  outList.Add(histo);
536  //histo->GetXaxis()->SetLabelSize(0.03);
537  }
538 
539  TString canName = "totalEff";
540  TCanvas* can = new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
541  TH1* totEff = (TH1*)effVsRunList.At(kNeffVsRun-1);
542  totEff->GetYaxis()->SetRangeUser(0.9,1.05);
543  totEff->GetYaxis()->SetTitle("Probability to satisfy trigger conditions (3/4)");
544  totEff->SetStats(kFALSE);
545  totEff->DrawCopy();
546  outCanList.Add(can);
547 
548  Int_t color[3] = {kBlack, kRed, kBlue};
549  Int_t markStyle[3] = {20, 24, 26};
550  TLegend* leg = 0x0;
551 
552  for ( Int_t ich=0; ich<kNch; ich++ ) {
553  canName = Form("trigEffCh%i", 11+ich);
554  can = new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
555  can->SetGridy();
556  leg = new TLegend(0.6, 0.2, 0.9, 0.4);
557  leg->SetBorderSize(1);
558  //can->Divide(2,2);
559  TString drawOpt = "e";
560  for(Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts-1; icount++) {
561  //can->cd(icount+1);
562  TH2* histo = static_cast<TH2*>(effVsRunList.At(GetEffIndex(0, icount)));
563  if ( ! histo ) continue;
564  TH1* chEff = histo->ProjectionX(Form("effEvolutionCh%i",11+ich), ich+1, ich+1);
565  chEff->SetTitle(Form("%s for chamber %i", histo->GetTitle(), 11+ich));
566  chEff->GetYaxis()->SetRangeUser(0.9,1.);
567  chEff->SetStats(kFALSE);
568  chEff->GetYaxis()->SetTitle("Trigger chamber efficiency");
569  TH1* copyEff = chEff->DrawCopy(drawOpt.Data());
570  copyEff->SetLineColor(color[icount]);
571  copyEff->SetMarkerColor(color[icount]);
572  copyEff->SetMarkerStyle(markStyle[icount]);
573  leg->AddEntry(copyEff, countTypeName[icount+1].Data(), "lp");
574  drawOpt = "esame";
575  } // loop on counts
576  leg->Draw("same");
577  outCanList.Add(can);
578  } // loop on chambers
579 
580  for ( Int_t iel=1; iel<3; iel++ ) {
581  for ( Int_t ich=0; ich<kNch; ich++ ) {
582  Int_t icount = AliMUONTriggerEfficiencyCells::kBothPlanesEff; // Just plot the efficiency for both
583 // for ( Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts-1; icount++ ) {
584  canName = Form("trigEff%sCh%i", elementName[iel].Data(), 11+ich);
585  can = new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
586  can->SetRightMargin(0.14);
587  TH2* histo = static_cast<TH2*>(effVsRunList.At(GetEffIndex(iel, icount,ich)));
588  if ( ! histo ) continue;
589  histo->SetStats(kFALSE);
590  histo->GetYaxis()->SetTitle(elementName[iel].Data());
591  // FIX issue when plotting 2D histos in aliroot on linux
592  if ( histo->GetMinimum() == 0. && histo->GetMaximum() == 0. ) histo->SetMaximum(0.1);
593  histo->DrawCopy("COLZ");
594 // } // loop on counts
595  outCanList.Add(can);
596  } // loop on chambers
597  } // loop on detection element type
598 }
599 
600 //_____________________________________________________________________________
601 void MaskTrending ( TObjArray runNumArray, TString defaultStorage, TList& outCanList, TList& outList )
602 {
604 
605  if ( ! SetAndCheckOCDB(defaultStorage) ) return;
606 
607  TObjArray maskedList(8);
608  TObjArray auxList(8);
609  auxList.SetOwner();
610  TString histoName = "", histoTitle = "";
611  for(Int_t icath=0; icath<2; icath++){
612  TString cathName = ( icath==0 ) ? "bendPlane" : "nonBendPlane";
613  for(Int_t ich=0; ich<kNch; ich++){
614  histoName = Form("%sMaskCh%i", cathName.Data(), 11+ich);
615  histoTitle = Form("Chamber %i - %s: fraction of masked channels", 11+ich, cathName.Data());
616  TH2* histo = new TH2D(histoName.Data(), histoTitle.Data(),1,0.,1., 234, 0.5, 234. + 0.5);
617  histo->GetYaxis()->SetTitle("Board Id");
618 // histo->SetOption("COLZ");
619  Int_t imask = 2*ich + icath;
620  maskedList.AddAt(histo, imask);
621  auxList.AddAt(histo->Clone(Form("%s_aux",histoName.Data())), imask);
622  } // loop on chambers
623  } // loop on cathodes
624 
625  TArrayS xyPatternAll[2];
626  for(Int_t icath=0; icath<2; icath++){
627  xyPatternAll[icath].Set(kNch);
628  xyPatternAll[icath].Reset(0xFFFF);
629  }
630 
631  TList* ocdbFileList = 0x0;
632  Int_t previousRun = -1;
633  AliMUONDigitMaker* digitMaker = 0x0;
634  AliMUONDigitStoreV2R digitStore;
635 
636  AliMUONCalibrationData* calibData = 0x0;
637  AliMUONTriggerUtilities* trigUtilities = 0x0;
638  for ( Int_t irun=0; irun<runNumArray.GetEntries(); irun++ ) {
639  TString runNumString = runNumArray.At(irun)->GetName();
640  Int_t runNumber = runNumString.Atoi();
641 
642  if ( IsOCDBChanged(runNumber, previousRun, ocdbFileList) ) {
643  AliCDBManager::Instance()->SetRun(runNumber);
644 
645  if ( ! digitMaker ) {
646  digitMaker = new AliMUONDigitMaker(kFALSE);
647  // Create a store with all digits in trigger
648  for ( Int_t iboard=1; iboard<=234; iboard++ ) {
649  digitMaker->TriggerDigits(iboard, xyPatternAll, digitStore, kFALSE);
650  }
651  }
652 
653  if ( ! ocdbFileList ) ocdbFileList = GetOCDBList("MUON/Calib/GlobalTriggerCrateConfig,MUON/Calib/RegionalTriggerConfig,MUON/Calib/LocalTriggerBoardMasks");
654 
655  delete calibData;
656  calibData = new AliMUONCalibrationData (runNumber);
657  delete trigUtilities;
658  trigUtilities = new AliMUONTriggerUtilities (calibData);
659  }
660 
661  previousRun = runNumber;
662 
663  TIter next(digitStore.CreateIterator());
664  AliMUONVDigit* dig = 0x0;
665  while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) ) {
666  Int_t icath = dig->Cathode();
667  Int_t detElemId = dig->DetElemId();
668  Int_t ich = detElemId/100-11;
669  Int_t iboard = dig->ManuId();
670  Int_t imask = 2*ich + icath;
671  static_cast<TH2*>(auxList.At(imask))->Fill(runNumString.Data(),iboard,1.);
672  static_cast<TH2*>(maskedList.At(imask))->Fill(runNumString.Data(),iboard,(Double_t)trigUtilities->IsMasked(*dig));
673  }
674  } // loop on runs
675  delete calibData;
676  delete trigUtilities;
677  delete digitMaker;
678 
679  TString canName = "";
680  for ( Int_t imask=0; imask<maskedList.GetEntries(); imask++ ) {
681  TH2* histo = static_cast<TH2*>(maskedList.At(imask));
682  histo->Divide(static_cast<TH2*>(auxList.At(imask)));
683  SetRunAxisRange(histo);
684  outList.Add(histo);
685 
686  canName = Form("%sCan", histo->GetName());
687  TCanvas* can = new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
688  can->SetRightMargin(0.14);
689  histo->SetStats(kFALSE);
690  if ( histo->GetMinimum() == 0. && histo->GetMaximum() == 0. ) histo->SetMaximum(0.1);
691  histo->DrawCopy("COLZ");
692  outCanList.Add(can);
693  }
694 }
695 
696 //_____________________________________________________________________________
697 Bool_t CheckPattern ( TString trigName, TObjArray* keepArray, TObjArray* rejectArray )
698 {
700  for ( Int_t ipat=0; ipat<rejectArray->GetEntries(); ++ipat ) {
701  if ( trigName.Contains(rejectArray->At(ipat)->GetName() ) ) return kFALSE;
702  } // loop on reject pattern
703 
704  for ( Int_t ipat=0; ipat<keepArray->GetEntries(); ++ipat ) {
705  if ( trigName.Contains(keepArray->At(ipat)->GetName() ) ) return kTRUE;
706  } // loop on keep pattern
707 
708  return ( keepArray->GetEntries() == 0 ) ? kTRUE : kFALSE;
709 }
710 
711 //_____________________________________________________________________________
712 TObjArray* BuildListOfTrigger ( const TObjArray* triggerArray, TString keepPattern = "", TString rejectPattern="OTHER,TRUE,PHI,ANY,EMC,-ACE-,-ABCE-,WU,MUP,SPI,SHM" )
713 {
715  TObjArray* selectedList = new TObjArray();
716  selectedList->SetOwner();
717  TObjArray* rejectArray = rejectPattern.Tokenize(",");
718  TObjArray* keepArray = keepPattern.Tokenize(",");
719 
720  for ( Int_t iTrig = 0; iTrig < triggerArray->GetEntries(); iTrig++ ){
721  TString currTrigName = ((TObjString*)triggerArray->At(iTrig))->GetName();
722  if ( CheckPattern(currTrigName, keepArray, rejectArray) ) selectedList->AddLast(new TObjString(currTrigName.Data()));
723  }
724 
725  delete rejectArray;
726  delete keepArray;
727 
728  return selectedList;
729 
730 }
731 
732 //_____________________________________________________________________________
733 TString FindCorrespondingTrigger ( TString checkTrigger, TObjArray* triggerArray )
734 {
736  TString foundName = "";
737  for ( Int_t iTrig = 0; iTrig < triggerArray->GetEntries(); iTrig++ ){
738  TString currTrigName = ((TObjString*)triggerArray->At(iTrig))->GetName();
739  TObjArray* array = currTrigName.Tokenize("-");
740  TString collisionType = array->At(1)->GetName();
741  delete array;
742  collisionType.Append("-");
743  collisionType.Prepend("-");
744  if ( checkTrigger.Contains(collisionType.Data()) ) {
745  foundName = currTrigName;
746  break;
747  }
748  }
749 
750  return foundName;
751 }
752 
753 //_____________________________________________________________________________
754 void ScalerTrending ( TObjArray runNumArray, TString mergedFileName, TString defaultStorage, TList& outCanList, TList& outList )
755 {
757  if ( ! SetAndCheckOCDB(defaultStorage) ) return;
758 
759  //trigger count from ESDs
760  TFile *file = TFile::Open(mergedFileName.Data());
761  AliCounterCollection* ccol = (AliCounterCollection*)((TDirectoryFile*)file->FindObjectAny("MUON_QA"))->FindObjectAny("eventCounters");
762 
763  //Build the trigger list for trigger with muon only in readout and min. bias triggers
764  TString triggerListName = ccol->GetKeyWords("trigger");
765 
766  TObjArray selectedTriggerArray, selectedL0TriggerArray;
767  selectedTriggerArray.SetOwner();
768  selectedL0TriggerArray.SetOwner();
769 
770  const Int_t nScaler = 3;
771  TString sScaler[nScaler] = {"L0B","L2A","L0BRATE"};
772  enum eScaler {kL0B = 0, kL2A=1, kL0BRATE=2};
773  Float_t maxScaler[nScaler] = {1e8,1e7,1e6};
774  TObjArray hFromQA;
775  TObjArray hFromScalers;
776  TObjArray hOutput;
777 
778 
779  TString sHistName, sHistNameFull, sTitleName;
780  Int_t nRuns = runNumArray.GetEntries();
781 
782  //
783  //Fill histos for Scalers and QA
784  //
785  //loop on run list
786  for ( Int_t iRun = 0; iRun < runNumArray.GetEntries(); iRun++ ) {
787 
788  TString sRunNr = ((TObjString*)runNumArray.At(iRun))->GetString();
789  Int_t runNr = sRunNr.Atoi();
790  AliAnalysisTriggerScalers triggerScaler(runNr);
791  AliTriggerConfiguration* tc = static_cast<AliTriggerConfiguration*>(triggerScaler.GetOCDBObject("GRP/CTP/Config",runNr));
792  const TObjArray& trClasses = tc->GetClasses();
793 
794  Int_t ibin = iRun+1;
795 
796  for ( Int_t itype=0; itype<2; itype++ ) {
797  TObjArray* currSelectedList = ( itype == 0 ) ? &selectedTriggerArray : &selectedL0TriggerArray;
798  TString matchTrig = ( itype == 0 ) ? "" : "C0TVX";
799  TObjArray* selectedTrigArrayForRun = BuildListOfTrigger(&trClasses, matchTrig);
800 
801  //loop on trigger list
802  for ( Int_t iTrig = 0; iTrig < selectedTrigArrayForRun->GetEntries(); iTrig++ ) {
803 
804  TString currTrigName = selectedTrigArrayForRun->At(iTrig)->GetName();
805  if ( itype == 0 && ! triggerListName.Contains(currTrigName.Data()) ) continue;
806  if ( ! currSelectedList->FindObject(currTrigName.Data()) ) currSelectedList->Add(new TObjString(currTrigName));
807 
808  //loop on scaler list
809  for ( Int_t iScaler = 0; iScaler < nScaler; iScaler++ ) {
810 
811  if ( itype == 1 && iScaler != kL0B ) continue;
812 
813  //from Scalers
814  TGraph* graph = triggerScaler.PlotTrigger(currTrigName.Data(),sScaler[iScaler].Data(),kFALSE);
815 
816  sHistName = Form("%s_%s",currTrigName.Data(),sScaler[iScaler].Data());
817  sHistNameFull = Form("Scalers_%s",sHistName.Data());
818 
819  TH1* hist = (TH1*) hFromScalers.FindObject(sHistNameFull);
820  if ( ! hist ) {
821  hist = new TH1D(sHistNameFull,sHistName,nRuns,1.,1.+(Double_t)nRuns);
822  hist->LabelsOption("v");
823  hist->GetXaxis()->SetLabelSize(0.02);
824  hist->SetDirectory(0);
825  hist->SetMinimum(1);
826  hist->SetMaximum(maxScaler[0]);
827  hFromScalers.AddLast(hist);
828  hOutput.AddLast(hist);
829  if ( iScaler == kL2A ) {
830  sHistNameFull = "QA_" + sHistName;
831  hFromQA.AddLast(hist->Clone(sHistNameFull.Data()));
832  }
833  }
834  Double_t *tab = (Double_t*) graph->GetY();
835  if ( tab ) hist->SetBinContent(ibin,tab[0]);
836  hist->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
837  delete graph;
838 
839  //from QA
840  if ( iScaler != kL2A ) continue;
841  TH1* histCounters = static_cast<TH1*>(ccol->Get("run",Form("run:%s/trigger:%s",sRunNr.Data(),currTrigName.Data())));
842  sHistNameFull = sHistNameFull = "QA_" + sHistName;
843  hist = (TH1*) hFromQA.FindObject(sHistNameFull);
844  if ( histCounters ) hist->SetBinContent(ibin,histCounters->GetSumOfWeights());
845  hist->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
846  delete histCounters;
847  }//end loop on scaler list
848  }//end loop on trigger list
849  } // end loop on type
850  }//end loop on run list
851 
852 
853  if ( selectedTriggerArray.GetEntries() == 0 ) {
854  printf("No trigger selected from trigger list %s\n",triggerListName.Data());
855  return;
856  }
857  printf("Nr of triggers selected %i\n",selectedTriggerArray.GetEntries());
858 
859  printf("Nr of T0 triggers selected %i\n",selectedL0TriggerArray.GetEntries());
860 
861  //Set options for QA and Scalers histos
862 
863  for ( Int_t itype=0; itype<2; itype++ ) {
864  TObjArray* currList = ( itype == 0 ) ? &hFromScalers : &hFromQA;
865  for ( Int_t ihisto=0; ihisto<currList->GetEntriesFast(); ihisto++ ) {
866  TH1* histo = static_cast<TH1*> ( currList->At(ihisto) );
867  if (!histo) continue;
868  // Write run number to each bin
869  for ( Int_t iRun = 0; iRun < runNumArray.GetEntries(); iRun++ ) {
870  TString sRunNr = ((TObjString*)runNumArray.At(iRun))->GetString();
871  Int_t ibin = iRun+1;
872  TString binLabel = histo->GetXaxis()->GetBinLabel(ibin);
873  if ( ! binLabel.IsNull() ) continue;
874  histo->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
875  }
876  histo->SetStats(kFALSE);
877  }
878  }
879 
880 
881  //Loop on histos from scalers and QA and create resulting histos from scalers
882  const Int_t nHisto = 3;
883  TString sHisto[nHisto] = {"L0BoverL0BC0TVX","L2AoverL0B","L2AQAoverSCALERS"};
884  TString sTitleHisto[nHisto] = {"L0B trigger / L0BC0TVX","L2A / L0B","L2A from QA / L2A from SCALERS"};
885  // TString sHisto[nHisto] = {"L2AoverL0B","L2AQAoverSCALERS"};
886 
887  //loop on trigger list
888  for ( Int_t iTrig = 0; iTrig < selectedTriggerArray.GetEntries(); iTrig++ ) {
889 
890  sHistNameFull = Form("Scalers_%s_L0B",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
891  TH1* histo1 = static_cast<TH1*> ( hFromScalers.FindObject(sHistNameFull) );
892  if (!histo1) continue;
893 
894 
895  //C0TVX
896  TString sTrig = ( (TObjString*) selectedTriggerArray.At(iTrig) )->GetName();
897  TString sL0Trig = FindCorrespondingTrigger(sTrig, &selectedL0TriggerArray);
898 
899  sHistNameFull = Form("Scalers_%s_L0B",sL0Trig.Data());
900 
901  TH1* histo0 = static_cast<TH1*> ( hFromScalers.FindObject(sHistNameFull) );
902  if ( histo0 ) {
903  sHistNameFull = Form("%s_%s",sHisto[0].Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
904  TH1* histo10 = (TH1*) histo1->Clone(sHistNameFull);
905  histo10->SetTitle(sTitleHisto[0].Data());
906  histo10->Sumw2();
907  histo10->Divide(histo0);
908  histo10->SetMaximum(10);
909  histo10->SetMinimum(1e-5);
910  //outList.Add(histo10);
911  hOutput.AddLast(histo10);
912  //outList.Add(histo0);
913  //outList.Add(histo1);
914  }
915 
916  //DEADTIME
917  sHistNameFull = Form("Scalers_%s_L2A",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
918  TH1* histo2 = static_cast<TH1*> ( hFromScalers.FindObject(sHistNameFull) );
919  if (!histo2) continue;
920 
921  sHistNameFull = Form("%s_%s",sHisto[1].Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
922  TH1* histo3 = (TH1*) histo2->Clone(sHistNameFull);
923  histo3->SetTitle(sTitleHisto[1]);
924  histo3->Sumw2();
925  histo3->Divide(histo1);
926  histo3->SetMaximum(1.2);
927  histo3->SetMinimum(1e-5);
928  //outList.Add(histo3);
929  hOutput.AddLast(histo3);
930 
931  //QA over Scalers
932  sHistNameFull = Form("QA_%s_L2A",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
933  TH1* histo4 = static_cast<TH1*> ( hFromQA.FindObject(sHistNameFull) );
934  if (!histo4) continue;
935 
936  sHistNameFull = Form("%s_%s",sHisto[2].Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
937  TH1* histo5 = (TH1*) histo4->Clone(sHistNameFull);
938  histo5->SetTitle(sTitleHisto[2]);
939  histo5->Sumw2();
940  histo5->Divide(histo2);
941  histo5->SetMaximum(1.2);
942  histo5->SetMinimum(5e-1);
943  //outList.Add(histo5);
944  hOutput.AddLast(histo5);
945  }
946 
947  // Plot all on canvases (only canvases will be saved)
948  const Int_t nCanvases = nScaler + nHisto;
949  TString sCanvases[nCanvases];
950  for (Int_t iScaler = 0; iScaler < nScaler; iScaler++) sCanvases[iScaler] = sScaler[iScaler];
951  for (Int_t iHisto = 0; iHisto < nHisto; iHisto++) sCanvases[nScaler+iHisto] = sHisto[iHisto];
952 
953  //loop on canvases
954  for ( Int_t iCan = 0; iCan < nCanvases; iCan++) {
955  TCanvas* canvas = new TCanvas(sCanvases[iCan],sCanvases[iCan],200,10,600,600);
956  TLegend* leg = new TLegend(0.72,0.7,0.9,0.85);
957  leg->SetBorderSize(1);
958  if ( iCan != 4 ) canvas->SetLogy();
959  TString optDraw = "e";
960 
961  //loop on trigger list
962  Int_t icolor = 1;
963  for ( Int_t iTrig = 0; iTrig < selectedTriggerArray.GetEntries(); iTrig++ ) {
964 
965  if ( iCan < nScaler ) sHistNameFull = Form("Scalers_%s_%s",selectedTriggerArray.At(iTrig)->GetName(),sCanvases[iCan].Data());
966  else sHistNameFull = Form("%s_%s",sCanvases[iCan].Data(),selectedTriggerArray.At(iTrig)->GetName());
967  TH1* histo1 = static_cast<TH1*> ( hOutput.FindObject(sHistNameFull) );
968  if (!histo1) continue;
969 
970  if ( icolor == 10 ) icolor++;
971  histo1->SetLineColor(icolor++);
972  histo1->Draw(optDraw);
973  optDraw = "esame";
974 
975  leg->AddEntry(histo1,selectedTriggerArray.At(iTrig)->GetName(),"l");
976  }
977 
978  leg->Draw();
979  outList.Add(canvas);
980  outCanList.Add(canvas);
981  }
982 
983  file->Close();
984 }
985 
986 //_____________________________________________________________________________
987 void trigEffQA(TString fileListName, TString outFilename = "", TString defaultStorage = "raw://", Bool_t doScalers = kFALSE, TString trackerQAmergedOut="QAresults_merged.root")
988 {
990  ifstream inFile(fileListName.Data());
991  TObjArray fileNameArray, runNumArray;
992  fileNameArray.SetOwner();
993  runNumArray.SetOwner();
994  TString currString = "";
995  if (inFile.is_open()) {
996  while (! inFile.eof() ) {
997  currString.ReadLine(inFile); // Read line
998  if ( ! currString.Contains(".root") ||
999  currString.BeginsWith("#") ) continue;
1000  fileNameArray.AddLast(new TObjString(currString.Data()));
1001  Int_t runNum = GetRunNumber(currString);
1002  runNumArray.AddLast(new TObjString(Form("%i",runNum)));
1003  }
1004  inFile.close();
1005  }
1006  else {
1007  printf("Fatal: cannot open input file %s\n",fileListName.Data());
1008  return;
1009  }
1010 
1011  runNumArray.Sort();
1012 
1013  // Instead of using the efficiency stored in the QA output
1014  // search for the new efficiency produced with trigger tracks only
1015  TObjArray* finalFileNameArray = ChangeFilenames(fileNameArray);
1016 
1017  TList outCanList, outList;
1018  TrigEffTrending(runNumArray, *finalFileNameArray, outCanList, outList);
1019  if ( SetAndCheckOCDB(defaultStorage) ) {
1020  MaskTrending(runNumArray, defaultStorage, outCanList, outList);
1021  if ( doScalers ) {
1022  if ( gSystem->AccessPathName(trackerQAmergedOut.Data()) ) {
1023  printf("Warning: cannot perform scaler trending:\n merged QA from tracker\n %s\n does not exist\n",trackerQAmergedOut.Data());
1024  }
1025  else {
1026  ScalerTrending(runNumArray, trackerQAmergedOut, defaultStorage, outCanList, outList);
1027  }
1028  }
1029  }
1030 
1031  delete finalFileNameArray;
1032 
1033  if ( outFilename.IsNull() ) return;
1034 
1035  TString outCanName = outFilename;
1036  outCanName.ReplaceAll(".root",".pdf");
1037  for ( Int_t ican=0; ican<outCanList.GetEntries(); ican++ ) {
1038  TString canName = outCanName;
1039  if ( ican == 0 ) canName.Append("("); // open pdf file
1040  else if ( ican == outCanList.GetEntries()-1 ) canName.Append(")"); // close pdf file
1041  static_cast<TCanvas*>(outCanList.At(ican))->Print(canName.Data());
1042  }
1043  // There is a bug when creating a pdf
1044  // So create a ps and then convert via epstopdf
1045  if ( outCanName.Contains(".ps") || outCanName.Contains(".eps") ) {
1046  gSystem->Exec(Form("epstopdf %s", outCanName.Data()));
1047  gSystem->Exec(Form("rm %s", outCanName.Data()));
1048  }
1049 
1050  TFile* outFile = new TFile(outFilename.Data(), "recreate");
1051  outList.Write();
1052  outFile->Close();
1053 }
Int_t color[]
const Int_t kNch
Definition: trigEffQA.C:41
void SetMyStyle()
Definition: trigEffQA.C:45
TSystem * gSystem
Bool_t SetAndCheckOCDB(TString defaultStorage)
Definition: trigEffQA.C:323
TH1 * GetHisto(TString histoName, TFile *file, TList *histoList)
Definition: trigEffQA.C:266
TString FindCorrespondingTrigger(TString checkTrigger, TObjArray *triggerArray)
Definition: trigEffQA.C:733
Double_t * GetConditionalEffErr(Double_t *effErr1, Double_t *effErr2, Double_t *effErrBoth, Int_t exclude=-1)
Definition: trigEffQA.C:192
const Double_t kZero
Definition: trigEffQA.C:42
Double_t * GetProdErr(Double_t *effErr, Int_t exclude, Int_t nFactors=kNch)
Definition: trigEffQA.C:171
Bool_t IsRunNum(TString stringToken)
Definition: trigEffQA.C:71
TObjArray * BuildListOfTrigger(const TObjArray *triggerArray, TString keepPattern="", TString rejectPattern="OTHER,TRUE,PHI,ANY,EMC,-ACE-,-ABCE-,WU,MUP,SPI,SHM")
Definition: trigEffQA.C:712
Int_t GetRunNumber(TString filePath)
Definition: trigEffQA.C:96
void ScalerTrending(TObjArray runNumArray, TString mergedFileName, TString defaultStorage, TList &outCanList, TList &outList)
Definition: trigEffQA.C:754
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)
TObjArray * ChangeFilenames(const TObjArray &fileNameArray)
Definition: trigEffQA.C:125
void SetRunAxisRange(TH1 *histo, TString runAxis="X")
Definition: trigEffQA.C:78
Double_t * GetBinomial(Double_t *effErr1, Double_t *effErr2=0x0, Double_t *effErrBoth=0x0)
Definition: trigEffQA.C:220
TFile * file
Bool_t IsOCDBChanged(Int_t currRun, Int_t previousRun, TList *fileList)
Definition: trigEffQA.C:383
void MaskTrending(TObjArray runNumArray, TString defaultStorage, TList &outCanList, TList &outList)
Definition: trigEffQA.C:601
void TrigEffTrending(TObjArray runNumArray, TObjArray fileNameArray, TList &outCanList, TList &outList)
Definition: trigEffQA.C:402
Int_t GetEffIndex(Int_t iel, Int_t icount, Int_t ich=-1)
Definition: trigEffQA.C:279
TList * GetOCDBList(TString ocdbDirs)
Definition: trigEffQA.C:287
Bool_t CheckPattern(TString trigName, TObjArray *keepArray, TObjArray *rejectArray)
Definition: trigEffQA.C:697
TString prod[]
total number of productions
void trigEffQA(TString fileListName, TString outFilename="", TString defaultStorage="raw://", Bool_t doScalers=kFALSE, TString trackerQAmergedOut="QAresults_merged.root")
Definition: trigEffQA.C:987