PulserGainPin Class Reference

#include <PulserGainPin.h>

Inheritance diagram for PulserGainPin:
DbiTableRow

List of all members.

Public Member Functions

 PulserGainPin ()
virtual ~PulserGainPin ()
bool AddPoint (Int_t point, const PulserSummary &ps, int aggNo, int expectedPoints)
bool Add (const PulserGainPin &pg)
Int_t GetAggregateNo () const
UInt_t GetIndex (UInt_t) const
PlexPinDiodeId GetStripEnd () const
PlexPinDiodeId GetPinDiodeId () 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)
Float_t ZCError (Int_t i)
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
PlexPinDiodeId fPlexPinDiodeId
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 40 of file PulserGainPin.h.


Constructor & Destructor Documentation

PulserGainPin::PulserGainPin (  ) 

Definition at line 57 of file PulserGainPin.cxx.

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

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

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

Definition at line 46 of file PulserGainPin.h.

00046 {};


Member Function Documentation

bool PulserGainPin::Add ( const PulserGainPin pg  ) 

Definition at line 171 of file PulserGainPin.cxx.

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

00172 {
00173 
00174   assert(pg.GetAggregateNo()==fAggregateNo);
00175   const float * mean = pg.GetMean();
00176   const float * error = pg.GetError();
00177   const float * numentries = pg.GetNumEntries();
00178   const float * numtriggers = pg.GetNumTriggers();
00179 
00180   // Allow Add() to add to either end of the curve.
00181  if (pg.GetFirstPoint()==1+fLastPoint) {
00182     // add to end
00183     fLastPoint = pg.GetLastPoint();
00184   }
00185   else if(pg.GetLastPoint()==fFirstPoint-1) {
00186     // add to start
00187     fFirstPoint = pg.GetFirstPoint();
00188   }
00189   else {
00190     // Fragments don't join up
00191     MSG("Pulser",Msg::kError) << "This should never happen!\n";
00192     return false;
00193     // This should never happen, though!
00194   }
00195   for (int i=pg.GetFirstPoint();i<=pg.GetLastPoint();i++) {
00196     fMean[i-1] = mean[i-1];
00197     fError[i-1] = error[i-1];
00198     fNumEntries[i-1] = numentries[i-1];
00199     fNumTriggers[i-1] = numtriggers[i-1];
00200     fNumPoints = pg.GetNumPoints();
00201     //    ++fNumPoints;
00202   }
00203   return true;
00204 
00205 }

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

Definition at line 85 of file PulserGainPin.cxx.

References fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, fPlexPinDiodeId, PulserSummary::GetEntries(), PulserSummary::GetError(), PulserSummary::GetMean(), PulserSummary::GetPinDiodeId(), PulserSummary::GetTriggers(), Msg::kDebug, and MSG.

Referenced by PulserDBModule::AddToGC().

00086 {
00087     MSG("Pulser",Msg::kDebug)<<"In GainPin Add(psl). Aggregate Number: " << aggNo << endl; 
00088     MSG("Pulser",Msg::kDebug)<<"In GainPin Add(psl). fFirst, fLast, fIdent: " << fFirstPoint << ", " << fLastPoint << endl;
00089 
00090     //  if ((fFirstPoint!=0)&&(point!=(1+fLastPoint))) return false;
00091   // Some channels might be missing a point with low pulse height.
00092   if (!(point>fLastPoint)) return false;
00093   fPlexPinDiodeId = ps.GetPinDiodeId();
00094   fAggregateNo = aggNo;
00095   fMean[point-1] = ps.GetMean();
00096   fError[point-1] =ps.GetError();
00097   fNumEntries[point-1] = ps.GetEntries();
00098   fNumTriggers[point-1] = ps.GetTriggers();
00099   fNumPoints = expectedPoints;
00100 //  ++fNumPoints;
00101   fLastPoint = point;
00102   if (fFirstPoint==0) fFirstPoint = point;
00103     MSG("Pulser",Msg::kDebug)<<"In GainPin Add(psl). Aggregate Number: " << aggNo << endl; 
00104     MSG("Pulser",Msg::kDebug)<<"In GainPin Add(psl). fFirst, fLast, fIdent: " << fFirstPoint << ", " << fLastPoint << endl;
00105 
00106   return true;
00107 }

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

Implements DbiTableRow.

Definition at line 67 of file PulserGainPin.h.

00067 { return new PulserGainPin;}

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

Implements DbiTableRow.

Definition at line 109 of file PulserGainPin.cxx.

References det, fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, fPlexPinDiodeId, VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), ElecType::kUnknown, and Detector::StringToEnum().

00111 {
00112  Detector::Detector_t det =
00113     (Detector::Detector_t) 
00114     ((vrec) ? vrec->GetVldRange().GetDetectorMask() : 0);
00115   
00116   string elecName="Unknown";
00117   char   elecType = ElecType::kUnknown;
00118   char   rackEastWest='?', rackLevel='?';
00119   int    rackBay=0, muxboxInRack=0;
00120   int    diodeinbox=0, gain=0;
00121 
00122   rs >> fAggregateNo  
00123      >> elecName
00124      >> rackEastWest
00125      >> rackLevel
00126      >> rackBay
00127      >> muxboxInRack
00128      >> diodeinbox
00129      >> gain
00130      >> fNumPoints >> fFirstPoint >> fLastPoint;
00131   for (int i=0;i<40;i++) rs >> fMean[i];
00132   for (int i=0;i<40;i++) rs >> fError[i];
00133   for (int i=0;i<40;i++) rs >> fNumEntries[i];
00134   for (int i=0;i<40;i++) rs >> fNumTriggers[i];
00135 
00136  ElecType::Elec_t elec = ElecType::StringToEnum(elecName.c_str(),1);
00137   if (ElecType::kUnknown == elec)  elec = (ElecType::Elec_t) elecType;
00138   
00139   fPlexPinDiodeId = PlexPinDiodeId(det,elec,rackEastWest,rackLevel,
00140                                    rackBay,muxboxInRack,diodeinbox,gain);
00141 
00142 } 

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

Reimplemented from DbiTableRow.

Definition at line 52 of file PulserGainPin.h.

References fAggregateNo.

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

00052 { return fAggregateNo; }

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

Definition at line 60 of file PulserGainPin.h.

References fError.

Referenced by Add(), FitNdNonlinQuad(), and PulserPinScale::PulserPinScale().

00060 {return fError;}

Int_t PulserGainPin::GetFirstPoint (  )  const [inline]

Definition at line 57 of file PulserGainPin.h.

References fFirstPoint.

Referenced by Add().

00057 {return fFirstPoint;}

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

Reimplemented from DbiTableRow.

Definition at line 53 of file PulserGainPin.h.

References fPlexPinDiodeId, and PlexPinDiodeId::GetEncoded().

Referenced by PulserDBModule::MergeBack().

00053 { return fPlexPinDiodeId.GetEncoded(); }

Int_t PulserGainPin::GetLastPoint (  )  const [inline]

Definition at line 58 of file PulserGainPin.h.

References fLastPoint.

Referenced by Add().

00058 {return fLastPoint;}

const Float_t* PulserGainPin::GetMean (  )  const [inline]
const Float_t* PulserGainPin::GetNumEntries (  )  const [inline]
Int_t PulserGainPin::GetNumPoints (  )  const [inline]
const Float_t* PulserGainPin::GetNumTriggers (  )  const [inline]
PlexPinDiodeId PulserGainPin::GetPinDiodeId (  )  const [inline]

Definition at line 55 of file PulserGainPin.h.

References fPlexPinDiodeId.

Referenced by CheckGC::checklin(), and PulserGainFit::GetPinData().

00055 {return fPlexPinDiodeId;}

PlexPinDiodeId PulserGainPin::GetStripEnd (  )  const [inline]

Definition at line 54 of file PulserGainPin.h.

References fPlexPinDiodeId.

00054 {return fPlexPinDiodeId;}

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

Reimplemented from DbiTableRow.

Definition at line 144 of file PulserGainPin.cxx.

References bfld::AsString(), fAggregateNo, fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, fPlexPinDiodeId, PlexMuxBoxId::GetEastWest(), PlexMuxBoxId::GetElecType(), PlexPinDiodeId::GetGain(), PlexPinDiodeId::GetInBox(), PlexMuxBoxId::GetInRack(), PlexMuxBoxId::GetRackBay(), and PlexMuxBoxId::GetRackLevel().

00146 {
00147 
00148  ElecType::Elec_t elec = fPlexPinDiodeId.GetElecType();
00149   char rackEastWest = fPlexPinDiodeId.GetEastWest();
00150   char rackLevel    = fPlexPinDiodeId.GetRackLevel();
00151   int  rackBay      = fPlexPinDiodeId.GetRackBay();
00152   int  muxInRack    = fPlexPinDiodeId.GetInRack();
00153   ors << fAggregateNo 
00154       << ElecType::AsString(elec)
00155       << rackEastWest
00156       << rackLevel
00157       << rackBay
00158       << muxInRack
00159       << fPlexPinDiodeId.GetInBox()
00160       << fPlexPinDiodeId.GetGain()
00161       << fNumPoints 
00162       << fFirstPoint 
00163       << fLastPoint;
00164   for (int i=0;i<40;i++) ors << fMean[i];
00165   for (int i=0;i<40;i++) ors << fError[i];
00166   for (int i=0;i<40;i++) ors << fNumEntries[i];
00167   for (int i=0;i<40;i++) ors << fNumTriggers[i];
00168 
00169 }

Float_t PulserGainPin::ZCError ( Int_t  i  ) 

Definition at line 213 of file PulserGainPin.cxx.

References fError, fMean, fNumEntries, and fNumTriggers.

Referenced by PulserGainFit::Fit().

00213                                       {
00214   // Return zero-corrected error for point i
00215   Float_t zcerr = fNumEntries[i]*fError[i]*fError[i];
00216   zcerr+= (1.-fNumEntries[i]/fNumTriggers[i])*fMean[i]*fMean[i];
00217   zcerr = sqrt(fNumEntries[i]*zcerr)/fNumTriggers[i];
00218   return zcerr;
00219 }

Float_t PulserGainPin::ZCMean ( Int_t  i  ) 

Definition at line 207 of file PulserGainPin.cxx.

References fMean, fNumEntries, and fNumTriggers.

Referenced by PulserGainFit::Fit().

00207                                      {
00208   // Return zero-corrected mean for point i
00209   Float_t zcmean = fMean[i] * fNumEntries[i] / fNumTriggers[i];
00210   return zcmean;
00211 }


Member Data Documentation

Int_t PulserGainPin::fAggregateNo [private]

Definition at line 76 of file PulserGainPin.h.

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

Float_t PulserGainPin::fError[40] [private]

Definition at line 85 of file PulserGainPin.h.

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

Int_t PulserGainPin::fFirstPoint [private]

Definition at line 79 of file PulserGainPin.h.

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

Int_t PulserGainPin::fLastPoint [private]

Definition at line 80 of file PulserGainPin.h.

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

Float_t PulserGainPin::fMean[40] [private]

Definition at line 84 of file PulserGainPin.h.

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

Float_t PulserGainPin::fNumEntries[40] [private]

Definition at line 86 of file PulserGainPin.h.

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

Int_t PulserGainPin::fNumPoints [private]

Definition at line 78 of file PulserGainPin.h.

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

Float_t PulserGainPin::fNumTriggers[40] [private]

Definition at line 87 of file PulserGainPin.h.

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

Definition at line 77 of file PulserGainPin.h.

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


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1