AliPhysics  29d4213 (29d4213)
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Macros
AliTrigChEffOutput.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 #include "AliTrigChEffOutput.h"
17 
18 // ROOT includes
19 #include "TObjString.h"
20 #include "TObjArray.h"
21 #include "TList.h"
22 #include "TH1.h"
23 #include "TH2.h"
24 
26 ClassImp(AliTrigChEffOutput) // Class implementation in ROOT context
28 
29 
30 //________________________________________________________________________
32  AliMuonAnalysisOutput(),
33  fTrackSelKeys(0x0),
34  fCountTypeKeys(0x0),
35  fHistoTypeKeys(0x0),
36  fEffMethodKeys(0x0),
37  fMatchTrigKeys(0x0)
38 {
40 
41 }
42 
43 //________________________________________________________________________
44 AliTrigChEffOutput::AliTrigChEffOutput ( TObjArray* outputList ) :
45 AliMuonAnalysisOutput(outputList),
46  fTrackSelKeys(0x0),
47  fCountTypeKeys(0x0),
48  fHistoTypeKeys(0x0),
49  fEffMethodKeys(0x0),
50  fMatchTrigKeys(0x0)
51 {
53  InitKeys();
54 }
55 
56 //________________________________________________________________________
57 AliTrigChEffOutput::AliTrigChEffOutput ( const char *filename, const char* outputName ) :
58  AliMuonAnalysisOutput(filename,outputName),
59  fTrackSelKeys(0x0),
60  fCountTypeKeys(0x0),
61  fHistoTypeKeys(0x0),
62  fEffMethodKeys(0x0),
63  fMatchTrigKeys(0x0)
64 {
66  InitKeys();
67 }
68 
69 //________________________________________________________________________
71 {
72  //
74  //
75  delete fTrackSelKeys;
76  delete fCountTypeKeys;
77  delete fHistoTypeKeys;
78  delete fEffMethodKeys;
79  delete fMatchTrigKeys;
80 }
81 
82 //________________________________________________________________________
84 {
86  TString matchTrigNames = "Nopt Apt Lpt Hpt";
87  fMatchTrigKeys = matchTrigNames.Tokenize(" ");
88 
89  TString countTypeNames = "bendPlaneCount nonBendPlaneCount bothPlanesCount allTracksCount";
90  fCountTypeKeys = countTypeNames.Tokenize(" ");
91 
92  TString histoTypeKeys = "Chamber Slat Board checkRejectedBoard";
93  fHistoTypeKeys = histoTypeKeys.Tokenize(" ");
94 
95  TString effMethodKeys = "FromTrk FromTrg";
96  fEffMethodKeys = effMethodKeys.Tokenize(" ");
97 
98  TString trackSelNames = "Match NoSelMatch";
99  fTrackSelKeys = trackSelNames.Tokenize(" ");
100 }
101 
102 //___________________________________________________________________________
103 TList* AliTrigChEffOutput::GetEffHistoList ( TString physSel, TString trigClassNames, TString centrality, TString trackSelection )
104 {
109 
110  if ( ! GetMergeableCollection() ) return 0x0;
111  TList* outList = new TList();
112  outList->SetOwner();
113  TString histoName = "";
114  TString histoPattern = "";
115  TH1* histo = 0x0;
116  Bool_t isOk = kTRUE;
117  for ( Int_t icount=0; icount<kNcounts; ++icount ) {
118  histoName = GetHistoName(kHchamberEff, icount, -1, -1, -1, -1);
119  histoPattern = Form("%s%s", histoName.Data(), trackSelection.Data());
120  histo = static_cast<TH1*>(GetSum(physSel, trigClassNames, centrality, histoPattern));
121  if ( histo ) {
122  histo->SetName(histoName.Data());
123  histo->SetTitle(histoName.Data());
124  }
125  else {
126  histo = GetCountHisto(kHchamberEff, icount, -1, -1, -1, -1);
127  isOk = kFALSE;
128  }
129  histo->SetDirectory(0);
130  outList->Add(histo);
131  }
132  for ( Int_t icount=0; icount<kNcounts; ++icount ) {
133  for ( Int_t ich=0; ich<4; ++ich ) {
134  histoName = GetHistoName(kHslatEff, icount, ich, -1, -1, -1);
135  histoPattern = Form("%s%s", histoName.Data(), trackSelection.Data());
136  histo = static_cast<TH1*>(GetSum(physSel, trigClassNames, centrality, histoPattern));
137  if ( histo ) {
138  histo->SetName(histoName.Data());
139  histo->SetTitle(histoName.Data());
140  }
141  else {
142  histo = GetCountHisto(kHslatEff, icount, ich, -1, -1, -1);
143  isOk = kFALSE;
144  }
145  histo->SetDirectory(0);
146  outList->Add(histo);
147  }
148  }
149  for ( Int_t icount=0; icount<kNcounts; ++icount ) {
150  for ( Int_t ich=0; ich<4; ++ich ) {
151  histoName = GetHistoName(kHboardEff, icount, ich, -1, -1, -1);
152  histoPattern = Form("%s%s", histoName.Data(), trackSelection.Data());
153  histo = static_cast<TH1*>(GetSum(physSel, trigClassNames, centrality, histoPattern));
154  if ( histo ) {
155  histo->SetName(histoName.Data());
156  histo->SetTitle(histoName.Data());
157  }
158  else {
159  histo = GetCountHisto(kHboardEff, icount, ich, -1, -1, -1);
160  isOk = kFALSE;
161  }
162  histo->SetDirectory(0);
163  outList->Add(histo);
164  }
165  }
166 
167  histoName = GetHistoName(kHcheckBoard, -1, -1, -1, -1, -1);
168  histoPattern = Form("%s%s", histoName.Data(), trackSelection.Data());
169  histo = static_cast<TH1*>(GetSum(physSel, trigClassNames, centrality, histoPattern));
170  if ( histo ) {
171  histo->SetName(histoName.Data());
172  histo->SetTitle(histoName.Data());
173  }
174  else {
175  histo = GetCountHisto(kHcheckBoard, -1, -1, -1, -1, -1);
176  }
177  histo->SetDirectory(0);
178  outList->Add(histo);
179 
180  return outList;
181 }
182 
183 //___________________________________________________________________________
184 TH1* AliTrigChEffOutput::GetCountHisto ( Int_t itype, Int_t icount, Int_t ichamber, Int_t itrackSel, Int_t imatch, Int_t imethod )
185 {
186  //
188  //
189 
190  Int_t nBoardBins = 234;
191  Float_t boardLow = 1.-0.5, boardHigh = (Float_t)nBoardBins+1.-0.5;
192  const Char_t* boardName = "board";
193 
194  TString histoName = "";
195  TH1* histo = 0x0;
196  switch ( itype ) {
197  case kHchamberEff:
198  histoName = GetHistoName(kHchamberEff, icount, -1, itrackSel, imatch, imethod);
199  histo = new TH1F(histoName, histoName, 4, 11.-0.5, 4.+11.-0.5);
200  histo->GetXaxis()->SetTitle("chamber");
201  histo->GetYaxis()->SetTitle("counts");
202  break;
203  case kHslatEff:
204  histoName = GetHistoName(kHslatEff, icount, ichamber, itrackSel, imatch, imethod);
205  histo = new TH1F(histoName, histoName, 18, 0.-0.5, 18.-0.5);
206  histo->GetXaxis()->SetTitle("slat");
207  histo->GetYaxis()->SetTitle("counts");
208  break;
209  case kHboardEff:
210  histoName = GetHistoName(kHboardEff, icount, ichamber, itrackSel, imatch, imethod);
211  histo = new TH1F(histoName, histoName, nBoardBins, boardLow, boardHigh);
212  histo->GetXaxis()->SetTitle(boardName);
213  histo->GetYaxis()->SetTitle("counts");
214  break;
215  case kHcheckBoard:
216  histoName = GetHistoName(kHcheckBoard, -1, -1, itrackSel, imatch, imethod);
217  histo = new TH2F(histoName.Data(), "Rejected tracks motivation", 5, 20.5, 25.5, nBoardBins, boardLow, boardHigh);
218  histo->GetXaxis()->SetBinLabel(1,"Many pads");
219  histo->GetXaxis()->SetBinLabel(2,"Few pads");
220  histo->GetXaxis()->SetBinLabel(3,"Outside geom");
221  histo->GetXaxis()->SetBinLabel(4,"Tracker track");
222  histo->GetXaxis()->SetBinLabel(5,"Masked board");
223  histo->GetYaxis()->SetTitle(boardName);
224  break;
225  default:
226  return 0x0;
227  }
228 
229  return histo;
230 }
231 
232 //___________________________________________________________________________
233 TString AliTrigChEffOutput::GetHistoName(Int_t itype, Int_t icount, Int_t ichamber, Int_t itrackSel, Int_t imatch, Int_t imethod)
234 {
236  TString histoName = "";
237  if ( itype < kHcheckBoard && icount >= 0 ) histoName += static_cast<TObjString*>(fCountTypeKeys->At(icount))->GetString();
238  if ( itype >= 0 ) histoName += static_cast<TObjString*>(fHistoTypeKeys->At(itype))->String();
239  if ( ichamber >= 0 ) histoName += Form("Ch%i", 11+ichamber);
240  if ( itrackSel >= 0 ) histoName += static_cast<TObjString*>(fTrackSelKeys->At(itrackSel))->String();
241  if ( imatch >= 0 ) histoName += static_cast<TObjString*>(fMatchTrigKeys->At(imatch))->String();
242  if ( imethod >= 0 ) histoName += static_cast<TObjString*>(fEffMethodKeys->At(imethod))->String();
243  return histoName;
244 }
Counts per cathode histogram index.
ClassImp(AliAnalysisTaskTriggerRates) AliAnalysisTaskTriggerRates
centrality
Counts per slat histogram index.
TObjArray * fCountTypeKeys
!<! Selection names
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.
TObjArray * fHistoTypeKeys
!<! Count type keys
Check rejected tracks per board.
Counts per board histogram index.
TList * GetEffHistoList(TString physSel, TString trigClassNames, TString centrality, TString trackSelection)
TObjArray * fMatchTrigKeys
!<! Efficiency methods keys
TString GetHistoName(Int_t itype, Int_t icount, Int_t ichamber, Int_t itrackSel, Int_t imatch, Int_t imethod)
TObjArray * fEffMethodKeys
!<! Base histogram name