Jpp - the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Functions
JShowerPointSimplex.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 "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JReconstruction/JEvt.hh"
#include "JReconstruction/JShowerPointSimplexParameters_t.hh"
#include "JReconstruction/JShowerPointSimplex.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 JShowerPointSimplex.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 38 of file JShowerPointSimplex.cc.

38  {
39 
40  using namespace std;
41  using namespace JPP;
42  using namespace KM3NETDAQ;
43 
44  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
46  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
47 
48  JParallelFileScanner_t inputFile;
51  JLimit_t& numberOfEvents = inputFile.getLimit();
52  string detectorFile;
53  int debug;
54 
55  try {
56 
57  JParser<> zap;
58 
59  zap['f'] = make_field(inputFile) ;
60  zap['o'] = make_field(outputFile) = "JORCAShowerPointSimplex_Output.root";
61  zap['a'] = make_field(detectorFile) ;
63  zap['n'] = make_field(numberOfEvents) = JLimit::max();
64  zap['d'] = make_field(debug) = 2;
65 
66  zap(argc, argv);
67  }
68  catch(const exception& error) {
69  FATAL(error.what() << endl);
70  }
71 
73 
74  try {
75  load(detectorFile, detector);
76  }
77  catch(const JException& error) {
78  FATAL(error);
79  }
80 
81  outputFile.open();
82  outputFile.put(JMeta(argc, argv));
83 
84  const JModuleRouter router(detector);
85 
86  JShowerPointSimplex fit(parameters, router, debug);
87 
88  while (inputFile.hasNext()) {
89 
90  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
91 
92  multi_pointer_type ps = inputFile.next();
93 
94  JDAQEvent* tev = ps;
95  JEvt* in = ps;
96 
97  // select start values
98  JEvt cp = *in;
99 
100  cp.select(parameters.numberOfPrefits, qualitySorter);
101 
102  if (!cp.empty()) {
103  cp.select(JHistory::is_event(cp.begin()->getHistory()));
104  }
105 
106  // fit
107 
108  JEvt out = fit(*tev, cp);
109 
110  // apply default sorter
111 
112  sort(out.begin(), out.end(), qualitySorter);
113 
114  // reduce output fits
115 
116  JEvt::iterator __end = out.end();
117 
118  advance(__end = out.begin(), min(parameters.numberOfOutfits, (size_t) distance(out.begin(), out.end())));
119 
120  JEvt reduced_out;
121 
122  copy(out.begin(), __end, back_inserter(reduced_out));
123 
124  copy(in->begin(), in->end(), back_inserter(reduced_out));
125 
126  outputFile.put(reduced_out);
127 
128  }
129  STATUS(endl);
130 
132 
133  io >> outputFile;
134 
135  outputFile.close();
136 }
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:70
Object writing to file.
Utility class to parse command line options.
Definition: JParser.hh:1500
General exception.
Definition: JException.hh:23
std::vector< T >::difference_type distance(typename std::vector< T >::const_iterator first, typename PhysicsEvent::const_iterator< T > second)
Specialisation of STL distance.
#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.
*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
int debug
debug level
Definition: JSirene.cc:63
counter_type advance(counter_type &counter, const counter_type value, const counter_type limit=std::numeric_limits< counter_type >::max())
Advance counter.
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
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:38
bool qualitySorter(const JRECONSTRUCTION::JFit &first, const JRECONSTRUCTION::JFit &second)
Comparison of fit results.