/* ======================================================================== *\
!
! *
! * This file is part of MARS, the MAGIC Analysis and Reconstruction
! * Software. It is distributed to you in the hope that it can be a useful
! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
! * It is distributed WITHOUT ANY WARRANTY.
! *
! * Permission to use, copy, modify and distribute this software and its
! * documentation for any purpose is hereby granted without fee,
! * provided that the above copyright notice appear in all copies and
! * that both that copyright notice and this permission notice appear
! * in supporting documentation. It is provided "as is" without express
! * or implied warranty.
! *
!
!
!   Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
!
!   Copyright: MAGIC Software Development, 2000-2004
!
!
\* ======================================================================== */

//////////////////////////////////////////////////////////////////////////////
//
//  MHCalibrationRelTimePix
//
//  Histogram class for the relative arrival time calibration. 
//  Stores and fits the relative arrival times between pixel fPixId and 
//  pixel number 1 (hardware index: 2). Times are taken from MArrivalTimePix
//
//////////////////////////////////////////////////////////////////////////////
#include "MHCalibrationRelTimePix.h"

#include <TH1.h>

ClassImp(MHCalibrationRelTimePix);

using namespace std;
//
const Int_t   MHCalibrationRelTimePix::fgRelTimeNbins    = 900;
const Axis_t  MHCalibrationRelTimePix::fgRelTimeFirst    = -5.;
const Axis_t  MHCalibrationRelTimePix::fgRelTimeLast     =  5.;
const Float_t MHCalibrationRelTimePix::fgFADCSliceWidth  =  3.3333;
// --------------------------------------------------------------------------
//
// Default Constructor. 
//
// Sets: 
// - the default number for fNbins  (fgRelTimeNbins)
// - the default number for fFirst  (fgRelTimeFirst)
// - the default number for fLast   (fgRelTimeLast)
//
// - the default name of the  fHGausHist ("HCalibrationRelTime")
// - the default title of the fHGausHist ("Distribution of Relative Arrival Times Pixel ")
// - the default x-axis title for fHGausHist ("FADC Slice")
// - the default y-axis title for fHGausHist ("Nr. of events")
// 
// - the default number for fFADCSliceWidth (fgFADCSliceWidth)
//
MHCalibrationRelTimePix::MHCalibrationRelTimePix(const char *name, const char *title) 
{ 

  fName  = name  ? name  : "MHCalibrationRelTimePix";
  fTitle = title ? title : "Histogrammed Calibration Relative Arrival Time events";

  SetNbins ( fgRelTimeNbins );
  SetFirst ( fgRelTimeFirst );
  SetLast  ( fgRelTimeLast  );
  SetFADCSliceWidth();

  // Create a large number of bins, later we will rebin
  fHGausHist.SetName("HCalibrationRelTime");
  fHGausHist.SetTitle("Distribution of Relative Arrival Times Pixel ");
  fHGausHist.SetXTitle("FADC Slice");
  fHGausHist.SetYTitle("Nr. of events");

}

