Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

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]

Constructor & Destructor Documentation

PulserGainPin::PulserGainPin  ) 
 

Definition at line 57 of file PulserGainPin.cxx.

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 fError, fFirstPoint, fLastPoint, fMean, fNumEntries, fNumPoints, fNumTriggers, GetAggregateNo(), GetError(), GetFirstPoint(), GetLastPoint(), GetMean(), GetNumEntries(), GetNumPoints(), GetNumTriggers(), and MSG.

Referenced by PulserDBModule::MergeBack().

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(), 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, fMean, fNumEntries, fNumPoints, fNumTriggers, fPlexPinDiodeId, VldRange::GetDetectorMask(), DbiValidityRec::GetVldRange(), and ElecType::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.

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.

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

00060 {return fError;}

Int_t PulserGainPin::GetFirstPoint  )  const [inline]
 

Definition at line 57 of file PulserGainPin.h.

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.

Referenced by Add().

00058 {return fLastPoint;}

const Float_t* PulserGainPin::GetMean  )  const [inline]
 

Definition at line 59 of file PulserGainPin.h.

Referenced by Add(), PulserLinearityCalScheme::DecalLinNear(), FitNdNonlinQuad(), PulserLinearityCalScheme::GetLinNear(), and PulserPinScale::PulserPinScale().

00059 {return fMean;}

const Float_t* PulserGainPin::GetNumEntries  )  const [inline]
 

Definition at line 61 of file PulserGainPin.h.

Referenced by Add(), PulserLinearityCalScheme::DecalLinNear(), FitNdNonlinQuad(), and PulserLinearityCalScheme::GetLinNear().

00061 {return fNumEntries;}

Int_t PulserGainPin::GetNumPoints  )  const [inline]
 

Definition at line 56 of file PulserGainPin.h.

Referenced by Add(), PulserLinearityCalScheme::DecalLinNear(), PulserGainFit::Fit(), FitNdNonlinQuad(), PulserLinearityCalScheme::GetLinNear(), and PulserPinScale::PulserPinScale().

00056 {return fNumPoints;}

const Float_t* PulserGainPin::GetNumTriggers  )  const [inline]
 

Definition at line 62 of file PulserGainPin.h.

Referenced by Add(), PulserLinearityCalScheme::DecalLinNear(), FitNdNonlinQuad(), and PulserLinearityCalScheme::GetLinNear().

00062 {return fNumTriggers;}

PlexPinDiodeId PulserGainPin::GetPinDiodeId  )  const [inline]
 

Definition at line 55 of file PulserGainPin.h.

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

00055 {return fPlexPinDiodeId;}

PlexPinDiodeId PulserGainPin::GetStripEnd  )  const [inline]
 

Definition at line 54 of file PulserGainPin.h.

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 ElecType::AsString(), fAggregateNo, fError, fFirstPoint, 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 AddPoint(), Fill(), and Store().

Float_t PulserGainPin::fError[40] [private]
 

Definition at line 85 of file PulserGainPin.h.

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

Int_t PulserGainPin::fFirstPoint [private]
 

Definition at line 79 of file PulserGainPin.h.

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

Int_t PulserGainPin::fLastPoint [private]
 

Definition at line 80 of file PulserGainPin.h.

Referenced by Add(), and AddPoint().

Float_t PulserGainPin::fMean[40] [private]
 

Definition at line 84 of file PulserGainPin.h.

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

Float_t PulserGainPin::fNumEntries[40] [private]
 

Definition at line 86 of file PulserGainPin.h.

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

Int_t PulserGainPin::fNumPoints [private]
 

Definition at line 78 of file PulserGainPin.h.

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

Float_t PulserGainPin::fNumTriggers[40] [private]
 

Definition at line 87 of file PulserGainPin.h.

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

PlexPinDiodeId PulserGainPin::fPlexPinDiodeId [private]
 

Definition at line 77 of file PulserGainPin.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Feb 15 11:10:06 2010 for loon by  doxygen 1.3.9.1