source: tags/Mars-V2.1/mhcalib/MHCalibrationPulseTimeCam.cc

Last change on this file was 8891, checked in by tbretz, 17 years ago
*** empty log message ***
File size: 21.4 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.42 2008-05-15 18:37:26 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 "MGeomPix.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 = 2;
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// Creates new MHCalibrationPulseTimeCam only with the averaged areas:
206// the rest has to be retrieved directly, e.g. via:
207// MHCalibrationPulseTimeCam *cam = MParList::FindObject("MHCalibrationPulseTimeCam");
208// - cam->GetAverageSector(5).DrawClone();
209// - (*cam)[100].DrawClone()
210//
211TObject *MHCalibrationPulseTimeCam::Clone(const char *) const
212{
213
214 MHCalibrationPulseTimeCam *cam = new MHCalibrationPulseTimeCam();
215
216 //
217 // Copy the data members
218 //
219 cam->fColor = fColor;
220 cam->fRunNumbers = fRunNumbers;
221 cam->fPulserFrequency = fPulserFrequency;
222 cam->fFlags = fFlags;
223 cam->fNbins = fNbins;
224 cam->fFirst = fFirst;
225 cam->fLast = fLast;
226 cam->fReferenceFile = fReferenceFile;
227 cam->fInnerRefTime = fInnerRefTime;
228 cam->fOuterRefTime = fOuterRefTime;
229
230 if (!IsAverageing())
231 return cam;
232
233 const Int_t navhi = fAverageHiGainAreas->GetSize();
234
235 for (int i=0; i<navhi; i++)
236 cam->fAverageHiGainAreas->AddAt(GetAverageHiGainArea(i).Clone(),i);
237
238 return cam;
239}
240
241// --------------------------------------------------------------------------
242//
243// Gets the pointers to:
244// - MRawEvtData
245//
246Bool_t MHCalibrationPulseTimeCam::SetupHists(const MParList *pList)
247{
248
249 fBadPixels = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam");
250 if (!fBadPixels)
251 {
252 *fLog << warn << GetDescriptor() << "MBadPixelsCam not found... " << endl;
253 }
254
255 return kTRUE;
256}
257
258// --------------------------------------------------------------------------
259//
260// Gets or creates the pointers to:
261// - MExtractedSignalCam
262// - MCalibrationPulseTimeCam
263// - MBadPixelsCam
264//
265// Initializes the number of used FADC slices from MExtractedSignalCam
266// into MCalibrationPulseTimeCam and test for changes in that variable
267//
268// Calls:
269// - InitHiGainArrays()
270//
271// Sets:
272// - fSumhiarea to nareas
273// - fSumloarea to nareas
274// - fSumhisector to nsectors
275// - fSumlosector to nsectors
276//
277Bool_t MHCalibrationPulseTimeCam::ReInitHists(MParList *pList)
278{
279 fSignalCam = (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
280 if (!fSignalCam)
281 {
282 *fLog << err << "MExtractedSignalCam not found... abort." << endl;
283 return kFALSE;
284 }
285
286 if (!InitCams(pList,"PulseTime"))
287 return kFALSE;
288
289 const Int_t npixels = fGeom->GetNumPixels();
290 const Int_t nsectors = fGeom->GetNumSectors();
291 const Int_t nareas = fGeom->GetNumAreas();
292
293 InitHiGainArrays(npixels,nareas,nsectors);
294
295 return kTRUE;
296}
297
298void MHCalibrationPulseTimeCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
299{
300
301 const Int_t samples = fRunHeader->GetNumSamples();
302 SetBinning(samples, -0.5, samples-0.5);
303
304 if (fHiGainArray->GetSize()==0)
305 {
306 for (Int_t i=0; i<npixels; i++)
307 {
308 fHiGainArray->AddAt(new MHCalibrationPix(Form("%sHiGainPix%04d",fHistName.Data(),i),
309 Form("%s High Gain Pixel %4d",fHistTitle.Data(),i)),i);
310
311 MHCalibrationPix &pix = (*this)[i];
312 pix.SetBinning(fNbins, fFirst, fLast);
313
314 InitHists(pix, (*fBadPixels)[i], i);
315
316 if (fCam)
317 (*fCam)[i].SetPixId(i);
318 }
319 }
320
321 if (!IsAverageing())
322 return;
323
324 if (fAverageHiGainAreas->GetSize()==0)
325 {
326 for (Int_t j=0; j<nareas; j++)
327 {
328 fAverageHiGainAreas->AddAt(new MHCalibrationPix(Form("%sHiGainArea%d",fHistName.Data(),j),
329 Form("%s High Gain Area Idx %d",fHistTitle.Data(),j)),j);
330
331 MHCalibrationPix &pix = GetAverageHiGainArea(j);
332 pix.SetBinning(fNbins, fFirst, fLast);
333
334 InitHists(pix, fCam->GetAverageBadArea(j), j);
335 }
336 }
337
338 if (fAverageHiGainSectors->GetSize()==0)
339 {
340 for (Int_t j=0; j<nsectors; j++)
341 {
342 fAverageHiGainSectors->AddAt(new MHCalibrationPix(Form("%sHiGainSector%02d",fHistName.Data(),j),
343 Form("%s High Gain Sector %02d",fHistTitle.Data(),j)),j);
344 MHCalibrationPix &pix = GetAverageHiGainSector(j);
345 pix.SetBinning(fNbins, fFirst, fLast);
346
347 InitHists(pix, fCam->GetAverageBadSector(j), j);
348 }
349 }
350}
351
352// --------------------------------------------------------------------------
353//
354// Retrieves from MExtractedSignalCam:
355// - first used LoGain FADC slice
356//
357// Retrieves from MGeomCam:
358// - number of pixels
359// - number of pixel areas
360// - number of sectors
361//
362// For all TOrdCollection's (including the averaged ones), the following steps are performed:
363//
364// 1) Fill PulseTimes histograms (MHGausEvents::FillHistAndArray()) with:
365// - MExtractedSignalPix::GetExtractedSignalHiGain();
366// - MExtractedSignalPix::GetExtractedSignalLoGain();
367//
368Bool_t MHCalibrationPulseTimeCam::FillHists(const MParContainer *par, const Stat_t w)
369{
370 MPedestalSubtractedEvt *evt = (MPedestalSubtractedEvt*)par;
371 if (!evt)
372 {
373 *fLog << err << "No argument in MHCalibrationPulseTimeCam::Fill... abort." << endl;
374 return kFALSE;
375 }
376
377 const UInt_t nareas = fGeom->GetNumAreas();
378 const UInt_t nsectors = fGeom->GetNumSectors();
379
380 MArrayD sumarea(nareas);
381 MArrayD sumsector(nsectors);
382
383 fAverageAreaNum.Reset();
384 fAverageSectorNum.Reset();
385
386 const Int_t npix = evt->GetNumPixels();
387 for (int idx=0; idx<npix; idx++)
388 {
389 if (fBadPixels)
390 if ((*fBadPixels)[idx].IsUnsuitable())
391 continue;
392
393 // Check for saturation
394 if (evt->GetSaturation(idx, fSaturationLimit*fRunHeader->GetScale())>0)
395 continue;
396
397 // Get position of maximum
398 Float_t max;
399 const Int_t pos = evt->GetMax(idx, fSignalCam->GetFirstUsedSliceHiGain(),
400 fSignalCam->GetLastUsedSliceHiGain(), max);
401
402 // check if maximum is high enough
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 {
424 sumarea[j] /= fAverageAreaNum[j];
425
426 if (IsOscillations())
427 GetAverageHiGainArea(j).FillHistAndArray(sumarea[j]);
428 else
429 GetAverageHiGainArea(j).FillHist(sumarea[j]);
430
431 }
432 }
433
434 for (UInt_t j=0; j<nsectors; j++)
435 {
436 if (fAverageSectorNum[j] > 0)
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
447 return kTRUE;
448}
449
450// --------------------------------------------------------------------------
451//
452// For all TOrdCollection's (including the averaged ones), the following steps are performed:
453//
454// 1) Returns if the pixel is excluded.
455// 2) Tests saturation. In case yes, set the flag: MCalibrationPix::SetHiGainSaturation()
456// or the flag: MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturated )
457// 3) Store the absolute arrival times in the MCalibrationPulseTimePix's. If flag
458// MCalibrationPix::IsHiGainSaturation() is set, the Low-Gain arrival times are stored,
459// otherwise the Hi-Gain ones.
460// 4) Calls to MHCalibrationCam::FitHiGainArrays() and MCalibrationCam::FitLoGainArrays()
461// with the flags:
462// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted )
463// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted )
464// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating )
465// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating )
466//
467Bool_t MHCalibrationPulseTimeCam::FinalizeHists()
468{
469
470 *fLog << endl;
471
472 //
473 // Perform the fitting for the High Gain (done in MHCalibrationCam)
474 //
475 for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
476 {
477
478 MHCalibrationPix &hist = (*this)[i];
479 if (hist.IsExcluded())
480 continue;
481
482 CalcHists(hist, (*fCam)[i]);
483 }
484
485 if (!IsAverageing())
486 return kTRUE;
487
488 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
489 CalcHists(GetAverageHiGainArea(j), fCam->GetAverageArea(j));
490
491 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
492 CalcHists(GetAverageHiGainSector(j), fCam->GetAverageSector(j));
493
494 return kTRUE;
495}
496
497void MHCalibrationPulseTimeCam::CalcHists(MHCalibrationPix &hist, MCalibrationPix &pix) const
498{
499
500 if (hist.IsEmpty())
501 {
502 *fLog << warn << hist.GetName() << ": Histogram empty." << endl;
503 return;
504 }
505 if (hist.IsOnlyOverflow())
506 {
507 *fLog << warn << hist.GetName() << ": Histogram contains only overflows." << endl;
508 return;
509 }
510 if (hist.IsOnlyUnderflow())
511 {
512 *fLog << warn << hist.GetName() << ": Histogram contains only underflows." << endl;
513 return;
514 }
515
516 hist.BypassFit();
517
518 pix.SetHiGainMean ( hist.GetMean() );
519 pix.SetHiGainMeanVar ( hist.GetMeanErr() * hist.GetMeanErr() );
520 pix.SetHiGainRms ( hist.GetHistRms() );
521 pix.SetHiGainSigma ( hist.GetSigma() );
522 pix.SetHiGainSigmaVar ( hist.GetSigmaErr()* hist.GetSigmaErr() );
523
524 if (IsDebug())
525 {
526 *fLog << dbginf << GetDescriptor() << ": ID " << GetName()
527 << " "<<pix.GetPixId()
528 << " Mean: " << hist.GetMean ()
529 << " MeanErr: " << hist.GetMeanErr ()
530 << " MeanSigma: " << hist.GetSigma ()
531 << " MeanSigmaErr: " << hist.GetSigmaErr()
532 << " Prob: " << hist.GetProb ()
533 << endl;
534 }
535}
536
537
538// --------------------------------------------------------------------------
539//
540// Calls MHCalibrationPix::DrawClone() for pixel idx
541//
542void MHCalibrationPulseTimeCam::DrawPixelContent(Int_t idx) const
543{
544 (*this)[idx].DrawClone();
545}
546
547
548// -----------------------------------------------------------------------------
549//
550// Default draw:
551//
552// Displays the averaged areas, both High Gain and Low Gain
553//
554// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
555//
556void MHCalibrationPulseTimeCam::Draw(const Option_t *opt)
557{
558
559 const Int_t nareas = fAverageHiGainAreas->GetSize();
560 if (nareas == 0)
561 return;
562
563 TString option(opt);
564 option.ToLower();
565
566 TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
567 pad->SetBorderMode(0);
568 pad->Divide(1,nareas, 1e-10, 1e-10);
569
570 //
571 // Loop over inner and outer pixels
572 //
573 for (Int_t i=0; i<nareas;i++)
574 {
575 pad->cd(i+1);
576
577 MHCalibrationPix &hipix = GetAverageHiGainArea(i);
578 DrawDataCheckPixel(hipix,i ? fOuterRefTime : fInnerRefTime);
579 }
580}
581
582// -----------------------------------------------------------------------------
583//
584// Draw the average pixel for the datacheck:
585//
586// Displays the averaged areas, both High Gain and Low Gain
587//
588// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
589//
590void MHCalibrationPulseTimeCam::DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline)
591{
592 gPad->SetBorderMode(0);
593 gPad->SetTicks();
594
595 TH1F *hist = pix.GetHGausHist();
596
597 //
598 // set the labels bigger
599 //
600 TAxis *xaxe = hist->GetXaxis();
601 TAxis *yaxe = hist->GetYaxis();
602 xaxe->CenterTitle();
603 yaxe->CenterTitle();
604 xaxe->SetTitleSize(0.06);
605 yaxe->SetTitleSize(0.076);
606 xaxe->SetTitleOffset(0.6);
607 yaxe->SetTitleOffset(0.65);
608 xaxe->SetLabelSize(0.06);
609 yaxe->SetLabelSize(0.06);
610 xaxe->SetTitle(hist->GetXaxis()->GetTitle());
611 yaxe->SetTitle(hist->GetYaxis()->GetTitle());
612 xaxe->SetRange(hist->GetMaximumBin()-30, hist->GetMaximumBin()+30);
613
614 hist->Draw();
615
616 DisplayRefLines(hist, refline);
617}
618
619void MHCalibrationPulseTimeCam::DisplayRefLines(const TH1F *hist, const Float_t refline) const
620{
621 TLine *line = new TLine(refline, 0, refline, hist->GetMaximum());
622 line->SetLineColor(106);
623 line->SetLineStyle(2);
624 line->SetLineWidth(3);
625 line->SetBit(kCanDelete);
626 line->Draw();
627
628 TLegend *leg = new TLegend(0.8,0.35,0.99,0.65);
629 leg->AddEntry(line, "Reference", "l");
630 leg->SetBit(kCanDelete);
631 leg->Draw();
632}
633
634Int_t MHCalibrationPulseTimeCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
635{
636
637 Int_t rc = MHCalibrationCam::ReadEnv(env,prefix,print);
638 if (rc==kERROR)
639 return kERROR;
640
641 if (IsEnvDefined(env, prefix, "SaturationLimit", print))
642 {
643 SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", (Int_t)fSaturationLimit));
644 rc = kTRUE;
645 }
646
647 if (IsEnvDefined(env, prefix, "LowerSignalLimit", print))
648 {
649 SetLowerSignalLimit(GetEnvValue(env, prefix, "LowerSignalLimit", (Int_t)fLowerSignalLimit));
650 rc = kTRUE;
651 }
652
653 if (IsEnvDefined(env, prefix, "NumPixelsRequired", print))
654 {
655 SetNumPixelsRequired(GetEnvValue(env,prefix,"NumPixelsRequired",fNumPixelsRequired));
656 rc = kTRUE;
657 }
658
659 if (IsEnvDefined(env, prefix, "ReferenceFile", print))
660 {
661 SetReferenceFile(GetEnvValue(env,prefix,"ReferenceFile",fReferenceFile.Data()));
662 rc = kTRUE;
663 }
664
665 TEnv refenv(fReferenceFile);
666
667 fInnerRefTime = refenv.GetValue("InnerRefTime",fInnerRefTime);
668 fOuterRefTime = refenv.GetValue("OuterRefTime",fOuterRefTime);
669
670 return rc;
671}
Note: See TracBrowser for help on using the repository browser.