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

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