Jpp 20.0.0-27-g39925593c-D
the software that should make you happy
Loading...
Searching...
No Matches
Functions
JShowerMCEvt.cc File Reference

Auxiliary program to store Monte Carlo information from a neutrino or the primary electron in JFIT::JEvt format. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/MultiHead.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "km3net-dataformat/tools/time_converter.hh"
#include "JAAnet/JHead.hh"
#include "JAAnet/JHeadToolkit.hh"
#include "JAAnet/JAAnetToolkit.hh"
#include "JDAQ/JDAQEventIO.hh"
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JTrigger/JTriggerParameters.hh"
#include "JSupport/JTriggeredFileScanner.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JMonteCarloFileSupportkit.hh"
#include "JSupport/JSupport.hh"
#include "JSupport/JMeta.hh"
#include "JPhysics/JGeanz.hh"
#include "JReconstruction/JEvt.hh"
#include "JReconstruction/JEvtToolkit.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to store Monte Carlo information from a neutrino or the primary electron in JFIT::JEvt format.

By default the neutrino is considered, a bool variable allows to select the primary electron instead.

Author
mdejong, adomi

Definition in file JShowerMCEvt.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 39 of file JShowerMCEvt.cc.

40{
41 using namespace std;
42 using namespace JPP;
43 using namespace KM3NETDAQ;
44
46
49 JLimit_t& numberOfEvents = inputFile.getLimit();
50 int debug;
51 bool take_electron;
52
53 try {
54
55 JParser<> zap("Auxiliary program to store Monte Carlo true shower in format for subsequent fits.");
56
57 zap['f'] = make_field(inputFile, "output of JTriggerEfficiency[.sh]");
58 zap['o'] = make_field(outputFile) = "mcevt.root";
59 zap['n'] = make_field(numberOfEvents) = JLimit::max();
60 zap['d'] = make_field(debug) = 2;
62
63 zap(argc, argv);
64 }
65 catch(const exception& error) {
66 FATAL(error.what() << endl);
67 }
68
69
70 const Vec offset = getOffset(getHeader(inputFile));
71
72 outputFile.open();
73
75
76 while (inputFile.hasNext()) {
77
78 STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
79
81
82 const JDAQEvent* tev = ps;
83 const Evt* event = ps;
84 JEvt out;
85
86 const time_converter converter(*event, *tev);
87
89
90 if(!take_electron) fermion = find_if(event->mc_trks.begin(), event->mc_trks.end(), is_neutrino);
91 else fermion = find_if(event->mc_trks.begin(), event->mc_trks.end(), is_electron);
92
93 if (fermion != event->mc_trks.end()) {
94
95 // if fermion = neutrino => fermion position = neutrino interaction vertex
96 double time = converter.putTime();
97 JVector3D position = getPosition(*fermion);
98
99 // if fermion = electron => fermion position and time = EM shower brightest point
100 if(take_electron){
102 double shower_elongation = geanz.getMaximum(fermion->E);
104 position.add(electron_dir);
106 }
107
108 JShower3D td(JVertex3D(position, time), getDirection(*fermion));
109 JShower3E ta(td, fermion->E);
110
111 ta.add(getPosition(offset));
112
113 out.push_back(getFit(JMCEVT, ta, 0, 0.0, ta.getE()));
114
115 }
116
117 outputFile.put(out);
118 }
119 STATUS(endl);
120
122
123 io >> outputFile;
124
125 outputFile.close();
126}
string outputFile
#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
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition JParser.hh:2142
3D shower with energy.
Definition JShower3E.hh:31
Data structure for vector in three dimensions.
Definition JVector3D.hh:36
JVector3D & add(const JVector3D &vector)
Add vector.
Definition JVector3D.hh:142
Template definition of a multi-dimensional oscillation probability interpolation table.
Auxiliary class to convert DAQ hit time to/from Monte Carlo hit time.
JDirection3D getDirection(const Vec &dir)
Get direction.
bool is_electron(const Trk &track)
Test whether given track is a (anti-)electron.
bool is_neutrino(const Trk &track)
Test whether given track is a neutrino.
JPosition3D getPosition(const Vec &pos)
Get position.
Vec getOffset(const JHead &header)
Get offset.
JFit getFit(const int id, const JMODEL::JString &string)
Get fit parameters of string.
static const JGeanz geanz(1.85, 0.62, 0.54)
Function object for longitudinal EM-shower profile.
const double getInverseSpeedOfLight()
Get inverse speed of light.
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.
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
The Vec class is a straightforward 3-d vector, which also works in pyroot.
Definition Vec.hh:13