]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/AliMUONSt1ElectronicElement.cxx
Adaption to new fluka common blocks (E. Futo)
[u/mrichter/AliRoot.git] / MUON / AliMUONSt1ElectronicElement.cxx
CommitLineData
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
16/*
17$Log$
5f91c9e8 18Revision 1.1 2003/01/28 13:21:06 morsch
19Improved response simulation for station 1.
20(M. Mac Cormick, I. Hrivnacova, D. Guez)
21
ba030c0e 22*/
23
24// Authors: David Guez, Ivana Hrivnacova, Marion MacCormick; IPN Orsay
25//
26// Class AliMUONSt1ElectronicElement
27// ---------------------------------
28// Describes a set of pads either by defining
29// a range of indices, or
30// a range of (centimeters) positions or
31// a range of electronic channel numbers or
32// a range of MANU numbers or, finally,
33// a range of gassiplex/MANAS numbers, in a given range of MANU addresses
34
35#include "AliMUONSt1ElectronicElement.h"
36
37ClassImp(AliMUONSt1ElectronicElement);
38
39//______________________________________________________________________________
40AliMUONSt1ElectronicElement::AliMUONSt1ElectronicElement()
41 :TObject(),fDescription(kNone)
42{
43// default constructor
44}
45
46//______________________________________________________________________________
47AliMUONSt1ElectronicElement::AliMUONSt1ElectronicElement(TDescription descr)
48 :TObject(),fDescription(descr)
49{
50// normal constructor
51 switch (descr){
52 case kXY : SetRange(0,0.,0.); SetRange(1,0.,0.); break;
53 default: SetRange(0,0,0); SetRange(1,0,0); break;
54 }
55}
56
57//______________________________________________________________________________
58AliMUONSt1ElectronicElement::~AliMUONSt1ElectronicElement()
59{
60// destructor
61}
62
63//______________________________________________________________________________
64void AliMUONSt1ElectronicElement::SetRange(Int_t numVar,Int_t i1,Int_t i2)
65{
66// set the range of the <numVar>th variables, in all cases but kXY
67// ---
68
69 if (fDescription==kXY) {
70 fRanges[numVar][0].x = (Double_t)i1;
71 fRanges[numVar][1].x = (Double_t)i2;
72 } else {
73 fRanges[numVar][0].i = i1;
74 fRanges[numVar][1].i = i2;
75 }
76}
77
78//______________________________________________________________________________
79void AliMUONSt1ElectronicElement::SetRange(Int_t numVar,Double_t x1,Double_t x2)
80{
81// set the range of the <numVar>th variable, in cases kXY
82// ---
83
84 if (fDescription==kXY) {
85 fRanges[numVar][0].x = x1;
86 fRanges[numVar][1].x = x2;
87 } else {
88 fRanges[numVar][0].i = (Int_t)x1;
89 fRanges[numVar][1].i = (Int_t)x2;
90 }
91}
92
93//______________________________________________________________________________
94Bool_t AliMUONSt1ElectronicElement::IsInRange(Int_t numVar,Int_t i) const
95{
96// is the given value in the <numVar>th variable
97// ---
98
99 return (fRanges[numVar][0].i<=i) && (fRanges[numVar][1].i>=i);
100}
101
102//______________________________________________________________________________
103Bool_t AliMUONSt1ElectronicElement::IsInRange(Int_t numVar,Double_t x) const
104{
105// is the given value in the <numVar>th variable
106// ---
107
108 return (fRanges[numVar][0].x<=x) && (fRanges[numVar][1].x>=x);
109}
110
111//______________________________________________________________________________
5f91c9e8 112Bool_t AliMUONSt1ElectronicElement::Contains(const AliMpPad& pad) const
ba030c0e 113{
114// is the pad <pad> contained in this range
115// ---
116
117 switch(fDescription){
118 case kNone:
119 return kFALSE;
120 case kIJ :
121 return ( IsInRange(0,pad.GetIndices().GetFirst())
122 && IsInRange(1,pad.GetIndices().GetSecond())
123 );
124 case kXY :
125 return ( IsInRange(0,pad.Position().X())
126 && IsInRange(1,pad.Position().Y())
127 );
128 case kMGC :
129 return ( IsInRange(0,pad.GetLocation().GetFirst())
130 && IsInRange(1,pad.GetLocation().GetSecond())
131 );
132 case kMG :
133 return ( IsInRange(0,pad.GetLocation().GetFirst())
134 && IsInRange(1,pad.GetLocation().GetSecond() >> 4)
135 );
136 case kM :
137 return ( IsInRange(0,pad.GetLocation().GetFirst()));
138
139 default: return kFALSE;
140 }
141}