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 // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
20 // Class AliMUONSt1ElectronicElement
21 // ---------------------------------
22 // Describes a set of pads either by defining
23 // a range of indices, or
24 // a range of (centimeters) positions or
25 // a range of electronic channel numbers or
26 // a range of MANU numbers or, finally,
27 // a range of gassiplex/MANAS numbers, in a given range of MANU addresses
28 // Included in AliRoot 2003/01/28
30 #include "AliMUONSt1ElectronicElement.h"
33 ClassImp(AliMUONSt1ElectronicElement)
35 //______________________________________________________________________________
36 AliMUONSt1ElectronicElement::AliMUONSt1ElectronicElement()
37 :TObject(),fDescription(kNone)
39 // default constructor
42 //______________________________________________________________________________
43 AliMUONSt1ElectronicElement::AliMUONSt1ElectronicElement(TDescription descr)
44 :TObject(),fDescription(descr)
48 case kXY : SetRange(0,0.,0.); SetRange(1,0.,0.); break;
49 default: SetRange(0,0,0); SetRange(1,0,0); break;
53 //______________________________________________________________________________
54 AliMUONSt1ElectronicElement::~AliMUONSt1ElectronicElement()
59 //______________________________________________________________________________
60 void AliMUONSt1ElectronicElement::SetRange(Int_t numVar,Int_t i1,Int_t i2)
62 // set the range of the <numVar>th variables, in all cases but kXY
65 if (fDescription==kXY) {
66 fRanges[numVar][0].x = (Double_t)i1;
67 fRanges[numVar][1].x = (Double_t)i2;
69 fRanges[numVar][0].i = i1;
70 fRanges[numVar][1].i = i2;
74 //______________________________________________________________________________
75 void AliMUONSt1ElectronicElement::SetRange(Int_t numVar,Double_t x1,Double_t x2)
77 // set the range of the <numVar>th variable, in cases kXY
80 if (fDescription==kXY) {
81 fRanges[numVar][0].x = x1;
82 fRanges[numVar][1].x = x2;
84 fRanges[numVar][0].i = (Int_t)x1;
85 fRanges[numVar][1].i = (Int_t)x2;
89 //______________________________________________________________________________
90 Bool_t AliMUONSt1ElectronicElement::IsInRange(Int_t numVar,Int_t i) const
92 // is the given value in the <numVar>th variable
95 return (fRanges[numVar][0].i<=i) && (fRanges[numVar][1].i>=i);
98 //______________________________________________________________________________
99 Bool_t AliMUONSt1ElectronicElement::IsInRange(Int_t numVar,Double_t x) const
101 // is the given value in the <numVar>th variable
104 return (fRanges[numVar][0].x<=x) && (fRanges[numVar][1].x>=x);
107 //______________________________________________________________________________
108 Bool_t AliMUONSt1ElectronicElement::Contains(const AliMpPad& pad) const
110 // is the pad <pad> contained in this range
113 switch(fDescription){
117 return ( IsInRange(0,pad.GetIndices().GetFirst())
118 && IsInRange(1,pad.GetIndices().GetSecond())
121 return ( IsInRange(0,pad.Position().X())
122 && IsInRange(1,pad.Position().Y())
125 return ( IsInRange(0,pad.GetLocation().GetFirst())
126 && IsInRange(1,pad.GetLocation().GetSecond())
129 return ( IsInRange(0,pad.GetLocation().GetFirst())
130 && IsInRange(1,pad.GetLocation().GetSecond() >> 4)
133 return ( IsInRange(0,pad.GetLocation().GetFirst()));
135 default: return kFALSE;