83 using namespace KM3NETDAQ;
86 typedef JTriggeredFileScanner_t::multi_pointer_type multi_pointer_type;
88 JTriggeredFileScanner_t inputFile;
91 size_t numberOfPrefits;
103 JParser<> zap(
"Example program to histogram fit results.");
107 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
114 zap[
'O'] =
make_field(option) =
"E",
"N",
"LINE",
"LOGE";
120 catch(
const exception& error) {
121 FATAL(error.what() << endl);
133 const JVolume volume(head, option !=
"LINE");
137 cylinder.
add(center);
139 NOTICE(
"Center [m]: " << center << endl);
140 NOTICE(
"Reposition can [m]: " << cylinder << endl);
145 TH1D job(
"job", NULL, 100, 0.5, 100.5);
147 TH1D hn(
"hn", NULL, 250, -0.5, 249.5);
148 TH1D hq(
"hq", NULL, 300, 0.0, 600.0);
149 TH1D hi(
"hi", NULL, 101, -0.5, 100.5);
150 TH1D hv(
"hv", NULL, 200, -6.0, 0.0);
151 TH1D h1(
"h1", NULL, 200, -2.0, +2.0);
152 TH1D hc(
"hc", NULL, 200, -1.0, +1.0);
153 TH1D hu(
"hu", NULL, 400, -1.0e3, 1.0e3);
155 TH1D hx(
"hx", NULL, 70, -3.0, +2.3);
156 TH1D hd(
"hd", NULL, 100, 0.0, 10.0);
157 TH1D ht(
"ht", NULL, 100, -100.0, 100.0);
159 TH1D hz0(
"hz0[start]", NULL, 400, -200.0, 200.0);
160 TH1D hz1(
"hz1[end]", NULL, 400, -200.0, 200.0);
162 TH1D E_0(
"E_0", NULL, 100, volume.getXmin(), volume.getXmax());
163 TH1D E_1(
"E_1", NULL, 100, volume.getXmin(), volume.getXmax());
164 TH1D E_2(
"E_2", NULL, 100, volume.getXmin(), volume.getXmax());
165 TH1D E_E(
"E_E", NULL, 100, -5.0, +5.0);
166 TH2D ExE(
"ExE", NULL,
167 40, volume.getXmin(), volume.getXmax(),
168 40, volume.getXmin(), volume.getXmax());
170 const Int_t ny = 28800;
171 const Double_t ymin = 0.0;
172 const Double_t ymax = 180.0;
176 if (option.find(
'E') != string::npos) {
178 for (
double x = volume.getXmin();
x <= volume.getXmax();
x += (volume.getXmax() - volume.getXmin()) / 20) {
186 for ( ; x <= 15.5; x += 1.0) {
X.push_back(x); }
187 for ( ; x <= 25.5; x += 2.0) {
X.push_back(x); }
188 for ( ; x <= 50.5; x += 5.0) {
X.push_back(x); }
189 for ( ; x <= 100.5; x += 10.0) {
X.push_back(x); }
190 for ( ; x <= 250.5; x += 20.0) {
X.push_back(x); }
193 TH2D h2(
"h2", NULL,
X.size() - 1,
X.data(), ny, ymin, ymax);
196 100, 0.0, cylinder.getRadius()*cylinder.getRadius(),
197 100, cylinder.getZmin() - 50.0, cylinder.getZmax() + 50.0);
199 100, 0.0, cylinder.getRadius()*cylinder.getRadius(),
200 100, cylinder.getZmin() - 50.0, cylinder.getZmax() + 50.0);
206 while (inputFile.hasNext()) {
208 STATUS(
"event: " << setw(10) << inputFile.getCounter() <<
'\r');
DEBUG(endl);
210 multi_pointer_type ps = inputFile.next();
237 if (track->E > Emax) {
244 if (muon == event->mc_trks.end()) {
255 if (option.find(
'E') != string::npos)
256 x = volume.getX(event->mc_trks[0].E);
262 JEvt::iterator __end = partition(evt->begin(), evt->end(),
JHistory::is_event(application));
264 if (evt->begin() == __end) {
270 if (numberOfPrefits > 0) {
272 JEvt::iterator __q = __end;
274 advance(__end = evt->begin(), min(numberOfPrefits, (
size_t)
distance(evt->begin(), __q)));
294 JEvt::iterator best = pointing(evt->begin(), __end);
295 const Double_t beta = pointing.
getAngle(*best);
296 const double Efit = best->getE();
297 const double Eraw = best->getW(
JENERGY_ENERGY, numeric_limits<double>::min());
298 const double mip = best->getW(
JSTART_NPE_MIP, numeric_limits<double>::max());
302 bool ok = (Efit >= Emin_GeV && mip >= NPE);
308 hn.Fill((Double_t) best->getNDF());
309 hq.Fill(best->getQ());
310 hi.Fill((Double_t)
distance(evt->begin(), best));
311 hc.Fill(best->getDZ());
316 (!
has_neutrino(*event) && best->getDZ() >= atmosphere.dot2)) {
317 hu.Fill(atmosphere(evt->begin(), __end));
320 hx.Fill(max(
log10(beta), hx.GetXaxis()->GetXmin()));
328 tb.
sub(converter.putTime());
345 if (cylinder.is_inside(vertex)) {
349 Va.Fill(best->getX()*best->getX() + best->getY()*best->getY(), best->getZ());
358 Vb.Fill(best->getX()*best->getX() + best->getY()*best->getY(), best->getZ());
361 E_0.Fill(volume.getX(E,
true));
362 E_1.Fill(volume.getX(Eraw,
true));
363 E_2.Fill(volume.getX(Efit,
true));
364 E_E.Fill(volume.getX(Efit) - volume.getX(E));
365 ExE.Fill(volume.getX(E), volume.getX(Efit));
375 const double npe = best->getW(
JVETO_NPE);
377 const double pv = TMath::PoissonI(count, npe);
379 hv.Fill(max(
log10(pv), hv.GetXaxis()->GetXmin()));
386 NOTICE(
"Number of events input " << setw(8) << right << job.GetBinContent(1) << endl);
387 NOTICE(
"Number of events with muon " << setw(8) << right << job.GetBinContent(3) << endl);
388 NOTICE(
"Number of events with fit " << setw(8) << right << job.GetBinContent(4) << endl);
389 NOTICE(
"Number of events selected " << setw(8) << right << job.GetBinContent(5) << endl);
390 NOTICE(
"Number of events with neutrino " << setw(8) << right << job.GetBinContent(6) << endl);
391 NOTICE(
"Number of events contained " << setw(8) << right << job.GetBinContent(7) << endl);
393 if (
Q.getCount() != 0) {
394 NOTICE(
"Median space angle [deg] " <<
FIXED (6,3) <<
Q.getQuantile(0.5) << endl);
static const int JMUONSTART
Utility class to parse command line options.
Q(UTCMax_s-UTCMin_s)-livetime_s
static const int JMUONPATH
static const int JVETO_NPE
number of photo-electrons from JVeto.cc
Auxiliary class to compare fit results with respect to a reference direction (e.g. true muon).
then usage $script< input file >[option[primary[working directory]]] nWhere option can be E
JTrack3E getTrack(const Trk &track)
Get track.
static const int JENERGY_ENERGY
uncorrected energy [GeV] from JEnergy.cc
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
JTime & sub(const JTime &value)
Subtraction operator.
const char *const neutrino_t
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.
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)...
static const JGeaneWater gWater
Function object for energy loss of muon in sea water.
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
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 JSTART_NPE_MIP
number of photo-electrons up to the barycentre from JStart.cc
JTime & add(const JTime &value)
Addition operator.
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Auxiliary class for histogramming of effective volume.
Auxiliary class for defining the range of iterations of objects.
const_iterator< T > end() const
Get end of data.
static const int JMUONPREFIT
double getAngle(const JFit &fit) const
Get angle between reference direction and fit result.
JDirection3D getDirection(const Vec &dir)
Get direction.
const_iterator< T > begin() const
Get begin of data.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
set_variable E_E log10(E_{fit}/E_{#mu})"
Auxiliary class to test history.
static const int JMUONGANDALF
JPosition3D getPosition(const Vec &pos)
Get position.
static const int JVETO_NUMBER_OF_HITS
number of hits from JVeto.cc
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.
Auxiliary data structure for average.
const double getSpeedOfLight()
Get speed of light.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
static const int JMUONSIMPLEX
int getCount(const T &hit)
Get hit count.
no fit printf nominal n $STRING awk v X
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.
JVector3D & add(const JVector3D &vector)
Add vector.
static const int JMUONENERGY
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
#define DEBUG(A)
Message macros.