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 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
21 //////////////////////////////////////////////////////////////////////
23 // Class that holds an FMD index. That is, it holds the detector
24 // coordinates for a given strip:
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
33 //////////////////////////////////////////////////////////////////////
35 #include "AliFMDIndex.h" // ALIFMDINDEX_H
36 #include "Riostream.h" // ROOT_Riostream
37 #include <TString.h> // ROOT_TString
38 #include <AliFMDMap.h>
40 //====================================================================
43 ; // This is here to keep Emacs from indenting the next line
46 //____________________________________________________________________
47 AliFMDIndex::AliFMDIndex()
58 //____________________________________________________________________
59 AliFMDIndex::AliFMDIndex(const AliFMDIndex& o)
60 : fDetector(o.fDetector),
70 //____________________________________________________________________
71 AliFMDIndex::AliFMDIndex(UShort_t detector,
75 : fDetector(detector),
83 // Creates a base data digit object
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)
93 //____________________________________________________________________
95 AliFMDIndex::operator=(const AliFMDIndex& o)
97 // Assignment operator
98 if (&o == this) return *this;
99 fDetector = o.fDetector;
107 //____________________________________________________________________
109 AliFMDIndex::Hash() const
111 // calculate hash value
113 size_t ringi = (fRing == 'I' || fRing == 'i' ? 0 : 1);
115 AliFMDMap::kMaxStrips *
116 (fSector + AliFMDMap::kMaxSectors *
117 (ringi + AliFMDMap::kMaxRings * (fDetector-1))));
123 //____________________________________________________________________
125 AliFMDIndex::Print(Option_t* /* option*/) const
127 // Print digit to standard out
128 cout << Name() << flush;
131 //____________________________________________________________________
133 AliFMDIndex::Name() const
135 // GEt the name of the index
137 fName = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip);
141 //====================================================================
142 ClassImp(AliFMDObjIndex)
144 ; // This is here to keep Emacs from indenting the next line
147 //____________________________________________________________________
149 AliFMDObjIndex::Compare(const TObject* o) const
151 // Compare to another index
152 const AliFMDObjIndex* a = dynamic_cast<const AliFMDObjIndex*>(o);
155 "trying to compare to something not a AliFMDObjIndex object, "
156 "but a %s object", o->ClassName());
159 if (this->operator<(*a)) return -1;
160 if (this->operator==(*a)) return 0;
164 //____________________________________________________________________