SimpleCalScheme Class Reference

#include <SimpleCalScheme.h>

Inheritance diagram for SimpleCalScheme:
CalScheme CfgPromptConfigurable

List of all members.

Public Member Functions

 SimpleCalScheme ()
virtual ~SimpleCalScheme ()
virtual DoubleErr GetCalibratedTime (DoubleErr rawtime, FloatErr charge, const PlexStripEndId &seid) const
virtual FloatErr GetPhotoElectrons (FloatErr rawcharge, const PlexStripEndId &seid) const
virtual FloatErr GetLinearizedVA (FloatErr rawcharge, const RawChannelId &rcid) const
virtual FloatErr GetDriftCorrected (FloatErr rawcharge, const PlexStripEndId &seid) const
virtual FloatErr GetLinearized (FloatErr sigdrift, const PlexStripEndId &seid) const
virtual FloatErr GetStripToStripCorrected (FloatErr siglin, const PlexStripEndId &seid) const
virtual FloatErr GetAttenCorrected (FloatErr sigcorr, FloatErr stripX, const PlexStripEndId &seid) const
virtual FloatErr GetMIP (FloatErr sigmap, const PlexStripEndId &seid=PlexStripEndId()) const
virtual DoubleErr DecalTime (DoubleErr caltime, FloatErr charge, const PlexStripEndId &seid) const
virtual void DecalGainAndWidth (FloatErr &gain, FloatErr &width, const PlexStripEndId &seid) const
virtual void DecalGainAndWidth (FloatErr &gain, FloatErr &width, const PlexPixelSpotId &psid) const
virtual FloatErr DecalVALinearity (FloatErr adc, const RawChannelId &rcid) const
virtual FloatErr DecalDrift (FloatErr undrifted, const PlexStripEndId &seid) const
virtual FloatErr DecalLinearity (FloatErr lin, const PlexStripEndId &seid) const
virtual FloatErr DecalStripToStrip (FloatErr sigcorr, const PlexStripEndId &seid) const
virtual FloatErr DecalAttenCorrected (FloatErr sigmap, FloatErr stripX, const PlexStripEndId &seid) const
virtual FloatErr DecalMIP (FloatErr sigmip, const PlexStripEndId &seid) const
virtual Float_t GetTemperature (Int_t) const
virtual void DoReset (const VldContext &context)
virtual void ConfigModified ()

Private Member Functions

 ClassDef (SimpleCalScheme, 0)

Private Attributes

Double_t fDefaultGainFD
Double_t fDefaultGainND
Double_t fDefaultDrift
Double_t fDefaultLinearity
Double_t fDefaultStripToStrip
Double_t fDefaultAttenLength1
Double_t fDefaultAttenLength2
Double_t fDefaultAttenN1
Double_t fDefaultSigCorPerMip
Double_t fDefaultTemp

Detailed Description

Definition at line 25 of file SimpleCalScheme.h.


Constructor & Destructor Documentation

SimpleCalScheme::SimpleCalScheme (  ) 

Constructor:

Use this to set up default configuration.

Definition at line 9 of file SimpleCalScheme.cxx.

References Nav::GetName(), and Registry::Set().

00010 {
00016 
00017   // Defaults:
00018   Registry r;
00019   r.SetName(this->GetName());
00020   r.Set("defaultGainFD",60.0);
00021   r.Set("defaultGainND",100.0);
00022   r.Set("defaultDrift",1.0);
00023   r.Set("defaultLinearity",1.0);
00024   r.Set("defaultStripToStrip",1.0);
00025   r.Set("defaultAttenLength1",1.0);
00026   r.Set("defaultAttenLength2",7.0);
00027   r.Set("defaultAttenN1",0.3333);
00028   r.Set("defaultSigCorPerMip",750.);
00029   r.Set("defaultTemp",18.0);
00030   this->InitializeConfig(r);
00031 }

SimpleCalScheme::~SimpleCalScheme (  )  [virtual]

Definition at line 33 of file SimpleCalScheme.cxx.

00034 {}


Member Function Documentation

SimpleCalScheme::ClassDef ( SimpleCalScheme  ,
 
) [private]

Reimplemented from CalScheme.

void SimpleCalScheme::ConfigModified ( void   )  [virtual]

ConfigModified()

This gets called when configuration is first set or when it changes.

Reimplemented from CalScheme.

Definition at line 36 of file SimpleCalScheme.cxx.

References fDefaultAttenLength1, fDefaultAttenLength2, fDefaultAttenN1, fDefaultDrift, fDefaultGainFD, fDefaultGainND, fDefaultLinearity, fDefaultSigCorPerMip, fDefaultStripToStrip, fDefaultTemp, Registry::Get(), CfgPromptConfigurable::GetConfig(), Msg::kError, and MSG.

00037 {
00044 
00045   // This bit of deathless code is nice because
00046   // it typo-checks your config to ensure that the stuff above
00047   // matches the stuff here.  If something is missing or is not the right
00048   // type, it prints a warning message.
00049   bool ok = true;
00050   ok = ok && GetConfig().Get("defaultGainFD",fDefaultGainFD);
00051   ok = ok && GetConfig().Get("defaultGainND",fDefaultGainND);
00052   ok = ok && GetConfig().Get("defaultDrift",fDefaultDrift);
00053   ok = ok && GetConfig().Get("defaultLinearity",fDefaultLinearity);
00054   ok = ok && GetConfig().Get("defaultStripToStrip",fDefaultStripToStrip);
00055   ok = ok && GetConfig().Get("defaultAttenLength1",fDefaultAttenLength1);
00056   ok = ok && GetConfig().Get("defaultAttenLength2",fDefaultAttenLength2);
00057   ok = ok && GetConfig().Get("defaultAttenN1",fDefaultAttenN1);
00058   ok = ok && GetConfig().Get("defaultSigCorPerMip",fDefaultSigCorPerMip);
00059   ok = ok && GetConfig().Get("defaultTemp",fDefaultTemp);
00060   if(!ok) MSG("Calib",Msg::kError) << "Problem configuring SimpleCalScheme. Something's missing." << endl;
00061 }

FloatErr SimpleCalScheme::DecalAttenCorrected ( FloatErr  sigmap,
FloatErr  stripX,
const PlexStripEndId seid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Get atttenuation correction

Input: Light expected if energy deposited in middle of strip True position of hit along strip Strip end

Output: Light seen at end of WLS pigtail

Must be implimented by: AttenCalibrator

Reimplemented from CalScheme.

Definition at line 407 of file SimpleCalScheme.cxx.

References MuELoss::a, fDefaultAttenLength1, fDefaultAttenLength2, fDefaultAttenN1, CalScheme::GetContext(), PlexStripEndId::GetEnd(), UgliStripHandle::GetHalfLength(), UgliGeomHandle::GetStripHandle(), StripEnd::kNegative, StripEnd::kPositive, and UgliStripHandle::WlsPigtail().

00410 {
00424   UgliGeomHandle ugli(GetContext());
00425   UgliStripHandle ustrip = ugli.GetStripHandle(seid);
00426 
00427   double halfgreen = ustrip.GetHalfLength() + ustrip.WlsPigtail(seid.GetEnd());
00428   double wlsLen = halfgreen;
00429   if(seid.GetEnd()==StripEnd::kPositive) wlsLen -= stripX;
00430   if(seid.GetEnd()==StripEnd::kNegative) wlsLen += stripX;
00431   // If not +ve or -ve, do nothing.
00432 
00433   // The correction is for the center of the strip to the new position
00434   // on the strip.
00435   
00436   float a = fDefaultAttenN1 * exp(-halfgreen/fDefaultAttenLength1)
00437     + (1.0 - fDefaultAttenN1)* exp(-halfgreen/fDefaultAttenLength2);
00438 
00439   float b = fDefaultAttenN1 * exp(-wlsLen/fDefaultAttenLength1)
00440     + (1.0 - fDefaultAttenN1)* exp(-wlsLen/fDefaultAttenLength2);
00441 
00442   if(a<=0) return FloatErr(sigmap,sigmap);
00443   return FloatErr(sigmap * (b/a),sigmap * (b/a));
00444 }

FloatErr SimpleCalScheme::DecalDrift ( FloatErr  undrifted,
const PlexStripEndId seid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Get gain drift

Input: True gain of phototube in PEs, Strip end

Output: Drifted gain of phototube

Must be implimented by: DriftCalibrator

Reimplemented from CalScheme.

Definition at line 350 of file SimpleCalScheme.cxx.

References fDefaultDrift.

00352 {
00365   float result = undrifted*(float)fDefaultDrift;
00366   return FloatErr(result,result);
00367 }

void SimpleCalScheme::DecalGainAndWidth ( FloatErr gain,
FloatErr width,
const PlexPixelSpotId psid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Get PMT gain and width of single PE response

Input: Strip end

Output: Gain and and width of 1-pe response in ADCs

Must be implimented by: PeCalibrator

Reimplemented from CalScheme.

Definition at line 309 of file SimpleCalScheme.cxx.

References fDefaultGainFD, fDefaultGainND, PlexMuxBoxId::GetElecType(), ElecType::kQIE, and ValueErr< T >::Set().

00312 {
00324   if(psid.GetElecType()==ElecType::kQIE) {
00325     gain.Set(fDefaultGainND,fDefaultGainND);
00326     width.Set(fDefaultGainND* 0.5,fDefaultGainND* 0.5);
00327  } else {
00328     gain.Set(fDefaultGainFD);
00329     width.Set(fDefaultGainFD* 0.5,fDefaultGainFD* 0.5);
00330   }    
00331 }

void SimpleCalScheme::DecalGainAndWidth ( FloatErr gain,
FloatErr width,
const PlexStripEndId seid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Get PMT gain and width of single PE response

Input: Strip end

Output: Gain and and width of 1-pe response in ADCs

Must be implimented by: PeCalibrator

Reimplemented from CalScheme.

Definition at line 285 of file SimpleCalScheme.cxx.

References fDefaultGainFD, fDefaultGainND, CalScheme::GetContext(), DataUtil::GetDetector(), Detector::kNear, and ValueErr< T >::Set().

00288 {
00300   if(GetContext().GetDetector()==Detector::kNear) {
00301     gain.Set(fDefaultGainND,fDefaultGainND);
00302     width.Set(fDefaultGainND* 0.5,fDefaultGainND* 0.5);
00303  } else {
00304     gain.Set(fDefaultGainFD);
00305     width.Set(fDefaultGainFD* 0.5,fDefaultGainFD* 0.5);
00306   }    
00307 }

FloatErr SimpleCalScheme::DecalLinearity ( FloatErr  lin,
const PlexStripEndId seid 
) const [virtual]

Inverse-calibration for use by Monte-Carlo

Purpose: Apply nonlinearity function.

Input: Linear charge expected from a perfect phototube, Strip end

Output: Realistic charge after PMT and electronics nonlinearity

Must be implimented by: LinCalibrator

Reimplemented from CalScheme.

Definition at line 369 of file SimpleCalScheme.cxx.

References fDefaultLinearity.

00371 {
00384   float result = lin*(float)fDefaultLinearity;
00385   return FloatErr(result,result);
00386 }

FloatErr SimpleCalScheme::DecalMIP ( FloatErr  sigmip,
const PlexStripEndId seid 
) const [virtual]

Purpose: Convert from corrected charge to energy units. MIPs are usually defined as the the light seen from a muon going in the Z-direction through the center of the strip (i.e. ~2 MeV of muon energy)

In: sigcorr or sigmap Strip end (May be ignored, depending upon implimentation)

Out: energy in MIPs

Must be implimented by: MIPCalibrator

Reimplemented from CalScheme.

Definition at line 446 of file SimpleCalScheme.cxx.

References fDefaultSigCorPerMip.

00448 {
00461   float result =  sigmip*(float)fDefaultSigCorPerMip;
00462   return FloatErr(result,result);
00463 }

FloatErr SimpleCalScheme::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

Must be implimented by: StripCalibrator

Reimplemented from CalScheme.

Definition at line 388 of file SimpleCalScheme.cxx.

References fDefaultStripToStrip.

00390 {
00403   float result = sigcorr*(float)fDefaultStripToStrip;
00404   return FloatErr(result,result);
00405 }

DoubleErr SimpleCalScheme::DecalTime ( DoubleErr  caltime,
FloatErr  charge,
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.

Reimplemented from CalScheme.

Definition at line 267 of file SimpleCalScheme.cxx.

00270 {
00282   return caltime;
00283 }

FloatErr SimpleCalScheme::DecalVALinearity ( FloatErr  adc,
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 333 of file SimpleCalScheme.cxx.

00334 {
00347   return lincharge;
00348 }

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

DoReset() is called whenever there's a context change. Note that if Reset() is called but the context doesn't change, or the context is invalid, this ISN'T called. That's nice because it avoids bad NewQuery() calls to the DB.

Reimplemented from CalScheme.

Definition at line 65 of file SimpleCalScheme.cxx.

References VldContext::GetTimeStamp().

00066 {
00072 
00073   // People who recognize this example are obviously fellow victims of a liberal education.
00074   // --Nathaniel
00075 
00076   const char* grue;
00077 
00078   if(context.GetTimeStamp()>VldTimeStamp(2000,1,1,0,0,0,0)) grue = "blue";
00079   else grue="green";
00080 }

FloatErr SimpleCalScheme::GetAttenCorrected ( FloatErr  sigcorr,
FloatErr  stripX,
const PlexStripEndId seid 
) const [virtual]

Purpose: Correct for attenuation along strip.

In: sigcorr, position along strip (in strip coordinates: 0 is center of strip.) strip end

Out: position-corrected charge (SigMap)

Must be implimented by: AttenCalibrator

Reimplemented from CalScheme.

Definition at line 204 of file SimpleCalScheme.cxx.

References MuELoss::a, fDefaultAttenLength1, fDefaultAttenLength2, fDefaultAttenN1, CalScheme::GetContext(), PlexStripEndId::GetEnd(), UgliStripHandle::GetHalfLength(), UgliGeomHandle::GetStripHandle(), StripEnd::kNegative, StripEnd::kPositive, and UgliStripHandle::WlsPigtail().

00207 {
00219   UgliGeomHandle ugli(GetContext());
00220   UgliStripHandle ustrip = ugli.GetStripHandle(seid);
00221 
00222   double halfgreen = ustrip.GetHalfLength() + ustrip.WlsPigtail(seid.GetEnd());
00223   double wlsLen = halfgreen;
00224   if(seid.GetEnd()==StripEnd::kPositive) wlsLen -= stripX;
00225   if(seid.GetEnd()==StripEnd::kNegative) wlsLen += stripX;
00226   // If not +ve or -ve, do nothing.
00227 
00228   // The correction is for the center of the strip to the new position
00229   // on the strip.
00230   
00231   float a = fDefaultAttenN1 * exp(-halfgreen/fDefaultAttenLength1)
00232     + (1.0 - fDefaultAttenN1)* exp(-halfgreen/fDefaultAttenLength2);
00233 
00234   float b = fDefaultAttenN1 * exp(-wlsLen/fDefaultAttenLength1)
00235     + (1.0 - fDefaultAttenN1)* exp(-wlsLen/fDefaultAttenLength2);
00236 
00237   if(b<=0) return FloatErr(sigcorr,sigcorr);
00238   return FloatErr(sigcorr * (a/b), sigcorr * (a/b));
00239 }

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

Purpose: Apply time calibration

In: raw time in seconds raw charge strip end

Out: calibrated time.

Reimplemented from CalScheme.

Definition at line 88 of file SimpleCalScheme.cxx.

References Munits::ns.

00091 {
00101  
00102   return rawtime + DoubleErr(0,50*Munits::ns);
00103 }

FloatErr SimpleCalScheme::GetDriftCorrected ( FloatErr  rawcharge,
const PlexStripEndId seid 
) const [virtual]

Purpose: Apply drift correction

In: raw adc strip end

Out: drift-corrected adcs

Must be implimented by: DriftCalibrator

Reimplemented from CalScheme.

Definition at line 147 of file SimpleCalScheme.cxx.

References fDefaultDrift, ValueErr< T >::GetValue(), and ValueErr< T >::SetError().

00149 {
00160   FloatErr result = rawcharge/(float)fDefaultDrift;
00161   result.SetError(result.GetValue()); // 100% error;
00162   return result;
00163 }

FloatErr SimpleCalScheme::GetLinearized ( FloatErr  sigdrift,
const PlexStripEndId seid 
) const [virtual]

Purpose: Apply linearity correction

In: drifted-corrected or raw ADC, strip end

Out: linearized adc (siglin)

Must be implimented by: LinCalibrator

Reimplemented from CalScheme.

Definition at line 165 of file SimpleCalScheme.cxx.

References fDefaultLinearity, ValueErr< T >::GetValue(), and ValueErr< T >::SetError().

00167 {
00178   FloatErr result = sigdrift/(float)fDefaultLinearity;
00179   result.SetError(result.GetValue()); // 100% error;
00180   return result;
00181 }

FloatErr SimpleCalScheme::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 129 of file SimpleCalScheme.cxx.

00130 {
00142  
00143   return FloatErr(rawcharge,rawcharge);
00144 }

FloatErr SimpleCalScheme::GetMIP ( FloatErr  sigmap,
const PlexStripEndId seid = PlexStripEndId() 
) const [virtual]

Purpose: Convert from corrected charge to energy units. MIPs are usually defined as the the light seen from a muon going in the Z-direction through the center of the strip (i.e. ~2 MeV of muon energy)

In: sigcorr or sigmap Strip end (May be ignored, depending upon implimentation)

Out: energy in MIPs

Must be implimented by: MIPCalibrator

Reimplemented from CalScheme.

Definition at line 241 of file SimpleCalScheme.cxx.

References fDefaultSigCorPerMip.

00243 {
00256   float result = sigmap/(float)fDefaultSigCorPerMip;
00257   return FloatErr(result,result);
00258 }  

FloatErr SimpleCalScheme::GetPhotoElectrons ( FloatErr  rawcharge,
const PlexStripEndId seid 
) const [virtual]

Purpose: Apply PE calibration

In: raw adc strip end

Out: number of pes.

Must be implimented by: PeCalibrator

Reimplemented from CalScheme.

Definition at line 105 of file SimpleCalScheme.cxx.

References fDefaultGainFD, fDefaultGainND, CalScheme::GetContext(), DataUtil::GetDetector(), and Detector::kNear.

00107 {
00118 
00119   // Should really look up in the plex to see what kind of channel it is.
00120   FloatErr res(rawcharge,rawcharge); // 100% error.
00121 
00122   if(GetContext().GetDetector()==Detector::kNear) {
00123     return res/=fDefaultGainND;
00124   }
00125   
00126   return res/=fDefaultGainFD;
00127 }

FloatErr SimpleCalScheme::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)

Must be implimented by: StripCalibrator

Reimplemented from CalScheme.

Definition at line 184 of file SimpleCalScheme.cxx.

References fDefaultStripToStrip.

00186 {
00200   float result = siglin/(float)fDefaultStripToStrip;
00201   return FloatErr(result,result);
00202 }

Float_t SimpleCalScheme::GetTemperature ( Int_t   )  const [virtual]

Return the temperature of the detector in degrees C.

Reimplemented from CalScheme.

Definition at line 466 of file SimpleCalScheme.cxx.

References fDefaultTemp.

00467 {
00471   return fDefaultTemp;
00472 }


Member Data Documentation

Definition at line 72 of file SimpleCalScheme.h.

Referenced by ConfigModified(), DecalAttenCorrected(), and GetAttenCorrected().

Definition at line 73 of file SimpleCalScheme.h.

Referenced by ConfigModified(), DecalAttenCorrected(), and GetAttenCorrected().

Definition at line 74 of file SimpleCalScheme.h.

Referenced by ConfigModified(), DecalAttenCorrected(), and GetAttenCorrected().

Double_t SimpleCalScheme::fDefaultDrift [private]

Definition at line 69 of file SimpleCalScheme.h.

Referenced by ConfigModified(), DecalDrift(), and GetDriftCorrected().

Double_t SimpleCalScheme::fDefaultGainFD [private]

Definition at line 67 of file SimpleCalScheme.h.

Referenced by ConfigModified(), DecalGainAndWidth(), and GetPhotoElectrons().

Double_t SimpleCalScheme::fDefaultGainND [private]

Definition at line 68 of file SimpleCalScheme.h.

Referenced by ConfigModified(), DecalGainAndWidth(), and GetPhotoElectrons().

Definition at line 70 of file SimpleCalScheme.h.

Referenced by ConfigModified(), DecalLinearity(), and GetLinearized().

Definition at line 75 of file SimpleCalScheme.h.

Referenced by ConfigModified(), DecalMIP(), and GetMIP().

Definition at line 71 of file SimpleCalScheme.h.

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

Double_t SimpleCalScheme::fDefaultTemp [private]

Definition at line 76 of file SimpleCalScheme.h.

Referenced by ConfigModified(), and GetTemperature().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1