53b029fb49a9fd3ea9a4ae06f7695abfe984b857
[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     {
283       fTrackFilter[ch] = 0;
284     }
285
286   Double_t posXL, posYL, posZL;          //!<Local positions.
287   Double_t posXG, posYG, posZG;          //!<Global. positions.
288   Int_t chamberResponse [10] = {0};      //!<1 if the chamber has responded; 0 if not
289   
290   for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
291     { 
292       fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
293       fCluster    = (AliMUONVCluster*  ) fTrackParam ->GetClusterPtr();    
294       fTrackFilter   [fCluster->GetChamberId()] = 1;
295       chamberResponse[fCluster->GetChamberId()] = 1;
296     }
297   
298   for (Int_t station = 0; station < fNSt-1; ++station)
299     {
300       Int_t filter;                                                  //<!
301       Int_t ch1, ch2, ch3, ch4;                                      //<!
302       ch1 = 2*station;                                               //<!
303       ch2 = 2*station + 1;                                           //<!
304       ch3 = 2*station + 2;                                           //<!
305       ch4 = 2*station + 3;                                           //<!
306                                                                      //<!For the efficiency calculation the tracks
307       if (station < 3 )                                              //<!reconstructed must have responded to the
308         {                                                              //<!criteria of the tracking. 
309           filter            = fTrackFilter[ch1];                       //<!And that's why the tracks usable for the 
310           fTrackFilter[ch1] = fTrackFilter[ch2];                       //<!intrinsic efficiency calculation are
311           fTrackFilter[ch2] = filter;                                  //<!the tracks which have one or two clusters
312         }                                                              //<!in each station. So the case where a track
313                                                                        //<!hasn't a cluster in a station is not
314       else                                                             //<!taking into account.
315         {                                                              //<!This part solves the problem. See the ALICE 
316           if (chamberResponse[ch3]*chamberResponse[ch4] != 0)          //<!note of Diego STOCCO on the trigger efficiency
317             {                                                            //<!
318               filter            = fTrackFilter[ch1];                       //<!
319               fTrackFilter[ch1] = fTrackFilter[ch2];                       //<!
320               fTrackFilter[ch2] = filter;                                  //<!
321             }                                                            //<!
322           else                                                         //<!
323             {                                                            //<!
324               fTrackFilter[ch1] = 0;                                       //<!
325               fTrackFilter[ch2] = 0;                                       //<!
326             }                                                            //<!
327           //<!
328           if (chamberResponse[ch1]*chamberResponse[ch2] != 0)          //<!
329             {                                                            //<!
330               filter            = fTrackFilter[ch3];                       //<!
331               fTrackFilter[ch3] = fTrackFilter[ch4];                       //<!
332               fTrackFilter[ch4] = filter;                                  //<!
333             }                                                            //<!
334           else                                                         //<!
335             {                                                            //<!
336               fTrackFilter[ch3] = 0;                                       //<!
337               fTrackFilter[ch4] = 0;                                       //<!
338             }                                                            //<!
339         }                                                              //<!
340     }                                                                //<!
341   
342
343   for (Int_t ch = 0; ch < fNCh; ++ch)
344     {
345       if (fTrackFilter[ch] == 1)
346         {
347           if ( chamberResponse[ch] != 0) 
348             {
349               ((TH2F*) fDetEltTDHistList->UncheckedAt(fNDE))->Fill(ch, 0);
350               ((TH1F*) fChamberTDHistList->UncheckedAt(fNCh))->Fill(ch);          
351             }
352           
353           ((TH2F*) fDetEltTTHistList->UncheckedAt(fNDE))->Fill(ch, 0);
354           ((TH1F*) fChamberTTHistList->UncheckedAt(fNCh))->Fill(ch);
355         }
356     } 
357   
358   ///Begining of the loop:
359   for (iTrackParam = 0; iTrackParam < nTrackParams; ++iTrackParam)
360     {
361       fTrackParam = (AliMUONTrackParam*) fTrackParams->At(iTrackParam);
362       fCluster    = (AliMUONVCluster*  ) fTrackParam ->GetClusterPtr(); 
363       
364       newChamber  = fCluster->GetChamberId();
365       detElt      = fCluster->GetDetElemId();
366
367       ///Global and local positions calculation:
368       posXG = fTrackParam->GetNonBendingCoor(); 
369       posYG = fTrackParam->GetBendingCoor(); 
370       posZG = fTrackParam->GetZ(); 
371       
372       fTransformer->Global2Local(detElt, posXG, posYG, posZG, posXL, posYL, posZL);  //!<Transfomation from global to local positions.
373       
374       ///Filling histograms of the cluster positions on the detection element of the TRACKS DETECTED (TD):
375       FillTDHistos(newChamber, detElt, posXL, posYL);
376     
377       ///Filling histograms of the cluster positions on the detection element of ALL THE TRACKS (TT):
378       FillTTHistos(newChamber, detElt, posXL, posYL);
379
380       if (newChamber != oldChamber) 
381         {
382           if (newChamber > oldChamber + 1)                                 //!<Check if it doesn't miss a chamber.
383             {
384               Int_t nbrMissChamber = newChamber - (oldChamber + 1);
385               FindAndFillMissedDetElt(fTrackParam, oldChamber+1, nbrMissChamber); //!<Calculation of the parameters of the missing cluster(s).
386             }
387             
388           if ( iTrackParam == nTrackParams - 1 && newChamber != fNCh-1)           //!<Check if the last chamber, chamber 9 (from 0 to 9) has responded.
389             {     
390               FindAndFillMissedDetElt(fTrackParam, fNCh-1, 1);                      //!<Calculation of the parameters of the missing cluster(s) in the last chamber.
391             }
392         }
393       oldChamber = newChamber; 
394     } 
395 }
396
397
398
399 //_____________________________________________________________________________
400 void AliCheckMuonDetEltResponse::FillTDHistos(Int_t chamber,
401                                               Int_t detElt,
402                                               Double_t posXL,
403                                               Double_t posYL)
404 {
405   if(fTrackFilter[chamber]== 1)
406     {
407       Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
408       iDet = FromDetElt2iDet(chamber, detElt);
409       ((TH2F*) fDetEltTDHistList->UncheckedAt(iDet))->Fill(posXL, posYL);
410       
411       Int_t detEltLocalId = 0;  //!<Id of the detection element in the station
412       detEltLocalId =  FromDetElt2LocalId(chamber, detElt);
413       ((TH1F*) fChamberTDHistList->UncheckedAt(chamber))->Fill(detEltLocalId);
414     }
415 }
416
417
418
419
420 //_____________________________________________________________________________
421 void AliCheckMuonDetEltResponse::FillTTHistos(Int_t chamber,
422                                               Int_t detElt,
423                                               Double_t posXL,
424                                               Double_t posYL)
425 {
426   if(fTrackFilter[chamber] == 1)
427     {
428       Int_t iDet = 0; //!<Position of the detection element in the histograms' list.
429       iDet = FromDetElt2iDet(chamber, detElt);
430       ((TH2F*) fDetEltTTHistList->UncheckedAt(iDet)) -> Fill(posXL, posYL);
431       
432       Int_t detEltLocalId = 0;  //!<Id of the detection element in the station
433       detEltLocalId =  FromDetElt2LocalId(chamber, detElt);
434       ((TH1F*) fChamberTTHistList->UncheckedAt(chamber))->Fill(detEltLocalId);
435     }
436 }
437
438
439
440
441
442 //_____________________________________________________________________________
443 Int_t AliCheckMuonDetEltResponse::FromDetElt2iDet(Int_t chamber, 
444                                                   Int_t detElt)
445 {
446 ///
447 ///Connexion between the detection element X and its position in the list of histograms iX.
448 ///
449
450     Int_t iDet = 0; //!<Position of the detection element (detElt) in the histograms' list.
451
452     if (chamber<4)             iDet = detElt-fOffset*(chamber+1)+ 4* chamber      ; 
453     if (chamber>3 && chamber<6) iDet = detElt-fOffset*(chamber+1)+18*(chamber-4)+16;
454     if (chamber>5)             iDet = detElt-fOffset*(chamber+1)+26*(chamber-6)+52;
455
456     return iDet;    
457 }
458
459
460
461 //_____________________________________________________________________________
462 Int_t AliCheckMuonDetEltResponse::FromDetElt2LocalId(Int_t chamber, 
463                                                      Int_t detElt)
464 {
465 ///
466 ///Connexion between the detection element X and its number in the station.
467 ///
468
469     Int_t localId = 0; //!<Position of the detection element (detElt) in the histograms' list.
470     localId = detElt - (chamber+1) * 100;
471
472     return localId;    
473 }
474
475
476
477 //_____________________________________________________________________________
478 void AliCheckMuonDetEltResponse::FindAndFillMissedDetElt(AliMUONTrackParam* extrapTrackParam, 
479                                                          Int_t firstMissCh,
480                                                          Int_t nbrMissCh)
481 {
482 ///
483 ///Find which detection elements should have been hit but were missed, 
484 ///and fill the TT histos appropriately
485 ///
486   for (Int_t iCh = 0; iCh < nbrMissCh; ++iCh)
487     {
488       Int_t chamber = firstMissCh + iCh;
489       Int_t nbrOfDetElt =  AliMpDEManager::GetNofDEInChamber(chamber, kTRUE); //!<Number of detection elements in the chamber.
490       
491       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).
492       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).
493       Double_t posMiss[2] = {0, 0};                 //!<(X, Y) local coordinates of the missing cluster.
494             
495       pos1[2] = AliMUONConstants::DefaultChamberZ(chamber);           //!<Z of point 1, defined by being the Z of the chamber in "perfect" position.
496       AliMUONTrackExtrap::ExtrapToZ(extrapTrackParam, pos1[2]);
497       pos1[0] = extrapTrackParam->GetNonBendingCoor();                //!<X of point 1, extrapolated by following the Track.
498       pos1[1] = extrapTrackParam->GetBendingCoor();                   //!<Y of point 1, extrapolated by following the Track.
499       
500       pos2[2] = AliMUONConstants::DefaultChamberZ(chamber) + AliMUONConstants::DzCh();   //!<Z of point 2, defined by being the Z of the chamber in "perfect" position 
501       AliMUONTrackExtrap::ExtrapToZ(extrapTrackParam, pos2[2]);                           //!< + plus a small shift (the distance between two stations in a same chamber).
502       pos2[0] = extrapTrackParam->GetNonBendingCoor();                                   //!<X of point 2, extrapolated by following the Track.                        
503       pos2[1] = extrapTrackParam->GetBendingCoor();                                      //!<Y of point 2, extrapolated by following the Track.                          
504       
505       
506       
507         for (Int_t iDE = 0; iDE < nbrOfDetElt; iDE++)                    //!<Loop on all the detection element of the chamber
508           {
509             Int_t deId = (chamber + 1)*fOffset + iDE;                        //!<detection element Id 
510             
511             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
512             fTransformer->Global2Local(deId, pos2[0], pos2[1], pos2[2], pos2[3], pos2[4], pos2[5]);
513             
514             CoordinatesOfMissingCluster(pos1[3], pos1[4], pos1[5], pos2[3], pos2[4], pos2[5], posMiss[0], posMiss[1]);
515
516             Bool_t IsMissed = kFALSE;
517             if (chamber < 4)
518               IsMissed = CoordinatesInDetEltSt12(deId, posMiss[0], posMiss[1]);
519             else
520               IsMissed = CoordinatesInDetEltSt345(deId, posMiss[0], posMiss[1]);
521
522             if (IsMissed)
523               FillTTHistos(chamber, deId, posMiss[0], posMiss[1]);
524             
525           }
526     }
527 }
528
529
530
531 //_____________________________________________________________________________
532 void AliCheckMuonDetEltResponse::CoordinatesOfMissingCluster(Double_t x1, Double_t y1, Double_t z1,
533                                                              Double_t x2, Double_t y2, Double_t z2,
534                                                              Double_t& x, Double_t& y)
535 {
536   //
537   //Compute the coordinates of the missing cluster.
538   //There are defined by the intersection between the straigth line joining two extrapolated points (1 and 2) and the detection element plane.
539   //In the local coordinates, this means Z=0 in the parametric equation of the line.
540   //
541
542   Double_t t = 0;
543   t = - z1 / (z2 - z1);
544   
545   x = t * (x2 - x1) + x1;
546   y = t * (y2 - y1) + y1;
547 }
548
549
550 //_____________________________________________________________________________
551 Bool_t AliCheckMuonDetEltResponse::CoordinatesInDetEltSt345(Int_t DeId, Double_t x, Double_t y)
552 {
553   //
554   //Return kTRUE if the coordinates are in the Detection Element, for station 3, 4 and 5.
555   //This is done by checking if a pad correspond to the (x, y) position.
556   //  
557
558   AliMpPad pad1;
559   AliMpPad pad2;
560
561   AliMpSlatSegmentation *segm1 = new AliMpSlatSegmentation(AliMpSegmentation::Instance(kFALSE)->GetSlat(DeId, AliMp::kCath0));
562   AliMpSlatSegmentation *segm2 = new AliMpSlatSegmentation(AliMpSegmentation::Instance(kFALSE)->GetSlat(DeId, AliMp::kCath1));
563   pad1 = segm1->PadByPosition(x, y, kFALSE);
564   pad2 = segm2->PadByPosition(x, y, kFALSE);
565  
566   if (pad1.IsValid() || pad2.IsValid())
567     return kTRUE;
568   else
569     return kFALSE;
570 }
571
572
573 //_____________________________________________________________________________
574 Bool_t AliCheckMuonDetEltResponse::CoordinatesInDetEltSt12(Int_t DeId, Double_t x, Double_t y)
575 {
576   //Return kTRUE if the coordinates are in the Detection Element, for station 1 and 2.
577   //This is done by checking if a pad correspond to the (x, y) position.
578   
579   AliMpPad pad1;
580   AliMpPad pad2;
581
582   AliMpSectorSegmentation *segm1 = new AliMpSectorSegmentation(AliMpSegmentation::Instance(kFALSE)->GetSector(DeId, AliMp::kCath0));
583   AliMpSectorSegmentation *segm2 = new AliMpSectorSegmentation(AliMpSegmentation::Instance(kFALSE)->GetSector(DeId, AliMp::kCath1));
584   pad1 = segm1->PadByPosition(x, y, kFALSE);
585   pad2 = segm2->PadByPosition(x, y, kFALSE);
586  
587   if (pad1.IsValid() || pad2.IsValid())
588     return kTRUE;
589   else
590     return kFALSE;
591 }