58{
62
66
69 JLimit_t& numberOfEvents = inputFile.getLimit();
70 string detectorFile;
71 JCalibration_t calibrationFile;
72 double Tmax_s;
75
76 try {
77
78 JParser<> zap(
"Auxiliary program to convert fit results to Evt format.\
79 \nThe option -L corresponds to the name of a shared library \
80 \nand function so to rearrange the order of fit results.");
81
90
91 zap(argc, argv);
92 }
93 catch(const exception& error) {
94 FATAL(error.what() << endl);
95 }
96
97
99 typedef JSingleFileScanner_t::pointer_type pointer_type;
100
101
103
104 if (detectorFile != "") {
105 try {
107 }
110 }
111 }
112
113 unique_ptr<JDynamics> dynamics;
114
115 try {
116
118
119 dynamics->load(calibrationFile);
120 }
121 catch(const exception& error) {
122 if (!calibrationFile.empty()) {
124 }
125 }
126
127
130
131
133
135
136 try {
138 } catch(const exception& error) {}
139 {
141
142 buffer.DAQ.livetime_s =
getLivetime(inputFile.begin(), inputFile.end());
144
145 copy(buffer, header);
146 }
147
149
150
152
153
155
157
158 STATUS(
"Processing: " << *i << endl);
159
162
163 in.setLimit(inputFile.getLimit());
164
166
167 int mc_run_id = 0;
168
169 try {
170
172
174 mc_run_id = head.start_run.run_id;
175
176 } catch(const exception& error) {}
177
178
179 while (in.hasNext()) {
180
181 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
182
183 pointer_type ps = in.next();
184
186
187 if (dynamics) {
188 dynamics->update(*tev);
189 }
190
192
193 if (mc.getEntries() != 0) {
194
196
197 if (event != NULL) {
198
199 out = *event;
200
203 }
204
206 i->pos += offset;
207 }
208 }
209 }
210
212
213 if (!pmt_router->empty()) {
214
216
217 if (pmt_router.hasPMT(i->pmt_id)) {
218
219 const JPMTAddress address = pmt_router.getAddress(i->pmt_id);
221 const JPMT& pmt = pmt_router.getPMT(address);
222
223 i->dom_id =
id.
getID();
224 i->channel_id = id.getPMTAddress();
227
228 } else {
229
230 FATAL(
"Missing PMT" << i->pmt_id << endl);
231 }
232 }
233 }
234
235 if (!mod_router->empty()) {
236
238
239 if (mod_router.hasModule(i->dom_id)) {
240
242
245
246 const JPMT& pmt = mod_router.getPMT(
id);
247
249
251
252 i->pmt_id = pmt.
getID();
255 i->t = hit.getT();
256 i->tot = hit.getToT();
257 i->a = cpu.getNPE(i->tot);
258
259 } else {
260
261 FATAL(
"Missing module " << i->dom_id << endl);
262 }
263 }
264 }
265
266 out.
id = ++number_of_events;
267
269 }
270 }
271
273
275
277
279}
#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, const char delimiter=' ')
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.
Auxiliary class for recursive type list generation.
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.