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