1 |
pam-fi |
1.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 |
mocchiut |
1.9 |
#include <TROOT.h> // EMILIANO: needed to compile with ROOT > 5.16/x |
13 |
pam-fi |
1.1 |
|
14 |
|
|
#include <GLTables.h> |
15 |
|
|
#include <TrkStruct.h> |
16 |
|
|
#include <TrkCalib.h> |
17 |
|
|
|
18 |
|
|
#define NTYPES 10 |
19 |
pam-fi |
1.13 |
#define NGF 14 |
20 |
pam-fi |
1.1 |
|
21 |
|
|
/** |
22 |
|
|
* \brief Class to store tracker parameter information |
23 |
|
|
* |
24 |
pam-fi |
1.5 |
* 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 |
pam-fi |
1.2 |
* |
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 |
pam-fi |
1.5 |
* Internal parameters are initialized to default values |
42 |
pam-fi |
1.7 |
* |
43 |
pam-fi |
1.2 |
* 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 |
pam-fi |
1.4 |
* setting (either from DB or from environment variables) and loading of parameters. |
51 |
pam-fi |
1.2 |
* 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 |
pam-fi |
1.1 |
*/ |
61 |
|
|
class TrkParams : public TObject { |
62 |
|
|
|
63 |
|
|
private: |
64 |
|
|
|
65 |
|
|
static Int_t GetIndex( UInt_t type ); |
66 |
|
|
|
67 |
|
|
public: |
68 |
|
|
|
69 |
|
|
// --------------------------------------------- |
70 |
|
|
// variables to store loaded-calibration info |
71 |
|
|
// --------------------------------------------- |
72 |
|
|
static GL_TRK_CALIB calib; |
73 |
|
|
static TString calibpatht; //truncated |
74 |
|
|
static TString calibpathf; //full |
75 |
|
|
static Bool_t calib104; |
76 |
|
|
static Bool_t calibload; |
77 |
pam-fi |
1.16 |
static TrkCalib* calib1; |
78 |
|
|
static TrkCalib* calib2; |
79 |
pam-fi |
1.1 |
// --------------------------------------------- |
80 |
|
|
// variables to store loaded-parameters info |
81 |
|
|
// --------------------------------------------- |
82 |
|
|
static UInt_t trkparamtype[NTYPES]; |
83 |
|
|
static GL_PARAM gl[NTYPES]; |
84 |
|
|
static TString glpath[NTYPES]; |
85 |
|
|
static Bool_t glload[NTYPES]; |
86 |
pam-fi |
1.5 |
// ----------------------------------------------- |
87 |
|
|
// some parameters to configure tracker processing |
88 |
|
|
// ----------------------------------------------- |
89 |
|
|
static int init__pfa; |
90 |
|
|
static int init__mini_trackmode; |
91 |
|
|
static int init__mini_istepmin; |
92 |
|
|
static double init__mini_fact; |
93 |
pam-fi |
1.7 |
static cDbg init__dbg_mode; //debug mode (for both c++ and F77 roiutines) |
94 |
pam-fi |
1.8 |
static float init__pfa_e234ax[6]; // angle intervals for eta2-3-4 |
95 |
|
|
static float init__pfa_e234ay[6]; // angle intervals for eta2-3-4 |
96 |
pam-fi |
1.11 |
static double init__deltab_0; |
97 |
|
|
static double init__deltab_1; |
98 |
pam-fi |
1.12 |
static double init__dlt; |
99 |
pam-fi |
1.8 |
|
100 |
pam-fi |
1.13 |
// ------------------------------------------ |
101 |
|
|
// nominal z-coordinates to define acceptance |
102 |
|
|
// ------------------------------------------ |
103 |
|
|
static int nGF; |
104 |
|
|
static float zGF[NGF]; |
105 |
|
|
static float xGF_min[NGF]; |
106 |
|
|
static float xGF_max[NGF]; |
107 |
|
|
static float yGF_min[NGF]; |
108 |
|
|
static float yGF_max[NGF]; |
109 |
|
|
static TString GF_element[NGF]; |
110 |
|
|
|
111 |
pam-fi |
1.1 |
TrkParams(); |
112 |
pam-fi |
1.13 |
|
113 |
pam-fi |
1.1 |
// --------------------------------------------- |
114 |
|
|
// calibration (PED-SIG-BAD) |
115 |
|
|
// --------------------------------------------- |
116 |
|
|
static Bool_t SetCalib( GL_RUN* , TSQLServer* ); |
117 |
|
|
static Bool_t LoadCalib( ); |
118 |
|
|
static Bool_t CalibIsLoaded(){ return calibload; }; |
119 |
pam-fi |
1.3 |
static UInt_t ValidateTrkCalib( CalibTrk1Event* ); |
120 |
pam-fi |
1.16 |
// static void FillFCalibFrom(TFile* , Int_t , Int_t );//full |
121 |
|
|
// static void FillTCalibFrom(TFile* , Int_t , Int_t );//truncated |
122 |
pam-fi |
1.1 |
static void FillTCalibFrom(TString path); |
123 |
|
|
static void FillACalibFrom(TFile* , Int_t , Int_t );//all |
124 |
|
|
static void FillMask(TFile* , Int_t , Int_t ); |
125 |
|
|
|
126 |
|
|
// --------------------------------------------- |
127 |
|
|
// parameters |
128 |
|
|
// --------------------------------------------- |
129 |
|
|
static Bool_t Set( GL_RUN* glrun, TSQLServer* dbc, UInt_t type); |
130 |
|
|
static Bool_t Set( GL_RUN* glrun, TSQLServer* dbc){ |
131 |
|
|
for(Int_t i=0; i<NTYPES; i++) |
132 |
|
|
if( !TrkParams::Set(glrun,dbc,trkparamtype[i]) )return false; |
133 |
|
|
return true; |
134 |
|
|
}; |
135 |
|
|
static Bool_t Set( TString, UInt_t ); |
136 |
|
|
static Bool_t Set( UInt_t ); |
137 |
|
|
static Bool_t Set( ); |
138 |
|
|
static Bool_t Load( UInt_t ); |
139 |
|
|
static Bool_t Load( ); |
140 |
|
|
static Bool_t IsLoaded( UInt_t type ){return glload[TrkParams::GetIndex(type)];}; |
141 |
|
|
static Bool_t IsLoaded( ); |
142 |
|
|
|
143 |
pam-fi |
1.16 |
static GL_PARAM GetParams( UInt_t type ){ return gl[TrkParams::GetIndex(type)]; }; |
144 |
|
|
|
145 |
pam-fi |
1.5 |
// --------------------------------------------- |
146 |
|
|
// retrieve parameters |
147 |
|
|
// --------------------------------------------- |
148 |
|
|
static float GetBX(float*); |
149 |
|
|
static float GetBY(float*); |
150 |
|
|
static float GetBZ(float*); |
151 |
pam-fi |
1.6 |
static float GetResolution(int,float); |
152 |
pam-fi |
1.8 |
static int GetPFA(){return sw_.pfaid;}; |
153 |
pam-fi |
1.14 |
static int GetPFA_NbinsAngle(); |
154 |
|
|
static int GetPFA_NbinsETA(); |
155 |
|
|
static int GetPFA_NbinsCharge(){return 0;}; |
156 |
|
|
static int GetPFA_AngleBin(float); |
157 |
|
|
static float* GetPFA_ETAcorr(TString,int,int,int); |
158 |
|
|
static float* GetPFA_ETAabs(TString,int); |
159 |
|
|
static float GetPFA_ETAlandi(int,int,int); |
160 |
|
|
static float GetPFA_ETAlandi(int nv,int nl,float ang) |
161 |
|
|
{ return TrkParams::GetPFA_ETAlandi(nv,nl,TrkParams::GetPFA_AngleBin(ang)); }; |
162 |
pam-fi |
1.4 |
|
163 |
pam-fi |
1.15 |
|
164 |
|
|
|
165 |
pam-fi |
1.4 |
// --------------------------------------------- |
166 |
|
|
// debug mode |
167 |
|
|
// --------------------------------------------- |
168 |
|
|
|
169 |
pam-fi |
1.7 |
static void SetDebugMode() {init__dbg_mode.SetDebug(); dbg_=init__dbg_mode;}; |
170 |
|
|
static void SetVerboseMode(){init__dbg_mode.SetVerbose(); dbg_=init__dbg_mode;}; |
171 |
|
|
static void SetWarningMode(){init__dbg_mode.SetWarning(); dbg_=init__dbg_mode;}; |
172 |
|
|
static void SetQuietMode() {init__dbg_mode.SetNone(); dbg_=init__dbg_mode;}; |
173 |
|
|
static Bool_t DebugMode(){return init__dbg_mode.debug;}; |
174 |
|
|
static Bool_t WarningMode(){return init__dbg_mode.warning;}; |
175 |
|
|
static Bool_t VerboseMode(){return init__dbg_mode.verbose;}; |
176 |
pam-fi |
1.4 |
|
177 |
pam-fi |
1.5 |
// ------------------------------------------------ |
178 |
|
|
// alcuni metodi che non sapevo dove mettere |
179 |
|
|
// per inizializzare alcune variabili in F77 common |
180 |
|
|
// ------------------------------------------------ |
181 |
|
|
// set to default values |
182 |
|
|
static void SetTrackingMode() {track_.trackmode = init__mini_trackmode;}; |
183 |
|
|
static void SetPrecisionFactor(){track_.fact = init__mini_fact; }; |
184 |
|
|
static void SetStepMin() {track_.istepmin = init__mini_istepmin; }; |
185 |
pam-fi |
1.11 |
static void SetDeltaB() {deltab_.delta0 = init__deltab_0; |
186 |
|
|
deltab_.delta1 = init__deltab_1;}; |
187 |
pam-fi |
1.12 |
static void SetDLT() {deltab_.dlt = init__dlt;}; |
188 |
pam-fi |
1.11 |
static void SetMiniDefault() { |
189 |
|
|
SetTrackingMode(); |
190 |
|
|
SetPrecisionFactor(); |
191 |
|
|
SetStepMin(); |
192 |
|
|
SetDeltaB(); |
193 |
pam-fi |
1.12 |
SetDLT(); |
194 |
pam-fi |
1.11 |
}; // |
195 |
|
|
static void SetPFA(); |
196 |
|
|
|
197 |
pam-fi |
1.5 |
// set to custom values |
198 |
|
|
static void SetTrackingMode(int); |
199 |
|
|
static void SetPrecisionFactor(double); |
200 |
|
|
static void SetStepMin(int); |
201 |
pam-fi |
1.11 |
static void SetDeltaB(int,double); |
202 |
pam-fi |
1.12 |
static void SetDLT(double); |
203 |
pam-fi |
1.5 |
static void SetPFA(int); |
204 |
pam-fi |
1.8 |
static void SetPFA(float *); |
205 |
pam-fi |
1.5 |
|
206 |
pam-fi |
1.10 |
// --------------------------------------------- |
207 |
|
|
// varie ed eventuali... |
208 |
|
|
// --------------------------------------------- |
209 |
|
|
static TSQLServer* SetDBConnection(); |
210 |
|
|
|
211 |
|
|
|
212 |
pam-fi |
1.4 |
ClassDef(TrkParams,2); |
213 |
pam-fi |
1.1 |
|
214 |
|
|
}; |
215 |
|
|
|
216 |
|
|
#endif |
217 |
|
|
|