]>
Commit | Line | Data |
---|---|---|
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. | |
79720f5b | 18 | //WOrk on ESD only |
128a8042 | 19 | //Author: Nicolas LE BRIS - SUBATECH Nantes |
79720f5b | 20 | // Modified by Matthieu LENHARDT - SUBATECH Nantes |
128a8042 | 21 | |
22 | ||
23 | //ROOT includes | |
128a8042 | 24 | #include <TChain.h> |
25 | #include <TFile.h> | |
79720f5b | 26 | #include <TList.h> |
128a8042 | 27 | #include <TH2F.h> |
28 | ||
29 | //ANALYSIS includes | |
30 | #include "AliAnalysisManager.h" | |
128a8042 | 31 | |
32 | //STEER includes | |
33 | #include "AliESDEvent.h" | |
34 | #include "AliESDMuonTrack.h" | |
35 | #include "AliESDInputHandler.h" | |
f7a1cc68 | 36 | #include "AliMagF.h" |
128a8042 | 37 | #include "AliTracker.h" |
38 | #include "AliAnalysisManager.h" | |
fc7a3fd3 | 39 | #include "AliGeomManager.h" |
79720f5b | 40 | #include "AliCDBManager.h" |
fc7a3fd3 | 41 | |
128a8042 | 42 | |
27f15548 | 43 | //PWG3/muondep includes |
128a8042 | 44 | #include "AliAnalysisTaskMuonTrackingEff.h" |
45 | #include "AliCheckMuonDetEltResponse.h" | |
46 | ||
47 | //MUON includes | |
128a8042 | 48 | #include "AliMUONTrackExtrap.h" |
27f15548 | 49 | #include "AliMUONGeometryTransformer.h" |
79720f5b | 50 | #include "AliMUONConstants.h" |
128a8042 | 51 | |
52 | ClassImp(AliAnalysisTaskMuonTrackingEff) | |
53 | ||
27f15548 | 54 | const Int_t AliAnalysisTaskMuonTrackingEff::fgkTotNbrOfDetectionElt = 156; |
79720f5b | 55 | const Int_t AliAnalysisTaskMuonTrackingEff::fgkTotNbrOfChamber = AliMUONConstants::NTrackingCh(); |
128a8042 | 56 | |
57 | //________________________________________________________________________ | |
58 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff() | |
0246246b | 59 | : |
0246246b | 60 | AliAnalysisTask(), |
79720f5b | 61 | fIsInit(kFALSE), |
62 | fIsLoaded(kFALSE), | |
63 | fOCDBpath(0), | |
64 | fUsableTracks(0), | |
0246246b | 65 | fESD(0x0), |
fc7a3fd3 | 66 | fTransformer(0x0), |
79720f5b | 67 | fDetEltTDHistList(0), |
68 | fDetEltTTHistList(0), | |
69 | fChamberTDHistList(0), | |
70 | fChamberTTHistList(0), | |
71 | fChamberEff(0x0) | |
128a8042 | 72 | { |
665701ae | 73 | /// Default constructor |
74 | } | |
75 | //________________________________________________________________________ | |
76 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff(const AliAnalysisTaskMuonTrackingEff& src) | |
0246246b | 77 | : |
0246246b | 78 | AliAnalysisTask(src), |
79720f5b | 79 | fIsInit(kFALSE), |
80 | fIsLoaded(kFALSE), | |
81 | fOCDBpath(0), | |
82 | fUsableTracks(0), | |
0246246b | 83 | fESD(0x0), |
fc7a3fd3 | 84 | fTransformer(0x0), |
79720f5b | 85 | fDetEltTDHistList(0), |
86 | fDetEltTTHistList(0), | |
87 | fChamberTDHistList(0), | |
88 | fChamberTTHistList(0), | |
89 | fChamberEff(0x0) | |
665701ae | 90 | { |
91 | /// copy ctor | |
92 | src.Copy(*this); | |
93 | } | |
94 | //________________________________________________________________________ | |
95 | AliAnalysisTaskMuonTrackingEff& AliAnalysisTaskMuonTrackingEff::operator=(const AliAnalysisTaskMuonTrackingEff& src) | |
96 | { | |
97 | /// assignement operator | |
98 | if ( this != &src ) | |
99 | { | |
100 | src.Copy(*this); | |
101 | } | |
102 | return *this; | |
128a8042 | 103 | } |
128a8042 | 104 | |
105 | //________________________________________________________________________ | |
79720f5b | 106 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff(TString name, TString path) |
0246246b | 107 | : |
0246246b | 108 | AliAnalysisTask(name, "AnalysisTaskESD"), |
79720f5b | 109 | fIsInit(kFALSE), |
110 | fIsLoaded(kFALSE), | |
111 | fOCDBpath(path), | |
112 | fUsableTracks(0), | |
0246246b | 113 | fESD(0x0), |
fc7a3fd3 | 114 | fTransformer(0x0), |
79720f5b | 115 | fDetEltTDHistList(0), |
116 | fDetEltTTHistList(0), | |
117 | fChamberTDHistList(0), | |
118 | fChamberTTHistList(0), | |
119 | fChamberEff(0x0) | |
128a8042 | 120 | { |
121 | //Constructor | |
122 | //----------- | |
128a8042 | 123 | //Define input & output |
124 | //--------------------- | |
128a8042 | 125 | // -Input slot 0 works with a TChain: |
126 | DefineInput(0, TChain::Class()); | |
127 | ||
5982d2f7 | 128 | // -Output slots 0 to 5 writes into a TClonesArray: |
79720f5b | 129 | DefineOutput(0, TList::Class()); |
130 | DefineOutput(1, TList::Class()); | |
131 | DefineOutput(2, TList::Class()); | |
132 | DefineOutput(3, TList::Class()); | |
128a8042 | 133 | } |
134 | ||
135 | ||
136 | ||
137 | //______________________________________________________________________________ | |
138 | AliAnalysisTaskMuonTrackingEff::~AliAnalysisTaskMuonTrackingEff() | |
139 | { | |
140 | // Destructor. | |
fc7a3fd3 | 141 | delete fTransformer; |
fc7a3fd3 | 142 | delete fDetEltTDHistList; |
143 | delete fDetEltTTHistList; | |
fc7a3fd3 | 144 | delete fChamberTDHistList; |
145 | delete fChamberTTHistList; | |
146 | delete fChamberEff; | |
128a8042 | 147 | } |
148 | ||
149 | ||
150 | ||
151 | //________________________________________________________________________ | |
152 | void AliAnalysisTaskMuonTrackingEff::CreateOutputObjects() | |
153 | { | |
79720f5b | 154 | if (!fIsInit) |
155 | Init(); | |
156 | ||
157 | OpenFile(0); | |
128a8042 | 158 | } |
159 | ||
160 | ||
161 | ||
162 | //________________________________________________________________________ | |
163 | void AliAnalysisTaskMuonTrackingEff::ConnectInputData(Option_t */*option*/) | |
164 | ||
165 | { | |
f7a1cc68 | 166 | //Connect input |
128a8042 | 167 | AliESDInputHandler* esdHandler = (AliESDInputHandler*) ((AliAnalysisManager::GetAnalysisManager())->GetInputEventHandler()); |
168 | if (!esdHandler) | |
128a8042 | 169 | Printf("ERROR: Could not get ESDInputHandler"); |
79720f5b | 170 | |
128a8042 | 171 | else fESD = esdHandler->GetEvent(); |
172 | } | |
173 | ||
174 | ||
175 | //________________________________________________________________________ | |
176 | void AliAnalysisTaskMuonTrackingEff::Exec(Option_t */*option*/) | |
177 | { | |
178 | //Execute analysis for current event | |
79720f5b | 179 | |
180 | // Initialize the object first | |
181 | if (!fIsInit) | |
182 | Init(); | |
183 | ||
184 | // Then load the OCDB and Geometry | |
185 | if (!fIsLoaded) | |
186 | LoadOCDBandGeometry(); | |
187 | ||
188 | // Fill the histograms | |
6db6876c | 189 | if (fChamberEff == 0x0) |
190 | fChamberEff = new AliCheckMuonDetEltResponse(fTransformer, fESD, fDetEltTDHistList, fDetEltTTHistList, fChamberTDHistList, fChamberTTHistList); | |
191 | fChamberEff->CheckDetEltResponse(); | |
79720f5b | 192 | fUsableTracks += fChamberEff -> GetNbrUsableTracks(); |
193 | ||
194 | //Post the output data: | |
195 | PostData(0, fDetEltTDHistList); | |
196 | PostData(1, fDetEltTTHistList); | |
197 | PostData(2, fChamberTDHistList); | |
198 | PostData(3, fChamberTTHistList); | |
199 | } | |
128a8042 | 200 | |
128a8042 | 201 | |
0246246b | 202 | |
79720f5b | 203 | //________________________________________________________________________ |
204 | void AliAnalysisTaskMuonTrackingEff::Terminate(Option_t */*option*/) | |
205 | { | |
206 | //Terminate analysis | |
207 | fDetEltTDHistList = (TList*) GetOutputData(0); | |
208 | fDetEltTTHistList = (TList*) GetOutputData(1); | |
209 | fChamberTDHistList = (TList*) GetOutputData(2); | |
210 | fChamberTTHistList = (TList*) GetOutputData(3); | |
211 | } | |
0246246b | 212 | |
128a8042 | 213 | |
214 | ||
79720f5b | 215 | //________________________________________________________________________ |
216 | void AliAnalysisTaskMuonTrackingEff::Init() | |
217 | { | |
218 | //Define detection element efficiency histograms | |
219 | //---------------------------------------------- | |
220 | fUsableTracks = 0; | |
128a8042 | 221 | |
222 | ||
79720f5b | 223 | fDetEltTDHistList = new TList(); |
224 | fDetEltTTHistList = new TList(); | |
128a8042 | 225 | |
79720f5b | 226 | fChamberTDHistList = new TList(); |
227 | fChamberTTHistList = new TList(); | |
228 | ||
229 | TString histName; | |
230 | TString histTitle; | |
128a8042 | 231 | |
79720f5b | 232 | |
233 | for (Int_t ii = 0; ii < fgkTotNbrOfDetectionElt; ++ii) | |
234 | { | |
235 | Int_t iDetElt = 0; | |
236 | if (ii<16) iDetElt = 100*(ii/4+1) + ii - int(ii/4)*4; | |
237 | else if (ii<52) iDetElt = 100*((ii-16)/18+5) + ii - (int((ii-16)/18)*18 + 16); | |
238 | if (ii>51) iDetElt = 100*((ii-52)/26+7) + ii - (int((ii-52)/26)*26 + 52); | |
0246246b | 239 | |
79720f5b | 240 | |
241 | histTitle.Form("detEltNbr %d",iDetElt); | |
242 | histName.Form("TD_detEltNbr%d",iDetElt); | |
243 | if(ii<16) | |
244 | {// Chambers 1 -> 4 | |
245 | TH2F *histo = new TH2F(histName, histTitle, 12, -10.0 , 110.0, 12, -10.0, 110.0); | |
246 | fDetEltTDHistList->AddAt(histo, ii); | |
247 | } | |
0246246b | 248 | |
79720f5b | 249 | else |
250 | {// Chambers 5 -> 10 | |
251 | TH2F *histo = new TH2F(histName, histTitle, 28, -140.0, 140.0, 8, -40.0, 40.0); | |
252 | fDetEltTDHistList->AddAt(histo, ii); | |
253 | } | |
0246246b | 254 | |
255 | ||
79720f5b | 256 | histName.Form("TT_detEltNbr%d",iDetElt); |
257 | if(ii<16) | |
258 | {// Chambers 1 -> 4 | |
259 | TH2F *histo = new TH2F(histName, histTitle, 12, -10.0 , 110.0, 12, -10.0, 110.0); | |
260 | fDetEltTTHistList->AddAt(histo, ii); | |
261 | } | |
0246246b | 262 | |
79720f5b | 263 | else |
264 | {// Chambers 5 -> 10 | |
265 | TH2F *histo = new TH2F(histName, histTitle, 28, -140.0, 140.0, 8, -40.0, 40.0); | |
266 | fDetEltTTHistList->AddAt(histo, ii); | |
267 | } | |
268 | } | |
0246246b | 269 | |
128a8042 | 270 | |
79720f5b | 271 | for (Int_t jj = 0; jj < fgkTotNbrOfChamber+1; jj++) |
272 | { | |
273 | histName.Form("TD_ChamberNbr%d", jj+1); | |
274 | histTitle.Form("ChamberNbr %d", jj+1); | |
275 | if (jj<4) | |
276 | {//Chambers 1 -> 4 | |
277 | TH1F *histo = new TH1F(histName, histTitle, 4, 0.0, 4.0); | |
278 | fChamberTDHistList->AddAt(histo, jj); | |
279 | } | |
280 | else | |
281 | { | |
282 | if (jj<6) | |
283 | {//Chambers 5 -> 6 | |
284 | TH1F *histo = new TH1F(histName, histTitle, 18, 0.0, 18.0); | |
285 | fChamberTDHistList->AddAt(histo, jj); | |
286 | } | |
128a8042 | 287 | |
79720f5b | 288 | if (jj>=6 && jj < 10) |
289 | {//Chambers 7 -> 10 | |
290 | TH1F *histo = new TH1F(histName, histTitle, 26, 0.0, 26.0); | |
291 | fChamberTDHistList->AddAt(histo, jj); | |
292 | } | |
293 | } | |
294 | ||
295 | histName.Form("TT_ChamberNbr%d",jj+1); | |
296 | if (jj<4) | |
297 | {//Chambers 1 -> 4 | |
298 | TH1F *histo = new TH1F(histName, histTitle, 4, 0.0, 4.0); | |
299 | fChamberTTHistList->AddAt(histo, jj); | |
300 | } | |
301 | else | |
302 | { | |
303 | if (jj<6) | |
304 | {//Chambers 5 -> 6 | |
305 | TH1F *histo = new TH1F(histName, histTitle, 18, 0.0, 18.0); | |
306 | fChamberTTHistList->AddAt(histo, jj); | |
307 | } | |
128a8042 | 308 | |
79720f5b | 309 | if (jj>=6 && jj < 10) |
310 | {//Chambers 7 -> 10 | |
311 | TH1F *histo = new TH1F(histName, histTitle, 26, 0.0, 26.0); | |
312 | fChamberTTHistList->AddAt(histo, jj); | |
313 | } | |
314 | } | |
315 | ||
316 | if (jj == 10) | |
317 | { | |
318 | histName.Form("TD_Chambers", jj+1); | |
319 | histTitle.Form("Chambers", jj+1); | |
320 | TH1F *histoTDchambers = new TH1F(histName, histTitle, 10, 0.5, 10.5); | |
321 | fChamberTDHistList->AddAt(histoTDchambers, jj); | |
322 | ||
323 | histName.Form("TT_Chambers", jj+1); | |
324 | TH1F *histoTTchambers = new TH1F(histName, histTitle, 10, 0.5, 10.5); | |
325 | fChamberTTHistList->AddAt(histoTTchambers, jj); | |
326 | } | |
128a8042 | 327 | |
79720f5b | 328 | } |
329 | ||
330 | fIsInit = kTRUE; | |
128a8042 | 331 | } |
0246246b | 332 | |
333 | ||
334 | //________________________________________________________________________ | |
79720f5b | 335 | void AliAnalysisTaskMuonTrackingEff::LoadOCDBandGeometry() |
0246246b | 336 | { |
79720f5b | 337 | // Load the OCDB and the Geometry |
0246246b | 338 | |
79720f5b | 339 | // OCDB |
340 | AliCDBManager* man = AliCDBManager::Instance(); | |
341 | TString ocdbPath= "alien://folder=/alice/data/2010/OCDB"; | |
342 | man->SetDefaultStorage(ocdbPath.Data()); | |
343 | man->SetRun(fESD->GetRunNumber()); | |
0246246b | 344 | |
79720f5b | 345 | //Geometry |
346 | if (!AliGeomManager::GetGeometry()) | |
347 | AliGeomManager::LoadGeometry(); | |
348 | fTransformer = new AliMUONGeometryTransformer(); | |
349 | fTransformer->LoadGeometryData(); | |
0246246b | 350 | |
79720f5b | 351 | //Set Field Map for track extrapolation |
352 | AliMUONTrackExtrap::SetField(); | |
353 | ||
354 | fIsLoaded = kTRUE; | |
0246246b | 355 | } |
79720f5b | 356 |