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