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

Auxiliary program to create map for reference PMTs. More...

#include <string>
#include <iostream>
#include <iomanip>
#include "JDetector/JDetector.hh"
#include "JDetector/JDetectorToolkit.hh"
#include "JDetector/JModuleRouter.hh"
#include "Jeep/JParser.hh"
#include "Jeep/JMessage.hh"
#include "JTrigger/JTriggerToolkit.hh"

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Detailed Description

Auxiliary program to create map for reference PMTs.

the option

    -T "s" 

or

    -T{"s1","s2"} 

has to be used with a vector of strings. This vector contains either the list of reference PMT identities or the keyword odd. If the keyword odd is used, all the PMTs with an odd identity are listed in the output file. The parity is calculated as following:

        (floor id - 1)*31 + PMT id
Author
acreusot

Definition in file createPMTMap.cc.

Function Documentation

int main ( int  argc,
char **  argv 
)

Definition at line 37 of file createPMTMap.cc.

38 {
39  using namespace std;
40  using namespace JPP;
41  //using namespace KM3NETDAQ;
42 
43  string detectorFile;
44  string outputFile;
45  vector<string> mapType;
46  int debug;
47 
48  try {
49  JParser<> zap("Auxiliary program to create PMT map files.");
50  zap['a'] = make_field(detectorFile);
51  zap['o'] = make_field(outputFile);
52  zap['T'] = make_field(mapType);
53  zap['d'] = make_field(debug) = 1;
54  zap(argc, argv);
55  }
56 
57  catch(const exception &error) {
58  FATAL(error.what() << endl);
59  }
60 
61  fstream outstr(outputFile.c_str(), ofstream::out);
63  try {
64  load(detectorFile, detector);
65  }
66  catch(const JException& error) {
67  FATAL(error);
68  }
69  for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) {
70  const int floorId = module->getFloor();
71  const int domId = module->getID();
72  for (unsigned int t = 0; t < mapType.size(); ++t) {
73  if (mapType[t] == "odd") {
74  for (unsigned int pmt = 0; pmt < NUMBER_OF_PMTS; ++pmt) {
75  const int id = (floorId - 1)*NUMBER_OF_PMTS + pmt;
76  if (id % 2 != 0) {
77  outstr << domId << ' ' << pmt << endl;
78  }
79  }
80  } else {
81  outstr << domId << ' ' << mapType[t] << endl;
82  }
83  }
84  }
85  outstr.close();
86 
87 }
Utility class to parse command line options.
Definition: JParser.hh:1500
General exception.
Definition: JException.hh:23
Detector data structure.
Definition: JDetector.hh:81
string outputFile
Detector file.
Definition: JHead.hh:196
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
Definition: JParser.hh:1961
int debug
debug level
Definition: JSirene.cc:63
#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
static const int NUMBER_OF_PMTS
Total number of PMTs in module.
Definition: JDAQ.hh:26