PulseEstimate Class Reference
[Odbcheck]

Estimates corrections for certian ODB values. More...

#include <PulseEstimate.hh>

List of all members.

Public Member Functions

 PulseEstimate ()
 Default constructor.
void Estimate (TH2 *pulses, TH1 *timing)
Getters



int GetPedestal () const
int GetPolarity () const
int GetOffset () const

Private Attributes

int fPedestal
int fPolarity
int fOffset

Detailed Description

Estimates corrections for certian ODB values.

PulseEstimate takes data quality histograms from an alcapana production and predicts what certain ODB values are. These are the pedestal, polarity, and timing offset.

Definition at line 17 of file PulseEstimate.hh.


Constructor & Destructor Documentation

PulseEstimate::PulseEstimate (  ) 

Default constructor.

Definition at line 8 of file PulseEstimate.cc.

00008 : fPedestal(0), fPolarity(1), fOffset(0) {}


Member Function Documentation

void PulseEstimate::Estimate ( TH2 *  pulses,
TH1 *  timing 
)

Estimate ODB values based on data quality histograms.

Parameters:
[in] pulses The shapes (persistance) histogram.
[in] timing The muSc timeing difference histogram.

Definition at line 10 of file PulseEstimate.cc.

References fOffset, fPedestal, fPolarity, and nPreSamples.

Referenced by ODBCheck::Check().

00010                                                      {
00011   /* Get pedestal and polarity */
00012   if (pulses && pulses->GetEntries()) {
00013     int nPreSamples = 10; // Number of presamples to project
00014     // Project out first few samples to get pedestal
00015     // Project everything to get polarity
00016     TH1* pulses_proj_ped = pulses->ProjectionY("_ped", 1, nPreSamples);
00017     TH1* pulses_proj_pol = pulses->ProjectionY("_pol");
00018 
00019     /* Get pedestal */
00020     // First reduce range slightly; specifically Ge preamp reset caused flatlining
00021     // We want to miss underflow/overflow due to this
00022     static const int nBinsIgnore = 5; // This number is arbitrary. Logically it should be 1, maybe 2, but 5 can't hurt
00023     int nbins = pulses_proj_ped->GetXaxis()->GetNbins();
00024     pulses_proj_ped->GetXaxis()->SetRange(nBinsIgnore, nbins - nBinsIgnore);
00025     // Get the pedestal
00026     fPedestal = (int)pulses_proj_ped->GetBinCenter(pulses_proj_ped->GetMaximumBin());
00027     // Reset bin range
00028     pulses_proj_ped->GetXaxis()->SetRange();
00029 
00030     /* Get polarity */
00031     int min = 0, max = 0;
00032     bool min_found = false, max_found = false;
00033     // Again, ignore 5 bin on each side to get rid of flatlines
00034     for (int i = nBinsIgnore; i <= nbins - nBinsIgnore; ++i) {
00035       if (!min_found && pulses_proj_pol->GetBinContent(i) > 0.) {
00036         min_found = true;
00037         min = i;
00038       }
00039       if (!max_found && pulses_proj_pol->GetBinContent(nbins - i) > 0.) {
00040         max_found = true;
00041         max = nbins - i;
00042       }
00043       if (min_found && max_found)
00044         break;
00045     }
00046     if (max - fPedestal > fPedestal - min)
00047       fPolarity = 1;
00048     else
00049       fPolarity = -1;
00050   } else {
00051     // If no pulses, default to positive polarity and zero pedestal
00052     std::cout << "PulseEstimate ERROR: Cannot estimate nonexistent or empty shapes histogram!" << std::endl;
00053     fPedestal = 0;
00054     fPolarity = 1;
00055   }
00056 
00057   /* Get Timing */
00058   // Rebin until we have plenty of samples at the peak
00059   if (timing && timing->GetEntries()) {
00060     int nRebins = 0;
00061     static int min_time_correlation_height = 10;
00062     while (timing->GetBinContent(timing->GetMaximumBin()) < min_time_correlation_height && nRebins++ < 3)
00063       timing->Rebin();
00064     fOffset = timing->GetBinCenter(timing->GetMaximumBin());
00065   } else {
00066     // If no timing, default to zero offset
00067     std::cout << "PulseEstimate ERROR: Cannot estimate nonexistent or empty timing histogram!" << std::endl;
00068     fOffset = 0;
00069   }
00070 }

int PulseEstimate::GetOffset (  )  const
Returns:
Estimated timing offset (TimeShift)

Definition at line 80 of file PulseEstimate.cc.

References fOffset.

Referenced by ODBCheck::Check().

00080                                    {
00081   return fOffset;
00082 }

int PulseEstimate::GetPedestal (  )  const
Returns:
Estimated pedestal

Definition at line 72 of file PulseEstimate.cc.

References fPedestal.

Referenced by ODBCheck::Check().

00072                                      {
00073   return fPedestal;
00074 }

int PulseEstimate::GetPolarity (  )  const
Returns:
Estimated polarity

Definition at line 76 of file PulseEstimate.cc.

References fPolarity.

Referenced by ODBCheck::Check().

00076                                      {
00077   return fPolarity;
00078 }


Member Data Documentation

int PulseEstimate::fOffset [private]

The estimated timing offset from the muSc time difference histograms. The bin containing the peak is used.

Definition at line 33 of file PulseEstimate.hh.

Referenced by Estimate(), and GetOffset().

int PulseEstimate::fPedestal [private]

Estimateed pedestal from the Y projection of the first few (10) bins of the shapes (persistance) histogram. The bin containing the peak is considered the pedestal.

Definition at line 23 of file PulseEstimate.hh.

Referenced by Estimate(), and GetPedestal().

int PulseEstimate::fPolarity [private]

Estimated polarity from fPedestal and the Y projection of the entire shapes histogram. The non-zero bin that is farthest from the peak determines the polarity. Whichever is farther indicates the polarity of the pulse. The first and last 5 bins are ignored so that problems with certain detectors (premplifier reset in the germanium) don't interfere.

Definition at line 30 of file PulseEstimate.hh.

Referenced by Estimate(), and GetPolarity().


The documentation for this class was generated from the following files:

Generated on 15 Jun 2016 for AlcapDAQ by  doxygen 1.6.1