Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JShowerPointSimplex.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"
18 
19 #include "Jeep/JParser.hh"
20 #include "Jeep/JMessage.hh"
21 
22 #include "JReconstruction/JEvt.hh"
25 
26 #include "JLang/JSharedPointer.hh"
27 
28 
29 /**
30  * \file
31  *
32  * Program to perform EM Shower Fit for ORCA with I/O of JFIT::JEvt data.
33  * The reconstruction is made at the PMT level.
34  * \author adomi
35  */
36 
37 int main(int argc, char** argv){
38 
39  using namespace std;
40  using namespace JPP;
41  using namespace KM3NETDAQ;
42 
43  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
45  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
46 
47  JParallelFileScanner_t inputFile;
50  JLimit_t& numberOfEvents = inputFile.getLimit();
51  string detectorFile;
52  int debug;
53 
54  try {
55 
56  JParser<> zap;
57 
58  zap['f'] = make_field(inputFile) ;
59  zap['o'] = make_field(outputFile) = "JORCAShowerPointSimplex_Output.root";
60  zap['a'] = make_field(detectorFile) ;
62  zap['n'] = make_field(numberOfEvents) = JLimit::max();
63  zap['d'] = make_field(debug) = 2;
64 
65  zap(argc, argv);
66  }
67  catch(const exception& error) {
68  FATAL(error.what() << endl);
69  }
70 
72 
73  try {
74  load(detectorFile, detector);
75  }
76  catch(const JException& error) {
77  FATAL(error);
78  }
79 
80  outputFile.open();
81  outputFile.put(JMeta(argc, argv));
82 
83  const JModuleRouter router(detector);
84 
85  JShowerPointSimplex fit(parameters, router, debug);
86 
87  while (inputFile.hasNext()) {
88 
89  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
90 
91  multi_pointer_type ps = inputFile.next();
92 
93  JDAQEvent* tev = ps;
94  JEvt* in = ps;
95 
96  // select start values
97  JEvt cp = *in;
98 
99  cp.select(parameters.numberOfPrefits, qualitySorter);
100 
101  if (!cp.empty()) {
102  cp.select(JHistory::is_event(cp.begin()->getHistory()));
103  }
104 
105  // fit
106  JEvt out = fit(*tev, cp);
107 
108  // apply default sorter
109  sort(out.begin(), out.end(), qualitySorter);
110 
111  copy(in->begin(), in->end(), back_inserter(out));
112 
113  outputFile.put(out);
114 
115  }
116  STATUS(endl);
117 
119 
120  io >> outputFile;
121 
122  outputFile.close();
123 }
class to handle the second position fit of the shower reconstruction, mainly dedicated for ORCA ...
Auxiliary class for ROOT I/O of application specific meta data.
Definition: JMeta.hh:71
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1493
General exception.
Definition: JException.hh:23
ROOT TTree parameter settings.
#define STATUS(A)
Definition: JMessage.hh:63
Detector data structure.
Definition: JDetector.hh:80
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.
esac print_variable DETECTOR INPUT_FILE OUTPUT_FILE CDF for TYPE in
Definition: JSirene.sh:45
*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:63
string outputFile
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:130
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
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.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
int debug
debug level
Definition: JSirene.cc:61
General purpose messaging.
#define FATAL(A)
Definition: JMessage.hh:67
Direct access to module in detector data structure.
Data structure for set of track fit results.
Definition: JEvt.hh:294
Utility class to parse command line options.
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:153
Object reading from a list of files.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:73
void select(const JSelector_t &selector)
Select fits.
Definition: JEvt.hh:314
bool qualitySorter(const JRECONSTRUCTION::JFit &first, const JRECONSTRUCTION::JFit &second)
Comparison of fit results.
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62
int main(int argc, char *argv[])
Definition: Main.cpp:15