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

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

#include <string>
#include "km3net-dataformat/offline/Head.hh"
#include "km3net-dataformat/offline/MultiHead.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/JShowerBjorkenYParameters_t.hh"
#include "JReconstruction/JShowerBjorkenY.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 Shower Bjorken Y Fit for ORCA with I/O of JFIT::JEvt data.

The reconstruction is made at the PMT level.

Author
adomi

Definition in file JShowerBjorkenY.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 40 of file JShowerBjorkenY.cc.

40  {
41 
42  using namespace std;
43  using namespace JPP;
44  using namespace KM3NETDAQ;
45 
46  typedef JParallelFileScanner< JTypeList<JDAQEvent, JEvt> > JParallelFileScanner_t;
48  typedef JParallelFileScanner_t::multi_pointer_type multi_pointer_type;
49 
50  JParallelFileScanner_t inputFile;
53  JLimit_t& numberOfEvents = inputFile.getLimit();
54  string detectorFile;
55  string pdfFile;
57  int debug;
58 
59  try {
60 
61  JParser<> zap;
62 
63  zap['f'] = make_field(inputFile) ;
64  zap['o'] = make_field(outputFile) = "JORCAShowerBjorkenY_Output.root";
65  zap['a'] = make_field(detectorFile) ;
66  zap['F'] = make_field(pdfFile) ;
67  zap['E'] = make_field(correct) = JShowerEnergyCorrection(); // off
69  zap['n'] = make_field(numberOfEvents) = JLimit::max();
70  zap['d'] = make_field(debug) = 2;
71 
72  zap(argc, argv);
73  }
74  catch(const exception& error) {
75  FATAL(error.what() << endl);
76  }
77 
79 
80  try {
81  load(detectorFile, detector);
82  }
83  catch(const JException& error) {
84  FATAL(error);
85  }
86 
87  outputFile.open();
88  outputFile.put(JMeta(argc, argv));
89 
90  const JModuleRouter router(detector);
91 
92  JSummaryFileRouter summary(inputFile, parameters.R_Hz);
93 
94  JShowerBjorkenY fit(parameters, router, summary, pdfFile, correct, debug);
95 
96  while (inputFile.hasNext()) {
97 
98  STATUS("event: " << setw(10) << inputFile.getCounter() << '\r'); DEBUG(endl);
99 
100  multi_pointer_type ps = inputFile.next();
101 
102  JDAQEvent* tev = ps;
103  JEvt* in = ps;
104 
105  summary.update(*tev);
106 
107  // select start values
108  JEvt cp = *in;
109 
110  cp.select(parameters.numberOfPrefits, qualitySorter);
111 
112  if (!cp.empty()) {
113  cp.select(JHistory::is_event(cp.begin()->getHistory()));
114  }
115 
116  // fit
117  JEvt out = fit(*tev, cp);
118 
119  // apply default sorter
120  sort(out.begin(), out.end(), qualitySorter);
121 
122  copy(in->begin(), in->end(), back_inserter(out));
123 
124  outputFile.put(out);
125 
126  }
127  STATUS(endl);
128 
130 
131  io >> outputFile;
132 
133  outputFile.close();
134 }
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:1514
General exception.
Definition: JException.hh:24
#define STATUS(A)
Definition: JMessage.hh:63
Detector data structure.
Definition: JDetector.hh:89
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:83
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:226
Acoustic event fit.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1989
Auxiliary class to test history.
Definition: JHistory.hh:105
File router for fast addressing of summary data.
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
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 JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
Definition: JCanberra.sh:48
void copy(const Head &from, JHead &to)
Copy header from from to to.
Definition: JHead.cc:162
then cp
Object reading from a list of files.
const JLimit & getLimit() const
Get limit.
Definition: JLimit.hh:84
do set_variable DETECTOR_TXT $WORKDIR detector
int debug
debug level
class to handle the direction fit of the shower reconstruction, mainly dedicated for ORCA ...
#define DEBUG(A)
Message macros.
Definition: JMessage.hh:62