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