]> git.uio.no Git - u/mrichter/AliRoot.git/blame - FMD/AliFMDIndex.cxx
Zero mis-alignment parameters for FMD (C.Cheshkov using AliFMDAlignFaker)
[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),
52 fHash(-1)
53{}
54
55//____________________________________________________________________
56AliFMDIndex::AliFMDIndex(const AliFMDIndex& o)
57 : fDetector(o.fDetector),
58 fRing(o.fRing),
59 fSector(o.fSector),
60 fStrip(o.fStrip),
61 fHash(o.fHash)
62{
63 // Copy constructor
64}
65
66//____________________________________________________________________
67AliFMDIndex::AliFMDIndex(UShort_t detector,
68 Char_t ring,
69 UShort_t sector,
70 UShort_t strip)
71 : fDetector(detector),
72 fRing(ring),
73 fSector(sector),
74 fStrip(strip),
75 fHash(-1)
76{
77 //
78 // Creates a base data digit object
79 //
80 // Parameters
81 //
82 // detector Detector # (1, 2, or 3)
83 // ring Ring ID ('I' or 'O')
84 // sector Sector # (For inner/outer rings: 0-19/0-39)
85 // strip Strip # (For inner/outer rings: 0-511/0-255)
86}
87
88//____________________________________________________________________
89AliFMDIndex&
90AliFMDIndex::operator=(const AliFMDIndex& o)
91{
92 // Assignment operator
93 fDetector = o.fDetector;
94 fRing = o.fRing;
95 fSector = o.fSector;
96 fStrip = o.fStrip;
97 fHash = o.fHash;
98 return *this;
99}
100
101//____________________________________________________________________
102Int_t
103AliFMDIndex::Hash() const
104{
105 if (fHash < 0) {
106 size_t ringi = (fRing == 'I' || fRing == 'i' ? 0 : 1);
107 fHash = (fStrip +
108 AliFMDMap::kMaxStrips *
109 (fSector + AliFMDMap::kMaxSectors *
110 (ringi + AliFMDMap::kMaxRings * (fDetector-1))));
111 }
112 return fHash;
113}
114
115
116//____________________________________________________________________
117void
118AliFMDIndex::Print(Option_t* /* option*/) const
119{
120 // Print digit to standard out
121 cout << Name() << flush;
122}
123
124//____________________________________________________________________
125const char*
126AliFMDIndex::Name() const
127{
128 if (fName.IsNull())
129 fName = Form("FMD%d%c[%2d,%3d]", fDetector, fRing, fSector, fStrip);
130 return fName.Data();
131}
132
133//====================================================================
134ClassImp(AliFMDObjIndex)
135#if 0
136 ; // This is here to keep Emacs from indenting the next line
137#endif
138
139//____________________________________________________________________
140Int_t
141AliFMDObjIndex::Compare(const TObject* o) const
142{
143 const AliFMDObjIndex* a = dynamic_cast<const AliFMDObjIndex*>(o);
144 if (!a) {
145 Fatal("Compare",
146 "trying to compare to something not a AliFMDObjIndex object, "
147 "but a %s object", o->ClassName());
148 return 0;
149 }
150 if (this->operator<(*a)) return -1;
151 if (this->operator==(*a)) return 0;
152 return 1;
153}
154
155//____________________________________________________________________
156//
157// EOF
158//