AliRoot Core  edcc906 (edcc906)
AliFMDUShortMap.cxx
Go to the documentation of this file.
1 /**************************************************************************
2  * Copyright(c) 1998-1999, 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$ */
21 //____________________________________________________________________
22 //
23 // A map of per strip UShort_t information (for example ADC values,
24 // number of hits and so on).
25 // Used for various calib information, and the like,
26 // as well as in reconstruction.
27 // Can be used elsewhere too.
28 //
29 #include "AliFMDUShortMap.h" // ALIFMDUSHORTMAP_H
30 
31 //____________________________________________________________________
32 ClassImp(AliFMDUShortMap)
33 #if 0
34  ; // This is here to keep Emacs for indenting the next line
35 #endif
36 
37 //____________________________________________________________________
39  : AliFMDMap(other.fMaxDetectors, other.fMaxRings, other.fMaxSectors,
40  other.fMaxStrips),
41  fTotal(0),
42  fData(0)
43 {
44  // CTOR
46  fData = new UShort_t[fTotal];
47  for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
48 }
49 
50 
51 
52 //____________________________________________________________________
54  UShort_t maxRing,
55  UShort_t maxSec,
56  UShort_t maxStr)
57  : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
58  fTotal(fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips),
59  fData(0)
60 {
61  // Construct a map
62  //
63  // Parameters:
64  // maxDet Maximum # of detectors
65  // maxRinf Maximum # of rings
66  // maxSec Maximum # of sectors
67  // maxStr Maximum # of strips
68  if (fTotal == 0) fTotal = 51200;
69  fData = new UShort_t[fTotal];
70 }
71 
72 //____________________________________________________________________
74  : AliFMDMap(),
75  fTotal(0),
76  fData(0)
77 {
78  // Construct a map
79  //
80  // Parameters:
81  // None
82 }
83 
84 //____________________________________________________________________
87 {
88  // Assignment operator
89  if (&other == this) return *this;
91  fMaxRings = other.fMaxRings;
92  fMaxSectors = other.fMaxSectors;
93  fMaxStrips = other.fMaxStrips;
94  if (fData) delete [] fData;
96  fData = new UShort_t[fTotal];
97  for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
98  return *this;
99 }
100 
101 //____________________________________________________________________
102 void
103 AliFMDUShortMap::Reset(const UShort_t& val)
104 {
105  // Reset to val
106  for (Int_t i = 0; i < fTotal; i++) fData[i] = val;
107 }
108 
109 //____________________________________________________________________
110 UShort_t&
111 AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str)
112 {
113  // Get data
114  //
115  // Parameters:
116  // det Detector #
117  // ring Ring ID
118  // sec Sector #
119  // str Strip #
120  //
121  // Returns appropriate data
122  //
123  return fData[CalcIndex(det, ring, sec, str)];
124 }
125 
126 //____________________________________________________________________
127 const UShort_t&
128 AliFMDUShortMap::operator()(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
129 {
130  // Get data
131  //
132  // Parameters:
133  // det Detector #
134  // ring Ring ID
135  // sec Sector #
136  // str Strip #
137  //
138  // Returns appropriate data
139  //
140  return fData[CalcIndex(det, ring, sec, str)];
141 }
142 
143 
144 //___________________________________________________________________
145 //
146 // EOF
147 //
Map of an integer per strip.
UShort_t fMaxStrips
Definition: AliFMDMap.h:541
AliFMDUShortMap & operator=(const AliFMDUShortMap &other)
#define fMaxSectors
UShort_t fMaxSectors
Definition: AliFMDMap.h:540
UShort_t fMaxDetectors
Definition: AliFMDMap.h:538
virtual void Reset(const UShort_t &val=UShort_t())
Base class for caches of per-strip information.This is used to index a strip. Data stored depends on ...
Definition: AliFMDMap.h:19
Per strip of unisgned shorts (16 bit) data.
virtual UShort_t & operator()(UShort_t detector, Char_t ring, UShort_t sector, UShort_t strip)
#define fMaxRings
UShort_t * fData
#define fMaxStrips
Int_t CalcIndex(UShort_t det, Char_t ring, UShort_t sec, UShort_t str) const
Definition: AliFMDMap.cxx:192
UShort_t fMaxRings
Definition: AliFMDMap.h:539