1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
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
21 #include "AliAnalysisTaskMuonTrackingEff.h"
22 #include "AliCheckMuonDetEltResponse.h"
26 #include "AliESDEvent.h"
27 #include "AliTracker.h"
28 #include "AliESDMuonTrack.h"
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"
39 //include MUON/mapping:
40 #include "mapping/AliMpDEManager.h"
43 #include <Riostream.h>
48 #include <TClonesArray.h>
49 #include <TPaveLabel.h>
53 ClassImp(AliCheckMuonDetEltResponse)
56 const Int_t AliCheckMuonDetEltResponse::fNbrOfChamber = 10;
57 const Int_t AliCheckMuonDetEltResponse::fNbrOfStation = 5;
58 const Int_t AliCheckMuonDetEltResponse::fNbrOfDetectionElt[10] = {4, 4, 4, 4, 18, 18, 26, 26, 26, 26};
59 const Int_t AliCheckMuonDetEltResponse::fFirstDetectionElt[10] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
60 const Int_t AliCheckMuonDetEltResponse::fOffset = 100;
61 const Int_t AliCheckMuonDetEltResponse::fOverlapSize = 15;
62 const Int_t AliCheckMuonDetEltResponse::fYSlatSize = 40;
64 //_____________________________________________________________________________
65 AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse()
74 fDetEltTDHistList(0x0),
75 fDetEltTTHistList(0x0)
77 /// Default constructor
79 fNCh = AliCheckMuonDetEltResponse::fNbrOfChamber;
80 fNSt = AliCheckMuonDetEltResponse::fNbrOfStation;
81 fNDE = AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt;
83 for (Int_t iCluster = 0; iCluster<fNCh; ++iCluster)
85 fNbrClustersCh[iCluster] = 0;
88 for (Int_t i=0; i<2; ++i)
92 for (Int_t i=0; i<fNCh; ++i)
100 //_____________________________________________________________________________
101 AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse(const AliMUONGeometryTransformer* transformer,
103 TClonesArray* detEltTDHistList,
104 TClonesArray* detEltTTHistList)
106 fTransformer(transformer),
112 fDetEltTDHistList(detEltTDHistList),
113 fDetEltTTHistList(detEltTTHistList)
118 fNCh = AliCheckMuonDetEltResponse::fNbrOfChamber;
119 fNSt = AliCheckMuonDetEltResponse::fNbrOfStation;
120 fNDE = AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt;
122 for (Int_t iCluster = 0; iCluster<fNCh; ++iCluster)
124 fNbrClustersCh[iCluster] = 0;
127 for (Int_t i = 0; i <2 ; ++i)
131 for (Int_t i=0; i<fNCh; ++i)
138 //_____________________________________________________________________________
139 AliCheckMuonDetEltResponse::~AliCheckMuonDetEltResponse()
148 //_____________________________________________________________________________
149 void AliCheckMuonDetEltResponse::CheckDetEltResponse()
152 //Cataloging positions (X,Y) of the clusters detected in the detection elements
153 //(fDetEltTDHistList), and positions of crossing points between all the
154 //tracks and the detection elements (fDetEltTTHistList).
155 //Efficiency = 100 * fDetEltTDHistList / fDetEltTTHistList.
164 //_____________________________________________________________________________
165 void AliCheckMuonDetEltResponse::TrackLoop()
167 AliESDMuonTrack* esdTrack;
169 Int_t nTracks, iTrack;
171 nTracks = (Int_t)fESD -> GetNumberOfMuonTracks();
172 fTrackParams = new TClonesArray();
173 ///Begininig of the loop:
174 for (iTrack = 0; iTrack < nTracks; iTrack++)
176 esdTrack = fESD -> GetMuonTrack(iTrack);
178 if( esdTrack->ContainTrackerData() )
180 AliMUONESDInterface::ESDToMUON(*esdTrack, track);
181 fTrackParams = track.GetTrackParamAtCluster();
182 TrackParamLoop(); //!<Loop on trackParam.
189 //_____________________________________________________________________________
190 void AliCheckMuonDetEltResponse::TrackParamLoop()
192 Int_t nTrackParams = (Int_t) fTrackParams->GetEntriesFast(); //!<Number of trackParams in the track.
193 Int_t iTrackParam = 0; //!<Number of the trackParam of the track.
194 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.
195 Int_t detElt; //!<Detection element Id.
197 for (Int_t ch = 0; ch < fNCh; ++ch)
199 fTrackFilter[ch] = 0;
202 Double_t posXL, posYL, posZL; //!<Local positions.
203 Double_t posXG, posYG, posZG; //!<Global. positions.
204 Int_t chamberResponse [10] = {0}; //!<1 if the chamber has responded; 0 if not
206 for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
208 fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
209 fCluster = (AliMUONVCluster* ) fTrackParam ->GetClusterPtr();
210 fTrackFilter [fCluster->GetChamberId()] = 1;
211 chamberResponse[fCluster->GetChamberId()] = 1;
214 for (Int_t station = 0; station < fNSt-1; ++station)
217 Int_t ch1, ch2, ch3, ch4; //<!
218 ch1 = 2*station; //<!
219 ch2 = 2*station + 1; //<!
220 ch3 = 2*station + 2; //<!
221 ch4 = 2*station + 3; //<!
222 //<!For the efficiency calculation the tracks
223 if (station < 3 ) //<!reconstructed must have responded to the
224 { //<!criteria of the tracking.
225 filter = fTrackFilter[ch1]; //<!And that's why the tracks usable for the
226 fTrackFilter[ch1] = fTrackFilter[ch2]; //<!intrinsic efficiency calculation are
227 fTrackFilter[ch2] = filter; //<!the tracks which have one or two clusters
228 } //<!in each station. So the case where a track
229 //<!hasn't a cluster in a station is not
230 else //<!taking into account.
231 { //<!This part solves the problem. See the ALICE
232 if (chamberResponse[ch3]*chamberResponse[ch4] != 0) //<!note of Diego STOCCO on the trigger efficiency
234 filter = fTrackFilter[ch1]; //<!
235 fTrackFilter[ch1] = fTrackFilter[ch2]; //<!
236 fTrackFilter[ch2] = filter; //<!
240 fTrackFilter[ch1] = 0; //<!
241 fTrackFilter[ch2] = 0; //<!
244 if (chamberResponse[ch1]*chamberResponse[ch2] != 0) //<!
246 filter = fTrackFilter[ch3]; //<!
247 fTrackFilter[ch3] = fTrackFilter[ch4]; //<!
248 fTrackFilter[ch4] = filter; //<!
252 fTrackFilter[ch3] = 0; //<!
253 fTrackFilter[ch4] = 0; //<!
258 for (Int_t ch = 0; ch < fNCh; ++ch)
260 if (fTrackFilter[ch] == 1)
262 if ( chamberResponse[ch] != 0) ((TH2F*) fDetEltTDHistList->UncheckedAt(fNDE))->Fill(ch, 0);
263 ((TH2F*) fDetEltTTHistList->UncheckedAt(fNDE))->Fill(ch, 0);
267 ///Begining of the loop:
268 for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
270 fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
271 fCluster = (AliMUONVCluster* ) fTrackParam ->GetClusterPtr();
273 newChamber = fCluster->GetChamberId();
274 detElt = fCluster->GetDetElemId();
276 ///Global and local positions calculation:
277 posXG = fTrackParam->GetNonBendingCoor();
278 posYG = fTrackParam->GetBendingCoor();
279 posZG = fTrackParam->GetZ();
281 fTransformer->Global2Local(detElt, posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
283 ///Filling histograms of the cluster positions on the detection element of the TRACKS DETECTED (TD):
284 FillDetEltTDHisto(newChamber, detElt, posXL, posYL);
286 ///Filling histograms of the cluster positions on the detection element of ALL THE TRACKS (TT):
287 FillDetEltTTHisto(newChamber, detElt, posXG, posYG, posZG, posXL, posYL, posZL);
289 if (newChamber != oldChamber)
291 if (newChamber > oldChamber + 1) //!<Check if it doesn't miss a chamber.
293 Int_t nbrOfMissCh = newChamber - (oldChamber+1); //!<Number of missing chambers.
294 CalculMissClusterParam(fTrackParam, oldChamber+1, nbrOfMissCh); //!<Calculation of the parameters of the missing cluster(s).
296 if ( iTrackParam == nTrackParams - 1 & newChamber != fNCh-1) //!<Check if the last chamber, chamber 9 (from 0 to 9) has responded.
298 CalculMissClusterParam(fTrackParam, fNCh-1, 1); //!<Calculation of the parameters of the missing cluster(s) in the last chamber.
301 oldChamber = newChamber;
307 //_____________________________________________________________________________
308 void AliCheckMuonDetEltResponse::FillDetEltTDHisto(Int_t chamber,
313 if(fTrackFilter[chamber]== 1)
315 Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
316 iDet = FromDetElt2iDet(chamber, detElt);
317 ((TH2F*) fDetEltTDHistList->UncheckedAt(iDet))->Fill(posXL, posYL);
323 //_____________________________________________________________________________
324 void AliCheckMuonDetEltResponse::FillDetEltTTHisto(Int_t chamber,
333 if(fTrackFilter[chamber] == 1)
335 Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
336 iDet = FromDetElt2iDet(chamber, detElt);
337 ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
339 if(TMath::Abs(posYL) > fOverlapSize) //!<It is an overlap area. It can have two clusters for this track in this chamber.
341 GetDetEltFromPosition(chamber, posXG, posYG, posZG);
342 if(fGetDetElt[1] != 0) //<!There is a second detection element for the same (X,Y) in this chamber (overlap).
344 if(fGetDetElt[1] != detElt)
346 fTransformer->Global2Local(fGetDetElt[1], posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
347 iDet = FromDetElt2iDet(chamber, fGetDetElt[1]);
348 ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
352 fTransformer->Global2Local(fGetDetElt[0], posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
353 iDet = FromDetElt2iDet(chamber, fGetDetElt[0]);
354 ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
363 //_____________________________________________________________________________
364 void AliCheckMuonDetEltResponse::CalculMissClusterParam(AliMUONTrackParam* extrapTrackParam,
368 //Calculation of the cluster parameter which was not detect by
371 for (Int_t iCh = 0; iCh<nbrOfMissCh; ++iCh)
373 Double_t exTraXL, exTraYL, exTraZL; //!<Extrapolated local positions.
374 Double_t exTraXG, exTraYG, exTraZG; //!<Extrapolated global positions.
375 Int_t missChamber= firstMissCh + iCh; //!<The missing chamber.
376 Int_t missDetElt = 0;
378 exTraZG = AliMUONConstants::DefaultChamberZ(missChamber);
379 AliMUONTrackExtrap::ExtrapToZ(extrapTrackParam, exTraZG); //!<Extrapolation to the missing chamber.
380 exTraXG = extrapTrackParam->GetNonBendingCoor(); //!<Global X position extrapolated to the missing chamber.
381 exTraYG = extrapTrackParam->GetBendingCoor(); //!<Global Y position extrapolated to the missing chamber.
383 GetDetEltFromPosition(missChamber, exTraXG, exTraYG, exTraZG); //!<Gives the detection element (fGetDetElt) with the position.
384 missDetElt = fGetDetElt[0];
386 if( missDetElt != 0 ) //!<Check if the track has passed trough a detection area
388 fTransformer->Global2Local(missDetElt, exTraXG, exTraYG, exTraZG, exTraXL, exTraYL, exTraZL); //!<Transfomation from global to local positions.
389 FillDetEltTTHisto(missChamber, missDetElt, exTraXG, exTraYG, exTraZG, exTraXL, exTraYL, exTraZL);
396 //_____________________________________________________________________________
397 Int_t AliCheckMuonDetEltResponse::FromDetElt2iDet(Int_t chamber,
401 ///Connexion between the detection element X and its position in the list of histograms iX.
404 Int_t iDet = 0; //!<Position of the detection element (detElt) in the histograms' list.
406 if (chamber<4) iDet = detElt-fOffset*(chamber+1)+ 4* chamber ;
407 if (chamber>3 & chamber<6) iDet = detElt-fOffset*(chamber+1)+18*(chamber-4)+16;
408 if (chamber>5) iDet = detElt-fOffset*(chamber+1)+26*(chamber-6)+52;
415 //_____________________________________________________________________________
416 void AliCheckMuonDetEltResponse::GetDetEltFromPosition(Int_t chamber,
422 ///Gives the detetection element fGetDetElt[0] corresponding to the position. In the case
423 ///of an overlap (two detection element with the same (X,Y)) fGetDetElt[1] is calculated.
426 Int_t nbrOfDetElt = AliMpDEManager::GetNofDEInChamber(chamber, kTRUE); //!<Number of detection elements in the chamber.
427 Int_t detElt = 0, lastDetElt = 0;
429 Double_t posXL, posYL, posZL; //!<Local positions.
430 posXL = posYL = posZL = 1000.;
431 fGetDetElt[0] = fGetDetElt[1] = 0;
435 Int_t shift = 0; //!<|
436 if(posX<0) shift = nbrOfDetElt /4 + 1; //!<|Method to avoid the loop on all elements of
437 if(posX>0) shift = (3*nbrOfDetElt)/4 + 1; //!<|detection, and just loop through fourth chamber.
439 detElt = fOffset*(chamber+1) + shift; //!<|
440 lastDetElt = fOffset*(chamber+1) +(shift+nbrOfDetElt/2)%nbrOfDetElt; //!<|
443 while(detElt != lastDetElt) //!<Loop on fourth chamber.
446 fTransformer->Global2Local(detElt, posX, posY, posZ, posXL, posYL, posZL); //!<Transfomation from global to local positions.
448 if(TMath::Abs(posYL)< fYSlatSize) //!<If |posYL|<20 => the cluster is in the detection element (-20<Ylocal<20 for each slat).
450 fGetDetElt[nbr] = detElt;
453 shift = (shift + 1)%nbrOfDetElt;
454 detElt = fOffset*(chamber+1) + shift;
458 else //!<For the station 1 & 2 (4 detection elements in each chamber).
460 if(posX>0 & posY>0) fGetDetElt[0] = fOffset*(chamber+1) ;
461 if(posX<0 & posY>0) fGetDetElt[0] = fOffset*(chamber+1) + 1;
462 if(posX<0 & posY<0) fGetDetElt[0] = fOffset*(chamber+1) + 2;
463 if(posX>0 & posY<0) fGetDetElt[0] = fOffset*(chamber+1) + 3;