]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/AliMUONDigit.cxx
Added a commented out version with new digitizers.
[u/mrichter/AliRoot.git] / MUON / AliMUONDigit.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 /* $Id$ */
17
18 #include "AliMUONDigit.h"
19
20 #include "Riostream.h"
21 #include "TString.h"
22
23 ClassImp(AliMUONDigit)
24
25 //_____________________________________________________________________________
26 AliMUONDigit::AliMUONDigit()
27 : TObject(),
28 fPadX(0),
29 fPadY(0),
30 fCathode(0),
31 fSignal(0),
32 fPhysics(0),
33 fHit(0),
34 fDetElemId(0),
35 fManuId(-1),
36 fManuChannel(-1),
37 fADC(0),
38 fIsSaturated(kFALSE)
39 {
40   // Default constructor
41   
42   for ( Int_t i=0; i<kMAXTRACKS; ++i ) 
43   {
44     fTcharges[i] = 0;
45     fTracks[i] = 0;
46   }
47 }
48
49 //_____________________________________________________________________________
50 AliMUONDigit::AliMUONDigit(const AliMUONDigit& digit)
51   : TObject(digit)
52 {
53   // copy constructor
54  
55    (static_cast<const AliMUONDigit&>(digit)).Copy(*this);
56 }
57
58
59 //_____________________________________________________________________________
60 AliMUONDigit::~AliMUONDigit()
61 {
62   // Destructor 
63 }
64
65 //_____________________________________________________________________________
66 AliMUONDigit& 
67 AliMUONDigit::operator=(const AliMUONDigit& digit)
68 {
69   AliMUONDigit a(digit);
70   a.Copy(*this);
71   return *this;
72 }
73
74 //______________________________________________________________________________
75 void 
76 AliMUONDigit::Copy(TObject& obj) const
77 {
78   // Copy this line to line.
79   
80   TObject::Copy(obj);
81   AliMUONDigit& digit = static_cast<AliMUONDigit&>(obj);
82   digit.fPadX = fPadX;
83   digit.fPadY = fPadY;
84   digit.fCathode = fCathode;
85   digit.fSignal = fSignal;
86   digit.fHit = fHit;
87   digit.fDetElemId = fDetElemId;
88   digit.fManuId = fManuId;
89   digit.fManuChannel = fManuChannel;
90   digit.fADC = fADC;
91   digit.fIsSaturated = fIsSaturated;
92 }
93
94
95 //_____________________________________________________________________________
96 AliMUONDigit::AliMUONDigit(Int_t *digits)
97 {
98   //
99   // Creates a MUON digit object to be updated
100   //
101     fPadX        = digits[0];
102     fPadY        = digits[1];
103     fCathode     = digits[2];
104     fSignal      = digits[3];
105     fPhysics     = digits[4];
106     fHit         = digits[5];
107     fDetElemId   = digits[6];
108     fManuId = -1;
109     fManuChannel = -1;
110     fADC=0;
111     fIsSaturated = kFALSE;
112 }
113 //_____________________________________________________________________________
114 AliMUONDigit::AliMUONDigit(Int_t *tracks, Int_t *charges, Int_t *digits)
115 {
116     //
117     // Creates a MUON digit object
118     //
119     fPadX        = digits[0];
120     fPadY        = digits[1];
121     fCathode     = digits[2];
122     fSignal      = digits[3];
123     fPhysics     = digits[4];
124     fHit         = digits[5];
125     fDetElemId   = digits[6];
126     fManuId = -1;
127     fManuChannel = -1;
128     fADC=0;
129     for(Int_t i=0; i<kMAXTRACKS; i++) {
130       fTcharges[i]  = charges[i];
131       fTracks[i]    = tracks[i];
132     }
133     fIsSaturated=kFALSE;
134 }
135
136 //_____________________________________________________________________________
137 Int_t AliMUONDigit::Compare(const TObject *obj) const
138 {
139 // sort by idDE
140
141  AliMUONDigit* d = (AliMUONDigit*) obj;
142
143  return ( fDetElemId > d->DetElemId()) ? 1 : -1;
144
145 }
146
147 //_____________________________________________________________________________
148 void
149 AliMUONDigit::Print(Option_t* opt) const
150 {
151   cout << "DetEle " << setw(5) << DetElemId()
152   << " Cath " << setw(2) << Cathode()
153   << " (Ix,Iy)=(" << setw(3) << PadX() << "," << setw(3) << PadY()
154   << ") "
155   << " (Manu,Channel)=(" << setw(4) << ManuId() 
156   << "," << setw(3) << ManuChannel() << ")"
157   << " Signal=" << setw(6) << Signal()
158   << " Physics=" << setw(4) << Physics();
159   if ( fIsSaturated ) 
160   {
161     cout << "(S)";
162   }
163   else
164   {
165     cout << "   ";
166   }
167   cout << " ADC=" << setw(4) << ADC();
168   TString options(opt);
169   options.ToLower();
170   if ( options.Contains("tracks") )
171   {
172     cout << " Track0=" << setw(3) << Track(0) 
173     << " Charge0=" << setw(4) << TrackCharge(0)
174     << " Track1=" << setw(3) << Track(1) 
175     << " Charge1=" << setw(4) << TrackCharge(1);
176   }
177   cout << endl;  
178 }
179
180 //_____________________________________________________________________________
181 Bool_t
182 AliMUONDigit::IsSaturated() const
183 {
184   return fIsSaturated;
185 }
186
187 //_____________________________________________________________________________
188 Int_t
189 AliMUONDigit::ManuId() const
190 {
191   return fManuId;
192 }
193
194 //_____________________________________________________________________________
195 Int_t
196 AliMUONDigit::ManuChannel() const
197 {
198   return fManuChannel;
199 }
200
201 //_____________________________________________________________________________
202 Int_t 
203 AliMUONDigit::ADC() const
204 {
205   return fADC;
206 }
207
208 //_____________________________________________________________________________
209 void
210 AliMUONDigit::SetADC(Int_t adc)
211 {
212   fADC = adc;
213 }
214
215 //_____________________________________________________________________________
216 void
217 AliMUONDigit::SetElectronics(Int_t manuId, Int_t manuChannel)
218 {
219   //
220   //FIXME: should we check that the values are ok here ??
221   //
222   fManuId=manuId;
223   fManuChannel=manuChannel;
224 }
225
226 //_____________________________________________________________________________
227 void
228 AliMUONDigit::Saturated(Bool_t saturated)
229 {
230   fIsSaturated=saturated;
231 }
232
233