30 int main(
int argc,
char **argv)
34 using namespace KM3NETDAQ;
45 JParser<> zap(
"Auxiliary application to plot detector parameters.");
47 zap[
'a'] =
make_field(detectorFileA,
"detector file.");
50 zap[
'r'] =
make_field(regexp,
"regular expresion to extract bin labels for the x-axis") =
" ";
51 zap[
'L'] =
make_field(labelInterval,
"interval between x-axis bins for which labels are shown") = 1;
56 catch(
const exception &error) {
57 FATAL(error.what() << endl);
61 if (detectorFileA.empty()) {
62 FATAL(
"No detector file specified." << endl);
65 if (detectorFileB.size() != 0 && detectorFileB.size() != detectorFileA.size()) {
66 FATAL(
"Detector file size " << detectorFileA.size() <<
" != " << detectorFileB.size() << endl);
70 const int NUMBER_OF_FILES = detectorFileA.size();
72 JManager<string, TH2D> manager(
new TH2D(
"%", NULL,
73 NUMBER_OF_FILES, -0.5, NUMBER_OF_FILES - 0.5,
76 manager->Sumw2(kFALSE);
80 const int n = (NUMBER_OF_FILES < labelInterval) ? 1 : labelInterval;
82 const TPRegexp buffer(regexp);
84 for (
int i = 0;
i != NUMBER_OF_FILES; ++
i){
87 manager->GetXaxis()->SetBinLabel(
i+1 ,
parse(buffer , TString(detectorFileA[
i].c_str())));
89 manager->GetXaxis()->SetBinLabel(
i+1 ,
" ");
94 if (detectorFileB.empty()) {
99 load(detectorFileA[0], detector);
101 catch(
const JException& error) {
105 if (detector.empty()) {
106 FATAL(
"Empty detector." << endl);
110 for (
int i = 0;
i != NUMBER_OF_FILES; ++
i) {
112 NOTICE(
"Histogram " << detectorFileA[
i] <<
" relative to " << detectorFileA[0] << endl);
117 load(detectorFileA[
i], buffer);
119 catch(
const JException& error) {
123 JModuleRouter router(buffer);
125 for (JDetector::iterator module = detector.begin(); module != detector.end(); ++module) {
127 TH2D* h2 = manager[
MAKE_CSTRING(module->getID() <<
"." <<
"t0")];
129 for (
size_t pmt = 0; pmt != module->size(); ++pmt) {
130 h2->SetBinContent(
i+1, pmt+1, router.getModule(module->getID()).getPMT(pmt).getT0() - module->getPMT(pmt).getT0());
137 for (
int i = 0;
i != NUMBER_OF_FILES; ++
i) {
139 NOTICE(
"Histogram " << detectorFileA[
i] <<
" relative to " << detectorFileB[
i] << endl);
145 load(detectorFileA[
i], detectorA);
146 load(detectorFileB[i], detectorB);
148 catch(
const JException& error) {
152 JModuleRouter router(detectorB);
154 for (JDetector::iterator module = detectorA.begin(); module != detectorA.end(); ++module) {
156 TH2D* h2 = manager[
MAKE_CSTRING(module->getID() <<
"." <<
"t0")];
158 for (
size_t pmt = 0; pmt != module->size(); ++pmt) {
159 h2->SetBinContent(
i+1, pmt+1, router.getModule(module->getID()).getPMT(pmt).getT0() - module->getPMT(pmt).getT0());
166 for (JManager<string, TH2D>::iterator
i = manager.begin();
i != manager.end(); ++
i) {
167 i->second->Sumw2(kFALSE);
Utility class to parse command line options.
int main(int argc, char *argv[])
#define MAKE_CSTRING(A)
Make C-string.
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
Dynamic ROOT object management.
Data structure for detector geometry and calibration.
boost::property_tree::ptree parse(std::string str)
I/O formatting auxiliaries.
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
General purpose messaging.
Direct access to module in detector data structure.
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
Utility class to parse command line options.
do set_variable DETECTOR_TXT $WORKDIR detector
KM3NeT DAQ constants, bit handling, etc.
static const int NUMBER_OF_PMTS
Total number of PMTs in module.