]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG3/muondep/AliCheckMuonDetEltResponse.cxx
quality check for the maximum Pt error removed. The Pt error depends on the magnetic...
[u/mrichter/AliRoot.git] / PWG3 / muondep / AliCheckMuonDetEltResponse.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 check the response of the detection elements of the MUON tracking chambers
17//in function of the position in the detection element.
18//Author: Nicolas LE BRIS - SUBATECH Nantes
19
20//PWG3/muon:
21#include "AliAnalysisTaskMuonTrackingEff.h"
22#include "AliCheckMuonDetEltResponse.h"
23
24//include STEER:
25#include "AliLog.h"
26#include "AliESDEvent.h"
27#include "AliTracker.h"
28#include "AliESDMuonTrack.h"
29
30//include MUON:
31#include "AliMUONTrack.h"
32#include "AliMUONTrackParam.h"
33#include "AliMUONTrackExtrap.h"
34#include "AliMUONVCluster.h"
35#include "AliMUONConstants.h"
36#include "AliMUONGeometryTransformer.h"
37#include "AliMUONESDInterface.h"
38
39//include MUON/mapping:
40#include "mapping/AliMpDEManager.h"
41
42//include ROOT:
43#include <Riostream.h>
44#include <TMath.h>
45#include <TROOT.h>
46#include <TSystem.h>
47#include <TH2F.h>
48#include <TClonesArray.h>
49#include <TPaveLabel.h>
50#include <TList.h>
51
52/// \cond CLASSIMP
53ClassImp(AliCheckMuonDetEltResponse)
54/// \endcond
55
56const Int_t AliCheckMuonDetEltResponse::fNbrOfChamber = 10;
57const Int_t AliCheckMuonDetEltResponse::fNbrOfStation = 5;
58const Int_t AliCheckMuonDetEltResponse::fNbrOfDetectionElt[10] = {4, 4, 4, 4, 18, 18, 26, 26, 26, 26};
59const Int_t AliCheckMuonDetEltResponse::fFirstDetectionElt[10] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
60const Int_t AliCheckMuonDetEltResponse::fOffset = 100;
61const Int_t AliCheckMuonDetEltResponse::fOverlapSize = 15;
62const Int_t AliCheckMuonDetEltResponse::fYSlatSize = 40;
63
64//_____________________________________________________________________________
65AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse()
128a8042 66: TObject(),
665701ae 67 fNCh(0),
68 fNSt(0),
69 fNDE(0),
128a8042 70 fTransformer(0x0),
665701ae 71 fESD(0x0),
128a8042 72 fTracksTotalNbr(0x0),
73 fTrackParams(0x0),
74 fTrackParam(0x0),
75 fCluster(0x0),
76 fDetEltTDHistList(0x0),
77 fDetEltTTHistList(0x0)
78{
79/// Default constructor
80
81 fNCh = AliCheckMuonDetEltResponse::fNbrOfChamber;
82 fNSt = AliCheckMuonDetEltResponse::fNbrOfStation;
83 fNDE = AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt;
84
85 for (Int_t iCluster = 0; iCluster<fNCh; ++iCluster)
86 {
87 fNbrClustersCh[iCluster] = 0;
88 }
89
90 for (Int_t i=0; i<2; ++i)
91 {
92 fGetDetElt[i] = 0;
93 }
94 for (Int_t i=0; i<fNCh; ++i)
95 {
96 fTrackFilter[i] = 0;
97 }
98}
99
665701ae 100//_____________________________________________________________________________
101AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse(const AliCheckMuonDetEltResponse& src)
102: TObject(src),
103 fNCh(0),
104 fNSt(0),
105 fNDE(0),
106 fTransformer(0x0),
107 fESD(0x0),
108 fTracksTotalNbr(0x0),
109 fTrackParams(0x0),
110 fTrackParam(0x0),
111 fCluster(0x0),
112 fDetEltTDHistList(0x0),
113 fDetEltTTHistList(0x0)
114{
115 src.Copy(*this);
116}
117//_____________________________________________________________________________
118AliCheckMuonDetEltResponse& AliCheckMuonDetEltResponse::operator=(const AliCheckMuonDetEltResponse& src)
119{
120 /// assignement operator
121 if ( this != &src )
122 {
123 src.Copy(*this);
124 }
125 return *this;
126}
128a8042 127
128//_____________________________________________________________________________
129AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse(const AliMUONGeometryTransformer* transformer,
130 AliESDEvent* esd,
131 TClonesArray* detEltTDHistList,
132 TClonesArray* detEltTTHistList)
133: TObject(),
665701ae 134 fNCh(0),
135 fNSt(0),
136 fNDE(0),
128a8042 137 fTransformer(transformer),
138 fESD(esd),
139 fTracksTotalNbr(0),
140 fTrackParams(0x0),
141 fTrackParam(0),
142 fCluster(0),
143 fDetEltTDHistList(detEltTDHistList),
144 fDetEltTTHistList(detEltTTHistList)
128a8042 145{
146/// Constructor
147
148 fNCh = AliCheckMuonDetEltResponse::fNbrOfChamber;
149 fNSt = AliCheckMuonDetEltResponse::fNbrOfStation;
150 fNDE = AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt;
151
152 for (Int_t iCluster = 0; iCluster<fNCh; ++iCluster)
153 {
154 fNbrClustersCh[iCluster] = 0;
155 }
156
157 for (Int_t i = 0; i <2 ; ++i)
158 {
159 fGetDetElt[i] = 0;
160 }
161 for (Int_t i=0; i<fNCh; ++i)
162 {
163 fTrackFilter[i] = 0;
164 }
165}
166
167
168//_____________________________________________________________________________
169AliCheckMuonDetEltResponse::~AliCheckMuonDetEltResponse()
170
171{
172/// Destructor
173 delete fTrackParams;
174}
175
176
177
178//_____________________________________________________________________________
179void AliCheckMuonDetEltResponse::CheckDetEltResponse()
180{
181//
182//Cataloging positions (X,Y) of the clusters detected in the detection elements
183//(fDetEltTDHistList), and positions of crossing points between all the
184//tracks and the detection elements (fDetEltTTHistList).
185//Efficiency = 100 * fDetEltTDHistList / fDetEltTTHistList.
186
187//Loop on tracks
188//--------------
189 TrackLoop();
190}
191
192
193
194//_____________________________________________________________________________
195void AliCheckMuonDetEltResponse::TrackLoop()
196{
197 AliESDMuonTrack* esdTrack;
198 AliMUONTrack track;
199 Int_t nTracks, iTrack;
200
201 nTracks = (Int_t)fESD -> GetNumberOfMuonTracks();
202 fTrackParams = new TClonesArray();
203 ///Begininig of the loop:
204 for (iTrack = 0; iTrack < nTracks; iTrack++)
205 {
206 esdTrack = fESD -> GetMuonTrack(iTrack);
207
208 if( esdTrack->ContainTrackerData() )
209 {
210 AliMUONESDInterface::ESDToMUON(*esdTrack, track);
211 fTrackParams = track.GetTrackParamAtCluster();
212 TrackParamLoop(); //!<Loop on trackParam.
213 }
214 }
215}
216
217
218
219//_____________________________________________________________________________
220void AliCheckMuonDetEltResponse::TrackParamLoop()
221{
222 Int_t nTrackParams = (Int_t) fTrackParams->GetEntriesFast(); //!<Number of trackParams in the track.
223 Int_t iTrackParam = 0; //!<Number of the trackParam of the track.
224 Int_t oldChamber = -1, newChamber = 0; //!<To check if there is 0, 1 or 2 (overlap cases) clusters in the same chamber for a track.
225 Int_t detElt; //!<Detection element Id.
226
227 for (Int_t ch = 0; ch < fNCh; ++ch)
228 {
229 fTrackFilter[ch] = 0;
230 }
231
232 Double_t posXL, posYL, posZL; //!<Local positions.
233 Double_t posXG, posYG, posZG; //!<Global. positions.
234 Int_t chamberResponse [10] = {0}; //!<1 if the chamber has responded; 0 if not
235
236 for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
237 {
238 fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
239 fCluster = (AliMUONVCluster* ) fTrackParam ->GetClusterPtr();
240 fTrackFilter [fCluster->GetChamberId()] = 1;
241 chamberResponse[fCluster->GetChamberId()] = 1;
242 }
243
244 for (Int_t station = 0; station < fNSt-1; ++station)
245 {
246 Int_t filter; //<!
247 Int_t ch1, ch2, ch3, ch4; //<!
248 ch1 = 2*station; //<!
249 ch2 = 2*station + 1; //<!
250 ch3 = 2*station + 2; //<!
251 ch4 = 2*station + 3; //<!
252 //<!For the efficiency calculation the tracks
253 if (station < 3 ) //<!reconstructed must have responded to the
254 { //<!criteria of the tracking.
255 filter = fTrackFilter[ch1]; //<!And that's why the tracks usable for the
256 fTrackFilter[ch1] = fTrackFilter[ch2]; //<!intrinsic efficiency calculation are
257 fTrackFilter[ch2] = filter; //<!the tracks which have one or two clusters
258 } //<!in each station. So the case where a track
259 //<!hasn't a cluster in a station is not
260 else //<!taking into account.
261 { //<!This part solves the problem. See the ALICE
262 if (chamberResponse[ch3]*chamberResponse[ch4] != 0) //<!note of Diego STOCCO on the trigger efficiency
263 { //<!
264 filter = fTrackFilter[ch1]; //<!
265 fTrackFilter[ch1] = fTrackFilter[ch2]; //<!
266 fTrackFilter[ch2] = filter; //<!
267 } //<!
268 else //<!
269 { //<!
270 fTrackFilter[ch1] = 0; //<!
271 fTrackFilter[ch2] = 0; //<!
272 } //<!
273 //<!
274 if (chamberResponse[ch1]*chamberResponse[ch2] != 0) //<!
275 { //<!
276 filter = fTrackFilter[ch3]; //<!
277 fTrackFilter[ch3] = fTrackFilter[ch4]; //<!
278 fTrackFilter[ch4] = filter; //<!
279 } //<!
280 else //<!
281 { //<!
282 fTrackFilter[ch3] = 0; //<!
283 fTrackFilter[ch4] = 0; //<!
284 } //<!
285 } //<!
286 } //<!
287
288 for (Int_t ch = 0; ch < fNCh; ++ch)
289 {
290 if (fTrackFilter[ch] == 1)
291 {
292 if ( chamberResponse[ch] != 0) ((TH2F*) fDetEltTDHistList->UncheckedAt(fNDE))->Fill(ch, 0);
665701ae 293 if (!fDetEltTTHistList) ((TH2F*) fDetEltTTHistList->UncheckedAt(fNDE))->Fill(ch, 0);
128a8042 294 }
295 }
296
297 ///Begining of the loop:
298 for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
299 {
300 fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
301 fCluster = (AliMUONVCluster* ) fTrackParam ->GetClusterPtr();
302
303 newChamber = fCluster->GetChamberId();
304 detElt = fCluster->GetDetElemId();
305
306 ///Global and local positions calculation:
307 posXG = fTrackParam->GetNonBendingCoor();
308 posYG = fTrackParam->GetBendingCoor();
309 posZG = fTrackParam->GetZ();
310
311 fTransformer->Global2Local(detElt, posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
312
313 ///Filling histograms of the cluster positions on the detection element of the TRACKS DETECTED (TD):
314 FillDetEltTDHisto(newChamber, detElt, posXL, posYL);
315
316 ///Filling histograms of the cluster positions on the detection element of ALL THE TRACKS (TT):
317 FillDetEltTTHisto(newChamber, detElt, posXG, posYG, posZG, posXL, posYL, posZL);
318
319 if (newChamber != oldChamber)
320 {
321 if (newChamber > oldChamber + 1) //!<Check if it doesn't miss a chamber.
322 {
323 Int_t nbrOfMissCh = newChamber - (oldChamber+1); //!<Number of missing chambers.
324 CalculMissClusterParam(fTrackParam, oldChamber+1, nbrOfMissCh); //!<Calculation of the parameters of the missing cluster(s).
325 }
a6e0ebfe 326 if ( iTrackParam == nTrackParams - 1 && newChamber != fNCh-1) //!<Check if the last chamber, chamber 9 (from 0 to 9) has responded.
128a8042 327 {
328 CalculMissClusterParam(fTrackParam, fNCh-1, 1); //!<Calculation of the parameters of the missing cluster(s) in the last chamber.
329 }
330 }
331 oldChamber = newChamber;
332 }
333}
334
335
336
337//_____________________________________________________________________________
338void AliCheckMuonDetEltResponse::FillDetEltTDHisto(Int_t chamber,
339 Int_t detElt,
340 Double_t posXL,
341 Double_t posYL)
342{
343 if(fTrackFilter[chamber]== 1)
344 {
345 Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
346 iDet = FromDetElt2iDet(chamber, detElt);
347 ((TH2F*) fDetEltTDHistList->UncheckedAt(iDet))->Fill(posXL, posYL);
348 }
349}
350
351
352
353//_____________________________________________________________________________
354void AliCheckMuonDetEltResponse::FillDetEltTTHisto(Int_t chamber,
355 Int_t detElt,
356 Double_t posXG,
357 Double_t posYG,
358 Double_t posZG,
359 Double_t posXL,
360 Double_t posYL,
361 Double_t posZL)
362{
363 if(fTrackFilter[chamber] == 1)
364 {
365 Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
366 iDet = FromDetElt2iDet(chamber, detElt);
665701ae 367 if (!fDetEltTTHistList) ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
128a8042 368
20e837dc 369 if(TMath::Abs(posYL) > fOverlapSize) //!<It is an overlap area. It can have two clusters for this track in this chamber.
128a8042 370 {
371 GetDetEltFromPosition(chamber, posXG, posYG, posZG);
372 if(fGetDetElt[1] != 0) //<!There is a second detection element for the same (X,Y) in this chamber (overlap).
373 {
374 if(fGetDetElt[1] != detElt)
375 {
376 fTransformer->Global2Local(fGetDetElt[1], posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
377 iDet = FromDetElt2iDet(chamber, fGetDetElt[1]);
665701ae 378 if (!fDetEltTTHistList) ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
128a8042 379 }
380 else
381 {
382 fTransformer->Global2Local(fGetDetElt[0], posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
383 iDet = FromDetElt2iDet(chamber, fGetDetElt[0]);
665701ae 384 if (!fDetEltTTHistList) ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
128a8042 385 }
386 }
387 }
388 }
389}
390
391
392
393//_____________________________________________________________________________
394void AliCheckMuonDetEltResponse::CalculMissClusterParam(AliMUONTrackParam* extrapTrackParam,
395 Int_t firstMissCh,
396 Int_t nbrOfMissCh)
397{
398//Calculation of the cluster parameter which was not detect by
399//the chamber.
400
401 for (Int_t iCh = 0; iCh<nbrOfMissCh; ++iCh)
402 {
403 Double_t exTraXL, exTraYL, exTraZL; //!<Extrapolated local positions.
404 Double_t exTraXG, exTraYG, exTraZG; //!<Extrapolated global positions.
405 Int_t missChamber= firstMissCh + iCh; //!<The missing chamber.
406 Int_t missDetElt = 0;
407
408 exTraZG = AliMUONConstants::DefaultChamberZ(missChamber);
409 AliMUONTrackExtrap::ExtrapToZ(extrapTrackParam, exTraZG); //!<Extrapolation to the missing chamber.
410 exTraXG = extrapTrackParam->GetNonBendingCoor(); //!<Global X position extrapolated to the missing chamber.
411 exTraYG = extrapTrackParam->GetBendingCoor(); //!<Global Y position extrapolated to the missing chamber.
412
413 GetDetEltFromPosition(missChamber, exTraXG, exTraYG, exTraZG); //!<Gives the detection element (fGetDetElt) with the position.
414 missDetElt = fGetDetElt[0];
415
416 if( missDetElt != 0 ) //!<Check if the track has passed trough a detection area
417 {
418 fTransformer->Global2Local(missDetElt, exTraXG, exTraYG, exTraZG, exTraXL, exTraYL, exTraZL); //!<Transfomation from global to local positions.
419 FillDetEltTTHisto(missChamber, missDetElt, exTraXG, exTraYG, exTraZG, exTraXL, exTraYL, exTraZL);
420 }
421 }
422}
423
424
425
426//_____________________________________________________________________________
427Int_t AliCheckMuonDetEltResponse::FromDetElt2iDet(Int_t chamber,
428 Int_t detElt)
429{
430///
431///Connexion between the detection element X and its position in the list of histograms iX.
432///
433
434 Int_t iDet = 0; //!<Position of the detection element (detElt) in the histograms' list.
435
436 if (chamber<4) iDet = detElt-fOffset*(chamber+1)+ 4* chamber ;
a6e0ebfe 437 if (chamber>3 && chamber<6) iDet = detElt-fOffset*(chamber+1)+18*(chamber-4)+16;
128a8042 438 if (chamber>5) iDet = detElt-fOffset*(chamber+1)+26*(chamber-6)+52;
439
440 return iDet;
441}
442
443
444
445//_____________________________________________________________________________
446void AliCheckMuonDetEltResponse::GetDetEltFromPosition(Int_t chamber,
447 Double_t posX,
448 Double_t posY,
449 Double_t posZ)
450{
451///
452///Gives the detetection element fGetDetElt[0] corresponding to the position. In the case
453///of an overlap (two detection element with the same (X,Y)) fGetDetElt[1] is calculated.
454///
455
456 Int_t nbrOfDetElt = AliMpDEManager::GetNofDEInChamber(chamber, kTRUE); //!<Number of detection elements in the chamber.
457 Int_t detElt = 0, lastDetElt = 0;
458
459 Double_t posXL, posYL, posZL; //!<Local positions.
460 posXL = posYL = posZL = 1000.;
461 fGetDetElt[0] = fGetDetElt[1] = 0;
462
463 if(chamber>3)
464 {
465 Int_t shift = 0; //!<|
466 if(posX<0) shift = nbrOfDetElt /4 + 1; //!<|Method to avoid the loop on all elements of
467 if(posX>0) shift = (3*nbrOfDetElt)/4 + 1; //!<|detection, and just loop through fourth chamber.
468 //!<|
469 detElt = fOffset*(chamber+1) + shift; //!<|
470 lastDetElt = fOffset*(chamber+1) +(shift+nbrOfDetElt/2)%nbrOfDetElt; //!<|
471
472 Int_t nbr = 0;
473 while(detElt != lastDetElt) //!<Loop on fourth chamber.
474 {
475
476 fTransformer->Global2Local(detElt, posX, posY, posZ, posXL, posYL, posZL); //!<Transfomation from global to local positions.
477
20e837dc 478 if(TMath::Abs(posYL)< fYSlatSize) //!<If |posYL|<20 => the cluster is in the detection element (-20<Ylocal<20 for each slat).
128a8042 479 {
480 fGetDetElt[nbr] = detElt;
481 ++nbr;
482 }
483 shift = (shift + 1)%nbrOfDetElt;
484 detElt = fOffset*(chamber+1) + shift;
485 }
486 }
487
488 else //!<For the station 1 & 2 (4 detection elements in each chamber).
489 {
a6e0ebfe 490 if(posX>0 && posY>0) fGetDetElt[0] = fOffset*(chamber+1) ;
491 if(posX<0 && posY>0) fGetDetElt[0] = fOffset*(chamber+1) + 1;
492 if(posX<0 && posY<0) fGetDetElt[0] = fOffset*(chamber+1) + 2;
493 if(posX>0 && posY<0) fGetDetElt[0] = fOffset*(chamber+1) + 3;
128a8042 494 }
495}