Jpp  15.0.1-rc.1-highQE
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 
5 
6 #include "JDAQ/JDAQEventIO.hh"
9 
12 
14 #include "JSupport/JSupport.hh"
16 #include "JSupport/JMeta.hh"
17 #include "JSupport/JTreeScanner.hh"
19 
20 #include "Jeep/JParser.hh"
21 #include "Jeep/JMessage.hh"
22 
23 #include "JReconstruction/JEvt.hh"
28 
29 #include "JLang/JSharedPointer.hh"
30 
31 /**
32  * \file
33  *
34  * Program to perform Shower Bjorken Y Fit for ORCA with I/O of JFIT::JEvt data.
35  * The reconstruction is made at the PMT level.
36  * \author adomi
37  */
38 
39 int main(int argc, char** argv){
40 
41  using namespace std;
42  using namespace JPP;
43  using namespace KM3NETDAQ;
44 
45  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
47  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
48 
49  JParallelFileScanner_t inputFile;
52  JLimit_t& numberOfEvents = inputFile.getLimit();
53  string detectorFile;
54  string pdfFile;
56  int debug;
57 
58  try {
59 
60  JParser<> zap;
61 
62  zap['f'] = make_field(inputFile) ;
63  zap['o'] = make_field(outputFile) = "JORCAShowerBjorkenY_Output.root";
64  zap['a'] = make_field(detectorFile) ;
65  zap['F'] = make_field(pdfFile) ;
66  zap['E'] = make_field(correct) = JShowerEnergyCorrection(); // off
68  zap['n'] = make_field(numberOfEvents) = JLimit::max();
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 
78 
79  try {
80  load(detectorFile, detector);
81  }
82  catch(const JException& error) {
83  FATAL(error);
84  }
85 
86  outputFile.open();
87  outputFile.put(JMeta(argc, argv));
88 
89  const JModuleRouter router(detector);
90 
91  JSummaryFileRouter summary(inputFile, parameters.R_Hz);
92 
93  JShowerBjorkenY fit(parameters, router, summary, pdfFile, correct, debug);
94 
95  while (inputFile.hasNext()) {
96 
97  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
98 
99  multi_pointer_type ps = inputFile.next();
100 
101  JDAQEvent* tev = ps;
102  JEvt* in = ps;
103 
104  summary.update(*tev);
105 
106  // select start values
107  JEvt cp = *in;
108 
109  cp.select(parameters.numberOfPrefits, qualitySorter);
110 
111  if (!cp.empty()) {
112  cp.select(JHistory::is_event(cp.begin()->getHistory()));
113  }
114 
115  // fit
116  JEvt out = fit(*tev, cp);
117 
118  // apply default sorter
119  sort(out.begin(), out.end(), qualitySorter);
120 
121  copy(in->begin(), in->end(), back_inserter(out));
122 
123  outputFile.put(out);
124 
125  }
126  STATUS(endl);
127 
129 
130  io >> outputFile;
131 
132  outputFile.close();
133 }
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:1500
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:66
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:196
Acoustic event fit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
Auxiliary class to test history.
Definition: JHistory.hh:104
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.
int debug
debug level
Definition: JSirene.cc:63
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.
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:139
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Definition: JCanberra.sh:41
class to handle the direction fit of the shower reconstruction, mainly dedicated for ORCA ...