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

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