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