source: trunk/MagicSoft/Mars/mhcalib/MHCalibrationPulseTimeCam.cc@ 8347

Last change on this file since 8347 was 8347, checked in by tbretz, 18 years ago
*** empty log message ***
File size: 21.9 KB
Line 
1/* ======================================================================== *\
2! $Name: not supported by cvs2svn $:$Id: MHCalibrationPulseTimeCam.cc,v 1.30 2007-03-01 23:04:55 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-2006
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#include "MHCalibrationPulseTimeCam.h"
105
106#include <TEnv.h>
107#include <TGraph.h>
108#include <TLegend.h>
109#include <TCanvas.h>
110#include <TOrdCollection.h>
111
112#include "MLog.h"
113#include "MLogManip.h"
114
115#include "MParList.h"
116
117#include "MArrayD.h"
118#include "MRawRunHeader.h"
119#include "MExtractedSignalCam.h"
120#include "MPedestalSubtractedEvt.h"
121
122#include "MCalibrationPix.h"
123#include "MHCalibrationPix.h"
124#include "MCalibrationIntensityCam.h"
125#include "MBadPixelsIntensityCam.h"
126
127#include "MGeomCam.h"
128#include "MGeomPix.h"
129
130#include "MBadPixelsCam.h"
131
132ClassImp(MHCalibrationPulseTimeCam);
133
134using namespace std;
135
136const Byte_t MHCalibrationPulseTimeCam::fgSaturationLimit = 254;
137const Byte_t MHCalibrationPulseTimeCam::fgLowerSignalLimit = 85;
138const Int_t MHCalibrationPulseTimeCam::fgNumPixelsRequired = 2;
139const Int_t MHCalibrationPulseTimeCam::fgHiGainNbins = 20;
140const Axis_t MHCalibrationPulseTimeCam::fgHiGainFirst = -0.5;
141const Axis_t MHCalibrationPulseTimeCam::fgHiGainLast = 19.5;
142const Float_t MHCalibrationPulseTimeCam::fgProbLimit = 0.001;
143const TString MHCalibrationPulseTimeCam::gsHistName = "PulseTime";
144const TString MHCalibrationPulseTimeCam::gsHistTitle = "Extracted Times";
145const TString MHCalibrationPulseTimeCam::gsHistXTitle = "Time [FADC slices]";
146const TString MHCalibrationPulseTimeCam::gsHistYTitle = "Nr. events";
147const TString MHCalibrationPulseTimeCam::fgReferenceFile = "mjobs/signalref.rc";
148
149// --------------------------------------------------------------------------
150//
151// Default Constructor.
152//
153// Sets:
154// - all pointers to NULL
155//
156// - fNbins to fgHiGainNbins
157// - fFirst to fgHiGainFirst
158// - fLast to fgHiGainLast
159//
160// - fHistName to gsHistName
161// - fHistTitle to gsHistTitle
162// - fHistXTitle to gsHistXTitle
163// - fHistYTitle to gsHistYTitle
164//
165// - fSaturationLimit to fgSaturationLimit
166// - fLowerSignalLimit to fgLowerSignalLimit
167// - fNumPixelsRequired to fgNumPixelsRequired
168//
169MHCalibrationPulseTimeCam::MHCalibrationPulseTimeCam(const char *name, const char *title)
170 : fBadPixels(NULL)
171{
172
173 fName = name ? name : "MHCalibrationPulseTimeCam";
174 fTitle = title ? title : "Class to fill the extracted pulse times for cosmics ";
175
176 SetBinning(fgHiGainNbins, fgHiGainFirst, fgHiGainLast);
177
178 SetProbLimit(fgProbLimit);
179
180 SetHistName (gsHistName .Data());
181 SetHistTitle (gsHistTitle .Data());
182 SetHistXTitle(gsHistXTitle.Data());
183 SetHistYTitle(gsHistYTitle.Data());
184
185 SetReferenceFile();
186 SetLoGain(kFALSE);
187 SetOscillations(kFALSE);
188
189 SetSaturationLimit();
190 SetLowerSignalLimit();
191 SetNumPixelsRequired();
192
193 fInnerRefTime = 5.;
194 fOuterRefTime = 5.;
195}
196// --------------------------------------------------------------------------
197//
198// Creates new MHCalibrationPulseTimeCam only with the averaged areas:
199// the rest has to be retrieved directly, e.g. via:
200// MHCalibrationPulseTimeCam *cam = MParList::FindObject("MHCalibrationPulseTimeCam");
201// - cam->GetAverageSector(5).DrawClone();
202// - (*cam)[100].DrawClone()
203//
204TObject *MHCalibrationPulseTimeCam::Clone(const char *) const
205{
206
207 MHCalibrationPulseTimeCam *cam = new MHCalibrationPulseTimeCam();
208
209 //
210 // Copy the data members
211 //
212 cam->fColor = fColor;
213 cam->fRunNumbers = fRunNumbers;
214 cam->fPulserFrequency = fPulserFrequency;
215 cam->fFlags = fFlags;
216 cam->fNbins = fNbins;
217 cam->fFirst = fFirst;
218 cam->fLast = fLast;
219 cam->fReferenceFile = fReferenceFile;
220
221 if (!IsAverageing())
222 return cam;
223
224 const Int_t navhi = fAverageHiGainAreas->GetSize();
225
226 for (int i=0; i<navhi; i++)
227 cam->fAverageHiGainAreas->AddAt(GetAverageHiGainArea(i).Clone(),i);
228
229 return cam;
230}
231
232// --------------------------------------------------------------------------
233//
234// Gets the pointers to:
235// - MRawEvtData
236//
237Bool_t MHCalibrationPulseTimeCam::SetupHists(const MParList *pList)
238{
239
240 fBadPixels = (MBadPixelsCam*)pList->FindObject("MBadPixelsCam");
241 if (!fBadPixels)
242 {
243 *fLog << warn << GetDescriptor() << "MBadPixelsCam not found... " << endl;
244 }
245
246 return kTRUE;
247}
248
249// --------------------------------------------------------------------------
250//
251// Gets or creates the pointers to:
252// - MExtractedSignalCam
253// - MCalibrationPulseTimeCam or MCalibrationIntensityPulseTimeCam
254// - MBadPixelsCam
255//
256// Initializes the number of used FADC slices from MExtractedSignalCam
257// into MCalibrationPulseTimeCam and test for changes in that variable
258//
259// Calls:
260// - InitHiGainArrays()
261//
262// Sets:
263// - fSumhiarea to nareas
264// - fSumloarea to nareas
265// - fSumhisector to nsectors
266// - fSumlosector to nsectors
267//
268Bool_t MHCalibrationPulseTimeCam::ReInitHists(MParList *pList)
269{
270
271 MExtractedSignalCam *signal =
272 (MExtractedSignalCam*)pList->FindObject(AddSerialNumber("MExtractedSignalCam"));
273 if (!signal)
274 {
275 *fLog << err << "MExtractedSignalCam not found... abort." << endl;
276 return kFALSE;
277 }
278
279 if (!InitCams(pList,"PulseTime"))
280 return kFALSE;
281
282 const Int_t npixels = fGeom->GetNumPixels();
283 const Int_t nsectors = fGeom->GetNumSectors();
284 const Int_t nareas = fGeom->GetNumAreas();
285
286 InitHiGainArrays(npixels,nareas,nsectors);
287
288 return kTRUE;
289}
290
291void MHCalibrationPulseTimeCam::InitHiGainArrays(const Int_t npixels, const Int_t nareas, const Int_t nsectors)
292{
293
294 const Int_t samples = fRunHeader->GetNumSamples();
295 SetBinning(samples, -0.5, samples-0.5);
296
297 if (fHiGainArray->GetSize()==0)
298 {
299 for (Int_t i=0; i<npixels; i++)
300 {
301 fHiGainArray->AddAt(new MHCalibrationPix(Form("%sHiGainPix%04d",fHistName.Data(),i),
302 Form("%s High Gain Pixel %4d",fHistTitle.Data(),i)),i);
303
304 MHCalibrationPix &pix = (*this)[i];
305 pix.SetBinning(fNbins, fFirst, fLast);
306
307 MBadPixelsPix &bad = fIntensBad ? (*fIntensBad)[i] : (*fBadPixels)[i];
308 InitHists(pix,bad,i);
309
310 if (fCam)
311 (*fCam)[i].SetPixId(i);
312 }
313 }
314
315 if (!IsAverageing())
316 return;
317
318 if (fAverageHiGainAreas->GetSize()==0)
319 {
320 for (Int_t j=0; j<nareas; j++)
321 {
322 fAverageHiGainAreas->AddAt(new MHCalibrationPix(Form("%sHiGainArea%d",fHistName.Data(),j),
323 Form("%s High Gain Area Idx %d",fHistTitle.Data(),j)),j);
324
325 MHCalibrationPix &pix = GetAverageHiGainArea(j);
326 pix.SetBinning(fNbins, fFirst, fLast);
327
328 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadArea(j) : fCam->GetAverageBadArea(j),j);
329 }
330 }
331
332 if (fAverageHiGainSectors->GetSize()==0)
333 {
334 for (Int_t j=0; j<nsectors; j++)
335 {
336 fAverageHiGainSectors->AddAt(new MHCalibrationPix(Form("%sHiGainSector%02d",fHistName.Data(),j),
337 Form("%s High Gain Sector %02d",fHistTitle.Data(),j)),j);
338 MHCalibrationPix &pix = GetAverageHiGainSector(j);
339 pix.SetBinning(fNbins, fFirst, fLast);
340
341 InitHists(pix,fIntensCam ? fIntensCam->GetAverageBadSector(j) : fCam->GetAverageBadSector(j),j);
342 }
343 }
344}
345
346// --------------------------------------------------------------------------
347//
348// Retrieves from MExtractedSignalCam:
349// - first used LoGain FADC slice
350//
351// Retrieves from MGeomCam:
352// - number of pixels
353// - number of pixel areas
354// - number of sectors
355//
356// For all TOrdCollection's (including the averaged ones), the following steps are performed:
357//
358// 1) Fill PulseTimes histograms (MHGausEvents::FillHistAndArray()) with:
359// - MExtractedSignalPix::GetExtractedSignalHiGain();
360// - MExtractedSignalPix::GetExtractedSignalLoGain();
361//
362Bool_t MHCalibrationPulseTimeCam::FillHists(const MParContainer *par, const Stat_t w)
363{
364 MPedestalSubtractedEvt *evt = (MPedestalSubtractedEvt*)par;
365 if (!evt)
366 {
367 *fLog << err << "No argument in MHCalibrationPulseTimeCam::Fill... abort." << endl;
368 return kFALSE;
369 }
370
371 const UInt_t nareas = fGeom->GetNumAreas();
372 const UInt_t nsectors = fGeom->GetNumSectors();
373
374 MArrayD sumarea(nareas);
375 MArrayD sumsector(nsectors);
376
377 fAverageAreaNum.Reset();
378 fAverageSectorNum.Reset();
379
380 const Int_t npix = evt->GetNumPixels();
381 for (int idx=0; idx<npix; idx++)
382 {
383 if (fBadPixels)
384 if ((*fBadPixels)[idx].IsUnsuitable())
385 continue;
386
387 Float_t *beg = evt->GetSamples(idx);
388 Float_t *end = beg + evt->GetNumSamples();;
389 Float_t *max = beg;
390
391 for (Float_t *ptr=beg+1; ptr<end; ptr++)
392 if (*ptr>*max)
393 max = ptr;
394
395 if (*max<fLowerSignalLimit || *max>fSaturationLimit)
396 continue;
397
398 const Int_t maxpos = max-beg-1;
399
400 (*this)[idx].FillHist(maxpos);
401
402 const Int_t aidx = (*fGeom)[idx].GetAidx();
403 const Int_t sector = (*fGeom)[idx].GetSector();
404
405 sumarea[aidx] += maxpos;
406 sumsector[sector] += maxpos;
407
408 fAverageAreaNum[aidx]++;
409 fAverageSectorNum[sector]++;
410 }
411
412 for (UInt_t j=0; j<nareas; j++)
413 {
414 const Int_t npix = fAverageAreaNum[j];
415
416 if (npix > fNumPixelsRequired)
417 {
418 if (IsOscillations())
419 GetAverageHiGainArea(j).FillHistAndArray(sumarea[j]/npix);
420 else
421 GetAverageHiGainArea(j).FillHist(sumarea[j]/npix);
422
423 }
424 }
425
426 for (UInt_t j=0; j<nsectors; j++)
427 {
428 const Int_t npix = fAverageSectorNum[j];
429
430 if (npix > 0)
431 {
432 if (IsOscillations())
433 GetAverageHiGainSector(j).FillHistAndArray(sumsector[j]/npix);
434 else
435 GetAverageHiGainSector(j).FillHist(sumsector[j]/npix);
436 }
437 }
438
439 return kTRUE;
440}
441
442// --------------------------------------------------------------------------
443//
444// For all TOrdCollection's (including the averaged ones), the following steps are performed:
445//
446// 1) Returns if the pixel is excluded.
447// 2) Tests saturation. In case yes, set the flag: MCalibrationPix::SetHiGainSaturation()
448// or the flag: MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturated )
449// 3) Store the absolute arrival times in the MCalibrationPulseTimePix's. If flag
450// MCalibrationPix::IsHiGainSaturation() is set, the Low-Gain arrival times are stored,
451// otherwise the Hi-Gain ones.
452// 4) Calls to MHCalibrationCam::FitHiGainArrays() and MCalibrationCam::FitLoGainArrays()
453// with the flags:
454// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted )
455// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted )
456// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating )
457// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating )
458//
459Bool_t MHCalibrationPulseTimeCam::FinalizeHists()
460{
461
462 *fLog << endl;
463
464 MCalibrationCam &calcam = *(fIntensCam ? fIntensCam->GetCam() : fCam);
465 //
466 // Perform the fitting for the High Gain (done in MHCalibrationCam)
467 //
468 for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
469 {
470
471 MHCalibrationPix &hist = (*this)[i];
472
473 if (hist.IsExcluded())
474 continue;
475
476 MCalibrationPix &pix = calcam[i];
477 CalcHists(hist,pix);
478 }
479
480 if (!IsAverageing())
481 return kTRUE;
482
483 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
484 {
485
486 MHCalibrationPix &hist = GetAverageHiGainArea(j);
487 MCalibrationPix &pix = calcam.GetAverageArea(j);
488 CalcHists(hist,pix);
489 }
490
491 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
492 {
493 MHCalibrationPix &hist = GetAverageHiGainSector(j);
494 MCalibrationPix &pix = calcam.GetAverageSector(j);
495 CalcHists(hist,pix);
496 }
497
498 return kTRUE;
499}
500
501void MHCalibrationPulseTimeCam::CalcHists(MHCalibrationPix &hist, MCalibrationPix &pix) const
502{
503
504 if (hist.IsEmpty())
505 {
506 *fLog << warn << hist.GetName() << ": Histogram empty." << endl;
507 return;
508 }
509 if (hist.IsOnlyOverflow())
510 {
511 *fLog << warn << hist.GetName() << ": Histogram contains only overflows." << endl;
512 return;
513 }
514 if (hist.IsOnlyUnderflow())
515 {
516 *fLog << warn << hist.GetName() << ": Histogram contains only underflows." << endl;
517 return;
518 }
519
520 hist.BypassFit();
521
522 pix.SetHiGainMean ( hist.GetMean() );
523 pix.SetHiGainMeanVar ( hist.GetMeanErr() * hist.GetMeanErr() );
524 pix.SetHiGainRms ( hist.GetHistRms() );
525 pix.SetHiGainSigma ( hist.GetSigma() );
526 pix.SetHiGainSigmaVar ( hist.GetSigmaErr()* hist.GetSigmaErr() );
527
528 if (IsDebug())
529 {
530 *fLog << dbginf << GetDescriptor() << ": ID " << GetName()
531 << " "<<pix.GetPixId()
532 << " Mean: " << hist.GetMean ()
533 << " MeanErr: " << hist.GetMeanErr ()
534 << " MeanSigma: " << hist.GetSigma ()
535 << " MeanSigmaErr: " << hist.GetSigmaErr()
536 << " Prob: " << hist.GetProb ()
537 << endl;
538 }
539 return;
540}
541
542
543// --------------------------------------------------------------------------
544//
545// Calls MHCalibrationPix::DrawClone() for pixel idx
546//
547void MHCalibrationPulseTimeCam::DrawPixelContent(Int_t idx) const
548{
549 (*this)[idx].DrawClone();
550}
551
552
553// -----------------------------------------------------------------------------
554//
555// Default draw:
556//
557// Displays the averaged areas, both High Gain and Low Gain
558//
559// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
560//
561void MHCalibrationPulseTimeCam::Draw(const Option_t *opt)
562{
563
564 const Int_t nareas = fAverageHiGainAreas->GetSize();
565 if (nareas == 0)
566 return;
567
568 TString option(opt);
569 option.ToLower();
570
571 TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
572 pad->SetBorderMode(0);
573 pad->Divide(1,nareas);
574
575 //
576 // Loop over inner and outer pixels
577 //
578 for (Int_t i=0; i<nareas;i++)
579 {
580
581 pad->cd(i+1);
582
583 MHCalibrationPix &hipix = GetAverageHiGainArea(i);
584 DrawDataCheckPixel(hipix,i ? fOuterRefTime : fInnerRefTime);
585 }
586}
587
588// -----------------------------------------------------------------------------
589//
590// Draw the average pixel for the datacheck:
591//
592// Displays the averaged areas, both High Gain and Low Gain
593//
594// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
595//
596void MHCalibrationPulseTimeCam::DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline)
597{
598
599 gPad->SetTicks();
600
601 TH1F *hist = pix.GetHGausHist();
602
603 TH1F *null = new TH1F("Null",hist->GetTitle(),100,
604 pix.GetFirst() > 0. ? pix.GetFirst() : 0.,
605 pix.GetLast() > pix.GetFirst()
606 ? pix.GetLast() : pix.GetFirst()*2.);
607
608 null->SetMaximum(1.1*hist->GetMaximum());
609 null->SetDirectory(NULL);
610 null->SetBit(kCanDelete);
611 null->SetStats(kFALSE);
612 //
613 // set the labels bigger
614 //
615 TAxis *xaxe = null->GetXaxis();
616 TAxis *yaxe = null->GetYaxis();
617 xaxe->CenterTitle();
618 yaxe->CenterTitle();
619 xaxe->SetTitleSize(0.06);
620 yaxe->SetTitleSize(0.076);
621 xaxe->SetTitleOffset(0.6);
622 yaxe->SetTitleOffset(0.65);
623 xaxe->SetLabelSize(0.06);
624 yaxe->SetLabelSize(0.06);
625 xaxe->SetTitle(hist->GetXaxis()->GetTitle());
626 yaxe->SetTitle(hist->GetYaxis()->GetTitle());
627
628 null->Draw();
629 hist->Draw("same");
630
631 DisplayRefLines(null,refline);
632
633 return;
634
635}
636
637void MHCalibrationPulseTimeCam::DisplayRefLines(const TH1F *hist, const Float_t refline) const
638{
639
640 TGraph *gr = new TGraph(2);
641 gr->SetPoint(0,refline,0.);
642 gr->SetPoint(1,refline,hist->GetMaximum());
643 gr->SetBit(kCanDelete);
644 gr->SetLineColor(106);
645 gr->SetLineStyle(2);
646 gr->SetLineWidth(3);
647 gr->Draw("L");
648
649 TLegend *leg = new TLegend(0.8,0.35,0.99,0.65);
650 leg->SetBit(kCanDelete);
651 leg->AddEntry(gr,"Reference","l");
652
653 leg->Draw();
654}
655
656Int_t MHCalibrationPulseTimeCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
657{
658
659 Int_t rc = MHCalibrationCam::ReadEnv(env,prefix,print);
660 if (rc==kERROR)
661 return kERROR;
662
663 if (IsEnvDefined(env, prefix, "SaturationLimit", print))
664 {
665 SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", fSaturationLimit));
666 rc = kTRUE;
667 }
668
669 if (IsEnvDefined(env, prefix, "LowerSignalLimit", print))
670 {
671 SetLowerSignalLimit(GetEnvValue(env,prefix,"LowerSignalLimit",fLowerSignalLimit));
672 rc = kTRUE;
673 }
674
675 if (IsEnvDefined(env, prefix, "NumPixelsRequired", print))
676 {
677 SetNumPixelsRequired(GetEnvValue(env,prefix,"NumPixelsRequired",fNumPixelsRequired));
678 rc = kTRUE;
679 }
680
681 if (IsEnvDefined(env, prefix, "ReferenceFile", print))
682 {
683 SetReferenceFile(GetEnvValue(env,prefix,"ReferenceFile",fReferenceFile.Data()));
684 rc = kTRUE;
685 }
686
687 TEnv refenv(fReferenceFile);
688
689 fInnerRefTime = refenv.GetValue("InnerRefTime",fInnerRefTime);
690 fOuterRefTime = refenv.GetValue("OuterRefTime",fOuterRefTime);
691
692 return rc;
693}
Note: See TracBrowser for help on using the repository browser.