Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JShowerFit.cc File Reference

Program to perform EM Shower Fit for ORCA with I/O of JFIT::JEvt data. More...

#include <string>
#include <limits>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/Evt.hh"
#include "JDAQ/JDAQEventIO.hh"
#include "JDAQ/JDAQTimesliceIO.hh"
#include "JDAQ/JDAQSummarysliceIO.hh"
#include "JDetector/JModuleRouter.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JSupport/JParallelFileScanner.hh"
#include "JSupport/JSupport.hh"
#include "JSupport/JFileRecorder.hh"
#include "JSupport/JMeta.hh"
#include "JSupport/JTreeScanner.hh"
#include "JSupport/JSummaryFileRouter.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JReconstruction/JEvt.hh"
#include "JReconstruction/JShowerEnergyCorrection.hh"
#include "JReconstruction/JShowerParameters.hh"
#include "JReconstruction/JShowerFitParameters_t.hh"
#include "JReconstruction/JShowerFit.hh"
#include "JLang/JSharedPointer.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to perform EM Shower Fit for ORCA with I/O of JFIT::JEvt data.

The reconstruction is made at the PMT level.

Author
adomi

Definition in file JShowerFit.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 41 of file JShowerFit.cc.

41  {
42 
43  using namespace std;
44  using namespace JPP;
45  using namespace KM3NETDAQ;
46 
47  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
49  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
50 
51  JParallelFileScanner_t inputFile;
54  JLimit_t& numberOfEvents = inputFile.getLimit();
55  string detectorFile;
56  string pdfFile;
58  int debug;
59 
60  try {
61 
62  JParser<> zap;
63 
64  zap['f'] = make_field(inputFile) ;
65  zap['o'] = make_field(outputFile) = "JORCAShowerFit_Output.root";
66  zap['a'] = make_field(detectorFile) ;
67  zap['F'] = make_field(pdfFile) ;
68  zap['E'] = make_field(correct) = JShowerEnergyCorrection(); // off
70  zap['n'] = make_field(numberOfEvents) = JLimit::max();
71  zap['d'] = make_field(debug) = 2;
72 
73  zap(argc, argv);
74  }
75  catch(const exception& error) {
76  FATAL(error.what() << endl);
77  }
78 
80 
81  try {
82  load(detectorFile, detector);
83  }
84  catch(const JException& error) {
85  FATAL(error);
86  }
87 
88  outputFile.open();
89  outputFile.put(JMeta(argc, argv));
90 
91  const JModuleRouter router(detector);
92 
93  JSummaryFileRouter summary(inputFile, parameters.R_Hz);
94 
95  JShowerFit fit(parameters, router, summary, pdfFile, correct, debug);
96 
97  while (inputFile.hasNext()) {
98 
99  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
100 
101  multi_pointer_type ps = inputFile.next();
102 
103  JDAQEvent* tev = ps;
104  JEvt* in = ps;
105 
106  summary.update(*tev);
107 
108  // select start values
109  JEvt cp = *in;
110 
111  cp.select(parameters.numberOfPrefits, qualitySorter);
112 
113  if (!cp.empty()) {
114  cp.select(JHistory::is_event(cp.begin()->getHistory()));
115  }
116 
117  // fit
118 
119  JEvt out = fit(*tev, cp);
120 
121  // apply default sorter
122 
123  sort(out.begin(), out.end(), qualitySorter);
124 
125  // reduce output fits
126 
127  JEvt::iterator __end = out.end();
128 
129  copy(in->begin(), in->end(), back_inserter(out));
130 
131  outputFile.put(out);
132 
133  }
134  STATUS(endl);
135 
137 
138  io >> outputFile;
139 
140  outputFile.close();
141 }
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
#define STATUS(A)
Definition: JMessage.hh:63
Detector data structure.
Definition: JDetector.hh:80
Auxiliary class for correction of energy determined by JShowerEnergy.cc.
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
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
File router for fast addressing of summary data.
int debug
debug level
Definition: JSirene.cc:63
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Data structure for fit parameters.
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
class to handle the direction fit of the shower reconstruction, mainly dedicated for ORCA ...
Definition: JShowerFit.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:38
bool qualitySorter(const JRECONSTRUCTION::JFit &first, const JRECONSTRUCTION::JFit &second)
Comparison of fit results.