]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWG3/muondep/AliCheckMuonDetEltResponse.cxx
Fixing an error in the computation of the efficiency of a whole chamber (Matthieu)
[u/mrichter/AliRoot.git] / PWG3 / muondep / AliCheckMuonDetEltResponse.cxx
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 #include "mapping/AliMpSegmentation.h"
42 #include "mapping/AliMpSlat.h"
43 #include "mapping/AliMpSlatSegmentation.h"
44 #include "mapping/AliMpSector.h"
45 #include "mapping/AliMpSectorSegmentation.h"
46 #include "mapping/AliMpPad.h"
47
48 //include ROOT:
49 #include <Riostream.h>
50 #include <TMath.h>
51 #include <TROOT.h>
52 #include <TSystem.h>
53 #include <TH2F.h>
54 #include <TH1F.h>
55 #include <TClonesArray.h>
56 #include <TPaveLabel.h>
57 #include <TList.h>
58
59 /// \cond CLASSIMP
60 ClassImp(AliCheckMuonDetEltResponse)
61 /// \endcond
62
63 const Int_t AliCheckMuonDetEltResponse::fNbrOfChamber          = 10;
64 const Int_t AliCheckMuonDetEltResponse::fNbrOfStation          = 5;
65 const Int_t AliCheckMuonDetEltResponse::fNbrOfDetectionElt[10] = {4, 4, 4, 4, 18, 18, 26, 26, 26, 26};
66 const Int_t AliCheckMuonDetEltResponse::fFirstDetectionElt[10] = {100, 200, 300, 400, 500, 600, 700, 800, 900, 1000};
67 const Int_t AliCheckMuonDetEltResponse::fOffset                = 100;
68 const Int_t AliCheckMuonDetEltResponse::fOverlapSize           = 15;
69 const Int_t AliCheckMuonDetEltResponse::fYSlatSize             = 20;
70
71 //_____________________________________________________________________________
72 AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse() 
73 : TObject(),
74   fNCh(0),
75   fNSt(0),
76   fNDE(0),
77   fTransformer(0x0),
78   fESD(0x0),
79   fTracksTotalNbr(0x0),
80   fIsCosmicData(kFALSE),
81   fTrackParams(0x0),
82   fTrackParam(0x0),
83   fCluster(0x0),
84   fDetEltTDHistList(0x0),
85   fDetEltTTHistList(0x0),
86   fChamberTDHistList(0x0),
87   fChamberTTHistList(0x0)
88 {
89 /// Default constructor
90
91     fNCh = AliCheckMuonDetEltResponse::fNbrOfChamber;
92     fNSt = AliCheckMuonDetEltResponse::fNbrOfStation;
93     fNDE = AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt;
94
95     for (Int_t iCluster = 0; iCluster<fNCh; ++iCluster)
96       fNbrClustersCh[iCluster] = 0;
97
98     for (Int_t i=0; i<fNCh; ++i)
99       fTrackFilter[i] = 0;
100 }
101
102 //_____________________________________________________________________________
103 AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse(const AliCheckMuonDetEltResponse& src) 
104 : TObject(src),
105   fNCh(0),
106   fNSt(0),
107   fNDE(0),
108   fTransformer(0x0),
109   fESD(0x0),
110   fTracksTotalNbr(0x0),
111   fIsCosmicData(kFALSE),
112   fTrackParams(0x0),
113   fTrackParam(0x0),
114   fCluster(0x0),
115   fDetEltTDHistList(0x0),
116   fDetEltTTHistList(0x0),
117   fChamberTDHistList(0x0),
118   fChamberTTHistList(0x0)
119 {
120  src.Copy(*this);
121 }
122 //_____________________________________________________________________________
123 AliCheckMuonDetEltResponse& AliCheckMuonDetEltResponse::operator=(const AliCheckMuonDetEltResponse& src) 
124 {
125   /// assignement operator
126   if ( this != &src ) 
127   {
128     src.Copy(*this);
129   }
130   return *this;
131 }
132
133 //_____________________________________________________________________________
134 AliCheckMuonDetEltResponse::AliCheckMuonDetEltResponse(const AliMUONGeometryTransformer* transformer,
135                                                        AliESDEvent* esd,
136                                                        TClonesArray* detEltTDHistList,
137                                                        TClonesArray* detEltTTHistList,
138                                                        TClonesArray* chamberTDHistList,
139                                                        TClonesArray* chamberTTHistList,
140                                                        Bool_t isCosmic) 
141 : TObject(),
142   fNCh(0),
143   fNSt(0),
144   fNDE(0),
145   fTransformer(transformer),
146   fESD(esd),
147   fTracksTotalNbr(0),
148   fIsCosmicData(kFALSE),
149   fTrackParams(0x0),
150   fTrackParam(0),
151   fCluster(0),
152   fDetEltTDHistList(detEltTDHistList),
153   fDetEltTTHistList(detEltTTHistList),
154   fChamberTDHistList(chamberTDHistList),
155   fChamberTTHistList(chamberTTHistList)
156 {
157 /// Constructor
158
159     fNCh = AliCheckMuonDetEltResponse::fNbrOfChamber;
160     fNSt = AliCheckMuonDetEltResponse::fNbrOfStation;
161     fNDE = AliAnalysisTaskMuonTrackingEff::fTotNbrOfDetectionElt;
162     fIsCosmicData = isCosmic;
163
164     for (Int_t iCluster = 0; iCluster<fNCh; ++iCluster)
165       fNbrClustersCh[iCluster] = 0;
166     
167     for (Int_t i=0; i<fNCh; ++i)
168       fTrackFilter[i] = 0;
169     
170 }
171
172
173 //_____________________________________________________________________________
174 AliCheckMuonDetEltResponse::~AliCheckMuonDetEltResponse()
175
176 {
177 /// Destructor
178     delete fTrackParams;
179 }
180
181
182
183 //_____________________________________________________________________________
184 void AliCheckMuonDetEltResponse::CheckDetEltResponse()
185 {
186 //
187 //Cataloging positions (X,Y) of the clusters detected in the detection elements
188 //(fDetEltTDHistList), and positions of crossing points between all the
189 //tracks and the detection elements (fDetEltTTHistList).
190 //Efficiency = 100 * fDetEltTDHistList / fDetEltTTHistList.
191
192 //Loop on tracks
193 //--------------
194     TrackLoop();
195 }
196
197
198
199 //_____________________________________________________________________________
200 void AliCheckMuonDetEltResponse::TrackLoop()
201 {
202     AliESDMuonTrack* esdTrack;
203     AliMUONTrack track;
204     Int_t nTracks, iTrack;
205
206     nTracks = (Int_t)fESD -> GetNumberOfMuonTracks();
207     fTrackParams = new TClonesArray();
208  ///Begininig of the loop:
209     for (iTrack = 0; iTrack < nTracks; iTrack++)
210     {
211       esdTrack   = fESD -> GetMuonTrack(iTrack);
212   
213       if( esdTrack->ContainTrackerData() && esdTrack->GetMatchTrigger() > 0)
214         {
215           if (fIsCosmicData)
216             {
217               // Beginnig of long stuff to check the number of trigger hit (to only keep muon trigger and cut cosmic showers)
218               Int_t nTriggerHit = 0;
219               Int_t nTriggerHitStrip[8] = {0, 0, 0, 0, 
220                                            0, 0, 0, 0};
221               UShort_t triggerPattern[8] = {esdTrack->GetTriggerX1Pattern(), esdTrack->GetTriggerX2Pattern(), esdTrack->GetTriggerX3Pattern(), esdTrack->GetTriggerX4Pattern(), 
222                                             esdTrack->GetTriggerY1Pattern(), esdTrack->GetTriggerY2Pattern(), esdTrack->GetTriggerY3Pattern(), esdTrack->GetTriggerY4Pattern()};
223               
224               for (Int_t ii = 0; ii < 8; ii++)
225                 {
226                   UShort_t pattern = triggerPattern[ii];
227                   Int_t binaryValue[16] = {0, 0, 0, 0,
228                                            0, 0, 0, 0,
229                                            0, 0, 0, 0,
230                                            0, 0, 0, 0};
231                   
232                   for (Int_t jj = 15; jj >= 0; jj--)
233                     {
234                       Int_t base = 1;
235                       for (Int_t bb = 0; bb < jj; bb++)
236                         base *= 2;
237                       
238                       if (pattern/base == 1)
239                         {
240                           binaryValue[jj] = 1;
241                           pattern = pattern - base;
242                         }
243                     }
244                 }
245               
246               for (Int_t ii = 0; ii < 8; ii++)
247                 nTriggerHit += nTriggerHitStrip[ii];
248               // End of long stuff
249               
250               
251               // Important part   
252               if (nTriggerHit < 10)
253                 {
254                   AliMUONESDInterface::ESDToMUON(*esdTrack, track);
255                   fTrackParams = track.GetTrackParamAtCluster();
256                   TrackParamLoop(); //!<Loop on trackParam.
257                 }
258             }
259
260           // No trigger cut is required for non-cosmic data
261           else
262             {
263               AliMUONESDInterface::ESDToMUON(*esdTrack, track);
264               fTrackParams = track.GetTrackParamAtCluster();
265               TrackParamLoop(); //!<Loop on trackParam.
266             }
267         }
268     }
269 }
270
271
272
273 //_____________________________________________________________________________
274 void AliCheckMuonDetEltResponse::TrackParamLoop()
275 {
276   Int_t nTrackParams = (Int_t) fTrackParams->GetEntriesFast();  //!<Number of trackParams in the track.
277   Int_t iTrackParam = 0;                                        //!<Number of the trackParam of the track.
278   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.                                      
279   Int_t detElt;                          //!<Detection element Id.
280   
281   for (Int_t ch = 0; ch < fNCh; ++ch)
282     fTrackFilter[ch] = 0;
283
284
285   Double_t posXL, posYL, posZL;          //!<Local positions.
286   Double_t posXG, posYG, posZG;          //!<Global. positions.
287   Int_t chamberResponse [10] = {0};      //!<1 if the chamber has responded; 0 if not
288   
289   for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
290     { 
291       fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
292       fCluster    = (AliMUONVCluster*  ) fTrackParam ->GetClusterPtr();    
293       fTrackFilter   [fCluster->GetChamberId()] = 1;
294       chamberResponse[fCluster->GetChamberId()] = 1;
295     }
296
297   for (Int_t station = 0; station < fNSt-1; ++station)
298     {
299       Int_t filter;                                                       //<!
300       Int_t ch1, ch2, ch3, ch4;                                           //<!
301       ch1 = 2*station;                                                    //<!
302       ch2 = 2*station + 1;                                                //<!
303       ch3 = 2*station + 2;                                                //<!
304       ch4 = 2*station + 3;                                                //<!
305                                                                           //<!For the efficiency calculation the tracks
306       if (station < 3 )                                                   //<!reconstructed must have responded to the
307         {                                                                 //<!criteria of the tracking. 
308           filter            = fTrackFilter[ch1];                          //<!And that's why the tracks usable for the 
309           fTrackFilter[ch1] = fTrackFilter[ch2];                          //<!intrinsic efficiency calculation are
310           fTrackFilter[ch2] = filter;                                     //<!the tracks which have one or two clusters
311         }                                                                 //<!in each station. So the case where a track
312                                                                           //<!hasn't a cluster in a station is not
313       else                                                                //<!taking into account.
314         {                                                                 //<!This part solves the problem. See the ALICE 
315           if (chamberResponse[ch3]*chamberResponse[ch4] != 0)             //<!note of Diego STOCCO on the trigger efficiency
316             {                                                             //<!
317               filter            = fTrackFilter[ch1];                      //<!
318               fTrackFilter[ch1] = fTrackFilter[ch2];                      //<!
319               fTrackFilter[ch2] = filter;                                 //<!
320             }                                                             //<!
321           else                                                            //<!
322             {                                                             //<!
323               fTrackFilter[ch1] = 0;                                      //<!
324               fTrackFilter[ch2] = 0;                                      //<!
325             }                                                             //<!
326           
327           if (chamberResponse[ch1]*chamberResponse[ch2] != 0)
328             {
329               filter            = fTrackFilter[ch3];
330               fTrackFilter[ch3] = fTrackFilter[ch4];
331               fTrackFilter[ch4] = filter;
332             }
333           else
334             {
335               fTrackFilter[ch3] = 0;
336               fTrackFilter[ch4] = 0;
337             }
338         }
339     }
340   
341
342   ///Begining of the loop:
343   for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
344     {
345       fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
346       fCluster    = (AliMUONVCluster*  ) fTrackParam ->GetClusterPtr(); 
347       
348       newChamber  = fCluster->GetChamberId();
349       detElt      = fCluster->GetDetElemId();
350
351       ///Global and local positions calculation:
352       posXG = fTrackParam->GetNonBendingCoor(); 
353       posYG = fTrackParam->GetBendingCoor(); 
354       posZG = fTrackParam->GetZ(); 
355       
356       fTransformer->Global2Local(detElt, posXG, posYG, posZG, posXL, posYL, posZL);  //!<Transfomation from global to local positions.
357       
358       ///Filling histograms of the cluster positions on the detection element of the TRACKS DETECTED (TD):
359       FillTDHistos(newChamber, detElt, posXL, posYL);
360     
361       ///Filling histograms of the cluster positions on the detection element of ALL THE TRACKS (TT):
362       FillTTHistos(newChamber, detElt, posXL, posYL);
363
364       if (newChamber != oldChamber) 
365         {
366           if (newChamber > oldChamber + 1)                                 //!<Check if it doesn't miss a chamber.
367             {
368               Int_t nbrMissChamber = newChamber - (oldChamber + 1);
369               FindAndFillMissedDetElt(fTrackParam, oldChamber+1, nbrMissChamber); //!<Calculation of the parameters of the missing cluster(s).
370             }
371             
372           if ( iTrackParam == nTrackParams - 1 && newChamber != fNCh-1)           //!<Check if the last chamber, chamber 9 (from 0 to 9) has responded.
373             FindAndFillMissedDetElt(fTrackParam, fNCh-1, 1);                      //!<Calculation of the parameters of the missing cluster(s) in the last chamber.
374             
375         }
376       oldChamber = newChamber; 
377     } 
378 }
379
380
381
382 //_____________________________________________________________________________
383 void AliCheckMuonDetEltResponse::FillTDHistos(Int_t chamber,
384                                               Int_t detElt,
385                                               Double_t posXL,
386                                               Double_t posYL)
387 {
388   if(fTrackFilter[chamber]== 1)
389     {
390       Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
391       iDet = FromDetElt2iDet(chamber, detElt);
392       ((TH2F*) fDetEltTDHistList->UncheckedAt(iDet))->Fill(posXL, posYL);
393       ((TH2F*) fDetEltTDHistList->UncheckedAt(fNDE))->Fill(chamber, 0);
394   
395       Int_t detEltLocalId = 0;  //!<Id of the detection element in the station
396       detEltLocalId =  FromDetElt2LocalId(chamber, detElt);
397       ((TH1F*) fChamberTDHistList->UncheckedAt(chamber))->Fill(detEltLocalId);
398       ((TH1F*) fChamberTDHistList->UncheckedAt(10))->Fill(chamber);
399    }
400 }
401
402
403
404
405 //_____________________________________________________________________________
406 void AliCheckMuonDetEltResponse::FillTTHistos(Int_t chamber,
407                                               Int_t detElt,
408                                               Double_t posXL,
409                                               Double_t posYL)
410 {
411   if(fTrackFilter[chamber] == 1)
412     {
413       Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
414       iDet = FromDetElt2iDet(chamber, detElt);
415       ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
416       ((TH2F*) fDetEltTTHistList->UncheckedAt(fNDE))->Fill(chamber, 0);
417      
418       Int_t detEltLocalId = 0;  //!<Id of the detection element in the station
419       detEltLocalId =  FromDetElt2LocalId(chamber, detElt);
420       ((TH1F*) fChamberTTHistList->UncheckedAt(chamber))->Fill(detEltLocalId);
421       ((TH1F*) fChamberTTHistList->UncheckedAt(10))->Fill(chamber);
422     }
423 }
424
425
426
427
428
429 //_____________________________________________________________________________
430 Int_t AliCheckMuonDetEltResponse::FromDetElt2iDet(Int_t chamber, 
431                                                   Int_t detElt)
432 {
433 ///
434 ///Connexion between the detection element X and its position in the list of histograms iX.
435 ///
436
437     Int_t iDet = 0; //!<Position of the detection element (detElt) in the histograms' list.
438
439     if (chamber<4)             iDet = detElt-fOffset*(chamber+1)+ 4* chamber      ; 
440     if (chamber>3 && chamber<6) iDet = detElt-fOffset*(chamber+1)+18*(chamber-4)+16;
441     if (chamber>5)             iDet = detElt-fOffset*(chamber+1)+26*(chamber-6)+52;
442
443     return iDet;    
444 }
445
446
447
448 //_____________________________________________________________________________
449 Int_t AliCheckMuonDetEltResponse::FromDetElt2LocalId(Int_t chamber, 
450                                                      Int_t detElt)
451 {
452 ///
453 ///Connexion between the detection element X and its number in the station.
454 ///
455
456     Int_t localId = 0; //!<Position of the detection element (detElt) in the histograms' list.
457     localId = detElt - (chamber+1) * 100;
458
459     return localId;    
460 }
461
462
463
464 //_____________________________________________________________________________
465 void AliCheckMuonDetEltResponse::FindAndFillMissedDetElt(AliMUONTrackParam* extrapTrackParam, 
466                                                          Int_t firstMissCh,
467                                                          Int_t nbrMissCh)
468 {
469 ///
470 ///Find which detection elements should have been hit but were missed, 
471 ///and fill the TT histos appropriately
472 ///
473   for (Int_t iCh = 0; iCh < nbrMissCh; ++iCh)
474     {
475       Int_t chamber = firstMissCh + iCh;
476       Int_t nbrOfDetElt =  AliMpDEManager::GetNofDEInChamber(chamber, kTRUE); //!<Number of detection elements in the chamber.
477       
478       Double_t pos1[6] = {0, 0, 0, 0, 0, 0};        //!<First point used to compute the extrapolated point (first 3 for global coordinates, last 3 for local).
479       Double_t pos2[6] = {0, 0, 0, 0, 0, 0};        //!<Second point used to compute the extrapolated point (first 3 for global coordinates, last 3 for local).
480       Double_t posMiss[2] = {0, 0};                 //!<(X, Y) local coordinates of the missing cluster.
481             
482       pos1[2] = AliMUONConstants::DefaultChamberZ(chamber);           //!<Z of point 1, defined by being the Z of the chamber in "perfect" position.
483       AliMUONTrackExtrap::ExtrapToZ(extrapTrackParam, pos1[2]);
484       pos1[0] = extrapTrackParam->GetNonBendingCoor();                //!<X of point 1, extrapolated by following the Track.
485       pos1[1] = extrapTrackParam->GetBendingCoor();                   //!<Y of point 1, extrapolated by following the Track.
486       
487       pos2[2] = AliMUONConstants::DefaultChamberZ(chamber) + AliMUONConstants::DzCh();   //!<Z of point 2, defined by being the Z of the chamber in "perfect" position 
488       AliMUONTrackExtrap::ExtrapToZ(extrapTrackParam, pos2[2]);                           //!< + plus a small shift (the distance between two stations in a same chamber).
489       pos2[0] = extrapTrackParam->GetNonBendingCoor();                                   //!<X of point 2, extrapolated by following the Track.                        
490       pos2[1] = extrapTrackParam->GetBendingCoor();                                      //!<Y of point 2, extrapolated by following the Track.                          
491       
492       
493       
494         for (Int_t iDE = 0; iDE < nbrOfDetElt; iDE++)                    //!<Loop on all the detection element of the chamber
495           {
496             Int_t deId = (chamber + 1)*fOffset + iDE;                        //!<detection element Id 
497             
498             fTransformer->Global2Local(deId, pos1[0], pos1[1], pos1[2], pos1[3], pos1[4], pos1[5]);      //!<convesrion of point 1 and 2 in the local coordinates
499             fTransformer->Global2Local(deId, pos2[0], pos2[1], pos2[2], pos2[3], pos2[4], pos2[5]);
500             
501             CoordinatesOfMissingCluster(pos1[3], pos1[4], pos1[5], pos2[3], pos2[4], pos2[5], posMiss[0], posMiss[1]);
502
503             Bool_t isMissed = kFALSE;
504             if (chamber < 4)
505               isMissed = CoordinatesInDetEltSt12(deId, posMiss[0], posMiss[1]);
506             else
507               isMissed = CoordinatesInDetEltSt345(deId, posMiss[0], posMiss[1]);
508
509             if (isMissed)
510               FillTTHistos(chamber, deId, posMiss[0], posMiss[1]);
511           }
512     }
513 }
514
515
516
517 //_____________________________________________________________________________
518 void AliCheckMuonDetEltResponse::CoordinatesOfMissingCluster(Double_t x1, Double_t y1, Double_t z1,
519                                                              Double_t x2, Double_t y2, Double_t z2,
520                                                              Double_t& x, Double_t& y)
521 {
522   //
523   //Compute the coordinates of the missing cluster.
524   //There are defined by the intersection between the straigth line joining two extrapolated points (1 and 2) and the detection element plane.
525   //In the local coordinates, this means Z=0 in the parametric equation of the line.
526   //
527
528   Double_t t = 0;
529   t = - z1 / (z2 - z1);
530   
531   x = t * (x2 - x1) + x1;
532   y = t * (y2 - y1) + y1;
533 }
534
535
536 //_____________________________________________________________________________
537 Bool_t AliCheckMuonDetEltResponse::CoordinatesInDetEltSt345(Int_t DeId, Double_t x, Double_t y)
538 {
539   //
540   //Return kTRUE if the coordinates are in the Detection Element, for station 3, 4 and 5.
541   //This is done by checking if a pad correspond to the (x, y) position.
542   //  
543
544   AliMpPad pad1;
545   AliMpPad pad2;
546
547   AliMpSlatSegmentation *segm1 = new AliMpSlatSegmentation(AliMpSegmentation::Instance(kFALSE)->GetSlat(DeId, AliMp::kCath0));
548   AliMpSlatSegmentation *segm2 = new AliMpSlatSegmentation(AliMpSegmentation::Instance(kFALSE)->GetSlat(DeId, AliMp::kCath1));
549   pad1 = segm1->PadByPosition(x, y, kFALSE);
550   pad2 = segm2->PadByPosition(x, y, kFALSE);
551  
552   if (pad1.IsValid() && pad2.IsValid())
553     return kTRUE;
554   else
555     return kFALSE;
556 }
557
558
559 //_____________________________________________________________________________
560 Bool_t AliCheckMuonDetEltResponse::CoordinatesInDetEltSt12(Int_t DeId, Double_t x, Double_t y)
561 {
562   //Return kTRUE if the coordinates are in the Detection Element, for station 1 and 2.
563   //This is done by checking if a pad correspond to the (x, y) position.
564   
565   AliMpPad pad1;
566   AliMpPad pad2;
567
568   AliMpSectorSegmentation *segm1 = new AliMpSectorSegmentation(AliMpSegmentation::Instance(kFALSE)->GetSector(DeId, AliMp::kCath0));
569   AliMpSectorSegmentation *segm2 = new AliMpSectorSegmentation(AliMpSegmentation::Instance(kFALSE)->GetSector(DeId, AliMp::kCath1));
570   pad1 = segm1->PadByPosition(x, y, kFALSE);
571   pad2 = segm2->PadByPosition(x, y, kFALSE);
572  
573   if (pad1.IsValid() && pad2.IsValid())
574     return kTRUE;
575   else
576     return kFALSE;
577 }