58   using namespace KM3NETDAQ;
 
   61   typedef JTriggeredFileScanner_t::multi_pointer_type       multi_pointer_type;
 
   65   JTriggeredFileScanner_t  inputFile;
 
   80     JParser<> zap(
"Utility program to determine energy correction.");
 
   82     zap[
'f'] = 
make_field(inputFile,   
"event file(s) or histogram file");
 
   84     zap[
'n'] = 
make_field(numberOfEvents)      = JLimit::max();
 
   86     zap[
'F'] = 
make_field(formula,     
"fit formula, e.g: \"[0]+[1]*x\"")         = 
"";
 
   90     zap[
'O'] = 
make_field(option,      
"Fit option")                              = 
"";
 
   97   catch(
const exception& error) {
 
   98     FATAL(error.what() << endl);
 
  105   if (inputFile.size() == 1) {
 
  107     in = TFile::Open(inputFile[0].c_str(), 
"READ");
 
  109     if (
in != NULL && 
in->IsOpen()) {
 
  110       h2 = (TH2D*) 
in->Get(
"h2");
 
  118     for (JMultipleFileScanner_t::const_iterator i = inputFile.begin(); i != inputFile.end(); ++i) {
 
  126         if (p == enigma.end())
 
  127           enigma.push_back(head);
 
  131       catch(
const exception& error) {
 
  136     double Emin =  numeric_limits<double>::max();
 
  141       if (!i->is_valid(&JHead::cut_nu)) {
 
  142         FATAL(
"Missing neutrino parameters." << endl);
 
  145       if (i->cut_nu.E.getLowerLimit() < Emin) { Emin = i->cut_nu.E.getLowerLimit(); }
 
  146       if (i->cut_nu.E.getUpperLimit() > Emax) { Emax = i->cut_nu.E.getUpperLimit(); }
 
  148       if (i->is_valid(&JHead::genvol)) {
 
  149         cout << 
"Neutrino energy range:      " << i->cut_nu.E              << endl;
 
  150         cout << 
"Number of generated events: " << i->genvol.numberOfEvents << endl;
 
  163     for (
string filename; inputFile.hasNext(); ) {
 
  165       STATUS(
"event: " << setw(10) << inputFile.getCounter() << 
'\r'); 
DEBUG(endl);
 
  167       if (filename != inputFile.getFilename()) {
 
  169         filename = inputFile.getFilename();
 
  175           center = get<JPosition3D>(head);
 
  179           if (p->is_valid(&JHead::genvol)) {
 
  180             W = 1.0 / (double) p->genvol.numberOfEvents;
 
  183           cout << 
"File: " << filename << 
" weight " << W << endl;
 
  185         catch(
const exception& error) {
 
  190       multi_pointer_type ps = inputFile.next();
 
  224       if (evt->begin() == __end) {
 
  228       JEvt::iterator p = min_element(evt->begin(), __end, 
quality_sorter);
 
  238       if (ta.getE() > 0.0 && tb.
getE() > 0.0) {
 
  239         h2->Fill(
log10(tb.
getE()), 
log10(ta.getE()), (enigma.size() > (size_t) 1 ? W * event->w[2] : 1.0));
 
  247   const Int_t    nx   = h2->GetXaxis()->GetNbins();
 
  248   const Double_t xmin = h2->GetXaxis()->GetXmin();
 
  249   const Double_t xmax = h2->GetXaxis()->GetXmax();
 
  251   const Int_t    ny   = h2->GetYaxis()->GetNbins();
 
  253   TH1D h1(
"h1", NULL, nx, xmin, xmax);
 
  261   for (Int_t ix = 1; ix <= nx; ++ix) {
 
  267     for (
int iy = 1; iy <= ny; ++iy) {
 
  269       const Double_t 
x = h2->GetYaxis()->GetBinCenter(iy);
 
  270       const Double_t y = h2->GetBinContent(ix,iy);
 
  271       const Double_t z = h2->GetBinError  (ix,iy);
 
  275         h0->SetBinContent(iy, y);
 
  276         h0->SetBinError  (iy, z);
 
  282     if (
Q.getCount() >= 3) {
 
  288       TF1 
f1(
"f1", 
"[0]*TMath::Gaus(x,[1],[2]) + [3]");
 
  290       const double x0    =        
Q.getQuantile(0.50);
 
  291       const double sigma = 0.5 * (
Q.getQuantile(0.66) - 
Q.getQuantile(0.33));
 
  293       f1.SetParameter(0, 
Q.getWmax());
 
  294       f1.SetParameter(1, x0);
 
  295       f1.SetParameter(2, sigma);
 
  296       f1.SetParameter(3, 0.0);
 
  298       TFitResultPtr 
result = h0->Fit(&
f1, 
"SQ", 
"same");
 
  300       if (result.Get() == NULL) {
 
  301         FATAL(
"Invalid TFitResultPtr " << h0->GetName() << endl);
 
  306              << setw(4)    << ix                               << 
' ' 
  307              << 
FIXED(7,3) << h2->GetXaxis()->GetBinCenter(ix) << 
' ' 
  308              << 
FIXED(7,3) << result->Chi2()                   << 
'/' 
  309              << result->Ndf()                                  << 
' ' 
  310              << (result->IsValid() ? 
"" : 
"failed")            << endl;
 
  313       if (result->IsValid()) {
 
  315         const Double_t x  = h2->GetXaxis()->GetBinCenter(ix);
 
  317         h1.SetBinContent(ix, 
f1.GetParameter(1));
 
  318         h1.SetBinError  (ix, 
f1.GetParError (1));
 
  320         g1.put(x, 
pow(10.0, x) - 
pow(10.0, 
f1.GetParameter(1)));
 
  321         g2.put(x, 
pow(10.0, abs(
f1.GetParameter(2)) - 
f1.GetParameter(1)));
 
  322         g3.put(x, 
f1.GetParameter(1), 0.0, 
f1.GetParameter(2));
 
  331     f1 = 
new TF1(
"f1", formula.c_str());
 
  333     if (
f1->IsZombie()) {
 
  334       FATAL(
"Function: " << formula << 
" is zombie." << endl);
 
  348       FATAL(error << endl);
 
  351     if (option.find(
'S') == string::npos) { option += 
"S"; }
 
  353     TFitResultPtr result = h1.Fit(
f1, option.c_str(), 
"same", 
X.getLowerLimit(), 
X.getUpperLimit());
 
  357     Double_t x[2] = { 
xmin, xmax };
 
  358     Double_t y[2] = { 
xmin, xmax };
 
  359     Double_t z[2] = { 0.00, 0.00 };
 
  365        << 
"x >= " << 
FIXED(5,3) << xmax
 
  371     for (Int_t ix = nx; ix >= 1; --ix) {
 
  373       x[0] = h1.GetXaxis()->GetBinCenter(ix);
 
  374       y[0] = h1.GetBinContent(ix);
 
  375       z[0] = h1.GetBinError  (ix);
 
  377       if (z[0] == 0.0 || !
X(x[0])) {
 
  383          << 
"x >= " << 
FIXED(5,3) << x[0]
 
  385          << 
"x <  " << 
FIXED(5,3) << x[1]
 
  388          << 
"(" << 
FIXED(5,3) << y[0] << 
" + " << 
FIXED(5,3) << (y[1] - y[0]) << 
" * (x - " << 
FIXED(5,3) << x[0] << 
") / " << 
FIXED(5,3) << (x[1] - x[0]) << 
")";
 
  401        << 
"x <  " << 
FIXED(5,3) << x[1]
 
  404        << 
"(" << 
FIXED(5,3) << y[0] << 
" + " << 
FIXED(5,3) << (y[1] - y[0]) << 
" * (x - " << 
FIXED(5,3) << x[0] << 
") / " << 
FIXED(5,3) << (x[1] - x[0]) << 
")";
 
  407     string buffer = os.str();
 
  411     for (string::iterator i = buffer.begin(); i != buffer.end(); ++i) {
 
  417     f1 = 
new TF1(
"f1", buffer.c_str(), 
xmin, 
xmax);
 
  419     h1.GetListOfFunctions()->Add(
f1);
 
  425   out << 
JMeta(argc, argv);
 
  427   out << *h2 << H0 << h1;
 
  437     out << *(
f1->GetFormula());
 
Utility class to parse command line options. 
 
Q(UTCMax_s-UTCMin_s)-livetime_s
 
double getValue(const JScale_t scale)
Get numerical value corresponding to scale. 
 
int getParameter(const std::string &text)
Get parameter number from text string. 
 
JTrack3E getTrack(const Trk &track)
Get track. 
 
static const int JENERGY_ENERGY
uncorrected energy [GeV] from JEnergy.cc 
 
Data structure for graph data. 
 
const char *const neutrino_t
 
bool has_neutrino(const Evt &evt)
Test whether given event has an incoming neutrino. 
 
double getIntersection(const JVector3D &pos) const 
Get longitudinal position along axis of position of closest approach with given position. 
 
bool is_muon(const Trk &track)
Test whether given track is a (anti-)muon. 
 
General purpose sorter of fit results. 
 
Auxiliary class to synchronously read DAQ events and Monte Carlo events (and optionally other events)...
 
Data structure for graph data. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
static const JGeaneWater gWater
Function object for energy loss of muon in sea water. 
 
Auxiliary data structure for floating point format specification. 
 
Auxiliary data structure to build TGraph. 
 
double E
Energy [GeV] (either MC truth or reconstructed) 
 
void move(const double step, const double velocity, const JGeane &geane)
Move vertex along this track with given velocity. 
 
Head getHeader(const JMultipleFileScanner_t &file_list)
Get Monte Carlo header. 
 
bool is_neutrino(const Trk &track)
Test whether given track is a neutrino. 
 
const JPolynome f1(1.0, 2.0, 3.0)
Function. 
 
Auxiliary class for defining the range of iterations of objects. 
 
Type definition of range. 
 
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
 
double getE() const 
Get energy. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
set_variable E_E log10(E_{fit}/E_{#mu})"
 
Auxiliary class to test history. 
 
void setE(const double E)
Set energy. 
 
T pow(const T &x, const double y)
Power . 
 
Reconstruction type dependent comparison of track quality. 
 
Auxiliary data structure to build TGraphErrors. 
 
const double getSpeedOfLight()
Get speed of light. 
 
Wrapper class around string. 
 
Exception for parsing value. 
 
no fit printf nominal n $STRING awk v X
 
const char * getName()
Get ROOT name of given data type. 
 
Data structure for position in three dimensions. 
 
const JLimit & getLimit() const 
Get limit. 
 
const Trk & get_neutrino(const Evt &evt)
Get incoming neutrino. 
 
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY JAcoustics sh $DETECTOR_ID source JAcousticsToolkit sh CHECK_EXIT_CODE typeset A EMITTERS get_tripods $WORKDIR tripod txt EMITTERS get_transmitters $WORKDIR transmitter txt EMITTERS for EMITTER in
 
The Trk class represents a Monte Carlo (MC) particle as well as a reconstructed track/shower. 
 
int numberOfBins
number of bins for average CDF integral of optical module 
 
static const int JMUONENERGY
 
The Evt class respresent a Monte Carlo (MC) event as well as an offline event. 
 
#define DEBUG(A)
Message macros. 
 
Double_t g1(const Double_t x)
Function.