]> git.uio.no Git - u/mrichter/AliRoot.git/blob - HLT/CALO/AliHLTCaloDigitMaker.h
end-of-line normalization
[u/mrichter/AliRoot.git] / HLT / CALO / AliHLTCaloDigitMaker.h
1 //-*- Mode: C++ -*-
2 // $Id$
3
4
5 /**************************************************************************
6  * This file is property of and copyright by the ALICE HLT Project        *
7  * All rights reserved.                                                   *
8  *                                                                        *
9  * Primary Authors: Oystein Djuvsland                                     *
10  *                                                                        *
11  * Permission to use, copy, modify and distribute this software and its   *
12  * documentation strictly for non-commercial purposes is hereby granted   *
13  * without fee, provided that the above copyright notice appears in all   *
14  * copies and that both the copyright notice and this permission notice   *
15  * appear in the supporting documentation. The authors make no claims     *
16  * about the suitability of this software for any purpose. It is          *
17  * provided "as is" without express or implied warranty.                  *
18  **************************************************************************/
19 #ifndef ALIHLTCALODIGITMAKER_H
20 #define ALIHLTCALODIGITMAKER_H
21
22 /**
23  * Class makes digits from information from raw data
24  *
25  * @file   AliHLTCaloDigitMaker.h
26  * @author Oystein Djuvsland
27  * @date
28  * @brief  Digit maker for Calo HLT
29  */
30
31 // see below for class documentation
32 // or
33 // refer to README to build package
34 // or
35 // visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
36
37 //#include "AliHLTCaloBase.h"
38 #include "AliHLTCaloConstantsHandler.h"
39 #include "AliHLTCaloDigitDataStruct.h"
40 #include "AliHLTCaloChannelDataStruct.h"
41 #include "AliHLTDataTypes.h"
42 #include "AliHLTLogging.h"
43 #include "TString.h"
44
45 /**
46  * @class AliHLTCaloDigitMaker
47  * Digit maker for CALO HLT. Takes input from AliHLTCaloRawAnalyzer, and 
48  * outputs a block of AliHLTCaloDigitDataStruct container
49  * @ingroup alihlt_calo
50  */
51
52 class TH2F;
53 class AliHLTCaloSharedMemoryInterfacev2; // added by PTH
54 struct AliHLTCaloChannelDataHeaderStruct;
55 class AliHLTCaloMapper;
56 class AliHLTCaloCoordinate;
57 class TString;
58
59 //using namespace CaloHLTConst;
60 //class AliHLTCaloDigitMaker : public AliHLTCaloBase
61
62
63
64 class AliHLTCaloDigitMaker : AliHLTCaloConstantsHandler, public AliHLTLogging
65 {
66
67 public:
68
69   /** Constructor */
70   AliHLTCaloDigitMaker(TString det);
71
72   /** Destructor */
73   virtual ~AliHLTCaloDigitMaker();
74
75   /**
76    * Sets the pointer to the output
77    * @param digitDataPtr the output pointer
78    */
79   void SetDigitDataPtr(AliHLTCaloDigitDataStruct *digitDataPtr) 
80   { fDigitStructPtr = digitDataPtr; }
81
82   /**
83    * Set the global high gain conversion factory 
84    * @param factor is the conversion factor
85    */
86   void SetGlobalHighGainFactor(Float_t factor);
87
88   /**
89    * Set the global low gain conversion factory 
90    * @param factor is the conversion factor
91    */
92   void SetGlobalLowGainFactor(Float_t factor);
93
94   /**
95    * Make the digits for one event.
96    * @param channelDataHeader is the data header from the AliHLTCaloRawAnalyzer
97    * @return the number of digits found
98    */
99   Int_t MakeDigits(AliHLTCaloChannelDataHeaderStruct* channelDataHeader, AliHLTUInt32_t availableSize);
100
101   /**
102    * Set the mask for dead channels
103    * @param badChannelHGHist is a pointer to a high gain bad channel histogram
104    * @param badChannelLGHist is a pointer to a low gain bad channel histogram
105    * @param qCut is the cut 
106    */
107   void SetBadChannelMask(TH2F* badChannelHGHist, TH2F* badChannelLGHist, Float_t qCut);
108
109    /** 
110    * Set the status of channel 
111    * @param x is x
112    * @param z is z
113    * @param bad if it's bad
114    */
115    void SetBadChannel(Int_t x, Int_t z, Bool_t bad = true);
116    
117    /** 
118    * Set the ADC to energy (GeV) gain 
119    * @param x is x
120    * @param z is z
121    * @param ratio - High/Low ratio
122    * @param gain is the gain
123    */
124    void SetGain(Int_t x, Int_t z, Float_t ratio, Float_t gain);
125    
126    /**
127    * Set the time window for which we accept energy signals
128    * @param min is the minumum time
129    * @param max is the maximum time
130    */
131    void SetTimeWindow(Float_t min, Float_t max) { fMinTime = min; fMaxTime = max; }
132    
133   /** Reset the channel book */
134   void Reset();
135
136   /** Set the mapper */
137   void SetMapper(AliHLTCaloMapper *mapper) { fMapperPtr = mapper; }
138
139 private:
140   
141   AliHLTCaloDigitMaker();
142   
143   /**
144    * Add a new digit
145    * @param channelData is the channel data
146    * @param coordinates is the coordinates of the channel, including gain and module
147    */
148   void AddDigit(AliHLTCaloChannelDataStruct* channelData, AliHLTCaloCoordinate &coord);
149
150   /**
151    * Check if we already have this crystal. If so, keep the high gain as long as it 
152    * is not in overflow. 
153    * @param channelCoordinates is a array of coordinates for the channel.
154    * @param channel is a pointer to a struct containing channel information
155    * @return true if we should use the digit. 
156    */
157   bool UseDigit(AliHLTCaloCoordinate &coord, AliHLTCaloChannelDataStruct *channel);
158
159   /** Pointer to shared memory interface */
160   AliHLTCaloSharedMemoryInterfacev2* fShmPtr;                    //! transient
161
162   /** Pointer to the AliHLTCaloDigitDataStruct */
163   AliHLTCaloDigitDataStruct *fDigitStructPtr;                    //! transient
164
165   /** Digit count */
166   Int_t fDigitCount;                                             //COMMENT
167
168   /** Mapper */
169   AliHLTCaloMapper* fMapperPtr;                                  //COMMENT
170
171   /** High gain energy conversion factors */
172   Float_t **fHighGainFactors;                                    //! transient
173
174   /** Low gain energy conversion factors */
175   Float_t **fLowGainFactors;                                     //!transient
176
177   /** Bad channel mask */
178   Bool_t ***fBadChannelMask;                                    //! transient
179
180   /** Channel book keeping variable */
181   AliHLTCaloDigitDataStruct ***fChannelBook;                     //! transient
182
183   /** Maximum energy we allow in a channel */
184   Float_t fMaxEnergy;                                            //COMMENT
185   
186   /** Minimum accepted time */
187   Float_t fMinTime;                                                       //COMMENT
188   
189   /** Maximum accepted time */            
190   Float_t fMaxTime;                                                //COMMENT
191
192   /** Assignment operator and copy constructor not implemented */
193   AliHLTCaloDigitMaker(const AliHLTCaloDigitMaker &);
194   AliHLTCaloDigitMaker & operator = (const AliHLTCaloDigitMaker &);
195
196   ClassDef(AliHLTCaloDigitMaker, 0); 
197
198 };
199
200 #endif
201