AliRoot Core  v5-06-30 (35d6c57)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AliMUONVDigit.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 //-----------------------------------------------------------------------------
56 //-----------------------------------------------------------------------------
57 
58 #include "AliMUONVDigit.h"
59 
60 #include <Riostream.h>
61 #include <TClass.h>
62 
63 using std::cout;
64 using std::endl;
65 using std::setw;
69 
70 //_____________________________________________________________________________
71 AliMUONVDigit::AliMUONVDigit(Int_t detElemId, Int_t eCardId,
72  Int_t eCardChannel, Int_t cathode)
73 : TObject()
74 {
76  SetUniqueID(BuildUniqueID(detElemId,eCardId,eCardChannel,cathode));
77 }
78 
79 //_____________________________________________________________________________
81 : TObject()
82 {
84 }
85 
86 //_____________________________________________________________________________
88 {
90 }
91 
92 //_____________________________________________________________________________
93 Bool_t
94 AliMUONVDigit::IsEqual(const TObject* object) const
95 {
99 
100  const AliMUONVDigit* d = static_cast<const AliMUONVDigit*>(object);
101 
102  return ( DetElemId() == d->DetElemId() &&
103  Cathode() == d->Cathode() &&
104  ManuId() == d->ManuId() &&
105  ManuChannel() == d->ManuChannel() );
106 }
107 
108 //_____________________________________________________________________________
109 Int_t
110 AliMUONVDigit::Compare(const TObject* object) const
111 {
115  const AliMUONVDigit* d = static_cast<const AliMUONVDigit*>(object);
116 
117  if ( DetElemId() > d->DetElemId() )
118  {
119  return 1;
120  }
121  else if ( DetElemId() < d->DetElemId() )
122  {
123  return -1;
124  }
125  else
126  {
127  if ( Charge() > d->Charge() )
128  {
129  return 1;
130  }
131  else if ( Charge() < d->Charge() )
132  {
133  return -1;
134  }
135  else
136  {
137  if ( ManuId() > d->ManuId() )
138  {
139  return 1;
140  }
141  else if ( ManuId() < d->ManuId() )
142  {
143  return -1;
144  }
145  else
146  {
147  if ( ManuChannel() > d->ManuChannel() )
148  {
149  return 1;
150  }
151  else if ( ManuChannel() < d->ManuChannel() )
152  {
153  return -1;
154  }
155  }
156  }
157  }
158  return 0;
159 }
160 
161 //_____________________________________________________________________________
162 UInt_t
163 AliMUONVDigit::BuildUniqueID(Int_t detElemId, Int_t manuId,
164  Int_t manuChannel, Int_t cathode)
165 {
167  return ( ( detElemId ) | ( manuId << 12 ) | ( manuChannel << 24 )
168  | ( cathode << 30 ) );
169 }
170 
171 //_____________________________________________________________________________
172 Int_t
173 AliMUONVDigit::DetElemId(UInt_t uniqueID)
174 {
176  return uniqueID & 0xFFF;
177 }
178 
179 //_____________________________________________________________________________
180 Int_t
182 {
184  return ( uniqueID & 0x3F000000 ) >> 24;
185 }
186 
187 //_____________________________________________________________________________
188 Int_t
189 AliMUONVDigit::ManuId(UInt_t uniqueID)
190 {
192  return ( uniqueID & 0xFFF000 ) >> 12;
193 }
194 
195 //_____________________________________________________________________________
196 Int_t
197 AliMUONVDigit::Cathode(UInt_t uniqueID)
198 {
200  return ( uniqueID & 0x40000000 ) >> 30;
201 }
202 
203 //_____________________________________________________________________________
204 void
206  Int_t& detElemId, Int_t& manuId,
207  Int_t& manuChannel, Int_t& cathode)
208 {
210  detElemId = DetElemId(uniqueID);
211  manuId = ManuId(uniqueID);
212  manuChannel = ManuChannel(uniqueID);
213  cathode = Cathode(uniqueID);
214 }
215 
216 //_____________________________________________________________________________
217 const char*
219 {
221  return Form("DE%04d-%04d-%02d-%d",
223 }
224 
225 //_____________________________________________________________________________
226 void
227 AliMUONVDigit::Print(Option_t* opt) const
228 {
240 
241  TString options(opt);
242  options.ToLower();
243 
244  if ( options.Contains("zs") )
245  {
246  if ( IsCalibrated() && Charge() <= 0 )
247  {
248  return;
249  }
250 
251  if ( !IsCalibrated() && ADC() <= 0 )
252  {
253  return;
254  }
255  }
256 
257  cout << Form("<%s>: ID %12u DE %4d Cath %d (Ix,Iy)=(%3d,%3d) (Manu,Channel)=(%4d,%2d)"
258  ", Charge=%7.2f",
259  ClassName(),GetUniqueID(),
261 
262 
263  if ( IsSaturated() )
264  {
265  cout << "(S)";
266  }
267  else
268  {
269  cout << " ";
270  }
271 
272  if ( IsCalibrated() )
273  {
274  cout << "(C)";
275  }
276  else
277  {
278  cout << " ";
279  }
280 
281  if ( IsChargeInFC() )
282  {
283  cout << "[fC]";
284  }
285  else
286  {
287  cout << " ";
288  }
289 
290  if ( IsUsed() )
291  {
292  cout << "(U)";
293  }
294  else
295  {
296  cout << " ";
297  }
298 
299  if ( IsNoiseOnly() )
300  {
301  cout << "(+)";
302  }
303  else
304  {
305  cout << " ";
306  }
307 
308  if ( IsConverted() )
309  {
310  cout << "(X)";
311  }
312  else
313  {
314  cout << " ";
315  }
316 
317  cout << Form(" ADC=%4d",ADC());
318 
319  if ( IsCalibrated() )
320  {
321  // StatusMap is not set before calibration has occured (e.g.
322  // SDigits cannot have it meaningfully filled)
323  cout << Form(" StatusMap=%04x",StatusMap());
324  }
325 
326  if ( options.Contains("tracks") && HasMCInformation() )
327  {
328  cout << " Hit " << setw(3) << Hit();
329  Int_t ntracks = Ntracks();
330  if (ntracks)
331  {
332  cout << " Tracks : " << setw(2) << ntracks;
333  for ( Int_t i = 0; i < ntracks; ++i )
334  {
335  cout << " Track(" << i << ")=" << setw(3) << Track(i)
336  << " Charge(" << i << ")=" << setw(5) << TrackCharge(i);
337  }
338  }
339  else
340  {
341  cout << " no track info.";
342  }
343  }
344  cout << endl;
345 }
virtual Int_t ManuChannel() const =0
The channel within ManuId() this digit belongs to (manuChannel for tracker, localBoardChannel for tri...
virtual UInt_t StatusMap() const =0
A word describing the status of the neighbours of this digit.
virtual Int_t Hit() const
Hit number that contributed to this simulated digit.
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.
static void DecodeUniqueID(UInt_t uniqueID, Int_t &detElemId, Int_t &manuId, Int_t &manuChannel, Int_t &cathode)
virtual const char * GetName() const
virtual Int_t ADC() const =0
Raw ADC value of this digit.
virtual Int_t Track(Int_t) const
Return the i-th track number.
virtual Bool_t IsChargeInFC() const
Whether this digit has charge in femto coulomb (see note 1 in AliMUONVDigit.cxx)
Definition: AliMUONVDigit.h:73
virtual Float_t Charge() const =0
The charge of this digit, calibrated or not depending on IsCalibrated()
virtual Bool_t IsCalibrated() const =0
Whether this digit has been calibrated or not (see note 1 in AliMUONVDigit.cxx)
virtual Bool_t IsEqual(const TObject *object) const
virtual Int_t DetElemId() const =0
The detection element this digit belongs to.
virtual Bool_t IsConverted() const
Whether or not this digit was obtained from a conversion (e.g. real to simulated) ...
Definition: AliMUONVDigit.h:78
ClassImp(TPCGenInfo)
Definition: AliTPCCmpNG.C:254
virtual ~AliMUONVDigit()
virtual Bool_t HasMCInformation() const =0
Below are methods only relevant for MC digigts.
virtual Bool_t IsUsed() const =0
Whether this digit is used somewhere (typically in a cluster)
virtual Int_t Cathode() const =0
Cathode number this digit is on (0 or 1)
virtual Int_t PadX() const =0
The x-index of this digit (>=0)
virtual Bool_t IsNoiseOnly() const =0
Whether this (simulated) digit is purely noise.
static UInt_t BuildUniqueID(Int_t detElemId, Int_t manuId, Int_t manuChannel, Int_t cathode)
virtual Int_t Ntracks() const
Number of tracks contributing to this digit.
virtual void Print(Option_t *opt="") const
virtual Int_t ManuId() const =0
The electronic card id this digit belongs to (manuId for tracker, localboardId for trigger) ...
ABC of a MUON digit.
Definition: AliMUONVDigit.h:18
virtual Bool_t IsSaturated() const =0
Whether the ADC has saturated.
virtual Int_t Compare(const TObject *object) const