]>
Commit | Line | Data |
---|---|---|
ba030c0e | 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 | ||
88cb7938 | 16 | /* $Id$ */ |
ba030c0e | 17 | |
18 | // Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay | |
19 | // | |
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 | |
5f1df83a | 28 | // Included in AliRoot 2003/01/28 |
ba030c0e | 29 | |
3c25381f | 30 | #include "AliMpPad.h" |
31 | ||
ba030c0e | 32 | #include "AliMUONSt1ElectronicElement.h" |
33 | ||
34 | ClassImp(AliMUONSt1ElectronicElement); | |
35 | ||
36 | //______________________________________________________________________________ | |
37 | AliMUONSt1ElectronicElement::AliMUONSt1ElectronicElement() | |
38 | :TObject(),fDescription(kNone) | |
39 | { | |
40 | // default constructor | |
41 | } | |
42 | ||
43 | //______________________________________________________________________________ | |
44 | AliMUONSt1ElectronicElement::AliMUONSt1ElectronicElement(TDescription descr) | |
45 | :TObject(),fDescription(descr) | |
46 | { | |
47 | // normal constructor | |
48 | switch (descr){ | |
49 | case kXY : SetRange(0,0.,0.); SetRange(1,0.,0.); break; | |
50 | default: SetRange(0,0,0); SetRange(1,0,0); break; | |
51 | } | |
52 | } | |
53 | ||
54 | //______________________________________________________________________________ | |
55 | AliMUONSt1ElectronicElement::~AliMUONSt1ElectronicElement() | |
56 | { | |
57 | // destructor | |
58 | } | |
59 | ||
60 | //______________________________________________________________________________ | |
61 | void AliMUONSt1ElectronicElement::SetRange(Int_t numVar,Int_t i1,Int_t i2) | |
62 | { | |
63 | // set the range of the <numVar>th variables, in all cases but kXY | |
64 | // --- | |
65 | ||
66 | if (fDescription==kXY) { | |
67 | fRanges[numVar][0].x = (Double_t)i1; | |
68 | fRanges[numVar][1].x = (Double_t)i2; | |
69 | } else { | |
70 | fRanges[numVar][0].i = i1; | |
71 | fRanges[numVar][1].i = i2; | |
72 | } | |
73 | } | |
74 | ||
75 | //______________________________________________________________________________ | |
76 | void AliMUONSt1ElectronicElement::SetRange(Int_t numVar,Double_t x1,Double_t x2) | |
77 | { | |
78 | // set the range of the <numVar>th variable, in cases kXY | |
79 | // --- | |
80 | ||
81 | if (fDescription==kXY) { | |
82 | fRanges[numVar][0].x = x1; | |
83 | fRanges[numVar][1].x = x2; | |
84 | } else { | |
85 | fRanges[numVar][0].i = (Int_t)x1; | |
86 | fRanges[numVar][1].i = (Int_t)x2; | |
87 | } | |
88 | } | |
89 | ||
90 | //______________________________________________________________________________ | |
91 | Bool_t AliMUONSt1ElectronicElement::IsInRange(Int_t numVar,Int_t i) const | |
92 | { | |
93 | // is the given value in the <numVar>th variable | |
94 | // --- | |
95 | ||
96 | return (fRanges[numVar][0].i<=i) && (fRanges[numVar][1].i>=i); | |
97 | } | |
98 | ||
99 | //______________________________________________________________________________ | |
100 | Bool_t AliMUONSt1ElectronicElement::IsInRange(Int_t numVar,Double_t x) const | |
101 | { | |
102 | // is the given value in the <numVar>th variable | |
103 | // --- | |
104 | ||
105 | return (fRanges[numVar][0].x<=x) && (fRanges[numVar][1].x>=x); | |
106 | } | |
107 | ||
108 | //______________________________________________________________________________ | |
5f91c9e8 | 109 | Bool_t AliMUONSt1ElectronicElement::Contains(const AliMpPad& pad) const |
ba030c0e | 110 | { |
111 | // is the pad <pad> contained in this range | |
112 | // --- | |
113 | ||
114 | switch(fDescription){ | |
115 | case kNone: | |
116 | return kFALSE; | |
117 | case kIJ : | |
118 | return ( IsInRange(0,pad.GetIndices().GetFirst()) | |
119 | && IsInRange(1,pad.GetIndices().GetSecond()) | |
120 | ); | |
121 | case kXY : | |
122 | return ( IsInRange(0,pad.Position().X()) | |
123 | && IsInRange(1,pad.Position().Y()) | |
124 | ); | |
125 | case kMGC : | |
126 | return ( IsInRange(0,pad.GetLocation().GetFirst()) | |
127 | && IsInRange(1,pad.GetLocation().GetSecond()) | |
128 | ); | |
129 | case kMG : | |
130 | return ( IsInRange(0,pad.GetLocation().GetFirst()) | |
131 | && IsInRange(1,pad.GetLocation().GetSecond() >> 4) | |
132 | ); | |
133 | case kM : | |
134 | return ( IsInRange(0,pad.GetLocation().GetFirst())); | |
135 | ||
136 | default: return kFALSE; | |
137 | } | |
138 | } |