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

Auxiliary program to draw the string of detector. More...

#include <string>
#include <iostream>
#include <limits>
#include <map>
#include "TROOT.h"
#include "TGraph.h"
#include "JROOT/JGraph.hh"
#include "JROOT/JManager.hh"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.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

Auxiliary program to draw the string of detector.

Author
mdejong

Definition in file JDrawDetector1D.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 21 of file JDrawDetector1D.cc.

22 {
23  using namespace std;
24  using namespace JPP;
25 
26  string detectorFile;
27  string outputFile;
28  double step;
29  int debug;
30 
31  try {
32 
33  JParser<> zap("Auxiliary program to draw the strigs of detector.");
34 
35  zap['a'] = make_field(detectorFile, "detector file") = JPARSER::initialised();
36  zap['o'] = make_field(outputFile, "graphics output") = "detector.root";
37  zap['z'] = make_field(step) = 0.0;
38  zap['d'] = make_field(debug) = 1;
39 
40  zap(argc, argv);
41  }
42  catch(const exception &error) {
43  FATAL(error.what() << endl);
44  }
45 
46 
48 
49  try {
50  load(detectorFile, detector);
51  }
52  catch(const JException& error) {
53  FATAL(error);
54  }
55 
58 
59  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
60  if (module->getFloor() == 1) {
61  if (step != 0.0)
62  z0[module->getString()] = module->getZ();
63  else
64  z0[module->getString()] = 0.0;
65  }
66  }
67 
68  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
69  if (module->getFloor() != 0) {
70  H0[module->getString()].put((Double_t) module->getFloor(), module->getZ() - (module->getFloor() - 1) * step - z0[module->getString()]);
71  }
72  }
73 
74  TFile out(outputFile.c_str(), "recreate");
75 
76  for (map<int, JGraph_t>::const_iterator i = H0.begin(); i != H0.end(); ++i) {
77  out << JGraph(i->second, MAKE_CSTRING("G[" << i->first << "].string"));
78  }
79 
80  out.Write();
81  out.Close();
82 
83 }
Utility class to parse command line options.
Definition: JParser.hh:1517
General exception.
Definition: JException.hh:23
Detector data structure.
Definition: JDetector.hh:89
#define MAKE_CSTRING(A)
Make C-string.
Definition: JPrint.hh:136
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Definition: JParser.hh:83
Auxiliary data structure to build TGraph.
Definition: JGraph.hh:42
string outputFile
Detector file.
Definition: JHead.hh:226
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1993
#define FATAL(A)
Definition: JMessage.hh:67
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
do set_variable DETECTOR_TXT $WORKDIR detector
int debug
debug level