88   using namespace KM3NETDAQ;
 
   97   double             laserFrequency_Hz;
 
   98   bool               overwriteDetector;
 
  112     JParser<> zap(
"Application for dark room time calibration.");
 
  114     zap[
'f'] = 
make_field(inputFile,         
"input file (time slice data from laser calibration).");
 
  116     zap[
'a'] = 
make_field(detectorFile,      
"detector file.");
 
  118                           "Set reference PMTs, e.g." 
  119                           "\n-! \"808969848 0 808982077 23\" sets PMT 0 of module 808969848 and PMT 23 of module 808982077 as references.");
 
  120     zap[
'n'] = 
make_field(numberOfEvents)    = JLimit::max(); 
 
  121     zap[
'l'] = 
make_field(laserFrequency_Hz, 
"laser frequency [Hz]")                             = 10000;
 
  122     zap[
'A'] = 
make_field(overwriteDetector, 
"overwrite detector file provided through '-a' with correct time offsets.");
 
  123     zap[
'O'] = 
make_field(option,            
"ROOT fit option, see TH1::Fit.")                   = 
"LS";
 
  125     zap[
'C'] = 
make_field(selector,          
"timeslice selector, e.g. JDAQTimesliceL1.")        = getROOTClassSelection<JDAQTimesliceTypes_t>();
 
  126     zap[
'T'] = 
make_field(T_ns,              
"time window for time-over-threshold monitor")      = 
JRange_t(-10.0, +10.0);
 
  132   catch(
const exception& error) {
 
  133     FATAL(error.what() << endl);
 
  139   if (laserFrequency_Hz <= 0.0) {
 
  140     FATAL(
"Invalid laser frequency " << laserFrequency_Hz << endl);
 
  143   const double laserPeriod_ns = 1.0e9 / laserFrequency_Hz;
 
  145   if (option.find(
'R') == string::npos) { option += 
'R'; }
 
  146   if (option.find(
'S') == string::npos) { option += 
'S'; }
 
  172   const double xmin = (
X == 
JRange_t() ? -0.5 * laserPeriod_ns : 
X.getLowerLimit());
 
  173   const double xmax = (
X == 
JRange_t() ? +0.5 * laserPeriod_ns : 
X.getUpperLimit());
 
  174   const int    nx   =  2 * (int) (
xmax - 
xmin);
 
  176   TH1D h0(
"h0", NULL, nx, 
xmin, 
xmax);
 
  177   TH1D h1(
"h1", NULL, 256, -0.5, +255.5);
 
  181   for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  185     for (JTDC_t::const_iterator 
i = range.first; 
i != range.second; ++
i) {
 
  188              << 
" string  " << setw(3) << module->getString() 
 
  189              << 
" floor   " << setw(2) << module->getFloor()
 
  190              << 
" module  " << setw(8) << module->getID() 
 
  191              << 
" channel " << setw(2) << 
i->second << endl);
 
  199       zmap.insert(make_pair(
id, 
new TH1D(os.str().c_str(), NULL, nx, 
xmin, 
xmax)));
 
  213   for ( ; 
in.hasNext() && counter != inputFile.getLimit(); ++counter) {
 
  215     STATUS(
"event: " << setw(10) << counter << 
'\r'); 
DEBUG(endl);
 
  219     for (JDAQTimeslice::const_iterator frame = timeslice->begin(); frame != timeslice->end(); ++frame) {
 
  223       if (range.first != range.second) {
 
  225         const double t0 = get_time(
getTimeOfFrame(frame->getFrameIndex()), laserPeriod_ns);
 
  229         buildL0(*frame, moduleRouter.getModule(frame->getModuleID()), back_inserter(dataL0));
 
  231         for (JDataL0_t::const_iterator hit = dataL0.begin(); hit != dataL0.end(); ++hit) {
 
  235           map_type::const_iterator p = zmap.find(
id);
 
  237           if (p != zmap.end()) {
 
  239             const double t1 = get_time(t0 + hit->getT(), laserPeriod_ns);
 
  247               h1.Fill(hit->getToT());
 
  262   TF1 
f1(
"f1", 
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))/(TMath::Sqrt(2.0*TMath::Pi())*[2]) + [3]");
 
  264   for (map_type::iterator it = zmap.begin(); it != zmap.end(); ++it) {
 
  267     TH1D*          h1  = it->second;
 
  269     if (h1->GetEntries() == 0) {
 
  270       WARNING(
"Histogram " << h1->GetName() << 
" empty" << endl);
 
  274     STATUS(
"--- PMT = " << pmt << 
"; histogram " << h1->GetName() <<  endl);
 
  280     Double_t 
sigma = 2.0;    
 
  283     for (
int i = 1; 
i != h1->GetNbinsX(); ++
i) {
 
  285       const Double_t 
x = h1->GetBinCenter (
i);
 
  286       const Double_t 
y = h1->GetBinContent(
i);
 
  294     f1.SetParameter(0, ymax/sigma);
 
  295     f1.SetParameter(1, x0);
 
  296     f1.SetParameter(2, sigma);
 
  297     f1.SetParameter(3, ymin);
 
  302     TFitResultPtr 
result = h1->Fit(&
f1, option.c_str(), 
"same", x0 - 3 * 
sigma, x0 + 3 * 
sigma);
 
  304     if (result.Get() == NULL) {
 
  305       FATAL(
"Invalid TFitResultPtr " << h1->GetName() << endl);
 
  308     if (
debug >= 
notice_t || !result->IsValid() || 
f1.GetParameter(0) < Wmin) {
 
  309       cout << 
"Histogram " << h1->GetName() << 
" fit " << (result->IsValid() ? 
"ok" : 
"failed") << endl;
 
  310       cout << 
"\tw  = " << 
FIXED(12,3) << 
f1.GetParameter(0) << endl;
 
  311       cout << 
"\tx0 = " << 
FIXED(12,3) << x0                 << endl;
 
  312       cout << 
"\tt0 = " << 
FIXED(12,3) << 
f1.GetParameter(1) << endl;
 
  318     int number_of_peaks = 0;
 
  320     Double_t dx = 2.0 * 
f1.GetParameter(2);
 
  322     Double_t 
Y  = 
f1.GetParameter(3);
 
  328     for (Int_t il = 1, ir = il; ir <= nx; ) {
 
  330       for ( ; ir <= nx && h1->GetBinCenter(ir) <= h1->GetBinCenter(il) + dx; ++ir) {
 
  331         W += h1->GetBinContent(ir) - 
Y;
 
  336         number_of_peaks += 1;
 
  344         W  -= h1->GetBinContent(il) - 
Y;          
 
  349     if (number_of_peaks != 1) {
 
  350       WARNING(
"Number of peaks " << h1->GetName() << 
' ' << number_of_peaks << 
" != 1" << endl);
 
  353     if (result->IsValid() && 
f1.GetParameter(0) >= Wmin) {
 
  354       t0[pmt] = 
f1.GetParameter(1);
 
  364     const double W = laserFrequency_Hz * counter * 
getFrameTime() * 1.0e-9;
 
  366     NOTICE(
"Expection values [npe]" << endl);
 
  369       NOTICE(
i->first << 
' ' << 
FIXED(7,3) << 
i->second / W << endl);
 
  374   if (overwriteDetector) { 
 
  378     for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
  382       if (range.first != range.second) {
 
  388         if (p0 != t0.end()) {
 
  390           const double t1 = p0->second;
 
  397               module->getPMT(pmt).subT0(p1->second);                   
 
  399               module->getPMT(pmt).subT0(t1);                           
 
  404           if (!module->getPMT(
id.getPMTAddress()).has(
PMT_DISABLE)) {
 
  409                 << setw(10) << module->getID() << 
"/" << 
FILL(2,
'0') << 
id.getPMTAddress() << 
FILL() << 
' ' 
  410                 << 
"missing or insufficient signal." << endl); 
 
  417       NOTICE(
"Store calibration data on file " << detectorFile << endl);
 
  425       FATAL(
"Number of errors " << errors << 
" != 0" << endl);
 
Utility class to parse command line options. 
 
std::map< int, buffer_type > map_type
string -> hits 
 
#define gmake_property(A)
macros to convert (template) parameter to JPropertiesElement object 
 
std::string getLabel(const JLocation &location)
Get module label for monitoring and other applications. 
 
Auxiliary class to select ROOT class based on class name. 
 
Router for direct addressing of module data in detector data structure. 
 
Auxiliary class for TDC constraints. 
 
Utility class to parse parameter values. 
 
Empty structure for specification of parser element that is initialised (i.e. does not require input)...
 
Long64_t counter_type
Type definition for counter. 
 
then fatal Wrong number of arguments fi set_variable STRING $argv[1] set_variable DETECTORXY_TXT $WORKDIR $DETECTORXY_TXT tail read X Y CHI2 RMS printf optimum n $X $Y $CHI2 $RMS awk v Y
 
Auxiliary data structure for floating point format specification. 
 
Auxiliary class for multiplexing object iterators. 
 
double getTimeOfFrame(const int frame_index)
Get start time of frame in ns since start of run for a given frame index. 
 
const JPolynome f1(1.0, 2.0, 3.0)
Function. 
 
Auxiliary class for defining the range of iterations of objects. 
 
Type definition of range. 
 
Template specialisation of L0 builder for JHitR0 data type. 
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object 
 
double getFrameTime()
Get frame time duration. 
 
void store(const std::string &file_name, const JDetector &detector)
Store detector to output file. 
 
static const int PMT_DISABLE
KM3NeT Data Definitions v3.2.0-10-g78c1c7a https://git.km3net.de/common/km3net-dataformat. 
 
bool putObject(TDirectory &dir, const TObject &object)
Write object to ROOT directory. 
 
Auxiliary data structure for sequence of same character. 
 
z range($ZMAX-$ZMIN)< $MINIMAL_DZ." fi fi typeset -Z 4 STRING typeset -Z 2 FLOOR JPlot1D -f $
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file. 
 
General purpose class for object reading from a list of file names. 
 
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
 
no fit printf nominal n $STRING awk v X
 
const JLimit & getLimit() const 
Get limit. 
 
do set_variable DETECTOR_TXT $WORKDIR detector
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module. 
 
#define DEBUG(A)
Message macros.