Jpp
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JShowerPositionFit.cc File Reference

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

#include <string>
#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/JShowerPositionFitParameters_t.hh"
#include "JReconstruction/JShowerPositionFit.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 Second Position Fit for ORCA with I/O of JFIT::JEvt data.

The reconstruction is made at the HIT level.

Author
adomi

Definition in file JShowerPositionFit.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 38 of file JShowerPositionFit.cc.

38  {
39 
40  using namespace std;
41  using namespace JPP;
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  string pdfFile;
53  int debug;
54 
55  try {
56 
57  JParser<> zap;
58 
59  zap['f'] = make_field(inputFile) ;
60  zap['o'] = make_field(outputFile) = "JShowerPositionFit.root";
61  zap['a'] = make_field(detectorFile) ;
62  zap['F'] = make_field(pdfFile) ;
64  zap['n'] = make_field(numberOfEvents) = JLimit::max();
65  zap['d'] = make_field(debug) = 2;
66 
67  zap(argc, argv);
68  }
69  catch(const exception& error) {
70  FATAL(error.what() << endl);
71  }
72 
74 
75  try {
76  load(detectorFile, detector);
77  }
78  catch(const JException& error) {
79  FATAL(error);
80  }
81 
82  outputFile.open();
83  outputFile.put(JMeta(argc, argv));
84 
85  const JModuleRouter router(detector);
86 
87  JSummaryFileRouter summary(inputFile, parameters.R_Hz);
88 
89  JShowerPositionFit fit(parameters, router, summary, pdfFile, debug);
90 
91  while (inputFile.hasNext()) {
92 
93  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
94 
95  multi_pointer_type ps = inputFile.next();
96 
97  JDAQEvent* tev = ps;
98  JEvt* in = ps;
99 
100  summary.update(*tev);
101 
102  // select start values
103  JEvt cp = *in;
104 
105  cp.select(parameters.numberOfPrefits, qualitySorter);
106 
107  if (!cp.empty()) {
108  cp.select(JHistory::is_event(cp.begin()->getHistory()));
109  }
110 
111  // fit
112  JEvt out = fit(*tev, cp);
113 
114  // apply default sorter
115  sort(out.begin(), out.end(), qualitySorter);
116 
117  copy(in->begin(), in->end(), back_inserter(out));
118 
119  outputFile.put(out);
120 
121  }
122  STATUS(endl);
123 
125 
126  io >> outputFile;
127 
128  outputFile.close();
129 }
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
#define STATUS(A)
Definition: JMessage.hh:63
Detector data structure.
Definition: JDetector.hh:80
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
class to handle the second position fit of the shower reconstruction, mainly dedicated for ORCA ...
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
File router for fast addressing of summary data.
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
int debug
debug level
Definition: JSirene.cc:61
#define FATAL(A)
Definition: JMessage.hh:67
Data structure for set of track fit results.
Definition: JEvt.hh:294
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