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