]> git.uio.no Git - u/mrichter/AliRoot.git/blame - EMCAL/AliCaloCalibSignal.h
correcting HLT build system (bug https://savannah.cern.ch/bugs/?56546)
[u/mrichter/AliRoot.git] / EMCAL / AliCaloCalibSignal.h
CommitLineData
bd83f412 1#ifndef ALICALOCALIBSIGNAL_H
2#define ALICALOCALIBSIGNAL_H
3
4/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
5 * See cxx source for full Copyright notice */
6
7/* $Id: AliCaloCalibSignal.h $ */
8
9// \file AliCaloCalibSignal.h
10// \brief Description:
11// A help class for monitoring and calibration tools: MOOD, AMORE etc.,
32cd4c24 12// that can process events from a standard AliCaloRawStreamV3,
bd83f412 13// most usually from LED/pulser runs. It stores signal info as
14// typical (highest) amplitude vs time in TGraphs (one per channel)
15// or TProfiles if we decide to just store the averages (and not all points)
16// for the detectors (EMCAL and PHOS).
17
18// \author: Josh Hamblen (UTenn), original version.
19// [Consultant: D. Silvermyr (ORNL)]
20// Partly based on AliCaloCalibPedestal.
21//
22// \version $Revision: $
23// \date $Date: $
24
8bcca84c 25#include "TString.h"
26#include "TTree.h"
bd3cd9c2 27#include "AliEMCALGeoParams.h"
32cd4c24 28class AliCaloRawStreamV3;
f4fc542c 29class AliCaloAltroMapping;
30class AliRawReader;
bd83f412 31
32class AliCaloCalibSignal : public TObject {
33
34 public:
35
36 enum kDetType {kPhos, kEmCal, kNone};//The detector types
37
38 AliCaloCalibSignal(kDetType detectorType = kPhos); //ctor
39 virtual ~AliCaloCalibSignal(); //dtor
40
41 // copy ctor, and '=' operator, are not fully tested/debugged yet
42 AliCaloCalibSignal(const AliCaloCalibSignal &sig); // copy ctor
43 AliCaloCalibSignal& operator = (const AliCaloCalibSignal &source); //!
44
f4fc542c 45 // Event processing methods:
46 Bool_t ProcessEvent(AliRawReader *rawReader);
b07ee441 47 Bool_t ProcessEvent(AliCaloRawStreamV3 *in, UInt_t Timestamp); // added header for time info
5ea60b80 48 Bool_t CheckFractionAboveAmp(int *AmpVal, int resultArray[]); // check fraction of signals to check for LED events
bd83f412 49
f4fc542c 50 // Mapping handling
51 AliCaloAltroMapping **GetAltroMapping() { return fMapping; };
52 void SetAltroMapping(AliCaloAltroMapping **mapp) { fMapping = mapp; };
53
b07ee441 54 // Parameter/cut handling
55 void SetParametersFromFile(const char *parameterFile);
56 void WriteParametersToFile(const char *parameterFile);
57
bd83f412 58 ////////////////////////////
59 //Simple getters
8bcca84c 60 // for TTree
61 TTree * GetTreeAmpVsTime() const { return fTreeAmpVsTime; } //!
62 TTree * GetTreeAvgAmpVsTime() const {return fTreeAvgAmpVsTime; } //!
5e99faca 63 TTree * GetTreeLEDAmpVsTime() const {return fTreeLEDAmpVsTime; } //!
64 TTree * GetTreeLEDAvgAmpVsTime() const {return fTreeLEDAvgAmpVsTime; } //!
8bcca84c 65
66 // how many points do we have for each tower&gain
bd83f412 67 int GetNHighGain(int imod, int icol, int irow) const //!
68 { int towId = GetTowerNum(imod, icol, irow); return fNHighGain[towId];}; //!
69 int GetNLowGain(int imod, int icol, int irow) const //!
70 { int towId = GetTowerNum(imod, icol, irow); return fNLowGain[towId];}; //!
71 int GetNHighGain(int towId) const { return fNHighGain[towId];}; //!
72 int GetNLowGain(int towId) const { return fNLowGain[towId];}; //!
73
5e99faca 74 // also for LED reference
75 int GetNRef(int imod, int istripMod, int igain) const //!
76 { int refId = GetRefNum(imod, istripMod, igain); return fNRef[refId];}; //!
77 int GetNRef(int refId) const { return fNRef[refId];}; //!
78
bd83f412 79 // Basic info: getters
80 kDetType GetDetectorType() const {return fDetType;};//Returns if this is a PHOS or EMCAL object
f4fc542c 81 TString GetCaloString() const {return fCaloString;}; //Returns if this is a PHOS or EMCAL object
82
bd83f412 83 int GetColumns() const {return fColumns;}; //The number of columns per module
84 int GetRows() const {return fRows;}; //The number of rows per module
5e99faca 85 int GetLEDRefs() const {return fLEDRefs;}; //The number of LED references/monitors per module
bd83f412 86 int GetModules() const {return fModules;}; //The number of modules
8bcca84c 87 int GetTowerNum(int imod, int icol, int irow) const { return (imod*fColumns*fRows + icol*fRows + irow);}; // help index
88
89 int GetChannelNum(int imod, int icol, int irow, int igain) const { return (igain*fModules*fColumns*fRows + imod*fColumns*fRows + icol*fRows + irow);}; // channel number with gain included
90
91 Bool_t DecodeChannelNum(int chanId, int *imod, int *icol, int *irow, int *igain) const {
92 *igain = chanId/(fModules*fColumns*fRows);
93 *imod = (chanId/(fColumns*fRows)) % fModules;
94 *icol = (chanId/fRows) % fColumns;
95 *irow = chanId % fRows;
8bcca84c 96 return kTRUE;
97 }; // return the module, column, row, and gain for a given channel number
bd83f412 98
5e99faca 99 // LED reference indexing
100 int GetRefNum(int imod, int istripMod, int igain) const { return (igain*fModules*fLEDRefs + imod*fLEDRefs + istripMod);}; // channel number with gain included
101
102 Bool_t DecodeRefNum(int refId, int *imod, int *istripMod, int *igain) const {
103 *igain = refId/(fModules*fLEDRefs);
104 *imod = (refId/(fLEDRefs)) % fModules;
105 *istripMod = refId % fLEDRefs;
106 return kTRUE;
107 }; // return the module, stripModule, and gain for a given reference number
108
bd83f412 109 // Basic Counters
110 int GetNEvents() const {return fNEvents;};
111 int GetNAcceptedEvents() const {return fNAcceptedEvents;};
112
113 ///////////////////////////////
114 // Get and Set Cuts
115 // Section for if we should help with the event selection of what is likely LED events
116 void SetAmpCut(double d) { fAmpCut = d; } //!
117 double GetAmpCut() const { return fAmpCut; }; //!
118 void SetReqFractionAboveAmpCutVal(double d) { fReqFractionAboveAmpCutVal = d; } //!
119 double GetReqFractionAboveAmpCutVal() const { return fReqFractionAboveAmpCutVal; }; //!
120 void SetReqFractionAboveAmp(bool b) { fReqFractionAboveAmp = b; } //!
8bcca84c 121 bool GetReqFractionAboveAmp() const { return fReqFractionAboveAmp; }; //!
bd83f412 122
8bcca84c 123 // We may select to get averaged info
bd83f412 124 void SetUseAverage(bool b) { fUseAverage = b; } //!
8bcca84c 125 bool GetUseAverage() const { return fUseAverage; }; //!
bd83f412 126 void SetSecInAverage(int secInAverage) {fSecInAverage = secInAverage;}; // length of the interval that should be used for the average calculation (determines number of bins in TProfile)
127 int GetSecInAverage() const {return fSecInAverage;}; //!
128
129 // Info on time since start of run
130 double GetHour() const { return fHour; }; // time info for current event
131 double GetCurrentHour() const { return fHour; }; // time info for current event (same as GetHour(), just more explicitly named)
132 double GetLatestHour() const { return fLatestHour; }; // the latest time encountered
133 // These times are typically the same, but not necessarily if the events do not come in order
134 void SetLatestHour(double d) { fLatestHour = d; }; // could be useful when we know the length of the run (i.e. after it is over), e.g. for PreProcessor
135
136 // RunNumbers : setters and getters
137 void SetRunNumber(int runNo) {fRunNumber = runNo;}; //!
138 int GetRunNumber() const {return fRunNumber;}; //!
139
140 // Start-of-run timestamp : set and get
141 void SetStartTime(int startTime) {fStartTime = startTime;}; //!
142 int GetStartTime() const {return fStartTime;}; //!
143
144 /////////////////////////////
145 //Analysis functions
8bcca84c 146 void ResetInfo();// trees and counters.
bd83f412 147 Bool_t AddInfo(const AliCaloCalibSignal *sig);//picks up new info from supplied argument
148
149 //Saving functions
8bcca84c 150 Bool_t Save(TString fileName); //Saves the objects to a .root file
151 Bool_t Analyze(); // makes average tree and summary tree
bd83f412 152
153 private:
8bcca84c 154
155 void DeleteTrees(); // delete old objects and set pointers
bd83f412 156 void Zero(); // set all counters to 0
8bcca84c 157 void CreateTrees(); //! create/setup the TTrees
bd83f412 158
159 private:
160
161 kDetType fDetType; //The detector type for this object
162 int fColumns; //The number of columns per module
163 int fRows; //The number of rows per module
5e99faca 164 int fLEDRefs; //The number of LED references/monitors per module
bd83f412 165 int fModules; //The number of modules
f4fc542c 166 TString fCaloString; // id for which detector type we have
167 AliCaloAltroMapping **fMapping; //! Altro Mapping object
bd83f412 168 int fRunNumber; //The run number. Needs to be set by the user.
169 int fStartTime; // Time of first event
170
171 double fAmpCut; // amplitude cut value
172 double fReqFractionAboveAmpCutVal; // required fraction that should be above cut
173 bool fReqFractionAboveAmp; // flag to select if we should do some event selection based on amplitudes
174
175 double fHour; // fraction of hour since beginning of run, for amp vs. time graphs, for current event
176 double fLatestHour; // largest fraction of hour since beginning of run, for amp vs. time graphs
177 bool fUseAverage; // flag to average graph points into over a time interval
178 int fSecInAverage; // time interval for the graph averaging
179
180 // status counters
181 int fNEvents; // # events processed
182 int fNAcceptedEvents; // # events accepted
183
bd3cd9c2 184 //Constants needed by the class: EMCAL ones are kept in AliEMCALGeoParams.h
bd83f412 185 static const int fgkPhosRows = 64; // number of rows per module for PHOS
186 static const int fgkPhosCols = 56; // number of columns per module for PHOS
5e99faca 187 static const int fgkPhosLEDRefs = 0; // no LED monitor channels for PHOS
bd83f412 188 static const int fgkPhosModules = 5; // number of modules for PHOS
189
bd83f412 190 // From numbers above: PHOS has more possible towers (17920) than EMCAL (13824)
191 // so use PHOS numbers to set max. array sizes
192 static const int fgkMaxTowers = 17920; // fgkPhosModules * fgkPhosCols * fgkPhosRows;
5e99faca 193 // for LED references; maximum from EMCAL
bd3cd9c2 194 static const int fgkMaxRefs = 288; // AliEMCALGeoParams::fgkEMCALModules * AliEMCALGeoParams::fgkEMCALLEDRefs
5e99faca 195
bd83f412 196 static const int fgkNumSecInHr = 3600; // number of seconds in an hour, for the fractional hour conversion on the time graph
197
8bcca84c 198 // trees
199 TTree *fTreeAmpVsTime; // stores channel, gain, amp, and time info
5e99faca 200 TTree *fTreeAvgAmpVsTime; // same, for averages
201 TTree *fTreeLEDAmpVsTime; // same, for LED reference
202 TTree *fTreeLEDAvgAmpVsTime; // same, for LED reference - averages
8bcca84c 203
204 // counters
5e99faca 205 int fNHighGain[fgkMaxTowers]; // Number of Amp. vs. Time readings per tower
206 int fNLowGain[fgkMaxTowers]; // same, for low gain
207 int fNRef[fgkMaxRefs * 2]; // same, for LED refs; *2 for both gains
bd83f412 208
b07ee441 209 ClassDef(AliCaloCalibSignal, 5) // don't forget to change version if you change class member list..
bd83f412 210
211};
212
213#endif