83 using namespace KM3NETDAQ;
86 typedef JTriggeredFileScanner_t::multi_pointer_type multi_pointer_type;
88 JTriggeredFileScanner_t inputFile;
91 size_t numberOfPrefits;
106 JParser<> zap(
"Example program to histogram fit results.");
110 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
117 zap[
'O'] =
make_field(option) =
"E",
"N",
"LINE",
"LOGE";
120 zap[
'r'] =
make_field(radius) = JLimit::max();
126 catch(
const exception& error) {
127 FATAL(error.what() << endl);
130 cout <<
"APPLICATION " << application << endl;
141 const JVolume volume(head, option !=
"LINE");
145 cylinder.
add(center);
147 NOTICE(
"Center: " << center << endl);
148 NOTICE(
"Reposition can [m]: " << cylinder << endl);
150 const double EMIN_GEV = 10e3;
154 TH1D job(
"job", NULL, 100, 0.5, 100.5);
156 TH1D hn(
"hn",
"NDF (Number of Degrees of Freedom)", 250, -0.5, 249.5);
157 TH1D hq(
"hq",
"Fit Quality", 300, 0.0, 600.0);
158 TH1D hi(
"hi",
"Fit Index vs Best Resolution", 101, -0.5, 100.5);
159 TH1D hd(
"hd",
"Square Distance between Reco and True position", 2000, 0.0, 400.0);
160 TH1D hz(
"hz",
"Longitudinal Distance between Reco and MC lepton position", 100, -200.0, 200.0);
161 TH1D ht(
"ht",
"Time difference between Reco and MC lepton", 100, -100.0, 100.0);
163 TH1D ha(
"ha",
"Angle between reco direction and true direction", 1000, 0.0, 180.0);
165 TH1D e0(
"e0",
"True lepton energy", 100, volume.getXmin(), volume.getXmax());
166 TH1D e2(
"e2",
"Reconstructed energy", 100, volume.getXmin(), volume.getXmax());
167 TH1D er(
"er",
"Ratio of reconstructed energy and true energy", 100, -5.0, +5.0);
168 TH1D ea(
"ea",
"Distribution of Energy error for all the events; E_{reco}-E_{true}", 100, -30, +30);
169 TH1D ed3_5GeV(
"ed3_5GeV",
"Distribution of Energy error for events with MC energy #in [3,5] GeV; E_{reco}-E_{true}", 100, -30, +30);
170 TH1D ed8_11GeV(
"ed8_11GeV",
"Distribution of Energy error for events with MC energy #in [8,11] GeV; E_{reco}-E_{true}", 100, -30, +30);
171 TH1D ed15_21GeV(
"ed15_21GeV",
"Distribution of Energy error for events with MC energy #in [15,21] GeV; E_{reco}-E_{true}", 100, -30, +30);
172 TH2D ee(
"ee",
"; E_{true} [GeV]; E_{reco} [GeV]",
173 40, volume.getXmin(), volume.getXmax(),
174 40, volume.getXmin(), volume.getXmax());
176 const Int_t ny = 28800;
177 const Double_t ymin = 0.0;
178 const Double_t ymax = 180.0;
182 if (option.find(
'E') != string::npos) {
184 for (
double x = volume.getXmin(); x <= volume.getXmax(); x += (volume.getXmax() - volume.getXmin()) / 20) {
192 for ( ; x <= 15.5; x += 1.0) { X.push_back(x); }
193 for ( ; x <= 25.5; x += 2.0) { X.push_back(x); }
194 for ( ; x <= 50.5; x += 5.0) { X.push_back(x); }
195 for ( ; x <= 100.5; x += 10.0) { X.push_back(x); }
196 for ( ; x <= 250.5; x += 20.0) { X.push_back(x); }
199 TH2D h2(
"h2", NULL, X.size() - 1, X.data(), ny, ymin, ymax);
201 TProfile herrorE(
"herrorE",
"Energy Error", X.size() - 1, X.data());
202 TProfile hfracE(
"hfracE",
"Fractional Energy Error", X.size() - 1, X.data());
203 TProfile he(
"he",
"Reconstruction Efficiency", X.size() - 1, X.data());
204 TProfile htheta_nu_lep(
"htheta_nu_lep",
"Angle between neutrino and primary lepton", X.size() - 1, X.data());
206 TH2D hb(
"hb", NULL, 100, 0.0, 0.5e6, 100, -100.0, +900.0);
207 TH2S hmca(
"hmca", NULL, X.size() - 1, X.data(), 1000, 0, 180);
209 TH2D hzenith(
"hzenith",
"Reco Zenith vs MC Energy", 100, 0, 100, ny, ymin, ymax);
216 while (inputFile.hasNext()) {
218 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
220 multi_pointer_type ps = inputFile.next();
251 if (mc_evt->E > Emax) {
257 }
else if(isMuon &&
is_muon(*mc_evt)){
260 if (mc_evt->E > Emax) {
267 if (lepton == event->mc_trks.end()) {
278 if (option.find(
'E') != string::npos){
280 if(wrtNeutrino ==
true && !isMuon) x = volume.getX(neutrino.
E);
281 else if(!wrtNeutrino && !isMuon) x = volume.getX(lepton->E);
292 JEvt::iterator __end = partition(evt->begin(), evt->end(),
JHistory::is_event(application));
294 if (evt->begin() == __end) {
301 if (numberOfPrefits > 0 ) {
303 JEvt::iterator __q = __end;
305 advance(__end = evt->begin(), min(numberOfPrefits, (
size_t)
distance(evt->begin(), __q)));
314 JEvt::iterator best = evt->begin();
322 if(!wrtNeutrino && !isMuon){
324 }
else if(wrtNeutrino ==
true && !isMuon){
330 JEvt::iterator fit_with_smallest_error = best;
333 fit_with_smallest_error = position(evt->begin(), __end);
335 fit_with_smallest_error =
energy(evt->begin(), __end);
337 fit_with_smallest_error = pointing(evt->begin(), __end);
340 const Double_t beta = pointing.getAngle(*best);
341 const double Efit = best->getE();
348 bool ok = (Efit >= Emin_GeV);
356 hn.Fill((Double_t) best->getNDF());
357 hq.Fill(best->getQ());
358 hi.Fill((Double_t)
distance(evt->begin(), fit_with_smallest_error));
376 tb.
sub(converter.putTime());
378 if(!isMuon && !wrtNeutrino){
382 hd.Fill(distance_m * distance_m);
388 hd.Fill(distance_m * distance_m);
400 if (cylinder.is_inside(mc_vx)) {
408 if (best->getE() >= EMIN_GEV) {
409 hb.Fill(best->getX()*best->getX() + best->getY()*best->getY(), best->getZ());
421 e0.Fill(volume.getX(Enu,
true));
422 er.Fill(volume.getX(Efit) - volume.getX(Enu));
423 ee.Fill(volume.getX(Enu), volume.getX(Efit));
425 hzenith.Fill(Enu, zenith);
427 herrorE.Fill(x, volume.getX(Efit) - volume.getX(Enu));
428 hfracE.Fill(x, abs(volume.getX(Efit) - volume.getX(Enu))/volume.getX(Enu));
430 if(Enu >= 3 && Enu <= 5) ed3_5GeV.Fill(Efit - Enu);
431 else if(Enu >= 8 && Enu <= 11) ed8_11GeV.Fill(Efit - Enu);
432 else if(Enu >= 15 && Enu <= 21) ed15_21GeV.Fill(Efit - Enu);
436 e0.Fill(volume.getX(Elep,
true));
437 er.Fill(volume.getX(Efit) - volume.getX(Elep));
438 ee.Fill(volume.getX(Elep), volume.getX(Efit));
439 ea.Fill(Efit - Elep);
440 hzenith.Fill(Elep, zenith);
442 herrorE.Fill(x, volume.getX(Efit) - volume.getX(Elep));
443 hfracE.Fill(x, abs(volume.getX(Efit) - volume.getX(Elep))/volume.getX(Elep));
445 if(Elep >= 3 && Elep <= 5) ed3_5GeV.Fill(Efit - Elep);
446 else if(Elep >= 8 && Elep <= 11) ed8_11GeV.Fill(Efit - Elep);
447 else if(Elep >= 15 && Elep <= 21) ed15_21GeV.Fill(Efit - Elep);
451 e2.Fill(volume.getX(Efit,
true));
462 NOTICE(
"Number of events input " << setw(8) << right << job.GetBinContent(1) << endl);
464 NOTICE(
"Number of events with electron " << setw(8) << right << job.GetBinContent(3) << endl);
466 NOTICE(
"Number of events with muon " << setw(8) << right << job.GetBinContent(3) << endl);
468 NOTICE(
"Number of events with fit " << setw(8) << right << job.GetBinContent(4) << endl);
469 NOTICE(
"Number of events selected " << setw(8) << right << job.GetBinContent(5) << endl);
470 NOTICE(
"Number of events with neutrino " << setw(8) << right << job.GetBinContent(6) << endl);
471 NOTICE(
"Number of events contained " << setw(8) << right << job.GetBinContent(7) << endl);
473 if (Q.getCount() != 0 && application ==
JSHOWERFIT) {
474 NOTICE(
"Median space angle [deg] " <<
FIXED (6,3) << Q.getQuantile(0.5) << endl);
bool is_electron(const Trk &track)
Test whether given track is a (anti-)electron.
Utility class to parse command line options.
Auxiliary class to compare fit results with respect to a reference position (e.g. ...
double getAngle(const JFirst_t &first, const JSecond_t &second)
Get space angle between objects.
Auxiliary class to compare fit results with respect to a reference direction (e.g.
JTrack3E getTrack(const Trk &track)
Get track.
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
Data structure for circle in two dimensions.
JTime & sub(const JTime &value)
Subtraction operator.
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
double getIntersection(const JVector3D &pos) const
Get longitudinal position along axis of position of closest approach with given position.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
static const int JSHOWERPOINTSIMPLEX
General purpose sorter of fit results.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
JCylinder3D & add(const JVector3D &pos)
Add position.
Auxiliary data structure for floating point format specification.
double E
Energy [GeV] (either MC truth or reconstructed)
static const int JSHOWERENERGYPREFIT
JVersor3D getDirection(const JVector3D &pos) const
Get photon direction of Cherenkov light on PMT.
JTime & add(const JTime &value)
Addition operator.
static const int JSHOWERPOSITIONFIT
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Auxiliary class for defining the range of iterations of objects.
const_iterator< T > end() const
Get end of data.
static const int JSHOWERPREFIT
Data structure for vector in three dimensions.
const_iterator< T > begin() const
Get begin of data.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
static const JGeanz geanz(1.85, 0.62, 0.54)
Function object for longitudinal EM-shower profile.
Auxiliary class to test history.
static const int JSHOWERDIRECTIONPREFIT
double getTheta() const
Get theta angle.
const JPosition3D & getPosition() const
Get position.
Reconstruction type dependent comparison of track quality.
Auxiliary class to evaluate atmospheric muon hypothesis.
double getT(const JVector3D &pos) const
Get arrival time of Cherenkov light at given position.
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
static const int JSHOWERCOMPLETEFIT
then for APP in event gandalf start energy
Data structure for set of track fit results.
double getMaximum(const double E) const
Get depth of shower maximum.
int getCount(const T &hit)
Get hit count.
JDirection3D getDirection(const Vec &v)
Get direction.
Auxiliary class to convert DAQ/trigger hit time to/from Monte Carlo hit time.
Data structure for position in three dimensions.
const JLimit & getLimit() const
Get limit.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
Auxiliary class for histogramming of effective volume.
JVector3D & add(const JVector3D &vector)
Add vector.
static const int JSHOWERFIT
Jpp shower reconstruction type.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
#define DEBUG(A)
Message macros.
JPosition3D getPosition(const Vec &v)
Get position.