Jpp  master_rocky
the software that should make you happy
JMuonSelect.cc
Go to the documentation of this file.
1 #include <string>
2 #include <iostream>
3 #include <iomanip>
4 
6 
9 
10 #include "JDAQ/JDAQEventIO.hh"
12 
13 #include "JSupport/JMeta.hh"
14 #include "JSupport/JSupport.hh"
18 
20 
21 #include "JTools/JRange.hh"
22 
23 #include "JReconstruction/JEvt.hh"
26 
27 #include "Jeep/JPrint.hh"
28 #include "Jeep/JParser.hh"
29 #include "Jeep/JMessage.hh"
30 
31 
32 /**
33  * \file
34  *
35  * Program to extract events based on muon reconstruction.\n
36  * Events outside the accepted range of cosine zenith angle will have no hits.
37  *
38  * \author mdejong
39  */
40 int main(int argc, char **argv)
41 {
42  using namespace std;
43  using namespace JPP;
44  using namespace KM3NETDAQ;
45 
46  typedef JRange<double> JRange_t;
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
Recording of objects on file according a format that follows from the file name extension.
General purpose messaging.
#define STATUS(A)
Definition: JMessage.hh:63
#define FATAL(A)
Definition: JMessage.hh:67
int debug
debug level
Definition: JSirene.cc:69
ROOT I/O of application specific meta data.
int main(int argc, char **argv)
Definition: JMuonSelect.cc:40
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
Utility class to parse command line options.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:2142
I/O formatting auxiliaries.
Auxiliary class to define a range between two values.
ROOT TTree parameter settings of various packages.
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.
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
Definition: JSTDTypes.hh:14
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