Jpp
Functions
JModuleMapper.cc File Reference
#include <string>
#include <iostream>
#include <iomanip>
#include "TROOT.h"
#include "TFile.h"
#include "TProfile.h"
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JModuleMapper.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

Example program to test JDETECTOR::JModuleMapper.

Author
mdejong

Definition in file JModuleMapper.cc.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 24 of file JModuleMapper.cc.

25 {
26  using namespace std;
27 
28  string outputFile;
29  string detectorFile;
30  int debug;
31 
32  try {
33 
34  JParser<> zap("Example program to test module mapping.");
35 
36  zap['o'] = make_field(outputFile) = "mapper.root";
37  zap['a'] = make_field(detectorFile);
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 
47  using namespace JPP;
48 
49  cout.tie(&cerr);
50 
51  JDetector detector;
52 
53  try {
54  load(detectorFile, detector);
55  }
56  catch(const JException& error) {
57  FATAL(error);
58  }
59 
60 
61  TFile out(outputFile.c_str(), "recreate");
62 
63  TProfile h1("h1", NULL, 1001,-0.5, 1000.5);
64 
65  JModuleMapper<> mapper(detector);
66 
67  for (int i = 1; i <= h1.GetNbinsX(); ++i) {
68 
69  const double x = h1.GetBinCenter(i);
70 
71  mapper.configure(JMaximalDistance(x));
72 
73  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
74  h1.Fill(x, (Double_t) mapper.getList(*module).size());
75  }
76  }
77 
78  out.Write();
79  out.Close();
80 }
JDETECTOR::load
void load(const JString &file_name, JDetector &detector)
Load detector from input file.
Definition: JDetectorToolkit.hh:456
JPARSER::JParser
Utility class to parse command line options.
Definition: JParser.hh:1493
JPP
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
Definition: JAAnetToolkit.hh:37
debug
int debug
debug level
Definition: JSirene.cc:59
make_field
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1954
std
Definition: jaanetDictionary.h:36
FATAL
#define FATAL(A)
Definition: JMessage.hh:67
outputFile
string outputFile
Definition: JDAQTimesliceSelector.cc:37