source: trunk/Mars/mhcalib/MHCalibrationPulseTimeCam.cc@ 9627

Last change on this file since 9627 was 9374, checked in by tbretz, 16 years ago
*** empty log message ***
File size: 21.5 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.44 2009-03-02 14:32:50 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 02/2004 <mailto:markus@ifae.es>
21! Author(s): Thomas Bretz <mailto:tbretz@astro.uni-wuerzburg.de>
22!
23! Copyright: MAGIC Software Development, 2000-2007
24!
25!
26\* ======================================================================== */
27/////////////////////////////////////////////////////////////////////////////
28//
29// MHCalibrationPulseTimeCam
30//
31// Fills the extracted signals of MExtractedSignalCam into the MHCalibrationPix-classes
32// MHCalibrationPulseTimeHiGainPix and MHCalibrationPulseTimeLoGainPix for every:
33//
34// - Pixel, stored in the TOrdCollection's MHCalibrationCam::fHiGainArray and
35// MHCalibrationCam::fLoGainArray
36//
37// - Average pixel per AREA index (e.g. inner and outer for the MAGIC camera),
38// stored in the TOrdCollection's MHCalibrationCam::fAverageHiGainAreas and
39// MHCalibrationCam::fAverageLoGainAreas
40//
41// - Average pixel per camera SECTOR (e.g. sectors 1-6 for the MAGIC camera),
42// stored in the TOrdCollection's MHCalibrationCam::fAverageHiGainSectors and
43// MHCalibrationCam::fAverageLoGainSectors
44//
45// Every signal is taken from MExtractedSignalCam and filled into a histogram and
46// an array, in order to perform a Fourier analysis (see MHGausEvents).
47// The signals are moreover averaged on an event-by-event basis and written into
48// the corresponding average pixels.
49//
50// Additionally, the (FADC slice) position of the maximum is stored in an Absolute
51// Arrival Time histogram. This histogram serves for a rough cross-check if the
52// signal does not lie at or outside the edges of the extraction window.
53//
54// The PulseTime histograms are fitted to a Gaussian, mean and sigma with its errors
55// and the fit probability are extracted. If none of these values are NaN's and
56// if the probability is bigger than MHGausEvents::fProbLimit (default: 0.5%),
57// the fit is declared valid.
58// Otherwise, the fit is repeated within ranges of the previous mean
59// +- MHCalibrationPix::fPickupLimit (default: 5) sigma (see MHCalibrationPix::RepeatFit())
60// In case this does not make the fit valid, the histogram means and RMS's are
61// taken directly (see MHCalibrationPix::BypassFit()) and the following flags are set:
62// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted ) or
63// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted ) and
64// - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
65//
66// Outliers of more than MHCalibrationPix::fPickupLimit (default: 5) sigmas
67// from the mean are counted as Pickup events (stored in MHCalibrationPix::fPickup)
68//
69// Unless more than fNumHiGainSaturationLimit (default: 1%) of the overall FADC
70// slices show saturation, the following flag is set:
71// - MCalibrationPulseTimePix::SetHiGainSaturation();
72// In that case, the calibration constants are derived from the low-gain results.
73//
74// If more than fNumLoGainSaturationLimit (default: 1%) of the overall
75// low-gain FADC slices saturate, the following flags are set:
76// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturation ) and
77// - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnsuitableRun )
78//
79// The class also fills arrays with the signal vs. event number, creates a fourier
80// spectrum and investigates if the projected fourier components follow an exponential
81// distribution. In case that the probability of the exponential fit is less than
82// MHGausEvents::fProbLimit (default: 0.5%), the following flags are set:
83// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating ) or
84// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating ) and
85// - MBadPixelsPix::SetUnsuitable( MBadPixelsPix::kUnreliableRun )
86//
87// This same procedure is performed for the average pixels.
88//
89// The following results are written into MCalibrationPulseTimeCam:
90//
91// - MCalibrationPix::SetHiGainSaturation()
92// - MCalibrationPix::SetHiGainMean()
93// - MCalibrationPix::SetHiGainMeanErr()
94// - MCalibrationPix::SetHiGainSigma()
95// - MCalibrationPix::SetHiGainSigmaErr()
96// - MCalibrationPix::SetHiGainProb()
97// - MCalibrationPix::SetHiGainNumPickup()
98//
99// For all averaged areas, the fitted sigma is multiplied with the square root of
100// the number involved pixels in order to be able to compare it to the average of
101// sigmas in the camera.
102//
103//
104// ClassVersion 2:
105// ---------------
106// - Byte_t fSaturationLimit
107// - Byte_t fLowerSignalLimit
108// + UInt_t fSaturationLimit
109// + UInt_t fLowerSignalLimit
110//
111/////////////////////////////////////////////////////////////////////////////
112#include "MHCalibrationPulseTimeCam.h"
113
114#include <TEnv.h>
115#include <TLine.h>
116#include <TGraph.h>
117#include <TLegend.h>
118#include <TCanvas.h>
119#include <TOrdCollection.h>
120
121#include "MLog.h"
122#include "MLogManip.h"
123
124#include "MParList.h"
125
126#include "MArrayD.h"
127#include "MRawRunHeader.h"
128#include "MExtractedSignalCam.h"
129#include "MPedestalSubtractedEvt.h"
130
131#include "MCalibrationPix.h"
132#include "MHCalibrationPix.h"
133
134#include "MGeomCam.h"
135#include "MGeom.h"
136
137#include "MBadPixelsCam.h"
138
139ClassImp(MHCalibrationPulseTimeCam);
140
141using namespace std;
142
143const UInt_t MHCalibrationPulseTimeCam::fgSaturationLimit = 245;
144const UInt_t MHCalibrationPulseTimeCam::fgLowerSignalLimit = 85;
145const Int_t MHCalibrationPulseTimeCam::fgNumPixelsRequired = 3;
146const Int_t MHCalibrationPulseTimeCam::fgHiGainNbins = 20;
147const Axis_t MHCalibrationPulseTimeCam::fgHiGainFirst = -0.5;
148const Axis_t MHCalibrationPulseTimeCam::fgHiGainLast = 19.5;
149const Float_t MHCalibrationPulseTimeCam::fgProbLimit = 0.001;
150const TString MHCalibrationPulseTimeCam::gsHistName = "PulseTime";
151const TString MHCalibrationPulseTimeCam::gsHistTitle = "Extracted Times";
152const TString MHCalibrationPulseTimeCam::gsHistXTitle = "Time [FADC slices]";
153const TString MHCalibrationPulseTimeCam::gsHistYTitle = "Nr. events";
154const TString MHCalibrationPulseTimeCam::fgReferenceFile = "mjobs/signalref.rc";
155
156// --------------------------------------------------------------------------
157//
158// Default Constructor.
159//
160// Sets:
161// - all pointers to NULL
162//
163// - fNbins to fgHiGainNbins
164// - fFirst to fgHiGainFirst
165// - fLast to fgHiGainLast
166//
167// - fHistName to gsHistName
168// - fHistTitle to gsHistTitle
169// - fHistXTitle to gsHistXTitle
170// - fHistYTitle to gsHistYTitle
171//
172// - fSaturationLimit to fgSaturationLimit
173// - fLowerSignalLimit to fgLowerSignalLimit
174// - fNumPixelsRequired to fgNumPixelsRequired
175//
176MHCalibrationPulseTimeCam::MHCalibrationPulseTimeCam(const char *name, const char *title)
177 : fSignalCam(NULL), fBadPixels(NULL)
178{
179
180 fName = name ? name : "MHCalibrationPulseTimeCam";
181 fTitle = title ? title : "Class to fill the extracted pulse times for cosmics ";
182
183 SetBinning(fgHiGainNbins, fgHiGainFirst, fgHiGainLast);
184
185 SetProbLimit(fgProbLimit);
186
187 SetHistName (gsHistName .Data());
188 SetHistTitle (gsHistTitle .Data());
189 SetHistXTitle(gsHistXTitle.Data());
190 SetHistYTitle(gsHistYTitle.Data());
191
192 SetReferenceFile();
193 SetLoGain(kFALSE);
194 SetOscillations(kFALSE);
195
196 SetSaturationLimit();
197 SetLowerSignalLimit();
198 SetNumPixelsRequired();
199
200 fInnerRefTime = 5.;
201 fOuterRefTime = 5.;
202}
203
204// --------------------------------------------------------------------------
205//
206// Creates new MHCalibrationPulseTimeCam only with the averaged areas:
207// the rest has to be retrieved directly, e.g. via:
208// MHCalibrationPulseTimeCam *cam = MParList::FindObject("MHCalibrationPulseTimeCam");
209// - cam->GetAverageSector(5).DrawClone();
210// - (*cam)[100].DrawClone()
211//
212TObject *MHCalibrationPulseTimeCam::Clone(const char *) const
213{
214
215 MHCalibrationPulseTimeCam *cam = new MHCalibrationPulseTimeCam();
216
217 //
218 // Copy the data members
219 //
220 cam->fColor = fColor;
221 cam->fRunNumbers = fRunNumbers;
222 cam->fPulserFrequency = fPulserFrequency;
223 cam->fFlags = fFlags;
224 cam->fNbins = fNbins;
225 cam->fFirst = fFirst;
226 cam->fLast = fLast;
227 cam->fReferenceFile = fReferenceFile;
228 cam->fInnerRefTime = fInnerRefTime;
229 cam->fOuterRefTime = fOuterRefTime;
230
231 if (!IsAverageing())
232 return cam;
233
234 const Int_t navhi = fAverageHiGainAreas->GetSize();
235
236 for (int i=0; i<navhi; i++)
237 cam->fAverageHiGainAreas->AddAt(GetAverageHiGainArea(i).Clone(),i);
238
239 return cam;
240}
241
242// --------------------------------------------------------------------------
243//
244// Gets the pointers to:
245// - MRawEvtData
246//
247Bool_t MHCalibrationPulseTimeCam::SetupHists(const MParList *pList)
248{
249
250 fBadPixels = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam");
251 if (!fBadPixels)
252 {
253 *fLog << warn << GetDescriptor() << "MBadPixelsCam not found... " << endl;
254 }
255
256 return kTRUE;
257}
258
259// --------------------------------------------------------------------------
260//
261// Gets or creates the pointers to:
262// - MExtractedSignalCam
263// - MCalibrationPulseTimeCam
264// - MBadPixelsCam
265//
266// Initializes the number of used FADC slices from MExtractedSignalCam
267// into MCalibrationPulseTimeCam and test for changes in that variable
268//
269// Calls:
270// - InitHiGainArrays()
271//
272// Sets:
273// - fSumhiarea to nareas
274// - fSumloarea to nareas
275// - fSumhisector to nsectors
276// - fSumlosector to nsectors
277//
278Bool_t MHCalibrationPulseTimeCam::ReInitHists(MParList *pList)
279{
280 fSignalCam = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
281 if (!fSignalCam)
282 {
283 *fLog << err << "MExtractedSignalCam not found... abort." << endl;
284 return kFALSE;
285 }
286
287 if (!InitCams(pList,"PulseTime"))
288 return kFALSE;
289
290 const Int_t npixels = fGeom->GetNumPixels();
291 const Int_t nsectors = fGeom->GetNumSectors();
292 const Int_t nareas = fGeom->GetNumAreas();
293
294 InitHiGainArrays(npixels,nareas,nsectors);
295
296 return kTRUE;
297}
298
299void MHCalibrationPulseTimeCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
300{
301
302 const Int_t samples = fRunHeader->GetNumSamples();
303 SetBinning(samples, -0.5, samples-0.5);
304
305 if (fHiGainArray->GetSize()==0)
306 {
307 for (Int_t i=0; i<npixels; i++)
308 {
309 fHiGainArray->AddAt(new MHCalibrationPix(Form("%sHiGainPix%04d",fHistName.Data(),i),
310 Form("%s High Gain Pixel %4d",fHistTitle.Data(),i)),i);
311
312 MHCalibrationPix &pix = (*this)[i];
313 pix.SetBinning(fNbins, fFirst, fLast);
314
315 InitHists(pix, (*fBadPixels)[i], i);
316
317 if (fCam)
318 (*fCam)[i].SetPixId(i);
319 }
320 }
321
322 if (!IsAverageing())
323 return;
324
325 if (fAverageHiGainAreas->GetSize()==0)
326 {
327 for (Int_t j=0; j<nareas; j++)
328 {
329 fAverageHiGainAreas->AddAt(new MHCalibrationPix(Form("%sHiGainArea%d",fHistName.Data(),j),
330 Form("%s High Gain Area Idx %d",fHistTitle.Data(),j)),j);
331
332 MHCalibrationPix &pix = GetAverageHiGainArea(j);
333 pix.SetBinning(fNbins, fFirst, fLast);
334
335 InitHists(pix, fCam->GetAverageBadArea(j), j);
336 }
337 }
338
339 if (fAverageHiGainSectors->GetSize()==0)
340 {
341 for (Int_t j=0; j<nsectors; j++)
342 {
343 fAverageHiGainSectors->AddAt(new MHCalibrationPix(Form("%sHiGainSector%02d",fHistName.Data(),j),
344 Form("%s High Gain Sector %02d",fHistTitle.Data(),j)),j);
345 MHCalibrationPix &pix = GetAverageHiGainSector(j);
346 pix.SetBinning(fNbins, fFirst, fLast);
347
348 InitHists(pix, fCam->GetAverageBadSector(j), j);
349 }
350 }
351}
352
353// --------------------------------------------------------------------------
354//
355// Retrieves from MExtractedSignalCam:
356// - first used LoGain FADC slice
357//
358// Retrieves from MGeomCam:
359// - number of pixels
360// - number of pixel areas
361// - number of sectors
362//
363// For all TOrdCollection's (including the averaged ones), the following steps are performed:
364//
365// 1) Fill PulseTimes histograms (MHGausEvents::FillHistAndArray()) with:
366// - MExtractedSignalPix::GetExtractedSignalHiGain();
367// - MExtractedSignalPix::GetExtractedSignalLoGain();
368//
369Bool_t MHCalibrationPulseTimeCam::FillHists(const MParContainer *par, const Stat_t w)
370{
371 MPedestalSubtractedEvt *evt = (MPedestalSubtractedEvt*)par;
372 if (!evt)
373 {
374 *fLog << err << "No argument in MHCalibrationPulseTimeCam::Fill... abort." << endl;
375 return kFALSE;
376 }
377
378 const UInt_t nareas = fGeom->GetNumAreas();
379 const UInt_t nsectors = fGeom->GetNumSectors();
380
381 MArrayD sumarea(nareas);
382 MArrayD sumsector(nsectors);
383
384 fAverageAreaNum.Reset();
385 fAverageSectorNum.Reset();
386
387 const Int_t npix = evt->GetNumPixels();
388 for (int idx=0; idx<npix; idx++)
389 {
390 if (fBadPixels)
391 if ((*fBadPixels)[idx].IsUnsuitable())
392 continue;
393
394 // Check for saturation
395 if (evt->GetSaturation(idx, fSaturationLimit*fRunHeader->GetScale())>0)
396 continue;
397
398 // Get position of maximum
399 Float_t max;
400 const Int_t pos = evt->GetMax(idx, fSignalCam->GetFirstUsedSliceHiGain(),
401 fSignalCam->GetLastUsedSliceHiGain(), max);
402
403 if (max<fLowerSignalLimit)
404 continue;
405
406 const Int_t maxpos = pos-1;
407
408 (*this)[idx].FillHist(maxpos);
409
410 const Int_t aidx = (*fGeom)[idx].GetAidx();
411 const Int_t sector = (*fGeom)[idx].GetSector();
412
413 sumarea[aidx] += maxpos;
414 sumsector[sector] += maxpos;
415
416 fAverageAreaNum[aidx]++;
417 fAverageSectorNum[sector]++;
418 }
419
420 for (UInt_t j=0; j<nareas; j++)
421 {
422 if (fAverageAreaNum[j]<fNumPixelsRequired)
423 continue;
424
425 sumarea[j] /= fAverageAreaNum[j];
426
427 if (IsOscillations())
428 GetAverageHiGainArea(j).FillHistAndArray(sumarea[j]);
429 else
430 GetAverageHiGainArea(j).FillHist(sumarea[j]);
431 }
432
433 for (UInt_t j=0; j<nsectors; j++)
434 {
435 if (fAverageSectorNum[j]<fNumPixelsRequired)
436 continue;
437
438 sumsector[j] /= fAverageSectorNum[j];
439
440 if (IsOscillations())
441 GetAverageHiGainSector(j).FillHistAndArray(sumsector[j]);
442 else
443 GetAverageHiGainSector(j).FillHist(sumsector[j]);
444 }
445
446 return kTRUE;
447}
448
449// --------------------------------------------------------------------------
450//
451// For all TOrdCollection's (including the averaged ones), the following steps are performed:
452//
453// 1) Returns if the pixel is excluded.
454// 2) Tests saturation. In case yes, set the flag: MCalibrationPix::SetHiGainSaturation()
455// or the flag: MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturated )
456// 3) Store the absolute arrival times in the MCalibrationPulseTimePix's. If flag
457// MCalibrationPix::IsHiGainSaturation() is set, the Low-Gain arrival times are stored,
458// otherwise the Hi-Gain ones.
459// 4) Calls to MHCalibrationCam::FitHiGainArrays() and MCalibrationCam::FitLoGainArrays()
460// with the flags:
461// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted )
462// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted )
463// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating )
464// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating )
465//
466Bool_t MHCalibrationPulseTimeCam::FinalizeHists()
467{
468
469 *fLog << endl;
470
471 //
472 // Perform the fitting for the High Gain (done in MHCalibrationCam)
473 //
474 for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
475 {
476
477 MHCalibrationPix &hist = (*this)[i];
478 if (hist.IsExcluded())
479 continue;
480
481 CalcHists(hist, (*fCam)[i]);
482 }
483
484 if (!IsAverageing())
485 return kTRUE;
486
487 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
488 CalcHists(GetAverageHiGainArea(j), fCam->GetAverageArea(j));
489
490 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
491 CalcHists(GetAverageHiGainSector(j), fCam->GetAverageSector(j));
492
493 return kTRUE;
494}
495
496void MHCalibrationPulseTimeCam::CalcHists(MHCalibrationPix &hist, MCalibrationPix &pix) const
497{
498
499 if (hist.IsEmpty())
500 {
501 *fLog << warn << hist.GetName() << ": Histogram empty." << endl;
502 return;
503 }
504 if (hist.IsOnlyOverflow())
505 {
506 *fLog << warn << hist.GetName() << ": Histogram contains only overflows." << endl;
507 return;
508 }
509 if (hist.IsOnlyUnderflow())
510 {
511 *fLog << warn << hist.GetName() << ": Histogram contains only underflows." << endl;
512 return;
513 }
514
515 hist.BypassFit();
516
517 pix.SetHiGainMean ( hist.GetMean() );
518 pix.SetHiGainMeanVar ( hist.GetMeanErr() * hist.GetMeanErr() );
519 pix.SetHiGainRms ( hist.GetHistRms() );
520 pix.SetHiGainSigma ( hist.GetSigma() );
521 pix.SetHiGainSigmaVar ( hist.GetSigmaErr()* hist.GetSigmaErr() );
522
523 if (IsDebug())
524 {
525 *fLog << dbginf << GetDescriptor() << ": ID " << GetName()
526 << " "<<pix.GetPixId()
527 << " Mean: " << hist.GetMean ()
528 << " MeanErr: " << hist.GetMeanErr ()
529 << " MeanSigma: " << hist.GetSigma ()
530 << " MeanSigmaErr: " << hist.GetSigmaErr()
531 << " Prob: " << hist.GetProb ()
532 << endl;
533 }
534}
535
536Double_t MHCalibrationPulseTimeCam::GetNumEvents() const
537{
538 return GetAverageAreas()>0 ? GetAverageHiGainArea(0).GetEntries() : 0;
539}
540
541// --------------------------------------------------------------------------
542//
543// Calls MHCalibrationPix::DrawClone() for pixel idx
544//
545void MHCalibrationPulseTimeCam::DrawPixelContent(Int_t idx) const
546{
547 (*this)[idx].DrawClone();
548}
549
550
551// -----------------------------------------------------------------------------
552//
553// Default draw:
554//
555// Displays the averaged areas, both High Gain and Low Gain
556//
557// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
558//
559void MHCalibrationPulseTimeCam::Draw(const Option_t *opt)
560{
561
562 const Int_t nareas = fAverageHiGainAreas->GetSize();
563 if (nareas == 0)
564 return;
565
566 TString option(opt);
567 option.ToLower();
568
569 TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
570 pad->SetBorderMode(0);
571 pad->Divide(1,nareas, 1e-10, 1e-10);
572
573 //
574 // Loop over inner and outer pixels
575 //
576 for (Int_t i=0; i<nareas;i++)
577 {
578 pad->cd(i+1);
579
580 MHCalibrationPix &hipix = GetAverageHiGainArea(i);
581 DrawDataCheckPixel(hipix,i ? fOuterRefTime : fInnerRefTime);
582 }
583}
584
585// -----------------------------------------------------------------------------
586//
587// Draw the average pixel for the datacheck:
588//
589// Displays the averaged areas, both High Gain and Low Gain
590//
591// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
592//
593void MHCalibrationPulseTimeCam::DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline)
594{
595 gPad->SetBorderMode(0);
596 gPad->SetTicks();
597
598 TH1F *hist = pix.GetHGausHist();
599
600 //
601 // set the labels bigger
602 //
603 TAxis *xaxe = hist->GetXaxis();
604 TAxis *yaxe = hist->GetYaxis();
605 xaxe->CenterTitle();
606 yaxe->CenterTitle();
607 xaxe->SetTitleSize(0.06);
608 yaxe->SetTitleSize(0.076);
609 xaxe->SetTitleOffset(0.6);
610 yaxe->SetTitleOffset(0.65);
611 xaxe->SetLabelSize(0.06);
612 yaxe->SetLabelSize(0.06);
613 xaxe->SetTitle(hist->GetXaxis()->GetTitle());
614 yaxe->SetTitle(hist->GetYaxis()->GetTitle());
615 xaxe->SetRange(hist->GetMaximumBin()-30, hist->GetMaximumBin()+30);
616
617 hist->Draw();
618
619 DisplayRefLines(hist, refline);
620}
621
622void MHCalibrationPulseTimeCam::DisplayRefLines(const TH1F *hist, const Float_t refline) const
623{
624 TLine *line = new TLine(refline, 0, refline, hist->GetMaximum());
625 line->SetLineColor(106);
626 line->SetLineStyle(2);
627 line->SetLineWidth(3);
628 line->SetBit(kCanDelete);
629 line->Draw();
630
631 TLegend *leg = new TLegend(0.8,0.35,0.99,0.65);
632 leg->AddEntry(line, "Reference", "l");
633 leg->SetBit(kCanDelete);
634 leg->Draw();
635}
636
637Int_t MHCalibrationPulseTimeCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
638{
639
640 Int_t rc = MHCalibrationCam::ReadEnv(env,prefix,print);
641 if (rc==kERROR)
642 return kERROR;
643
644 if (IsEnvDefined(env, prefix, "SaturationLimit", print))
645 {
646 SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", (Int_t)fSaturationLimit));
647 rc = kTRUE;
648 }
649
650 if (IsEnvDefined(env, prefix, "LowerSignalLimit", print))
651 {
652 SetLowerSignalLimit(GetEnvValue(env, prefix, "LowerSignalLimit", (Int_t)fLowerSignalLimit));
653 rc = kTRUE;
654 }
655
656 if (IsEnvDefined(env, prefix, "NumPixelsRequired", print))
657 {
658 SetNumPixelsRequired(GetEnvValue(env,prefix,"NumPixelsRequired",fNumPixelsRequired));
659 rc = kTRUE;
660 }
661
662 if (IsEnvDefined(env, prefix, "ReferenceFile", print))
663 {
664 SetReferenceFile(GetEnvValue(env,prefix,"ReferenceFile",fReferenceFile.Data()));
665 rc = kTRUE;
666 }
667
668 TEnv refenv(fReferenceFile);
669
670 fInnerRefTime = refenv.GetValue("InnerRefTime",fInnerRefTime);
671 fOuterRefTime = refenv.GetValue("OuterRefTime",fOuterRefTime);
672
673 return rc;
674}
Note: See TracBrowser for help on using the repository browser.