12 #include <trg/ecl/dbobjects/TrgEclDatabaseImporter.h>
15 #include <framework/database/DBObjPtr.h>
16 #include <framework/database/IntervalOfValidity.h>
17 #include <framework/database/DBImportArray.h>
20 #include <framework/logging/Logger.h>
23 #include "trg/ecl/dbobjects/TRGECLFAMPara.h"
24 #include "trg/ecl/dbobjects/TRGECLTMMPara.h"
25 #include "trg/ecl/dbobjects/TRGECLETMPara.h"
26 #include "trg/ecl/dbobjects/TRGECLBadRun.h"
28 #include "trg/ecl/TrgEclMapping.h"
40 TrgEclDatabaseImporter::TrgEclDatabaseImporter(): startExp(0), startRun(0), endExp(-1), endRun(-1)
44 std::string InputFileNoise)
47 stream.open(InputFileName.c_str());
49 B2ERROR(
"openFile: " << InputFileName <<
" *** failed to open");
52 std::ifstream stream1;
53 stream1.open(InputFileSignalPDF.c_str());
55 B2ERROR(
"openFile: " << InputFileSignalPDF <<
" *** failed to open");
59 std::ifstream stream2;
60 stream2.open(InputFileNoise.c_str());
62 B2ERROR(
"openFile: " << InputFileNoise <<
" *** failed to open");
72 std::vector<int> FPGAversion;
73 std::vector<int> TCId;
74 std::vector<int> FAMId;
75 std::vector<int> ChannelId;
76 std::vector<int> TEreconstruction;
77 std::vector<int> Threshold;
78 std::vector<double> Conversionfactor;
79 std::vector<int> Toffset;
80 std::vector<int> Wavemean;
81 std::vector<int> Wavesigma;
86 TEreconstruction.clear();
88 Conversionfactor.clear();
93 FPGAversion.resize(624, 0);
96 ChannelId.resize(624, 0);
97 TEreconstruction.resize(624, 0);
98 Threshold.resize(624, 0);
99 Conversionfactor.resize(624, 0);
100 Toffset.resize(624, 0);
102 Wavemean.resize(624, 0);
103 Wavesigma.resize(624, 0);
106 std::vector<std::vector<double> > SignalPDF;
108 std::vector<std::vector<double> > NoiseCovarianceMatrix;
109 NoiseCovarianceMatrix.clear();
110 SignalPDF.resize(624, std::vector<double>(8, 0));
111 NoiseCovarianceMatrix.resize(624, std::vector<double>(78, 0));
114 while (!stream.eof()) {
115 stream >> FAMId[Id] >> ChannelId[Id] >> FPGAversion [Id] >> TEreconstruction[Id] >> Threshold[Id] >> Conversionfactor[Id] >>
116 Toffset[Id] >> Wavemean[Id] >> Wavesigma[Id];
117 TCId[Id] = _map -> getTCIdFromFAMChannel(FAMId[Id], ChannelId[Id]);
124 while (!stream1.eof()) {
125 stream1 >> SignalPDF[Id][line];
137 while (!stream2.eof()) {
138 stream2 >> NoiseCovarianceMatrix[Id][line];
150 for (
int iTCId = 0; iTCId < 624; iTCId++) {
155 TEreconstruction[iTCId],
156 Conversionfactor[iTCId],
162 NoiseCovarianceMatrix[iTCId]
171 B2RESULT(
"FAM parameters are imported to database.");
178 std::ifstream stream;
179 stream.open(InputFileName.c_str());
181 B2ERROR(
"openFile: " << InputFileName <<
" *** failed to open");
188 stream >> FPGAversion ;
196 B2RESULT(
"TMM parameters are imported to database.");
203 std::ifstream stream;
204 stream.open(InputFileName.c_str());
206 B2ERROR(
"openFile: " << InputFileName <<
" *** failed to open");
219 int Bhabha3DSelectionThreshold[2];
220 int Bhabha3DVetoThreshold[2];
221 int Bhabha3DSelectionAngle[4];
222 int Bhabha3DVetoAngle[4];
225 int LowMultiThreshold[4];
226 int Prescalefactor[3];
230 int ECLBurstThreshold;
232 stream >> FPGAversion
237 >> FWD2DBhabha[0] >> BWD2DBhabha[0]
238 >> FWD2DBhabha[1] >> BWD2DBhabha[1]
239 >> FWD2DBhabha[2] >> BWD2DBhabha[2]
240 >> FWD2DBhabha[3] >> BWD2DBhabha[3]
241 >> FWD2DBhabha[4] >> BWD2DBhabha[4]
242 >> FWD2DBhabha[5] >> BWD2DBhabha[5]
243 >> FWD2DBhabha[6] >> BWD2DBhabha[6]
244 >> FWD2DBhabha[7] >> BWD2DBhabha[7]
245 >> FWD2DBhabha[8] >> BWD2DBhabha[8]
246 >> FWD2DBhabha[9] >> BWD2DBhabha[9]
247 >> FWD2DBhabha[10] >> BWD2DBhabha[10]
248 >> FWD2DBhabha[11] >> BWD2DBhabha[11]
249 >> FWD2DBhabha[12] >> BWD2DBhabha[12]
250 >> FWD2DBhabha[13] >> BWD2DBhabha[13]
251 >> Bhabha3DSelectionThreshold[0]
252 >> Bhabha3DSelectionThreshold[1]
253 >> Bhabha3DVetoThreshold[0]
254 >> Bhabha3DVetoThreshold[1]
255 >> Bhabha3DSelectionAngle[0]
256 >> Bhabha3DSelectionAngle[1]
257 >> Bhabha3DSelectionAngle[2]
258 >> Bhabha3DSelectionAngle[3]
259 >> Bhabha3DVetoAngle[0]
260 >> Bhabha3DVetoAngle[1]
261 >> Bhabha3DVetoAngle[2]
262 >> Bhabha3DVetoAngle[3]
268 >> LowMultiThreshold[0]
269 >> LowMultiThreshold[1]
270 >> LowMultiThreshold[2]
271 >> LowMultiThreshold[3]
278 >> ECLBurstThreshold;
281 etmpara.
appendNew(FPGAversion, ADCto100MeV, ELow, EHigh, ELum, FWD2DBhabha, BWD2DBhabha, Bhabha3DSelectionThreshold,
282 Bhabha3DVetoThreshold, Bhabha3DSelectionAngle, Bhabha3DVetoAngle, mumuThreshold, mumuAngle, LowMultiThreshold,
283 Prescalefactor, TriggerLatency, ETMDelay, n300MeVCluster, ECLBurstThreshold);
291 B2RESULT(
"ETM Parameters are imported to database.");
297 std::ifstream stream;
298 stream.open(InputFileName.c_str());
300 B2ERROR(
"openFile: " << InputFileName <<
" *** failed to open");
307 while (!stream.eof()) {
309 stream >> BadRunNumber ;
318 B2RESULT(
"BadRunList are imported to database.");