AliPhysics  29d4213 (29d4213)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliAnalysisTaskTrigChEff.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-2007, ALICE Experiment at CERN, All rights reserved. *
3  * *
4  * Author: The ALICE Off-line Project. *
5  * Contributors are mentioned in the code where appropriate. *
6  * *
7  * Permission to use, copy, modify and distribute this software and its *
8  * documentation strictly for non-commercial purposes is hereby granted *
9  * without fee, provided that the above copyright notice appears in all *
10  * copies and that both the copyright notice and this permission notice *
11  * appear in the supporting documentation. The authors make no claims *
12  * about the suitability of this software for any purpose. It is *
13  * provided "as is" without express or implied warranty. *
14  **************************************************************************/
15 
16 /* $Id$ */
17 
19 
20 // ROOT includes
21 #include "TH1.h"
22 #include "TH2.h"
23 #include "TCanvas.h"
24 #include "TLegend.h"
25 #include "TMath.h"
26 #include "TObjString.h"
27 #include "TObjArray.h"
28 #include "TStyle.h"
29 #include "TROOT.h"
30 #include "TGraphAsymmErrors.h"
31 #include "TList.h"
32 #include "TFile.h"
33 
34 // STEER includes
35 #include "AliVParticle.h"
36 #include "AliAODTrack.h"
37 #include "AliESDMuonTrack.h"
38 
39 // ANALYSIS includes
40 #include "AliAnalysisManager.h"
41 #include "AliAnalysisDataSlot.h"
42 #include "AliAnalysisDataContainer.h"
43 
44 // PWG3 includes
45 #include "AliVAnalysisMuon.h"
46 #include "AliMuonEventCuts.h"
47 #include "AliMuonTrackCuts.h"
48 #include "AliMergeableCollection.h"
49 #include "AliAnalysisMuonUtility.h"
50 #include "AliTrigChEffOutput.h"
51 
52 
54 ClassImp(AliAnalysisTaskTrigChEff) // Class implementation in ROOT context
56 
57 
58 //________________________________________________________________________
60  AliVAnalysisMuon(),
61  fAnalysisOutput(0x0),
62  fList(0x0)
63 {
65 }
66 
67 //________________________________________________________________________
68 AliAnalysisTaskTrigChEff::AliAnalysisTaskTrigChEff(const char *name, const AliMuonTrackCuts& cuts) :
69  AliVAnalysisMuon(name, cuts),
70  fAnalysisOutput(0x0),
71  fList(0x0)
72 {
73  //
75  //
76 
77  DefineOutput(2, TList::Class());
78 }
79 
80 
81 //________________________________________________________________________
83 {
84  //
86  //
87  delete fAnalysisOutput;
88  if ( ! AliAnalysisManager::GetAnalysisManager() || ! AliAnalysisManager::GetAnalysisManager()->IsProofMode() ) {
89  delete fList;
90  }
91 }
92 
93 
94 //___________________________________________________________________________
96 {
97  //
100  //
101 
102  TString histoName = "";
103  for ( Int_t isel=0; isel<kNselections; ++isel ) {
104  for ( Int_t itrig=0; itrig<GetAllSelectedTrigClasses()->GetEntries(); ++itrig ) {
105  for ( Int_t icent=1; icent<=GetCentralityClasses()->GetNbins(); ++icent ) {
106  for ( Int_t itrackSel=0; itrackSel<AliTrigChEffOutput::kNtrackSel; ++itrackSel ) {
107  for ( Int_t imethod=0; imethod<AliTrigChEffOutput::kNeffMethods; ++imethod ) {
108  for ( Int_t itype=0; itype<AliTrigChEffOutput::kNhistoTypes; ++itype ) {
109  for ( Int_t icount=-1; icount<AliTrigChEffOutput::kNcounts; ++icount ) {
110  for ( Int_t ich=-1; ich<4; ++ich ) {
111  for ( Int_t imatch=AliTrigChEffOutput::kMatchApt; imatch<AliTrigChEffOutput::kMatchHpt; ++imatch ) {
112  TH1* histo = 0x0;
113  for ( Int_t jmatch=imatch+1; jmatch<=AliTrigChEffOutput::kMatchHpt; ++jmatch ) {
114  histoName = fAnalysisOutput->GetHistoName(itype, icount, ich, itrackSel, jmatch, imethod);
115  TH1* histoAdd = static_cast<TH1*>(fMergeableCollection->GetObject(Form("/%s/%s/%s/",fPhysSelKeys->At(isel)->GetName(), GetAllSelectedTrigClasses()->At(itrig)->GetName(), GetCentralityClasses()->GetBinLabel(icent)), histoName));
116  if ( ! histoAdd ) continue;
117  histoName = fAnalysisOutput->GetHistoName(itype, icount, ich, itrackSel, imatch, imethod);
118  if ( ! histo ) histo = static_cast<TH1*>(GetMergeableObject(fPhysSelKeys->At(isel)->GetName(), GetAllSelectedTrigClasses()->At(itrig)->GetName(), GetCentralityClasses()->GetBinLabel(icent), histoName));
119  AliDebug(2,Form("Adding %s (%g) to %s (%g)", histoAdd->GetName(), histoAdd->Integral(), histo->GetName(), histo->Integral()));
120  histo->Add(histoAdd);
121  } // loop on higher pt matching
122  } // loop on match trigger
123  } // loop on chamber
124  } // loop on count type
125  } // loop on histo type
126  } // loop on eff method
127  } // loop on track selection
128  } // loop on centrality
129  } // loop on trigger classes
130  } // loop on physics selection
131 
132  TString physSel = fPhysSelKeys->At(kPhysSelPass)->GetName();
133  TString trigClass = "ANY";
134  TString centrality = "-100_200";
136 
137  TList* outList = fAnalysisOutput->GetEffHistoList(physSel, trigClass, centrality, histoPattern);
138  outList->SetOwner(kFALSE);
139  TIter next(outList);
140  TObject* obj;
141  while ( (obj = next()) ) fList->Add(obj);
142  delete outList;
143 
144  AliVAnalysisMuon::FinishTaskOutput();
145 }
146 
147 
148 //___________________________________________________________________________
150 {
151  //
153  //
154 
155  TString histoName = "";
156 
157  fAnalysisOutput = new AliTrigChEffOutput(fOutputList);
158 
159  for ( Int_t itrackSel = 0; itrackSel<AliTrigChEffOutput::kNtrackSel; ++itrackSel ) {
160  for ( Int_t imethod=0; imethod<AliTrigChEffOutput::kNeffMethods; ++imethod ) {
161  for ( Int_t imatch = 0; imatch<AliTrigChEffOutput::kNtrigMatch; ++imatch ) {
162  for ( Int_t icount=0; icount<AliTrigChEffOutput::kNcounts; ++icount ) {
163  AddObjectToCollection(fAnalysisOutput->GetCountHisto(AliTrigChEffOutput::kHchamberEff, icount, -1, itrackSel, imatch, imethod));
164  for ( Int_t ich=0; ich<4; ++ich ) {
165  AddObjectToCollection(fAnalysisOutput->GetCountHisto(AliTrigChEffOutput::kHslatEff, icount, ich, itrackSel, imatch, imethod));
166  AddObjectToCollection(fAnalysisOutput->GetCountHisto(AliTrigChEffOutput::kHboardEff, icount, ich, itrackSel, imatch, imethod));
167  }
168  } // loop on counts
169 
170  AddObjectToCollection(fAnalysisOutput->GetCountHisto(AliTrigChEffOutput::kHcheckBoard, -1, -1, itrackSel, imatch, imethod));
171  } // loop on trig match
172  } // loop on eff method
173  } // loop on track selection
174 
175  fMuonTrackCuts->Print();
176 
177  fList = new TList();
178  fList->SetOwner();
179  PostData(2, fList);
180 }
181 
182 //________________________________________________________________________
183 void AliAnalysisTaskTrigChEff::ProcessEvent(TString physSel, const TObjArray& selectTrigClasses, TString centrality)
184 {
185  //
187  //
188 
189  Int_t slat = 0, board = 0;
190  UInt_t pattern = 0;
191  TString histoName = "";
192 
193  TArrayI othersEfficient(4);
194 
195  AliVParticle* track = 0x0;
196 
197  UInt_t addMask[4] = {0, AliMuonTrackCuts::kMuMatchApt, AliMuonTrackCuts::kMuMatchApt|AliMuonTrackCuts::kMuMatchLpt, AliMuonTrackCuts::kMuMatchApt|AliMuonTrackCuts::kMuMatchLpt|AliMuonTrackCuts::kMuMatchHpt};
198 
199  Int_t nTracks = AliAnalysisMuonUtility::GetNTracks(InputEvent());
200  for ( Int_t itrack = 0; itrack < nTracks; ++itrack ) {
201  track = AliAnalysisMuonUtility::GetTrack(itrack,InputEvent());
202 
203  Bool_t matchTracker = AliAnalysisMuonUtility::IsMuonTrack(track);
204 
205  Int_t matchTrig = AliAnalysisMuonUtility::GetMatchTrigger(track);
206  UInt_t selection = fMuonTrackCuts->GetSelectionMask(track);
207 
208  // Apply the sharp pt cut according to the matched pt level of the track
209  UInt_t filterMask = fMuonTrackCuts->GetFilterMask() | addMask[matchTrig];
210  Bool_t isSelected = ( ( selection & filterMask ) == filterMask );
211 
212  for ( Int_t imethod=0; imethod<AliTrigChEffOutput::kNeffMethods; ++imethod ) {
213  if ( imethod == AliTrigChEffOutput::kEffFromTrack ) {
214  if ( ! matchTracker || track->P() < 10. ) continue;
215  pattern = AliAnalysisMuonUtility::GetMUONTrigHitsMapTrk(track);
216  board = AliESDMuonTrack::GetCrossedBoard(pattern);
217  }
218  else {
219  if ( matchTrig == 0 ) continue;
220  pattern = AliAnalysisMuonUtility::GetMUONTrigHitsMapTrg(track);
221  board = ( AliAnalysisMuonUtility::IsAODEvent(InputEvent()) ) ? AliESDMuonTrack::GetCrossedBoard(pattern) : ((AliESDMuonTrack*)track)->LoCircuit();
222  }
223 
224  Int_t effFlag = AliESDMuonTrack::GetEffFlag(pattern);
225 
226  if ( effFlag < AliESDMuonTrack::kChEff ) {
227  for ( Int_t itrackSel=0; itrackSel<AliTrigChEffOutput::kNtrackSel; ++itrackSel ) {
228  if ( itrackSel == AliTrigChEffOutput::kSelectTrack && ! isSelected ) continue;
229  for ( Int_t itrig=0; itrig<selectTrigClasses.GetEntries(); ++itrig ) {
230  TString trigClassName = ((TObjString*)selectTrigClasses.At(itrig))->GetString();
231 
232  histoName = fAnalysisOutput->GetHistoName(AliTrigChEffOutput::kHcheckBoard, -1, -1, itrackSel, matchTrig, imethod);
233  ((TH2F*)GetMergeableObject(physSel, trigClassName, centrality, histoName))->Fill(AliESDMuonTrack::GetSlatOrInfo(pattern), board);
234  }
235  }
236  continue; // Track not good for efficiency calculation
237  }
238 
239  othersEfficient.Reset(1);
240  for ( Int_t cath=0; cath<2; ++cath ) {
241  for ( Int_t ich=0; ich<4; ++ich ) {
242  if ( ! AliESDMuonTrack::IsChamberHit(pattern, cath, ich) ) {
243  for ( Int_t jch=0; jch<4; jch++ ) {
244  if ( jch != ich ) othersEfficient[jch] = 0;
245  } // loop on other chambers
246  break;
247  } // if chamber not efficient
248  } // loop on chambers
249  } // loop on cathodes
250 
251  Bool_t rejectTrack = kTRUE;
252  for ( Int_t ich=0; ich<4; ++ich ) {
253  if ( othersEfficient[ich] > 0 ) {
254  rejectTrack = kFALSE;
255  break;
256  }
257  }
258 
259  if ( rejectTrack ) continue;
260 
261  slat = AliESDMuonTrack::GetSlatOrInfo(pattern);
262 
263  for ( Int_t ich=0; ich<4; ++ich ) {
264  if ( ! othersEfficient[ich] )
265  continue; // Reject track if the info of the chamber under study
266  // is necessary to create the track itself
267 
268  Int_t iChamber = 11 + ich;
269 
270  Bool_t hitsBend = AliESDMuonTrack::IsChamberHit(pattern, 0, ich);
271  Bool_t hitsNonBend = AliESDMuonTrack::IsChamberHit(pattern, 1, ich);
272 
273  Bool_t fillHisto[AliTrigChEffOutput::kNcounts] = {
274  hitsBend,
275  hitsNonBend,
276  ( hitsBend && hitsNonBend ),
277  kTRUE
278  };
279 
280  for ( Int_t itrackSel=0; itrackSel<AliTrigChEffOutput::kNtrackSel; ++itrackSel ) {
281  if ( itrackSel == AliTrigChEffOutput::kSelectTrack && ! isSelected ) continue;
282  for (Int_t icount=0; icount<AliTrigChEffOutput::kNcounts; ++icount){
283  if ( ! fillHisto[icount] ) continue;
284  for ( Int_t itrig=0; itrig<selectTrigClasses.GetEntries(); ++itrig ) {
285  TString trigClassName = ((TObjString*)selectTrigClasses.At(itrig))->GetString();
286 
287  histoName = fAnalysisOutput->GetHistoName(AliTrigChEffOutput::kHchamberEff, icount, -1, itrackSel, matchTrig, imethod);
288  static_cast<TH1*>(GetMergeableObject(physSel, trigClassName, centrality, histoName))->Fill(iChamber);
289 
290  if ( effFlag < AliESDMuonTrack::kSlatEff ) continue; // Track crossed different slats
291  histoName = fAnalysisOutput->GetHistoName(AliTrigChEffOutput::kHslatEff, icount, ich, itrackSel, matchTrig, imethod);
292  static_cast<TH1*>(GetMergeableObject(physSel, trigClassName, centrality, histoName))->Fill(slat);
293 
294  if ( effFlag < AliESDMuonTrack::kBoardEff ) continue; // Track crossed different boards
295  histoName = fAnalysisOutput->GetHistoName(AliTrigChEffOutput::kHboardEff, icount, ich, itrackSel, matchTrig, imethod);
296  static_cast<TH1*>(GetMergeableObject(physSel, trigClassName, centrality, histoName))->Fill(board);
297  } // loop on trigger classes
298  } // loop on count types
299  } // loop on track selection
300  } // loop on chambers
301  } // loop on tracks
302  } // loop on eff methods
303 
304  PostData(2, fList);
305 }
306 
307 
308 //________________________________________________________________________
310 {
311  //
313  //
314 
315  AliVAnalysisMuon::Terminate("");
316 
317  if ( ! fMergeableCollection ) return;
318 
319  delete fAnalysisOutput;
320  fAnalysisOutput = new AliTrigChEffOutput(fOutputList);
321 
322  Int_t xshift = 100;
323  Int_t yshift = 20;
324  Int_t igroup1 = -1;
325  Int_t igroup2 = 0;
326 
327  TObjArray* physSel = ((TObjString*)fTerminateOptions->At(0))->GetString().Tokenize(" ");
328  physSel->SetOwner();
329  TObjArray* trigClasses = ((TObjString*)fTerminateOptions->At(1))->GetString().Tokenize(" ");
330  trigClasses->SetOwner();
331  TObjArray* centrality = ((TObjString*)fTerminateOptions->At(2))->GetString().Tokenize(" ");
332  centrality->SetOwner();
333  TString furtherOpt = ((TObjString*)fTerminateOptions->At(3))->GetString();
334 
335  TString currName = "";
336  TObjArray* optArr = furtherOpt.Tokenize(" ");
337  TObjArray trackSel, methodSel;
338  trackSel.SetOwner();
339  methodSel.SetOwner();
340  TString outFileOpt = "";
341  for ( Int_t iopt=0; iopt<optArr->GetEntries(); iopt++ ) {
342  currName = optArr->At(iopt)->GetName();
343  if ( currName.Contains(".root") ) outFileOpt = currName;
344  else if ( currName.Contains("Match") ) trackSel.Add(new TObjString(currName));
345  else if ( currName.Contains("From") ) methodSel.Add(new TObjString(currName));
346  }
347  delete optArr;
348 
349  if ( trackSel.GetEntries() == 0 ) trackSel.Add(new TObjString(fAnalysisOutput->GetHistoName(-1,-1,-1,AliTrigChEffOutput::kSelectTrack,AliTrigChEffOutput::kMatchApt,-1)));
350  if ( methodSel.GetEntries() == 0 ) methodSel.Add(new TObjString(fAnalysisOutput->GetHistoName(-1, -1, -1, -1, -1, AliTrigChEffOutput::kEffFromTrack)));
351 
352  furtherOpt.ToUpper();
353 
354  Int_t chosenType = ( furtherOpt.Contains("BOARD") ) ? AliTrigChEffOutput::kHboardEff : AliTrigChEffOutput::kHslatEff;
355 
356  igroup1++;
357  igroup2 = 0;
358  TString histoName = "", yAxisTitle = "";
359 
360  TH1 *num = 0x0;
361  TH1 *den = 0x0;
362  TGraphAsymmErrors* effGraph = 0x0;
363 
365  // Show tests //
367 
368  for ( Int_t icount=0; icount<AliTrigChEffOutput::kNcounts-1; ++icount ) {
369  currName = fAnalysisOutput->GetHistoName(chosenType, icount, -1, -1, -1, -1);
370  currName += "_can";
371  TCanvas* can = new TCanvas(currName.Data(), currName.Data(), igroup1*xshift,igroup2*yshift,600,600);
372  can->Divide(2,2);
373  TLegend* leg = new TLegend(0.6, 0.6, 0.9, 0.9);
374  leg->SetBorderSize(1);
375  for ( Int_t ich=0; ich<4; ++ich ) {
376  TGraph* refGraph = 0x0;
377  can->cd(ich+1);
378  gPad->SetRightMargin(0.03);
379  Int_t icolor = 1;
380  Int_t istyle = 0;
381  TString drawOpt = "AP";
382  for ( Int_t isel=0; isel<physSel->GetEntries(); ++isel ) {
383  for ( Int_t itrig=0; itrig<trigClasses->GetEntries(); ++itrig ) {
384  for ( Int_t icent=0; icent<centrality->GetEntries(); ++icent ) {
385  for ( Int_t imethodSel=0; imethodSel<methodSel.GetEntries(); ++imethodSel ) {
386  for ( Int_t itrackSel=0; itrackSel<trackSel.GetEntries(); ++itrackSel ) {
387  histoName = fAnalysisOutput->GetHistoName(chosenType, AliTrigChEffOutput::kAllTracks, ich, -1, -1, -1); // partial name
388  histoName += Form("%s%s",trackSel.At(itrackSel)->GetName(),methodSel.At(imethodSel)->GetName());
389  den = static_cast<TH1*>(fAnalysisOutput->GetSum(physSel->At(isel)->GetName(), trigClasses->At(itrig)->GetName(), centrality->At(icent)->GetName(), histoName.Data()));
390  if ( ! den ) {
391  printf("Warning: cannot find %s\n", histoName.Data());
392  continue;
393  }
394  histoName = fAnalysisOutput->GetHistoName(chosenType, icount, ich, -1, -1, -1); // partial name
395  histoName += Form("%s%s",trackSel.At(itrackSel)->GetName(),methodSel.At(imethodSel)->GetName());
396  num = static_cast<TH1*>(fAnalysisOutput->GetSum(physSel->At(isel)->GetName(), trigClasses->At(itrig)->GetName(), centrality->At(icent)->GetName(), histoName.Data()));
397  if ( ! num ) continue;
398  effGraph = new TGraphAsymmErrors(num, den, "e0");
399  currName = Form("%s_%s_%s_%s_%s", physSel->At(isel)->GetName(), trigClasses->At(itrig)->GetName(), centrality->At(icent)->GetName(), trackSel.At(itrackSel)->GetName(), methodSel.At(imethodSel)->GetName());
400  effGraph->SetTitle(currName.Data());
401 
402  Double_t ymin = 0.;
403  Double_t ymax = 1.1;
404  yAxisTitle = "Efficiency";
405 
406  if ( furtherOpt.Contains("DIFF") || furtherOpt.Contains("PULL") ) {
407  if ( ! refGraph ) {
408  refGraph = effGraph;
409  continue;
410  }
411  Double_t currX, currY, baseX, baseY, errYlow = 0., errYhigh = 0., newY = 0.;
412  Double_t refVal = 1., errY = 0.;
413  for ( Int_t ipoint=0; ipoint<effGraph->GetN(); ipoint++ ) {
414  refGraph->GetPoint(ipoint, baseX, baseY);
415  effGraph->GetPoint(ipoint, currX, currY);
416  Double_t errX = effGraph->GetErrorXlow(ipoint);
417  if ( furtherOpt.Contains("DIFF") ) {
418  refVal = ( baseY > 0. ) ? baseY : 1.;
419  newY = ( currY - baseY ) / refVal;
420  Double_t errYlow1 = effGraph->GetErrorYlow(ipoint);
421  Double_t errYlow2 = refGraph->GetErrorYlow(ipoint);
422  Double_t errYhigh1 = effGraph->GetErrorYhigh(ipoint);
423  Double_t errYhigh2 = refGraph->GetErrorYhigh(ipoint);
424  errYlow = TMath::Sqrt(errYlow1*errYlow1 + errYlow2*errYlow2) / refVal;
425  errYhigh = TMath::Sqrt(errYhigh1*errYhigh1 + errYhigh2*errYhigh2) / refVal;
426  //yAxisTitle = Form("(%s - %s) / %s", effGraph->GetTitle(), refGraph->GetTitle(), refGraph->GetTitle());
427  yAxisTitle = "(eff - ref ) / ref";
428  effGraph->SetTitle(Form("Rel. diff. w.r.t. %s", refGraph->GetTitle()));
429  ymin = -0.1;
430  ymax = 0.1;
431  }
432  else if ( furtherOpt.Contains("PULL") ) {
433  errY = 0.5 * ( effGraph->GetErrorYlow(ipoint) + effGraph->GetErrorYhigh(ipoint));
434  newY = ( errY > 0. ) ? ( currY - baseY ) / errY : 0.;
435  errYlow = 1.;
436  errYhigh = 1.;
437  //yAxisTitle = Form("( %s - %s ) / err", effGraph->GetTitle(), refGraph->GetTitle());
438  yAxisTitle = "(eff - ref ) / err";
439  effGraph->SetTitle(Form("Pull w.r.t. %s", refGraph->GetTitle()));
440  ymin = -4.;
441  ymax = 4.;
442  }
443  effGraph->SetPoint(ipoint, currX, newY);
444  effGraph->SetPointError(ipoint, errX, errX, errYlow, errYhigh);
445  } // loop on points
446  }
447  effGraph->GetYaxis()->SetRangeUser(ymin, ymax);
448  effGraph->GetYaxis()->SetTitle(yAxisTitle.Data());
449  effGraph->SetLineColor(icolor);
450  effGraph->SetMarkerColor(icolor);
451  effGraph->SetMarkerStyle(20 + istyle);
452  //effGraph->SetMarkerSize(0.3);
453  icolor++;
454  if ( icolor == 5 || icolor == 10 ) icolor++;
455  istyle++;
456  effGraph->Draw(drawOpt.Data());
457  drawOpt = "P";
458  if ( ich < 3 ) continue;
459  leg->AddEntry(effGraph, currName.Data(), "lp");
460  } // loop on match trigger
461  } // loop on eff method
462  } // loop on centrality
463  } // loop on trigger classes
464  } // loop on physics selection
465  } // loop on chamber
466  leg->Draw("same");
467  } // loop on count type
468  //} // loop on detection element type
469 
470  delete physSel;
471  delete trigClasses;
472  delete centrality;
473 
474 
475  fList = dynamic_cast<TList*>(GetOutputData(2));
476  if ( fList ) {
477 
479  // Show final efficiency //
481  TString baseName[3] = {"Chamber", "RPC", "Board"};
483  TString effName[AliTrigChEffOutput::kNcounts-1] = {"BendPlane", "NonBendPlane", "BothPlanes"};
484  for ( Int_t itype=0; itype<3; itype++ ) {
485  for ( Int_t icount=0; icount<AliTrigChEffOutput::kNcounts-1; icount++ ){
486  TString canName = Form("efficiencyPer%s_%s",baseName[itype].Data(),effName[icount].Data());
487  TCanvas* can = new TCanvas(canName.Data(),canName.Data(),10*(1+AliTrigChEffOutput::kNcounts*itype+icount),10*(1+AliTrigChEffOutput::kNcounts*itype+icount),310,310);
488  can->SetFillColor(10); can->SetHighLightColor(10);
489  can->SetLeftMargin(0.15); can->SetBottomMargin(0.15);
490  if ( itype > 0 )
491  can->Divide(2,2);
492 
493  for ( Int_t ich=-1; ich<4; ich++ ) {
494  histoName = fAnalysisOutput->GetHistoName(baseIndex[itype], icount, ich, -1, -1, -1);
495  num = static_cast<TH1*>(fList->FindObject(histoName.Data()));
496  histoName = fAnalysisOutput->GetHistoName(baseIndex[itype], AliTrigChEffOutput::kNcounts-1, ich, -1, -1, -1);
497  den = static_cast<TH1*>(fList->FindObject(histoName.Data()));
498  if ( ! num || ! den ) continue;
499  effGraph = new TGraphAsymmErrors(num, den, "e0");
500  effGraph->GetYaxis()->SetRangeUser(0., 1.1);
501  effGraph->GetYaxis()->SetTitle("Efficiency");
502  effGraph->GetXaxis()->SetTitle(baseName[itype].Data());
503  can->cd(ich+1);
504  effGraph->Draw("AP");
505  if ( itype == 0 ) break;
506  } // loop on chamber
507  } // loop on count types
508  } // loop on histo
509  }
510 
511 
512  if ( ! outFileOpt.IsNull() ) {
513  TObjArray* outFileOptList = outFileOpt.Tokenize("?");
514  AliInfo(Form("Creating file %s", outFileOptList->At(0)->GetName()));
515  TList* effList = fAnalysisOutput->GetEffHistoList(outFileOptList->At(1)->GetName(), outFileOptList->At(2)->GetName(), outFileOptList->At(3)->GetName(), outFileOptList->At(4)->GetName());
516  effList->SetName(GetOutputSlot(2)->GetContainer()->GetName());
517  if ( effList ->GetEntries() == 0 ) {
518  printf("\nWarning: no histograms satisfying the requested conditions.\n(%s %s %s %s).\nOutput %s not created.\n", outFileOptList->At(1)->GetName(), outFileOptList->At(2)->GetName(), outFileOptList->At(3)->GetName(), outFileOptList->At(4)->GetName(),outFileOptList->At(0)->GetName());
519  }
520  else {
521  TFile* outFile = TFile::Open(outFileOptList->At(0)->GetName(), "RECREATE");
522  effList->Write(effList->GetName(),TObject::kSingleKey);
523  outFile->Close();
524  }
525  delete effList;
526  delete outFileOptList;
527  }
528 }
Counts per cathode histogram index.
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
const Double_t ymax
Definition: AddTaskCFDStar.C:7
void ProcessEvent(TString physSel, const TObjArray &selectTrigClasses, TString centrality)
tracks used for calculation
Total number of matched types.
Hit pattern from tracker track extrapolation.
centrality
AliTrigChEffOutput * fAnalysisOutput
! Output handler
Counts per slat histogram index.
Total number of track selection.
Number of count type.
TH1 * GetCountHisto(Int_t itype, Int_t icount, Int_t ichamber, Int_t itrackSel, Int_t imatch, Int_t imethod)
Output for Trig chamber effieincy.
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)
Check rejected tracks per board.
const Double_t ymin
Definition: AddTaskCFDStar.C:6
Counts per board histogram index.
TList * GetEffHistoList(TString physSel, TString trigClassNames, TString centrality, TString trackSelection)
Check rejected tracks per board.
TList * fList
! TList output object
Total number of efficiency methods.
TString GetHistoName(Int_t itype, Int_t icount, Int_t ichamber, Int_t itrackSel, Int_t imatch, Int_t imethod)