58{
62
64
67 JLimit_t& numberOfEvents = inputFile.getLimit();
68 string detectorFile;
69 JCalibration_t calibrationFile;
70 double Tmax_s;
73
74 try {
75
76 JParser<> zap(
"Auxiliary program to convert fit results to Evt format.\
77 \nThe option -L corresponds to the name of a shared library \
78 \nand function so to rearrange the order of fit results.");
79
88
89 zap(argc, argv);
90 }
91 catch(const exception& error) {
92 FATAL(error.what() << endl);
93 }
94
95
97 typedef JSingleFileScanner_t::pointer_type pointer_type;
98
99
101
102 if (detectorFile != "") {
103 try {
105 }
108 }
109 }
110
111 unique_ptr<JDynamics> dynamics;
112
113 try {
114
116
117 dynamics->load(calibrationFile);
118 }
119 catch(const exception& error) {
120 if (!calibrationFile.empty()) {
122 }
123 }
124
125
128
129
131
133
134 try {
136 } catch(const exception& error) {}
137 {
139
140 buffer.DAQ.livetime_s =
getLivetime(inputFile.begin(), inputFile.end());
142
143 copy(buffer, header);
144 }
145
147
148
150
151
153
155
156 STATUS(
"Processing: " << *i << endl);
157
160
161 in.setLimit(inputFile.getLimit());
162
164
165 int mc_run_id = 0;
166
167 try {
168
170
172 mc_run_id = head.start_run.run_id;
173
174 } catch(const exception& error) {}
175
176
177 while (in.hasNext()) {
178
179 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
180
181 pointer_type ps = in.next();
182
184
185 if (dynamics) {
186 dynamics->update(*tev);
187 }
188
190
191 if (mc.getEntries() != 0) {
192
194
195 if (event != NULL) {
196
197 out = *event;
198
201 }
202
204 i->pos += offset;
205 }
206 }
207 }
208
210
211 if (!pmt_router->empty()) {
212
214
215 if (pmt_router.hasPMT(i->pmt_id)) {
216
217 const JPMTAddress address = pmt_router.getAddress(i->pmt_id);
219 const JPMT& pmt = pmt_router.getPMT(address);
220
221 i->dom_id =
id.
getID();
222 i->channel_id = id.getPMTAddress();
225
226 } else {
227
228 FATAL(
"Missing PMT" << i->pmt_id << endl);
229 }
230 }
231 }
232
233 if (!mod_router->empty()) {
234
236
237 if (mod_router.hasModule(i->dom_id)) {
238
240
243
244 const JPMT& pmt = mod_router.getPMT(
id);
245
247
249
250 i->pmt_id = pmt.
getID();
253 i->t = hit.getT();
254 i->tot = hit.getToT();
255 i->a = cpu.getNPE(i->tot);
256
257 } else {
258
259 FATAL(
"Missing module " << i->dom_id << endl);
260 }
261 }
262 }
263
264 out.
id = ++number_of_events;
265
267 }
268 }
269
271
273
275
277}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const JCalibration & getCalibration() const
Get calibration.
Router for direct addressing of module data in detector data structure.
Address of PMT in detector data structure.
Auxiliary class for map of PMT parameters.
const JPMTParameters & getPMTParameters(const JPMTIdentifier &id) const
Get PMT parameters.
Data structure for PMT parameters.
bool slewing
time slewing of analogue signal
Router for direct addressing of PMT data in detector data structure.
Data structure for PMT geometry, calibration and status.
int getID() const
Get identifier.
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
Object reading from a list of files.
Template definition for direct access of elements in ROOT TChain.
static void setSlewing(const bool slewing)
Set slewing option.
JTriggerCounter_t getCounter() const
Get trigger counter.
JDirection3D getDirection(const Vec &dir)
Get direction.
void copy(const Head &from, JHead &to)
Copy header from from to to.
JPosition3D getPosition(const Vec &pos)
Get position.
Vec getOffset(const JHead &header)
Get offset.
std::istream & read(std::istream &in, JTestSummary &summary)
Read test summary.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Long64_t counter_type
Type definition for counter.
double getLivetime(const std::string &file_name)
Get data taking live time.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
const char * getTime()
Get current local time conform ISO-8601 standard.
KM3NeT DAQ data structures and auxiliaries.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
std::vector< Hit > hits
list of hits
int mc_run_id
MC run identifier.
std::vector< Hit > mc_hits
MC: list of MC truth hits.
std::vector< Trk > mc_trks
MC: list of MC truth tracks.
int id
offline event identifier
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
PMT analogue signal processor.
Dynamic detector calibration.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for defining the range of iterations of objects.
static counter_type max()
Get maximum counter value.
Auxiliary base class for file name.
The Vec class is a straightforward 3-d vector, which also works in pyroot.