Jpp  17.3.1
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JShowerBjorkenY.cc
Go to the documentation of this file.
1 #include <string>
2 
6 
7 #include "JDAQ/JDAQEventIO.hh"
10 
13 
15 #include "JSupport/JSupport.hh"
17 #include "JSupport/JMeta.hh"
18 #include "JSupport/JTreeScanner.hh"
20 
21 #include "Jeep/JParser.hh"
22 #include "Jeep/JMessage.hh"
23 
24 #include "JReconstruction/JEvt.hh"
29 
30 #include "JLang/JSharedPointer.hh"
31 
32 /**
33  * \file
34  *
35  * Program to perform Shower Bjorken Y Fit for ORCA with I/O of JFIT::JEvt data.
36  * The reconstruction is made at the PMT level.
37  * \author adomi
38  */
39 
40 int main(int argc, char** argv){
41 
42  using namespace std;
43  using namespace JPP;
44  using namespace KM3NETDAQ;
45 
46  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
48  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
49 
50  JParallelFileScanner_t inputFile;
53  JLimit_t& numberOfEvents = inputFile.getLimit();
54  string detectorFile;
55  string pdfFile;
57  int debug;
58 
59  try {
60 
61  JParser<> zap;
62 
63  zap['f'] = make_field(inputFile) ;
64  zap['o'] = make_field(outputFile) = "JORCAShowerBjorkenY_Output.root";
65  zap['a'] = make_field(detectorFile) ;
66  zap['F'] = make_field(pdfFile) ;
67  zap['E'] = make_field(correct) = JShowerEnergyCorrection(); // off
69  zap['n'] = make_field(numberOfEvents) = JLimit::max();
70  zap['d'] = make_field(debug) = 2;
71 
72  zap(argc, argv);
73  }
74  catch(const exception& error) {
75  FATAL(error.what() << endl);
76  }
77 
79 
80  try {
81  load(detectorFile, detector);
82  }
83  catch(const JException& error) {
84  FATAL(error);
85  }
86 
87  outputFile.open();
88  outputFile.put(JMeta(argc, argv));
89 
90  const JModuleRouter router(detector);
91 
92  JSummaryFileRouter summary(inputFile, parameters.R_Hz);
93 
94  JShowerBjorkenY fit(parameters, router, summary, pdfFile, correct, debug);
95 
96  while (inputFile.hasNext()) {
97 
98  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
99 
100  multi_pointer_type ps = inputFile.next();
101 
102  JDAQEvent* tev = ps;
103  JEvt* in = ps;
104 
105  summary.update(*tev);
106 
107  // select start values
108  JEvt cp = *in;
109 
110  cp.select(parameters.numberOfPrefits, qualitySorter);
111 
112  if (!cp.empty()) {
113  cp.select(JHistory::is_event(cp.begin()->getHistory()));
114  }
115 
116  // fit
117  JEvt out = fit(*tev, cp);
118 
119  // apply default sorter
120  sort(out.begin(), out.end(), qualitySorter);
121 
122  copy(in->begin(), in->end(), back_inserter(out));
123 
124  outputFile.put(out);
125 
126  }
127  STATUS(endl);
128 
130 
131  io >> outputFile;
132 
133  outputFile.close();
134 }
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:70
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1517
General exception.
Definition: JException.hh:23
int main(int argc, char *argv[])
Definition: Main.cc:15
ROOT TTree parameter settings of various packages.
#define STATUS(A)
Definition: JMessage.hh:63
void update(const JDAQHeader &header)
Update router.
Detector data structure.
Definition: JDetector.hh:89
Auxiliary class for correction of energy determined by JShowerEnergy.cc.
Recording of objects on file according a format that follows from the file name extension.
Router for direct addressing of module data in detector data structure.
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
Definition: diff-Tuna.sh:38
General purpose class for parallel reading of objects from a single file or multiple files...
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
string outputFile
bool qualitySorter(const JFit &first, const JFit &second)
Comparison of fit results.
Type list.
Definition: JTypeList.hh:22
Auxiliary class for defining the range of iterations of objects.
Definition: JLimit.hh:41
Detector file.
Definition: JHead.hh:226
Acoustic event fit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
Auxiliary class to test history.
Definition: JHistory.hh:105
Parallel scanning of objects from a single file or multiple files according a format that follows fro...
ROOT I/O of application specific meta data.
File router for fast addressing of summary data.
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Direct access to module in detector data structure.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
then cp
Object reading from a list of files.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
do set_variable DETECTOR_TXT $WORKDIR detector
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:46
int debug
debug level
class to handle the direction fit of the shower reconstruction, mainly dedicated for ORCA ...
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62