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()
76 fDetEltTDHistList(0x0),
77 fDetEltTTHistList(0x0)
79 /// Default constructor
81 fNCh = AliCheckMuonDetEltResponse::fNbrOfChamber;
82 fNSt = AliCheckMuonDetEltResponse::fNbrOfStation;
83 fNDE = AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt;
85 for (Int_t iCluster = 0; iCluster<fNCh; ++iCluster)
87 fNbrClustersCh[iCluster] = 0;
90 for (Int_t i=0; i<2; ++i)
94 for (Int_t i=0; i<fNCh; ++i)
100 //_____________________________________________________________________________
101 AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse(const AliCheckMuonDetEltResponse& src)
108 fTracksTotalNbr(0x0),
112 fDetEltTDHistList(0x0),
113 fDetEltTTHistList(0x0)
117 //_____________________________________________________________________________
118 AliCheckMuonDetEltResponse& AliCheckMuonDetEltResponse::operator=(const AliCheckMuonDetEltResponse& src)
120 /// assignement operator
128 //_____________________________________________________________________________
129 AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse(const AliMUONGeometryTransformer* transformer,
131 TClonesArray* detEltTDHistList,
132 TClonesArray* detEltTTHistList)
137 fTransformer(transformer),
143 fDetEltTDHistList(detEltTDHistList),
144 fDetEltTTHistList(detEltTTHistList)
148 fNCh = AliCheckMuonDetEltResponse::fNbrOfChamber;
149 fNSt = AliCheckMuonDetEltResponse::fNbrOfStation;
150 fNDE = AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt;
152 for (Int_t iCluster = 0; iCluster<fNCh; ++iCluster)
154 fNbrClustersCh[iCluster] = 0;
157 for (Int_t i = 0; i <2 ; ++i)
161 for (Int_t i=0; i<fNCh; ++i)
168 //_____________________________________________________________________________
169 AliCheckMuonDetEltResponse::~AliCheckMuonDetEltResponse()
178 //_____________________________________________________________________________
179 void AliCheckMuonDetEltResponse::CheckDetEltResponse()
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.
194 //_____________________________________________________________________________
195 void AliCheckMuonDetEltResponse::TrackLoop()
197 AliESDMuonTrack* esdTrack;
199 Int_t nTracks, iTrack;
201 nTracks = (Int_t)fESD -> GetNumberOfMuonTracks();
202 fTrackParams = new TClonesArray();
203 ///Begininig of the loop:
204 for (iTrack = 0; iTrack < nTracks; iTrack++)
206 esdTrack = fESD -> GetMuonTrack(iTrack);
208 if( esdTrack->ContainTrackerData() )
210 AliMUONESDInterface::ESDToMUON(*esdTrack, track);
211 fTrackParams = track.GetTrackParamAtCluster();
212 TrackParamLoop(); //!<Loop on trackParam.
219 //_____________________________________________________________________________
220 void AliCheckMuonDetEltResponse::TrackParamLoop()
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.
227 for (Int_t ch = 0; ch < fNCh; ++ch)
229 fTrackFilter[ch] = 0;
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
236 for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
238 fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
239 fCluster = (AliMUONVCluster* ) fTrackParam ->GetClusterPtr();
240 fTrackFilter [fCluster->GetChamberId()] = 1;
241 chamberResponse[fCluster->GetChamberId()] = 1;
244 for (Int_t station = 0; station < fNSt-1; ++station)
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
264 filter = fTrackFilter[ch1]; //<!
265 fTrackFilter[ch1] = fTrackFilter[ch2]; //<!
266 fTrackFilter[ch2] = filter; //<!
270 fTrackFilter[ch1] = 0; //<!
271 fTrackFilter[ch2] = 0; //<!
274 if (chamberResponse[ch1]*chamberResponse[ch2] != 0) //<!
276 filter = fTrackFilter[ch3]; //<!
277 fTrackFilter[ch3] = fTrackFilter[ch4]; //<!
278 fTrackFilter[ch4] = filter; //<!
282 fTrackFilter[ch3] = 0; //<!
283 fTrackFilter[ch4] = 0; //<!
288 for (Int_t ch = 0; ch < fNCh; ++ch)
290 if (fTrackFilter[ch] == 1)
292 if ( chamberResponse[ch] != 0) ((TH2F*) fDetEltTDHistList->UncheckedAt(fNDE))->Fill(ch, 0);
293 if (!fDetEltTTHistList) ((TH2F*) fDetEltTTHistList->UncheckedAt(fNDE))->Fill(ch, 0);
297 ///Begining of the loop:
298 for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
300 fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
301 fCluster = (AliMUONVCluster* ) fTrackParam ->GetClusterPtr();
303 newChamber = fCluster->GetChamberId();
304 detElt = fCluster->GetDetElemId();
306 ///Global and local positions calculation:
307 posXG = fTrackParam->GetNonBendingCoor();
308 posYG = fTrackParam->GetBendingCoor();
309 posZG = fTrackParam->GetZ();
311 fTransformer->Global2Local(detElt, posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
313 ///Filling histograms of the cluster positions on the detection element of the TRACKS DETECTED (TD):
314 FillDetEltTDHisto(newChamber, detElt, posXL, posYL);
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);
319 if (newChamber != oldChamber)
321 if (newChamber > oldChamber + 1) //!<Check if it doesn't miss a chamber.
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).
326 if ( iTrackParam == nTrackParams - 1 && newChamber != fNCh-1) //!<Check if the last chamber, chamber 9 (from 0 to 9) has responded.
328 CalculMissClusterParam(fTrackParam, fNCh-1, 1); //!<Calculation of the parameters of the missing cluster(s) in the last chamber.
331 oldChamber = newChamber;
337 //_____________________________________________________________________________
338 void AliCheckMuonDetEltResponse::FillDetEltTDHisto(Int_t chamber,
343 if(fTrackFilter[chamber]== 1)
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);
353 //_____________________________________________________________________________
354 void AliCheckMuonDetEltResponse::FillDetEltTTHisto(Int_t chamber,
363 if(fTrackFilter[chamber] == 1)
365 Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
366 iDet = FromDetElt2iDet(chamber, detElt);
367 if (!fDetEltTTHistList) ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
369 if(TMath::Abs(posYL) > fOverlapSize) //!<It is an overlap area. It can have two clusters for this track in this chamber.
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).
374 if(fGetDetElt[1] != detElt)
376 fTransformer->Global2Local(fGetDetElt[1], posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
377 iDet = FromDetElt2iDet(chamber, fGetDetElt[1]);
378 if (!fDetEltTTHistList) ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
382 fTransformer->Global2Local(fGetDetElt[0], posXG, posYG, posZG, posXL, posYL, posZL); //!<Transfomation from global to local positions.
383 iDet = FromDetElt2iDet(chamber, fGetDetElt[0]);
384 if (!fDetEltTTHistList) ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
393 //_____________________________________________________________________________
394 void AliCheckMuonDetEltResponse::CalculMissClusterParam(AliMUONTrackParam* extrapTrackParam,
398 //Calculation of the cluster parameter which was not detect by
401 for (Int_t iCh = 0; iCh<nbrOfMissCh; ++iCh)
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;
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.
413 GetDetEltFromPosition(missChamber, exTraXG, exTraYG, exTraZG); //!<Gives the detection element (fGetDetElt) with the position.
414 missDetElt = fGetDetElt[0];
416 if( missDetElt != 0 ) //!<Check if the track has passed trough a detection area
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);
426 //_____________________________________________________________________________
427 Int_t AliCheckMuonDetEltResponse::FromDetElt2iDet(Int_t chamber,
431 ///Connexion between the detection element X and its position in the list of histograms iX.
434 Int_t iDet = 0; //!<Position of the detection element (detElt) in the histograms' list.
436 if (chamber<4) iDet = detElt-fOffset*(chamber+1)+ 4* chamber ;
437 if (chamber>3 && chamber<6) iDet = detElt-fOffset*(chamber+1)+18*(chamber-4)+16;
438 if (chamber>5) iDet = detElt-fOffset*(chamber+1)+26*(chamber-6)+52;
445 //_____________________________________________________________________________
446 void AliCheckMuonDetEltResponse::GetDetEltFromPosition(Int_t chamber,
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.
456 Int_t nbrOfDetElt = AliMpDEManager::GetNofDEInChamber(chamber, kTRUE); //!<Number of detection elements in the chamber.
457 Int_t detElt = 0, lastDetElt = 0;
459 Double_t posXL, posYL, posZL; //!<Local positions.
460 posXL = posYL = posZL = 1000.;
461 fGetDetElt[0] = fGetDetElt[1] = 0;
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.
469 detElt = fOffset*(chamber+1) + shift; //!<|
470 lastDetElt = fOffset*(chamber+1) +(shift+nbrOfDetElt/2)%nbrOfDetElt; //!<|
473 while(detElt != lastDetElt) //!<Loop on fourth chamber.
476 fTransformer->Global2Local(detElt, posX, posY, posZ, posXL, posYL, posZL); //!<Transfomation from global to local positions.
478 if(TMath::Abs(posYL)< fYSlatSize) //!<If |posYL|<20 => the cluster is in the detection element (-20<Ylocal<20 for each slat).
480 fGetDetElt[nbr] = detElt;
483 shift = (shift + 1)%nbrOfDetElt;
484 detElt = fOffset*(chamber+1) + shift;
488 else //!<For the station 1 & 2 (4 detection elements in each chamber).
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;