]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDIndex.cxx
Non-implemented private copy constructor and assignment operator
[u/mrichter/AliRoot.git] / FMD / AliFMDIndex.cxx
CommitLineData
55f0ce5b 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 AliFMDDigit.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*/
21//////////////////////////////////////////////////////////////////////
22//
23// Class that holds an FMD index. That is, it holds the detector
24// coordinates for a given strip:
25//
26// Variable | Type | Range | Description
27// ---------+----------+---------+------------------
28// detector | UShort_t | 1-3 | Detector number
29// ring | Char_t | 'I'/'O' | Ring identifier
30// sector | UShort_t | 0-39 | Sector number
31// strip | UShort_t | 0-511 | Strip number
32//
33//////////////////////////////////////////////////////////////////////
34
35#include "AliFMDIndex.h" // ALIFMDINDEX_H
36#include "Riostream.h" // ROOT_Riostream
37#include <TString.h> // ROOT_TString
38#include <AliFMDMap.h>
39
40//====================================================================
41ClassImp(AliFMDIndex)
42#if 0
43 ; // This is here to keep Emacs from indenting the next line
44#endif
45
46//____________________________________________________________________
47AliFMDIndex::AliFMDIndex()
48 : fDetector(0),
49 fRing('\0'),
50 fSector(0),
51 fStrip(0),
b5ee4425 52 fName(""),
53 fHash(-1)
02a27b50 54{
55 // CTOR
56}
55f0ce5b 57
58//____________________________________________________________________
59AliFMDIndex::AliFMDIndex(const AliFMDIndex& o)
60 : fDetector(o.fDetector),
61 fRing(o.fRing),
62 fSector(o.fSector),
63 fStrip(o.fStrip),
b5ee4425 64 fName(""),
55f0ce5b 65 fHash(o.fHash)
66{
67 // Copy constructor
68}
69
70//____________________________________________________________________
71AliFMDIndex::AliFMDIndex(UShort_t detector,
72 Char_t ring,
73 UShort_t sector,
74 UShort_t strip)
75 : fDetector(detector),
76 fRing(ring),
77 fSector(sector),
78 fStrip(strip),
b5ee4425 79 fName(""),
55f0ce5b 80 fHash(-1)
81{
82 //
83 // Creates a base data digit object
84 //
85 // Parameters
86 //
87 // detector Detector # (1, 2, or 3)
88 // ring Ring ID ('I' or 'O')
89 // sector Sector # (For inner/outer rings: 0-19/0-39)
90 // strip Strip # (For inner/outer rings: 0-511/0-255)
91}
92
93//____________________________________________________________________
94AliFMDIndex&
95AliFMDIndex::operator=(const AliFMDIndex& o)
96{
97 // Assignment operator
d015ecfe 98 if (&o == this) return *this;
55f0ce5b 99 fDetector = o.fDetector;
100 fRing = o.fRing;
101 fSector = o.fSector;
102 fStrip = o.fStrip;
103 fHash = o.fHash;
104 return *this;
105}
106
107//____________________________________________________________________
108Int_t
109AliFMDIndex::Hash() const
110{
02a27b50 111 // calculate hash value
55f0ce5b 112 if (fHash < 0) {
113 size_t ringi = (fRing == 'I' || fRing == 'i' ? 0 : 1);
114 fHash = (fStrip +
115 AliFMDMap::kMaxStrips *
116 (fSector + AliFMDMap::kMaxSectors *
117 (ringi + AliFMDMap::kMaxRings * (fDetector-1))));
118 }
119 return fHash;
120}
121
122
123//____________________________________________________________________
124void
125AliFMDIndex::Print(Option_t* /* option*/) const
126{
127 // Print digit to standard out
128 cout << Name() << flush;
129}
130
131//____________________________________________________________________
132const char*
133AliFMDIndex::Name() const
134{
02a27b50 135 // GEt the name of the index
55f0ce5b 136 if (fName.IsNull())
137 fName = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip);
138 return fName.Data();
139}
140
141//====================================================================
142ClassImp(AliFMDObjIndex)
143#if 0
144 ; // This is here to keep Emacs from indenting the next line
145#endif
146
147//____________________________________________________________________
148Int_t
149AliFMDObjIndex::Compare(const TObject* o) const
150{
02a27b50 151 // Compare to another index
55f0ce5b 152 const AliFMDObjIndex* a = dynamic_cast<const AliFMDObjIndex*>(o);
153 if (!a) {
154 Fatal("Compare",
155 "trying to compare to something not a AliFMDObjIndex object, "
156 "but a %s object", o->ClassName());
157 return 0;
158 }
159 if (this->operator<(*a)) return -1;
160 if (this->operator==(*a)) return 0;
161 return 1;
162}
163
164//____________________________________________________________________
165//
166// EOF
167//