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 |
|
---|
40 | ClassImp(MHCalibrationPINDiode);
|
---|
41 |
|
---|
42 | using namespace std;
|
---|
43 |
|
---|
44 | // --------------------------------------------------------------------------
|
---|
45 | //
|
---|
46 | // Default Constructor.
|
---|
47 | //
|
---|
48 | MHCalibrationPINDiode::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 |
|
---|
76 | MHCalibrationPINDiode::~MHCalibrationPINDiode()
|
---|
77 | {
|
---|
78 |
|
---|
79 | delete fHPINDiodeCharge;
|
---|
80 | delete fHPINDiodeChargevsN;
|
---|
81 |
|
---|
82 | if (fChargeGausFit)
|
---|
83 | delete fChargeGausFit;
|
---|
84 | if (fFitLegend)
|
---|
85 | delete fFitLegend;
|
---|
86 | }
|
---|
87 |
|
---|
88 | void MHCalibrationPINDiode::Clear(Option_t *o)
|
---|
89 | {
|
---|
90 |
|
---|
91 | fTotalEntries = 0;
|
---|
92 |
|
---|
93 | fChargeFirstHiGain = -100.5;
|
---|
94 | fChargeLastHiGain = 1999.5;
|
---|
95 |
|
---|
96 | fChargeChisquare = -1.;
|
---|
97 | fChargeProb = -1.;
|
---|
98 | fChargeNdf = -1;
|
---|
99 |
|
---|
100 | if (fChargeGausFit)
|
---|
101 | delete fChargeGausFit;
|
---|
102 | if (fFitLegend)
|
---|
103 | delete fFitLegend;
|
---|
104 |
|
---|
105 | return;
|
---|
106 |
|
---|
107 | }
|
---|
108 |
|
---|
109 | void MHCalibrationPINDiode::Reset()
|
---|
110 | {
|
---|
111 |
|
---|
112 | Clear();
|
---|
113 |
|
---|
114 | fHPINDiodeCharge->Reset();
|
---|
115 | fHPINDiodeChargevsN->Reset();
|
---|
116 | }
|
---|
117 |
|
---|
118 |
|
---|
119 | Bool_t MHCalibrationPINDiode::FillCharge(Float_t q)
|
---|
120 | {
|
---|
121 | return (fHPINDiodeCharge->Fill(q) > -1);
|
---|
122 | }
|
---|
123 |
|
---|
124 | Bool_t MHCalibrationPINDiode::FillChargevsN(Float_t q, Int_t n)
|
---|
125 | {
|
---|
126 | return (fHPINDiodeChargevsN->Fill(n,q) > -1);
|
---|
127 | }
|
---|
128 |
|
---|
129 | void MHCalibrationPINDiode::CutAllEdges()
|
---|
130 | {
|
---|
131 |
|
---|
132 | Int_t nbins = 20;
|
---|
133 |
|
---|
134 | CutEdges(fHPINDiodeCharge,nbins);
|
---|
135 |
|
---|
136 | fChargeFirstHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetFirst());
|
---|
137 | fChargeLastHiGain = fHPINDiodeCharge->GetBinLowEdge(fHPINDiodeCharge->GetXaxis()->GetLast())
|
---|
138 | +fHPINDiodeCharge->GetBinWidth(0);
|
---|
139 | CutEdges(fHPINDiodeChargevsN,0);
|
---|
140 |
|
---|
141 | }
|
---|
142 |
|
---|