1 |
/** |
2 |
* \file inc/CaloProcessing.h |
3 |
* \author Emiliano Mocchiutti |
4 |
**/ |
5 |
#ifndef CaloProcessing_h |
6 |
#define CaloProcessing_h |
7 |
#include <TObject.h> |
8 |
#include <TROOT.h> |
9 |
// |
10 |
// YODA headers |
11 |
// |
12 |
#include <PamelaRun.h> |
13 |
#include <RegistryEvent.h> |
14 |
#include <physics/calorimeter/CalorimeterEvent.h> |
15 |
#include <CalibCalPedEvent.h> |
16 |
// |
17 |
#include <CaloCore.h> |
18 |
#include <CaloLevel2.h> |
19 |
|
20 |
/** |
21 |
* \brief Class needed to calibrate calorimeter data. |
22 |
* |
23 |
* Calibrates data and connects to fortran routines using structures. |
24 |
* |
25 |
**/ |
26 |
class CaloProcessing : public TObject { |
27 |
|
28 |
private: |
29 |
Bool_t debug; ///< debugging flag |
30 |
Bool_t verbose; ///< verbose flag |
31 |
// |
32 |
// variables in which it is stored the calibration information for the four sections |
33 |
// |
34 |
ULong64_t idcalib[4]; ///< ID of root file containing calibrations (one per section) |
35 |
ULong64_t fromtime[4]; ///< lower validity time limit |
36 |
ULong64_t totime[4]; ///< upper validity time limit |
37 |
Int_t calibno[4]; ///< entry of the file |
38 |
TString fcalname[4]; ///< filename of calibrations |
39 |
// |
40 |
// variables needed to open level0 files |
41 |
// |
42 |
TTree *l0tr; ///< level0 tree |
43 |
TBranch *l0calo; ///< level0 calorimeter branch |
44 |
pamela::calorimeter::CalorimeterEvent *de; ///< level0 calorimeter object |
45 |
// |
46 |
// |
47 |
// variables from the calorimeter online calibration |
48 |
// |
49 |
Float_t calped[2][22][96]; ///< pedestals |
50 |
Float_t calgood[2][22][96]; ///< used or not in the common noise calculation |
51 |
Float_t calthr[2][22][6]; ///< thresholds |
52 |
Float_t calrms[2][22][96]; ///< rms |
53 |
Float_t calbase[2][22][6]; ///< baselines (common noise) during calibration |
54 |
Float_t calvar[2][22][6]; ///< variance |
55 |
Float_t cstwerr[4]; ///< status word |
56 |
Float_t cperror[4]; ///< unpacking error flag |
57 |
// |
58 |
// variables needed to calibrate the calorimeter event by event basis |
59 |
// |
60 |
Float_t dexy[2][22][96]; ///< compressed ADC data |
61 |
Float_t dexyc[2][22][96]; ///< RAW ADC data |
62 |
Float_t base[2][22][6]; ///< baselines for this event |
63 |
Float_t sbase[2][22][6]; ///< saved baselines from previous events |
64 |
// |
65 |
// Energy vector |
66 |
// |
67 |
Int_t istrip; ///< number of strip above threshold |
68 |
Float_t svstrip[4224]; ///< saved calibrated energy |
69 |
// |
70 |
// Variables needed to handle parameters files |
71 |
// |
72 |
Bool_t calopar1; ///< boolean, is true if parameter set number 1 has already been loaded |
73 |
Bool_t calopar2; ///< boolean, is true if parameter set number 2 has already been loaded |
74 |
ULong64_t ftcalopar1; ///< parameter set 1 lower limit validity |
75 |
ULong64_t ttcalopar1; ///< parameter set 1 upper limit validity |
76 |
ULong64_t ftcalopar2; ///< parameter set 2 lower limit validity |
77 |
ULong64_t ttcalopar2; ///< parameter set 2 upper limit validity |
78 |
// |
79 |
// private methods |
80 |
// |
81 |
/** |
82 |
* \param s calorimeter section. |
83 |
**/ |
84 |
void ClearCalibVals(Int_t s); ///< clear calibration values for section s |
85 |
void ClearCommonVar(); ///< clear common variables |
86 |
void ClearTrkVar(); ///< clear track-related variables |
87 |
void FindBaseRaw(Int_t l, Int_t m, Int_t pre); ///< calculate baselines starting from RAW data |
88 |
Int_t Update(TSQLServer *dbc, ULong64_t atime, Int_t s); ///< update calibration for this event |
89 |
Int_t LoadCalib(Int_t s); ///< load calibrations |
90 |
|
91 |
public: |
92 |
// |
93 |
// ADC to MIP conversion values |
94 |
// |
95 |
Float_t mip[2][22][96]; ///< ADC to MIP conversion values |
96 |
Float_t emin; ///< Offline threshold to separate noise from signal |
97 |
// |
98 |
// Structures to pass data from/to F77 |
99 |
// |
100 |
struct FlCaLevel1 *clevel1; ///< input structure |
101 |
struct FlCaLevel2 *clevel2; ///< output structure |
102 |
// |
103 |
// |
104 |
// |
105 |
Int_t trkseqno; ///< tracker track sequential number (-1 if calorimeter selftrigger) |
106 |
// |
107 |
// useful methods |
108 |
// |
109 |
Int_t ChkParam(TSQLServer *dbc, ULong64_t runheader); ///< check and load parameters data |
110 |
Int_t ChkCalib(TSQLServer *dbc, ULong64_t atime); ///< check and load calibration data |
111 |
Int_t Calibrate(Int_t ei); ///< perform data calibration |
112 |
void GetCommonVar(); ///< call fortran common variables program |
113 |
void GetTrkVar(); ///< call fortran track-related variables program |
114 |
void ClearStructs(); ///< clear input and output structures |
115 |
void FillCommonVar(CaloLevel2 *ca); ///< copy common variables from structure to class |
116 |
void FillTrkVar(CaloLevel2 *ca, Int_t nutrk); ///< copy track-related variables from structure to class |
117 |
void RunClose(); ///< clear variables which could change from one run to another |
118 |
// |
119 |
// constructor |
120 |
// |
121 |
CaloProcessing(); ///< contructor |
122 |
void ProcessingInit(TSQLServer *dbc, ULong64_t hs, Int_t &sgnl, TTree *l0tree, Bool_t debug, Bool_t verbose); ///< initialize caloprocessing object |
123 |
// |
124 |
// virtual destructor |
125 |
// |
126 |
virtual ~CaloProcessing(); |
127 |
// |
128 |
}; |
129 |
|
130 |
#endif |