91{
95
97
98
101
103
104 try {
105
107
111
112 zap(argc, argv);
113 }
114 catch(const exception& error) {
115 FATAL(error.what() << endl);
116 }
117
118
120
122
123
124
126
127 if (scanners.empty()) {
128 FATAL(
"File scanner set is empty");
129 }
130
131
132
134 JHead commonHeader = firstHeader;
136
137 eventHeaders.
merge(firstHeader);
138
140
142 commonHeader = commonHeader.
getMatch(header);
143
144 eventHeaders.
insert(header);
145 }
146
147 eventHeaders.
merge();
148
150
151 {
153
154 copy(commonHeader, buffer);
155
157 }
158
159
161
163
166 }
167
169
170 for (const auto& i : in) {
171 number_of_events += i.getEntries();
172 }
173
174
175
176
177 auto getEvt = [eventHeaders, scanners](
const entry_type& top) {
178
180
183 }
184
186 eventHeaders.
getHeaderUUID(out) : scanners[top.index].getHeader().UUID);
187
189
191
192 return out;
193 };
194
195
196 priority_queue<entry_type, deque<entry_type> > buffer;
197
198 for (size_t i = 0; i != in.size(); ++i) {
199
200 if (in[i].hasNext()) {
201
202 buffer.push({i, *in[i].next()});
203
204 --number_of_events;
205 }
206 }
207
208 while (number_of_events != 0) {
209
210 STATUS(
"event: " << setw(10) << number_of_events <<
'\r');
DEBUG(endl);
211
212 const entry_type& top = buffer.top();
213
215
216 if (in[top.index].hasNext()) {
217
218 buffer.push({top.index, *in[top.index].next()});
219
220 --number_of_events;
221 }
222
223 buffer.pop();
224 }
225
226 while (!buffer.empty()) {
227
228 const entry_type& top = buffer.top();
229
231
232 buffer.pop();
233 }
234
236
238
240
241 return 0;
242}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const JHead & getHeader() const
Get header.
JHead getMatch(const JHead &header) const
Get matching fields.
Data structure for set of track fit results.
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
Base class for JTreeScanner.
Template definition for direct access of elements in ROOT TChain.
void copy(const Head &from, JHead &to)
Copy header from from to to.
JEvt getEvt(const JHead &header, const JModel &model)
Get event.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Long64_t counter_type
Type definition for counter.
JMultiHead getMultiHeader(const JMultipleFileScanner_t &file_list)
Get multi-header corresponding to a given file list.
KM3NeT DAQ data structures and auxiliaries.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
std::vector< double > w
MC: Weights w[0]=w1, w[1]=w2, w[2]=w3 (see e.g. Tag list or km3net-dataformat/definitions)
uuid_t header_uuid
UUID of header containing the event-weight information.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Auxiliary data structure to store multiple headers and bookkeep event-weight normalisations.
bool insert(const JHead &header)
Insert the given header.
void merge(const JHead &header)
Merge the given header into this object.
double getNormalisation(const JUUID &UUID) const
Get normalisation for given header UUID.
JUUID getHeaderUUID(const Evt &event) const
Get the header UUID corresponding to the given event.
Auxiliary data structure to convert model to event.
Auxiliary class for recursive type list generation.
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
Auxiliary base class for list of file names.
static const int WEIGHTLIST_NORMALISATION
Event rate normalisation.