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