1 | /* ======================================================================== *\
|
---|
2 | ! $Name: not supported by cvs2svn $:$Id: MExtractTime.cc,v 1.22 2006-10-24 08:24:52 tbretz Exp $
|
---|
3 | ! --------------------------------------------------------------------------
|
---|
4 | !
|
---|
5 | ! *
|
---|
6 | ! * This file is part of MARS, the MAGIC Analysis and Reconstruction
|
---|
7 | ! * Software. It is distributed to you in the hope that it can be a useful
|
---|
8 | ! * and timesaving tool in analysing Data of imaging Cerenkov telescopes.
|
---|
9 | ! * It is distributed WITHOUT ANY WARRANTY.
|
---|
10 | ! *
|
---|
11 | ! * Permission to use, copy, modify and distribute this software and its
|
---|
12 | ! * documentation for any purpose is hereby granted without fee,
|
---|
13 | ! * provided that the above copyright notice appear in all copies and
|
---|
14 | ! * that both that copyright notice and this permission notice appear
|
---|
15 | ! * in supporting documentation. It is provided "as is" without express
|
---|
16 | ! * or implied warranty.
|
---|
17 | ! *
|
---|
18 | !
|
---|
19 | !
|
---|
20 | ! Author(s): Markus Gaug, 04/2004 <mailto:markus@ifae.es>
|
---|
21 | ! Author(s): Thomas Bretz, 04/2004 <mailto:tbretz@astro.uni-wuerzburg.de>
|
---|
22 | !
|
---|
23 | ! Copyright: MAGIC Software Development, 2000-2006
|
---|
24 | !
|
---|
25 | !
|
---|
26 | \* ======================================================================== */
|
---|
27 |
|
---|
28 | //////////////////////////////////////////////////////////////////////////////
|
---|
29 | //
|
---|
30 | // MExtractTime
|
---|
31 | //
|
---|
32 | // Base class for the signal extractors, used the functions
|
---|
33 | // FindTimeHiGain() and FindTimeLoGain() to extract the signal and
|
---|
34 | // substract the pedestal value
|
---|
35 | //
|
---|
36 | // The following figure gives and example of possible inheritance trees.
|
---|
37 | // An extractor class can inherit from each of the following base classes:
|
---|
38 | // - MExtractor
|
---|
39 | // - MExtractTime
|
---|
40 | // - MExtractTimeAndCharge
|
---|
41 | //
|
---|
42 | //Begin_Html
|
---|
43 | /*
|
---|
44 | <img src="images/ExtractorClasses.gif">
|
---|
45 | */
|
---|
46 | //End_Html
|
---|
47 | //
|
---|
48 | // The following variables have to be set by the derived class and
|
---|
49 | // do not have defaults:
|
---|
50 | // - fNumHiGainSamples
|
---|
51 | // - fNumLoGainSamples
|
---|
52 | // - fSqrtHiGainSamples
|
---|
53 | // - fSqrtLoGainSamples
|
---|
54 | //
|
---|
55 | // Input Containers:
|
---|
56 | // MRawEvtData
|
---|
57 | // MRawRunHeader
|
---|
58 | // MPedestalCam
|
---|
59 | //
|
---|
60 | // Output Containers:
|
---|
61 | // MArrivalTimeCam
|
---|
62 | //
|
---|
63 | //////////////////////////////////////////////////////////////////////////////
|
---|
64 | #include "MExtractTime.h"
|
---|
65 |
|
---|
66 | #include <fstream>
|
---|
67 |
|
---|
68 | #include "MLog.h"
|
---|
69 | #include "MLogManip.h"
|
---|
70 |
|
---|
71 | #include "MParList.h"
|
---|
72 |
|
---|
73 | #include "MRawEvtData.h"
|
---|
74 | #include "MRawEvtPixelIter.h"
|
---|
75 | #include "MRawRunHeader.h"
|
---|
76 |
|
---|
77 | #include "MPedestalCam.h"
|
---|
78 | #include "MPedestalPix.h"
|
---|
79 |
|
---|
80 | #include "MArrivalTimeCam.h"
|
---|
81 | #include "MArrivalTimePix.h"
|
---|
82 |
|
---|
83 | ClassImp(MExtractTime);
|
---|
84 |
|
---|
85 | using namespace std;
|
---|
86 |
|
---|
87 | const TString MExtractTime::fgNameTimeCam = "MArrivalTimeCam";
|
---|
88 | // --------------------------------------------------------------------------
|
---|
89 | //
|
---|
90 | // Default constructor.
|
---|
91 | //
|
---|
92 | // Set:
|
---|
93 | // - all pointers to NULL
|
---|
94 | // - all variables to 0
|
---|
95 | // - fSaturationLimit to fgSaturationLimit
|
---|
96 | // - fNameTimeCam to fgNameTimeCam
|
---|
97 | //
|
---|
98 | // Call:
|
---|
99 | // - AddToBranchList("MRawEvtData.*")
|
---|
100 | //
|
---|
101 | MExtractTime::MExtractTime(const char *name, const char *title)
|
---|
102 | : fArrTime(NULL)
|
---|
103 | {
|
---|
104 |
|
---|
105 | fName = name ? name : "MExtractTime";
|
---|
106 | fTitle = title ? title : "Base class for signal extractors";
|
---|
107 |
|
---|
108 | SetNameTimeCam();
|
---|
109 | }
|
---|
110 |
|
---|
111 |
|
---|
112 |
|
---|
113 | // --------------------------------------------------------------------------
|
---|
114 | //
|
---|
115 | // The PreProcess searches for the following input containers:
|
---|
116 | // - MRawEvtData
|
---|
117 | // - MRawRunHeader
|
---|
118 | // - MPedestalCam
|
---|
119 | //
|
---|
120 | // The following output containers are also searched and created if
|
---|
121 | // they were not found:
|
---|
122 | //
|
---|
123 | // - MArrivalTimeCam
|
---|
124 | //
|
---|
125 | Int_t MExtractTime::PreProcess(MParList *pList)
|
---|
126 | {
|
---|
127 | fArrTime = (MArrivalTimeCam*)pList->FindCreateObj("MArrivalTimeCam",AddSerialNumber(fNameTimeCam));
|
---|
128 | if (!fArrTime)
|
---|
129 | return kFALSE;
|
---|
130 |
|
---|
131 | return PreProcessStd(pList);
|
---|
132 | }
|
---|
133 |
|
---|
134 | // --------------------------------------------------------------------------
|
---|
135 | //
|
---|
136 | // The ReInit calls:
|
---|
137 | // - MExtractor::ReInit()
|
---|
138 | //
|
---|
139 | // Call:
|
---|
140 | // - MArrivalTimeCam::SetUsedFADCSlices(fHiGainFirst, fHiGainLast, fNumHiGainSamples,
|
---|
141 | // fLoGainFirst, fLoGainLast, fNumLoGainSamples);
|
---|
142 | /*
|
---|
143 | Bool_t MExtractTime::ReInit(MParList *pList)
|
---|
144 | {
|
---|
145 | if (!MExtractor::ReInit(pList))
|
---|
146 | return kFALSE;
|
---|
147 |
|
---|
148 | // if (fArrTime)
|
---|
149 | // fArrTime->SetUsedFADCSlices(fHiGainFirst, fHiGainLast+fHiLoLast, fLoGainFirst, fLoGainLast);
|
---|
150 |
|
---|
151 | return kTRUE;
|
---|
152 | }
|
---|
153 | */
|
---|
154 | // --------------------------------------------------------------------------
|
---|
155 | //
|
---|
156 | // Calculate the integral of the FADC time slices and store them as a new
|
---|
157 | // pixel in the MArrivalTimeCam container.
|
---|
158 | /*
|
---|
159 | Int_t MExtractTime::Process()
|
---|
160 | {
|
---|
161 |
|
---|
162 |
|
---|
163 | MRawEvtPixelIter pixel(fRawEvt);
|
---|
164 |
|
---|
165 | while (pixel.Next())
|
---|
166 | {
|
---|
167 | //
|
---|
168 | // Find signal in hi- and lo-gain
|
---|
169 | //
|
---|
170 | Float_t timehi=0., deltatimehi=0.;
|
---|
171 | Byte_t sathi=0;
|
---|
172 |
|
---|
173 | const Int_t pixid = pixel.GetPixelId();
|
---|
174 | const MPedestalPix &ped = (*fPedestals)[pixid];
|
---|
175 | MArrivalTimePix &pix = (*fArrTime)[pixid];
|
---|
176 |
|
---|
177 | FindTimeHiGain(pixel.GetHiGainSamples()+fHiGainFirst, timehi, deltatimehi, sathi, ped);
|
---|
178 |
|
---|
179 | Float_t timelo=0., deltatimelo=0.;
|
---|
180 | Byte_t satlo=0;
|
---|
181 |
|
---|
182 | if ((sathi)&&pixel.HasLoGain())
|
---|
183 | FindTimeLoGain(pixel.GetLoGainSamples()+fLoGainFirst, timelo, deltatimelo, satlo, ped);
|
---|
184 |
|
---|
185 | pix.SetArrivalTime(timehi, deltatimehi, timelo-fOffsetLoGain, deltatimelo);
|
---|
186 | pix.SetGainSaturation(sathi, satlo);
|
---|
187 |
|
---|
188 | }
|
---|
189 |
|
---|
190 | fArrTime->SetReadyToSave();
|
---|
191 |
|
---|
192 | return kTRUE;
|
---|
193 | }*/
|
---|
194 |
|
---|
195 | void MExtractTime::Print(Option_t *o) const
|
---|
196 | {
|
---|
197 | // if (IsA()==MExtractTime::Class())
|
---|
198 | // *fLog << GetDescriptor() << ":" << endl;
|
---|
199 | MExtractor::Print(o);
|
---|
200 | *fLog << " Offset Lo-Gain: " << fOffsetLoGain << endl;
|
---|
201 | }
|
---|