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

Last change on this file since 6777 was 6774, checked in by gaug, 20 years ago
*** empty log message ***
File size: 22.0 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 // *fLog << (Int_t)max << " " << (Int_t)maxpos << endl;
444
445 if (max < fLowerSignalLimit)
446 continue;
447
448 const Float_t time = (Float_t)maxpos;
449
450 (*this)[i].FillHist(time);
451
452 const Int_t aidx = (*fGeom)[i].GetAidx();
453 const Int_t sector = (*fGeom)[i].GetSector();
454
455 fSumhiarea[aidx] += time;
456 fSumhisector[sector] += time;
457
458 fAverageAreaNum[aidx]++;
459 fAverageSectorNum[sector]++;
460 }
461
462 for (UInt_t j=0; j<nareas; j++)
463 {
464
465 const Int_t npix = fAverageAreaNum[j];
466
467 if (npix > fNumPixelsRequired)
468 GetAverageHiGainArea(j).FillHist(fSumhiarea[j]/npix);
469 }
470
471 for (UInt_t j=0; j<nsectors; j++)
472 {
473
474 const Int_t npix = fAverageSectorNum[j];
475
476 if (npix > 0)
477 GetAverageHiGainSector(j).FillHist(fSumhisector [j]/npix);
478 }
479
480 return kTRUE;
481}
482
483// --------------------------------------------------------------------------
484//
485// For all TOrdCollection's (including the averaged ones), the following steps are performed:
486//
487// 1) Returns if the pixel is excluded.
488// 2) Tests saturation. In case yes, set the flag: MCalibrationPix::SetHiGainSaturation()
489// or the flag: MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainSaturated )
490// 3) Store the absolute arrival times in the MCalibrationPulseTimePix's. If flag
491// MCalibrationPix::IsHiGainSaturation() is set, the Low-Gain arrival times are stored,
492// otherwise the Hi-Gain ones.
493// 4) Calls to MHCalibrationCam::FitHiGainArrays() and MCalibrationCam::FitLoGainArrays()
494// with the flags:
495// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainNotFitted )
496// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainNotFitted )
497// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kHiGainOscillating )
498// - MBadPixelsPix::SetUncalibrated( MBadPixelsPix::kLoGainOscillating )
499//
500Bool_t MHCalibrationPulseTimeCam::FinalizeHists()
501{
502
503 *fLog << endl;
504
505 MCalibrationCam *calcam = fIntensCam ? fIntensCam->GetCam() : fCam;
506 //
507 // Perform the fitting for the High Gain (done in MHCalibrationCam)
508 //
509 for (Int_t i=0; i<fHiGainArray->GetSize(); i++)
510 {
511
512 MHCalibrationPix &hist = (*this)[i];
513
514 if (hist.IsExcluded())
515 continue;
516
517 MCalibrationPix &pix = (*calcam)[i];
518 CalcHists(hist,pix);
519 }
520
521 if (!IsAverageing())
522 return kTRUE;
523
524 for (Int_t j=0; j<fAverageHiGainAreas->GetSize(); j++)
525 {
526
527 MHCalibrationPix &hist = GetAverageHiGainArea(j);
528 MCalibrationPix &pix = calcam->GetAverageArea(j);
529 CalcHists(hist,pix);
530 }
531
532 for (Int_t j=0; j<fAverageHiGainSectors->GetSize(); j++)
533 {
534 MHCalibrationPix &hist = GetAverageHiGainSector(j);
535 MCalibrationPix &pix = calcam->GetAverageSector(j);
536 CalcHists(hist,pix);
537 }
538
539 return kTRUE;
540}
541
542void MHCalibrationPulseTimeCam::CalcHists(MHCalibrationPix &hist, MCalibrationPix &pix)
543{
544
545
546 if (hist.IsEmpty() || hist.IsOnlyOverflow() || hist.IsOnlyUnderflow())
547 {
548 *fLog << warn << GetDescriptor()
549 << ": Only overflow or underflow in hi-gain pixel: " << pix.GetPixId() << endl;
550 return;
551 }
552
553 hist.BypassFit();
554
555 pix.SetHiGainMean ( hist.GetMean() );
556 pix.SetHiGainMeanVar ( hist.GetMeanErr() * hist.GetMeanErr() );
557 pix.SetHiGainRms ( hist.GetHistRms() );
558 pix.SetHiGainSigma ( hist.GetSigma() );
559 pix.SetHiGainSigmaVar ( hist.GetSigmaErr()* hist.GetSigmaErr() );
560
561 if (IsDebug())
562 {
563 *fLog << dbginf << GetDescriptor() << ": ID " << GetName()
564 << " Mean: " << hist.GetMean ()
565 << " MeanErr: " << hist.GetMeanErr ()
566 << " MeanSigma: " << hist.GetSigma ()
567 << " MeanSigmaErr: " << hist.GetSigmaErr()
568 << " Prob: " << hist.GetProb ()
569 << endl;
570 }
571 return;
572}
573
574
575// --------------------------------------------------------------------------
576//
577// Calls MHCalibrationPix::DrawClone() for pixel idx
578//
579void MHCalibrationPulseTimeCam::DrawPixelContent(Int_t idx) const
580{
581 (*this)[idx].DrawClone();
582}
583
584
585// -----------------------------------------------------------------------------
586//
587// Default draw:
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::Draw(const Option_t *opt)
594{
595
596 const Int_t nareas = fAverageHiGainAreas->GetSize();
597 if (nareas == 0)
598 return;
599
600 TString option(opt);
601 option.ToLower();
602
603 TVirtualPad *pad = gPad ? gPad : MH::MakeDefCanvas(this);
604 pad->SetBorderMode(0);
605 pad->Divide(1,nareas);
606
607 //
608 // Loop over inner and outer pixels
609 //
610 for (Int_t i=0; i<nareas;i++)
611 {
612
613 pad->cd(i+1);
614
615 MHCalibrationPix &hipix = GetAverageHiGainArea(i);
616 DrawDataCheckPixel(hipix,i ? fOuterRefTime : fInnerRefTime);
617 }
618}
619
620// -----------------------------------------------------------------------------
621//
622// Draw the average pixel for the datacheck:
623//
624// Displays the averaged areas, both High Gain and Low Gain
625//
626// Calls the Draw of the fAverageHiGainAreas and fAverageLoGainAreas objects with options
627//
628void MHCalibrationPulseTimeCam::DrawDataCheckPixel(MHCalibrationPix &pix, const Float_t refline)
629{
630
631 gPad->SetTicks();
632
633 TH1F *hist = pix.GetHGausHist();
634
635 TH1F *null = new TH1F("Null",hist->GetTitle(),100,
636 pix.GetFirst() > 0. ? pix.GetFirst() : 0.,
637 pix.GetLast() > pix.GetFirst()
638 ? pix.GetLast() : pix.GetFirst()*2.);
639
640 null->SetMaximum(1.1*hist->GetMaximum());
641 null->SetDirectory(NULL);
642 null->SetBit(kCanDelete);
643 null->SetStats(kFALSE);
644 //
645 // set the labels bigger
646 //
647 TAxis *xaxe = null->GetXaxis();
648 TAxis *yaxe = null->GetYaxis();
649 xaxe->CenterTitle();
650 yaxe->CenterTitle();
651 xaxe->SetTitleSize(0.06);
652 yaxe->SetTitleSize(0.076);
653 xaxe->SetTitleOffset(0.6);
654 yaxe->SetTitleOffset(0.65);
655 xaxe->SetLabelSize(0.06);
656 yaxe->SetLabelSize(0.06);
657 xaxe->SetTitle(hist->GetXaxis()->GetTitle());
658 yaxe->SetTitle(hist->GetYaxis()->GetTitle());
659
660 null->Draw();
661 hist->Draw("same");
662
663 DisplayRefLines(null,refline);
664
665 return;
666
667}
668
669void MHCalibrationPulseTimeCam::DisplayRefLines(const TH1F *hist, const Float_t refline) const
670{
671
672 TGraph *gr = new TGraph(2);
673 gr->SetPoint(0,refline,0.);
674 gr->SetPoint(1,refline,hist->GetMaximum());
675 gr->SetBit(kCanDelete);
676 gr->SetLineColor(106);
677 gr->SetLineStyle(2);
678 gr->SetLineWidth(3);
679 gr->Draw("L");
680
681 TLegend *leg = new TLegend(0.8,0.35,0.99,0.65);
682 leg->SetBit(kCanDelete);
683 leg->AddEntry(gr,"Reference","l");
684
685 leg->Draw();
686}
687
688Int_t MHCalibrationPulseTimeCam::ReadEnv(const TEnv &env, TString prefix, Bool_t print)
689{
690
691 Bool_t rc = kFALSE;
692
693 if (MHCalibrationCam::ReadEnv(env,prefix,print))
694 rc = kTRUE;
695
696 if (IsEnvDefined(env, prefix, "SaturationLimit", print))
697 {
698 SetSaturationLimit(GetEnvValue(env, prefix, "SaturationLimit", fSaturationLimit));
699 rc = kTRUE;
700 }
701
702 if (IsEnvDefined(env, prefix, "LowerSignalLimit", print))
703 {
704 SetLowerSignalLimit(GetEnvValue(env,prefix,"LowerSignalLimit",fLowerSignalLimit));
705 rc = kTRUE;
706 }
707
708 if (IsEnvDefined(env, prefix, "NumPixelsRequired", print))
709 {
710 SetNumPixelsRequired(GetEnvValue(env,prefix,"NumPixelsRequired",fNumPixelsRequired));
711 rc = kTRUE;
712 }
713
714 if (IsEnvDefined(env, prefix, "ReferenceFile", print))
715 {
716 SetReferenceFile(GetEnvValue(env,prefix,"ReferenceFile",fReferenceFile.Data()));
717 rc = kTRUE;
718 }
719
720 TEnv refenv(fReferenceFile);
721
722 fInnerRefTime = refenv.GetValue("InnerRefTime",fInnerRefTime);
723 fOuterRefTime = refenv.GetValue("OuterRefTime",fOuterRefTime);
724
725 return rc;
726}
Note: See TracBrowser for help on using the repository browser.