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 |
|
|
|
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 |
pam-fi |
1.5 |
* 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 |
pam-fi |
1.2 |
* |
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 |
pam-fi |
1.5 |
* Internal parameters are initialized to default values |
40 |
|
|
* (NB!! the same values set in analisysflight.f). |
41 |
|
|
* |
42 |
pam-fi |
1.2 |
* 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 |
pam-fi |
1.4 |
* setting (either from DB or from environment variables) and loading of parameters. |
50 |
pam-fi |
1.2 |
* 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 |
pam-fi |
1.1 |
*/ |
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 |
pam-fi |
1.5 |
// ----------------------------------------------- |
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 |
pam-fi |
1.1 |
|
91 |
|
|
TrkParams(); |
92 |
|
|
|
93 |
|
|
// --------------------------------------------- |
94 |
|
|
// calibration (PED-SIG-BAD) |
95 |
|
|
// --------------------------------------------- |
96 |
|
|
static Bool_t SetCalib( GL_RUN* , TSQLServer* ); |
97 |
|
|
static Bool_t LoadCalib( ); |
98 |
|
|
static Bool_t CalibIsLoaded(){ return calibload; }; |
99 |
pam-fi |
1.3 |
static UInt_t ValidateTrkCalib( CalibTrk1Event* ); |
100 |
pam-fi |
1.1 |
static void FillFCalibFrom(TFile* , Int_t , Int_t );//full |
101 |
|
|
static void FillTCalibFrom(TFile* , Int_t , Int_t );//truncated |
102 |
|
|
static void FillTCalibFrom(TString path); |
103 |
|
|
static void FillACalibFrom(TFile* , Int_t , Int_t );//all |
104 |
|
|
static void FillMask(TFile* , Int_t , Int_t ); |
105 |
|
|
|
106 |
|
|
// --------------------------------------------- |
107 |
|
|
// parameters |
108 |
|
|
// --------------------------------------------- |
109 |
|
|
static Bool_t Set( GL_RUN* glrun, TSQLServer* dbc, UInt_t type); |
110 |
|
|
static Bool_t Set( GL_RUN* glrun, TSQLServer* dbc){ |
111 |
|
|
for(Int_t i=0; i<NTYPES; i++) |
112 |
|
|
if( !TrkParams::Set(glrun,dbc,trkparamtype[i]) )return false; |
113 |
|
|
return true; |
114 |
|
|
}; |
115 |
|
|
static Bool_t Set( TString, UInt_t ); |
116 |
|
|
static Bool_t Set( UInt_t ); |
117 |
|
|
static Bool_t Set( ); |
118 |
|
|
static Bool_t Load( UInt_t ); |
119 |
|
|
static Bool_t Load( ); |
120 |
|
|
static Bool_t IsLoaded( UInt_t type ){return glload[TrkParams::GetIndex(type)];}; |
121 |
|
|
static Bool_t IsLoaded( ); |
122 |
|
|
|
123 |
pam-fi |
1.5 |
// --------------------------------------------- |
124 |
|
|
// retrieve parameters |
125 |
|
|
// --------------------------------------------- |
126 |
|
|
static float GetBX(float*); |
127 |
|
|
static float GetBY(float*); |
128 |
|
|
static float GetBZ(float*); |
129 |
pam-fi |
1.6 |
static float GetResolution(int,float); |
130 |
pam-fi |
1.4 |
|
131 |
|
|
// --------------------------------------------- |
132 |
|
|
// debug mode |
133 |
|
|
// --------------------------------------------- |
134 |
|
|
static cDbg dbg_mode; //debug mode (for both c++ and F77 roiutines) |
135 |
|
|
|
136 |
|
|
static void SetDebugMode() {dbg_mode.SetDebug(); dbg_=dbg_mode;}; |
137 |
|
|
static void SetVerboseMode(){dbg_mode.SetVerbose(); dbg_=dbg_mode;}; |
138 |
|
|
static void SetWarningMode(){dbg_mode.SetWarning(); dbg_=dbg_mode;}; |
139 |
|
|
static Bool_t DebugMode(){return dbg_mode.debug;}; |
140 |
|
|
static Bool_t WarningMode(){return dbg_mode.warning;}; |
141 |
|
|
static Bool_t VerboseMode(){return dbg_mode.verbose;}; |
142 |
|
|
|
143 |
pam-fi |
1.5 |
// ------------------------------------------------ |
144 |
|
|
// alcuni metodi che non sapevo dove mettere |
145 |
|
|
// per inizializzare alcune variabili in F77 common |
146 |
|
|
// ------------------------------------------------ |
147 |
|
|
// set to default values |
148 |
|
|
static void SetTrackingMode() {track_.trackmode = init__mini_trackmode;}; |
149 |
|
|
static void SetPrecisionFactor(){track_.fact = init__mini_fact; }; |
150 |
|
|
static void SetStepMin() {track_.istepmin = init__mini_istepmin; }; |
151 |
|
|
static void SetPFA() {sw_.pfaid = init__pfa; }; |
152 |
|
|
// set to custom values |
153 |
|
|
static void SetTrackingMode(int); |
154 |
|
|
static void SetPrecisionFactor(double); |
155 |
|
|
static void SetStepMin(int); |
156 |
|
|
static void SetPFA(int); |
157 |
|
|
|
158 |
pam-fi |
1.4 |
ClassDef(TrkParams,2); |
159 |
pam-fi |
1.1 |
|
160 |
|
|
}; |
161 |
|
|
|
162 |
|
|
#endif |
163 |
|
|
|