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) and |
23 |
* other parameters. |
24 |
* The first can be either those evaluated online or default values. |
25 |
* The second are labelled according to the DB convention: |
26 |
* |
27 |
* type description |
28 |
* ----------------- |
29 |
* 1 field |
30 |
* 2 adc-to-mip |
31 |
* 3 charge-correlation |
32 |
* 4 p.f.a. (eta) |
33 |
* 5 alignment |
34 |
* 6 VA1 mask |
35 |
* 7 default calibration |
36 |
* |
37 |
* TrkParams::SetCalib(...) and TrkParams::Set(...) methods allow to set |
38 |
* required parameters, from an input path, from the DB (for a given input |
39 |
* run id) and from environment variable PAM_CALIB. |
40 |
* TrkParams::LoadCalib() and TrkParams::Load() methods load parameters into |
41 |
* F77 common. |
42 |
* |
43 |
* Tracker libraries (TrkLevel0, TrkLevel1 and TrkLevel2) implement automatic |
44 |
* setting (eother from DB or from environment variables) and loading of parameters. |
45 |
* If one needs to load custom parameters, it is enough to call TrkParams::Set(...) |
46 |
* with proper arguments. All the methods are static, and can be used as standalone functions. |
47 |
* |
48 |
* For example: |
49 |
* |
50 |
* TrkParams::Set("/param-path/new-mip-param/",2); |
51 |
* |
52 |
* After this instruction (to be called once), new adc-to-mip conversion parameters |
53 |
* will be loaded automatically (once) and used until the next set instruction |
54 |
*/ |
55 |
class TrkParams : public TObject { |
56 |
|
57 |
private: |
58 |
|
59 |
static Int_t GetIndex( UInt_t type ); |
60 |
|
61 |
public: |
62 |
|
63 |
// --------------------------------------------- |
64 |
// variables to store loaded-calibration info |
65 |
// --------------------------------------------- |
66 |
static GL_TRK_CALIB calib; |
67 |
static TString calibpatht; //truncated |
68 |
static TString calibpathf; //full |
69 |
static Bool_t calib104; |
70 |
static Bool_t calibload; |
71 |
// --------------------------------------------- |
72 |
// variables to store loaded-parameters info |
73 |
// --------------------------------------------- |
74 |
static UInt_t trkparamtype[NTYPES]; |
75 |
static GL_PARAM gl[NTYPES]; |
76 |
static TString glpath[NTYPES]; |
77 |
static Bool_t glload[NTYPES]; |
78 |
|
79 |
TrkParams(); |
80 |
|
81 |
// --------------------------------------------- |
82 |
// calibration (PED-SIG-BAD) |
83 |
// --------------------------------------------- |
84 |
static Bool_t SetCalib( GL_RUN* , TSQLServer* ); |
85 |
static Bool_t LoadCalib( ); |
86 |
static Bool_t CalibIsLoaded(){ return calibload; }; |
87 |
static void FillFCalibFrom(TFile* , Int_t , Int_t );//full |
88 |
static void FillTCalibFrom(TFile* , Int_t , Int_t );//truncated |
89 |
static void FillTCalibFrom(TString path); |
90 |
static void FillACalibFrom(TFile* , Int_t , Int_t );//all |
91 |
static void FillMask(TFile* , Int_t , Int_t ); |
92 |
|
93 |
// --------------------------------------------- |
94 |
// parameters |
95 |
// --------------------------------------------- |
96 |
static Bool_t Set( GL_RUN* glrun, TSQLServer* dbc, UInt_t type); |
97 |
static Bool_t Set( GL_RUN* glrun, TSQLServer* dbc){ |
98 |
for(Int_t i=0; i<NTYPES; i++) |
99 |
if( !TrkParams::Set(glrun,dbc,trkparamtype[i]) )return false; |
100 |
return true; |
101 |
}; |
102 |
static Bool_t Set( TString, UInt_t ); |
103 |
static Bool_t Set( UInt_t ); |
104 |
static Bool_t Set( ); |
105 |
static Bool_t Load( UInt_t ); |
106 |
static Bool_t Load( ); |
107 |
static Bool_t IsLoaded( UInt_t type ){return glload[TrkParams::GetIndex(type)];}; |
108 |
static Bool_t IsLoaded( ); |
109 |
|
110 |
ClassDef(TrkParams,1); |
111 |
|
112 |
}; |
113 |
|
114 |
#endif |
115 |
|