Rewriting of Digits2Clusters method to minimize the number of loops
[u/mrichter/AliRoot.git] / MUON / AliMUONDigit.cxx
CommitLineData
a9e2aefa 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$ */
a9e2aefa 17
18#include "AliMUONDigit.h"
19
81b31073 20#include "Riostream.h"
21#include "TString.h"
8c343c7c 22
a9e2aefa 23ClassImp(AliMUONDigit)
81b31073 24
a9e2aefa 25//_____________________________________________________________________________
81b31073 26AliMUONDigit::AliMUONDigit()
27: TObject(),
28fPadX(0),
29fPadY(0),
30fCathode(0),
31fSignal(0),
32fPhysics(0),
33fHit(0),
34fDetElemId(0),
35fManuId(-1),
36fManuChannel(-1),
37fADC(0),
38fIsSaturated(kFALSE)
61adb9bd 39{
81b31073 40 // Default constructor
61adb9bd 41
81b31073 42 for ( Int_t i=0; i<kMAXTRACKS; ++i )
43 {
44 fTcharges[i] = 0;
45 fTracks[i] = 0;
46 }
47}
61adb9bd 48
81b31073 49//_____________________________________________________________________________
50AliMUONDigit::AliMUONDigit(const AliMUONDigit& digit)
51 : TObject(digit)
52{
53 // copy constructor
54
55 (static_cast<const AliMUONDigit&>(digit)).Copy(*this);
61adb9bd 56}
57
81b31073 58
61adb9bd 59//_____________________________________________________________________________
81b31073 60AliMUONDigit::~AliMUONDigit()
61{
62 // Destructor
63}
76fa1113 64
81b31073 65//_____________________________________________________________________________
66AliMUONDigit&
67AliMUONDigit::operator=(const AliMUONDigit& digit)
68{
69 AliMUONDigit a(digit);
70 a.Copy(*this);
71 return *this;
30178c30 72}
73
81b31073 74//______________________________________________________________________________
75void
76AliMUONDigit::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
30178c30 95//_____________________________________________________________________________
a9e2aefa 96AliMUONDigit::AliMUONDigit(Int_t *digits)
97{
98 //
99 // Creates a MUON digit object to be updated
100 //
101 fPadX = digits[0];
102 fPadY = digits[1];
a450cfad 103 fCathode = digits[2];
104 fSignal = digits[3];
105 fPhysics = digits[4];
106 fHit = digits[5];
a713db22 107 fDetElemId = digits[6];
81b31073 108 fManuId = -1;
109 fManuChannel = -1;
110 fADC=0;
111 fIsSaturated = kFALSE;
a9e2aefa 112}
113//_____________________________________________________________________________
114AliMUONDigit::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];
a450cfad 121 fCathode = digits[2];
122 fSignal = digits[3];
123 fPhysics = digits[4];
124 fHit = digits[5];
a713db22 125 fDetElemId = digits[6];
81b31073 126 fManuId = -1;
127 fManuChannel = -1;
128 fADC=0;
cb73aa80 129 for(Int_t i=0; i<kMAXTRACKS; i++) {
81b31073 130 fTcharges[i] = charges[i];
131 fTracks[i] = tracks[i];
a9e2aefa 132 }
81b31073 133 fIsSaturated=kFALSE;
a9e2aefa 134}
135
81b31073 136//_____________________________________________________________________________
137Int_t AliMUONDigit::Compare(const TObject *obj) const
a9e2aefa 138{
81b31073 139// sort by idDE
140
141 AliMUONDigit* d = (AliMUONDigit*) obj;
142
143 return ( fDetElemId > d->DetElemId()) ? 1 : -1;
144
a9e2aefa 145}
61adb9bd 146
147//_____________________________________________________________________________
81b31073 148void
149AliMUONDigit::Print(Option_t* opt) const
61adb9bd 150{
81b31073 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}
61adb9bd 179
81b31073 180//_____________________________________________________________________________
181Bool_t
182AliMUONDigit::IsSaturated() const
183{
184 return fIsSaturated;
185}
61adb9bd 186
81b31073 187//_____________________________________________________________________________
188Int_t
189AliMUONDigit::ManuId() const
190{
191 return fManuId;
61adb9bd 192}
81b31073 193
a713db22 194//_____________________________________________________________________________
81b31073 195Int_t
196AliMUONDigit::ManuChannel() const
a713db22 197{
81b31073 198 return fManuChannel;
199}
a713db22 200
81b31073 201//_____________________________________________________________________________
202Int_t
203AliMUONDigit::ADC() const
204{
205 return fADC;
206}
a713db22 207
81b31073 208//_____________________________________________________________________________
209void
210AliMUONDigit::SetADC(Int_t adc)
211{
212 fADC = adc;
213}
a713db22 214
81b31073 215//_____________________________________________________________________________
216void
217AliMUONDigit::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;
a713db22 224}
81b31073 225
226//_____________________________________________________________________________
227void
228AliMUONDigit::Saturated(Bool_t saturated)
229{
230 fIsSaturated=saturated;
231}
232
233