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