40{
44
46 typedef JTriggeredFileScanner_t::multi_pointer_type multi_pointer_type;
47
48 JTriggeredFileScanner_t inputFile;
51 string detectorFile;
52 size_t numberOfPrefits;
54 double quality;
55 bool logx;
56 bool containment;
58
59 try {
60
61 JParser<> zap(
"Example program to histogram fit results.");
62
69 zap[
'Q'] =
make_field(quality) = numeric_limits<double>::min();
73
74 zap(argc, argv);
75 }
76 catch(const exception& error) {
77 FATAL(error.what() << endl);
78 }
79
80
82
83 try {
85 }
88 }
89
92
93 const double Xmax = E_GeV.
is_valid() ? volume.getX(E_GeV.
getMaximum()) : volume.getXmax();
94 const double Xmin = E_GeV.
is_valid() ? volume.getX(E_GeV.
getMinimum()) : volume.getXmin();
95
97
98 TH1D* hN = new TH1D("hN", NULL, 25, Xmin, Xmax);
99 TH1D* he = new TH1D("he", NULL, 25, Xmin, Xmax);
100
101 hN->Sumw2();
102 he->Sumw2();
103
105
106 try {
108 }
111 }
112
114
115 STATUS(
"Detector Geometry:" << endl);
116 STATUS(
"Zmin: " << cylinder.getZmin() << endl);
117 STATUS(
"Zmax: " << cylinder.getZmax() << endl);
118 STATUS(
"Z origin: " << 0.5 * (cylinder.getZmax() + cylinder.getZmin()) << endl);
119 STATUS(
"Radius: " << cylinder.getRadius() << endl);
120
121 while (inputFile.hasNext()) {
122
123 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
124
125 multi_pointer_type ps = inputFile.next();
126
127
130
132
134 const double X = volume.getX(neutrino.
E);
135
136 hN->Fill(X);
137
138 if (!evt->empty()) {
139
140 JEvt::iterator __end = evt->end();
141
142 if (numberOfPrefits > 0) {
143
144 advance(__end = evt->begin(), min(numberOfPrefits, evt->size()));
145
146 partial_sort(evt->begin(), __end, evt->end(),
qualitySorter);
147 }
148
149
150 for(JEvt::const_iterator track = evt->begin(); track != __end; ++track) {
151
153
155
156 if ((pos.
getZ() > cylinder.getZmin()
157 && pos.
getZ() < cylinder.getZmax()
158 && R < cylinder.getRadius())
159 || !containment) {
160
161 double Q = 0.0;
162
165 }
166 else {
167 Q = track->getQ();
168 }
169
170 if (Q > quality) {
171 he->Fill(X);
172 }
173 }
174 }
175 }
176 }
177 else {
178 WARNING(
"No neutrino." << endl);
179 }
180 }
182
183 he->Divide(hN);
184
185 out.Write();
186 out.Close();
187}
#define DEBUG(A)
Message macros.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Data structure for position in three dimensions.
double getY() const
Get y position.
double getZ() const
Get z position.
double getX() const
Get x position.
Utility class to parse command line options.
static const int JGANDALF_NUMBER_OF_HITS
number of hits from JGandalf.cc
static const int JGANDALF_CHI2
chi2 from JGandalf.cc
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
JPosition3D getPosition(const Vec &pos)
Get position.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
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).
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
KM3NeT DAQ data structures and auxiliaries.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
The Head class reflects the header of Monte-Carlo event files, which consists of keys (also referred ...
Auxiliary class for histogramming of effective volume.
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.
double E
Energy [GeV] (either MC truth or reconstructed)