AliPhysics  323987d (323987d)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
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";
135 
137  outList->SetOwner(kFALSE);
138  TIter next(outList);
139  TObject* obj;
140  while ( (obj = next()) ) fList->Add(obj);
141  delete outList;
142 
143  AliVAnalysisMuon::FinishTaskOutput();
144 }
145 
146 
147 //___________________________________________________________________________
149 {
150  //
152  //
153 
154  TString histoName = "";
155 
156  fAnalysisOutput = new AliTrigChEffOutput(fOutputList);
157 
158  for ( Int_t itrackSel = 0; itrackSel<AliTrigChEffOutput::kNtrackSel; ++itrackSel ) {
159  for ( Int_t imethod=0; imethod<AliTrigChEffOutput::kNeffMethods; ++imethod ) {
160  for ( Int_t imatch = 0; imatch<AliTrigChEffOutput::kNtrigMatch; ++imatch ) {
161  for ( Int_t icount=0; icount<AliTrigChEffOutput::kNcounts; ++icount ) {
162  AddObjectToCollection(fAnalysisOutput->GetCountHisto(AliTrigChEffOutput::kHchamberEff, icount, -1, itrackSel, imatch, imethod));
163  for ( Int_t ich=0; ich<4; ++ich ) {
164  AddObjectToCollection(fAnalysisOutput->GetCountHisto(AliTrigChEffOutput::kHslatEff, icount, ich, itrackSel, imatch, imethod));
165  AddObjectToCollection(fAnalysisOutput->GetCountHisto(AliTrigChEffOutput::kHboardEff, icount, ich, itrackSel, imatch, imethod));
166  }
167  } // loop on counts
168 
169  AddObjectToCollection(fAnalysisOutput->GetCountHisto(AliTrigChEffOutput::kHcheckBoard, -1, -1, itrackSel, imatch, imethod));
170  } // loop on trig match
171  } // loop on eff method
172  } // loop on track selection
173 
174  fMuonTrackCuts->Print();
175 
176  fList = new TList();
177  fList->SetOwner();
178  PostData(2, fList);
179 }
180 
181 //________________________________________________________________________
183 {
184  //
186  //
187 
188  Int_t slat = 0, board = 0;
189  UInt_t pattern = 0;
190  TString histoName = "";
191 
192  TArrayI othersEfficient(4);
193 
194  AliVParticle* track = 0x0;
195 
196  UInt_t addMask[4] = {0, AliMuonTrackCuts::kMuMatchApt, AliMuonTrackCuts::kMuMatchApt|AliMuonTrackCuts::kMuMatchLpt, AliMuonTrackCuts::kMuMatchApt|AliMuonTrackCuts::kMuMatchLpt|AliMuonTrackCuts::kMuMatchHpt};
197 
198  Int_t nTracks = AliAnalysisMuonUtility::GetNTracks(InputEvent());
199  for ( Int_t itrack = 0; itrack < nTracks; ++itrack ) {
200  track = AliAnalysisMuonUtility::GetTrack(itrack,InputEvent());
201 
202  Bool_t matchTracker = AliAnalysisMuonUtility::IsMuonTrack(track);
203 
204  Int_t matchTrig = AliAnalysisMuonUtility::GetMatchTrigger(track);
205  UInt_t selection = fMuonTrackCuts->GetSelectionMask(track);
206 
207  // Apply the sharp pt cut according to the matched pt level of the track
208  UInt_t filterMask = fMuonTrackCuts->GetFilterMask() | addMask[matchTrig];
209  Bool_t isSelected = ( ( selection & filterMask ) == filterMask );
210 
211  for ( Int_t imethod=0; imethod<AliTrigChEffOutput::kNeffMethods; ++imethod ) {
212  if ( imethod == AliTrigChEffOutput::kEffFromTrack ) {
213  if ( ! matchTracker || track->P() < 10. ) continue;
214  pattern = AliAnalysisMuonUtility::GetMUONTrigHitsMapTrk(track);
215  board = AliESDMuonTrack::GetCrossedBoard(pattern);
216  }
217  else {
218  if ( matchTrig == 0 ) continue;
219  pattern = AliAnalysisMuonUtility::GetMUONTrigHitsMapTrg(track);
220  board = ( AliAnalysisMuonUtility::IsAODEvent(InputEvent()) ) ? AliESDMuonTrack::GetCrossedBoard(pattern) : ((AliESDMuonTrack*)track)->LoCircuit();
221  }
222 
223  Int_t effFlag = AliESDMuonTrack::GetEffFlag(pattern);
224 
225  if ( effFlag < AliESDMuonTrack::kChEff ) {
226  for ( Int_t itrackSel=0; itrackSel<AliTrigChEffOutput::kNtrackSel; ++itrackSel ) {
227  if ( itrackSel == AliTrigChEffOutput::kSelectTrack && ! isSelected ) continue;
228  for ( Int_t itrig=0; itrig<selectTrigClasses.GetEntries(); ++itrig ) {
229  TString trigClassName = ((TObjString*)selectTrigClasses.At(itrig))->GetString();
230 
231  histoName = fAnalysisOutput->GetHistoName(AliTrigChEffOutput::kHcheckBoard, -1, -1, itrackSel, matchTrig, imethod);
232  ((TH2F*)GetMergeableObject(physSel, trigClassName, centrality, histoName))->Fill(AliESDMuonTrack::GetSlatOrInfo(pattern), board);
233  }
234  }
235  continue; // Track not good for efficiency calculation
236  }
237 
238  othersEfficient.Reset(1);
239  for ( Int_t cath=0; cath<2; ++cath ) {
240  for ( Int_t ich=0; ich<4; ++ich ) {
241  if ( ! AliESDMuonTrack::IsChamberHit(pattern, cath, ich) ) {
242  for ( Int_t jch=0; jch<4; jch++ ) {
243  if ( jch != ich ) othersEfficient[jch] = 0;
244  } // loop on other chambers
245  break;
246  } // if chamber not efficient
247  } // loop on chambers
248  } // loop on cathodes
249 
250  Bool_t rejectTrack = kTRUE;
251  for ( Int_t ich=0; ich<4; ++ich ) {
252  if ( othersEfficient[ich] > 0 ) {
253  rejectTrack = kFALSE;
254  break;
255  }
256  }
257 
258  if ( rejectTrack ) continue;
259 
260  slat = AliESDMuonTrack::GetSlatOrInfo(pattern);
261 
262  for ( Int_t ich=0; ich<4; ++ich ) {
263  if ( ! othersEfficient[ich] )
264  continue; // Reject track if the info of the chamber under study
265  // is necessary to create the track itself
266 
267  Int_t iChamber = 11 + ich;
268 
269  Bool_t hitsBend = AliESDMuonTrack::IsChamberHit(pattern, 0, ich);
270  Bool_t hitsNonBend = AliESDMuonTrack::IsChamberHit(pattern, 1, ich);
271 
272  Bool_t fillHisto[AliTrigChEffOutput::kNcounts] = {
273  hitsBend,
274  hitsNonBend,
275  ( hitsBend && hitsNonBend ),
276  kTRUE
277  };
278 
279  for ( Int_t itrackSel=0; itrackSel<AliTrigChEffOutput::kNtrackSel; ++itrackSel ) {
280  if ( itrackSel == AliTrigChEffOutput::kSelectTrack && ! isSelected ) continue;
281  for (Int_t icount=0; icount<AliTrigChEffOutput::kNcounts; ++icount){
282  if ( ! fillHisto[icount] ) continue;
283  for ( Int_t itrig=0; itrig<selectTrigClasses.GetEntries(); ++itrig ) {
284  TString trigClassName = ((TObjString*)selectTrigClasses.At(itrig))->GetString();
285 
286  histoName = fAnalysisOutput->GetHistoName(AliTrigChEffOutput::kHchamberEff, icount, -1, itrackSel, matchTrig, imethod);
287  static_cast<TH1*>(GetMergeableObject(physSel, trigClassName, centrality, histoName))->Fill(iChamber);
288 
289  if ( effFlag < AliESDMuonTrack::kSlatEff ) continue; // Track crossed different slats
290  histoName = fAnalysisOutput->GetHistoName(AliTrigChEffOutput::kHslatEff, icount, ich, itrackSel, matchTrig, imethod);
291  static_cast<TH1*>(GetMergeableObject(physSel, trigClassName, centrality, histoName))->Fill(slat);
292 
293  if ( effFlag < AliESDMuonTrack::kBoardEff ) continue; // Track crossed different boards
294  histoName = fAnalysisOutput->GetHistoName(AliTrigChEffOutput::kHboardEff, icount, ich, itrackSel, matchTrig, imethod);
295  static_cast<TH1*>(GetMergeableObject(physSel, trigClassName, centrality, histoName))->Fill(board);
296  } // loop on trigger classes
297  } // loop on count types
298  } // loop on track selection
299  } // loop on chambers
300  } // loop on tracks
301  } // loop on eff methods
302 
303  PostData(2, fList);
304 }
305 
306 
307 //________________________________________________________________________
309 {
310  //
312  //
313 
314  AliVAnalysisMuon::Terminate("");
315 
316  if ( ! fMergeableCollection ) return;
317 
318  delete fAnalysisOutput;
319  fAnalysisOutput = new AliTrigChEffOutput(fOutputList);
320 
321  Int_t xshift = 100;
322  Int_t yshift = 20;
323  Int_t igroup1 = -1;
324  Int_t igroup2 = 0;
325 
326  TObjArray* physSel = ((TObjString*)fTerminateOptions->At(0))->GetString().Tokenize(" ");
327  physSel->SetOwner();
328  TObjArray* trigClasses = ((TObjString*)fTerminateOptions->At(1))->GetString().Tokenize(" ");
329  trigClasses->SetOwner();
330  TObjArray* centrality = ((TObjString*)fTerminateOptions->At(2))->GetString().Tokenize(" ");
331  centrality->SetOwner();
332  TString furtherOpt = ((TObjString*)fTerminateOptions->At(3))->GetString();
333 
334  TString currName = "";
335  TObjArray* optArr = furtherOpt.Tokenize(" ");
336  TObjArray trackSel, methodSel;
337  trackSel.SetOwner();
338  methodSel.SetOwner();
339  TString outFileOpt = "";
340  for ( Int_t iopt=0; iopt<optArr->GetEntries(); iopt++ ) {
341  currName = optArr->At(iopt)->GetName();
342  if ( currName.Contains(".root") ) outFileOpt = currName;
343  else if ( currName.Contains("Match") ) trackSel.Add(new TObjString(currName));
344  else if ( currName.Contains("From") ) methodSel.Add(new TObjString(currName));
345  }
346  delete optArr;
347 
348  if ( trackSel.GetEntries() == 0 ) trackSel.Add(new TObjString(fAnalysisOutput->GetHistoName(-1,-1,-1,AliTrigChEffOutput::kSelectTrack,AliTrigChEffOutput::kMatchApt,-1)));
349  if ( methodSel.GetEntries() == 0 ) methodSel.Add(new TObjString(fAnalysisOutput->GetHistoName(-1, -1, -1, -1, -1, AliTrigChEffOutput::kEffFromTrack)));
350 
351  furtherOpt.ToUpper();
352 
353  Int_t chosenType = ( furtherOpt.Contains("BOARD") ) ? AliTrigChEffOutput::kHboardEff : AliTrigChEffOutput::kHslatEff;
354 
355  igroup1++;
356  igroup2 = 0;
357  TString histoName = "", yAxisTitle = "";
358 
359  TH1 *num = 0x0;
360  TH1 *den = 0x0;
361  TGraphAsymmErrors* effGraph = 0x0;
362 
364  // Show tests //
366 
367  for ( Int_t icount=0; icount<AliTrigChEffOutput::kNcounts-1; ++icount ) {
368  currName = fAnalysisOutput->GetHistoName(chosenType, icount, -1, -1, -1, -1);
369  currName += "_can";
370  TCanvas* can = new TCanvas(currName.Data(), currName.Data(), igroup1*xshift,igroup2*yshift,600,600);
371  can->Divide(2,2);
372  TLegend* leg = new TLegend(0.6, 0.6, 0.9, 0.9);
373  leg->SetBorderSize(1);
374  for ( Int_t ich=0; ich<4; ++ich ) {
375  TGraph* refGraph = 0x0;
376  can->cd(ich+1);
377  gPad->SetRightMargin(0.03);
378  Int_t icolor = 1;
379  Int_t istyle = 0;
380  TString drawOpt = "AP";
381  for ( Int_t isel=0; isel<physSel->GetEntries(); ++isel ) {
382  for ( Int_t itrig=0; itrig<trigClasses->GetEntries(); ++itrig ) {
383  for ( Int_t icent=0; icent<centrality->GetEntries(); ++icent ) {
384  for ( Int_t imethodSel=0; imethodSel<methodSel.GetEntries(); ++imethodSel ) {
385  for ( Int_t itrackSel=0; itrackSel<trackSel.GetEntries(); ++itrackSel ) {
386  histoName = fAnalysisOutput->GetHistoName(chosenType, AliTrigChEffOutput::kAllTracks, ich, -1, -1, -1); // partial name
387  histoName += Form("%s%s",trackSel.At(itrackSel)->GetName(),methodSel.At(imethodSel)->GetName());
388  den = static_cast<TH1*>(fAnalysisOutput->GetSum(physSel->At(isel)->GetName(), trigClasses->At(itrig)->GetName(), centrality->At(icent)->GetName(), histoName.Data()));
389  if ( ! den ) {
390  printf("Warning: cannot find %s\n", histoName.Data());
391  continue;
392  }
393  histoName = fAnalysisOutput->GetHistoName(chosenType, icount, ich, -1, -1, -1); // partial name
394  histoName += Form("%s%s",trackSel.At(itrackSel)->GetName(),methodSel.At(imethodSel)->GetName());
395  num = static_cast<TH1*>(fAnalysisOutput->GetSum(physSel->At(isel)->GetName(), trigClasses->At(itrig)->GetName(), centrality->At(icent)->GetName(), histoName.Data()));
396  if ( ! num ) continue;
397  effGraph = new TGraphAsymmErrors(num, den, "e0");
398  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());
399  effGraph->SetTitle(currName.Data());
400 
401  Double_t ymin = 0.;
402  Double_t ymax = 1.1;
403  yAxisTitle = "Efficiency";
404 
405  if ( furtherOpt.Contains("DIFF") || furtherOpt.Contains("PULL") ) {
406  if ( ! refGraph ) {
407  refGraph = effGraph;
408  continue;
409  }
410  Double_t currX, currY, baseX, baseY, errYlow = 0., errYhigh = 0., newY = 0.;
411  Double_t refVal = 1., errY = 0.;
412  for ( Int_t ipoint=0; ipoint<effGraph->GetN(); ipoint++ ) {
413  refGraph->GetPoint(ipoint, baseX, baseY);
414  effGraph->GetPoint(ipoint, currX, currY);
415  Double_t errX = effGraph->GetErrorXlow(ipoint);
416  if ( furtherOpt.Contains("DIFF") ) {
417  refVal = ( baseY > 0. ) ? baseY : 1.;
418  newY = ( currY - baseY ) / refVal;
419  Double_t errYlow1 = effGraph->GetErrorYlow(ipoint);
420  Double_t errYlow2 = refGraph->GetErrorYlow(ipoint);
421  Double_t errYhigh1 = effGraph->GetErrorYhigh(ipoint);
422  Double_t errYhigh2 = refGraph->GetErrorYhigh(ipoint);
423  errYlow = TMath::Sqrt(errYlow1*errYlow1 + errYlow2*errYlow2) / refVal;
424  errYhigh = TMath::Sqrt(errYhigh1*errYhigh1 + errYhigh2*errYhigh2) / refVal;
425  //yAxisTitle = Form("(%s - %s) / %s", effGraph->GetTitle(), refGraph->GetTitle(), refGraph->GetTitle());
426  yAxisTitle = "(eff - ref ) / ref";
427  effGraph->SetTitle(Form("Rel. diff. w.r.t. %s", refGraph->GetTitle()));
428  ymin = -0.1;
429  ymax = 0.1;
430  }
431  else if ( furtherOpt.Contains("PULL") ) {
432  errY = 0.5 * ( effGraph->GetErrorYlow(ipoint) + effGraph->GetErrorYhigh(ipoint));
433  newY = ( errY > 0. ) ? ( currY - baseY ) / errY : 0.;
434  errYlow = 1.;
435  errYhigh = 1.;
436  //yAxisTitle = Form("( %s - %s ) / err", effGraph->GetTitle(), refGraph->GetTitle());
437  yAxisTitle = "(eff - ref ) / err";
438  effGraph->SetTitle(Form("Pull w.r.t. %s", refGraph->GetTitle()));
439  ymin = -4.;
440  ymax = 4.;
441  }
442  effGraph->SetPoint(ipoint, currX, newY);
443  effGraph->SetPointError(ipoint, errX, errX, errYlow, errYhigh);
444  } // loop on points
445  }
446  effGraph->GetYaxis()->SetRangeUser(ymin, ymax);
447  effGraph->GetYaxis()->SetTitle(yAxisTitle.Data());
448  effGraph->SetLineColor(icolor);
449  effGraph->SetMarkerColor(icolor);
450  effGraph->SetMarkerStyle(20 + istyle);
451  //effGraph->SetMarkerSize(0.3);
452  icolor++;
453  if ( icolor == 5 || icolor == 10 ) icolor++;
454  istyle++;
455  effGraph->Draw(drawOpt.Data());
456  drawOpt = "P";
457  if ( ich < 3 ) continue;
458  leg->AddEntry(effGraph, currName.Data(), "lp");
459  } // loop on match trigger
460  } // loop on eff method
461  } // loop on centrality
462  } // loop on trigger classes
463  } // loop on physics selection
464  } // loop on chamber
465  leg->Draw("same");
466  } // loop on count type
467  //} // loop on detection element type
468 
469  delete physSel;
470  delete trigClasses;
471  delete centrality;
472 
473 
474  fList = dynamic_cast<TList*>(GetOutputData(2));
475  if ( fList ) {
476 
478  // Show final efficiency //
480  TString baseName[3] = {"Chamber", "RPC", "Board"};
482  TString effName[AliTrigChEffOutput::kNcounts-1] = {"BendPlane", "NonBendPlane", "BothPlanes"};
483  for ( Int_t itype=0; itype<3; itype++ ) {
484  for ( Int_t icount=0; icount<AliTrigChEffOutput::kNcounts-1; icount++ ){
485  TString canName = Form("efficiencyPer%s_%s",baseName[itype].Data(),effName[icount].Data());
486  TCanvas* can = new TCanvas(canName.Data(),canName.Data(),10*(1+AliTrigChEffOutput::kNcounts*itype+icount),10*(1+AliTrigChEffOutput::kNcounts*itype+icount),310,310);
487  can->SetFillColor(10); can->SetHighLightColor(10);
488  can->SetLeftMargin(0.15); can->SetBottomMargin(0.15);
489  if ( itype > 0 )
490  can->Divide(2,2);
491 
492  for ( Int_t ich=-1; ich<4; ich++ ) {
493  histoName = fAnalysisOutput->GetHistoName(baseIndex[itype], icount, ich, -1, -1, -1);
494  num = static_cast<TH1*>(fList->FindObject(histoName.Data()));
495  histoName = fAnalysisOutput->GetHistoName(baseIndex[itype], AliTrigChEffOutput::kNcounts-1, ich, -1, -1, -1);
496  den = static_cast<TH1*>(fList->FindObject(histoName.Data()));
497  if ( ! num || ! den ) continue;
498  effGraph = new TGraphAsymmErrors(num, den, "e0");
499  effGraph->GetYaxis()->SetRangeUser(0., 1.1);
500  effGraph->GetYaxis()->SetTitle("Efficiency");
501  effGraph->GetXaxis()->SetTitle(baseName[itype].Data());
502  can->cd(ich+1);
503  effGraph->Draw("AP");
504  if ( itype == 0 ) break;
505  } // loop on chamber
506  } // loop on count types
507  } // loop on histo
508  }
509 
510 
511  if ( ! outFileOpt.IsNull() ) {
512  TObjArray* outFileOptList = outFileOpt.Tokenize("?");
513  AliInfo(Form("Creating file %s", outFileOptList->At(0)->GetName()));
514  TString histoPattern = outFileOptList->At(4)->GetName();
515  Int_t itrackSel = histoPattern.Contains("NoSel") ? AliTrigChEffOutput::kNoSelectTrack : AliTrigChEffOutput::kSelectTrack;
517  if ( histoPattern.Contains("MatchApt") ) imatch = AliTrigChEffOutput::kMatchApt;
518  else if ( histoPattern.Contains("MatchLpt") ) imatch = AliTrigChEffOutput::kMatchLpt;
519  else if ( histoPattern.Contains("MatchHpt") ) imatch = AliTrigChEffOutput::kMatchHpt;
520  Int_t imethod = histoPattern.Contains("FromTrg") ? AliTrigChEffOutput::kEffFromTrig : AliTrigChEffOutput::kEffFromTrack;
521  TList* effList = fAnalysisOutput->GetEffHistoList(outFileOptList->At(1)->GetName(), outFileOptList->At(2)->GetName(), outFileOptList->At(3)->GetName(), itrackSel, imatch, imethod);
522  effList->SetName(GetOutputSlot(2)->GetContainer()->GetName());
523  if ( effList ->GetEntries() == 0 ) {
524  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());
525  }
526  else {
527  TFile* outFile = TFile::Open(outFileOptList->At(0)->GetName(), "RECREATE");
528  effList->Write(effList->GetName(),TObject::kSingleKey);
529  outFile->Close();
530  }
531  delete effList;
532  delete outFileOptList;
533  }
534 }
Counts per cathode histogram index.
TList * GetEffHistoList(TString physSel, TString trigClassNames, TString centrality, Int_t itrackSel, Int_t imatch, Int_t imethod)
Hit pattern from trigger.
const Double_t ymax
Definition: AddTaskCFDStar.C:7
double Double_t
Definition: External.C:58
Definition: External.C:236
void ProcessEvent(TString physSel, const TObjArray &selectTrigClasses, TString centrality)
tracks used for calculation
Non selected tracks (includes ghosts)
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.
int Int_t
Definition: External.C:63
unsigned int UInt_t
Definition: External.C:33
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.
ClassImp(AliAnalysisTaskCRC) AliAnalysisTaskCRC
No match with trigger.
const Double_t ymin
Definition: AddTaskCFDStar.C:6
Counts per board histogram index.
const char Option_t
Definition: External.C:48
bool Bool_t
Definition: External.C:53
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)
Definition: External.C:196