33 int main(
int argc, 
char **argv)
 
   41   bool               setDefaultLimits;
 
   50     JParser<> zap(
"Auxiliary program to fit singles rate distributions.");
 
   63   catch(
const exception &error) {
 
   64     FATAL(error.what() << endl);
 
   79   TFile* in = TFile::Open(inputFile.c_str(), 
"exist");
 
   81   if (in == NULL || !in->IsOpen()) {
 
   82     FATAL(
"File: " << inputFile << 
" not opened." << endl);
 
   87   for (JDetector::iterator module = 
detector.begin(); module != 
detector.end(); ++module) {
 
   89     DEBUG(
"Module " << module->getID() << endl);
 
   92     TH2D* h2s = (TH2D*) in->Get((title+
".2S").c_str());
 
   96       WARNING(
"No data in histogram " << title << endl);
 
  101     const double factor = 1.0/1000 ;
 
  106     for (
int i = 1; i <= h2s->GetXaxis()->GetNbins(); ++i) {
 
  108       TH1D slice((title+Form(
".%i.1S", i-1)).c_str(), NULL, h2s->GetYaxis()->GetNbins(), JDAQRate::getData(factor)) ;
 
  112       for (
int j = 1 ; 
j <= h2s->GetNbinsY() ; ++
j) {
 
  114         slice.SetBinContent(
j, h2s->GetBinContent(i, 
j)) ;
 
  115         slice.SetBinError  (
j, sqrt(h2s->GetBinContent(i, 
j))) ;
 
  119       if (slice.Integral() <= 0.0) {
 
  121         WARNING(
"No data in PMT " << i-1 << 
" of module " << title << 
", skipping fit" << endl) ;
 
  126       slice.Scale(1.0/slice.Integral()) ;
 
  129       int    binmax = slice.GetMaximumBin() ;
 
  130       double ratemax = slice.GetBinContent(binmax) ;
 
  134       while ((slice.GetBinContent(bin_l)==0 || slice.GetBinContent(bin_l) >= peakFraction*ratemax) && bin_l > 0)                 { bin_l-- ; } ; bin_l++ ;
 
  135       while ((slice.GetBinContent(bin_r)==0 || slice.GetBinContent(bin_r) >= peakFraction*ratemax) && bin_r < slice.GetNbinsX()) { bin_r++ ; } ; bin_r-- ;
 
  137       JRange<double> fitrange(slice.GetXaxis()->GetBinCenter(bin_l), slice.GetXaxis()->GetBinCenter(bin_r)) ;
 
  139       TF1 
f1(
"f1", 
"[0]*exp(-0.5*(x-[1])*(x-[1])/([2]*[2]))/(sqrt(2*pi)*[2])");
 
  142       f1.SetParameter(0, 0.2) ;
 
  143       f1.SetParameter(1, 6.0) ; 
 
  144       f1.SetParameter(2, 0.3) ; 
 
  146       if (setDefaultLimits) {
 
  147         f1.SetParLimits(0,     0.0,  10.0);
 
  148         f1.SetParLimits(1,     0.0,  20.0); 
 
  149         f1.SetParLimits(2,     0.0,  1.0);  
 
  156       DEBUG(
"Fit histogram " << slice.GetName() << 
" in range " << fitrange << 
" kHz " << endl ) ;
 
  158       slice.Fit(&
f1, option.c_str(), 
"same", max(0.0, fitrange.
first), fitrange.
second) ;
 
  160       DEBUG( 
f1.GetParameter(0)<<
" "<<
f1.GetParameter(1)<<
" "<<
f1.GetParameter(2)<<endl ) ;
 
  162       mean.SetBinContent(i, 
f1.GetParameter(1)) ;
 
  163       sigma.SetBinContent(i, 
f1.GetParameter(2)) ;
 
KM3NeT DAQ constants, bit handling, etc.
 
Data structure for detector geometry and calibration.
 
int main(int argc, char **argv)
 
General purpose messaging.
 
#define DEBUG(A)
Message macros.
 
Utility class to parse command line options.
 
#define make_field(A,...)
macro to convert parameter to JParserTemplateElement object
 
Auxiliary class to define a range between two values.
 
Wrapper class around STL string class.
 
Utility class to parse command line options.
 
const JPolynome f1(1.0, 2.0, 3.0)
Function.
 
void load(const std::string &file_name, JDetector &detector)
Load detector from input file.
 
This name space includes all other name spaces (except KM3NETDAQ, KM3NET and ANTARES).
 
KM3NeT DAQ data structures and auxiliaries.
 
static const int NUMBER_OF_PMTS
Total number of PMTs in module.