Fixing an error in the computation of the efficiency of a whole chamber (Matthieu)
[u/mrichter/AliRoot.git] / PWG3 / muondep / AliAnalysisTaskMuonTrackingEff.cxx
CommitLineData
128a8042 1/**************************************************************************
2 * Copyright(c) 1998-1999, 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//Class to calculate the intrinsic efficiency of the detection elements of the
17//MUON tracking chambers in function of the position in the detection element.
18//Author: Nicolas LE BRIS - SUBATECH Nantes
19
20
21//ROOT includes
22#include <TROOT.h>
23#include <TSystem.h>
24#include <TChain.h>
25#include <TFile.h>
26#include <TList.h>
27#include <TClonesArray.h>
28#include <TH2F.h>
0246246b 29#include <TH1F.h>
30#include <TMath.h>
6db6876c 31#include "Riostream.h"
128a8042 32
33//ANALYSIS includes
34#include "AliAnalysisManager.h"
35#include "AliAnalysisTask.h"
36
37//STEER includes
38#include "AliESDEvent.h"
39#include "AliESDMuonTrack.h"
40#include "AliESDInputHandler.h"
f7a1cc68 41#include "AliMagF.h"
128a8042 42#include "AliTracker.h"
43#include "AliAnalysisManager.h"
44
45//PWG3/muon includes
46#include "AliAnalysisTaskMuonTrackingEff.h"
47#include "AliCheckMuonDetEltResponse.h"
48
49//MUON includes
50#include "AliMUONGeometryTransformer.h"
51#include "AliMUONTrackExtrap.h"
52
53ClassImp(AliAnalysisTaskMuonTrackingEff)
54
55const Int_t AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt = 156;
0246246b 56const Int_t AliAnalysisTaskMuonTrackingEff::fTotNbrOfChamber = 10;
128a8042 57
58//________________________________________________________________________
59AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff()
0246246b 60 :
0246246b 61 AliAnalysisTask(),
62 fTransformer(0x0),
63 fESD(0x0),
64 fDetEltEffHistList(0x0),
65 fDetEltTDHistList(0x0),
66 fDetEltTTHistList(0x0),
67 fChamberEffHistList(0x0),
68 fChamberTDHistList(0x0),
ce1b0b6f 69 fChamberTTHistList(0x0),
6db6876c 70 fChamberEff(0x0),
ce1b0b6f 71 fIsCosmicData(kFALSE)
128a8042 72{
665701ae 73/// Default constructor
74}
75//________________________________________________________________________
76AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff(const AliAnalysisTaskMuonTrackingEff& src)
0246246b 77 :
0246246b 78 AliAnalysisTask(src),
79 fTransformer(0x0),
80 fESD(0x0),
81 fDetEltEffHistList(0x0),
82 fDetEltTDHistList(0x0),
83 fDetEltTTHistList(0x0),
84 fChamberEffHistList(0x0),
85 fChamberTDHistList(0x0),
ce1b0b6f 86 fChamberTTHistList(0x0),
6db6876c 87 fChamberEff(0x0),
ce1b0b6f 88 fIsCosmicData(kFALSE)
665701ae 89{
90 /// copy ctor
91 src.Copy(*this);
92}
93//________________________________________________________________________
94AliAnalysisTaskMuonTrackingEff& AliAnalysisTaskMuonTrackingEff::operator=(const AliAnalysisTaskMuonTrackingEff& src)
95{
96 /// assignement operator
97 if ( this != &src )
98 {
99 src.Copy(*this);
100 }
101 return *this;
128a8042 102}
128a8042 103
104//________________________________________________________________________
105AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff(const char* name,
0246246b 106 const AliMUONGeometryTransformer* transformer,
107 Bool_t isCosmic)
108 :
0246246b 109 AliAnalysisTask(name, "AnalysisTaskESD"),
6db6876c 110 fTransformer(0x0),
0246246b 111 fESD(0x0),
112 fDetEltEffHistList(0x0),
113 fDetEltTDHistList(0x0),
114 fDetEltTTHistList(0x0),
115 fChamberEffHistList(0x0),
116 fChamberTDHistList(0x0),
ce1b0b6f 117 fChamberTTHistList(0x0),
6db6876c 118 fChamberEff(0x0),
ce1b0b6f 119 fIsCosmicData(kFALSE)
128a8042 120{
121//Constructor
122//-----------
123
0246246b 124 fIsCosmicData = isCosmic;
6db6876c 125 fTransformer = transformer;
0246246b 126
128a8042 127//Define detection element efficiency histograms
128//----------------------------------------------
129
130 fDetEltEffHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 3); //!<+3 for: 1.the total efficiency chamber by chamber histogram.
131 //!< 2.the total number of tracks detected by the tracking system.
132 //!< 3.the number of track used for the efficiency calculation chamber by chamber
133 fDetEltTDHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 1);
134 fDetEltTTHistList = new TClonesArray("TH2F",fTotNbrOfDetectionElt + 1);
135
0246246b 136
137 fChamberEffHistList = new TClonesArray("TH1F", fTotNbrOfChamber + 3);
138 fChamberTDHistList = new TClonesArray("TH1F", fTotNbrOfChamber + 1);
139 fChamberTTHistList = new TClonesArray("TH1F", fTotNbrOfChamber + 1);
140
141
142
128a8042 143 for (Int_t i = 0; i<fTotNbrOfDetectionElt; ++i)
144 {
145 Int_t iDetElt = 0;
146 if (i<16) iDetElt = 100*(i/4+1) + i - int(i/4)*4;
147 else if (i<52) iDetElt = 100*((i-16)/18+5) + i - (int((i-16)/18)*18 + 16);
148 if (i>51) iDetElt = 100*((i-52)/26+7) + i - (int((i-52)/26)*26 + 52);
149
150 Char_t histName[255];
151 Char_t histTitle[255];
152
153 sprintf(histName,"Eff_detEltNbr%d",iDetElt);
154 sprintf(histTitle,"detEltNbr %d",iDetElt);
155 if(i<16) new((*fDetEltEffHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110);//!<Stations 1 & 2.
156 else new((*fDetEltEffHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5.
157
158 sprintf(histName,"TD_detEltNbr%d",iDetElt);
159 if(i<16) new((*fDetEltTDHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110);//!<Stations 1 & 2.
160 else new((*fDetEltTDHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5.
161
162 sprintf(histName,"TT_detEltNbr%d",iDetElt);
163 if(i<16) new((*fDetEltTTHistList)[i]) TH2F(histName,histTitle,12,-10,110,12,-10,110); //!<Stations 1 & 2.
164 else new((*fDetEltTTHistList)[i]) TH2F(histName,histTitle,28,-140,140,8,-40,40); //!<Stations 3 -> 5.
165
166 ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetXaxis() -> SetTitle("X (cm)");
167 ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetYaxis() -> SetTitle("Y (cm)");
168 ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetZaxis() -> SetTitle("Efficiency (%)");
169 ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetXaxis() -> SetTitleOffset(1.8);
170 ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetYaxis() -> SetTitleOffset(1.8);
171 ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> GetZaxis() -> SetTitleOffset(1.2);
172 ((TH2F*) fDetEltEffHistList->UncheckedAt(i)) -> SetOption("LEGO");
173 }
174
0246246b 175 for (Int_t j = 0; j < fTotNbrOfChamber; j++)
176 {
177 Char_t histName[255];
178 Char_t histTitle[255];
179
180
181 sprintf(histName,"Eff_ChamberNbr%d",j+1);
182 sprintf(histTitle,"ChamberNbr %d",j+1);
183 if (j<4) new ((*fChamberEffHistList)[j]) TH1F(histName, histTitle, 4, 0.0, 4.0);
184 else if (j<6) new ((*fChamberEffHistList)[j]) TH1F(histName, histTitle, 18, 0.0, 18.0);
185 if (j>=6) new ((*fChamberEffHistList)[j]) TH1F(histName, histTitle, 26, 0.0, 26.0);
186
187 sprintf(histName,"TD_ChamberNbr%d",j+1);
188 if (j<4) new ((*fChamberTDHistList)[j]) TH1F(histName, histTitle, 4, 0.0, 4.0);
189 else if (j<6) new ((*fChamberTDHistList)[j]) TH1F(histName, histTitle, 18, 0.0, 18.0);
190 if (j>=6) new ((*fChamberTDHistList)[j]) TH1F(histName, histTitle, 26, 0.0, 26.0);
191
192 sprintf(histName,"TT_ChamberNbr%d",j+1);
193 if (j<4) new ((*fChamberTTHistList)[j]) TH1F(histName, histTitle, 4, 0.0, 4.0);
194 else if (j<6) new ((*fChamberTTHistList)[j]) TH1F(histName, histTitle, 18, 0.0, 18.0);
195 if (j>=6) new ((*fChamberTTHistList)[j]) TH1F(histName, histTitle, 26, 0.0, 26.0);
196
197 ((TH1F*) fChamberEffHistList->UncheckedAt(j)) -> GetXaxis() -> SetTitle("DetElement");
198 ((TH1F*) fChamberEffHistList->UncheckedAt(j)) -> GetYaxis() -> SetTitle("Efficiency (%)");
199 ((TH1F*) fChamberEffHistList->UncheckedAt(j)) -> GetXaxis() -> SetTitleOffset(1.8);
200 ((TH1F*) fChamberEffHistList->UncheckedAt(j)) -> GetYaxis() -> SetTitleOffset(1.8);
201 ((TH1F*) fChamberEffHistList->UncheckedAt(j)) -> Sumw2();
202 }
203
204
128a8042 205 new((*fDetEltTDHistList )[fTotNbrOfDetectionElt]) TH2F("TD_Chamber" ,"TD_Chamber" ,10,0,10,1,0,1); //!<Detected tracks.
206 new((*fDetEltTTHistList )[fTotNbrOfDetectionElt]) TH2F("TT_Chamber" ,"TT_Chamber" ,10,0,10,1,0,1); //!<Tracks total number.
207 new((*fDetEltEffHistList)[fTotNbrOfDetectionElt]) TH2F("fChamberEff","fChamberEff",10,0,10,1,0,1); //!<Chamber efficiency.
208
209 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetXaxis() -> SetTitle("Chamber number");
210 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetYaxis() -> SetTitle("");
211 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetZaxis() -> SetTitle("Efficiency (%)");
212 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetXaxis() -> SetTitleOffset(1.8);
213 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetYaxis() -> SetTitleOffset(1.8);
214 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> GetZaxis() -> SetTitleOffset(1.2);
215 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt)) -> SetOption("LEGO");
216
217 new((*fDetEltEffHistList)[157]) TH2F("TT_Chamber" ,"TT_Chamber" ,10,0,10,1,0,1); //!<Tracks total number by chamber.
218
219 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetXaxis() -> SetTitle("Chamber number");
220 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetYaxis() -> SetTitle("");
221 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetZaxis() -> SetTitle("Number of tracks");
222 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetXaxis() -> SetTitleOffset(1.8);
223 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetYaxis() -> SetTitleOffset(1.8);
224 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> GetZaxis() -> SetTitleOffset(1.2);
225 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 1)) -> SetOption("LEGO");
226
227 new((*fDetEltEffHistList)[158]) TH2F("Total_Number_of_Tracks" ,"Total_Number_of_Tracks" ,1,0,1,1,0,1); //!<Tracks total number.
228
229 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetXaxis() -> SetTitle("");
230 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetYaxis() -> SetTitle("");
231 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetZaxis() -> SetTitle("Number of tracks");
232 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetXaxis() -> SetTitleOffset(1.8);
233 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetYaxis() -> SetTitleOffset(1.8);
234 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> GetZaxis() -> SetTitleOffset(1.2);
235 ((TH2F*) fDetEltEffHistList->UncheckedAt(fTotNbrOfDetectionElt + 2)) -> SetOption("LEGO");
236
0246246b 237
238 new((*fChamberTDHistList )[fTotNbrOfChamber]) TH1F("TD_Chamber_2" ,"TD_Chamber_2" ,10,0,10); //!<Detected tracks.
239 new((*fChamberTTHistList )[fTotNbrOfChamber]) TH1F("TT_Chamber_2" ,"TT_Chamber_2" ,10,0,10); //!<Tracks total number.
240 new((*fChamberEffHistList)[fTotNbrOfChamber]) TH1F("fChamberEff_2","fChamberEff_2",10,0,10); //!<Chamber efficiency.
241
242 ((TH1F*) fChamberTDHistList->UncheckedAt(fTotNbrOfChamber)) -> Sumw2();
243 ((TH1F*) fChamberTTHistList->UncheckedAt(fTotNbrOfChamber)) -> Sumw2();
244
245 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber)) -> GetXaxis() -> SetTitle("Chamber number");
246 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber)) -> GetYaxis() -> SetTitle("");
247 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber)) -> GetXaxis() -> SetTitleOffset(1.8);
248 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber)) -> GetYaxis() -> SetTitleOffset(1.8);
249 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber)) -> Sumw2();
250 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber)) -> SetOption("");
251
252 new((*fChamberEffHistList)[11]) TH1F("TT_Chamber_2" ,"TT_Chamber_2" ,10,0,10); //!<Tracks total number by chamber.
253
254 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 1)) -> GetXaxis() -> SetTitle("Chamber number");
255 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 1)) -> GetYaxis() -> SetTitle("");
256 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 1)) -> GetXaxis() -> SetTitleOffset(1.8);
257 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 1)) -> GetYaxis() -> SetTitleOffset(1.8);
258 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 1)) -> Sumw2();
259 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 1)) -> SetOption("");
260
261 new((*fChamberEffHistList)[12]) TH1F("Total_Number_of_Tracks_2" ,"Total_Number_of_Tracks_2" ,1,0,1); //!<Tracks total number.
262
263 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 2)) -> GetXaxis() -> SetTitle("");
264 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 2)) -> GetYaxis() -> SetTitle("");
265 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 2)) -> GetXaxis() -> SetTitleOffset(1.8);
266 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 2)) -> GetYaxis() -> SetTitleOffset(1.8);
267 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 2)) -> Sumw2();
268 ((TH1F*) fChamberEffHistList->UncheckedAt(fTotNbrOfChamber + 2)) -> SetOption("");
269
6db6876c 270
271
272 //fChamberEff = new AliCheckMuonDetEltResponse(fTransformer, fESD, fDetEltTDHistList, fDetEltTTHistList, fChamberTDHistList, fChamberTTHistList);
273
274
275
128a8042 276//Define input & output
277//---------------------
278
279// -Input slot 0 works with a TChain:
280 DefineInput(0, TChain::Class());
281
5982d2f7 282// -Output slots 0 to 5 writes into a TClonesArray:
128a8042 283 DefineOutput(0, TClonesArray::Class());
0246246b 284 DefineOutput(1, TClonesArray::Class());
285 DefineOutput(2, TClonesArray::Class());
286 DefineOutput(3, TClonesArray::Class());
5982d2f7 287 DefineOutput(4, TClonesArray::Class());
288 DefineOutput(5, TClonesArray::Class());
128a8042 289}
290
291
292
293//______________________________________________________________________________
294AliAnalysisTaskMuonTrackingEff::~AliAnalysisTaskMuonTrackingEff()
295{
296// Destructor.
297 delete fDetEltEffHistList;
298 delete fDetEltTDHistList;
299 delete fDetEltTTHistList;
0246246b 300 delete fChamberEffHistList;
301 delete fChamberTDHistList;
302 delete fChamberTTHistList;
6db6876c 303 delete fChamberEff;
128a8042 304}
305
306
307
308//________________________________________________________________________
309void AliAnalysisTaskMuonTrackingEff::CreateOutputObjects()
310{
311 OpenFile(0);
312}
313
314
315
316//________________________________________________________________________
317void AliAnalysisTaskMuonTrackingEff::ConnectInputData(Option_t */*option*/)
318
319{
f7a1cc68 320 //Set Field Map for track extrapolation
321 AliMUONTrackExtrap::SetField();
128a8042 322
f7a1cc68 323 //Connect input
128a8042 324 AliESDInputHandler* esdHandler = (AliESDInputHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler());
325 if (!esdHandler)
326 {
327 Printf("ERROR: Could not get ESDInputHandler");
328 }
329 else fESD = esdHandler->GetEvent();
330}
331
332
333//________________________________________________________________________
334void AliAnalysisTaskMuonTrackingEff::Exec(Option_t */*option*/)
335{
336//Execute analysis for current event
337
6db6876c 338 if (fChamberEff == 0x0)
339 fChamberEff = new AliCheckMuonDetEltResponse(fTransformer, fESD, fDetEltTDHistList, fDetEltTTHistList, fChamberTDHistList, fChamberTTHistList);
340 fChamberEff->CheckDetEltResponse();
128a8042 341
342
343 for( Int_t i = 0; i<156; ++i)
344 {
345 ((TH2F*) fDetEltEffHistList->UncheckedAt(i))-> Divide( (TH2F*) fDetEltTDHistList->UncheckedAt(i),
346 (TH2F*) fDetEltTTHistList->UncheckedAt(i), 100., 1.);
347 }
348
0246246b 349 for (Int_t j = 0; j < 10; j++)
350 {
351 ((TH1F*) fChamberEffHistList->UncheckedAt(j))-> Divide( (TH1F*) fChamberTDHistList->UncheckedAt(j),
352 (TH1F*) fChamberTTHistList->UncheckedAt(j), 100., 1.);
353 }
354
355
128a8042 356 ((TH2F*) fDetEltEffHistList->UncheckedAt(156))-> Divide( (TH2F*) fDetEltTDHistList->UncheckedAt(156),
357 (TH2F*) fDetEltTTHistList->UncheckedAt(156), 100., 1.);
358
359
360 ((TH2F*) fDetEltEffHistList->UncheckedAt(157))-> Add ( (TH2F*) fDetEltTTHistList ->UncheckedAt(156),
361 (TH2F*) fDetEltEffHistList->UncheckedAt(157), 1., 0.);
362
363
20e837dc 364 ((TH2F*) fDetEltEffHistList->UncheckedAt(158))-> Fill(0., 0., ((Double_t)fESD -> GetNumberOfMuonTracks()));
128a8042 365
366
0246246b 367 ((TH1F*) fChamberEffHistList->UncheckedAt(10))-> Divide( (TH1F*) fChamberTDHistList->UncheckedAt(10),
368 (TH1F*) fChamberTTHistList->UncheckedAt(10), 100., 1.);
369
370
371 ((TH1F*) fChamberEffHistList->UncheckedAt(11))-> Add ( (TH1F*) fChamberTTHistList ->UncheckedAt(10),
372 (TH1F*) fChamberEffHistList->UncheckedAt(11), 1., 0.);
373
374
375 ((TH1F*) fChamberEffHistList->UncheckedAt(12))-> Fill(0., ((Double_t)fESD -> GetNumberOfMuonTracks()));
376
377 ComputeErrors();
378
128a8042 379//Post the output data:
0246246b 380 PostData(0, fDetEltTDHistList);
381 PostData(1, fDetEltTTHistList);
382 PostData(2, fDetEltEffHistList);
383 PostData(3, fChamberTDHistList);
384 PostData(4, fChamberTTHistList);
385 PostData(5, fChamberEffHistList);
128a8042 386}
387
388
389
390//________________________________________________________________________
391void AliAnalysisTaskMuonTrackingEff::Terminate(Option_t */*option*/)
392{
393//Terminate analysis
394
395}
0246246b 396
397
398//________________________________________________________________________
399void AliAnalysisTaskMuonTrackingEff::ComputeErrors()
400{
401 // Compute error on the efficiency
402 // eff = Ntd/Ntt
403 // error = max {1/Ntt, sqrt(eff*(1-eff)/Ntt)}
404
405 for (Int_t ii = 0; ii < 10; ii++)
406 {
407 Int_t NumberOfBins = ((TH1F*) fChamberEffHistList->UncheckedAt(ii))->GetNbinsX();
a12be0d1 408 for (Int_t jj = 1; jj <= NumberOfBins; jj++)
0246246b 409 {
410 Double_t Ntd = ((TH1F*) fChamberTDHistList->UncheckedAt(ii))->GetBinContent(jj);
411 Double_t Ntt = ((TH1F*) fChamberTTHistList->UncheckedAt(ii))->GetBinContent(jj);
412
413 if (Ntt > 0.0 && Ntd > 0.0)
414 {
415 Double_t eff = ((TH1F*) fChamberEffHistList->UncheckedAt(ii))->GetBinContent(jj)/100.0;
416 Double_t err1 = 1.0/Ntt;
417 Double_t err2 = TMath::Sqrt(eff*(1.0 - eff)/Ntt);
418 Double_t error = TMath::Max(err1, err2);
419
420 ((TH1F*) fChamberEffHistList->UncheckedAt(ii))->SetBinError(jj, error*100.0);
421 }
422 }
423 }
424}