AliRoot Core  3dc7879 (3dc7879)
AliMUONDigit.cxx
Go to the documentation of this file.
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 //-----------------------------------------------------------------------------
31 //-----------------------------------------------------------------------------
32 
34 ClassImp(AliMUONDigit)
36 
37 //_____________________________________________________________________________
39 :
41 fDetElemId(0),
42 fManuId(0),
43 fManuChannel(0),
44 fSignal(0.0),
45 fPadX(-1),
46 fPadY(-1),
47 fCathode(0),
48 fADC(0),
49 fFlags(0),
50 fNtracks(0),
51 fTcharges(0x0),
52 fTracks(0x0),
53 fHit(0),
54 fTime(0),
55 fStatusMap(0)
56 {
58 }
59 
60 //_____________________________________________________________________________
61 AliMUONDigit::AliMUONDigit(Int_t detElemId, Int_t manuId,
62  Int_t manuChannel, Int_t cathode)
63 :
64 AliMUONVDigit(detElemId,manuId,manuChannel,cathode),
65 fDetElemId(detElemId),
66 fManuId(manuId),
67 fManuChannel(manuChannel),
68 fSignal(0.0),
69 fPadX(-1),
70 fPadY(-1),
71 fCathode(cathode),
72 fADC(0),
73 fFlags(0),
74 fNtracks(0),
75 fTcharges(0x0),
76 fTracks(0x0),
77 fHit(0),
78 fTime(0),
79 fStatusMap(0)
80 {
82 }
83 
84 
85 //_____________________________________________________________________________
87 : AliMUONVDigit(),
88 fDetElemId(0),
89 fManuId(0),
90 fManuChannel(0),
91 fSignal(0.0),
92 fPadX(-1),
93 fPadY(-1),
94 fCathode(0),
95 fADC(0),
96 fFlags(0),
97 fNtracks(0),
98 fTcharges(0x0),
99 fTracks(0x0),
100 fHit(0),
101 fTime(0),
102 fStatusMap(0)
103 {
105 
106  (static_cast<const AliMUONDigit&>(digit)).Copy(*this);
107 }
108 
109 //_____________________________________________________________________________
111 {
113 
114  delete[] fTcharges;
115  delete[] fTracks;
116 }
117 
118 //_____________________________________________________________________________
119 void
120 AliMUONDigit::AddTrack(Int_t trackNumber, Float_t trackCharge)
121 {
124 
125  // First check if track is already there, in which
126  // case we simply increment its charge.
127  for ( Int_t i = 0; i < Ntracks(); ++i )
128  {
129  if ( Track(i) == trackNumber )
130  {
131  fTcharges[i] += trackCharge;
132  return;
133  }
134  }
135 
136  // Nope. It's a brand new track. Make a new array to get space
137  // for it, copy the old array into new one, and add the track.
138  Int_t* newTracks = new Int_t[fNtracks+1];
139  Float_t* newTcharges = new Float_t[fNtracks+1];
140 
141  for ( Int_t i = 0; i < fNtracks; ++i )
142  {
143  newTracks[i] = fTracks[i];
144  newTcharges[i] = fTcharges[i];
145  }
146 
147  newTracks[fNtracks] = trackNumber;
148  newTcharges[fNtracks] = trackCharge;
149 
150  delete[] fTracks;
151  delete[] fTcharges;
152 
153  fTracks = newTracks;
154  fTcharges = newTcharges;
155 
156  ++fNtracks;
157 }
158 
159 //_____________________________________________________________________________
160 void
162 {
164 
165  delete[] fTracks;
166  delete[] fTcharges;
167  fTracks=0x0;
168  fTcharges=0x0;
169  fNtracks=0;
170 }
171 
172 //______________________________________________________________________________
173 void
174 AliMUONDigit::Copy(TObject& obj) const
175 {
177 
178  TObject::Copy(obj);
179  AliMUONDigit& digit = static_cast<AliMUONDigit&>(obj);
180 
181  digit.fDetElemId = fDetElemId;
182  digit.fManuId = fManuId;
183  digit.fManuChannel = fManuChannel;
184  digit.fSignal = fSignal;
185 
186  digit.fPadX = fPadX;
187  digit.fPadY = fPadY;
188  digit.fCathode = fCathode;
189  digit.fADC = fADC;
190  digit.fFlags = fFlags;
191 
192  digit.fNtracks = fNtracks;
193 
194  delete[] digit.fTcharges;
195  delete[] digit.fTracks;
196 
197  if ( fNtracks )
198  {
199  digit.fTcharges = new Float_t[fNtracks];
200  digit.fTracks = new Int_t[fNtracks];
201  }
202 
203  for ( Int_t i=0; i<fNtracks; ++i )
204  {
205  digit.fTcharges[i] = fTcharges[i];
206  digit.fTracks[i] = fTracks[i];
207  }
208 
209  digit.fHit = fHit;
210  digit.fTime = fTime;
211  digit.fStatusMap = fStatusMap;
212 }
213 
214 
215 //_____________________________________________________________________________
216 Bool_t
218 {
220 
221  return (fFlags & fgkNoiseOnlyMask );
222 }
223 
224 //_____________________________________________________________________________
225 Bool_t
227 {
229 
230  return (fFlags & fgkSaturatedMask );
231 }
232 
233 //_____________________________________________________________________________
234 Bool_t
236 {
238 
239  return (fFlags & fgkCalibratedMask );
240 }
241 
242 //_____________________________________________________________________________
243 Bool_t
245 {
247 
248  return (fFlags & fgkConverted);
249 }
250 
251 //_____________________________________________________________________________
252 Bool_t
254 {
256 
257  return (fFlags & fgkChargeInFC);
258 }
259 
260 
261 //_____________________________________________________________________________
262 Bool_t
264 {
266 
267  return (fFlags & fgkUsedMask );
268 }
269 
270 //_____________________________________________________________________________
271 Bool_t
273 {
275 
276  return (fFlags & fgkEfficiencyMask );
277 }
278 
279 //_____________________________________________________________________________
280 void
281 AliMUONDigit::Used(Bool_t value)
282 {
284 
285  if ( value )
286  {
287  fFlags |= fgkUsedMask;
288  }
289  else
290  {
291  fFlags &= ~fgkUsedMask;
292  }
293 }
294 
295 //_____________________________________________________________________________
296 void
298 {
300 
301  if ( value )
302  {
304  }
305  else
306  {
308  }
309 }
310 
311 //_____________________________________________________________________________
312 void
314 {
316 
317  if ( value )
318  {
320  }
321  else
322  {
324  }
325 }
326 
327 //_____________________________________________________________________________
328 Bool_t
330 {
332 
333  Bool_t check = ( src.DetElemId() == DetElemId() &&
334  src.PadX() == PadX() &&
335  src.PadY() == PadY() &&
336  src.Cathode() == Cathode() );
337  if (!check)
338  {
339  return kFALSE;
340  }
341 
342  AddCharge(src.Charge());
343  for ( Int_t i = 0; i < src.Ntracks(); ++i )
344  {
345  AddTrack(src.Track(i),src.TrackCharge(i));
346  }
347  return kTRUE;
348 }
349 
350 //_____________________________________________________________________________
351 void
353 {
355 
356  if ( value )
357  {
359  }
360  else
361  {
363  }
364 }
365 
366 //_____________________________________________________________________________
367 AliMUONDigit&
369 {
371 
372  if ( this != &digit )
373  {
374  digit.Copy(*this);
375  }
376  return *this;
377 }
378 
379 //_____________________________________________________________________________
380 void
382 {
384 
385  for ( Int_t i = 0; i < Ntracks(); ++i )
386  {
387  fTracks[i] += mask;
388  }
389 }
390 
391 //_____________________________________________________________________________
392 void
394 {
396 
397  if ( value )
398  {
400  }
401  else
402  {
404  }
405 }
406 
407 //_____________________________________________________________________________
408 void
410 {
412 
413  if ( value )
414  {
415  fFlags |= fgkConverted;
416  }
417  else
418  {
419  fFlags &= ~fgkConverted;
420  }
421 }
422 
423 //_____________________________________________________________________________
424 void
426 {
428 
429  if ( value )
430  {
432  }
433  else
434  {
435  fFlags &= ~fgkChargeInFC;
436  }
437 }
438 
439 //_____________________________________________________________________________
440 Int_t
441 AliMUONDigit::Track(Int_t i) const
442 {
444 
445  if ( i >= 0 && i < fNtracks )
446  {
447  return fTracks[i];
448  }
449 
450  return -1;
451 }
452 
453 //_____________________________________________________________________________
454 Float_t
456 {
458 
459  if ( i >= 0 && i < fNtracks )
460  {
461  return fTcharges[i];
462  }
463 
464  return -1;
465 }
466 
467 //_____________________________________________________________________________
468 UInt_t
470 {
472 
474 }
virtual Int_t ManuId() const
Return Id of the MANU chip.
Definition: AliMUONDigit.h:50
virtual Int_t Cathode() const
Return cathode number.
Definition: AliMUONDigit.h:36
Int_t fDetElemId
Detection element ID.
Definition: AliMUONDigit.h:94
UInt_t fFlags
Special flags (e.g. is the signal an overflow ?)
Definition: AliMUONDigit.h:103
virtual Int_t PadY() const =0
The y-index of this digit (>=0)
virtual Float_t TrackCharge(Int_t) const
Return the i-th track charge.
Int_t fADC
ADC value.
Definition: AliMUONDigit.h:102
virtual void Calibrated(Bool_t value)
Set the calibrated status (see note 1 in AliMUONVDigit.cxx)
virtual Int_t DetElemId() const
Return detection element ID.
Definition: AliMUONDigit.h:33
Int_t * fTracks
primary MC tracks making this digit
Definition: AliMUONDigit.h:111
Int_t fPadX
Pad number along x.
Definition: AliMUONDigit.h:99
virtual Int_t PadY() const
Return pad number along y.
Definition: AliMUONDigit.h:35
static const UInt_t fgkEfficiencyMask
indicate chamber efficiency has been applied to a simulated digit
Definition: AliMUONDigit.h:122
virtual Int_t Track(Int_t) const
Return the i-th track number.
static const UInt_t fgkChargeInFC
charge unit are femto coulomb
Definition: AliMUONDigit.h:124
virtual Float_t TrackCharge(Int_t i) const
Return the i-th track charge.
virtual Bool_t IsEfficiencyApplied() const
Whether this (simulated) digit got corrected by chamber efficiency.
virtual Bool_t IsNoiseOnly() const
Whether this (simulated) digit is purely noise.
virtual Float_t Charge() const =0
The charge of this digit, calibrated or not depending on IsCalibrated()
virtual void ChargeInFC(Bool_t value=kTRUE)
Set the unit value (see note 1 in AliMUONVDigit.cxx)
virtual Int_t DetElemId() const =0
The detection element this digit belongs to.
Int_t fManuId
Id of the MANU chip.
Definition: AliMUONDigit.h:95
static const UInt_t fgkConverted
has been converted from a real digit
Definition: AliMUONDigit.h:123
virtual Int_t PadX() const
Return pad number along x.
Definition: AliMUONDigit.h:34
virtual void PatchTracks(Int_t mask)
Patch track with a mask.
static const UInt_t fgkSaturatedMask
the mask (part of fFlags) to indicate this digit is saturated
Definition: AliMUONDigit.h:118
virtual void AddCharge(Float_t q)
Add a charge.
Definition: AliMUONVDigit.h:97
virtual Bool_t IsSaturated() const
Whether the ADC has saturated.
virtual Bool_t IsCalibrated() const
Whether this digit has been calibrated or not (see note 1 in AliMUONVDigit.cxx)
Int_t fHit
MC hit number - temporary solution.
Definition: AliMUONDigit.h:113
Int_t fCathode
Cathode number.
Definition: AliMUONDigit.h:101
virtual Int_t Cathode() const =0
Cathode number this digit is on (0 or 1)
MUON digit.
Definition: AliMUONDigit.h:17
virtual Int_t Track(Int_t i) const
Return the i-th track number.
virtual void EfficiencyApplied(Bool_t value=kTRUE)
Set the efficiencyApplied status.
static const UInt_t fgkUsedMask
whether this digit is used by whatever other object (typically a cluster, though) ...
Definition: AliMUONDigit.h:119
virtual Bool_t IsUsed() const
Whether this digit is used somewhere (typically in a cluster)
virtual void Clear(Option_t *)
virtual Int_t PadX() const =0
The x-index of this digit (>=0)
virtual void Saturated(Bool_t saturated=kTRUE)
Set the saturation status.
virtual Bool_t MergeWith(const AliMUONVDigit &other)
Merge this with other.
Int_t fPadY
Pad number along y.
Definition: AliMUONDigit.h:100
static const UInt_t fgkNoiseOnlyMask
indicate a simulated digit due to noise only
Definition: AliMUONDigit.h:121
static UInt_t BuildUniqueID(Int_t detElemId, Int_t manuId, Int_t manuChannel, Int_t cathode)
virtual ~AliMUONDigit()
virtual UInt_t GetUniqueID() const
UInt_t fStatusMap
Neighbouring pad status (whether ped, lv, hv were ok or not)
Definition: AliMUONDigit.h:116
virtual Int_t ManuChannel() const
Return Channel within the MANU chip.
Definition: AliMUONDigit.h:51
virtual void Copy(TObject &digit) const
virtual Int_t Ntracks() const
Number of tracks contributing to this digit.
Int_t fManuChannel
Channel within the MANU chip.
Definition: AliMUONDigit.h:96
ABC of a MUON digit.
Definition: AliMUONVDigit.h:18
virtual void Converted(Bool_t value=kTRUE)
Int_t fNtracks
MC tracks making to this digit.
Definition: AliMUONDigit.h:105
AliMUONDigit & operator=(const AliMUONDigit &rhs)
virtual Bool_t IsConverted() const
Whether or not this digit was obtained from a conversion (e.g. real to simulated) ...
virtual void Used(Bool_t value)
Set the used status.
static const UInt_t fgkCalibratedMask
whether this digits has been calibrated
Definition: AliMUONDigit.h:120
virtual void AddTrack(Int_t trackNumber, Float_t trackCharge)
Add a track (and its charge) to the list of tracks we handle.
virtual Int_t Ntracks() const
Return MC hit age.
Definition: AliMUONDigit.h:44
Float_t fSignal
Signal amplitude.
Definition: AliMUONDigit.h:97
Float_t fTime
MC hit age.
Definition: AliMUONDigit.h:114
virtual void NoiseOnly(Bool_t value=kTRUE)
Set the noiseOnly status.
virtual Bool_t IsChargeInFC() const
Whether this digit has charge in femto coulomb (see note 1 in AliMUONVDigit.cxx)
Float_t * fTcharges
charges of MC track making this digit
Definition: AliMUONDigit.h:108