]> git.uio.no Git - u/mrichter/AliRoot.git/blob - FMD/FMDbase/AliFMDBoolMap.h
FMD module
[u/mrichter/AliRoot.git] / FMD / FMDbase / AliFMDBoolMap.h
1 #ifndef ALIFMDBOOLMAP_H
2 #define ALIFMDBOOLMAP_H
3 /* Copyright (c) 2004, ALICE Experiment @ CERN.
4  * All rights reserved
5  * See AliFMDBoolMap.cxx for full copyright notice
6  * 
7  * Created Mon Nov  8 12:51:51 2004 by Christian Holm Christensen
8  */
9 /* $Id$ */
10 /** @file    AliFMDBoolMap.h
11     @author  Christian Holm Christensen <cholm@nbi.dk>
12     @date    Sun Mar 26 18:28:59 2006
13     @brief   Per strip boolean map
14 */
15 //__________________________________________________________
16 // 
17 // Map of Bool_t for each FMD strip
18 // Used in calibration and the like classes.
19 // Used amoung other things for dead-channel map
20 // 
21 #ifndef ALIFMDMAP_H
22 # include <AliFMDMap.h>
23 #endif
24
25 /** @class AliFMDBoolMap 
26     @brief MAp of per strip boolean values. 
27     @ingroup FMD_base
28  */
29 class AliFMDBoolMap : public AliFMDMap
30 {
31 public:
32   /** Copy constructor 
33       @param other Object to copy from. */
34   AliFMDBoolMap(const AliFMDBoolMap& other);
35   /** 
36    * Constructor 
37    */
38   AliFMDBoolMap();
39   /** Constructor 
40       @param maxDet  Number of detectors (3)
41       @param maxRing Number of rings (2)
42       @param maxSec  Number of sectors (40)
43       @param maxStr  Number of strips (20) */
44   AliFMDBoolMap(UShort_t maxDet,
45                 UShort_t maxRing = 0,
46                 UShort_t maxSec  = 0,
47                 UShort_t maxStr  = 0);
48   /** Destructor */
49   virtual ~AliFMDBoolMap() { if (fData) delete [] fData; }
50   /** Assignment operator 
51       @param other Object to assign from 
52       @return reference to this object.  */
53   AliFMDBoolMap& operator=(const AliFMDBoolMap& other);
54   /** Reset to value 
55       @param v Value to reset from */
56   virtual void Reset(const Bool_t& v=Bool_t());
57   /** Access operator 
58       @param det   Detector 
59       @param ring  Ring 
60       @param sec   Sector  
61       @param str   Strip
62       @return  reference value stored for the strip */
63   virtual Bool_t& operator()(UShort_t det,
64                              Char_t   ring,
65                              UShort_t sec,
66                              UShort_t str);
67   /** Access operator 
68       @param det   Detector 
69       @param ring  Ring 
70       @param sec   Sector  
71       @param str   Strip
72       @return  value stored for the strip */
73   virtual const Bool_t& operator()(UShort_t det,
74                                    Char_t   ring,
75                                    UShort_t sec,
76                                    UShort_t str) const;
77   Bool_t* Data() const { return fData; }
78   Int_t   Total() const { return fTotal; }
79   void*   Ptr() const { return reinterpret_cast<void*>(fData); }
80 protected:
81   Int_t     MaxIndex()            const { return fTotal; }
82   Bool_t    AtAsBool(Int_t idx)   const { return fData[idx]; }
83   Bool_t&   AtAsBool(Int_t idx)         { return fData[idx]; }
84   Bool_t    IsBool()              const { return kTRUE; }  
85   Int_t     AtAsInt(Int_t idx)    const { return fData[idx] ? 1   : 0;   }
86   Float_t   AtAsFloat(Int_t idx)  const { return fData[idx] ? 1.F : 0.F; }
87   UShort_t  AtAsUShort(Int_t idx) const { return fData[idx] ? 1   : 0;   }
88   Int_t&    AtAsInt(Int_t idx)          { return AliFMDMap::AtAsInt(idx);    }
89   Float_t&  AtAsFloat(Int_t idx)        { return AliFMDMap::AtAsFloat(idx);  }
90   UShort_t& AtAsUShort(Int_t idx)       { return AliFMDMap::AtAsUShort(idx); }
91   Int_t  fTotal; // Total number of entries 
92   Bool_t* fData;  // [fTotal] The Data
93   ClassDef(AliFMDBoolMap,3) // Map of Bool_t data per strip
94 };
95
96 #endif
97 //__________________________________________________________
98 // 
99 // Local Variables:
100 //   mode: C++
101 // End:
102 //