13 #include "TFitResult.h" 
   58     JSetup(
const string& file_name) :
 
   61       fp = TFile::Open(file_name.c_str(), 
"read");
 
   75       ResultSet& rs  = 
getResultSet(getTable   <JPMTHVRunSettings>(),
 
   83           location = 
JLocation_t(parameters.DUID, parameters.FLOORID, parameters.PMTINTID);
 
   85           location = 
JLocation_t(parameters.DUID, parameters.FLOORID, parameters.CABLEPOS);
 
   87         HV[location] = parameters.HV_VALUE;
 
   99     TH2D* 
get(
const string& key) 
const 
  101       return (TH2D*) fp->Get(key.c_str());
 
  120 int main(
int argc, 
char **argv)
 
  124   using namespace KM3NETDAQ;
 
  147     JParser<> zap(
"Auxiliary program to check t0's.");
 
  154     zap[
'f'] = 
make_field(inputFile,         
"pair of input files (output of JCalibrateK40)");
 
  156     zap[
'e'] = 
make_field(precision,         
"precision for HV comparison")             = 0.5;
 
  158     zap[
'x'] = 
make_field(
X,                 
"ROOT fit range (PMT pairs).")             = JRange_t(300, numeric_limits<size_t>::max());
 
  159     zap[
'O'] = 
make_field(option,            
"ROOT fit option, see TH1::Fit.")          = 
"";
 
  165   catch(
const exception &error) {
 
  166     FATAL(error.what() << endl);
 
  173   catch(
const exception& error) {
 
  174     FATAL(error.what() << endl);
 
  178     JSetup(inputFile.first), 
 
  179     JSetup(inputFile.second)
 
  182   for (
int i = 0; i != 2; ++i) {
 
  183     DEBUG(setw(32) << setups[i].file_name << 
' ' << setups[i].header.getDetectorID() << 
' ' << setups[i].header.getRunNumber() << endl);
 
  195   if (option.find(
'S') == string::npos) { option += 
'S'; }
 
  202   TF1 f1(
"f1", 
"[0]*TMath::Gaus(x,[1],[2]) + [3]");
 
  204   for (JDetector::const_iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  211     DEBUG(
"Module " << setw(10) << module->getID() << 
' ' << (h2[0] != NULL) << (h2[0] != NULL) << endl);
 
  226     for (
size_t ip = max(
X.getLowerLimit(), size_t(0)); ip != min(
X.getUpperLimit(), combinatorics.
getNumberOfPairs()); ++ip) {
 
  230       const JLocation_t location_1(module->getString(), module->getFloor(), pair.first);
 
  231       const JLocation_t location_2(module->getString(), module->getFloor(), pair.second);
 
  233       const bool hv_1 = (fabs(setups[0].HV[location_1] - setups[1].HV[location_1]) < precision);
 
  234       const bool hv_2 = (fabs(setups[0].HV[location_2] - setups[1].HV[location_2]) < precision);
 
  237         numeric_limits<double>::max(),
 
  238         numeric_limits<double>::max()
 
  241       const Int_t ix = ip + 1;
 
  243       for (
int i = 0; i != 2; ++i) {
 
  245         TH1D 
h1(
"__py", NULL, h2[i]->GetYaxis()->GetNbins(), h2[i]->GetYaxis()->GetXmin(), h2[i]->GetYaxis()->GetXmax());
 
  249         Double_t ymin   =  numeric_limits<double>::max();
 
  250         Double_t ymax   =  numeric_limits<double>::lowest();
 
  252         Double_t sigma  =  4.5;
 
  255         for (
int iy = 1; iy <= h1.GetNbinsX(); ++iy) {
 
  257           const Double_t 
x = h1.GetBinCenter(iy);
 
  258           const Double_t y = h2[i]->GetBinContent(ix,iy);
 
  260           h1.SetBinContent(iy, y);
 
  261           h1.SetBinError  (iy, sqrt(y));
 
  277           f1.SetParameter(0, ymax);
 
  278           f1.SetParameter(1, mean);
 
  279           f1.SetParameter(2, sigma);
 
  280           f1.SetParameter(3, ymin);
 
  282           TFitResultPtr 
result = h1.Fit(&f1, option.c_str(), 
"same");
 
  284           if (result.Get() == NULL) {
 
  285             FATAL(
"Invalid TFitResultPtr " << h1.GetName() << endl);
 
  289             cout << 
"Histogram slice: " 
  290                  << setw(3)    << ix                    << 
' ' 
  291                  << 
FIXED(7,3) << f1.GetParameter(1)    << 
" +/- " 
  292                  << 
FIXED(7,3) << f1.GetParError(1)     << 
' ' 
  293                  << 
FIXED(7,3) << result->Chi2()        << 
'/' 
  294                  << result->Ndf()                       << 
' ' 
  295                  << (result->IsValid() ? 
"" : 
"failed") << endl;
 
  298           t1[i] = f1.GetParameter(1);
 
  302       if (t1[0] != numeric_limits<double>::max() &&
 
  303           t1[1] != numeric_limits<double>::max()) {
 
  318             cout << setw(10) << module->getID() << 
"." << 
FILL(2,
'0') << p2.first  << 
FILL() << 
' ';
 
  319             cout << 
"(" << 
FILL(2,
'0') << p2.second << 
FILL() << 
")" << 
' ';
 
  320             cout << 
FIXED(6,2) << (combinatorics.
getSign(p2) * (t1[1] - t1[0])) << endl;
 
  323           Q[p2.first].put(combinatorics.
getSign(p2) * (t1[1] - t1[0]));
 
  330         H1[module->getID()]->SetBinContent(i+1, 
Q[i].
getMean());
 
  331         H1[module->getID()]->SetBinError  (i+1, 
Q[i].getSTDev());
 
Utility class to parse command line options. 
 
JCombinatorics::pair_type pair_type
 
Q(UTCMax_s-UTCMin_s)-livetime_s
 
int main(int argc, char *argv[])
 
#define gmake_property(A)
macro to convert (template) parameter to JPropertiesElement object 
 
#define THROW(JException_t, A)
Marco for throwing exception with std::ostream compatible message. 
 
Utility class to parse parameter values. 
 
*fatal Wrong number of arguments esac JCookie sh typeset Z DETECTOR typeset Z SOURCE_RUN typeset Z TARGET_RUN set_variable PARAMETERS_FILE $WORKDIR parameters
 
#define MAKE_CSTRING(A)
Make C-string. 
 
then for HISTOGRAM in h0 h1
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Dynamic ROOT object management. 
 
Auxiliary data structure for floating point format specification. 
 
Data structure for detector geometry and calibration. 
 
double getMean(vector< double > &v)
get mean of vector content 
 
Utility class to parse parameter values. 
 
JDetectorsHelper getDetector
Function object for mapping serial number to object identifier of detector and vice versa...
 
Auxiliary class to manage set of compatible ROOT objects (e.g. histograms) using unique keys...
 
I/O formatting auxiliaries. 
 
Auxiliary class to sort pairs of PMT addresses within optical module. 
 
Auxiliary data structure for location of product in detector. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
then break fi done getCenter read X Y Z let X
 
void Write(TDirectory &out, const bool wm=false)
Write objects to file. 
 
ROOT TTree parameter settings. 
 
General purpose messaging. 
 
Auxiliary data structure for sequence of same character. 
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
Auxiliary class to define a range between two values. 
 
Utility class to parse command line options. 
 
then usage $script< input_file >< detector_file > fi set_variable OUTPUT_DIR set_variable SELECTOR JDAQTimesliceL1 set_variable DEBUG case set_variable DEBUG
 
ResultSet & getResultSet(const std::string &query)
Get result set. 
 
std::vector< JServer > getServernames()
Get list of names of available database servers. 
 
int getCount(const T &hit)
Get hit count. 
 
Wrapper class for server name. 
 
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. 
 
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 source JAcoustics sh $DETECTOR_ID CHECK_EXIT_CODE typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
 
Template definition for getting table specific selector. 
 
static const char *const _2S
Name extension for 2D counts.