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

Program to convert detector to ntuples. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JModuleGeometry.hh"
#include "JFit/JPoint3DEstimator.hh"
#include "JIO/JFileStreamIO.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Program to convert detector to ntuples.

Author
mdejong

Definition in file JDetectorToNTuple.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 22 of file JDetectorToNTuple.cc.

23 {
24  using namespace std;
25 
26  string detectorFile;
27  string outputFile;
28  int debug;
29 
30  try {
31 
32  JParser<> zap("Program to convert detector to ntuples.");
33 
34  zap['a'] = make_field(detectorFile);
35  zap['o'] = make_field(outputFile);
36  zap['d'] = make_field(debug) = 0;
37 
38  zap(argc, argv);
39  }
40  catch(const exception &error) {
41  FATAL(error.what() << endl);
42  }
43 
44 
45  using namespace JPP;
46 
47 
49 
50  try {
51  load(detectorFile, detector);
52  }
53  catch(const JException& error) {
54  FATAL(error);
55  }
56 
57 
58  JFileStreamWriter out(outputFile.c_str());
59 
60  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
61 
62  const JEstimator<JPoint3D> center(module->begin(), module->end());
63 
64  JModuleGeometry geometry(JDAQUTCExtended(), module->getID(), center, JEulerAngle3D());
65 
66  out.store(geometry);
67  }
68 
69  out.close();
70 }
Utility class to parse command line options.
Definition: JParser.hh:1493
General exception.
Definition: JException.hh:23
Data structure for Euler angles in three dimensions.
Detector data structure.
Definition: JDetector.hh:80
string outputFile
Data structure for UTC time.
Detector file.
Definition: JHead.hh:130
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
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
Binary buffered file output.
Linear fit of crossing point (position) between axes (objects with position and direction).