| 1 |
mocchiut |
1.1 |
/** |
| 2 |
|
|
* \file inc/CaloLevel0.h |
| 3 |
|
|
* \author Emiliano Mocchiutti |
| 4 |
|
|
**/ |
| 5 |
|
|
#ifndef CaloLevel0_h |
| 6 |
|
|
#define CaloLevel0_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 |
mocchiut |
1.4 |
#include <CalibCalPulse1Event.h> |
| 16 |
|
|
#include <CalibCalPulse2Event.h> |
| 17 |
mocchiut |
1.1 |
// |
| 18 |
|
|
#include <CaloCore.h> |
| 19 |
|
|
#include <CaloLevel1.h> |
| 20 |
|
|
#include <CaloLevel2.h> |
| 21 |
|
|
|
| 22 |
|
|
using namespace pamela::calorimeter; |
| 23 |
|
|
|
| 24 |
|
|
/** |
| 25 |
|
|
* \brief Class needed to calibrate calorimeter data. |
| 26 |
|
|
* |
| 27 |
|
|
* Calibrates data and connects to fortran routines using structures. |
| 28 |
|
|
* |
| 29 |
|
|
**/ |
| 30 |
|
|
class CaloLevel0 : public TObject { |
| 31 |
|
|
|
| 32 |
|
|
private: |
| 33 |
|
|
|
| 34 |
|
|
public: |
| 35 |
|
|
Bool_t debug; ///< debugging flag |
| 36 |
|
|
Bool_t verbose; ///< verbose flag |
| 37 |
mocchiut |
1.4 |
Bool_t crosst; ///< Cross talk correction flag (true apply false do not apply) |
| 38 |
|
|
Bool_t ctground; ///< Cross talk correction type (true ground, false flight) |
| 39 |
mocchiut |
1.10 |
Bool_t noselfct; ///< Pre cross talk correction do not applied to the strip itself |
| 40 |
mocchiut |
1.1 |
// |
| 41 |
|
|
// variables in which it is stored the calibration information for the four sections |
| 42 |
|
|
// |
| 43 |
|
|
UInt_t idcalib[4]; ///< ID of root file containing calibrations (one per section) |
| 44 |
|
|
UInt_t fromtime[4]; ///< lower validity time limit |
| 45 |
|
|
UInt_t totime[4]; ///< upper validity time limit |
| 46 |
|
|
Int_t calibno[4]; ///< entry of the file |
| 47 |
|
|
TString fcalname[4]; ///< filename of calibrations |
| 48 |
|
|
// |
| 49 |
|
|
// variables needed to open level0 files |
| 50 |
|
|
// |
| 51 |
|
|
TTree *l0tr; ///< level0 tree |
| 52 |
|
|
TBranch *l0calo; ///< level0 calorimeter branch |
| 53 |
|
|
pamela::calorimeter::CalorimeterEvent *de; ///< level0 calorimeter object |
| 54 |
|
|
|
| 55 |
|
|
void Set(){ de = new CalorimeterEvent(); }; |
| 56 |
|
|
|
| 57 |
mocchiut |
1.5 |
void Clear(Option_t *t=""){}; |
| 58 |
mocchiut |
1.1 |
void* GetPointerToCalorimeterEvent(){ return &de; }; |
| 59 |
|
|
CalorimeterEvent* GetCalorimeterEvent(){ return de; }; |
| 60 |
|
|
// |
| 61 |
|
|
// |
| 62 |
|
|
// variables from the calorimeter online calibration |
| 63 |
|
|
// |
| 64 |
|
|
Float_t calped[2][22][96]; ///< pedestals |
| 65 |
|
|
Float_t calgood[2][22][96]; ///< used or not in the common noise calculation |
| 66 |
|
|
Float_t calthr[2][22][6]; ///< thresholds |
| 67 |
|
|
Float_t calrms[2][22][96]; ///< rms |
| 68 |
|
|
Float_t calbase[2][22][6]; ///< baselines (common noise) during calibration |
| 69 |
|
|
Float_t calvar[2][22][6]; ///< variance |
| 70 |
|
|
Float_t cstwerr[4]; ///< status word |
| 71 |
|
|
Float_t cperror[4]; ///< unpacking error flag |
| 72 |
|
|
// |
| 73 |
|
|
// variables needed to calibrate the calorimeter event by event basis |
| 74 |
|
|
// |
| 75 |
|
|
Float_t dexy[2][22][96]; ///< compressed ADC data |
| 76 |
|
|
Float_t dexyc[2][22][96]; ///< RAW ADC data |
| 77 |
|
|
Float_t base[2][22][6]; ///< baselines for this event |
| 78 |
|
|
Float_t sbase[2][22][6]; ///< saved baselines from previous events |
| 79 |
mocchiut |
1.10 |
Float_t ctprecor[2][22][6]; ///< 'cross-talk' correction factor for each pre from pulse calibration or table file |
| 80 |
|
|
Float_t ctneigcor[2][22][6]; ///< 'cross-talk' correction factor for each pre, neighbour strips from pulse calibration or table file |
| 81 |
|
|
Float_t ctsicor[2][22][9]; ///< 'cross-talk' correction factor for each silicon detector |
| 82 |
|
|
Int_t maxrms[2][22]; ///< max rms for each plane, strip with higher values are masked |
| 83 |
mocchiut |
1.1 |
// |
| 84 |
|
|
// Energy vector |
| 85 |
|
|
// |
| 86 |
|
|
Int_t istrip; ///< number of strip above threshold |
| 87 |
|
|
Int_t svstrip[4224]; ///< saved calibrated energy |
| 88 |
|
|
// |
| 89 |
|
|
// Variables needed to handle parameters files |
| 90 |
|
|
// |
| 91 |
|
|
Bool_t calopar1; ///< boolean, is true if parameter set number 101 has already been loaded |
| 92 |
|
|
Bool_t calopar2; ///< boolean, is true if parameter set number 102 has already been loaded |
| 93 |
|
|
Bool_t calopar3; ///< boolean, is true if parameter set number 103 has already been loaded |
| 94 |
mocchiut |
1.10 |
Bool_t calopar4; ///< boolean, is true if parameter set number 103 has already been loaded |
| 95 |
|
|
Bool_t calopar5; ///< boolean, is true if parameter set number 103 has already been loaded |
| 96 |
mocchiut |
1.1 |
UInt_t ftcalopar1; ///< parameter set 101 lower limit validity |
| 97 |
|
|
UInt_t ttcalopar1; ///< parameter set 101 upper limit validity |
| 98 |
|
|
UInt_t ftcalopar2; ///< parameter set 102 lower limit validity |
| 99 |
|
|
UInt_t ttcalopar2; ///< parameter set 102 upper limit validity |
| 100 |
|
|
UInt_t ftcalopar3; ///< parameter set 103 lower limit validity |
| 101 |
|
|
UInt_t ttcalopar3; ///< parameter set 103 upper limit validity |
| 102 |
mocchiut |
1.10 |
UInt_t ftcalopar4; ///< parameter set 103 lower limit validity |
| 103 |
|
|
UInt_t ttcalopar4; ///< parameter set 103 upper limit validity |
| 104 |
|
|
UInt_t ftcalopar5; ///< parameter set 103 lower limit validity |
| 105 |
|
|
UInt_t ttcalopar5; ///< parameter set 103 upper limit validity |
| 106 |
mocchiut |
1.1 |
// |
| 107 |
|
|
void ClearCalibVals(Int_t s); ///< clear calibration values for section s |
| 108 |
|
|
void ClearCommonVar(); ///< clear common variables |
| 109 |
|
|
void ClearTrkVar(); ///< clear track-related variables |
| 110 |
|
|
void FindBaseRaw(Int_t l, Int_t m, Int_t pre); ///< calculate baselines starting from RAW data |
| 111 |
mocchiut |
1.6 |
void FindBaseCompress(Int_t l, Int_t m, Int_t pre); ///< calculate baselines starting from COMPRESS data |
| 112 |
mocchiut |
1.7 |
void FindBaseRaw(Int_t l, Int_t m, Int_t pre,Int_t &nst, Float_t &qp); ///< calculate baselines starting from RAW data |
| 113 |
|
|
void FindBaseCompress(Int_t l, Int_t m, Int_t pre,Int_t &nst, Float_t &qp); ///< calculate baselines starting from COMPRESS data |
| 114 |
mocchiut |
1.3 |
Int_t Update(GL_TABLES *glt, UInt_t atime, Int_t s); ///< update calibration for this event |
| 115 |
mocchiut |
1.1 |
Int_t LoadCalib(Int_t s); ///< load calibrations |
| 116 |
|
|
|
| 117 |
|
|
// |
| 118 |
|
|
// ADC to MIP conversion values |
| 119 |
|
|
// |
| 120 |
|
|
Float_t mip[2][22][96]; ///< ADC to MIP conversion values |
| 121 |
|
|
Int_t obadmask[2][22][96]; ///< Offline mask of bad strips (not used to calculate baselines and calorimeter variables) |
| 122 |
mocchiut |
1.4 |
Int_t obadpulsemask[2][22][96]; ///< Offline mask of bad pulser (not used to calculate crosstalk corrections) |
| 123 |
mocchiut |
1.1 |
Float_t emin; ///< Offline threshold to separate noise from signal |
| 124 |
mocchiut |
1.10 |
Float_t memin[2][22][96]; ///< Offline threshold to separate noise from signal |
| 125 |
mocchiut |
1.1 |
// |
| 126 |
|
|
// Structures to pass data from/to F77 |
| 127 |
|
|
// |
| 128 |
|
|
struct FlCaLevel1 *clevel1; ///< input structure |
| 129 |
|
|
struct FlCaLevel2 *clevel2; ///< output structure |
| 130 |
mocchiut |
1.11 |
/* // */ |
| 131 |
|
|
/* struct FlEventi *eventi; */ |
| 132 |
|
|
/* struct FlGruppo *gruppo; */ |
| 133 |
|
|
/* struct FlGruppo2 *gruppo2; */ |
| 134 |
|
|
/* struct FlGruppo4 *gruppo4; */ |
| 135 |
|
|
/* struct FlTaglioen *taglioen; */ |
| 136 |
|
|
/* struct FlAngolo *angolo; */ |
| 137 |
|
|
/* struct FlWhere *where; */ |
| 138 |
|
|
/* struct FlGeneral *general; */ |
| 139 |
|
|
/* struct FlCh *ch; */ |
| 140 |
|
|
/* struct FlCalofit *calofit; */ |
| 141 |
|
|
/* struct FlPawcd *pawcd; */ |
| 142 |
|
|
/* struct FlQuestd *questd; */ |
| 143 |
|
|
/* // */ |
| 144 |
mocchiut |
1.1 |
// |
| 145 |
|
|
// |
| 146 |
|
|
// |
| 147 |
|
|
Int_t trkseqno; ///< tracker track sequential number (-1 if calorimeter selftrigger) |
| 148 |
|
|
// |
| 149 |
|
|
// useful methods |
| 150 |
|
|
// |
| 151 |
mocchiut |
1.3 |
Int_t ChkParam(GL_TABLES *glt, UInt_t runheader, Bool_t mech); ///< check and load parameters data |
| 152 |
mocchiut |
1.9 |
Int_t ChkParam(TSQLServer *dbc, UInt_t runheader, Bool_t mech); ///< check and load parameters data |
| 153 |
|
|
Int_t ChkParamDo(TSQLServer *dbc, UInt_t runheader, Bool_t mech); ///< check and load parameters data |
| 154 |
mocchiut |
1.3 |
Int_t ChkCalib(GL_TABLES *glt, UInt_t atime); ///< check and load calibration data |
| 155 |
mocchiut |
1.4 |
Int_t CalcCrossTalkCorr(GL_TABLES *glt, UInt_t runheader); ///< calculate the cross talk corretion using CaloPulse information from flight calibrations |
| 156 |
mocchiut |
1.9 |
Int_t CalcCrossTalkCorr(TSQLServer *dbc, UInt_t runheader); ///< calculate the cross talk corretion using CaloPulse information from flight calibrations |
| 157 |
mocchiut |
1.10 |
Int_t CalcCrossTalkCorr(GL_TABLES *glt, UInt_t runheader, Bool_t usetable); ///< calculate the cross talk corretion using CaloPulse information from flight calibrations |
| 158 |
|
|
Int_t CalcCrossTalkCorr(TSQLServer *dbc, UInt_t runheader, Bool_t usetable); ///< calculate the cross talk corretion using CaloPulse information from flight calibrations |
| 159 |
|
|
Int_t CalcCrossTalkCorrDo(TSQLServer *dbc, UInt_t runheader, Bool_t usetable); ///< calculate the cross talk corretion using CaloPulse information from flight calibrations |
| 160 |
mocchiut |
1.1 |
Int_t Calibrate(Int_t ei); ///< perform data calibration |
| 161 |
|
|
void GetCommonVar(); ///< call fortran common variables program |
| 162 |
|
|
void GetTrkVar(); ///< call fortran track-related variables program |
| 163 |
|
|
void ClearStructs(); ///< clear input and output structures |
| 164 |
|
|
void FillCommonVar(CaloLevel1 *c1, CaloLevel2 *ca); ///< copy common variables from structure to class |
| 165 |
|
|
void FillTrkVar(CaloLevel2 *ca, Int_t nutrk); ///< copy track-related variables from structure to class |
| 166 |
|
|
void RunClose(); ///< clear variables which could change from one run to another |
| 167 |
|
|
void SetCrossTalk(Bool_t ct); |
| 168 |
mocchiut |
1.4 |
void SetCrossTalkType(Bool_t ct); |
| 169 |
mocchiut |
1.10 |
void SetCrossTalkType(Int_t ct); |
| 170 |
mocchiut |
1.1 |
void SetVerbose(Bool_t ct); |
| 171 |
|
|
// |
| 172 |
|
|
// constructor |
| 173 |
|
|
// |
| 174 |
|
|
CaloLevel0(); ///< contructor |
| 175 |
mocchiut |
1.10 |
void Delete(Option_t *t=""); //ELENA |
| 176 |
mocchiut |
1.3 |
void ProcessingInit(GL_TABLES *glt, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t debug, Bool_t verbose); ///< initialize caloprocessing object |
| 177 |
mocchiut |
1.9 |
void ProcessingInit(TSQLServer *dbc, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t debug, Bool_t verbose); ///< initialize caloprocessing object |
| 178 |
|
|
void InitDo(TSQLServer *dbc, UInt_t hs, Int_t &sgnl, TTree *l0tree, Bool_t debug, Bool_t verbose); ///< initialize caloprocessing object |
| 179 |
mocchiut |
1.1 |
// |
| 180 |
|
|
// destructor |
| 181 |
|
|
// |
| 182 |
|
|
~CaloLevel0();///< destructor |
| 183 |
|
|
// |
| 184 |
mocchiut |
1.10 |
ClassDef(CaloLevel0,4); |
| 185 |
mocchiut |
1.1 |
}; |
| 186 |
|
|
|
| 187 |
|
|
#endif |