]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HLT/PHOS/AliHLTPHOSBaselineAnalyzer.h
Selectiv readout and writing to FXS (oystein)
[u/mrichter/AliRoot.git] / HLT / PHOS / AliHLTPHOSBaselineAnalyzer.h
CommitLineData
5c6503dc 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * All rights reserved. *
4 * *
5 * Primary Authors: Oystein Djuvsland *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16#ifndef ALIHLTPHOSBASELINEANALYZER_H
17#define ALIHLTPHOSBASELINEANALYZER_H
18
2374af72 19/**
20 * Measures the baselines and calculates relevant values
21 *
22 * @file AliHLTPHOSBaselineAnalyzer.h
23 * @author Oystein Djuvsland
24 * @date
25 * @brief Baseline analyzer for PHOS HLT
26 */
27
28// see below for class documentation
29// or
30// refer to README to build package
31// or
32// visit http://web.ift.uib.no/~kjeks/doc/alice-hlt
33
5c6503dc 34#include "AliHLTPHOSConstants.h"
35#include "AliHLTPHOSBase.h"
36
37class AliHLTPHOSRcuCellEnergyDataStruct;
38class AliHLTPHOSValidCellDataStruct;
39class AliHLTPHOSSanityInspector;
40class TTree;
41class TClonesArray;
42class TH1F;
43class TH2F;
44
45using namespace PhosHLTConst;
46
2374af72 47
48/**
49 * @class AliHLTPHOSBaselineAnalyzer
50 * Measures the baseline in a baseline run. It also calculates
51 * RMS of the signal noise in each channel. It takes as input raw signals,
52 * and outputs an object of AliHLTPHOSBaseline class for each channel.
53 * It also creates several histograms for each channel.
54 *
55 * @ingroup alihlt_phos
56 */
57
5c6503dc 58class AliHLTPHOSBaselineAnalyzer : public AliHLTPHOSBase
59{
60
61public:
2374af72 62
63 /** Constructor */
5c6503dc 64 AliHLTPHOSBaselineAnalyzer();
65
2374af72 66 /** Destructor */
5c6503dc 67 virtual ~AliHLTPHOSBaselineAnalyzer();
25b7f84c 68
69 /** Copy constructor */
70 AliHLTPHOSBaselineAnalyzer(const AliHLTPHOSBaselineAnalyzer &) :
71 AliHLTPHOSBase(),
72 fSampleStart(5),
73 fMaxCrazyDifference(0),
74 fMaxSignal(0),
75 fChannelCount(0),
76 fTreePtr(0),
77 fBaselineArrayPtr(0),
78 fRMSHistogramPtr(0),
79 fRMSMapHighGainHistogramPtr(0),
80 fRMSMapLowGainHistogramPtr(0),
81 fFixedRMSHistogramPtr(0),
82 fFixedRMSMapHighGainHistogramPtr(0),
83 fFixedRMSMapLowGainHistogramPtr(0),
84 fSanityInspector(0)
85 {
86 //Copy constructor not implemented
87 }
88
89 /** Assignment */
90 AliHLTPHOSBaselineAnalyzer & operator = (const AliHLTPHOSBaselineAnalyzer)
91 {
92 //Assignment
93 return *this;
94 }
95
2374af72 96 /**
97 * Calculate baselines for an RCU
98 * @param rcuData is a pointer to energy and timing data from an RCU
99 */
5c6503dc 100 void CalculateRcuBaselines(AliHLTPHOSRcuCellEnergyDataStruct* rcuData);
2374af72 101
102 /**
103 * Calculate the baseline of channels
104 * @param cellData is a pointer to a valid channel
105 * @param xOff is the offset in the x position given by the RCU number
106 * @param zOff is the offset in the z position given by the RCU number
107 * @return the baseline
108 */
5c6503dc 109 Float_t CalculateChannelBaseline(AliHLTPHOSValidCellDataStruct *cellData, Int_t xOff, Int_t zOff);
2374af72 110
111 /**
112 * Calculate the accumulated baseline of a channel
113 * @param x is the x coord of the channel
114 * @param z is the z coord of the channel
115 * @param gain is the gain of the channel
116 * @param baseline is the most recent measured baseline
117 */
5c6503dc 118 void CalculateAccumulatedChannelBaseline(Int_t x, Int_t z, Int_t gain, Float_t baseline);
2374af72 119
120 /**
121 * Calculate the channels baseline RMS
122 */
5c6503dc 123 void CalculateChannelsBaselineRMS();
2374af72 124
125
5c6503dc 126 // void CalculateAccumulatedBaselines();
2374af72 127
128 /** Set the ROOT objects to be filled */
5c6503dc 129 void SetRootObjects(TTree *tree, TClonesArray *array);
2374af72 130
131 /** Fill the tree */
5c6503dc 132 void FillTree();
133
2374af72 134 /** Write the accumulated baselines */
5c6503dc 135 void WriteAccumulatedBaselines(const Char_t* filename);
2374af72 136
137 /** Write the channel histograms */
5c6503dc 138 void WriteChannelHistograms(const Char_t* filename);
2374af72 139
140 /** Write the RMS histograms */
5c6503dc 141 void WriteRMSHistogram(const Char_t* filename);
2374af72 142
143 /** Reset the baseline array */
5c6503dc 144 void ResetBaselines();
2374af72 145
146 /** Reset the channel count */
5c6503dc 147 void ResetChannelCount();
2374af72 148
149 /** Reset the accumulated baseline array */
5c6503dc 150 void ResetAccumulatedBaselines();
2374af72 151
152 /** Set the number of samples to be used for the baseline calculation */
5c6503dc 153 void SetNumberOfSamples(Int_t nSamples) { fNSamples = nSamples; }
2374af72 154
155 /** Set the max difference between 2 samples before flagging crazy */
5c6503dc 156 void SetMaxCrazyDifference(Int_t diff);
2374af72 157
158 /** Set the maximum signal before flagging that a real signal is in the samples */
5c6503dc 159 void SetMaxSignal(Int_t max) { fMaxSignal = max; }
160
161 // void SetChannelsHistograms(TH1F *channelLowGainHistArray[N_XCOLUMNS_MOD][N_ZROWS_MOD], TH1F *channelLowGainHistArray[N_XCOLUMNS_MOD][N_ZROWS_MOD]);
162
163
164private:
2374af72 165
166 /** At which time index to start the measuring of the baseline */
af6a2273 167 Int_t fSampleStart; // Shutting up rule checker
2374af72 168
169 /** Not used anymore */
af6a2273 170 Int_t fMaxCrazyDifference; // Shutting up rule checker
2374af72 171
172 /** Maximum signal level, used to not count channels with signals for baseline measurement */
af6a2273 173 Int_t fMaxSignal; // Shutting up rule checker
2374af72 174
175 /** Count of channels, not used anymore */
af6a2273 176 Int_t fChannelCount; // Shutting up rule checker
2374af72 177
178 /** Array containing the baselines of all channels */
af6a2273 179 Float_t fBaselines[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS]; // Shutting up rule checker
2374af72 180
181 /** Array containing the accumulated baselines for all channels */
af6a2273 182 Float_t fAccumulatedBaselines[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS][2]; // Shutting up rule checker
2374af72 183
184 /** Pointer to a tree containing TClonesArray of AliHLTPHOSBaseline objects */
185 TTree *fTreePtr; //! transient
186
187 /** Pointer to an array of AliHLTPHOSBaseline objects */
188 TClonesArray *fBaselineArrayPtr; //! transient
189
190
ab38011b 191 // TH1F *fChannelLowGainHistogramsPtr[N_XCOLUMNS_MOD][N_ZROWS_MOD]; //comment
192 // TH1F *fChannelHighGainHistogramsPtr[N_XCOLUMNS_MOD][N_ZROWS_MOD]; //comment
2374af72 193
194
195 /** Pointer to an array of histograms containg the baselines */
196 TH1F *fChannelHistogramsPtr[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS]; //! transient
197
198 /** Pointer to an array of histograms containg the "fixed" baselines */
199 TH1F *fFixedChannelHistogramsPtr[N_XCOLUMNS_MOD][N_ZROWS_MOD][N_GAINS]; //! transient
200
201 /** Pointer to a histograms containing the RMS values for all channels */
202 TH1F *fRMSHistogramPtr; //! transient
203
204 /** Pointer to a 2D histogram of the high gain RMS */
205 TH2F *fRMSMapHighGainHistogramPtr; //! transient
206
207 /** Pointer to a 2D histogram of the low gain RMS */
208 TH2F *fRMSMapLowGainHistogramPtr; //! transient
209
210 /** Pointer to a histogram containing the "fixed" RMS values for all channels */
211 TH1F *fFixedRMSHistogramPtr; //! transient
212
213 /** Pointer to a 2D histogram of the "fixed" high gain channels */
214 TH2F *fFixedRMSMapHighGainHistogramPtr; //! transient
215
216 /** Pointer to a 2D histogram of the "fixed" low gain channels */
217 TH2F *fFixedRMSMapLowGainHistogramPtr; //! transient
218
219 /** Pointer to a sanity inspector */
220 AliHLTPHOSSanityInspector *fSanityInspector; //! transient
5c6503dc 221
ab38011b 222 ClassDef(AliHLTPHOSBaselineAnalyzer, 1);
5c6503dc 223};
224
225#endif
226