]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/AliFMDBoolMap.cxx
Geometry checked and corrected with sampling option.
[u/mrichter/AliRoot.git] / FMD / AliFMDBoolMap.cxx
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 /** @file    AliFMDBoolMap.cxx
19     @author  Christian Holm Christensen <cholm@nbi.dk>
20     @date    Sun Mar 26 18:28:42 2006
21     @brief   Per strip Boolean map
22 */
23 //__________________________________________________________
24 // 
25 // Map of Bool_t for each FMD strip
26 // Used in calibration and the like classes.
27 // Used amoung other things for dead-channel map
28 // Can also be used for other stuff too
29 // Created Mon Nov  8 12:51:51 2004 by Christian Holm Christensen
30 // 
31 #include "AliFMDBoolMap.h"      //ALIFMDBOOLMAP_H
32 //__________________________________________________________
33 ClassImp(AliFMDBoolMap)
34 #if 0
35   ; // This is here to keep Emacs for indenting the next line
36 #endif
37 //__________________________________________________________
38 AliFMDBoolMap::AliFMDBoolMap(const AliFMDBoolMap& other)
39   : AliFMDMap(other.fMaxDetectors,
40               other.fMaxRings,
41               other.fMaxSectors,
42               other.fMaxStrips),
43     fTotal(0),
44     fData(0)
45 {
46   // Copy constructor
47   fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
48   fData  = new Bool_t[fTotal];
49   for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
50 }
51
52 //__________________________________________________________
53 AliFMDBoolMap::AliFMDBoolMap(UShort_t maxDet,
54                          UShort_t maxRing,
55                          UShort_t maxSec,
56                          UShort_t maxStr)
57   : AliFMDMap(maxDet, maxRing, maxSec, maxStr),
58     fTotal(0),
59     fData(0)
60 {
61   // Constructor.
62   // Parameters:
63   //    maxDet  Maximum number of detectors
64   //    maxRing Maximum number of rings per detector
65   //    maxSec  Maximum number of sectors per ring
66   //    maxStr  Maximum number of strips per sector
67   fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
68   fData  = new Bool_t[fTotal];
69   Reset();
70 }
71
72 //__________________________________________________________
73 AliFMDBoolMap&
74 AliFMDBoolMap::operator=(const AliFMDBoolMap& other)
75 {
76   // Assignment operator 
77   fMaxDetectors = other.fMaxDetectors;
78   fMaxRings     = other.fMaxRings;
79   fMaxSectors   = other.fMaxSectors;
80   fMaxStrips    = other.fMaxStrips;
81   if (fData) delete [] fData;
82   fTotal = fMaxDetectors * fMaxRings * fMaxSectors * fMaxStrips;
83   fData  = new Bool_t[fTotal];
84   for (Int_t i = 0; i < fTotal; i++) fData[i] = other.fData[i];
85   return *this;
86 }
87
88 //__________________________________________________________
89 void
90 AliFMDBoolMap::Reset(const Bool_t& val)
91 {
92   // Reset map to val
93   for (Int_t i = 0; i < fTotal; i++) fData[i] = val;
94 }
95
96 //__________________________________________________________
97 Bool_t&
98 AliFMDBoolMap::operator()(UShort_t det, 
99                           Char_t   ring, 
100                           UShort_t sec, 
101                           UShort_t str)
102 {
103   // Get data
104   // Parameters:
105   //    det     Detector #
106   //    ring    Ring ID
107   //    sec     Sector #
108   //    str     Strip #
109   // Returns appropriate data
110   return fData[CalcIndex(det, ring, sec, str)];
111 }
112
113 //__________________________________________________________
114 const Bool_t&
115 AliFMDBoolMap::operator()(UShort_t det, 
116                           Char_t   ring, 
117                           UShort_t sec, 
118                           UShort_t str) const
119 {
120   // Get data
121   // Parameters:
122   //    det     Detector #
123   //    ring    Ring ID
124   //    sec     Sector #
125   //    str     Strip #
126   // Returns appropriate data
127   return fData[CalcIndex(det, ring, sec, str)];
128 }
129
130 //__________________________________________________________
131 // 
132 // EOF
133 // 
134