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 **************************************************************************/
18 //===================================================================
19 // Segment element position in local coordinates of the detection element
20 // Gines MARTINEZ, SUBATECH July 04
21 // This class is one of the basic component of
22 // AliMUONSegmentationDetectionElement and contains al the
23 // info about a segment (pad or strip):
24 // Id-indetectionelement, x_local, y_local
25 // Detailed information in Alice Technical Note xxxxxxxx (2004)
26 //====================================================================
30 #include "AliMUONSegmentPosition.h"
32 //___________________________________________
33 ClassImp(AliMUONSegmentPosition)
35 Float_t AliMUONSegmentPosition::fUnit = 0.3 ; // 3mm unit for generation of segmenposition name
38 //___________________________________________
39 AliMUONSegmentPosition::AliMUONSegmentPosition() : TNamed()
46 //___________________________________________
47 AliMUONSegmentPosition::AliMUONSegmentPosition(const Int_t channelId, const Float_t x, const Float_t y, const Int_t cathode) : TNamed()
49 // Constructor to be used
50 fName = Name(x,y,cathode);
51 fTitle= Name(x,y,cathode);
52 fChannelId = channelId;
59 //_______________________________________________
60 AliMUONSegmentPosition::~AliMUONSegmentPosition()
64 //___________________________________________
65 Int_t AliMUONSegmentPosition::Compare(const TObject *obj) const
67 // Comparison of two AliMUONSegmentPosition objects
68 AliMUONSegmentPosition * myobj = ( AliMUONSegmentPosition *) obj;
69 return (fChannelId > myobj->GetChannelId()) ? 1 : -1;
72 //___________________________________________
73 Float_t AliMUONSegmentPosition::Distance(Float_t x, Float_t y)
75 return TMath::Sqrt( (fX-x)*(fX-x) + (fY-y)*(fY-y) ) ;
77 //___________________________________________
78 TString AliMUONSegmentPosition::Name(Float_t x, Float_t y, Int_t cathode)
80 // Definition of the name of AliMUONSegmentPosition
81 // Our convention since the smaller pad pich is 5 mm is to choice a 3mm unit:
82 // So for a position pair x,y and cathode plane icathode the name will be:
83 // xp = TMath::Nint(x*10./3.);
84 // yp = TMath::Nint(y+10./3.);
85 // sprintf(name,"%d-%d-%d",xp,yp,cathode);
86 Int_t xp = TMath::Nint(x/fUnit);
87 Int_t yp = TMath::Nint(y/fUnit);
89 sprintf(name,"%d-%d-%d",xp,yp,cathode);
92 //___________________________________________
93 void AliMUONSegmentPosition::Print() const
95 // Printing AliMUONSegmentManuIndex information
96 Info("Print","Name=%s Id=%d X=%f Y=%f Cathode=%d\n",fName.Data(),fChannelId, fX, fY,fCathode);