StripToStripCalScheme Class Reference

#include <StripToStripCalScheme.h>

Inheritance diagram for StripToStripCalScheme:
CalScheme CfgPromptConfigurable

List of all members.

Public Member Functions

 StripToStripCalScheme ()
virtual FloatErr GetStripToStripCorrected (FloatErr siglin, const PlexStripEndId &seid) const
virtual FloatErr DecalStripToStrip (FloatErr sigcorr, const PlexStripEndId &seid) const
virtual void DoReset (const VldContext &context)
virtual void ConfigModified ()
virtual void PrintConfig (std::ostream &os) const
FloatErr GetTemperatureCorrection () const

Private Member Functions

 ClassDef (StripToStripCalScheme, 0)

Private Attributes

DbiResultPtr< CalStripToStripfResPtr
Bool_t fDoTempCal
Int_t fMuonTask
Double_t fSpectrometerFudge
double fRefTemp
double fTempCorFactor

Detailed Description

Definition at line 17 of file StripToStripCalScheme.h.


Constructor & Destructor Documentation

StripToStripCalScheme::StripToStripCalScheme (  ) 

Set up default config.

Definition at line 38 of file StripToStripCalScheme.cxx.

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

00039 {
00043   MSG("Calib",Msg::kVerbose) << "StripToStripCalScheme::StripToStripCalScheme" 
00044                                   << endl;
00045   Registry r;
00046   r.Set("TemperatureCalibration","off");
00047   r.Set("MuonSource","Cosmics");
00048   r.Set("SpectrometerFudge",1.0);
00049   InitializeConfig(r);
00050 
00051   // Hard code these for now.
00052   fRefTemp = 18.0;       // reference temperature
00053   fTempCorFactor = -0.0008;  // frac diff in light output with temperature
00054 
00055 }


Member Function Documentation

StripToStripCalScheme::ClassDef ( StripToStripCalScheme  ,
 
) [private]

Reimplemented from CalScheme.

void StripToStripCalScheme::ConfigModified ( void   )  [virtual]

Deal with a change in the configuration parameters.

Reimplemented from CalScheme.

Definition at line 76 of file StripToStripCalScheme.cxx.

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

00077 {
00081 
00082   const char* str_tempcal;
00083   const char* str_source;
00084 
00085 
00086   bool ok = true;
00087   ok = ok && GetConfig().Get("TemperatureCalibration",str_tempcal);
00088   ok = ok && GetConfig().Get("MuonSource",str_source);
00089   ok = ok && GetConfig().Get("SpectrometerFudge",fSpectrometerFudge);
00090   if(!ok) MSG("Calib",Msg::kError) << "Problem setting up StripToStripCalScheme config." << endl;
00091   
00092   // Interpret strings.
00093   if(strcasecmp(str_tempcal,"on")==0) fDoTempCal = true;
00094   else fDoTempCal = false;
00095   
00096   if(strncasecmp(str_source,"cosmic",6)==0) fMuonTask = 0;
00097   else if(strncasecmp(str_source,"paul",4)==0) fMuonTask = 1;
00098   else if(strncasecmp(str_source,"ps",2)==0) fMuonTask = 2;
00099   else if(strncasecmp(str_source,"alt",3)==0) fMuonTask = 3;
00100   else {
00101     MSG("Calib",Msg::kError) << "I don't understand the MuonSource setting " << str_source << endl;
00102     MSG("Calib",Msg::kError) << "Valid settings are: Cosmics, Paul's Cosmics, PS muons, and Alternative PS muons"<< endl;
00103     MSG("Calib",Msg::kError) << "Defaulting to cosmics"<< endl;
00104     fMuonTask=0;
00105   }
00106 
00107   // Ensure that the DB has been changed for this event.
00108   Reset(GetContext(),true); 
00109 }

FloatErr StripToStripCalScheme::DecalStripToStrip ( FloatErr  sigcorr,
const PlexStripEndId seid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Get strip-to-strip variation

Input: Charge expected from a perfect strip with a perfect phototube Strip end

Output: Charge expected from this strip, including PMT gain

Reimplemented from CalScheme.

Definition at line 178 of file StripToStripCalScheme.cxx.

References PlexStripEndId::AsString(), PlexStripEndId::BuildPlnStripEndKey(), fDoTempCal, fResPtr, fSpectrometerFudge, DbiResultPtr< T >::GetNumRows(), CalStripToStrip::GetResponse(), CalStripToStrip::GetResponseErr(), DbiResultPtr< T >::GetRowByIndex(), GetTemperatureCorrection(), CalScheme::IncrementErrors(), PlexPlaneId::IsNearSpect(), PlexPlaneId::IsVetoShield(), CalScheme::kMissingRow, CalScheme::kStripCalibrator, Msg::kVerbose, Msg::kWarning, MAXMSG, and MSG.

00180 {
00191 
00192   MSG("Calib",Msg::kVerbose) << "StripToStripCalScheme decal on " << sigcorr 
00193                              << " siglin in seid " << seid.AsString() <<"\n";
00194   
00195   FloatErr correction = 1.0;
00196   if(fDoTempCal)
00197     correction = GetTemperatureCorrection();
00198 
00199   // Don't complain about veto shield entries; just do it.
00200   if(seid.IsVetoShield()) return  sigcorr / correction;
00201 
00202   if(seid.IsNearSpect()) correction *= fSpectrometerFudge;
00203 
00204   // Now need to get the row which corresponds to the stripendnum.
00205   const CalStripToStrip* muoncal = fResPtr.GetRowByIndex(seid.BuildPlnStripEndKey());
00206   
00207   if(muoncal ==0) {
00208     if(fResPtr.GetNumRows()>0) {
00209       MAXMSG("Calib",Msg::kWarning,10) 
00210         << "StripToStripCalScheme: No database row for StripEnd " << seid.BuildPlnStripEndKey() << "\n";
00211       
00212      IncrementErrors(kStripCalibrator,kMissingRow,seid);
00213     }
00214     
00215     return sigcorr / correction * FloatErr(1,0.5); // Add 50% for unknown.
00216   }
00217   
00218   return sigcorr / correction * FloatErr(muoncal->GetResponse(), muoncal->GetResponseErr());
00219 }

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

Copied mostly from StripToStripCalibrator::ReInit()

Reimplemented from CalScheme.

Definition at line 58 of file StripToStripCalScheme.cxx.

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

00059 {
00063 
00064   MSG("Calib",Msg::kVerbose) << "StripToStripCalScheme::DoReset(VldContext) Task: " << fMuonTask << endl;
00065 
00066   fResPtr.NewQuery(vc,fMuonTask);
00067   if(fResPtr.GetNumRows()==0) {
00068     MAXMSG("Calib",Msg::kWarning,10) 
00069       << "StripToStrip Scheme: No rows in CALSTRIPTOSTRIP database table"
00070       << vc.AsString() << ".\n";         
00071     IncrementErrors(kStripCalibrator,kMissingTable);
00072   }
00073 }

FloatErr StripToStripCalScheme::GetStripToStripCorrected ( FloatErr  siglin,
const PlexStripEndId seid 
) const [virtual]

Purpose: Apply strip-to-strip correction i.e. scintillator light output, PMT gain, and light loss By default, assumes hit is in center of strip.

In: linearized or raw adc (siglin) strip end

Out: corrected adc (sigcorr)

Reimplemented from CalScheme.

Definition at line 130 of file StripToStripCalScheme.cxx.

References PlexStripEndId::AsString(), PlexStripEndId::BuildPlnStripEndKey(), fDoTempCal, fResPtr, fSpectrometerFudge, DbiResultPtr< T >::GetNumRows(), CalStripToStrip::GetResponse(), CalStripToStrip::GetResponseErr(), DbiResultPtr< T >::GetRowByIndex(), GetTemperatureCorrection(), CalScheme::IncrementErrors(), PlexPlaneId::IsNearSpect(), PlexPlaneId::IsVetoShield(), CalScheme::kMissingRow, CalScheme::kStripCalibrator, Msg::kVerbose, Msg::kWarning, MAXMSG, and MSG.

00132 {
00133   
00145 
00146   MSG("Calib",Msg::kVerbose) << "StripToStripCalScheme on " << siglin 
00147                              << " siglin in seid " << seid.BuildPlnStripEndKey() <<"\n";
00148   // Now need to get the row which corresponds to the stripendnum.
00149 
00150   FloatErr correction = 1.0;
00151   if(fDoTempCal)
00152     correction = GetTemperatureCorrection();
00153 
00154   // Don't complain about veto shield entries; just do it.
00155   if(seid.IsVetoShield()) return  siglin * correction;
00156 
00157   if(seid.IsNearSpect()) correction *= fSpectrometerFudge;
00158 
00159   const CalStripToStrip* muoncal = fResPtr.GetRowByIndex(seid.BuildPlnStripEndKey());
00160   
00161   if(muoncal ==0) {                             
00162     if(fResPtr.GetNumRows()>0) {
00163       MAXMSG("Calib",Msg::kWarning,10) 
00164        << "StripToStripCalScheme: No database row for StripEnd " 
00165        << seid.AsString("c") << " key " << seid.BuildPlnStripEndKey() << "\n";
00166      
00167      IncrementErrors(kStripCalibrator,kMissingRow,seid);
00168    }
00169 
00170     return siglin * correction * FloatErr(1,0.5); // Add 50% error 
00171  }
00172 
00173   
00174   return correction * siglin / FloatErr(muoncal->GetResponse(), muoncal->GetResponseErr());
00175 }

FloatErr StripToStripCalScheme::GetTemperatureCorrection (  )  const

Definition at line 222 of file StripToStripCalScheme.cxx.

References fRefTemp, fTempCorFactor, Calibrator::GetTemperature(), Calibrator::Instance(), Msg::kVerbose, and MSG.

Referenced by DecalStripToStrip(), and GetStripToStripCorrected().

00223 {
00224   //======================================================================
00225   // Purpose: Do temperature correction
00226   //======================================================================
00227   
00228   float temp = Calibrator::Instance().GetTemperature();
00229   
00230   float correction = 1 - fTempCorFactor * (fRefTemp - temp);
00231   
00232   return 1./correction;
00233 
00234   MSG("Calib",Msg::kVerbose) << "Got Temperature Correction of: " 
00235                              << correction << endl;
00236 
00237 }

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

Reimplemented from CalScheme.

Definition at line 112 of file StripToStripCalScheme.cxx.

References fDoTempCal, fMuonTask, fRefTemp, fSpectrometerFudge, fTempCorFactor, Registry::GetCharString(), and CfgPromptConfigurable::GetConfig().

00113 {
00114   os << " (NEW Strip-to-strip calibration scheme) " << endl;
00115   os << "  Muon Source = " << fMuonTask << " = " 
00116      << GetConfig().GetCharString("MuonSource") << endl;
00117   os << " Temperature calibration is " << ((fDoTempCal)?"on":"off") << endl;
00118   if(fDoTempCal) {
00119     os << "  Temp Correction Factor = 1 / [ 1 - " 
00120        << fTempCorFactor << "*(" 
00121        << fRefTemp << " - temp) ]" << endl;
00122   }
00123   if(fSpectrometerFudge!=1.0) {
00124       os << "  Spectrometer fudged by ratio: " << fSpectrometerFudge << endl;
00125   }
00126 }


Member Data Documentation

Definition at line 34 of file StripToStripCalScheme.h.

Referenced by ConfigModified(), DoReset(), and PrintConfig().

Definition at line 38 of file StripToStripCalScheme.h.

Referenced by GetTemperatureCorrection(), and PrintConfig().

Definition at line 32 of file StripToStripCalScheme.h.

Referenced by DecalStripToStrip(), DoReset(), and GetStripToStripCorrected().

Definition at line 39 of file StripToStripCalScheme.h.

Referenced by GetTemperatureCorrection(), and PrintConfig().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1