AliPhysics  vAN-20150630 (513c479)
 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  checkFile.ReplaceAll("folder=","");
356  checkFile.ReplaceAll("Folder=","");
357  TFile* file = TFile::Open(checkFile.Data());
358  if ( ! file ) {
359  printf("Cannot access test file: %s\n", checkFile.Data());
360  isOk = kFALSE;
361  }
362  delete file;
363  }
364  delete ocdbList;
365  }
366  else {
367  printf("Tried to set the default storage, but something went wrong.\n");
368  isOk = kFALSE;
369  }
370 
371  if ( ! isOk ) printf("Please check path %s\n",defaultStorage.Data());
372 
373  return isOk;
374 }
375 
376 //_____________________________________________________________________________
377 Bool_t IsOCDBChanged ( Int_t currRun, Int_t previousRun, TList* fileList )
378 {
380  if ( ! fileList ) return kTRUE;
381  for ( Int_t ifile=0; ifile<fileList->GetEntries(); ifile++ ) {
382  TString filename = static_cast<TObjString*>(fileList->At(ifile))->GetString();
383  filename.ReplaceAll("Run","");
384  TObjArray* array = filename.Tokenize("_");
385  Int_t firstRun = static_cast<TObjString*>(array->At(0))->GetString().Atoi();
386  Int_t lastRun = static_cast<TObjString*>(array->At(1))->GetString().Atoi();
387  delete array;
388  Bool_t isCurrRunInside = ( currRun >= firstRun && currRun <= lastRun );
389  Bool_t isPreviousRunInside = ( previousRun >= firstRun && previousRun <= lastRun );
390  if ( isCurrRunInside != isPreviousRunInside ) return kTRUE;
391  }
392  return kFALSE;
393 }
394 
395 //_____________________________________________________________________________
396 void TrigEffTrending(TObjArray runNumArray, TObjArray fileNameArray, TList& outCanList, TList& outList)
397 {
399  TString elementName[3] = { "Chamber", "RPC", "Board" };
400  TString countTypeName[4] = { "allTracks", "bendPlane", "nonBendPlane", "bothPlanes" };
401 
402  TString filename = "", effName = "", effTitle = "";
403 
404  SetMyStyle();
405  Double_t effValues[3][2*kNch];
406  const Int_t kNgraphs = kNch*3*2+3;
407  TObjArray effList(kNgraphs);
408  effList.SetOwner();
409  const Int_t kNeffVsRun = kNgraphs+1;
410  TObjArray effVsRunList(kNeffVsRun);
411 
412  effName = "totalEffEvolution";
413  effTitle = "Multinomial probability of firing at least 3/4 chambers";
414  TH1D* totalEff = new TH1D(effName.Data(), effTitle.Data(), 1, 0., 1.);
415  effVsRunList.AddAt(totalEff, kNeffVsRun-1);
416 
417  TString runNumString = "";
418  for ( Int_t irun=0; irun<runNumArray.GetEntries(); irun++ ) {
419  effList.Clear();
420  runNumString = runNumArray.At(irun)->GetName();
421 
422  // Search corresponding file (for sorting)
423  for ( Int_t ifile=0; ifile<fileNameArray.GetEntries(); ifile++ ) {
424  filename = fileNameArray.At(ifile)->GetName();
425  if ( filename.Contains(runNumString.Data()) ) break;
426  }
427 
428  if ( filename.Contains("alien://") && ! gGrid ) gGrid->Connect("alien://");
429 
430  //
431  // First get the list of efficiency graphs
432  //
433 
434  // Chamber efficiency
435  TFile* file = TFile::Open(filename.Data());
436  if ( ! file ) {
437  printf("Warning: cannot find %s\n", filename.Data());
438  continue;
439  }
440 
441  TList* trigEffList = (TList*)file->FindObjectAny("triggerChamberEff");
442  if ( ! trigEffList ) printf("Warning: histo list not found in %s. Check directly in file\n", filename.Data());
443  if ( trigEffList->GetEntries() == 0 ) {
444  printf("Warning: empty trigger list in file %s. Probably no MUON info there. Skip.\n", filename.Data());
445  continue;
446  }
447 
448  TH1* histoDen = 0x0;
449  for ( Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts; icount++ ) {
450  effName = countTypeName[icount] + "Count" + elementName[0];
451  if ( icount == 0 ) {
452  histoDen = GetHisto(effName, file, trigEffList);
453  continue;
454  }
455 
456  TH1* histoNum = GetHisto(effName, file, trigEffList);
457  TGraphAsymmErrors* graph = new TGraphAsymmErrors(histoNum, histoDen,"e0");
458  effName.ReplaceAll("Count","Eff");
459  graph->SetName(effName.Data());
460  effList.AddAt(graph, GetEffIndex(0, icount-1));
461  }
462  file->Close();
463 
464  if ( ! histoDen ) {
465  printf("Error: cannot find histograms in file %s. Skip to next\n", filename.Data());
466  continue;
467  }
468 
469  // RPC/board efficiency
470  AliMUONTriggerChamberEfficiency trigChEff(filename);
471  for ( Int_t iel=1; iel<3; iel++ ) {
472  for ( Int_t ich=0; ich<kNch; ich++ ) {
473  for ( Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts-1; icount++ ) {
474  TObject* obj = trigChEff.GetEffObject(2-iel, icount, ich);
475  effList.AddAt(obj->Clone(Form("%s_cloned",obj->GetName())), GetEffIndex(iel, icount, ich));
476  }
477  }
478  }
479 
480  // Fill efficiency vs run
481  for ( Int_t iel=0; iel<3; iel++ ) {
482  for ( Int_t ich=0; ich<kNch; ich++ ) {
483  for ( Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts-1; icount++ ) {
484  TGraphAsymmErrors* graph = static_cast<TGraphAsymmErrors*>(effList.At(GetEffIndex(iel, icount, ich)));
485  Int_t nPoints = ( iel == 0 ) ? 1 : graph->GetN();
486  for ( Int_t ipoint=0; ipoint<nPoints; ipoint++ ) {
487  Int_t currPoint = ( iel == 0 ) ? ich : ipoint;
488  Double_t xpt, ypt;
489  graph->GetPoint(currPoint, xpt, ypt);
490  effValues[icount][ich] = ypt;
491  Int_t ihisto = GetEffIndex(iel,icount,ich);
492  TH2* effHisto = static_cast<TH2*>(effVsRunList.At(ihisto));
493  if ( ! effHisto ) {
494  effName = Form("effEvolution%s%s", countTypeName[icount+1].Data(), elementName[iel].Data());
495  effTitle = Form("Trigger chamber efficiency vs run");
496  if ( iel>0 ) {
497  effName += Form("Ch%i", 11+ich);
498  effTitle += Form(" for chamber %i", 11+ich);
499  }
500  effHisto = new TH2D(effName.Data(), effTitle.Data(), 1, 0., 1., graph->GetN(), xpt-0.5, xpt-0.5+(Double_t)graph->GetN());
501  effVsRunList.AddAt(effHisto, ihisto);
502  }
503  Int_t currBin = effHisto->Fill(runNumString.Data(), xpt, ypt);
504  Double_t err = 0.5*(graph->GetErrorYlow(ipoint) + graph->GetErrorYhigh(ipoint));
505  Int_t binx, biny, binz;
506  effHisto->GetBinXYZ(currBin, binx, biny, binz);
507  effHisto->SetBinError(binx, biny, err);
508  effValues[icount][ich+kNch] = err;
509  } // loop on points
510  } // loop on counts
511  } // loop on chambers
512  if ( iel > 0 ) continue;
513  Double_t* binomialEff = GetBinomial(effValues[0], effValues[1], effValues[2]);
514  Int_t currBin = totalEff->Fill(runNumString, binomialEff[0]);
515  // CAVEAT!!!!
516  // Well, error calculation of the binomial efficiency is a mess...
517  // Sometimes it happens that efficiency + error > 1.
518  // In that case reduce the error.
519  totalEff->SetBinError(currBin, TMath::Min(binomialEff[1], 1.-binomialEff[0]));
520  delete [] binomialEff;
521  } // loop on detection elements
522  } // loop on runs
523 
524  // Set correct range (do not show last empty bins)
525  for ( Int_t ihisto=0; ihisto<effVsRunList.GetEntries(); ihisto++ ) {
526  TH1* histo = static_cast<TH1*>(effVsRunList.At(ihisto));
527  if ( ! histo ) continue;
528  SetRunAxisRange(histo->GetXaxis());
529  outList.Add(histo);
530  //histo->GetXaxis()->SetLabelSize(0.03);
531  }
532 
533  TString canName = "totalEff";
534  TCanvas* can = new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
535  TH1* totEff = (TH1*)effVsRunList.At(kNeffVsRun-1);
536  totEff->GetYaxis()->SetRangeUser(0.9,1.05);
537  totEff->GetYaxis()->SetTitle("Probability to satisfy trigger conditions (3/4)");
538  totEff->SetStats(kFALSE);
539  totEff->DrawCopy();
540  outCanList.Add(can);
541 
542  Int_t color[3] = {kBlack, kRed, kBlue};
543  Int_t markStyle[3] = {20, 24, 26};
544  TLegend* leg = 0x0;
545 
546  for ( Int_t ich=0; ich<kNch; ich++ ) {
547  canName = Form("trigEffCh%i", 11+ich);
548  can = new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
549  can->SetGridy();
550  leg = new TLegend(0.6, 0.2, 0.9, 0.4);
551  leg->SetBorderSize(1);
552  //can->Divide(2,2);
553  TString drawOpt = "e";
554  for(Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts-1; icount++) {
555  //can->cd(icount+1);
556  TH2* histo = static_cast<TH2*>(effVsRunList.At(GetEffIndex(0, icount)));
557  if ( ! histo ) continue;
558  TH1* chEff = histo->ProjectionX(Form("effEvolutionCh%i",11+ich), ich+1, ich+1);
559  chEff->SetTitle(Form("%s for chamber %i", histo->GetTitle(), 11+ich));
560  chEff->GetYaxis()->SetRangeUser(0.9,1.);
561  chEff->SetStats(kFALSE);
562  chEff->GetYaxis()->SetTitle("Trigger chamber efficiency");
563  TH1* copyEff = chEff->DrawCopy(drawOpt.Data());
564  copyEff->SetLineColor(color[icount]);
565  copyEff->SetMarkerColor(color[icount]);
566  copyEff->SetMarkerStyle(markStyle[icount]);
567  leg->AddEntry(copyEff, countTypeName[icount+1].Data(), "lp");
568  drawOpt = "esame";
569  } // loop on counts
570  leg->Draw("same");
571  outCanList.Add(can);
572  } // loop on chambers
573 
574  for ( Int_t iel=1; iel<3; iel++ ) {
575  for ( Int_t ich=0; ich<kNch; ich++ ) {
576  Int_t icount = AliMUONTriggerEfficiencyCells::kBothPlanesEff; // Just plot the efficiency for both
577 // for ( Int_t icount=0; icount<AliMUONTriggerEfficiencyCells::kNcounts-1; icount++ ) {
578  canName = Form("trigEff%sCh%i", elementName[iel].Data(), 11+ich);
579  can = new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
580  can->SetRightMargin(0.14);
581  TH2* histo = static_cast<TH2*>(effVsRunList.At(GetEffIndex(iel, icount,ich)));
582  if ( ! histo ) continue;
583  histo->SetStats(kFALSE);
584  histo->GetYaxis()->SetTitle(elementName[iel].Data());
585  // FIX issue when plotting 2D histos in aliroot on linux
586  if ( histo->GetMinimum() == 0. && histo->GetMaximum() == 0. ) histo->SetMaximum(0.1);
587  histo->DrawCopy("COLZ");
588 // } // loop on counts
589  outCanList.Add(can);
590  } // loop on chambers
591  } // loop on detection element type
592 }
593 
594 //_____________________________________________________________________________
595 void MaskTrending ( TObjArray runNumArray, TString defaultStorage, TList& outCanList, TList& outList )
596 {
598 
599  if ( ! SetAndCheckOCDB(defaultStorage) ) return;
600 
601  TObjArray maskedList(8);
602  TObjArray auxList(8);
603  auxList.SetOwner();
604  TString histoName = "", histoTitle = "";
605  for(Int_t icath=0; icath<2; icath++){
606  TString cathName = ( icath==0 ) ? "bendPlane" : "nonBendPlane";
607  for(Int_t ich=0; ich<kNch; ich++){
608  histoName = Form("%sMaskCh%i", cathName.Data(), 11+ich);
609  histoTitle = Form("Chamber %i - %s: fraction of masked channels", 11+ich, cathName.Data());
610  TH2* histo = new TH2D(histoName.Data(), histoTitle.Data(),1,0.,1., 234, 0.5, 234. + 0.5);
611  histo->GetYaxis()->SetTitle("Board Id");
612 // histo->SetOption("COLZ");
613  Int_t imask = 2*ich + icath;
614  maskedList.AddAt(histo, imask);
615  auxList.AddAt(histo->Clone(Form("%s_aux",histoName.Data())), imask);
616  } // loop on chambers
617  } // loop on cathodes
618 
619  TArrayS xyPatternAll[2];
620  for(Int_t icath=0; icath<2; icath++){
621  xyPatternAll[icath].Set(kNch);
622  xyPatternAll[icath].Reset(0xFFFF);
623  }
624 
625  TList* ocdbFileList = 0x0;
626  Int_t previousRun = -1;
627  AliMUONDigitMaker* digitMaker = 0x0;
628  AliMUONDigitStoreV2R digitStore;
629 
630  AliMUONCalibrationData* calibData = 0x0;
631  AliMUONTriggerUtilities* trigUtilities = 0x0;
632  for ( Int_t irun=0; irun<runNumArray.GetEntries(); irun++ ) {
633  TString runNumString = runNumArray.At(irun)->GetName();
634  Int_t runNumber = runNumString.Atoi();
635 
636  if ( IsOCDBChanged(runNumber, previousRun, ocdbFileList) ) {
637  AliCDBManager::Instance()->SetRun(runNumber);
638 
639  if ( ! digitMaker ) {
640  digitMaker = new AliMUONDigitMaker(kFALSE);
641  // Create a store with all digits in trigger
642  for ( Int_t iboard=1; iboard<=234; iboard++ ) {
643  digitMaker->TriggerDigits(iboard, xyPatternAll, digitStore, kFALSE);
644  }
645  }
646 
647  if ( ! ocdbFileList ) ocdbFileList = GetOCDBList("MUON/Calib/GlobalTriggerCrateConfig,MUON/Calib/RegionalTriggerConfig,MUON/Calib/LocalTriggerBoardMasks");
648 
649  delete calibData;
650  calibData = new AliMUONCalibrationData (runNumber);
651  delete trigUtilities;
652  trigUtilities = new AliMUONTriggerUtilities (calibData);
653  }
654 
655  previousRun = runNumber;
656 
657  TIter next(digitStore.CreateIterator());
658  AliMUONVDigit* dig = 0x0;
659  while ( ( dig = static_cast<AliMUONVDigit*>(next()) ) ) {
660  Int_t icath = dig->Cathode();
661  Int_t detElemId = dig->DetElemId();
662  Int_t ich = detElemId/100-11;
663  Int_t iboard = dig->ManuId();
664  Int_t imask = 2*ich + icath;
665  static_cast<TH2*>(auxList.At(imask))->Fill(runNumString.Data(),iboard,1.);
666  static_cast<TH2*>(maskedList.At(imask))->Fill(runNumString.Data(),iboard,(Double_t)trigUtilities->IsMasked(*dig));
667  }
668  } // loop on runs
669  delete calibData;
670  delete trigUtilities;
671  delete digitMaker;
672 
673  TString canName = "";
674  for ( Int_t imask=0; imask<maskedList.GetEntries(); imask++ ) {
675  TH2* histo = static_cast<TH2*>(maskedList.At(imask));
676  histo->Divide(static_cast<TH2*>(auxList.At(imask)));
677  SetRunAxisRange(histo->GetXaxis());
678  outList.Add(histo);
679 
680  canName = Form("%sCan", histo->GetName());
681  TCanvas* can = new TCanvas(canName.Data(), canName.Data(), 200, 10, 600, 600);
682  can->SetRightMargin(0.14);
683  histo->SetStats(kFALSE);
684  if ( histo->GetMinimum() == 0. && histo->GetMaximum() == 0. ) histo->SetMaximum(0.1);
685  histo->DrawCopy("COLZ");
686  outCanList.Add(can);
687  }
688 }
689 
690 //_____________________________________________________________________________
691 Bool_t CheckPattern ( TString trigName, TObjArray* keepArray, TObjArray* rejectArray )
692 {
694  for ( Int_t ipat=0; ipat<rejectArray->GetEntries(); ++ipat ) {
695  if ( trigName.Contains(rejectArray->At(ipat)->GetName() ) ) return kFALSE;
696  } // loop on reject pattern
697 
698  for ( Int_t ipat=0; ipat<keepArray->GetEntries(); ++ipat ) {
699  if ( trigName.Contains(keepArray->At(ipat)->GetName() ) ) return kTRUE;
700  } // loop on keep pattern
701 
702  return ( keepArray->GetEntries() == 0 ) ? kTRUE : kFALSE;
703 }
704 
705 //_____________________________________________________________________________
706 TObjArray* BuildListOfTrigger ( const TObjArray* triggerArray, TString keepPattern = "", TString rejectPattern="OTHER,TRUE,PHI,ANY,EMC,-ACE-,-ABCE-,WU,MUP,SPI,SHM" )
707 {
709  TObjArray* selectedList = new TObjArray();
710  selectedList->SetOwner();
711  TObjArray* rejectArray = rejectPattern.Tokenize(",");
712  TObjArray* keepArray = keepPattern.Tokenize(",");
713 
714  for ( Int_t iTrig = 0; iTrig < triggerArray->GetEntries(); iTrig++ ){
715  TString currTrigName = ((TObjString*)triggerArray->At(iTrig))->GetName();
716  if ( CheckPattern(currTrigName, keepArray, rejectArray) ) selectedList->AddLast(new TObjString(currTrigName.Data()));
717  }
718 
719  delete rejectArray;
720  delete keepArray;
721 
722  return selectedList;
723 
724 }
725 
726 //_____________________________________________________________________________
727 TString FindCorrespondingTrigger ( TString checkTrigger, TObjArray* triggerArray )
728 {
730  TString foundName = "";
731  for ( Int_t iTrig = 0; iTrig < triggerArray->GetEntries(); iTrig++ ){
732  TString currTrigName = ((TObjString*)triggerArray->At(iTrig))->GetName();
733  TObjArray* array = currTrigName.Tokenize("-");
734  TString collisionType = array->At(1)->GetName();
735  delete array;
736  collisionType.Append("-");
737  collisionType.Prepend("-");
738  if ( checkTrigger.Contains(collisionType.Data()) ) {
739  foundName = currTrigName;
740  break;
741  }
742  }
743 
744  return foundName;
745 }
746 
747 //_____________________________________________________________________________
748 void ScalerTrending ( TObjArray runNumArray, TString mergedFileName, TString defaultStorage, TList& outCanList, TList& outList )
749 {
751  if ( ! SetAndCheckOCDB(defaultStorage) ) return;
752 
753  //trigger count from ESDs
754  TFile *file = TFile::Open(mergedFileName.Data());
755  AliCounterCollection* ccol = (AliCounterCollection*)((TDirectoryFile*)file->FindObjectAny("MUON_QA"))->FindObjectAny("eventCounters");
756 
757  //Build the trigger list for trigger with muon only in readout and min. bias triggers
758  TString triggerListName = ccol->GetKeyWords("trigger");
759 
760  TObjArray selectedTriggerArray, selectedL0TriggerArray;
761  selectedTriggerArray.SetOwner();
762  selectedL0TriggerArray.SetOwner();
763 
764  const Int_t nScaler = 3;
765  TString sScaler[nScaler] = {"L0B","L2A","L0BRATE"};
766  enum eScaler {kL0B = 0, kL2A=1, kL0BRATE=2};
767  Float_t maxScaler[nScaler] = {1e8,1e7,1e6};
768  TObjArray hFromQA;
769  TObjArray hFromScalers;
770  TObjArray hOutput;
771 
772 
773  TString sHistName, sHistNameFull, sTitleName;
774  Int_t nRuns = runNumArray.GetEntries();
775 
776  //
777  //Fill histos for Scalers and QA
778  //
779  //loop on run list
780  for ( Int_t iRun = 0; iRun < runNumArray.GetEntries(); iRun++ ) {
781 
782  TString sRunNr = ((TObjString*)runNumArray.At(iRun))->GetString();
783  Int_t runNr = sRunNr.Atoi();
784  AliAnalysisTriggerScalers triggerScaler(runNr);
785  AliTriggerConfiguration* tc = static_cast<AliTriggerConfiguration*>(triggerScaler.GetOCDBObject("GRP/CTP/Config",runNr));
786  const TObjArray& trClasses = tc->GetClasses();
787 
788  Int_t ibin = iRun+1;
789 
790  for ( Int_t itype=0; itype<2; itype++ ) {
791  TObjArray* currSelectedList = ( itype == 0 ) ? &selectedTriggerArray : &selectedL0TriggerArray;
792  TString matchTrig = ( itype == 0 ) ? "" : "C0TVX";
793  TObjArray* selectedTrigArrayForRun = BuildListOfTrigger(&trClasses, matchTrig);
794 
795  //loop on trigger list
796  for ( Int_t iTrig = 0; iTrig < selectedTrigArrayForRun->GetEntries(); iTrig++ ) {
797 
798  TString currTrigName = selectedTrigArrayForRun->At(iTrig)->GetName();
799  if ( itype == 0 && ! triggerListName.Contains(currTrigName.Data()) ) continue;
800  if ( ! currSelectedList->FindObject(currTrigName.Data()) ) currSelectedList->Add(new TObjString(currTrigName));
801 
802  //loop on scaler list
803  for ( Int_t iScaler = 0; iScaler < nScaler; iScaler++ ) {
804 
805  if ( itype == 1 && iScaler != kL0B ) continue;
806 
807  //from Scalers
808  TGraph* graph = triggerScaler.PlotTrigger(currTrigName.Data(),sScaler[iScaler].Data());
809 
810  sHistName = Form("%s_%s",currTrigName.Data(),sScaler[iScaler].Data());
811  sHistNameFull = Form("Scalers_%s",sHistName.Data());
812 
813  TH1* hist = (TH1*) hFromScalers.FindObject(sHistNameFull);
814  if ( ! hist ) {
815  hist = new TH1D(sHistNameFull,sHistName,nRuns,1.,1.+(Double_t)nRuns);
816  hist->SetDirectory(0);
817  hist->SetMinimum(1);
818  hist->SetMaximum(maxScaler[0]);
819  hFromScalers.AddLast(hist);
820  hOutput.AddLast(hist);
821  if ( iScaler == kL2A ) {
822  sHistNameFull = "QA_" + sHistName;
823  hFromQA.AddLast(hist->Clone(sHistNameFull.Data()));
824  }
825  }
826  Double_t *tab = (Double_t*) graph->GetY();
827  if ( tab ) hist->SetBinContent(ibin,tab[0]);
828  hist->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
829  delete graph;
830 
831  //from QA
832  if ( iScaler != kL2A ) continue;
833  TH1* histCounters = static_cast<TH1*>(ccol->Get("run",Form("run:%s/trigger:%s",sRunNr.Data(),currTrigName.Data())));
834  sHistNameFull = sHistNameFull = "QA_" + sHistName;
835  hist = (TH1*) hFromQA.FindObject(sHistNameFull);
836  if ( histCounters ) hist->SetBinContent(ibin,histCounters->GetSumOfWeights());
837  hist->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
838  delete histCounters;
839  }//end loop on scaler list
840  }//end loop on trigger list
841  } // end loop on type
842  }//end loop on run list
843 
844 
845  if ( selectedTriggerArray.GetEntries() == 0 ) {
846  printf("No trigger selected from trigger list %s\n",triggerListName.Data());
847  return;
848  }
849  printf("Nr of triggers selected %i\n",selectedTriggerArray.GetEntries());
850 
851  printf("Nr of T0 triggers selected %i\n",selectedL0TriggerArray.GetEntries());
852 
853  //Set options for QA and Scalers histos
854 
855  for ( Int_t itype=0; itype<2; itype++ ) {
856  TObjArray* currList = ( itype == 0 ) ? &hFromScalers : &hFromQA;
857  for ( Int_t ihisto=0; ihisto<currList->GetEntriesFast(); ihisto++ ) {
858  TH1* histo = static_cast<TH1*> ( currList->At(ihisto) );
859  if (!histo) continue;
860  // Write run number to each bin
861  for ( Int_t iRun = 0; iRun < runNumArray.GetEntries(); iRun++ ) {
862  TString sRunNr = ((TObjString*)runNumArray.At(iRun))->GetString();
863  Int_t ibin = iRun+1;
864  TString binLabel = histo->GetXaxis()->GetBinLabel(ibin);
865  if ( ! binLabel.IsNull() ) continue;
866  histo->GetXaxis()->SetBinLabel(ibin,sRunNr.Data());
867  }
868  histo->SetStats(kFALSE);
869  }
870  }
871 
872 
873  //Loop on histos from scalers and QA and create resulting histos from scalers
874  const Int_t nHisto = 3;
875  TString sHisto[nHisto] = {"L0BoverL0BC0TVX","L2AoverL0B","L2AQAoverSCALERS"};
876  TString sTitleHisto[nHisto] = {"L0B trigger / L0BC0TVX","L2A / L0B","L2A from QA / L2A from SCALERS"};
877  // TString sHisto[nHisto] = {"L2AoverL0B","L2AQAoverSCALERS"};
878 
879  //loop on trigger list
880  for ( Int_t iTrig = 0; iTrig < selectedTriggerArray.GetEntries(); iTrig++ ) {
881 
882  sHistNameFull = Form("Scalers_%s_L0B",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
883  TH1* histo1 = static_cast<TH1*> ( hFromScalers.FindObject(sHistNameFull) );
884  if (!histo1) continue;
885 
886 
887  //C0TVX
888  TString sTrig = ( (TObjString*) selectedTriggerArray.At(iTrig) )->GetName();
889  TString sL0Trig = FindCorrespondingTrigger(sTrig, &selectedL0TriggerArray);
890 
891  sHistNameFull = Form("Scalers_%s_L0B",sL0Trig.Data());
892 
893  TH1* histo0 = static_cast<TH1*> ( hFromScalers.FindObject(sHistNameFull) );
894  if ( histo0 ) {
895  sHistNameFull = Form("%s_%s",sHisto[0].Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
896  TH1* histo10 = (TH1*) histo1->Clone(sHistNameFull);
897  histo10->SetTitle(sTitleHisto[0].Data());
898  histo10->Sumw2();
899  histo10->Divide(histo0);
900  histo10->SetMaximum(10);
901  histo10->SetMinimum(1e-5);
902  //outList.Add(histo10);
903  hOutput.AddLast(histo10);
904  //outList.Add(histo0);
905  //outList.Add(histo1);
906  }
907 
908  //DEADTIME
909  sHistNameFull = Form("Scalers_%s_L2A",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
910  TH1* histo2 = static_cast<TH1*> ( hFromScalers.FindObject(sHistNameFull) );
911  if (!histo2) continue;
912 
913  sHistNameFull = Form("%s_%s",sHisto[1].Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
914  TH1* histo3 = (TH1*) histo2->Clone(sHistNameFull);
915  histo3->SetTitle(sTitleHisto[1]);
916  histo3->Sumw2();
917  histo3->Divide(histo1);
918  histo3->SetMaximum(1.2);
919  histo3->SetMinimum(1e-5);
920  //outList.Add(histo3);
921  hOutput.AddLast(histo3);
922 
923  //QA over Scalers
924  sHistNameFull = Form("QA_%s_L2A",((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
925  TH1* histo4 = static_cast<TH1*> ( hFromQA.FindObject(sHistNameFull) );
926  if (!histo4) continue;
927 
928  sHistNameFull = Form("%s_%s",sHisto[2].Data(),((TObjString*) selectedTriggerArray.At(iTrig))->GetName());
929  TH1* histo5 = (TH1*) histo4->Clone(sHistNameFull);
930  histo5->SetTitle(sTitleHisto[2]);
931  histo5->Sumw2();
932  histo5->Divide(histo2);
933  histo5->SetMaximum(1.2);
934  histo5->SetMinimum(5e-1);
935  //outList.Add(histo5);
936  hOutput.AddLast(histo5);
937  }
938 
939  // Plot all on canvases (only canvases will be saved)
940  const Int_t nCanvases = nScaler + nHisto;
941  TString sCanvases[nCanvases];
942  for (Int_t iScaler = 0; iScaler < nScaler; iScaler++) sCanvases[iScaler] = sScaler[iScaler];
943  for (Int_t iHisto = 0; iHisto < nHisto; iHisto++) sCanvases[nScaler+iHisto] = sHisto[iHisto];
944 
945  //loop on canvases
946  for ( Int_t iCan = 0; iCan < nCanvases; iCan++) {
947  TCanvas* canvas = new TCanvas(sCanvases[iCan],sCanvases[iCan],200,10,600,600);
948  TLegend* leg = new TLegend(0.72,0.7,0.9,0.85);
949  leg->SetBorderSize(1);
950  if ( iCan != 4 ) canvas->SetLogy();
951  TString optDraw = "e";
952 
953  //loop on trigger list
954  Int_t icolor = 1;
955  for ( Int_t iTrig = 0; iTrig < selectedTriggerArray.GetEntries(); iTrig++ ) {
956 
957  if ( iCan < nScaler ) sHistNameFull = Form("Scalers_%s_%s",selectedTriggerArray.At(iTrig)->GetName(),sCanvases[iCan].Data());
958  else sHistNameFull = Form("%s_%s",sCanvases[iCan].Data(),selectedTriggerArray.At(iTrig)->GetName());
959  TH1* histo1 = static_cast<TH1*> ( hOutput.FindObject(sHistNameFull) );
960  if (!histo1) continue;
961 
962  if ( icolor == 10 ) icolor++;
963  histo1->SetLineColor(icolor++);
964  histo1->Draw(optDraw);
965  optDraw = "esame";
966 
967  leg->AddEntry(histo1,selectedTriggerArray.At(iTrig)->GetName(),"l");
968  }
969 
970  leg->Draw();
971  outList.Add(canvas);
972  outCanList.Add(canvas);
973  }
974 
975  file->Close();
976 }
977 
978 //_____________________________________________________________________________
979 void trigEffQA(TString fileListName, TString outFilename = "", TString defaultStorage = "raw://", Bool_t doScalers = kFALSE, TString trackerQAmergedOut="QAresults_merged.root")
980 {
982  ifstream inFile(fileListName.Data());
983  TObjArray fileNameArray, runNumArray;
984  fileNameArray.SetOwner();
985  runNumArray.SetOwner();
986  TString currString = "";
987  if (inFile.is_open()) {
988  while (! inFile.eof() ) {
989  currString.ReadLine(inFile); // Read line
990  if ( ! currString.Contains(".root") ||
991  currString.BeginsWith("#") ) continue;
992  fileNameArray.AddLast(new TObjString(currString.Data()));
993  Int_t runNum = GetRunNumber(currString);
994  runNumArray.AddLast(new TObjString(Form("%i",runNum)));
995  }
996  inFile.close();
997  }
998  else {
999  printf("Fatal: cannot open input file %s\n",fileListName.Data());
1000  return;
1001  }
1002 
1003  runNumArray.Sort();
1004 
1005  // Instead of using the efficiency stored in the QA output
1006  // search for the new efficiency produced with trigger tracks only
1007  TObjArray* finalFileNameArray = ChangeFilenames(fileNameArray);
1008 
1009  TList outCanList, outList;
1010  TrigEffTrending(runNumArray, *finalFileNameArray, outCanList, outList);
1011  if ( SetAndCheckOCDB(defaultStorage) ) {
1012  MaskTrending(runNumArray, defaultStorage, outCanList, outList);
1013  if ( doScalers ) {
1014  if ( gSystem->AccessPathName(trackerQAmergedOut.Data()) ) {
1015  printf("Warning: cannot perform scaler trending:\n merged QA from tracker\n %s\n does not exist\n",trackerQAmergedOut.Data());
1016  }
1017  else {
1018  ScalerTrending(runNumArray, trackerQAmergedOut, defaultStorage, outCanList, outList);
1019  }
1020  }
1021  }
1022 
1023  delete finalFileNameArray;
1024 
1025  if ( outFilename.IsNull() ) return;
1026 
1027  TString outCanName = outFilename;
1028  outCanName.ReplaceAll(".root",".pdf");
1029  for ( Int_t ican=0; ican<outCanList.GetEntries(); ican++ ) {
1030  TString canName = outCanName;
1031  if ( ican == 0 ) canName.Append("("); // open pdf file
1032  else if ( ican == outCanList.GetEntries()-1 ) canName.Append(")"); // close pdf file
1033  static_cast<TCanvas*>(outCanList.At(ican))->Print(canName.Data());
1034  }
1035  // There is a bug when creating a pdf
1036  // So create a ps and then convert via epstopdf
1037  if ( outCanName.Contains(".ps") || outCanName.Contains(".eps") ) {
1038  gSystem->Exec(Form("epstopdf %s", outCanName.Data()));
1039  gSystem->Exec(Form("rm %s", outCanName.Data()));
1040  }
1041 
1042  TFile* outFile = new TFile(outFilename.Data(), "recreate");
1043  outList.Write();
1044  outFile->Close();
1045 }
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:727
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:706
Int_t GetRunNumber(TString filePath)
Definition: trigEffQA.C:90
void ScalerTrending(TObjArray runNumArray, TString mergedFileName, TString defaultStorage, TList &outCanList, TList &outList)
Definition: trigEffQA.C:748
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:377
void MaskTrending(TObjArray runNumArray, TString defaultStorage, TList &outCanList, TList &outList)
Definition: trigEffQA.C:595
void TrigEffTrending(TObjArray runNumArray, TObjArray fileNameArray, TList &outCanList, TList &outList)
Definition: trigEffQA.C:396
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:691
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:979