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

Public Member Functions | |
| StripAttenCalScheme () | |
| virtual | ~StripAttenCalScheme () |
| virtual void | DoReset (const VldContext &context) |
| virtual void | ConfigModified () |
| virtual void | PrintConfig (std::ostream &os) const |
| virtual FloatErr | GetAttenCorrected (FloatErr sigcorr, FloatErr stripX, const PlexStripEndId &seid) const |
| virtual FloatErr | DecalAttenCorrected (FloatErr sigmap, FloatErr stripX, const PlexStripEndId &seid) const |
Private Member Functions | |
| ClassDef (StripAttenCalScheme, 0) | |
Private Attributes | |
| DbiResultPtr< CalStripAtten > | fResPtr |
| Int_t | fTask |
| CalStripAtten * | fDefaultAtten |
|
|
Definition at line 24 of file StripAttenCalScheme.cxx. References Registry::Set(). 00025 : fResPtr(), 00026 fDefaultAtten(0) 00027 { 00028 Registry r; 00029 r.Set("defF12",0.333); 00030 r.Set("defL1",1.0); 00031 r.Set("defL2",7.0); 00032 r.Set("Task",0); 00033 InitializeConfig(r); 00034 }
|
|
|
Definition at line 38 of file StripAttenCalScheme.cxx. 00039 {
00040 if(fDefaultAtten) delete fDefaultAtten;
00041 }
|
|
||||||||||||
|
|
|
|
Deal with a change in the configuration parameters. Reimplemented from CalScheme. Definition at line 59 of file StripAttenCalScheme.cxx. References fDefaultAtten, fTask, Registry::Get(), CfgPromptConfigurable::GetConfig(), CalScheme::GetContext(), MSG, and CalScheme::Reset(). 00060 {
00064
00065 double f12,l1,l2;
00066 bool ok = true;
00067 ok = ok && GetConfig().Get("Task",fTask);
00068 ok = ok && GetConfig().Get("defF12",f12);
00069 ok = ok && GetConfig().Get("defL1",l1);
00070 ok = ok && GetConfig().Get("defL2",l2);
00071 if(!ok) MSG("Calib",Msg::kError) << "Problem setting up StripAttenCalScheme config." << endl;
00072
00073 if(fDefaultAtten) delete fDefaultAtten;
00074
00075 // Create a dummy seid. This is because the row constructor calls
00076 // seid.BuildPlnStripEndKey(), which prints out warning messages we don't want.
00077 // Doesn't matter, we don't use this seid for anything.
00078 PlexStripEndId dummy_seid(Detector::kNear,1,1,StripEnd::kPositive);
00079
00080 // Build the 'default' row. Uses the default values harvested above to create a
00081 // single DB row, which can do our calibration!
00082 fDefaultAtten = new CalStripAtten(dummy_seid,
00083 l1, l2, f12, // L1, L2, N1/(N1+N2)
00084 l1/2., l2/2., f12/2. // 50% errors
00085 );
00086
00087 // Ensure that the DB has been changed for this event.
00088 Reset(GetContext(),true);
00089 }
|
|
||||||||||||||||
|
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 Reimplemented from CalScheme. Definition at line 186 of file StripAttenCalScheme.cxx. References PlexStripEndId::AsString(), PlexStripEndId::BuildPlnStripEndKey(), FloatErr, fResPtr, CalStripAtten::GetAttenuation(), CalScheme::GetContext(), PlexStripEndId::GetEnd(), ValueErr< T >::GetError(), UgliStripHandle::GetHalfLength(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRowByIndex(), UgliGeomHandle::GetStripHandle(), ValueErr< T >::GetValue(), CalScheme::IncrementErrors(), PlexPlaneId::IsVetoShield(), MAXMSG, ValueErr< T >::SetError(), and UgliStripHandle::WlsPigtail(). 00189 {
00201
00202 UgliGeomHandle ugli(GetContext());
00203 UgliStripHandle ustrip = ugli.GetStripHandle(seid);
00204
00205 // Don't clip the MC.. trust that it's checked strip bounds.
00206 // I sometimes want to inject light into the pigtails, so I need the
00207 // flexibility. --Nathaniel, Jan 2006
00208 // if(fabs(stripX) > ustrip.GetHalfLength()) {
00209 // MSG("Calib",Msg::kDebug) << "Reconstruction asked for non-physical attenuation correction: "
00210 // << seid.AsString() << endl;
00211 // MSG("Calib",Msg::kDebug) << "halflen=" << ustrip.GetHalfLength()
00212 // << " requested=" << stripX
00213 // << " ... trimming to physical bounds now..."
00214 // << endl;
00215
00216 // // Increment error if it's more than 10 cm out.
00217 // if(fabs(stripX) > ustrip.GetHalfLength()+0.1)
00218 // IncrementErrors(kAttenCalibrator,kBadInput);
00219
00220 // // Trim it.
00221 // stripX = TMath::Sign(ustrip.GetHalfLength(),stripX);
00222 // }
00223
00224 double halfgreen = ustrip.GetHalfLength() + ustrip.WlsPigtail(seid.GetEnd());
00225 double wlsLen = halfgreen;
00226 if(seid.GetEnd()==StripEnd::kPositive) wlsLen -= stripX;
00227 if(seid.GetEnd()==StripEnd::kNegative) wlsLen += stripX;
00228 // If not +ve or -ve, do nothing.
00229
00230 const CalStripAtten* atten = fResPtr.GetRowByIndex(seid.BuildPlnStripEndKey());
00231 if(atten==0) {
00232 if((fResPtr.GetNumRows()>0)&&(!seid.IsVetoShield())) {
00233 MAXMSG("Calib",Msg::kWarning,10) << "StripAtten Scheme: Cannot find row for stripend "
00234 << seid.AsString() << ". Using default." << endl;
00235 IncrementErrors(kAttenCalibrator,kMissingRow,seid);
00236 }
00237 atten = fDefaultAtten;
00238 }
00239
00240 // The correction is for the center of the strip to the new position
00241 // on the strip.
00242
00243 float a = atten->GetAttenuation(halfgreen);
00244 FloatErr b = atten->GetAttenuation(wlsLen);
00245 b.SetError( fabs( b.GetValue() - atten->GetAttenuation(wlsLen - stripX.GetError()) ) );
00246
00247 if(a < 4e-10) {
00248 MAXMSG("Calib",Msg::kWarning,10)
00249 << "StripAtten Scheme: caught a divide-by-zero error on " << seid.AsString() << endl;
00250 IncrementErrors(kAttenCalibrator,kFPE,seid);
00251 return sigmap * FloatErr(1,0.5);
00252 }
00253
00254 // New, March 2007. NJT, JL
00255 // Clamp the correction at the near end to be less that a factor of 10
00256 FloatErr ratio = b/a;
00257 if(ratio > 10.) ratio = FloatErr(10.,fabs(10.-ratio.GetValue()));
00258
00259 return sigmap * ratio;
00260 }
|
|
|
Reimplemented from CalScheme. Definition at line 45 of file StripAttenCalScheme.cxx. References VldContext::AsString(), fResPtr, fTask, DbiResultPtr< T >::GetNumRows(), CalScheme::IncrementErrors(), MAXMSG, MSG, and DbiResultPtr< T >::NewQuery(). 00046 {
00047 MSG("Calib",Msg::kVerbose) << "StripAttenCalScheme::DoReset(VldContext) Task: " << fTask << endl;
00048
00049 fResPtr.NewQuery(vc,fTask);
00050 if(fResPtr.GetNumRows()==0) {
00051 MAXMSG("Calib",Msg::kWarning,10)
00052 << "StripAtten Scheme: No rows found for CALSTRIPATTEN database table"
00053 << vc.AsString() << ".\n";
00054 IncrementErrors(kAttenCalibrator,kMissingTable);
00055 }
00056 }
|
|
||||||||||||||||
|
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) Reimplemented from CalScheme. Definition at line 104 of file StripAttenCalScheme.cxx. References PlexStripEndId::AsString(), PlexStripEndId::BuildPlnStripEndKey(), FloatErr, fResPtr, CalStripAtten::GetAttenuation(), CalScheme::GetContext(), PlexStripEndId::GetEnd(), ValueErr< T >::GetError(), UgliStripHandle::GetHalfLength(), DbiResultPtr< T >::GetNumRows(), DbiResultPtr< T >::GetRowByIndex(), UgliGeomHandle::GetStripHandle(), ValueErr< T >::GetValue(), CalScheme::IncrementErrors(), PlexPlaneId::IsVetoShield(), MAXMSG, MSG, ValueErr< T >::SetError(), Particle::Sign(), and UgliStripHandle::WlsPigtail(). 00107 {
00117 // This bit ripped from the old StripCalibrator:
00118 // Change from 'stripX' to 'length of green fibre'
00119
00120 UgliGeomHandle ugli(GetContext());
00121 UgliStripHandle ustrip = ugli.GetStripHandle(seid);
00122
00123 float outside = fabs(stripX) - ustrip.GetHalfLength();
00124 if(outside>0) {
00125 if(outside > 10.0*Munits::cm) {
00126 MSG("Calib",Msg::kDebug)
00127 << "Reconstruction asked for non-physical attenuation correction: "
00128 << seid.AsString()
00129 << endl
00130 << "halflen=" << ustrip.GetHalfLength()
00131 << " requested=" << stripX
00132 << " ... trimming to physical bounds now..."
00133 << endl;
00134 IncrementErrors(kAttenCalibrator,kBadInput);
00135 }
00136 // Trim it.
00137 stripX = TMath::Sign(ustrip.GetHalfLength(),stripX);
00138 }
00139
00140 double halfgreen = ustrip.GetHalfLength() + ustrip.WlsPigtail(seid.GetEnd());
00141 double wlsLen = halfgreen;
00142 if(seid.GetEnd()==StripEnd::kPositive) wlsLen -= stripX;
00143 if(seid.GetEnd()==StripEnd::kNegative) wlsLen += stripX;
00144 // If not +ve or -ve, do nothing.
00145
00146 const CalStripAtten* atten = fResPtr.GetRowByIndex(seid.BuildPlnStripEndKey());
00147 if(atten==0) {
00148 if((fResPtr.GetNumRows()>0)&&(!seid.IsVetoShield())) {
00149 MAXMSG("Calib",Msg::kWarning,10) << "StripAtten Scheme: Cannot find row for stripend "
00150 << seid.AsString() << ". Using default." << endl;
00151 IncrementErrors(kAttenCalibrator,kMissingRow,seid);
00152 }
00153 atten = fDefaultAtten;
00154 }
00155
00156 // The correction is for the center of the strip to the new position
00157 // on the strip.
00158
00159 float a = atten->GetAttenuation(halfgreen);
00160 FloatErr b = atten->GetAttenuation(wlsLen);
00161 b.SetError( fabs( b.GetValue() - atten->GetAttenuation(wlsLen - stripX.GetError()) ) );
00162
00163 if ( b < 4.0e-10 ) {
00164 // The value of "b" gets raised to the 4-th power in
00165 // the error calculation of a/b. We cut below 4.0e-10 because it
00166 // is ~(1.175e-38)^(1/4) where that is the smallest representable
00167 // value for a Float_t; smaller values underflow to zero and are
00168 // then used as a denominator.
00169 MAXMSG("Calib",Msg::kWarning,10)
00170 << "StripAtten Scheme: caught a divide-by-zero error on "
00171 << seid.AsString() << endl;
00172 IncrementErrors(kAttenCalibrator,kFPE,seid);
00173 return sigcorr * FloatErr(1,0.5);
00174 }
00175
00176 // New, March 2007. NJT, JL
00177 // Clamp the correction at the near end to be less that a factor of 10
00178 FloatErr ratio = a/b;
00179 if(ratio < 0.1) ratio = FloatErr(0.1,fabs(0.1-ratio.GetValue()));
00180
00181 return sigcorr * ratio;
00182 }
|
|
|
Prints out the current configuration status Should be overridden by implimentation. Reimplemented from CalScheme. Definition at line 92 of file StripAttenCalScheme.cxx. References fDefaultAtten, fTask, CalStripAtten::GetFrac1(), CalStripAtten::GetLambda1(), and CalStripAtten::GetLambda2(). 00093 {
00094 os << " (NEW attenuation calibration scheme) " << endl;
00095 os << " Task = " << fTask << endl;
00096 os << " Default attenuation is "
00097 << "F12 = " << fDefaultAtten->GetFrac1() << "\t"
00098 << "Lambda1 = " << fDefaultAtten->GetLambda1() << "\t"
00099 << "Lambda2 = " << fDefaultAtten->GetLambda2() << endl;
00100 }
|
|
|
Definition at line 42 of file StripAttenCalScheme.h. Referenced by ConfigModified(), and PrintConfig(). |
|
|
Definition at line 40 of file StripAttenCalScheme.h. Referenced by DecalAttenCorrected(), DoReset(), and GetAttenCorrected(). |
|
|
Definition at line 41 of file StripAttenCalScheme.h. Referenced by ConfigModified(), DoReset(), and PrintConfig(). |
1.3.9.1