#include <SimpleCalScheme.h>
Inheritance diagram for SimpleCalScheme:

|
|
Constructor: Use this to set up default configuration. Definition at line 9 of file SimpleCalScheme.cxx. References 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 }
|
|
|
Definition at line 33 of file SimpleCalScheme.cxx. 00034 {}
|
|
||||||||||||
|
|
|
|
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(), 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 }
|
|
||||||||||||||||
|
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 fDefaultAttenLength1, fDefaultAttenLength2, fDefaultAttenN1, FloatErr, CalScheme::GetContext(), PlexStripEndId::GetEnd(), UgliStripHandle::GetHalfLength(), UgliGeomHandle::GetStripHandle(), 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 }
|
|
||||||||||||
|
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 FloatErr. 00352 {
00365 float result = undrifted*(float)fDefaultDrift;
00366 return FloatErr(result,result);
00367 }
|
|
||||||||||||||||
|
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, FloatErr, PlexMuxBoxId::GetElecType(), 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 }
|
|
||||||||||||||||
|
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, FloatErr, CalScheme::GetContext(), VldContext::GetDetector(), 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 }
|
|
||||||||||||
|
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 FloatErr. 00371 {
00384 float result = lin*(float)fDefaultLinearity;
00385 return FloatErr(result,result);
00386 }
|
|
||||||||||||
|
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 FloatErr. 00448 {
00461 float result = sigmip*(float)fDefaultSigCorPerMip;
00462 return FloatErr(result,result);
00463 }
|
|
||||||||||||
|
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 FloatErr. 00390 {
00403 float result = sigcorr*(float)fDefaultStripToStrip;
00404 return FloatErr(result,result);
00405 }
|
|
||||||||||||||||
|
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. References DoubleErr, and FloatErr. 00270 {
00282 return caltime;
00283 }
|
|
||||||||||||
|
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. References FloatErr. 00334 {
00347 return lincharge;
00348 }
|
|
|
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 }
|
|
||||||||||||||||
|
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 fDefaultAttenLength1, fDefaultAttenLength2, fDefaultAttenN1, FloatErr, CalScheme::GetContext(), PlexStripEndId::GetEnd(), UgliStripHandle::GetHalfLength(), UgliGeomHandle::GetStripHandle(), 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 }
|
|
||||||||||||||||
|
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 DoubleErr, and FloatErr. 00091 {
00101
00102 return rawtime + DoubleErr(0,50*Munits::ns);
00103 }
|
|
||||||||||||
|
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 FloatErr, 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 }
|
|
||||||||||||
|
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 FloatErr, 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 }
|
|
||||||||||||
|
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. References FloatErr. 00130 {
00142
00143 return FloatErr(rawcharge,rawcharge);
00144 }
|
|
||||||||||||
|
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 FloatErr. 00243 {
00256 float result = sigmap/(float)fDefaultSigCorPerMip;
00257 return FloatErr(result,result);
00258 }
|
|
||||||||||||
|
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 FloatErr, CalScheme::GetContext(), and VldContext::GetDetector(). 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 }
|
|
||||||||||||
|
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 FloatErr. 00186 {
00200 float result = siglin/(float)fDefaultStripToStrip;
00201 return FloatErr(result,result);
00202 }
|
|
|
Return the temperature of the detector in degrees C. Reimplemented from CalScheme. Definition at line 466 of file SimpleCalScheme.cxx. 00467 {
00471 return fDefaultTemp;
00472 }
|
|
|
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(). |
|
|
Definition at line 69 of file SimpleCalScheme.h. Referenced by ConfigModified(). |
|
|
Definition at line 67 of file SimpleCalScheme.h. Referenced by ConfigModified(), and DecalGainAndWidth(). |
|
|
Definition at line 68 of file SimpleCalScheme.h. Referenced by ConfigModified(), and DecalGainAndWidth(). |
|
|
Definition at line 70 of file SimpleCalScheme.h. Referenced by ConfigModified(). |
|
|
Definition at line 75 of file SimpleCalScheme.h. Referenced by ConfigModified(). |
|
|
Definition at line 71 of file SimpleCalScheme.h. Referenced by ConfigModified(). |
|
|
Definition at line 76 of file SimpleCalScheme.h. Referenced by ConfigModified(). |
1.3.9.1