]>
Commit | Line | Data |
---|---|---|
02a27b50 | 1 | /************************************************************************** |
2 | * Copyright(c) 2004, 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 | /* $Id$ */ | |
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 | |
20 | @ingroup FMD_base | |
21 | */ | |
22 | ////////////////////////////////////////////////////////////////////// | |
23 | // | |
24 | // Digits classes for the FMD | |
25 | // | |
26 | // Digits consists of | |
27 | // - Detector # | |
28 | // - Ring ID | |
29 | // - Sector # | |
30 | // - Strip # | |
31 | // - ADC count in this channel | |
32 | // | |
33 | // Digits consists of | |
34 | // - Detector # | |
35 | // - Ring ID | |
36 | // - Sector # | |
37 | // - Strip # | |
38 | // - Total energy deposited in the strip | |
39 | // - ADC count in this channel | |
40 | // | |
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. | |
44 | /// | |
45 | // +-----------------+ | |
46 | // | AliFMDBaseDigit | | |
47 | // +-----------------+ | |
48 | // ^ | |
49 | // | | |
50 | // +------------+ | |
51 | // | | | |
52 | // +-------------+ +--------------+ | |
53 | // | AliFMDDigit | | AliFMDSDigit | | |
54 | // +-------------+ +--------------+ | |
55 | // | |
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 | |
60 | // not to anyway). | |
61 | // | |
62 | // Latest changes by Christian Holm Christensen | |
63 | // | |
64 | ////////////////////////////////////////////////////////////////////// | |
65 | ||
66 | #include "AliFMDBaseDigit.h" // ALIFMDDIGIT_H | |
67 | #include "Riostream.h" // ROOT_Riostream | |
68 | #include <TString.h> | |
69 | #include <AliLog.h> | |
70 | ||
71 | //==================================================================== | |
72 | ClassImp(AliFMDBaseDigit) | |
73 | #if 0 | |
74 | ; // This is here to keep Emacs from indenting the next line | |
75 | #endif | |
76 | ||
77 | //____________________________________________________________________ | |
78 | AliFMDBaseDigit::AliFMDBaseDigit() | |
79 | : fDetector(0), | |
80 | fRing('\0'), | |
81 | fSector(0), | |
82 | fStrip(0) | |
83 | {} | |
84 | ||
85 | //____________________________________________________________________ | |
86 | AliFMDBaseDigit::AliFMDBaseDigit(UShort_t detector, | |
87 | Char_t ring, | |
88 | UShort_t sector, | |
89 | UShort_t strip) | |
90 | : fDetector(detector), | |
91 | fRing(ring), | |
92 | fSector(sector), | |
93 | fStrip(strip) | |
94 | { | |
95 | // | |
96 | // Creates a base data digit object | |
97 | // | |
98 | // Parameters | |
99 | // | |
100 | // detector Detector # (1, 2, or 3) | |
101 | // ring Ring ID ('I' or 'O') | |
102 | // sector Sector # (For inner/outer rings: 0-19/0-39) | |
103 | // strip Strip # (For inner/outer rings: 0-511/0-255) | |
104 | } | |
105 | ||
106 | //____________________________________________________________________ | |
107 | void | |
108 | AliFMDBaseDigit::Print(Option_t* /* option*/) const | |
109 | { | |
110 | // Print digit to standard out | |
111 | cout << ClassName() << ": FMD" << GetName() << flush; | |
112 | } | |
113 | ||
114 | //____________________________________________________________________ | |
115 | const char* | |
116 | AliFMDBaseDigit::GetName() const | |
117 | { | |
118 | // Get the name of a FMD digit. | |
119 | if (fName.IsNull()) | |
120 | fName = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip); | |
121 | return fName.Data(); | |
122 | } | |
123 | #define fMaxStrips 512 | |
124 | #define fMaxSectors 40 | |
125 | #define fMaxRings 2 | |
126 | ||
127 | //____________________________________________________________________ | |
128 | ULong_t | |
129 | AliFMDBaseDigit::Hash() const | |
130 | { | |
6169f936 | 131 | // Calculate a hash value based on the detector coordinates. |
02a27b50 | 132 | size_t ringi = (fRing == 'I' || fRing == 'i' ? 0 : 1); |
133 | return fStrip + fMaxStrips * | |
134 | (fSector + fMaxSectors * (ringi + fMaxRings * (fDetector - 1))); | |
135 | } | |
136 | ||
137 | ||
138 | //____________________________________________________________________ | |
139 | Int_t | |
140 | AliFMDBaseDigit::Compare(const TObject* o) const | |
141 | { | |
6169f936 | 142 | // Compare to other digit. If the passed pointer to TObject does |
143 | // not point to an object of class AliFMDBaseDigit (or one of it's | |
144 | // derived classes), then a fatal exception is made. | |
145 | // | |
146 | // Returns -1, if this object's detector coordinates are smaller | |
147 | // than passed object's detector coordinates. | |
148 | // | |
149 | // Returns 0, if this object's detector coordinates is the same as | |
150 | // passed object's detector coordinates. | |
151 | // | |
152 | // Returns 1, if this object's detector coordinates are larger | |
153 | // than passed object's detector coordinates. | |
02a27b50 | 154 | if (!o) |
155 | AliFatal("Can not compare to NULL!"); | |
156 | if (o->IsA() != AliFMDBaseDigit::Class()) | |
157 | AliFatal(Form("Cannot compare to a %s object", o->ClassName())); | |
158 | // AliFMDBaseDigit* of = static_cast<AliFMDBaseDigit*>(o); | |
159 | if (Hash() == o->Hash()) return 0; | |
160 | if (Hash() < o->Hash()) return -1; | |
161 | return 1; | |
162 | } | |
163 | ||
164 | ||
165 | //____________________________________________________________________ | |
166 | // | |
167 | // EOF | |
168 | // |