1 |
mocchiut |
1.1 |
RunInfo |
2 |
|
|
|
3 |
|
|
|
4 |
|
|
class RunInfo : public TObject |
5 |
|
|
|
6 |
|
|
|
7 |
|
|
Inheritance Chart: |
8 |
|
|
|
9 |
|
|
TObject <- RunInfo |
10 |
|
|
|
11 |
|
|
|
12 |
|
|
Methods: |
13 |
|
|
|
14 |
|
|
private: |
15 |
|
|
|
16 |
|
|
public: |
17 |
|
|
|
18 |
|
|
|
19 |
|
|
Data Members: |
20 |
|
|
|
21 |
|
|
private: |
22 |
|
|
|
23 |
|
|
public: |
24 |
|
|
ULong64_t ID; |
25 |
|
|
ULong64_t ID_REG_RUN; |
26 |
|
|
ULong64_t ID_REG_RUN_L2; |
27 |
|
|
ULong64_t RUNHEADER_TIME; |
28 |
|
|
ULong64_t RUNTRAILER_TIME; |
29 |
|
|
Int_t EV_REG_PHYS_FROM; |
30 |
|
|
Int_t EV_REG_PHYS_TO; |
31 |
|
|
Int_t EV_REG_RUNHEADER; |
32 |
|
|
Int_t EV_REG_RUNTRAILER; |
33 |
|
|
Int_t TRK_CALIB_USED; |
34 |
|
|
Int_t EFFECTIVE_WORKING_SCHEDULE; |
35 |
|
|
Int_t PRH_VAR_TRIGGER_MODE_A; |
36 |
|
|
Int_t PRH_VAR_TRIGGER_MODE_B; |
37 |
|
|
Int_t ACQ_BUILD_INFO; |
38 |
|
|
Int_t ACQ_VAR_INFO; |
39 |
|
|
TString TRIG_ver; |
40 |
|
|
TString TOF_ver; |
41 |
|
|
TString AC_ver; |
42 |
|
|
TString TRK_ver; |
43 |
|
|
TString CAL_ver; |
44 |
|
|
TString S4_ver; |
45 |
|
|
TString ND_ver; |
46 |
|
|
|
47 |
|
|
|
48 |
|
|
Class Description: |
49 |
|
|
|
50 |
|
|
Class needed to copy into the Level2 rootple the information stored in the DB table GL_RUN. |
51 |
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
ItoRunInfo |
57 |
|
|
|
58 |
|
|
|
59 |
|
|
class ItoRunInfo : public TObject |
60 |
|
|
|
61 |
|
|
|
62 |
|
|
Inheritance Chart: |
63 |
|
|
|
64 |
|
|
TObject <- ItoRunInfo |
65 |
|
|
|
66 |
|
|
|
67 |
|
|
Methods: |
68 |
|
|
|
69 |
|
|
private: |
70 |
|
|
|
71 |
|
|
public: |
72 |
|
|
ItoRunInfo(); |
73 |
|
|
ItoRunInfo(TSQLServer *dbc, TFile *processFile, TString processFolder, ULong64_t idRun, TString Detector, TString Dec_version); |
74 |
|
|
ItoRunInfo(TFile *processFile); |
75 |
|
|
Int_t Update(); |
76 |
|
|
Int_t Read(); |
77 |
|
|
Int_t GetRunInfo(ULong64_t run); |
78 |
|
|
UInt_t GetRunForEntry(UInt_t entry); |
79 |
|
|
Long64_t GetRunEntries(){return(totnorun);}; |
80 |
|
|
Bool_t IsReprocessing(); |
81 |
|
|
UInt_t GetFirstFileEntry(); |
82 |
|
|
UInt_t GetLastFileEntry(); |
83 |
|
|
ULong64_t GetFileEntries(); |
84 |
|
|
UInt_t GetNoRun(); |
85 |
|
|
TArrayL *GetRunList(); |
86 |
|
|
void Close(); |
87 |
|
|
|
88 |
|
|
|
89 |
|
|
Data Members: |
90 |
|
|
|
91 |
|
|
private: |
92 |
|
|
ULong64_t file_entries; |
93 |
|
|
Long64_t totnorun; |
94 |
|
|
Int_t first_file_entry; |
95 |
|
|
Int_t last_file_entry; |
96 |
|
|
UInt_t norun; |
97 |
|
|
Bool_t reprocessing; |
98 |
|
|
Bool_t updating; |
99 |
|
|
TFile *file; |
100 |
|
|
TTree *newtree; |
101 |
|
|
TArrayL *runlist; |
102 |
|
|
ULong64_t idRun; |
103 |
|
|
TSQLServer *dbc; |
104 |
|
|
TString processFolder; |
105 |
|
|
TString Detector; |
106 |
|
|
TString Dec_version; |
107 |
|
|
|
108 |
|
|
public: |
109 |
|
|
ULong64_t ID; |
110 |
|
|
ULong64_t ID_REG_RUN; |
111 |
|
|
ULong64_t ID_REG_RUN_L2; |
112 |
|
|
ULong64_t RUNHEADER_TIME; |
113 |
|
|
ULong64_t RUNTRAILER_TIME; |
114 |
|
|
Int_t EV_REG_PHYS_FROM; |
115 |
|
|
Int_t EV_REG_PHYS_TO; |
116 |
|
|
Int_t EV_REG_RUNHEADER; |
117 |
|
|
Int_t EV_REG_RUNTRAILER; |
118 |
|
|
Int_t TRK_CALIB_USED; |
119 |
|
|
Int_t EFFECTIVE_WORKING_SCHEDULE; |
120 |
|
|
Int_t PRH_VAR_TRIGGER_MODE_A; |
121 |
|
|
Int_t PRH_VAR_TRIGGER_MODE_B; |
122 |
|
|
Int_t ACQ_BUILD_INFO; |
123 |
|
|
Int_t ACQ_VAR_INFO; |
124 |
|
|
TString TRIG_ver; |
125 |
|
|
TString TOF_ver; |
126 |
|
|
TString AC_ver; |
127 |
|
|
TString TRK_ver; |
128 |
|
|
TString CAL_ver; |
129 |
|
|
TString S4_ver; |
130 |
|
|
TString ND_ver; |
131 |
|
|
|
132 |
|
|
|
133 |
|
|
Class Description: |
134 |
|
|
|
135 |
|
|
Interface to the RunInfo class: provides methods which can be used to reprocess RUNs inside a Level2 file. |
136 |
|
|
|
137 |
|
|
|
138 |
|
|
ItoRunInfo(): |
139 |
|
|
|
140 |
|
|
Default constructor for RunInfo. |
141 |
|
|
|
142 |
|
|
|
143 |
|
|
ItoRunInfo(TSQLServer *dbc, TFile *processFile, ULong64_t idRun, TString Detector, TString Dec_version, Int_t &signal): |
144 |
|
|
|
145 |
|
|
Constructor to be used with a file opened in "UPDATE" mode, needed to update informations in the file. |
146 |
|
|
Given a opened sql connection, an opened TFile and the idRun it updates the versioning information for |
147 |
|
|
the given detector or creates inside the TFile the TTree run copying data from the GL_RUN table where ID=idRun. |
148 |
|
|
Signal is returned in "signal" variable: if less than 0 an error occurred. |
149 |
|
|
Detector can be: |
150 |
|
|
"TOF", "TRIG", "AC", "TRK", "CALO", "S4", "ND" |
151 |
|
|
|
152 |
|
|
Example: |
153 |
|
|
|
154 |
|
|
... |
155 |
|
|
#include <RunInfo.h> |
156 |
|
|
|
157 |
|
|
... |
158 |
|
|
|
159 |
|
|
TSQLServer *dbc = 0; |
160 |
|
|
dbc = TSQLServer::Connect("mysql://localhost/pamelaprod","anonymous",""); |
161 |
|
|
TFile *file = new TFile(processFile.Data(),"UPDATE"); |
162 |
|
|
const char *caloversion = CaloInfo(false); |
163 |
|
|
Int_t sgnl = 0; |
164 |
|
|
ItoRunInfo *runinfo = new ItoRunInfo(dbc,file,"calorimeterFolder",idRun,"CALO",caloversion); |
165 |
|
|
sgnl = runinfo->Update() |
166 |
|
|
if ( sgnl < 0 ) return(sgnl); |
167 |
|
|
|
168 |
|
|
|
169 |
|
|
ItoRunInfo(TFile *processFile): |
170 |
|
|
|
171 |
|
|
Constructor to be used with a file opened in "READ-ONLY" mode, needed only to perform analysis. |
172 |
|
|
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
Bool_t IsReprocessing(): |
176 |
|
|
|
177 |
|
|
Returns "true" if the TFile already contained a Run TTree and the "Detector" versioning information was already |
178 |
|
|
filled; return "false" otherwise. |
179 |
|
|
|
180 |
|
|
|
181 |
|
|
UInt_t GetFirstFileEntry(); |
182 |
|
|
|
183 |
|
|
Returns the entry of the TFile which contains the first event of the processed run. |
184 |
|
|
|
185 |
|
|
|
186 |
|
|
UInt_t GetFirstFileEntry(); |
187 |
|
|
|
188 |
|
|
Returns the entry of the TFile which contains the last event of the processed run. |
189 |
|
|
|
190 |
|
|
|
191 |
|
|
ULong64_t GetFileEntries(); |
192 |
|
|
|
193 |
|
|
Returns the number of entries of the TFile. |
194 |
|
|
|
195 |
|
|
|
196 |
|
|
UInt_t GetNoRun(): |
197 |
|
|
|
198 |
|
|
Returns the number of runs to be processed. |
199 |
|
|
|
200 |
|
|
|
201 |
|
|
TArrayL *GetRunList(): |
202 |
|
|
|
203 |
|
|
Returns an array of lenght equal to the number of run to be processed in which each elements is the idRun to be |
204 |
|
|
processed. |
205 |
|
|
Example (follows the one above): |
206 |
|
|
|
207 |
|
|
UInt_t numbofrun = runinfo->GetNoRun(); |
208 |
|
|
TArrayL *runlist = runinfo->GetRunList(); |
209 |
|
|
// |
210 |
|
|
// Loop over the run to be processed |
211 |
|
|
// |
212 |
|
|
for (UInt_t irun=0; irun < numbofrun; irun++){ |
213 |
|
|
// |
214 |
|
|
// get idRun to process |
215 |
|
|
// |
216 |
|
|
idRun = runlist->At(irun); |
217 |
|
|
// |
218 |
|
|
// store run information from GL_RUN in memory |
219 |
|
|
// |
220 |
|
|
sgnl = runinfo->GetRunInfo(idRun); |
221 |
|
|
if ( sgnl < 0 ) return(sgnl); |
222 |
|
|
// |
223 |
|
|
// process data |
224 |
|
|
// |
225 |
|
|
printf(" ID_REG_RUN for run %i is %i \n",(int)idRun,(int)runinfo->ID_REG_RUN); |
226 |
|
|
printf(" RUNHEADER_TIME for run %i is %i \n",(int)idRun,(int)runinfo->RUNHEADER_TIME); |
227 |
|
|
|
228 |
|
|
|
229 |
|
|
Int_t GetRunInfo(ULong64_t idRun): |
230 |
|
|
|
231 |
|
|
Fill data members with variables of the run "idRun" reading from the file and not from the DB. |
232 |
|
|
Returns a signal less than zero in case of any error, zero otherwise. |
233 |
|
|
As example look at the one above. |
234 |
|
|
|
235 |
|
|
|
236 |
|
|
UInt_t GetRunForEntry(UInt_t entry); |
237 |
|
|
|
238 |
|
|
Given the entry number it returns the ID of the run which contains that event. |
239 |
|
|
|
240 |
|
|
|
241 |
|
|
Long64_t GetRunEntries(){return(totnorun);}; |
242 |
|
|
|
243 |
|
|
Returns the number of runs contained in the file. |
244 |
|
|
|
245 |
|
|
|
246 |
|
|
void Close(): |
247 |
|
|
|
248 |
|
|
Clear private data memebers. |