| 9 |
#include <TString.h> |
#include <TString.h> |
| 10 |
#include <TSQLServer.h> |
#include <TSQLServer.h> |
| 11 |
#include <TSystem.h> |
#include <TSystem.h> |
| 12 |
|
#include <TROOT.h> // EMILIANO: needed to compile with ROOT > 5.16/x |
| 13 |
|
|
| 14 |
#include <GLTables.h> |
#include <GLTables.h> |
| 15 |
#include <TrkStruct.h> |
#include <TrkStruct.h> |
| 16 |
#include <TrkCalib.h> |
#include <TrkCalib.h> |
| 17 |
|
|
| 18 |
#define NTYPES 10 |
#define NTYPES 10 |
| 19 |
|
#define NGF 14 |
| 20 |
|
|
| 21 |
/** |
/** |
| 22 |
* \brief Class to store tracker parameter information |
* \brief Class to store tracker parameter information |
| 23 |
* |
* |
| 24 |
|
* Tracker parameters include calibration parameters (PED, SIG and BAD), |
| 25 |
|
* parameters loaded from DB (alignment, ADC-to-mip, etc. ) and some parameters |
| 26 |
|
* to configure tracker processing (PFA, ecc...). |
| 27 |
|
* |
| 28 |
|
* Calibrations can be either those evaluated online or default values. |
| 29 |
|
* External parameter are labelled according to the DB convention: |
| 30 |
|
* |
| 31 |
|
* type description |
| 32 |
|
* ----------------- |
| 33 |
|
* 1 field |
| 34 |
|
* 2 adc-to-mip |
| 35 |
|
* 3 charge-correlation |
| 36 |
|
* 4 p.f.a. (eta) |
| 37 |
|
* 5 alignment |
| 38 |
|
* 6 VA1 mask |
| 39 |
|
* 7 default calibration |
| 40 |
|
* |
| 41 |
|
* Internal parameters are initialized to default values |
| 42 |
|
* |
| 43 |
|
* TrkParams::SetCalib(...) and TrkParams::Set(...) methods allow to set |
| 44 |
|
* required parameters, from an input path, from the DB (for a given input |
| 45 |
|
* run id) and from environment variable PAM_CALIB. |
| 46 |
|
* TrkParams::LoadCalib() and TrkParams::Load() methods load parameters into |
| 47 |
|
* F77 common. |
| 48 |
|
* |
| 49 |
|
* Tracker libraries (TrkLevel0, TrkLevel1 and TrkLevel2) implement automatic |
| 50 |
|
* setting (either from DB or from environment variables) and loading of parameters. |
| 51 |
|
* If one needs to load custom parameters, it is enough to call TrkParams::Set(...) |
| 52 |
|
* with proper arguments. All the methods are static, and can be used as standalone functions. |
| 53 |
|
* |
| 54 |
|
* For example: |
| 55 |
|
* |
| 56 |
|
* TrkParams::Set("/param-path/new-mip-param/",2); |
| 57 |
|
* |
| 58 |
|
* After this instruction (to be called once), new adc-to-mip conversion parameters |
| 59 |
|
* will be loaded automatically (once) and used until the next set instruction |
| 60 |
*/ |
*/ |
| 61 |
class TrkParams : public TObject { |
class TrkParams : public TObject { |
| 62 |
|
|
| 81 |
static GL_PARAM gl[NTYPES]; |
static GL_PARAM gl[NTYPES]; |
| 82 |
static TString glpath[NTYPES]; |
static TString glpath[NTYPES]; |
| 83 |
static Bool_t glload[NTYPES]; |
static Bool_t glload[NTYPES]; |
| 84 |
|
// ----------------------------------------------- |
| 85 |
|
// some parameters to configure tracker processing |
| 86 |
|
// ----------------------------------------------- |
| 87 |
|
static int init__pfa; |
| 88 |
|
static int init__mini_trackmode; |
| 89 |
|
static int init__mini_istepmin; |
| 90 |
|
static double init__mini_fact; |
| 91 |
|
static cDbg init__dbg_mode; //debug mode (for both c++ and F77 roiutines) |
| 92 |
|
static float init__pfa_e234ax[6]; // angle intervals for eta2-3-4 |
| 93 |
|
static float init__pfa_e234ay[6]; // angle intervals for eta2-3-4 |
| 94 |
|
static double init__deltab_0; |
| 95 |
|
static double init__deltab_1; |
| 96 |
|
static double init__dlt; |
| 97 |
|
|
| 98 |
|
// ------------------------------------------ |
| 99 |
|
// nominal z-coordinates to define acceptance |
| 100 |
|
// ------------------------------------------ |
| 101 |
|
static int nGF; |
| 102 |
|
static float zGF[NGF]; |
| 103 |
|
static float xGF_min[NGF]; |
| 104 |
|
static float xGF_max[NGF]; |
| 105 |
|
static float yGF_min[NGF]; |
| 106 |
|
static float yGF_max[NGF]; |
| 107 |
|
static TString GF_element[NGF]; |
| 108 |
|
|
| 109 |
TrkParams(); |
TrkParams(); |
| 110 |
|
|
| 111 |
// --------------------------------------------- |
// --------------------------------------------- |
| 112 |
// calibration (PED-SIG-BAD) |
// calibration (PED-SIG-BAD) |
| 113 |
// --------------------------------------------- |
// --------------------------------------------- |
| 114 |
static Bool_t SetCalib( GL_RUN* , TSQLServer* ); |
static Bool_t SetCalib( GL_RUN* , TSQLServer* ); |
| 115 |
static Bool_t LoadCalib( ); |
static Bool_t LoadCalib( ); |
| 116 |
static Bool_t CalibIsLoaded(){ return calibload; }; |
static Bool_t CalibIsLoaded(){ return calibload; }; |
| 117 |
|
static UInt_t ValidateTrkCalib( CalibTrk1Event* ); |
| 118 |
static void FillFCalibFrom(TFile* , Int_t , Int_t );//full |
static void FillFCalibFrom(TFile* , Int_t , Int_t );//full |
| 119 |
static void FillTCalibFrom(TFile* , Int_t , Int_t );//truncated |
static void FillTCalibFrom(TFile* , Int_t , Int_t );//truncated |
| 120 |
static void FillTCalibFrom(TString path); |
static void FillTCalibFrom(TString path); |
| 138 |
static Bool_t IsLoaded( UInt_t type ){return glload[TrkParams::GetIndex(type)];}; |
static Bool_t IsLoaded( UInt_t type ){return glload[TrkParams::GetIndex(type)];}; |
| 139 |
static Bool_t IsLoaded( ); |
static Bool_t IsLoaded( ); |
| 140 |
|
|
| 141 |
ClassDef(TrkParams,1); |
// --------------------------------------------- |
| 142 |
|
// retrieve parameters |
| 143 |
|
// --------------------------------------------- |
| 144 |
|
static float GetBX(float*); |
| 145 |
|
static float GetBY(float*); |
| 146 |
|
static float GetBZ(float*); |
| 147 |
|
static float GetResolution(int,float); |
| 148 |
|
static int GetPFA(){return sw_.pfaid;}; |
| 149 |
|
static int GetPFA_NbinsAngle(); |
| 150 |
|
static int GetPFA_NbinsETA(); |
| 151 |
|
static int GetPFA_NbinsCharge(){return 0;}; |
| 152 |
|
static int GetPFA_AngleBin(float); |
| 153 |
|
static float* GetPFA_ETAcorr(TString,int,int,int); |
| 154 |
|
static float* GetPFA_ETAabs(TString,int); |
| 155 |
|
static float GetPFA_ETAlandi(int,int,int); |
| 156 |
|
static float GetPFA_ETAlandi(int nv,int nl,float ang) |
| 157 |
|
{ return TrkParams::GetPFA_ETAlandi(nv,nl,TrkParams::GetPFA_AngleBin(ang)); }; |
| 158 |
|
|
| 159 |
|
|
| 160 |
|
|
| 161 |
|
// --------------------------------------------- |
| 162 |
|
// debug mode |
| 163 |
|
// --------------------------------------------- |
| 164 |
|
|
| 165 |
|
static void SetDebugMode() {init__dbg_mode.SetDebug(); dbg_=init__dbg_mode;}; |
| 166 |
|
static void SetVerboseMode(){init__dbg_mode.SetVerbose(); dbg_=init__dbg_mode;}; |
| 167 |
|
static void SetWarningMode(){init__dbg_mode.SetWarning(); dbg_=init__dbg_mode;}; |
| 168 |
|
static void SetQuietMode() {init__dbg_mode.SetNone(); dbg_=init__dbg_mode;}; |
| 169 |
|
static Bool_t DebugMode(){return init__dbg_mode.debug;}; |
| 170 |
|
static Bool_t WarningMode(){return init__dbg_mode.warning;}; |
| 171 |
|
static Bool_t VerboseMode(){return init__dbg_mode.verbose;}; |
| 172 |
|
|
| 173 |
|
// ------------------------------------------------ |
| 174 |
|
// alcuni metodi che non sapevo dove mettere |
| 175 |
|
// per inizializzare alcune variabili in F77 common |
| 176 |
|
// ------------------------------------------------ |
| 177 |
|
// set to default values |
| 178 |
|
static void SetTrackingMode() {track_.trackmode = init__mini_trackmode;}; |
| 179 |
|
static void SetPrecisionFactor(){track_.fact = init__mini_fact; }; |
| 180 |
|
static void SetStepMin() {track_.istepmin = init__mini_istepmin; }; |
| 181 |
|
static void SetDeltaB() {deltab_.delta0 = init__deltab_0; |
| 182 |
|
deltab_.delta1 = init__deltab_1;}; |
| 183 |
|
static void SetDLT() {deltab_.dlt = init__dlt;}; |
| 184 |
|
static void SetMiniDefault() { |
| 185 |
|
SetTrackingMode(); |
| 186 |
|
SetPrecisionFactor(); |
| 187 |
|
SetStepMin(); |
| 188 |
|
SetDeltaB(); |
| 189 |
|
SetDLT(); |
| 190 |
|
}; // |
| 191 |
|
static void SetPFA(); |
| 192 |
|
|
| 193 |
|
// set to custom values |
| 194 |
|
static void SetTrackingMode(int); |
| 195 |
|
static void SetPrecisionFactor(double); |
| 196 |
|
static void SetStepMin(int); |
| 197 |
|
static void SetDeltaB(int,double); |
| 198 |
|
static void SetDLT(double); |
| 199 |
|
static void SetPFA(int); |
| 200 |
|
static void SetPFA(float *); |
| 201 |
|
|
| 202 |
|
// --------------------------------------------- |
| 203 |
|
// varie ed eventuali... |
| 204 |
|
// --------------------------------------------- |
| 205 |
|
static TSQLServer* SetDBConnection(); |
| 206 |
|
|
| 207 |
|
|
| 208 |
|
ClassDef(TrkParams,2); |
| 209 |
|
|
| 210 |
}; |
}; |
| 211 |
|
|