Jpp test-rotations-old
the software that should make you happy
Loading...
Searching...
No Matches
JMuonMCEvt.cc
Go to the documentation of this file.
1#include <string>
2#include <iostream>
3#include <iomanip>
4
9
10#include "JAAnet/JHead.hh"
13#include "JDAQ/JDAQEventIO.hh"
20#include "JSupport/JSupport.hh"
21#include "JSupport/JMeta.hh"
22
25
26#include "Jeep/JParser.hh"
27#include "Jeep/JMessage.hh"
28
29
30/**
31 * \file
32 *
33 * Auxiliary program to store Monte Carlo true muon in JFIT::JEvt format.
34 * \author mdejong
35 */
36int main(int argc, char **argv)
37{
38 using namespace std;
39 using namespace JPP;
40 using namespace KM3NETDAQ;
41
43
46 JLimit_t& numberOfEvents = inputFile.getLimit();
47 int debug;
48
49 try {
50
51 JParser<> zap("Auxiliary program to store Monte Carlo true muon in format for subsequent fits.");
52
53 zap['f'] = make_field(inputFile, "output of JTriggerEfficiency[.sh]");
54 zap['o'] = make_field(outputFile) = "mcevt.root";
55 zap['n'] = make_field(numberOfEvents) = JLimit::max();
56 zap['d'] = make_field(debug) = 2;
57
58 zap(argc, argv);
59 }
60 catch(const exception& error) {
61 FATAL(error.what() << endl);
62 }
63
64
65 const Vec offset = getOffset(getHeader(inputFile));
66
67 outputFile.open();
68
69 outputFile.put(JMeta(argc, argv));
70
71 while (inputFile.hasNext()) {
72
73 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
74
76
77 const JDAQEvent* tev = ps;
78 const Evt* event = ps;
79 JEvt out;
80
81 const time_converter converter(*event, *tev);
82
83 vector<Trk>::const_iterator muon = find_if(event->mc_trks.begin(), event->mc_trks.end(), is_muon);
84
85 if (muon != event->mc_trks.end()) {
86
87 JTrack3E ta = getTrack(*muon);
88
89 ta.add(getPosition(offset));
90 ta.add(converter.putTime());
91
92 out.push_back(getFit(JMCEVT, ta, 0.0, 0, ta.getE()));
93
94 if (has_neutrino(*event)) {
95 out.rbegin()->setW(0, (get_neutrino(*event).pos - muon->pos).len());
96 }
97 }
98
99 outputFile.put(out);
100 }
101 STATUS(endl);
102
104
105 io >> outputFile;
106
107 outputFile.close();
108}
Definition of hit and track types and auxiliary methods for handling Monte Carlo data.
string outputFile
Recording of objects on file according a format that follows from the file name extension.
General purpose messaging.
#define DEBUG(A)
Message macros.
Definition JMessage.hh:62
#define STATUS(A)
Definition JMessage.hh:63
#define FATAL(A)
Definition JMessage.hh:67
int debug
debug level
Definition JSirene.cc:72
ROOT I/O of application specific meta data.
int main(int argc, char **argv)
Definition JMuonMCEvt.cc:36
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
ROOT TTree parameter settings of various packages.
Synchronously read DAQ events and Monte Carlo events (and optionally other events).
JTime & add(const JTime &value)
Addition operator.
3D track with energy.
Definition JTrack3E.hh:32
double getE() const
Get energy.
Definition JTrack3E.hh:93
Utility class to parse command line options.
Definition JParser.hh:1698
Object writing to file.
General purpose class for object reading from a list of file names.
counter_type getCounter() const
Get counter.
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
double putTime() const
Get Monte Carlo time minus DAQ/trigger time.
static const int JMCEVT
JTrack3E getTrack(const Trk &track)
Get track.
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino.
JPosition3D getPosition(const Vec &pos)
Get position.
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon.
Vec getOffset(const JHead &header)
Get offset.
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino.
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header.
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
The Evt class respresent a Monte Carlo (MC) event as well as an offline event.
Definition Evt.hh:21
Acoustic event fit.
General purpose class for multiple pointers.
Type list.
Definition JTypeList.hh:23
Auxiliary class for defining the range of iterations of objects.
Definition JLimit.hh:45
static counter_type max()
Get maximum counter value.
Definition JLimit.hh:128
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
virtual bool hasNext() override
Check availability of next element.
virtual const multi_pointer_type & next() override
Get next element.
Vec pos
postion [m] of the track at time t
Definition Trk.hh:17
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition Vec.hh:13
Auxiliary include file for time conversion between DAQ/trigger hit and Monte Carlo hit.