1 /**************************************************************************
2 * Copyright(c) 2004, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 /** @file AliFMDBaseDigit.cxx
17 @author Christian Holm Christensen <cholm@nbi.dk>
18 @date Mon Mar 27 12:37:41 2006
19 @brief Digits for the FMD
22 //////////////////////////////////////////////////////////////////////
24 // Digits classes for the FMD
31 // - ADC count in this channel
38 // - Total energy deposited in the strip
39 // - ADC count in this channel
41 // As the Digits and SDigits have so much in common, the classes
42 // AliFMDDigit and AliFMDSDigit are implemented via a base
43 // class AliFMDBaseDigit.
45 // +-----------------+
46 // | AliFMDBaseDigit |
47 // +-----------------+
52 // +-------------+ +--------------+
53 // | AliFMDDigit | | AliFMDSDigit |
54 // +-------------+ +--------------+
56 // (Note, that I'd really would have liked to implement AliFMDHit as a
57 // derived class from some base class - say AliFMDStrip, and the Digit
58 // classes would (eventually) have derived from that as well.
59 // However, ROOT doesn't do well with multiple inheritance, so I chose
62 // Latest changes by Christian Holm Christensen
64 //////////////////////////////////////////////////////////////////////
66 #include "AliFMDBaseDigit.h" // ALIFMDDIGIT_H
67 #include "Riostream.h" // ROOT_Riostream
71 //====================================================================
72 ClassImp(AliFMDBaseDigit)
74 ; // This is here to keep Emacs from indenting the next line
77 //____________________________________________________________________
78 AliFMDBaseDigit::AliFMDBaseDigit()
86 //____________________________________________________________________
87 AliFMDBaseDigit::AliFMDBaseDigit(UShort_t detector,
91 : fDetector(detector),
98 // Creates a base data digit object
102 // detector Detector # (1, 2, or 3)
103 // ring Ring ID ('I' or 'O')
104 // sector Sector # (For inner/outer rings: 0-19/0-39)
105 // strip Strip # (For inner/outer rings: 0-511/0-255)
108 //____________________________________________________________________
110 AliFMDBaseDigit::Print(Option_t* /* option*/) const
112 // Print digit to standard out
113 cout << ClassName() << ": FMD" << GetName() << flush;
116 //____________________________________________________________________
118 AliFMDBaseDigit::GetName() const
120 // Get the name of a FMD digit.
122 fName = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip);
125 #define fMaxStrips 512
126 #define fMaxSectors 40
129 //____________________________________________________________________
131 AliFMDBaseDigit::Hash() const
133 // Calculate a hash value based on the detector coordinates.
134 size_t ringi = (fRing == 'I' || fRing == 'i' ? 0 : 1);
135 return fStrip + fMaxStrips *
136 (fSector + fMaxSectors * (ringi + fMaxRings * (fDetector - 1)));
140 //____________________________________________________________________
142 AliFMDBaseDigit::Compare(const TObject* o) const
144 // Compare to other digit. If the passed pointer to TObject does
145 // not point to an object of class AliFMDBaseDigit (or one of it's
146 // derived classes), then a fatal exception is made.
148 // Returns -1, if this object's detector coordinates are smaller
149 // than passed object's detector coordinates.
151 // Returns 0, if this object's detector coordinates is the same as
152 // passed object's detector coordinates.
154 // Returns 1, if this object's detector coordinates are larger
155 // than passed object's detector coordinates.
157 AliFatal("Can not compare to NULL!");
158 if (o->IsA() != AliFMDBaseDigit::Class())
159 AliFatal(Form("Cannot compare to a %s object", o->ClassName()));
160 // AliFMDBaseDigit* of = static_cast<AliFMDBaseDigit*>(o);
161 if (Hash() == o->Hash()) return 0;
162 if (Hash() < o->Hash()) return -1;
167 //____________________________________________________________________