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