#include #include #include #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" /** * \file * * Example program to test JDETECTOR::JModuleMapper. * \author mdejong */ int main(int argc, char **argv) { using namespace std; string outputFile; string detectorFile; int debug; try { JParser<> zap("Example program to test module mapping."); zap['o'] = make_field(outputFile) = "mapper.root"; zap['a'] = make_field(detectorFile); zap['d'] = make_field(debug) = 1; zap(argc, argv); } catch(const exception& error) { FATAL(error.what() << endl); } using namespace JPP; cout.tie(&cerr); JDetector detector; try { load(detectorFile, detector); } catch(const JException& error) { FATAL(error); } TFile out(outputFile.c_str(), "recreate"); TProfile h1("h1", NULL, 1001,-0.5, 1000.5); JModuleMapper<> mapper(detector); for (int i = 1; i <= h1.GetNbinsX(); ++i) { const double x = h1.GetBinCenter(i); mapper.configure(JMaximalDistance(x)); for (JDetector::const_iterator module = detector.begin(); module != detector.end(); ++module) { h1.Fill(x, (Double_t) mapper.getList(*module).size()); } } out.Write(); out.Close(); }