#include #include #include #include #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" /** * \file * Auxiliary program to draw the string of detector. * \author mdejong */ int main(int argc, char**argv) { using namespace std; using namespace JPP; string detectorFile; string outputFile; double step; int debug; try { JParser<> zap("Auxiliary program to draw the strigs of detector."); zap['a'] = make_field(detectorFile, "detector file") = JPARSER::initialised(); zap['o'] = make_field(outputFile, "graphics output") = "detector.root"; zap['z'] = make_field(step) = 0.0; zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception &error) { FATAL(error.what() << endl); } JDetector detector; try { load(detectorFile, detector); } catch(const JException& error) { FATAL(error); } map H0; map z0; for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) { if (module->getFloor() == 1) { if (step != 0.0) z0[module->getString()] = module->getZ(); else z0[module->getString()] = 0.0; } } for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) { if (module->getFloor() != 0) { H0[module->getString()].put((Double_t) module->getFloor(), module->getZ() - (module->getFloor() - 1) * step - z0[module->getString()]); } } TFile out(outputFile.c_str(), "recreate"); for (map::const_iterator i = H0.begin(); i != H0.end(); ++i) { out << JGraph(i->second, MAKE_CSTRING("G[" << i->first << "].string")); } out.Write(); out.Close(); }