TimeCalScheme Class Reference

#include <TimeCalScheme.h>

Inheritance diagram for TimeCalScheme:
CalScheme CfgPromptConfigurable

List of all members.

Public Member Functions

 TimeCalScheme ()
virtual void DoReset (const VldContext &context)
virtual void ConfigModified ()
virtual void PrintConfig (std::ostream &os) const
virtual DoubleErr GetCalibratedTime (DoubleErr rawtime, FloatErr, const PlexStripEndId &seid) const
virtual DoubleErr DecalTime (DoubleErr caltime, FloatErr, const PlexStripEndId &seid) const

Private Member Functions

 ClassDef (TimeCalScheme, 1)

Private Attributes

DbiResultPtr< CalTimeCalibrationfResPtr

Detailed Description

Definition at line 16 of file TimeCalScheme.h.


Constructor & Destructor Documentation

TimeCalScheme::TimeCalScheme (  ) 

Definition at line 20 of file TimeCalScheme.cxx.

00021 {
00022   Registry r;
00023   // No configurable options.
00024   InitializeConfig(r); 
00025 }


Member Function Documentation

TimeCalScheme::ClassDef ( TimeCalScheme  ,
 
) [private]

Reimplemented from CfgPromptConfigurable.

void TimeCalScheme::ConfigModified ( void   )  [virtual]

Reimplemented from CalScheme.

Definition at line 44 of file TimeCalScheme.cxx.

00045 {                                               
00046   // No configurable options.
00047 }

DoubleErr TimeCalScheme::DecalTime ( DoubleErr  caltime,
FloatErr  ,
const PlexStripEndId seid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Go from calibrated time to raw time

Input: True time Raw charge Strip end

Output: Raw, uncalibrated time.

Must be implimented by: TimeCalibrator

Reimplemented from CalScheme.

Definition at line 90 of file TimeCalScheme.cxx.

References PlexStripEndId::BuildPlnStripEndKey(), fResPtr, DbiResultPtr< T >::GetNumRows(), CalTimeCalibration::GetOffset(), DbiResultPtr< T >::GetRowByIndex(), CalTimeCalibration::GetScale(), CalScheme::IncrementErrors(), CalScheme::kMissingRow, CalScheme::kTimeCalibrator, Msg::kWarning, MAXMSG, and Munits::ns.

00093 {
00107 
00108   // Now need to get the row which corresponds to the stripendnum.
00109   const CalTimeCalibration* dpgc = fResPtr.GetRowByIndex(seid.BuildPlnStripEndKey());
00110 
00111   if(dpgc==0) {
00112     // Print warning message / log errors if-and-only-if the table is not empty:
00113     if(fResPtr.GetNumRows()>0) { 
00114       MAXMSG("Calib",Msg::kWarning,10) 
00115         << "TimeCalScheme: No database row for StripEnd " << seid.BuildPlnStripEndKey() << "\n";
00116       
00117       IncrementErrors(kTimeCalibrator,kMissingRow,seid);
00118     }
00119 
00120     return caltime + FloatErr(0,50*Munits::ns); // Add error of 50ns, since we really don't know.;
00121   }
00122 
00123   // No inverse function exists in the row function, so I'll kludge one here.
00124   // NJT 7/04
00125   return (caltime +  (double)dpgc->GetOffset())*(double)dpgc->GetScale();
00126 }

void TimeCalScheme::DoReset ( const VldContext context  )  [virtual]

Reimplemented from CalScheme.

Definition at line 29 of file TimeCalScheme.cxx.

References VldContext::AsString(), fResPtr, DbiResultPtr< T >::GetNumRows(), CalScheme::IncrementErrors(), CalScheme::kMissingTable, CalScheme::kTimeCalibrator, Msg::kVerbose, Msg::kWarning, MAXMSG, MSG, and DbiResultPtr< T >::NewQuery().

00030 {
00031   MSG("Calib",Msg::kVerbose) << "TimeCalScheme::DoReset()" << endl;
00032   
00033   fResPtr.NewQuery(context,0);
00034   
00035   if(fResPtr.GetNumRows()==0) {
00036     MAXMSG("Calib",Msg::kWarning,10) 
00037       << "No rows in database table with validity context "
00038       << context.AsString() << "  No calibration will be applied." << endl;
00039     IncrementErrors(kTimeCalibrator,kMissingTable);
00040   }  
00041 }

DoubleErr TimeCalScheme::GetCalibratedTime ( DoubleErr  rawtime,
FloatErr  ,
const PlexStripEndId seid 
) const [virtual]

Purpose: Apply time calibration

In: raw time in seconds raw charge strip end

Out: calibrated time.

Must be implimented by: TimeCalibrator

Reimplemented from CalScheme.

Definition at line 57 of file TimeCalScheme.cxx.

References PlexStripEndId::AsString(), PlexStripEndId::BuildPlnStripEndKey(), fResPtr, DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRowByIndex(), CalTimeCalibration::GetTime(), CalScheme::IncrementErrors(), CalScheme::kMissingRow, CalScheme::kTimeCalibrator, Msg::kWarning, MAXMSG, and Munits::ns.

00060 {
00072 
00073   // Now need to get the row which corresponds to the stripendnum.
00074   const CalTimeCalibration* dpgc = fResPtr.GetRowByIndex(seid.BuildPlnStripEndKey());
00075 
00076   if(dpgc==0) {
00077     if(fResPtr.GetNumRows()>0) {
00078       MAXMSG("Calib",Msg::kWarning,10) 
00079         << "TimeCalScheme: No database row for StripEnd " << seid.AsString() << "\n";
00080       
00081       IncrementErrors(kTimeCalibrator,kMissingRow,seid);
00082     }
00083     return rawtime + FloatErr(0,50*Munits::ns); // Add error of 50ns, since we really don't know.
00084   }
00085   return dpgc->GetTime(rawtime);
00086 }

void TimeCalScheme::PrintConfig ( std::ostream &  os  )  const [virtual]

Reimplemented from CalScheme.

Definition at line 50 of file TimeCalScheme.cxx.

00051 {
00052   // Nothing to print.
00053 }


Member Data Documentation

Definition at line 29 of file TimeCalScheme.h.

Referenced by DecalTime(), DoReset(), and GetCalibratedTime().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1