]>
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 | ||
27de2dfb | 16 | /* $Id$ */ |
17 | ||
128a8042 | 18 | //Class to calculate the intrinsic efficiency of the detection elements of the |
19 | //MUON tracking chambers in function of the position in the detection element. | |
79720f5b | 20 | //WOrk on ESD only |
128a8042 | 21 | //Author: Nicolas LE BRIS - SUBATECH Nantes |
79720f5b | 22 | // Modified by Matthieu LENHARDT - SUBATECH Nantes |
e1ec553d | 23 | // Modified by Antoine LARDEUX - SUBATECH Nantes |
128a8042 | 24 | |
e1ec553d | 25 | // ROOT includes |
79720f5b | 26 | #include <TList.h> |
e1ec553d | 27 | #include <TH3F.h> |
128a8042 | 28 | #include <TH2F.h> |
e1ec553d | 29 | #include <TObjArray.h> |
30 | #include <TGeoGlobalMagField.h> | |
128a8042 | 31 | |
e1ec553d | 32 | // STEER includes |
128a8042 | 33 | #include "AliESDEvent.h" |
34 | #include "AliESDMuonTrack.h" | |
fc7a3fd3 | 35 | #include "AliGeomManager.h" |
79720f5b | 36 | #include "AliCDBManager.h" |
e1ec553d | 37 | #include "AliESDVZERO.h" |
fc7a3fd3 | 38 | |
e1ec553d | 39 | // ANALYSIS includes |
40 | #include "AliInputEventHandler.h" | |
41 | #include "AliAnalysisManager.h" | |
128a8042 | 42 | #include "AliAnalysisTaskMuonTrackingEff.h" |
e1ec553d | 43 | #include "AliCentrality.h" |
128a8042 | 44 | |
45 | //MUON includes | |
e1ec553d | 46 | #include "AliMUONCDB.h" |
47 | #include "AliMUONESDInterface.h" | |
27f15548 | 48 | #include "AliMUONGeometryTransformer.h" |
e1ec553d | 49 | #include "AliMUONTrack.h" |
50 | #include "AliMUONTrackParam.h" | |
51 | #include "AliMUONTrackExtrap.h" | |
52 | #include "AliMUONVCluster.h" | |
79720f5b | 53 | #include "AliMUONConstants.h" |
128a8042 | 54 | |
e1ec553d | 55 | //include MUON/mapping: |
56 | #include "AliMpDEManager.h" | |
57 | #include "AliMpSegmentation.h" | |
58 | #include "AliMpVSegmentation.h" | |
59 | #include "AliMpPad.h" | |
60 | ||
128a8042 | 61 | ClassImp(AliAnalysisTaskMuonTrackingEff) |
62 | ||
e1ec553d | 63 | const Int_t AliAnalysisTaskMuonTrackingEff::fgkNbrOfDetectionElt[10] = {4, 4, 4, 4, 18, 18, 26, 26, 26, 26}; |
64 | const Int_t AliAnalysisTaskMuonTrackingEff::fgkOffset = 100; | |
128a8042 | 65 | |
66 | //________________________________________________________________________ | |
e1ec553d | 67 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff() : |
68 | AliAnalysisTaskSE(), | |
69 | fOCDBLoaded(kFALSE), | |
70 | fOCDBpath(""), | |
71 | fMatchTrig(kFALSE), | |
72 | fApplyAccCut(kFALSE), | |
73 | fCurrentCentrality(0.), | |
fc7a3fd3 | 74 | fTransformer(0x0), |
e1ec553d | 75 | fDetEltTDHistList(0x0), |
76 | fDetEltTTHistList(0x0), | |
145eb7fe | 77 | fDetEltSDHistList(0x0), |
e1ec553d | 78 | fChamberTDHistList(0x0), |
145eb7fe | 79 | fChamberTTHistList(0x0), |
80 | fChamberSDHistList(0x0), | |
81 | fExtraHistList(0x0) | |
128a8042 | 82 | { |
e1ec553d | 83 | /// Default constructor |
128a8042 | 84 | } |
128a8042 | 85 | |
86 | //________________________________________________________________________ | |
e1ec553d | 87 | AliAnalysisTaskMuonTrackingEff::AliAnalysisTaskMuonTrackingEff(TString name) : |
88 | AliAnalysisTaskSE(name), | |
89 | fOCDBLoaded(kFALSE), | |
90 | fOCDBpath("raw://"), | |
91 | fMatchTrig(kFALSE), | |
92 | fApplyAccCut(kFALSE), | |
93 | fCurrentCentrality(100.), | |
fc7a3fd3 | 94 | fTransformer(0x0), |
e1ec553d | 95 | fDetEltTDHistList(0x0), |
96 | fDetEltTTHistList(0x0), | |
145eb7fe | 97 | fDetEltSDHistList(0x0), |
e1ec553d | 98 | fChamberTDHistList(0x0), |
145eb7fe | 99 | fChamberTTHistList(0x0), |
100 | fChamberSDHistList(0x0), | |
101 | fExtraHistList(0x0) | |
128a8042 | 102 | { |
e1ec553d | 103 | /// Constructor |
104 | ||
105 | // Output slots 0 to 5 writes into a TClonesArray: | |
106 | DefineOutput(1, TList::Class()); | |
107 | DefineOutput(2, TList::Class()); | |
108 | DefineOutput(3, TList::Class()); | |
109 | DefineOutput(4, TList::Class()); | |
145eb7fe | 110 | DefineOutput(5, TList::Class()); |
111 | DefineOutput(6, TList::Class()); | |
112 | DefineOutput(7, TList::Class()); | |
128a8042 | 113 | } |
114 | ||
e1ec553d | 115 | //________________________________________________________________________ |
128a8042 | 116 | AliAnalysisTaskMuonTrackingEff::~AliAnalysisTaskMuonTrackingEff() |
117 | { | |
e1ec553d | 118 | /// Destructor |
119 | if (!AliAnalysisManager::GetAnalysisManager()->IsProofMode()) { | |
120 | delete fDetEltTDHistList; | |
121 | delete fDetEltTTHistList; | |
145eb7fe | 122 | delete fDetEltSDHistList; |
e1ec553d | 123 | delete fChamberTDHistList; |
124 | delete fChamberTTHistList; | |
145eb7fe | 125 | delete fChamberSDHistList; |
126 | delete fExtraHistList; | |
e1ec553d | 127 | } |
fc7a3fd3 | 128 | delete fTransformer; |
128a8042 | 129 | } |
130 | ||
128a8042 | 131 | //________________________________________________________________________ |
e1ec553d | 132 | void AliAnalysisTaskMuonTrackingEff::NotifyRun() |
128a8042 | 133 | { |
e1ec553d | 134 | /// Load the OCDB and the Geometry |
135 | ||
136 | // Load it only once | |
137 | if (fOCDBLoaded) return; | |
138 | ||
139 | // OCDB | |
140 | AliCDBManager* man = AliCDBManager::Instance(); | |
145eb7fe | 141 | if (man->IsDefaultStorageSet()) printf("EfficiencyTask: CDB default storage already set!\n"); |
e1ec553d | 142 | else man->SetDefaultStorage(fOCDBpath.Data()); |
145eb7fe | 143 | if (man->GetRun() > -1) printf("EfficiencyTask: run number already set!\n"); |
e1ec553d | 144 | else man->SetRun(fCurrentRunNumber); |
145 | ||
146 | // Geometry | |
147 | if (!AliGeomManager::GetGeometry()) { | |
148 | AliGeomManager::LoadGeometry(); | |
149 | if (!AliGeomManager::GetGeometry()) return; | |
150 | if (!AliGeomManager::ApplyAlignObjsFromCDB("MUON")) return; | |
151 | } | |
152 | fTransformer = new AliMUONGeometryTransformer(); | |
153 | fTransformer->LoadGeometryData(); | |
154 | ||
155 | // Magnetic field for track extrapolation | |
156 | if (!TGeoGlobalMagField::Instance()->GetField()) { | |
157 | if (!AliMUONCDB::LoadField()) return; | |
158 | } | |
159 | ||
160 | // Mapping | |
161 | if (!AliMpSegmentation::Instance(kFALSE)) { | |
162 | if (!AliMUONCDB::LoadMapping(kTRUE)) return; | |
163 | } | |
164 | ||
165 | // RecoParam for refitting | |
145eb7fe | 166 | if (!AliMUONESDInterface::GetTracker()) { |
167 | AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam(); | |
168 | if (!recoParam) return; | |
169 | AliMUONESDInterface::ResetTracker(recoParam); | |
170 | } | |
e1ec553d | 171 | |
172 | fOCDBLoaded = kTRUE; | |
128a8042 | 173 | } |
174 | ||
128a8042 | 175 | //________________________________________________________________________ |
e1ec553d | 176 | void AliAnalysisTaskMuonTrackingEff::UserCreateOutputObjects() |
128a8042 | 177 | { |
e1ec553d | 178 | /// Define efficiency histograms |
179 | ||
180 | fDetEltTDHistList = new TList(); | |
181 | fDetEltTDHistList->SetOwner(); | |
182 | fDetEltTTHistList = new TList(); | |
183 | fDetEltTTHistList->SetOwner(); | |
145eb7fe | 184 | fDetEltSDHistList = new TList(); |
185 | fDetEltSDHistList->SetOwner(); | |
e1ec553d | 186 | fChamberTDHistList = new TList(); |
187 | fChamberTDHistList->SetOwner(); | |
188 | fChamberTTHistList = new TList(); | |
189 | fChamberTTHistList->SetOwner(); | |
145eb7fe | 190 | fChamberSDHistList = new TList(); |
191 | fChamberSDHistList->SetOwner(); | |
192 | fExtraHistList = new TList(); | |
193 | fExtraHistList->SetOwner(); | |
e1ec553d | 194 | |
195 | TH2F *h2; | |
196 | TH3F *h3; | |
197 | TString histNameTD; | |
198 | TString histNameTT; | |
145eb7fe | 199 | TString histNameSD; |
e1ec553d | 200 | TString histTitle; |
201 | Int_t nCentBins = 22; | |
202 | Double_t centRange[2] = {-5., 105.}; | |
203 | Int_t iDEGlobal = 0; | |
145eb7fe | 204 | |
e1ec553d | 205 | |
206 | for (Int_t iCh = 0; iCh < 10; iCh++) | |
207 | { | |
208 | // histograms per chamber | |
209 | histTitle.Form("ChamberNbr %d", iCh+1); | |
210 | histNameTD.Form("TD_ChamberNbr%d", iCh+1); | |
211 | histNameTT.Form("TT_ChamberNbr%d",iCh+1); | |
145eb7fe | 212 | histNameSD.Form("SD_ChamberNbr%d", iCh+1); |
e1ec553d | 213 | h2 = new TH2F(histNameTD, histTitle, fgkNbrOfDetectionElt[iCh], 0., fgkNbrOfDetectionElt[iCh], nCentBins, centRange[0], centRange[1]); |
214 | fChamberTDHistList->AddAt(h2, iCh); | |
215 | h2 = new TH2F(histNameTT, histTitle, fgkNbrOfDetectionElt[iCh], 0., fgkNbrOfDetectionElt[iCh], nCentBins, centRange[0], centRange[1]); | |
216 | fChamberTTHistList->AddAt(h2, iCh); | |
145eb7fe | 217 | h2 = new TH2F(histNameSD, histTitle, fgkNbrOfDetectionElt[iCh], 0., fgkNbrOfDetectionElt[iCh], nCentBins, centRange[0], centRange[1]); |
218 | fChamberSDHistList->AddAt(h2, iCh); | |
e1ec553d | 219 | |
220 | // histograms per DE | |
221 | for (Int_t iDE = 0; iDE < fgkNbrOfDetectionElt[iCh]; iDE++) | |
222 | { | |
223 | Int_t deId = FromLocalId2DetElt(iCh, iDE); | |
224 | histTitle.Form("detEltNbr %d",deId); | |
225 | histNameTD.Form("TD_detEltNbr%d",deId); | |
226 | histNameTT.Form("TT_detEltNbr%d",deId); | |
145eb7fe | 227 | histNameSD.Form("SD_detEltNbr%d",deId); |
e1ec553d | 228 | if(iCh < 4) |
229 | {// chambers 1 -> 4 | |
230 | h3 = new TH3F(histNameTD, histTitle, 12, -10.0 , 110.0, 12, -10.0, 110.0, nCentBins, centRange[0], centRange[1]); | |
231 | fDetEltTDHistList->AddAt(h3, iDEGlobal); | |
232 | h3 = new TH3F(histNameTT, histTitle, 12, -10.0 , 110.0, 12, -10.0, 110.0, nCentBins, centRange[0], centRange[1]); | |
233 | fDetEltTTHistList->AddAt(h3, iDEGlobal); | |
145eb7fe | 234 | h3 = new TH3F(histNameSD, histTitle, 12, -10.0 , 110.0, 12, -10.0, 110.0, nCentBins, centRange[0], centRange[1]); |
235 | fDetEltSDHistList->AddAt(h3, iDEGlobal); | |
e1ec553d | 236 | } |
237 | else | |
238 | {// chambers 5 -> 10 | |
239 | h3 = new TH3F(histNameTD, histTitle, 28, -140.0, 140.0, 8, -40.0, 40.0, nCentBins, centRange[0], centRange[1]); | |
240 | fDetEltTDHistList->AddAt(h3, iDEGlobal); | |
241 | h3 = new TH3F(histNameTT, histTitle, 28, -140.0, 140.0, 8, -40.0, 40.0, nCentBins, centRange[0], centRange[1]); | |
145eb7fe | 242 | fDetEltTTHistList->AddAt(h3, iDEGlobal); |
243 | h3 = new TH3F(histNameSD, histTitle, 28, -140.0, 140.0, 8, -40.0, 40.0, nCentBins, centRange[0], centRange[1]); | |
244 | fDetEltSDHistList->AddAt(h3, iDEGlobal); | |
e1ec553d | 245 | } |
246 | iDEGlobal++; | |
247 | } | |
248 | } | |
249 | ||
250 | // global histograms per chamber | |
251 | h2 = new TH2F("TD_Chambers 11", "Chambers 11", 10, 0.5, 10.5, nCentBins, centRange[0], centRange[1]); | |
252 | fChamberTDHistList->AddAt(h2, 10); | |
253 | h2 = new TH2F("TT_Chambers 11", "Chambers 11", 10, 0.5, 10.5, nCentBins, centRange[0], centRange[1]); | |
254 | fChamberTTHistList->AddAt(h2, 10); | |
145eb7fe | 255 | h2 = new TH2F("SD_Chambers 11", "Chambers 11", 10, 0.5, 10.5, nCentBins, centRange[0], centRange[1]); |
256 | fChamberSDHistList->AddAt(h2, 10); | |
257 | ||
258 | ||
259 | //Extra histograms | |
260 | TH1F *fHistPt = new TH1F("fHistPt", "Pt distribution", 100, 0.0, 50); | |
261 | fExtraHistList->AddAt(fHistPt,0); | |
262 | ||
e1ec553d | 263 | |
264 | // post the output data at least once | |
265 | PostData(1, fDetEltTDHistList); | |
145eb7fe | 266 | PostData(2, fDetEltTTHistList); |
267 | PostData(3, fDetEltSDHistList); | |
268 | PostData(4, fChamberTDHistList); | |
269 | PostData(5, fChamberTTHistList); | |
270 | PostData(6, fChamberSDHistList); | |
271 | PostData(7, fExtraHistList); | |
128a8042 | 272 | } |
273 | ||
128a8042 | 274 | //________________________________________________________________________ |
e1ec553d | 275 | void AliAnalysisTaskMuonTrackingEff::UserExec(Option_t *) |
128a8042 | 276 | { |
e1ec553d | 277 | /// Main event loop |
278 | ||
279 | // check the OCDB has been loaded properly | |
280 | if (!fOCDBLoaded) return; | |
281 | ||
282 | // get the current event | |
283 | AliESDEvent* esd = dynamic_cast<AliESDEvent*>(InputEvent()); | |
284 | if (!esd) return; | |
285 | ||
286 | // get the centrality | |
287 | fCurrentCentrality = esd->GetCentrality()->GetCentralityPercentileUnchecked("V0M"); | |
288 | ||
289 | // loop over tracks | |
290 | AliMUONTrack track; | |
291 | Int_t nTracks = (Int_t)esd->GetNumberOfMuonTracks(); | |
292 | for (Int_t iTrack = 0; iTrack < nTracks; iTrack++) | |
293 | { | |
294 | AliESDMuonTrack* esdTrack = esd->GetMuonTrack(iTrack); | |
295 | ||
296 | if(!esdTrack->ContainTrackerData()) continue; | |
297 | ||
298 | if(fMatchTrig && !esdTrack->ContainTriggerData()) continue; | |
299 | ||
300 | Double_t thetaTrackAbsEnd = TMath::ATan(esdTrack->GetRAtAbsorberEnd()/505.) * TMath::RadToDeg(); | |
301 | Double_t eta = esdTrack->Eta(); | |
302 | if(fApplyAccCut && !(thetaTrackAbsEnd >= 2. && thetaTrackAbsEnd <= 9. && eta >= -4. && eta <= -2.5)) continue; | |
145eb7fe | 303 | |
304 | ((TH1F*) fExtraHistList->At(0))->Fill(esdTrack->Pt()); | |
e1ec553d | 305 | |
306 | AliMUONESDInterface::ESDToMUON(*esdTrack, track); | |
307 | ||
308 | TrackParamLoop(track.GetTrackParamAtCluster()); | |
309 | } | |
310 | ||
311 | // post the output data: | |
312 | PostData(1, fDetEltTDHistList); | |
313 | PostData(2, fDetEltTTHistList); | |
145eb7fe | 314 | PostData(3, fDetEltSDHistList); |
315 | PostData(4, fChamberTDHistList); | |
316 | PostData(5, fChamberTTHistList); | |
317 | PostData(6, fChamberSDHistList); | |
318 | PostData(7, fExtraHistList); | |
79720f5b | 319 | } |
e1ec553d | 320 | |
79720f5b | 321 | //________________________________________________________________________ |
e1ec553d | 322 | void AliAnalysisTaskMuonTrackingEff::Terminate(Option_t *) |
79720f5b | 323 | { |
e1ec553d | 324 | /// final plots |
79720f5b | 325 | } |
0246246b | 326 | |
79720f5b | 327 | //________________________________________________________________________ |
e1ec553d | 328 | void AliAnalysisTaskMuonTrackingEff::TrackParamLoop(const TObjArray* trackParams) |
79720f5b | 329 | { |
e1ec553d | 330 | /// Loop on all the track params and fill the histos |
79720f5b | 331 | |
e1ec553d | 332 | Bool_t trackFilter[10]; |
333 | memset(trackFilter, kFALSE, 10*sizeof(Bool_t)); | |
334 | Bool_t chamberResponse[10]; | |
335 | memset(chamberResponse, kFALSE, 10*sizeof(Bool_t)); | |
336 | ||
337 | // check if the chamber responds | |
338 | Int_t nTrackParams = (Int_t) trackParams->GetEntriesFast(); | |
339 | for (Int_t iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam) | |
340 | { | |
341 | Int_t chamberId = static_cast<AliMUONTrackParam*>(trackParams->UncheckedAt(iTrackParam))->GetClusterPtr()->GetChamberId(); | |
342 | trackFilter[chamberId] = kTRUE; | |
343 | chamberResponse[chamberId] = kTRUE; | |
344 | } | |
79720f5b | 345 | |
e1ec553d | 346 | // To make sure the calculation of the efficiency of a given chamber (DE) is not biased by the tracking algorithm |
347 | // we must make sure the track would have been reconstructed whatever this chamber (DE) has responded or not. | |
348 | // If the track is valid for a given chamber, the following code set trackFilter[chamberId] to kTRUE. | |
349 | for (Int_t station = 0; station < 4; ++station) | |
350 | { | |
351 | Int_t filter; | |
352 | Int_t ch1 = 2*station; | |
353 | Int_t ch2 = 2*station + 1; | |
354 | Int_t ch3 = 2*station + 2; | |
355 | Int_t ch4 = 2*station + 3; | |
356 | if (station < 3 ) | |
79720f5b | 357 | { |
e1ec553d | 358 | filter = trackFilter[ch1]; |
359 | trackFilter[ch1] = trackFilter[ch2]; | |
360 | trackFilter[ch2] = filter; | |
361 | } | |
362 | else | |
363 | { | |
364 | if (chamberResponse[ch3] && chamberResponse[ch4]) | |
365 | { | |
366 | filter = trackFilter[ch1]; | |
367 | trackFilter[ch1] = trackFilter[ch2]; | |
368 | trackFilter[ch2] = filter; | |
369 | } | |
370 | else | |
371 | { | |
372 | trackFilter[ch1] = kFALSE; | |
373 | trackFilter[ch2] = kFALSE; | |
374 | } | |
79720f5b | 375 | |
e1ec553d | 376 | if (chamberResponse[ch1] && chamberResponse[ch2]) |
377 | { | |
378 | filter = trackFilter[ch3]; | |
379 | trackFilter[ch3] = trackFilter[ch4]; | |
380 | trackFilter[ch4] = filter; | |
381 | } | |
382 | else | |
383 | { | |
384 | trackFilter[ch3] = kFALSE; | |
385 | trackFilter[ch4] = kFALSE; | |
386 | } | |
79720f5b | 387 | } |
e1ec553d | 388 | } |
389 | ||
390 | // loop over track parameters | |
391 | Int_t oldChamber = -1; | |
392 | for (Int_t iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam) | |
393 | { | |
394 | AliMUONTrackParam* trackParam = static_cast<AliMUONTrackParam*>(trackParams->UncheckedAt(iTrackParam)); | |
395 | AliMUONVCluster* cluster = trackParam->GetClusterPtr(); | |
396 | ||
397 | Int_t newChamber = cluster->GetChamberId(); | |
398 | ||
145eb7fe | 399 | Int_t detElt = cluster->GetDetElemId(); |
400 | ||
401 | ///track position in the global coordinate system | |
402 | Double_t posXG = trackParam->GetNonBendingCoor(); | |
403 | Double_t posYG = trackParam->GetBendingCoor(); | |
404 | Double_t posZG = trackParam->GetZ(); | |
405 | ||
406 | ///track position in the coordinate system of the DE | |
407 | Double_t posXL, posYL, posZL; | |
408 | fTransformer->Global2Local(detElt, posXG, posYG, posZG, posXL, posYL, posZL); | |
409 | ||
e1ec553d | 410 | // fill histograms if the track is valid for this chamber |
411 | if(trackFilter[newChamber]) | |
79720f5b | 412 | { |
e1ec553d | 413 | |
414 | // fill histograms of the cluster positions on the detection element of the TRACKS DETECTED (TD) | |
415 | FillTDHistos(newChamber, detElt, posXL, posYL); | |
416 | ||
417 | // fill histograms of the cluster positions on the detection element of ALL THE TRACKS (TT) | |
418 | FillTTHistos(newChamber, detElt, posXL, posYL); | |
145eb7fe | 419 | |
420 | } else { | |
421 | ||
422 | FillSDHistos(newChamber, detElt, posXL, posYL); | |
423 | ||
e1ec553d | 424 | } |
425 | ||
426 | // look for missing cluster(s) if any | |
427 | if (newChamber != oldChamber) | |
428 | { | |
429 | if (newChamber > oldChamber + 1) | |
430 | { | |
431 | Int_t nbrMissChamber = newChamber - (oldChamber + 1); | |
432 | ||
433 | // find the DE(s) that should have been fired and fill the corresponding histograms | |
434 | FindAndFillMissedDetElt(trackParam, trackFilter, oldChamber+1, nbrMissChamber); | |
435 | } | |
436 | ||
437 | // in case the last chamber has not responded | |
438 | if ( iTrackParam == nTrackParams-1 && newChamber != 9) FindAndFillMissedDetElt(trackParam, trackFilter, 9, 1); | |
79720f5b | 439 | } |
e1ec553d | 440 | |
441 | oldChamber = newChamber; | |
442 | } | |
443 | } | |
444 | ||
445 | //________________________________________________________________________ | |
446 | void AliAnalysisTaskMuonTrackingEff::FindAndFillMissedDetElt(const AliMUONTrackParam* trackParam, | |
447 | const Bool_t* trackFilter, | |
448 | Int_t firstMissCh, Int_t nbrMissCh) | |
449 | { | |
450 | /// Find which detection elements should have been hit but were missed, and fill the TT histos appropriately | |
79720f5b | 451 | |
e1ec553d | 452 | // copy track parameters for extrapolation |
453 | AliMUONTrackParam extrapTrackParam(*trackParam); | |
454 | ||
455 | // loop over missing chambers | |
456 | for (Int_t iCh = 0; iCh < nbrMissCh; ++iCh) | |
457 | { | |
458 | Int_t chamber = firstMissCh + iCh; | |
459 | ||
460 | // skip this chamber if the track is not valid for it | |
461 | if(!trackFilter[chamber]) continue; | |
462 | ||
463 | Int_t nbrOfDetElt = AliMpDEManager::GetNofDEInChamber(chamber, kTRUE); | |
464 | ||
465 | Double_t pos1[6] = {0, 0, 0, 0, 0, 0}; | |
466 | Double_t pos2[6] = {0, 0, 0, 0, 0, 0}; | |
467 | Double_t posMiss[2] = {0, 0}; | |
468 | ||
469 | // track position at the chamber z | |
470 | pos1[2] = AliMUONConstants::DefaultChamberZ(chamber); | |
471 | AliMUONTrackExtrap::ExtrapToZ(&extrapTrackParam, pos1[2]); | |
472 | pos1[0] = extrapTrackParam.GetNonBendingCoor(); | |
473 | pos1[1] = extrapTrackParam.GetBendingCoor(); | |
474 | ||
475 | // track position at the chamber z + dz (where dz = distance between the 2 chamber in the station) | |
476 | pos2[2] = AliMUONConstants::DefaultChamberZ(chamber) + AliMUONConstants::DzCh(); | |
477 | AliMUONTrackExtrap::ExtrapToZ(&extrapTrackParam, pos2[2]); | |
478 | pos2[0] = extrapTrackParam.GetNonBendingCoor(); | |
479 | pos2[1] = extrapTrackParam.GetBendingCoor(); | |
480 | ||
481 | // loop over all the detection element of the chamber | |
482 | for (Int_t iDE = 0; iDE < nbrOfDetElt; iDE++) | |
483 | { | |
484 | Int_t deId = (chamber + 1)*fgkOffset + iDE; | |
485 | ||
486 | // track positions (at chamber z and chamber z + dz) in the local coordinate system of the DE | |
487 | fTransformer->Global2Local(deId, pos1[0], pos1[1], pos1[2], pos1[3], pos1[4], pos1[5]); | |
488 | fTransformer->Global2Local(deId, pos2[0], pos2[1], pos2[2], pos2[3], pos2[4], pos2[5]); | |
489 | ||
490 | // track position at z=0 in the local coordinate system of the DE | |
491 | CoordinatesOfMissingCluster(pos1[3], pos1[4], pos1[5], pos2[3], pos2[4], pos2[5], posMiss[0], posMiss[1]); | |
492 | ||
493 | // check if the track cross this DE and fill the corresponding histogram | |
494 | if (CoordinatesInDetElt(deId, posMiss[0], posMiss[1])) FillTTHistos(chamber, deId, posMiss[0], posMiss[1]); | |
495 | } | |
496 | } | |
128a8042 | 497 | } |
0246246b | 498 | |
e1ec553d | 499 | //________________________________________________________________________ |
500 | void AliAnalysisTaskMuonTrackingEff::CoordinatesOfMissingCluster(Double_t x1, Double_t y1, Double_t z1, | |
501 | Double_t x2, Double_t y2, Double_t z2, | |
502 | Double_t& x, Double_t& y) const | |
503 | { | |
504 | /// Compute the coordinates of the missing cluster. They are defined by the intersection between | |
505 | /// the straigth line joining two extrapolated points (1 and 2) and the detection element plane. | |
506 | /// In the local coordinates, this means Z=0 in the parametric equation of the line. | |
507 | Double_t t = - z1 / (z2 - z1); | |
508 | x = t * (x2 - x1) + x1; | |
509 | y = t * (y2 - y1) + y1; | |
510 | } | |
0246246b | 511 | |
512 | //________________________________________________________________________ | |
e1ec553d | 513 | Bool_t AliAnalysisTaskMuonTrackingEff::CoordinatesInDetElt(Int_t DeId, Double_t x, Double_t y) const |
0246246b | 514 | { |
e1ec553d | 515 | /// Return kTRUE if the coordinates are in the Detection Element. |
516 | /// This is done by checking if a pad correspond to the (x, y) position. | |
517 | const AliMpVSegmentation* seg1 = AliMpSegmentation::Instance()->GetMpSegmentation(DeId, AliMp::kCath0); | |
518 | const AliMpVSegmentation* seg2 = AliMpSegmentation::Instance()->GetMpSegmentation(DeId, AliMp::kCath1); | |
519 | if (!seg1 || !seg2) return kFALSE; | |
520 | AliMpPad pad1 = seg1->PadByPosition(x, y, kFALSE); | |
521 | AliMpPad pad2 = seg2->PadByPosition(x, y, kFALSE); | |
522 | return (pad1.IsValid() && pad2.IsValid()); | |
523 | } | |
0246246b | 524 | |
e1ec553d | 525 | //________________________________________________________________________ |
526 | void AliAnalysisTaskMuonTrackingEff::FillTDHistos(Int_t chamber, Int_t detElt, Double_t posXL, Double_t posYL) | |
527 | { | |
528 | /// Fill the histo for detected tracks | |
529 | ((TH3F*) fDetEltTDHistList->At(FromDetElt2iDet(chamber, detElt)))->Fill(posXL, posYL, fCurrentCentrality); | |
530 | ((TH2F*) fChamberTDHistList->At(chamber))->Fill(FromDetElt2LocalId(chamber, detElt), fCurrentCentrality); | |
531 | ((TH2F*) fChamberTDHistList->At(10))->Fill(chamber+1, fCurrentCentrality); | |
532 | } | |
0246246b | 533 | |
e1ec553d | 534 | //________________________________________________________________________ |
535 | void AliAnalysisTaskMuonTrackingEff::FillTTHistos(Int_t chamber, Int_t detElt, Double_t posXL, Double_t posYL) | |
536 | { | |
537 | /// Fill the histo for all tracks | |
538 | ((TH3F*) fDetEltTTHistList->At(FromDetElt2iDet(chamber, detElt))) -> Fill(posXL, posYL, fCurrentCentrality); | |
539 | ((TH2F*) fChamberTTHistList->At(chamber))->Fill(FromDetElt2LocalId(chamber, detElt), fCurrentCentrality); | |
540 | ((TH2F*) fChamberTTHistList->At(10))->Fill(chamber+1, fCurrentCentrality); | |
145eb7fe | 541 | } |
542 | ||
543 | //________________________________________________________________________ | |
544 | void AliAnalysisTaskMuonTrackingEff::FillSDHistos(Int_t chamber, Int_t detElt, Double_t posXL, Double_t posYL) | |
545 | { | |
546 | /// Fill the histo for single detected tracks | |
547 | ((TH3F*) fDetEltSDHistList->At(FromDetElt2iDet(chamber, detElt))) -> Fill(posXL, posYL, fCurrentCentrality); | |
548 | ((TH2F*) fChamberSDHistList->At(chamber))->Fill(FromDetElt2LocalId(chamber, detElt), fCurrentCentrality); | |
549 | ((TH2F*) fChamberSDHistList->At(10))->Fill(chamber+1, fCurrentCentrality); | |
e1ec553d | 550 | } |
0246246b | 551 | |
e1ec553d | 552 | //________________________________________________________________________ |
553 | Int_t AliAnalysisTaskMuonTrackingEff::FromDetElt2iDet(Int_t chamber, Int_t detElt) const | |
554 | { | |
555 | /// Connexion between the detection element Id and its position in the list of histograms | |
556 | Int_t iDet = FromDetElt2LocalId(chamber, detElt); | |
557 | for (Int_t iCh = chamber-1; iCh >=0; iCh--) iDet += fgkNbrOfDetectionElt[iCh]; | |
558 | return iDet; | |
559 | } | |
79720f5b | 560 | |
e1ec553d | 561 | //________________________________________________________________________ |
562 | Int_t AliAnalysisTaskMuonTrackingEff::FromDetElt2LocalId(Int_t chamber, Int_t detElt) const | |
563 | { | |
564 | /// Connexion between the detection element Id and its number in the chamber | |
565 | return detElt - fgkOffset*(chamber+1); | |
566 | } | |
567 | ||
568 | //________________________________________________________________________ | |
569 | Int_t AliAnalysisTaskMuonTrackingEff::FromLocalId2DetElt(Int_t chamber, Int_t iDet) const | |
570 | { | |
571 | /// Connexion between the number of the detection element in the chamber and its Id | |
572 | return iDet + fgkOffset*(chamber+1); | |
0246246b | 573 | } |
79720f5b | 574 |