VaLinearityCalScheme Class Reference

#include <VaLinearityCalScheme.h>

Inheritance diagram for VaLinearityCalScheme:
CalScheme CfgPromptConfigurable

List of all members.

Public Member Functions

 VaLinearityCalScheme ()
virtual void DoReset (const VldContext &context)
virtual void ConfigModified ()
virtual void PrintConfig (std::ostream &os) const
virtual FloatErr GetLinearizedVA (FloatErr rawcharge, const RawChannelId &rcid) const
virtual FloatErr DecalVALinearity (FloatErr lincharge, const RawChannelId &rcid) const

Private Member Functions

 ClassDef (VaLinearityCalScheme, 0)

Private Attributes

Int_t fTask
DbiResultPtr< CalVaLinearityfResPtr

Detailed Description

Definition at line 21 of file VaLinearityCalScheme.h.


Constructor & Destructor Documentation

VaLinearityCalScheme::VaLinearityCalScheme (  ) 

Set up default config.

Definition at line 26 of file VaLinearityCalScheme.cxx.

References Msg::kVerbose, MSG, and Registry::Set().

00027 {
00031   MSG("Calib",Msg::kVerbose) << "VaLinearityCalScheme::VaLinearityCalScheme" 
00032                              << endl;
00033   Registry r;
00034   r.Set("Task","PinsOnly");
00035   InitializeConfig(r);
00036 }


Member Function Documentation

VaLinearityCalScheme::ClassDef ( VaLinearityCalScheme  ,
 
) [private]

Reimplemented from CalScheme.

void VaLinearityCalScheme::ConfigModified ( void   )  [virtual]

Deal with a change in the configuration parameters.

Reimplemented from CalScheme.

Definition at line 57 of file VaLinearityCalScheme.cxx.

References fTask, Registry::Get(), CfgPromptConfigurable::GetConfig(), CalScheme::GetContext(), Msg::kError, MSG, and CalScheme::Reset().

00058 {
00062   bool ok = true;
00063   const char* taskname;
00064   ok = ok && GetConfig().Get("Task",taskname);
00065 
00066   if     (0==strcasecmp(taskname,"PinsOnly" )) fTask = 0;
00067   else if(0==strcasecmp(taskname,"All"))       fTask = 1;
00068   else ok = false;
00069 
00070   if(!ok) MSG("Calib",Msg::kError) << "Problem setting up VaLinearityCalScheme config." << endl;
00071   
00072   // Ensure that the DB has been changed for this event.
00073   Reset(GetContext(),true); 
00074 }

FloatErr VaLinearityCalScheme::DecalVALinearity ( FloatErr  lincharge,
const RawChannelId rcid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Apply VA nonlinearity

Input: linear charge channel ID

Output: nonlinear charge

Must be implimented by: VALinCalibrator

Reimplemented from CalScheme.

Definition at line 127 of file VaLinearityCalScheme.cxx.

References RawChannelId::AsString(), Form(), fResPtr, RawChannelId::GetElecType(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRowByIndex(), CalScheme::IncrementErrors(), RawChannelId::IsNull(), CalScheme::kMissingRow, ElecType::kVA, CalScheme::kVALinCalibrator, Msg::kWarning, MAXMSG, CalVaLinearity::Rcid2Index(), and CalVaLinearity::UnLinearize().

00129 {
00142 
00143   // Reject stupid inputs:
00144   if(rcid.IsNull()) return lincharge;
00145   if(rcid.GetElecType()!=ElecType::kVA) return lincharge;
00146   
00147 
00148   // Get Row ID:
00149   UInt_t idx = CalVaLinearity::Rcid2Index(rcid);
00150   
00151   const CalVaLinearity* row = fResPtr.GetRowByIndex(idx);
00152 
00153   if(row==0) {
00154     if(fResPtr.GetNumRows()>0) {
00155       MAXMSG("Calib",Msg::kWarning,10) 
00156         << "VaLinearityCalScheme: No database row for RawChannelId" << rcid.AsString() 
00157         << "  Idx:" << Form("%08x",idx) << std::endl;      
00158       IncrementErrors(kVALinCalibrator,kMissingRow,rcid);
00159     }
00160     return lincharge * FloatErr(1,0.5);
00161   }
00162   
00163   return row->UnLinearize(lincharge);
00164 }

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

Copied mostly from VaLinearityCalibrator::ReInit()

Reimplemented from CalScheme.

Definition at line 39 of file VaLinearityCalScheme.cxx.

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

00040 {
00044 
00045   MSG("Calib",Msg::kVerbose) << "VaLinearityCalScheme::DoReset()" << endl;
00046 
00047   fResPtr.NewQuery(vc,fTask);
00048   if(fResPtr.GetNumRows()==0) {
00049     MAXMSG("Calib",Msg::kWarning,10) 
00050       << "VaLinearity Scheme: No rows in CALVALINEARITY database table"
00051       << vc.AsString() << ".\n";         
00052     IncrementErrors(kVALinCalibrator,kMissingTable);
00053   }
00054 }

FloatErr VaLinearityCalScheme::GetLinearizedVA ( FloatErr  rawcharge,
const RawChannelId rcid 
) const [virtual]

Purpose: Linearize a VA channel to charge injection data. Usually applies only to pin diodes

In: raw adc raw channel ID

Out: number of pes.

Must be implimented by: VALinCalibrator

Reimplemented from CalScheme.

Definition at line 88 of file VaLinearityCalScheme.cxx.

References RawChannelId::AsString(), Form(), fResPtr, RawChannelId::GetElecType(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRowByIndex(), CalScheme::IncrementErrors(), RawChannelId::IsNull(), CalScheme::kMissingRow, ElecType::kVA, CalScheme::kVALinCalibrator, Msg::kWarning, CalVaLinearity::Linearize(), MAXMSG, and CalVaLinearity::Rcid2Index().

00090 {
00102 
00103   // Reject stupid inputs:
00104   if(rcid.IsNull()) return rawcharge;
00105   if(rcid.GetElecType()!=ElecType::kVA) return rawcharge;
00106 
00107   // Get Row ID:
00108   UInt_t idx = CalVaLinearity::Rcid2Index(rcid);
00109   
00110   const CalVaLinearity* row = fResPtr.GetRowByIndex(idx);
00111 
00112   if(row==0) {
00113     if(fResPtr.GetNumRows()>0) {
00114       MAXMSG("Calib",Msg::kWarning,10) 
00115         << "VaLinearityCalScheme: No database row for RawChannelId" << rcid.AsString() 
00116         << "  Idx:" << Form("%08x",idx) << std::endl;      
00117       IncrementErrors(kVALinCalibrator,kMissingRow,rcid);
00118     }
00119     return rawcharge * FloatErr(1,0.5);
00120   }
00121   
00122   return row->Linearize(rawcharge);
00123 }

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

Reimplemented from CalScheme.

Definition at line 78 of file VaLinearityCalScheme.cxx.

References Registry::GetCharString(), and CfgPromptConfigurable::GetConfig().

00079 {
00080   os << " VaLinearityCalScheme " << endl;
00081   os << " Task: " << GetConfig().GetCharString("Task");
00082 }


Member Data Documentation

Definition at line 38 of file VaLinearityCalScheme.h.

Referenced by DecalVALinearity(), DoReset(), and GetLinearizedVA().

Int_t VaLinearityCalScheme::fTask [private]

Definition at line 35 of file VaLinearityCalScheme.h.

Referenced by ConfigModified(), and DoReset().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1