PulserGain Class Reference

#include <PulserGain.h>

Inheritance diagram for PulserGain:
DbiTableRow

List of all members.

Public Member Functions

 PulserGain ()
virtual ~PulserGain ()
void New (Int_t aggNo, Int_t points, Int_t stripEndKey)
bool AddPoint (Int_t point, const PulserSummary &ps, int aggNo, int expectedPoints)
bool Add (const PulserGain &pg)
Int_t GetAggregateNo () const
UInt_t GetIndex (UInt_t) const
Int_t GetStripEnd () const
Int_t GetNumPoints () const
Int_t GetFirstPoint () const
Int_t GetLastPoint () const
const Float_t * GetMean () const
const Float_t * GetError () const
const Float_t * GetNumEntries () const
const Float_t * GetNumTriggers () const
Float_t ZCMean (Int_t i) const
Float_t ZCError (Int_t i) const
virtual DbiTableRowCreateTableRow () const
virtual void Fill (DbiResultSet &rs, const DbiValidityRec *vrec)
virtual void Store (DbiOutRowStream &ors, const DbiValidityRec *vrec) const

Private Attributes

Int_t fAggregateNo
Int_t fStripEnd
Int_t fNumPoints
Int_t fFirstPoint
Int_t fLastPoint
Float_t fMean [40]
Float_t fError [40]
Float_t fNumEntries [40]
Float_t fNumTriggers [40]

Detailed Description

Definition at line 38 of file PulserGain.h.


Constructor & Destructor Documentation

PulserGain::PulserGain (  ) 

Definition at line 54 of file PulserGain.cxx.

References fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, and fStripEnd.

00055 {
00056   fAggregateNo = -1;
00057   fStripEnd = -1;
00058   for (int i=0;i<40;i++) {
00059      fMean[i] = -1;
00060      fError[i] = -1;
00061      fNumEntries[i] = -1;
00062      fNumTriggers[i] = -1;
00063   }
00064   fFirstPoint = fLastPoint = 0;
00065   fNumPoints = 0;
00066 
00067 }

virtual PulserGain::~PulserGain (  )  [inline, virtual]

Definition at line 44 of file PulserGain.h.

00044 {};


Member Function Documentation

bool PulserGain::Add ( const PulserGain pg  ) 

Definition at line 136 of file PulserGain.cxx.

References fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, GetAggregateNo(), GetError(), GetFirstPoint(), GetLastPoint(), GetMean(), GetNumEntries(), GetNumPoints(), GetNumTriggers(), Msg::kError, and MSG.

Referenced by PulserDBModule::MergeBack().

00137 {
00138   assert(pg.GetAggregateNo()==fAggregateNo);
00139   const float * mean = pg.GetMean();
00140   const float * error = pg.GetError();
00141   const float * numentries = pg.GetNumEntries();
00142   const float * numtriggers = pg.GetNumTriggers();
00143 
00144   // Allow Add() to add to either end of the curve.
00145  if (pg.GetFirstPoint()==1+fLastPoint) {
00146     // add to end
00147     fLastPoint = pg.GetLastPoint();
00148   }
00149   else if(pg.GetLastPoint()==fFirstPoint-1) {
00150     // add to start
00151     fFirstPoint = pg.GetFirstPoint();
00152   }
00153   else {
00154     // Fragments don't join up
00155     MSG("Pulser",Msg::kError) << "This should never happen!\n";
00156     return false;
00157     // This should never happen, though!
00158   }
00159   for (int i=pg.GetFirstPoint();i<=pg.GetLastPoint();i++) {
00160     fMean[i-1] = mean[i-1];
00161     fError[i-1] = error[i-1];
00162     fNumEntries[i-1] = numentries[i-1];
00163     fNumTriggers[i-1] = numtriggers[i-1];
00164     fNumPoints = pg.GetNumPoints();
00165     //    ++fNumPoints;
00166   }
00167   return true;
00168 }

bool PulserGain::AddPoint ( Int_t  point,
const PulserSummary ps,
int  aggNo,
int  expectedPoints 
)

Definition at line 95 of file PulserGain.cxx.

References PlexStripEndId::BuildPlnStripEndKey(), fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, fStripEnd, PulserSummary::GetEntries(), PulserSummary::GetError(), PulserSummary::GetMean(), PulserSummary::GetStripEndId(), and PulserSummary::GetTriggers().

00096 {
00097 
00098   //  if ((fFirstPoint!=0)&&(point!=(1+fLastPoint))) return false;
00099   // Some channels might be missing a point with low pulse height.
00100   if (!(point>fLastPoint)) return false;
00101   fStripEnd = ps.GetStripEndId().BuildPlnStripEndKey();
00102   fAggregateNo = aggNo;
00103   fMean[point-1] = ps.GetMean();
00104   fError[point-1] =ps.GetError();
00105   fNumEntries[point-1] = ps.GetEntries();
00106   fNumTriggers[point-1] = ps.GetTriggers();
00107   fNumPoints = expectedPoints;
00108   //  ++fNumPoints;
00109   fLastPoint = point;
00110   if (fFirstPoint==0) fFirstPoint = point;
00111 
00112   return true;
00113 }

virtual DbiTableRow* PulserGain::CreateTableRow (  )  const [inline, virtual]

Implements DbiTableRow.

Definition at line 63 of file PulserGain.h.

00063 { return new PulserGain;}

void PulserGain::Fill ( DbiResultSet rs,
const DbiValidityRec vrec 
) [virtual]

Implements DbiTableRow.

Definition at line 115 of file PulserGain.cxx.

References fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, and fStripEnd.

00117 {
00118   rs >> fAggregateNo >> fStripEnd >> fNumPoints >> fFirstPoint >> fLastPoint;
00119   for (int i=0;i<40;i++) rs >> fMean[i];
00120   for (int i=0;i<40;i++) rs >> fError[i];
00121   for (int i=0;i<40;i++) rs >> fNumEntries[i];
00122   for (int i=0;i<40;i++) rs >> fNumTriggers[i];
00123 } 

Int_t PulserGain::GetAggregateNo (  )  const [inline, virtual]

Reimplemented from DbiTableRow.

Definition at line 50 of file PulserGain.h.

References fAggregateNo.

Referenced by Add(), CheckGC::checklin(), and PulserGainFit::Fit().

00050 { return fAggregateNo; }

const Float_t* PulserGain::GetError (  )  const [inline]

Definition at line 57 of file PulserGain.h.

References fError.

Referenced by Add(), CheckGC::checklin(), and FitNdNonlinQuad().

00057 {return fError;}

Int_t PulserGain::GetFirstPoint (  )  const [inline]

Definition at line 54 of file PulserGain.h.

References fFirstPoint.

Referenced by Add().

00054 {return fFirstPoint;}

UInt_t PulserGain::GetIndex ( UInt_t   )  const [inline, virtual]

Reimplemented from DbiTableRow.

Definition at line 51 of file PulserGain.h.

References fStripEnd.

00051 { return fStripEnd; }

Int_t PulserGain::GetLastPoint (  )  const [inline]

Definition at line 55 of file PulserGain.h.

References fLastPoint.

Referenced by Add().

00055 {return fLastPoint;}

const Float_t* PulserGain::GetMean (  )  const [inline]
const Float_t* PulserGain::GetNumEntries (  )  const [inline]
Int_t PulserGain::GetNumPoints (  )  const [inline]
const Float_t* PulserGain::GetNumTriggers (  )  const [inline]
Int_t PulserGain::GetStripEnd (  )  const [inline]
void PulserGain::New ( Int_t  aggNo,
Int_t  points,
Int_t  stripEndKey 
)

Definition at line 83 of file PulserGain.cxx.

References fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, and fStripEnd.

00084 {
00085   fAggregateNo = aggNo;
00086   fStripEnd = stripEndKey;
00087   fNumPoints =points;
00088   memset(fMean,0,40*sizeof(Float_t));
00089   memset(fError,0,40*sizeof(Float_t));
00090   memset(fNumEntries,0,40*sizeof(Float_t));
00091   memset(fNumTriggers,0,40*sizeof(Float_t));
00092   fFirstPoint = fLastPoint = 0;  
00093 }

void PulserGain::Store ( DbiOutRowStream ors,
const DbiValidityRec vrec 
) const [virtual]

Reimplemented from DbiTableRow.

Definition at line 125 of file PulserGain.cxx.

References fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, and fStripEnd.

00127 {
00128   ors << fAggregateNo << fStripEnd << fNumPoints << fFirstPoint << fLastPoint;
00129   for (int i=0;i<40;i++) ors << fMean[i];
00130   for (int i=0;i<40;i++) ors << fError[i];
00131   for (int i=0;i<40;i++) ors << fNumEntries[i];
00132   for (int i=0;i<40;i++) ors << fNumTriggers[i];
00133 
00134 }

Float_t PulserGain::ZCError ( Int_t  i  )  const

Definition at line 176 of file PulserGain.cxx.

References fError, fMean, fNumEntries, and fNumTriggers.

Referenced by PulserGainFit::FarMeans(), PulserGainFit::Fit(), and PulserGainFit::RunNearFarFits().

00176                                          {
00177   // Return zero-corrected error for point i
00178   Float_t zcerr = fNumEntries[i]*fError[i]*fError[i];
00179   zcerr+= (1.-fNumEntries[i]/fNumTriggers[i])*fMean[i]*fMean[i];
00180   zcerr = sqrt(fNumEntries[i]*zcerr)/fNumTriggers[i];
00181   return zcerr;
00182 }

Float_t PulserGain::ZCMean ( Int_t  i  )  const

Definition at line 170 of file PulserGain.cxx.

References fMean, fNumEntries, and fNumTriggers.

Referenced by PulserGainFit::FarMeans(), PulserGainFit::Fit(), and PulserGainFit::RunNearFarFits().

00170                                         {
00171   // Return zero-corrected mean for point i
00172   Float_t zcmean = fMean[i] * fNumEntries[i] / fNumTriggers[i];
00173   return zcmean;
00174 }


Member Data Documentation

Int_t PulserGain::fAggregateNo [private]

Definition at line 72 of file PulserGain.h.

Referenced by Add(), AddPoint(), Fill(), GetAggregateNo(), New(), PulserGain(), and Store().

Float_t PulserGain::fError[40] [private]

Definition at line 81 of file PulserGain.h.

Referenced by Add(), AddPoint(), Fill(), GetError(), New(), PulserGain(), Store(), and ZCError().

Int_t PulserGain::fFirstPoint [private]

Definition at line 75 of file PulserGain.h.

Referenced by Add(), AddPoint(), Fill(), GetFirstPoint(), New(), PulserGain(), and Store().

Int_t PulserGain::fLastPoint [private]

Definition at line 76 of file PulserGain.h.

Referenced by Add(), AddPoint(), Fill(), GetLastPoint(), New(), PulserGain(), and Store().

Float_t PulserGain::fMean[40] [private]

Definition at line 80 of file PulserGain.h.

Referenced by Add(), AddPoint(), Fill(), GetMean(), New(), PulserGain(), Store(), ZCError(), and ZCMean().

Float_t PulserGain::fNumEntries[40] [private]

Definition at line 82 of file PulserGain.h.

Referenced by Add(), AddPoint(), Fill(), GetNumEntries(), New(), PulserGain(), Store(), ZCError(), and ZCMean().

Int_t PulserGain::fNumPoints [private]

Definition at line 74 of file PulserGain.h.

Referenced by Add(), AddPoint(), Fill(), GetNumPoints(), New(), PulserGain(), and Store().

Float_t PulserGain::fNumTriggers[40] [private]

Definition at line 83 of file PulserGain.h.

Referenced by Add(), AddPoint(), Fill(), GetNumTriggers(), New(), PulserGain(), Store(), ZCError(), and ZCMean().

Int_t PulserGain::fStripEnd [private]

Definition at line 73 of file PulserGain.h.

Referenced by AddPoint(), Fill(), GetIndex(), GetStripEnd(), New(), PulserGain(), and Store().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1