source: trunk/MagicSoft/Mars/mcalib/MHCalibrationPINDiode.cc@ 3234

Last change on this file since 3234 was 3184, checked in by tbretz, 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 11/2003 <mailto:markus@ifae.es>
19!
20! Copyright: MAGIC Software Development, 2000-2002
21!
22!
23\* ======================================================================== */
24
25//////////////////////////////////////////////////////////////////////////////
26//
27// MHCalibrationPINDiode
28//
29// Performs all the necessary fits to extract the mean number of photons
30// out of the derived light flux
31//
32//////////////////////////////////////////////////////////////////////////////
33#include "MHCalibrationPINDiode.h"
34#include "MHCalibrationConfig.h"
35
36#include <TH1.h>
37#include <TF1.h>
38#include <TPaveText.h>
39
40ClassImp(MHCalibrationPINDiode);
41
42using namespace std;
43
44// --------------------------------------------------------------------------
45//
46// Default Constructor.
47//
48MHCalibrationPINDiode::MHCalibrationPINDiode(const char *name, const char *title)
49 : fChargeNbins(1000),
50 fChargevsNbins(10000)
51{
52
53 fName = name ? name : "MHCalibrationPINDiode";
54 fTitle = title ? title : "Fill the accumulated charges and times all PINDiode events and perform fits";
55
56 // Create a large number of bins, later we will rebin
57 fChargeFirstHiGain = -100.5;
58 fChargeLastHiGain = 1999.5;
59
60 fHPINDiodeCharge = new TH1F("HPINDiodeCharge","Distribution of Summed FADC Slices PINDiode",
61 fChargeNbins,fChargeFirstHiGain,fChargeLastHiGain);
62 fHPINDiodeCharge->SetXTitle("Sum FADC Slices");
63 fHPINDiodeCharge->SetYTitle("Nr. of events");
64 fHPINDiodeCharge->Sumw2();
65 fHPINDiodeCharge->SetDirectory(NULL);
66
67 fHPINDiodeChargevsN = new TH1I("HPINDiodeChargevsN","Sum of Hi Gain Charges vs. Event Number Pixel ",
68 fChargevsNbins,-0.5,(Axis_t)fChargevsNbins - 0.5);
69 fHPINDiodeChargevsN->SetXTitle("Event Nr.");
70 fHPINDiodeChargevsN->SetYTitle("Sum of Hi Gain FADC slices");
71 fHPINDiodeChargevsN->SetDirectory(NULL);
72
73 Clear();
74}
75
76MHCalibrationPINDiode::~MHCalibrationPINDiode()
77{
78 delete fHPINDiodeCharge;
79 delete fHPINDiodeChargevsN;
80}
81
82void MHCalibrationPINDiode::Clear(Option_t *o)
83{
84 fTotalEntries = 0;
85
86 fChargeFirstHiGain = -100.5;
87 fChargeLastHiGain = 1999.5;
88
89 fChargeChisquare = -1;
90 fChargeProb = -1;
91 fChargeNdf = -1;
92
93 MHCalibrationPixel::Clear();
94}
95
96void MHCalibrationPINDiode::Reset()
97{
98 Clear();
99
100 fHPINDiodeCharge->Reset();
101 fHPINDiodeChargevsN->Reset();
102}
103
104
105Bool_t MHCalibrationPINDiode::FillCharge(Float_t q)
106{
107 return (fHPINDiodeCharge->Fill(q) > -1);
108}
109
110Bool_t MHCalibrationPINDiode::FillChargevsN(Float_t q, Int_t n)
111{
112 return (fHPINDiodeChargevsN->Fill(n,q) > -1);
113}
114
115void MHCalibrationPINDiode::CutAllEdges()
116{
117
118 Int_t nbins = 20;
119
120 StripZeros(fHPINDiodeCharge,nbins);
121
122 fChargeFirstHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetFirst());
123 fChargeLastHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetLast())
124 +fHPINDiodeCharge->GetBinWidth(0);
125 StripZeros(fHPINDiodeChargevsN,0);
126
127}
128
Note: See TracBrowser for help on using the repository browser.