75{
79
81
83 typedef JTriggeredFileScanner_t::multi_pointer_type multi_pointer_type;
84
85 JTriggeredFileScanner_t inputFile;
90 bool trace;
91 double cosLR;
93
94 try {
95
96 JParser<> zap(
"Application for writing DST.");
97
98 zap[
'f'] =
make_field(inputFile,
"output of JXXXReconstruction");
101 zap[
'O'] =
make_field(option,
"bit pattern: " << endl << bits_t()) = 0xFF;
103 zap[
'T'] =
make_field(trace,
"keep results of fits leading to best");
104 zap[
'c'] =
make_field(cosLR,
"re-evaluate likelihood ratio") = -1.0;
106
107 zap(argc, argv);
108 }
109 catch(const exception& error) {
110 FATAL(error.what() << endl);
111 }
112
113
115
117
119
120 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
121
122 multi_pointer_type ps = inputFile.next();
123
127
128 if (option.
has(CLEAR_MC_HITS)) {
129 event->mc_hits.clear();
130 }
131
132 if (option.
has(CLEAR_MC_TRKS)) {
133
134 vector<Trk>::iterator __end = partition(event->mc_trks.begin(), event->mc_trks.end(), [](
const Trk& trk) { return is_initialstate(trk) || is_muonbundle(trk); });
135
137
139
140 __end = partition(__end, event->mc_trks.end(), [
id](
const Trk& trk) { return is_lepton(trk) && trk.mother_id == id; });
141 }
142
143 event->mc_trks.erase(__end, event->mc_trks.end());
144 }
145
146 if (option.
has(CLEAR_DAQ_HITS)) {
148 }
149
150
151
152 if (cosLR > -1.0) {
153
155
156 for (JEvt::iterator i = evt->begin(); i != __end; ++i) {
157
158 double Q = numeric_limits<double>::max();
159
160 for (JEvt::iterator p = evt->begin(); p != evt->end(); ++p) {
163 if (i->getQ() - p->getQ() < Q) {
164 Q = i->getQ() - p->getQ();
165 }
166 }
167 }
168 }
169
171 }
172 }
173
174 if (option.
has(CLEAR_INTERMEDIATE_FITS) ||
175 option.
has(CLEAR_ALL_BUT_BEST_FITS)) {
176
178
179 if (option.
has(CLEAR_ALL_BUT_BEST_FITS) && evt->begin() != __end) {
180 __end = next(evt->begin());
181 }
182
183 if (!keep.empty()) {
184 __end = partition(__end, evt->end(), [keep](
const JFit& fit) { return keep.count(fit.getHistory().rbegin()->type) != 0; });
185 }
186
187 if (trace) {
188 for (JEvt::iterator i = evt->begin(), __q = __end; i != __q; ++i) {
189 __end = partition(__end, evt->end(), [i](
const JFit& fit) { return i->getHistory().match(fit.getHistory()); });
190 }
191 }
192
193 evt->erase(__end, evt->end());
194 }
195
196
197
199
203 }
205
207
209
211}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int getStatus() const
Get status of the fit; negative values should refer to a bad fit.
Utility class to parse command line options.
General purpose class for object reading from a list of file names.
void setCounter(const JTriggerCounter_t counter)
Set trigger counter.
static const int JGANDALF_LIKELIHOOD_RATIO
likelihood ratio between this and best alternative fit see JRECONSTRUCTION::JMuonGandalf
JDirection3D getDirection(const Vec &dir)
Get direction.
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
double getDot(const JFirst_t &first, const JSecond_t &second)
Get dot product of objects.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
KM3NeT DAQ data structures and auxiliaries.
unsigned long long int JTriggerCounter_t
Type definition of trigger counter.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Auxiliary class for handling status.
bool has(const int bit) const
Test PMT status.
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.
const JLimit & getLimit() const
Get limit.
static counter_type max()
Get maximum counter value.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.