source: trunk/MagicSoft/Mars/mcalib/MHCalibrationRelTimePix.cc@ 3609

Last change on this file since 3609 was 3177, checked in by gaug, 21 years ago
*** empty log message ***
File size: 3.7 KB
Line 
1/* ======================================================================== *\
2!
3! *
4! * This file is part of MARS, the MAGIC Analysis and Reconstruction
5! * Software. It is distributed to you in the hope that it can be a useful
6! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
7! * It is distributed WITHOUT ANY WARRANTY.
8! *
9! * Permission to use, copy, modify and distribute this software and its
10! * documentation for any purpose is hereby granted without fee,
11! * provided that the above copyright notice appear in all copies and
12! * that both that copyright notice and this permission notice appear
13! * in supporting documentation. It is provided "as is" without express
14! * or implied warranty.
15! *
16!
17!
18! Author(s): Markus Gaug 02/2004 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2004
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MHCalibrationRelTimePix
28//
29// Histogram class for the relative arrival time analysis.
30// Holds the histogrammed arrival times,
31// derives from MHGausEvents, perform Fourier analysis
32//
33//////////////////////////////////////////////////////////////////////////////
34#include "MHCalibrationRelTimePix.h"
35
36#include <TH1.h>
37
38ClassImp(MHCalibrationRelTimePix);
39
40using namespace std;
41//
42const Int_t MHCalibrationRelTimePix::fgChargeNbins = 900;
43const Axis_t MHCalibrationRelTimePix::fgChargeFirst = -13.;
44const Axis_t MHCalibrationRelTimePix::fgChargeLast = 13.;
45
46const Int_t MHCalibrationRelTimePix::fgPulserFrequency = 200;
47// --------------------------------------------------------------------------
48//
49// Default Constructor.
50//
51MHCalibrationRelTimePix::MHCalibrationRelTimePix(const char *name, const char *title)
52 : fPixId(-1)
53{
54
55 fName = name ? name : "MHCalibrationRelTimePix";
56 fTitle = title ? title : "Histogrammed Calibration Relative Arrival Time events";
57
58 SetChargeNbins();
59 SetChargeFirst();
60 SetChargeLast();
61
62 // Create a large number of bins, later we will rebin
63 fHGausHist.SetName("HCalibrationRelTimeCharge");
64 fHGausHist.SetTitle("Distribution of Relative Arrival Times Pixel ");
65 fHGausHist.SetXTitle("FADC Slice");
66 fHGausHist.SetYTitle("Nr. of events");
67 fHGausHist.Sumw2();
68
69 SetPulserFrequency();
70}
71
72MHCalibrationRelTimePix::~MHCalibrationRelTimePix()
73{
74}
75
76void MHCalibrationRelTimePix::Clear(Option_t *o)
77{
78
79 fPixId = -1;
80 MHGausEvents::Clear();
81 return;
82}
83
84
85
86void MHCalibrationRelTimePix::InitBins()
87{
88
89 fHGausHist.SetBins(fChargeNbins,fChargeFirst,fChargeLast);
90
91}
92
93
94void MHCalibrationRelTimePix::ChangeHistId(Int_t id)
95{
96
97 fPixId = id;
98
99 fHGausHist.SetName( Form("%s%d", fHGausHist.GetName(), id));
100 fHGausHist.SetTitle( Form("%s%d", fHGausHist.GetTitle(), id));
101
102}
103
104
105void MHCalibrationRelTimePix::SetPulserFrequency(Float_t f)
106{
107 SetEventFrequency(f);
108}
109
110
111void MHCalibrationRelTimePix::BypassFit()
112{
113
114 //
115 // In case, we do not obtain reasonable values
116 // with the fit, we take the histogram values
117 //
118 SetMean( fHGausHist.GetMean() );
119 SetMeanErr( fHGausHist.GetRMS() / fHGausHist.GetEntries() );
120 SetSigma( fHGausHist.GetRMS() );
121 SetSigmaErr( fHGausHist.GetRMS() / fHGausHist.GetEntries() /2. );
122
123}
124
125// ----------------------------------------------------------------------
126//
127// Renorm the results from FADC slices to times in ns.
128//
129void MHCalibrationRelTimePix::Renorm(const Float_t slicewidth)
130{
131
132 SetMean( GetMean() * slicewidth );
133 SetMeanErr( GetMeanErr() * slicewidth );
134 SetSigma( GetSigma() * slicewidth );
135 SetSigmaErr( GetSigmaErr()* slicewidth );
136
137}
138
Note: See TracBrowser for help on using the repository browser.