75{
79
81
82
85
86 JAbstractHistogram_t X;
87 bool logx;
88 double margin;
89 double epsilon;
91
92 std::string option;
93
95
97
98
99 try {
100
101 JParser<> zap(
"Example program to histogram neutrino effective mass for triggered events using offline files.");
102
106 = JAbstractHistogram_t(100, 1.0, 100.0);
107 zap[
'X'] =
make_field(logx,
"Use logarithm of energy");
108 zap[
'C'] =
make_field(cylinder,
"Cylinder to compute visible energy depositions")
110 zap[
'm'] =
make_field(margin,
"Extra margin to consider visible energy depositions")
111 = 0.0;
112 zap[
'e'] =
make_field(epsilon,
"Minimal amount of visible energy assigned to events") = 1e-8;
113 zap[
'O'] =
make_field(option,
"Result option")
114 = Mass_t, Volume_t;
115 zap[
'T'] =
make_field(trigger_mask,
"Trigger mask")
118
119 zap(argc, argv);
120 }
121 catch(const exception &error) {
122 FATAL(error.what() << endl);
123 }
124
125
127
129
130 const double Xmin = X.getLowerLimit();
131 const double Xmax = X.getUpperLimit();
132 const int Xnbins = X.getNumberOfBins();
133
138
140
142
144
145 NOTICE(
"Scanning file type " << scanner->getName() << endl);
146 DEBUG (header << endl);
147
149
150 STATUS(
"event: " << setw(10) << in.getCounter() <<
'\r');
DEBUG(endl);
151
152 Evt*
event = in.next();
154
155
158 track->clearusr();
159 }
160 double Wnorm = 0.0;
161
163
164 Wnorm = getWnorm(header);
165
166 } else if (uuid_is_null(event->header_uuid) == 0) {
167
169
170 MultiHead::const_iterator i = multiheader.
find(mergedUUID.
uuid,
true);
171
172 if (i == multiheader.cend()) {
173 FATAL(
"Could not find header corresponding to UUID: " <<
JUUID(event->header_uuid) << endl);
174 }
175
176 const JHead header1(*i);
177 DEBUG(header1 << endl);
178
179 Wnorm = getWnorm(header1);
180
182
183 } else {
184
185 FATAL(
"Mising normalisation in event/header." << endl);
186 }
187
189
190 if (
can.getVolume() == 0.0) {
192 }
193
194 can.addMargin(margin);
195
199 0.0);
200 double EvisHad = Evis - EvisLL;
201
202 if (Evis == 0) Evis = epsilon;
203 if (EvisLL == 0) EvisLL = epsilon;
204 if (EvisHad == 0) EvisHad = epsilon;
205
207 const double x1 = logx ? log10(Evis) : Evis;
208 const double x2 = logx ? log10(EvisLL) : EvisLL;
209 const double x3 = logx ? log10(EvisHad) : EvisHad;
210
212 double w = (
getVolume(weighter.getEvtWeighter(), *event) /
213 (logx ? log(10.0) *
primary.E * hm0->GetBinWidth(1) : hm0->GetBinWidth(1)) /
214 Wnorm);
215
216 if (option == Mass_t) {
218 } else if (option == Volume_t) {
220 }
221
224
225 hm0[interactionID0]->Fill(x0, y);
226 hm1[interactionID0]->Fill(x1, y);
227 hm2[interactionID0]->Fill(x2, y);
228 hm3[interactionID0]->Fill(x3, y);
229
230 hm0[interactionID1]->Fill(x0, y);
231 hm2[interactionID1]->Fill(x2, y);
232 hm1[interactionID1]->Fill(x1, y);
233 hm3[interactionID1]->Fill(x3, y);
234
236
239
240 hm0[interactionID2]->Fill(x0, y);
241 hm1[interactionID2]->Fill(x1, y);
242 hm2[interactionID2]->Fill(x2, y);
243 hm3[interactionID2]->Fill(x3, y);
244
245 hm0[interactionID3]->Fill(x0, y);
246 hm2[interactionID3]->Fill(x2, y);
247 hm1[interactionID3]->Fill(x1, y);
248 hm3[interactionID3]->Fill(x3, y);
249 }
250 }
251 }
253 }
254
256
257 out << hm0 << hm1 << hm2 << hm3;
258
259 out.Close();
260}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
const JHead & getHeader() const
Get header.
bool is_valid(T JHead::*pd) const
Check validity of given data member in JHead.
Utility class to parse command line options.
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys.
General purpose class for object reading from a list of file names.
virtual bool hasNext() override
Check availability of next element.
Auxiliary class for trigger mask.
bool hasTriggerMask(const JDAQTriggerMask &mask) const
Has trigger bit pattern.
double getVolume(const JType< JEvtWeightGSeaGen > &type, const Evt &evt)
Get volume of given event according given weighter.
JCylinder3D getCylinder(const JHead &header)
Get cylinder corresponding to the positions of generated tracks (i.e.
bool has_leading_lepton(const Evt &event)
Auxiliary function to check if an event contains the leading lepton of a neutrino interaction.
const Trk & get_primary(const Evt &evt)
Auxiliary function to retrieve the primary track of an event.
JEvtWeighter getEventWeighter
Function object for mapping header to event weighter.
int getInteractionID(const Evt &event, const bool useScatteringType=true, const bool useDecayType=true)
Retrieve interaction identifier.
static const double DENSITY_SEA_WATER
Fixed environment values.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
double getVisibleEnergyLeadingLepton(const Trk &, const JCylinder3D &)
double getVisibleEnergy(const Trk &, const JCylinder3D &)
Get the visible energy of a track.
JMultiHead getMultiHeader(const JMultipleFileScanner_t &file_list)
Get multi-header corresponding to a given file list.
KM3NeT DAQ data structures and auxiliaries.
static const JDAQTriggerMask TRIGGER_MASK_ON
Trigger mask on;.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Helper class for event weighing.
Auxiliary data structure to store multiple headers and bookkeep event-weight normalisations.
JUUID getHeaderUUID(const Evt &event) const
Get the header UUID corresponding to the given event.
The cylinder used for photon tracking.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Auxiliary class for organising Monte Carlo file scanners associated with event weighters.
Auxiliary base class for list of file names.
const_iterator find(const uuid_t &uuid, const bool useCache=false) const
Find header with given UUID.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.