PulserTimeDrift Class Reference

#include <PulserTimeDrift.h>

Inheritance diagram for PulserTimeDrift:

DbiTableRow List of all members.

Public Member Functions

 PulserTimeDrift (Int_t aggregate=0, Int_t index=-1, Float_t entries=0, Float_t mean=0, Float_t rms=0)
virtual ~PulserTimeDrift ()
virtual UInt_t GetIndex (UInt_t) const
virtual UInt_t GetIndex () const
virtual Int_t GetAggregateNo () const
RawChannelId GetRawChannelId () const
Float_t GetEntries () const
Float_t GetMean () const
Float_t GetRms () const
void Add (Float_t ent, Float_t mean, Float_t rms)
virtual Bool_t CanL2Cache () const
virtual DbiTableRowCreateTableRow () const
virtual void Fill (DbiResultSet &rs, const DbiValidityRec *vrec)
virtual void Store (DbiOutRowStream &ors, const DbiValidityRec *vrec) const

Static Public Member Functions

static Int_t GetIndex (const RawChannelId &rcid)
static RawChannelId GetRawChannelId (Int_t index)

Private Member Functions

 PulserTimeDrift (const PulserTimeDrift &from)
 ClassDef (PulserTimeDrift, 1)

Private Attributes

Int_t fAggregate
UInt_t fChannelIndex
Float_t fEntries
Float_t fMean
Float_t fRms

Detailed Description

Definition at line 11 of file PulserTimeDrift.h.


Constructor & Destructor Documentation

PulserTimeDrift::PulserTimeDrift ( Int_t  aggregate = 0,
Int_t  index = -1,
Float_t  entries = 0,
Float_t  mean = 0,
Float_t  rms = 0 
)

Definition at line 23 of file PulserTimeDrift.cxx.

References LEA_CTOR.

00028                                               :
00029   fAggregate(aggregate),
00030   fChannelIndex(index),
00031   fEntries(entries),
00032   fMean(mean),
00033   fRms(rms)
00034 {
00035   LEA_CTOR;
00036 }

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

Definition at line 15 of file PulserTimeDrift.h.

References LEA_DTOR.

00015 { LEA_DTOR; };

PulserTimeDrift::PulserTimeDrift ( const PulserTimeDrift from  )  [inline, private]

Definition at line 45 of file PulserTimeDrift.h.

References LEA_CTOR.

00046     : DbiTableRow(from) { LEA_CTOR; *this = from; }


Member Function Documentation

void PulserTimeDrift::Add ( Float_t  ent,
Float_t  mean,
Float_t  rms 
)

Definition at line 86 of file PulserTimeDrift.cxx.

References fEntries, fMean, and fRms.

00087 {
00092 
00093   // new entries, new mean:
00094   double newEntries  = fEntries + ent;
00095   double newMean     = (fMean*fEntries + ent*mean)/newEntries;
00096 
00097   double oldx2 = (fRms*fRms + fMean*fMean)*fEntries;
00098   double addx2 = (rms*rms + mean*mean)*ent;
00099   double newx2 = oldx2 + addx2;
00100   double newRms = sqrt(fabs(newx2/newEntries - newMean*newMean));
00101 
00102   fEntries = newEntries;
00103   fMean    = newMean;
00104   fRms     = newRms;
00105 }

virtual Bool_t PulserTimeDrift::CanL2Cache (  )  const [inline, virtual]

Reimplemented from DbiTableRow.

Definition at line 31 of file PulserTimeDrift.h.

00031 { return kTRUE; }

PulserTimeDrift::ClassDef ( PulserTimeDrift  ,
 
) [private]

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

Implements DbiTableRow.

Definition at line 32 of file PulserTimeDrift.h.

00032 { return new PulserTimeDrift; }

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

Implements DbiTableRow.

Definition at line 111 of file PulserTimeDrift.cxx.

References DbiRowStream::CurColName(), fAggregate, fChannelIndex, fEntries, fMean, fRms, DbiRowStream::HasRowCounter(), DbiRowStream::IncrementCurCol(), Msg::kDebug, MSG, DbiRowStream::NumCols(), and DbiRowStream::TableName().

00112                                                             {
00113 
00114 //
00115 //
00116 //  Purpose:  Fill object from Result Set
00117 //
00118 //  Arguments: 
00119 //    rs           in    Result Set used to fill object
00120 //    vrec         in    Associated validity record (or 0 if filling
00121 //                                                    DbiValidityRec)
00122 
00123    if ( rs.TableName() == "PULSERTIMEDRIFT" ) {
00124       // Dumb method.
00125      rs  >> fAggregate >> fChannelIndex >> fEntries >> fMean >> fRms;
00126    }
00127    else {      
00128      // Smart method
00129      Int_t numCol = rs.NumCols();
00130      //  The first column (SeqNo) has already been processed.
00131      for (Int_t curCol = rs.HasRowCounter() ? 3 : 2; curCol <= numCol; ++curCol) {
00132        string colName = rs.CurColName();
00133        if ( colName == "AGGREGATENO" )        rs >> fAggregate;
00134        else if( colName == "CHANNELINDEX" )   rs >> fChannelIndex;
00135        else if( colName == "ENTRIES" )        rs >> fEntries;
00136        else if( colName == "MEAN" )           rs >> fMean;
00137        else if( colName == "RMS" )            rs >> fRms;
00138        else {
00139             MSG("Dbi",Msg::kDebug) << "Ignoring column " << curCol 
00140                                    << "(" << colName << ")"
00141                                    << "; not part of PulserTimeDrift" 
00142                                    << endl;
00143             rs.IncrementCurCol();
00144          }
00145       }
00146    }
00147    
00148 }

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

Reimplemented from DbiTableRow.

Definition at line 23 of file PulserTimeDrift.h.

References fAggregate.

00023 { return fAggregate; }

Float_t PulserTimeDrift::GetEntries (  )  const [inline]

Definition at line 25 of file PulserTimeDrift.h.

References fEntries.

Referenced by PulserTimeCalScheme::CalibrateByPulser(), and PulserTimeCalScheme::GetPulserCalibration().

00025 { return fEntries; };

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

Definition at line 21 of file PulserTimeDrift.h.

References fChannelIndex.

Referenced by PulserTimingPoint::AddSummaryBlock(), PulserTimeCalScheme::CalibrateByPulser(), and PulserTimingPoint::PulserTimingPoint().

00021 {return fChannelIndex;};

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

Reimplemented from DbiTableRow.

Definition at line 20 of file PulserTimeDrift.h.

References fChannelIndex.

00020 {return fChannelIndex;};

Int_t PulserTimeDrift::GetIndex ( const RawChannelId rcid  )  [static]

Definition at line 41 of file PulserTimeDrift.cxx.

References RawChannelId::GetCrate(), RawChannelId::GetDetector(), RawChannelId::GetVaAdcSel(), RawChannelId::GetVaChip(), RawChannelId::GetVarcId(), RawChannelId::GetVmm(), RawChannelId::IsNull(), and Detector::kFar.

00042 {
00043   if(rcid.GetDetector()==Detector::kFar) {
00044     Int_t index = rcid.GetCrate()*108
00045                 + rcid.GetVarcId()*36
00046                 + rcid.GetVmm()*6
00047                 + rcid.GetVaAdcSel()*3
00048                 + rcid.GetVaChip();
00049     return index;
00050   } else if(rcid.IsNull()) {
00051     return -1;
00052   } else {
00053     // ND not supported.
00054     assert(0);
00055   }
00056   return -1;
00057 }

Float_t PulserTimeDrift::GetMean (  )  const [inline]

Definition at line 26 of file PulserTimeDrift.h.

References fMean.

Referenced by PulserTimeCalScheme::CalibrateByPulser().

00026 { return fMean; };

RawChannelId PulserTimeDrift::GetRawChannelId ( void   )  const [inline]

Definition at line 24 of file PulserTimeDrift.h.

References fChannelIndex.

00024 {return GetRawChannelId(fChannelIndex);};

RawChannelId PulserTimeDrift::GetRawChannelId ( Int_t  index  )  [static]

Definition at line 59 of file PulserTimeDrift.cxx.

References Detector::kFar, and ElecType::kVA.

00060 {
00061   Int_t temp = index;
00062   Int_t crate = index/108;
00063   temp -= crate*108;
00064   Int_t varc  = temp/36;
00065   temp -= varc*36;
00066   Int_t vmm  = temp/6;
00067   temp -= vmm*6;
00068   Int_t vaadc = temp/3;
00069   temp -= vaadc*3;
00070   Int_t vachip  = temp;
00071 
00072   return RawChannelId(Detector::kFar,
00073                       ElecType::kVA,
00074                       crate, 
00075                       varc,
00076                       vmm,
00077                       vaadc,
00078                       vachip,
00079                       0  // no particular channel on chip
00080                       );                              
00081 }

Float_t PulserTimeDrift::GetRms (  )  const [inline]

Definition at line 27 of file PulserTimeDrift.h.

References fRms.

Referenced by PulserTimeCalScheme::CalibrateByPulser(), and PulserTimeCalScheme::GetPulserCalibration().

00027 { return fRms; };

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

Reimplemented from DbiTableRow.

Definition at line 151 of file PulserTimeDrift.cxx.

References fAggregate, fChannelIndex, fEntries, fMean, and fRms.

00153 {
00154   //
00155   //
00156   //  Purpose:  Stream object to output row stream
00157   //
00158   
00159   ors << fAggregate << fChannelIndex << fEntries << fMean << fRms;
00160 }


Member Data Documentation

Int_t PulserTimeDrift::fAggregate [private]

Definition at line 38 of file PulserTimeDrift.h.

Referenced by Fill(), GetAggregateNo(), and Store().

UInt_t PulserTimeDrift::fChannelIndex [private]

Definition at line 39 of file PulserTimeDrift.h.

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

Float_t PulserTimeDrift::fEntries [private]

Definition at line 40 of file PulserTimeDrift.h.

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

Float_t PulserTimeDrift::fMean [private]

Definition at line 41 of file PulserTimeDrift.h.

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

Float_t PulserTimeDrift::fRms [private]

Definition at line 42 of file PulserTimeDrift.h.

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


The documentation for this class was generated from the following files:
Generated on Mon Nov 10 00:56:19 2014 for loon by  doxygen 1.4.7