Added classes to make fake calibration constants, and alignment data.
[u/mrichter/AliRoot.git] / FMD / AliFMDBoolMap.cxx
CommitLineData
56b1929b 1/**************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN. *
3 * All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this *
9 * software and its documentation strictly for non-commercial *
10 * purposes is hereby granted without fee, provided that the *
11 * above copyright notice appears in all copies and that both *
12 * the copyright notice and this permission notice appear in *
13 * the supporting documentation. The authors make no claims *
14 * about the suitability of this software for any purpose. It *
15 * is provided "as is" without express or implied warranty. *
16 **************************************************************/
17/* $Id$ */
18//__________________________________________________________
19//
088f8e79 20// Map of Bool_t for each FMD strip
21// Used in calibration and the like classes.
22// Used amoung other things for dead-channel map
23// Can also be used for other stuff too
56b1929b 24// Created Mon Nov 8 12:51:51 2004 by Christian Holm Christensen
25//
26#include "AliFMDBoolMap.h" //ALIFMDBOOLMAP_H
27//__________________________________________________________
925e6570 28ClassImp(AliFMDBoolMap)
1a1fdef7 29#if 0
30 ; // This is here to keep Emacs for indenting the next line
31#endif
56b1929b 32//__________________________________________________________
33AliFMDBoolMap::AliFMDBoolMap(const AliFMDBoolMap& other)
34 : AliFMDMap(other.fMaxDetectors,
35 other.fMaxRings,
36 other.fMaxSectors,
37 other.fMaxStrips),
38 fData(0)
39{
40 // Copy constructor
41 fData = new Bool_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
42 for (size_t i = 0; i < fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips; i++)
43 fData[i] = other.fData[i];
44}
45
46//__________________________________________________________
47AliFMDBoolMap::AliFMDBoolMap(size_t maxDet,
48 size_t maxRing,
49 size_t maxSec,
50 size_t maxStr)
51 : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
52 fData(0)
53{
54 // Constructor.
55 // Parameters:
56 // maxDet Maximum number of detectors
57 // maxRing Maximum number of rings per detector
58 // maxSec Maximum number of sectors per ring
59 // maxStr Maximum number of strips per sector
60 fData = new Bool_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
69b696b9 61 Reset();
56b1929b 62}
63
64//__________________________________________________________
65AliFMDBoolMap&
66AliFMDBoolMap::operator=(const AliFMDBoolMap& other)
67{
68 // Assignment operator
69 fMaxDetectors = other.fMaxDetectors;
70 fMaxRings = other.fMaxRings;
71 fMaxSectors = other.fMaxSectors;
72 fMaxStrips = other.fMaxStrips;
73 if (fData) delete [] fData;
74 fData = new Bool_t[fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips];
75 for (size_t i = 0; i < fMaxDetectors * fMaxRings
76 * fMaxSectors * fMaxStrips; i++)
77 fData[i] = other.fData[i];
78 return *this;
79}
80
81//__________________________________________________________
82void
69b696b9 83AliFMDBoolMap::Reset(const Bool_t& val)
56b1929b 84{
85 // Reset map to val
86 for (size_t i = 0; i < fMaxDetectors * fMaxRings
87 * fMaxSectors * fMaxStrips; i++)
88 fData[i] = val;
89}
90
91//__________________________________________________________
92Bool_t&
93AliFMDBoolMap::operator()(UShort_t det,
94 Char_t ring,
95 UShort_t sec,
96 UShort_t str)
97{
98 // Get data
99 // Parameters:
100 // det Detector #
101 // ring Ring ID
102 // sec Sector #
103 // str Strip #
104 // Returns appropriate data
105 return fData[CalcIndex(det, ring, sec, str)];
106}
107
108//__________________________________________________________
109const Bool_t&
110AliFMDBoolMap::operator()(UShort_t det,
111 Char_t ring,
112 UShort_t sec,
113 UShort_t str) const
114{
115 // Get data
116 // Parameters:
117 // det Detector #
118 // ring Ring ID
119 // sec Sector #
120 // str Strip #
121 // Returns appropriate data
122 return fData[CalcIndex(det, ring, sec, str)];
123}
124
125//__________________________________________________________
126//
127// EOF
128//
129