Jpp 19.3.0-rc.1
the software that should make you happy
Loading...
Searching...
No Matches
JMuonSelect.cc File Reference

Program to extract events based on muon reconstruction. More...

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to extract events based on muon reconstruction.


Events outside the accepted range of cosine zenith angle will have no hits.

Author
mdejong

Definition in file JMuonSelect.cc.

Function Documentation

◆ main()

int main ( int argc,
char ** argv )

Definition at line 40 of file JMuonSelect.cc.

41{
42 using namespace std;
43 using namespace JPP;
44 using namespace KM3NETDAQ;
45
47
49
50 typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
51 typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
52
53 JParallelFileScanner_t inputFile;
54 size_t numberOfEvents;
56 JRange_t ct;
57 int debug;
58
59
60 try {
61
62 JParser<> zap("Program to extract events based on muon reconstruction."\
63 "\nEvents outside the accepted range of cosine zenith angle will have no hits.");
64
65 zap['f'] = make_field(inputFile, "input file (output of JXXXMuonReconstruction.sh)");
66 zap['n'] = make_field(numberOfEvents) = std::numeric_limits<size_t>::max();
67 zap['o'] = make_field(outputFile, "output file name") = "extract.root";
68 zap['c'] = make_field(ct, "accepted range of cosine zenith angle") = JRange_t();
69 zap['d'] = make_field(debug) = 2;
70
71 zap(argc, argv);
72 }
73 catch(const exception& error) {
74 FATAL(error.what() << endl);
75 }
76
77
78 outputFile.open();
79 outputFile.put(JMeta(argc, argv));
80
81 while (inputFile.hasNext()) {
82
83 STATUS("event: " << setw(8) << inputFile.getCounter() << '\r' << flush);
84
85 multi_pointer_type ps = inputFile.next();
86
87 JDAQEvent* tev = ps;
88 JEvt* evt = ps;
89
90 bool status = true;
91
92 if (has_reconstructed_muon(*evt)) {
93
94 const JFit& fit = get_best_reconstructed_muon(*evt);
95
96 status = ct(fit.getDZ());
97 }
98
99 if (status)
100 outputFile.put(*tev);
101 else
103 }
104 STATUS(endl);
105
106 {
108
109 io >> outputFile;
110 }
111
112 outputFile.close();
113
114 return 0;
115}
string outputFile
#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
Data structure for set of track fit results.
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.
General purpose class for parallel reading of objects from a single file or multiple files.
Range of values.
Definition JRange.hh:42
const JDAQEventHeader & getDAQEventHeader() const
Get DAQ event header.
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
const JFit & get_best_reconstructed_muon(const JEvt &evt)
Get best reconstructed muon.
bool has_reconstructed_muon(const JEvt &evt)
Test whether given event has a track with muon reconstruction.
KM3NeT DAQ data structures and auxiliaries.
Definition DataQueue.cc:39
Type definition of range.
Definition JHead.hh:43
Acoustic event fit.
Acoustic single fit.
Auxiliary class for recursive type list generation.
Definition JTypeList.hh:351
Auxiliary class for ROOT I/O of application specific meta data.
Definition JMeta.hh:72