28 static const int JQUALITY = -1;
41 JKey(
const char*
name,
56 friend inline bool operator<(
const JKey&
first,
const JKey& second)
58 return first.index < second.index;
72 #define make_key(PARAMETER) JKey(#PARAMETER, PARAMETER)
121 void Fill(
const Double_t xA,
const Double_t xB,
const bool option)
123 hA->Fill(logx ? log10(xA) : xA);
124 hB->Fill(logx ? log10(xB) : xB);
126 hC->Fill(logx ? log10(xB/xA) : xB - xA);
128 hD->Fill(logx ? log10(xB/xA) : xB - xA);
137 if (hA->GetEntries() != 0) { hA->Scale(1.0/hA->GetEntries()); }
138 if (hB->GetEntries() != 0) { hB->Scale(1.0/hB->GetEntries()); }
139 if (hC->GetEntries() != 0) { hC->Scale(1.0/hC->GetEntries()); }
140 if (hD->GetEntries() != 0) { hD->Scale(1.0/hD->GetEntries()); }
149 void Write(TFile& out)
151 out.WriteTObject(hA);
152 out.WriteTObject(hB);
153 out.WriteTObject(hC);
154 out.WriteTObject(hD);
181 void insert(
const JKey& key,
185 const double logx =
false)
189 TH1D* hA =
new TH1D((
"[A " + key.name +
"]").c_str(), NULL, nx, xmin, xmax);
190 TH1D* hB =
new TH1D((
"[B " + key.name +
"]").c_str(), NULL, nx, xmin, xmax);
191 TH1D* hC =
new TH1D((
"[C " + key.name +
"]").c_str(), NULL, nx, -xmax, xmax);
192 TH1D* hD =
new TH1D((
"[D " + key.name +
"]").c_str(), NULL, nx, -xmax, xmax);
205 void Fill(
const JFit& fA,
const JFit& fB,
const bool option)
207 for (
iterator i = begin(); i != end(); ++i) {
209 const int index = i->first.index;
211 if (index == JQUALITY) {
212 i->second.Fill(fA.
getQ(), fB.
getQ(), option);
213 }
else if (fA.
hasW(index) && fB.
hasW(index)) {
214 i->second.Fill(fA.
getW(index), fB.
getW(index), option);
225 for (
iterator i = this->begin(); i != this->end(); ++i) {
236 void Write(TFile& out)
238 for (
iterator i = this->begin(); i != this->end(); ++i) {
239 i->second.Write(out);
249 void Write(
const char* file_name)
251 TFile out(file_name,
"RECREATE");
267 int main(
int argc,
char **argv)
273 typedef JTriggeredFileScanner_t::multi_pointer_type multi_pointer_type;
275 JTriggeredFileScanner_t inputFileA;
276 JTriggeredFileScanner_t inputFileB;
284 JParser<> zap(
"Example program to compare fit results from two files.");
289 zap[
'n'] =
make_field(numberOfEvents) = JLimit::max();
295 catch(
const exception& error) {
296 FATAL(error.what() << endl);
307 const double E_nu_min = head.cut_nu.Emin;
308 const double E_nu_max = head.cut_nu.Emax;
310 inputFileA.setLimit(numberOfEvents);
311 inputFileB.setLimit(numberOfEvents);
318 manager.insert(
make_key(JQUALITY), 101, 0.0, 250.0);
328 TH1D hA(
"h[A]", NULL, 100, -3.0, +2.3);
329 TH1D hB(
"h[B]", NULL, 100, -3.0, +2.3);
330 TH2D hA_angle_E(
"hA_angle_E", NULL, 20, E_nu_min, E_nu_max, 100, 0,90);
331 TH2D hB_angle_E(
"hB_angle_E", NULL, 20, E_nu_min, E_nu_max, 100, 0,90);
334 360, -180.0, +180.0);
336 while (inputFileA.hasNext() && inputFileB.hasNext()) {
338 STATUS(
"event: " << setw(10) << inputFileA.getCounter() <<
'\r');
DEBUG(endl);
340 multi_pointer_type psA = inputFileA.next();
341 multi_pointer_type psB = inputFileB.next();
345 while (psA.get<
Evt>()->
mc_id < psB.get<
Evt>()->
mc_id && inputFileA.hasNext()) { psA = inputFileA.next(); }
346 while (psB.get<
Evt>()->
mc_id < psA.get<
Evt>()->
mc_id && inputFileB.hasNext()) { psB = inputFileB.next(); }
348 if (!psA.is_valid()) {
continue; }
349 if (!psB.is_valid()) {
continue; }
351 if (psA.get<
Evt>()->
mc_id == psB.get<
Evt>()->mc_id) {
361 if (muon == event->mc_trks.end()) {
continue; }
363 if (evtA->empty()) {
continue; }
364 if (evtB->empty()) {
continue; }
366 JEvt::const_iterator fitA = evtA->begin();
367 JEvt::const_iterator fitB = evtB->begin();
372 hA.Fill(log10(angleA));
373 hB.Fill(log10(angleB));
375 h2.Fill(fitB->getQ() - fitA->getQ(), angleB - angleA);
377 const double Enu = neutrino.
E;
378 hA_angle_E.Fill(Enu, angleA);
379 hB_angle_E.Fill(Enu, angleB);
381 if (angleA > angle_Deg) {
382 manager.Fill(*fitA, *fitB, angleB < angle_Deg);
Utility class to parse command line options.
static const int JSTART_NPE_MIP_TOTAL
number of photo-electrons along the whole track from JStart.cc
ROOT TTree parameter settings.
double getAngle(const JFirst_t &first, const JSecond_t &second)
Get space angle between objects.
static const int JENERGY_ENERGY
uncorrected energy [GeV] from JEnergy.cc
Synchronously read DAQ events and Monte Carlo events (and optionally other events).
bool operator<(const Head &first, const Head &second)
Less than operator.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
static const int JGANDALF_BETA1_RAD
angular resolution [rad] from JGandalf.cc
static const int JENERGY_CHI2
chi2 from JEnergy.cc
double E
Energy [GeV] (either MC truth or reconstructed)
then echo The file $DIR KM3NeT_00000001_00000000 root already please rename or remove it first
static const int JSTART_NPE_MIP
number of photo-electrons up to the barycentre from JStart.cc
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
Data structure for track fit results.
#define make_key(PARAMETER)
Make key.
Auxiliary class to manage set of compatible ROOT objects (e.g.
Auxiliary class for defining the range of iterations of objects.
static const int JGANDALF_NUMBER_OF_HITS
number of hits from JGandalf.cc
bool hasW(const int i) const
Check availability of value.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
int mc_id
identifier of the MC event (as found in ascii or antcc file).
static const int JGANDALF_BETA0_RAD
KM3NeT Data Definitions v1.2.3 https://git.km3net.de/common/km3net-dataformat.
General purpose messaging.
double getQ() const
Get quality.
static const int JSTART_LENGTH_METRES
distance between first and last hits in metres from JStart.cc
Data structure for set of track fit results.
Utility class to parse command line options.
Wrapper class around template object.
JDirection3D getDirection(const Vec &v)
Get direction.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
const std::vector< double > & getW() const
Get values.
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower.
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
#define DEBUG(A)
Message macros.
int main(int argc, char *argv[])