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

|
|
Definition at line 23 of file PulserSigLinCalScheme.cxx. References MSG, and Registry::Set(). 00024 {
00025 MSG("Calib",Msg::kVerbose)
00026 << "PulserSigLinCalScheme::PulserSigLinCalScheme"
00027 << endl;
00028
00029 Registry r;
00030 r.Set("CalMode",1);
00031 r.Set("MinNumPulses",500);
00032 r.Set("VATemperatureCalibration","off");
00033 InitializeConfig(r);
00034
00035 fRefTemp = 18.0; //reference temperature
00036 fVATempCorFactor = -0.0022; //frac diff in VA electronics response with temp
00037 }
|
|
||||||||||||
|
Definition at line 407 of file PulserSigLinCalScheme.cxx. References PulserSigLinCalScheme::Drift::adc, CalLinearity::ADCtoLin(), ApplyCalib(), PlexStripEndId::BuildPlnStripEndKey(), fLinearity, FloatErr, CalScheme::GetContext(), GetDriftPoint(), DbiResultPtr< T >::GetRowByIndex(), GetVATemperatureCorrection(), CalScheme::IncrementErrors(), MAXMSG, PulserSigLinCalScheme::Drift::pin, PulserSigLinCalScheme::Drift::refadc, and PulserSigLinCalScheme::Drift::refpin. Referenced by GetDriftCorrected(). 00409 {
00410 // Curve is parameterised by the numbers in the nonlinearity table.
00411 // We call the ADCtoLin method of the linearity table, with the
00412 // mode from fCalMode. This returns a number in the arbitrary linear
00413 // scale for that stripend, LIN.
00414
00415 // Also call ADCtoLin with the drift point PMT adc, to get the drift
00416 // point in the magic linear scale, DLIN.
00417
00418 // so do LIN/DLIN * DPIN to give linear, drift corrected PIN units,
00419 // then multiply by REFADC/REFPIN to give an ADC count again.
00420
00421 // We'll probably want to cache DLIN at some point.
00422
00423 const CalLinearity *linearity =
00424 fLinearity.GetRowByIndex(seid.BuildPlnStripEndKey());
00425 if (linearity==0) {
00426 MAXMSG("Calib",Msg::kWarning,20)
00427 << "No Linearity table for StripEnd " << seid
00428 << " (indexed as " << seid.BuildPlnStripEndKey() << " )\n";
00429 MAXMSG("Calib",Msg::kWarning,20)
00430 <<"Defaulting to linear assumption\n";
00431
00432 IncrementErrors(kLinCalibrator,kMissingRow,seid);
00433 return ApplyCalib(rawcharge,seid);
00434 }
00435
00436 //check for VA temperature correction and that channel is VA:
00437 double tempCor = 1.0;
00438 if(fDoTempCal) {
00439 PlexHandle ph(GetContext());
00440 //if(ph.GetRawChannelId(seid).GetElecType()==ElecType::kVA ||
00441 // this->CalDet2003Check())
00442 tempCor = GetVATemperatureCorrection();
00443 }
00444
00445 // Get drift bits
00446 Drift d = GetDriftPoint(seid);
00447 if (d.adc > 0) {
00448 float lin = linearity->ADCtoLin(rawcharge);
00449 float dlin = linearity->ADCtoLin(d.adc);
00450
00451 //if (d.adc!=dlin) cout<<"Drift "<<d.adc<<" "<<dlin<<endl;
00452
00453 return lin/dlin * d.pin * linearity->ADCtoLin(d.refadc)/d.refpin * tempCor;
00454 // return rawcharge/d.adc * d.pin * d.refadc/d.refpin;
00455 }
00456 else {
00457 MAXMSG("Calib",Msg::kWarning,20)
00458 << "No drift point for StripEnd " << seid
00459 << " so NOT CALIBRATING THIS CHANNEL\n";
00460 IncrementErrors(kLinCalibrator,kMissingRow,seid);
00461 return rawcharge * FloatErr(1.0,0.5); // Add 50% error
00462 }
00463 }
|
|
||||||||||||
|
Definition at line 188 of file PulserSigLinCalScheme.cxx. References PulserSigLinCalScheme::Drift::adc, PlexStripEndId::AsString(), FloatErr, CalScheme::GetContext(), GetDriftPoint(), GetVATemperatureCorrection(), CalScheme::IncrementErrors(), MAXMSG, PulserSigLinCalScheme::Drift::pin, PulserSigLinCalScheme::Drift::refadc, and PulserSigLinCalScheme::Drift::refpin. Referenced by ApplyBendyCalib(), and GetDriftCorrected(). 00190 {
00191
00192 //check for VA temperature correction and that channel is VA:
00193 FloatErr tempCor = 1.0;
00194 if(fDoTempCal) {
00195 PlexHandle ph(GetContext());
00196 //if(ph.GetRawChannelId(seid).GetElecType()==ElecType::kVA ||
00197 // this->CalDet2003Check())
00198 tempCor = GetVATemperatureCorrection();
00199 }
00200
00201 Drift d = GetDriftPoint(seid);
00202 if (d.adc > 0) {
00203 return rawcharge/d.adc * d.pin * d.refadc/d.refpin * tempCor; // Fixme: no error set
00204 }
00205 else {
00206 MAXMSG("Calib",Msg::kWarning,20)
00207 << "No drift point for StripEnd " << seid.AsString()
00208 << " so NOT CALIBRATING THIS CHANNEL\n";
00209
00210 IncrementErrors(kDriftCalibrator,kMissingRow,seid);
00211 return rawcharge * tempCor * FloatErr(1.0,0.5); // 50% error added.
00212 }
00213
00214 }
|
|
||||||||||||
|
Definition at line 216 of file PulserSigLinCalScheme.cxx. References PulserSigLinCalScheme::Drift::adc, PlexStripEndId::AsString(), FloatErr, CalScheme::GetContext(), GetDriftFar(), GetVATemperatureCorrection(), CalScheme::IncrementErrors(), MAXMSG, PulserSigLinCalScheme::Drift::pin, PulserSigLinCalScheme::Drift::refadc, and PulserSigLinCalScheme::Drift::refpin. 00218 {
00219
00220 //check for VA temperature correction and that channel is VA:
00221 FloatErr tempCor = 1.0;
00222 if(fDoTempCal) {
00223 PlexHandle ph(GetContext());
00224 //if(ph.GetRawChannelId(seid).GetElecType()==ElecType::kVA ||
00225 // this->CalDet2003Check())
00226 tempCor = GetVATemperatureCorrection();
00227 }
00228
00229 Drift d = GetDriftFar(seid);
00230 if (d.adc > 0) {
00231 return rawcharge/d.adc * d.pin * d.refadc/d.refpin * tempCor; // Fixme: no error set
00232 }
00233 else {
00234 MAXMSG("Calib",Msg::kWarning,20)
00235 << "No drift point for StripEnd " << seid.AsString()
00236 << " so NOT CALIBRATING THIS CHANNEL\n";
00237
00238 IncrementErrors(kDriftCalibrator,kMissingRow,seid);
00239 return rawcharge * tempCor * FloatErr(1.0,0.5); // Add 50% error
00240 }
00241 }
|
|
|
Definition at line 706 of file PulserSigLinCalScheme.cxx. References CalScheme::GetContext(), VldContext::GetDetector(), and VldContext::GetTimeStamp(). 00707 {
00708 const VldContext &vldc = GetContext();
00709 //is this CalDet:
00710 if(vldc.GetDetector()!=Detector::kCalDet) return false;
00711 //is this 2003:
00712 VldTimeStamp vldstart = VldTimeStamp(2003,8,22,0,0,0); //T7 Sept 2003 N/F
00713 VldTimeStamp vldend = VldTimeStamp(2003,9,26,0,0,0); //Run Nums: 70000's
00714 if(vldc.GetTimeStamp()<vldstart) return false;
00715 if(vldc.GetTimeStamp()>=vldend) return false;
00716 //must be CalDet 2003
00717 return true;
00718 }
|
|
||||||||||||
|
|
|
|
Reimplemented from CalScheme. Definition at line 65 of file PulserSigLinCalScheme.cxx. References fCalMode, fDoTempCal, fMinNumPulses, Registry::Get(), CfgPromptConfigurable::GetConfig(), and MSG. 00066 {
00067
00068 const char* str_tempcal;
00069
00070 bool ok = true;
00071 ok = ok && GetConfig().Get("CalMode", fCalMode);
00072 ok = ok && GetConfig().Get("MinNumPulses",fMinNumPulses);
00073 ok = ok && GetConfig().Get("VATemperatureCalibration",str_tempcal);
00074 if(!ok) MSG("Calib",Msg::kWarning) << "PulserSigLinCalibrator "
00075 << " Problem when configuring. " <<endl;
00076
00077 // Interpret strings.
00078 if(strcasecmp(str_tempcal,"on")==0) fDoTempCal = true;
00079 else fDoTempCal = false;
00080
00081 }
|
|
||||||||||||
|
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 Reimplemented from CalScheme. Definition at line 146 of file PulserSigLinCalScheme.cxx. 00147 {
00158
00159 //FIXME: No method yet.
00160 MSG("Calib",Msg::kWarning) << "DecalDrift method is unimplimented!" << endl;
00161 return undrifted;
00162 }
|
|
||||||||||||
|
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 Reimplemented from CalScheme. Definition at line 165 of file PulserSigLinCalScheme.cxx. 00166 {
00177
00178 //FIXME: No method yet.
00179 MSG("Calib",Msg::kWarning) << "DecalLinearity method is unimplimented!" << endl;
00180 return lin;
00181 }
|
|
|
New context. Reimplemented from CalScheme. Definition at line 40 of file PulserSigLinCalScheme.cxx. References fFarDrift, fFarDriftRef, fLinearity, fNearDrift, fNearDriftRef, fPinDrift, fPinDriftRef, DbiResultPtr< T >::GetNumRows(), CalScheme::IncrementErrors(), and DbiResultPtr< T >::NewQuery(). 00041 {
00045 fNearDriftRef.NewQuery(vc,0);
00046 fFarDriftRef.NewQuery(vc,0);
00047 fPinDriftRef.NewQuery(vc,0);
00048 fNearDrift.NewQuery(vc,0);
00049 fFarDrift.NewQuery(vc,0);
00050 fPinDrift.NewQuery(vc,0);
00051 fLinearity.NewQuery(vc,2);
00052
00053 // Don't bother with warning messages, but do increment errors.
00054
00055 if(fNearDriftRef.GetNumRows()<=0) IncrementErrors(kDriftCalibrator,kMissingTable);
00056 if(fFarDriftRef.GetNumRows()<=0) IncrementErrors(kDriftCalibrator,kMissingTable);
00057 if(fPinDriftRef.GetNumRows()<=0) IncrementErrors(kDriftCalibrator,kMissingTable);
00058 if(fNearDrift.GetNumRows()<=0) IncrementErrors(kDriftCalibrator,kMissingTable);
00059 if(fFarDrift.GetNumRows()<=0) IncrementErrors(kDriftCalibrator,kMissingTable);
00060 if(fPinDrift.GetNumRows()<=0) IncrementErrors(kDriftCalibrator,kMissingTable);
00061 if(fLinearity.GetNumRows()<=0) IncrementErrors(kLinCalibrator,kMissingTable);
00062 }
|
|
|
Definition at line 677 of file PulserSigLinCalScheme.cxx. References PulserSigLinCalScheme::Drift::adc, PulserSigLinCalScheme::Drift::pin, and PulserSigLinCalScheme::Drift::refadc. Referenced by GetDriftFar(). 00678 {
00679 Drift d;
00680 d.adc = 0;
00681 d.pin = 0;
00682 d.refadc = 0;
00683 d.pin = 0;
00684 return d;
00685 }
|
|
||||||||||||
|
Purpose: Apply drift correction In: raw adc strip end Out: drift-corrected adcs Reimplemented from CalScheme. Definition at line 99 of file PulserSigLinCalScheme.cxx. References ApplyBendyCalib(), ApplyCalib(), fCalMode, FloatErr, and MSG. 00101 {
00110
00111 // FIXME: We are applying BOTH drift and linearity here.
00112 switch (fCalMode) {
00113 case 0: // Shouldn't ever be zero, but you never know...
00114 case 1: // Mode 1: No linearity correction, just drift points
00115 return ApplyCalib(rawcharge,seid);
00116 default:
00117 // Undefined mode!
00118 MSG("Calib",Msg::kWarning)<<"PulserSigLinCalScheme doesn't understand mode "<<fCalMode<<". Defaulting to mode 2."<<endl;
00119 fCalMode = 2;
00120 case 2: // Bendy lines parameterised with a straight line and a cubic.
00121 return ApplyBendyCalib(rawcharge,seid);
00122 };
00123 }
|
|
|
Definition at line 577 of file PulserSigLinCalScheme.cxx. References PulserSigLinCalScheme::Drift::adc, PlexStripEndId::BuildPlnStripEndKey(), DriftZero(), fFarDrift, fFarDriftRef, PulserRefDriftF::GetAggregateNo(), PulserRawDriftF::GetAggregateNo(), CalScheme::GetContext(), DataUtil::GetDetector(), GetDriftPinDiodeValue(), PlexLedId::GetEncoded(), PlexLedId::GetLedInBox(), PulserRefDriftF::GetMean(), PulserRawDriftF::GetMean(), PulserRefDriftF::GetNumEntries(), PulserRawDriftF::GetNumEntries(), PlexLedId::GetPulserBox(), GetReferencePinDiodeValue(), DbiResultPtr< T >::GetRowByIndex(), CalScheme::IncrementErrors(), MAXMSG, MSG, PulserSigLinCalScheme::Drift::pin, PulserSigLinCalScheme::Drift::refadc, and PulserSigLinCalScheme::Drift::refpin. Referenced by ApplyCalibFar(), and GetDriftPoint(). 00578 {
00579 // Return drift point bits using the far end, or zeros if we can't manage it
00580 Drift drift;
00581
00582 const PulserRawDriftF *farrawdrift =
00583 fFarDrift.GetRowByIndex(seid.BuildPlnStripEndKey());
00584
00585 if(farrawdrift==0) {
00586 MAXMSG("Calib",Msg::kWarning,20)
00587 << "No Far Drift Point database row for StripEnd " << seid
00588 << " (indexed as " << seid.BuildPlnStripEndKey() << " )\n";
00589 IncrementErrors(kDriftCalibrator,kMissingRow,seid);
00590 return DriftZero(); // need to flag this as error
00591 }
00592 MSG("Calib",Msg::kDebug)
00593 << "Got Far Drift row for StripEnd " << seid
00594 << " (indexed as " << seid.BuildPlnStripEndKey() << " )"
00595 << " aggregate. " << farrawdrift->GetAggregateNo() << endl;
00596 if(farrawdrift->GetNumEntries()<fMinNumPulses) {
00597 MAXMSG("Calib",Msg::kWarning,20)
00598 << "Only " << farrawdrift->GetNumEntries() << " entries for "
00599 << seid
00600 << " (indexed as " << seid.BuildPlnStripEndKey() << " )\n";
00601 IncrementErrors(kDriftCalibrator,kDataInsufficient,seid);
00602 return DriftZero();
00603 }
00604 drift.adc = farrawdrift->GetMean();
00605 PlexLedId veryTempLedId = PlexLedId(farrawdrift->GetAggregateNo());
00606 PlexLedId tempLedId = PlexLedId(GetContext().GetDetector(),
00607 veryTempLedId.GetPulserBox(),
00608 veryTempLedId.GetLedInBox());
00609 //Now need to get PIN info.
00610 int tempWhichPin=0; // high gain pin.
00611 float tempPinValue=GetDriftPinDiodeValue(tempLedId, tempWhichPin);
00612 if(tempPinValue<=0) {
00613 tempWhichPin=1; // low gain pin.
00614 tempPinValue=GetDriftPinDiodeValue(tempLedId, tempWhichPin);
00615 if(tempPinValue<=0) {
00616 return DriftZero();
00617 }
00618 }
00619 const PulserRefDriftF *farrefdrift =
00620 fFarDriftRef.GetRowByIndex(seid.BuildPlnStripEndKey());
00621 if(farrefdrift==0) {
00622 MAXMSG("Calib",Msg::kWarning,20)
00623 << "No Far Reference Drift Point database row for StripEnd "
00624 << seid
00625 << " (indexed as " << seid.BuildPlnStripEndKey() << " )\n";
00626 return DriftZero(); // Need to add error.
00627 }
00628 MSG("Calib",Msg::kDebug)
00629 << "Got Far Reference Drift row for StripEnd " << seid
00630 << " (indexed as " << seid.BuildPlnStripEndKey() << " )"
00631 << " aggregate. " << farrawdrift->GetAggregateNo() << endl;
00632 if(farrefdrift->GetNumEntries()<fMinNumPulses) {
00633 MAXMSG("Calib",Msg::kWarning,20)
00634 << "Only " << farrefdrift->GetNumEntries()
00635 << " entries for "
00636 << seid
00637 << " (indexed as " << seid.BuildPlnStripEndKey() << " )" << endl;
00638 IncrementErrors(kDriftCalibrator,kDataInsufficient,seid);
00639 return DriftZero();
00640 }
00641 float tempRefAdcValue=farrefdrift->GetMean();
00642 PlexLedId veryTempRefLedId = PlexLedId(farrefdrift->GetAggregateNo());
00643 PlexLedId tempRefLedId = PlexLedId(GetContext().GetDetector(),
00644 veryTempRefLedId.GetPulserBox(),
00645 veryTempRefLedId.GetLedInBox());
00646 if(tempRefLedId.GetEncoded()!=tempLedId.GetEncoded()) {
00647 MSG("Calib",Msg::kWarning)
00648 << "The drift point led is: " << tempLedId
00649 << " the reference led is: " << tempRefLedId
00650 << " for " << seid << " (indexed as "
00651 << seid.BuildPlnStripEndKey() << ")\t"
00652 << " Oh what to do!!!\n";
00653 IncrementErrors(kDriftCalibrator,kGeneralErr,seid);
00654 return DriftZero();
00655 }
00656 float tempRefPinValue=GetReferencePinDiodeValue(tempRefLedId, tempWhichPin);
00657 if(tempRefPinValue<=0) {
00658 if(tempWhichPin==0) {
00659 tempWhichPin=1; // low gain pin.
00660 tempPinValue=GetDriftPinDiodeValue(tempLedId, tempWhichPin);
00661 if(tempPinValue<=0) {
00662 return DriftZero();
00663 }
00664 tempRefPinValue=GetReferencePinDiodeValue(tempRefLedId, tempWhichPin);
00665 if(tempRefPinValue<=0) {
00666 return DriftZero();
00667 }
00668 }
00669 }
00670 if (drift.adc <1) return DriftZero();
00671 drift.pin = tempPinValue;
00672 drift.refadc = tempRefAdcValue;
00673 drift.refpin = tempRefPinValue;
00674 return drift;
00675 }
|
|
||||||||||||
|
Definition at line 244 of file PulserSigLinCalScheme.cxx. References FloatErr, fPinDrift, CalScheme::GetContext(), PulserRawDriftPin::GetMean(), PulserRawDriftPin::GetNumEntries(), DbiResultPtr< T >::GetNumRows(), PlexHandle::GetPinDiodeIds(), DbiResultPtr< T >::GetRowByIndex(), CalScheme::IncrementErrors(), and MSG. Referenced by GetDriftFar(), and GetDriftPoint(). 00245 {
00246
00247 PlexHandle ph(GetContext());
00248 std::pair<PlexPinDiodeId,PlexPinDiodeId> myPins =
00249 ph.GetPinDiodeIds(ledid); // hi, low
00250 //myGetPinDiodeIds(GetContext(),ledid);
00251 //cout << ledid << "\t" << myPins.first << endl;
00252
00253 if(highOrLow==0) {//high ==0 low ==1
00254 const PulserRawDriftPin *highpin =fPinDrift.GetRowByIndex(myPins.first.GetEncoded());
00255 if(highpin==0) {
00256
00257 MSG("Calib",Msg::kWarning)
00258 << "No Drift Point database row for Pin " << myPins.first
00259 << " (indexed as " << myPins.first.GetEncoded() << " there are "
00260 << fPinDrift.GetNumRows() << " rows\n.";
00261 IncrementErrors(kDriftCalibrator,kMissingRow,ledid);
00262
00263 // for ( UInt_t irow = 0; irow < fPinDrift.GetNumRows(); irow++) {
00264 // const PulserRawDriftPin* ddd1 = fPinDrift.GetRow(irow);
00265 // cout << "Bastard: " << ddd1->GetIndex(1) << endl;
00266 // }
00267
00268 // Process row.
00269
00270
00271
00272
00273 return -1;
00274 }
00275 else {
00276 MSG("Calib",Msg::kDebug)
00277 << "Got Drift Point database row for Pin " << myPins.first
00278 << " (indexed as " << myPins.first.GetEncoded() << " )\n";
00279
00280 if(highpin->GetNumEntries()<fMinNumPulses) {
00281 MSG("Calib",Msg::kWarning)
00282 << "Only " << highpin->GetNumEntries() << " entries for "
00283 << myPins.first
00284 << " (indexed as " << myPins.first.GetEncoded() << " )" << endl;
00285 return -1;
00286 }
00287 return highpin->GetMean();
00288 }
00289 }
00290 else if(highOrLow==1) { //low gain pin
00291 const PulserRawDriftPin *lowpin =fPinDrift.GetRowByIndex(myPins.second.GetEncoded());
00292 if(lowpin==0) {
00293
00294 MSG("Calib",Msg::kWarning)
00295 << "No Drift Point database row for Pin " << myPins.second
00296 << " (indexed as " << myPins.second.GetEncoded() << " )\n";
00297 return -1;
00298 }
00299 else {
00300 MSG("Calib",Msg::kDebug)
00301 << "Got Drift Point database row for Pin " << myPins.second
00302 << " (indexed as " << myPins.second.GetEncoded() << " )\n";
00303
00304 if(lowpin->GetNumEntries()<fMinNumPulses) {
00305 MSG("Calib",Msg::kWarning)
00306 << "Only " << lowpin->GetNumEntries() << " entries for "
00307 << myPins.second
00308 << " (indexed as " << myPins.second.GetEncoded() << " )" << endl;
00309 return -1;
00310 }
00311 return lowpin->GetMean();
00312 }
00313 }
00314
00315 return -1;
00316 }
|
|
|
Definition at line 466 of file PulserSigLinCalScheme.cxx. References PulserSigLinCalScheme::Drift::adc, PlexStripEndId::BuildPlnStripEndKey(), fNearDrift, fNearDriftRef, PulserRefDrift::GetAggregateNo(), PulserRawDrift::GetAggregateNo(), CalScheme::GetContext(), DataUtil::GetDetector(), GetDriftFar(), GetDriftPinDiodeValue(), PlexLedId::GetEncoded(), PlexLedId::GetLedInBox(), PulserRefDrift::GetMean(), PulserRawDrift::GetMean(), PulserRefDrift::GetNumEntries(), PulserRawDrift::GetNumEntries(), PlexLedId::GetPulserBox(), GetReferencePinDiodeValue(), DbiResultPtr< T >::GetRowByIndex(), CalScheme::IncrementErrors(), MAXMSG, MSG, PulserSigLinCalScheme::Drift::pin, PulserSigLinCalScheme::Drift::refadc, and PulserSigLinCalScheme::Drift::refpin. Referenced by ApplyBendyCalib(), and ApplyCalib(). 00467 {
00468 Drift drift;
00469
00470 const PulserRawDrift *nearrawdrift =
00471 fNearDrift.GetRowByIndex(seid.BuildPlnStripEndKey());
00472 if(nearrawdrift==0) {
00473 MAXMSG("Calib",Msg::kWarning,20)
00474 << "No Near Drift Point database row for StripEnd " << seid
00475 << " (indexed as " << seid.BuildPlnStripEndKey() << " )\n";
00476 IncrementErrors(kDriftCalibrator,kMissingRow,seid);
00477 return GetDriftFar(seid);
00478 }
00479 MSG("Calib",Msg::kDebug)
00480 << "Got Near Drift row for StripEnd " << seid
00481 << " (indexed as " << seid.BuildPlnStripEndKey() << " )"
00482 << " aggregate. " << nearrawdrift->GetAggregateNo() << endl;
00483 if(nearrawdrift->GetNumEntries()<fMinNumPulses) {
00484 MAXMSG("Calib",Msg::kWarning,20)
00485 << "Only " << nearrawdrift->GetNumEntries() << " entries for "
00486 << seid
00487 << " (indexed as " << seid.BuildPlnStripEndKey() << " )" << endl;
00488 IncrementErrors(kDriftCalibrator,kDataInsufficient,seid);
00489 return GetDriftFar(seid);
00490 }
00491
00492 drift.adc = nearrawdrift->GetMean();
00493 if (drift.adc<1) return GetDriftFar(seid);
00494 if (drift.adc>8000) {
00495 // If the near side has a big number, try to use the far side.
00496 // If the far side doesn't have data, we'll have to use the near side,
00497 // even though it's a big number.
00498 Drift fardrift = GetDriftFar(seid);
00499 if (fardrift.adc>0) return fardrift;
00500 }
00501
00502 PlexLedId veryTempLedId = PlexLedId(nearrawdrift->GetAggregateNo());
00503 PlexLedId tempLedId = PlexLedId(GetContext().GetDetector(),
00504 veryTempLedId.GetPulserBox(),
00505 veryTempLedId.GetLedInBox());
00506 //Now need to get PIN info.
00507 int tempWhichPin=0; // high gain pin.
00508 float tempPinValue=GetDriftPinDiodeValue(tempLedId, tempWhichPin);
00509 if(tempPinValue<=0) {
00510 tempWhichPin=1; // low gain pin.
00511 tempPinValue=GetDriftPinDiodeValue(tempLedId, tempWhichPin);
00512 if(tempPinValue<=0) {
00513 return GetDriftFar(seid);
00514 }
00515 }
00516
00517 const PulserRefDrift *nearrefdrift =
00518 fNearDriftRef.GetRowByIndex(seid.BuildPlnStripEndKey());
00519 if(nearrefdrift==0) {
00520 MAXMSG("Calib",Msg::kWarning,20)
00521 << "No Near Reference Drift Point database row for StripEnd "
00522 << seid
00523 << " (indexed as " << seid.BuildPlnStripEndKey() << " )\n";
00524 IncrementErrors(kDriftCalibrator,kMissingRow,seid);
00525 return GetDriftFar(seid);
00526 }
00527 MSG("Calib",Msg::kDebug)
00528 << "Got Near Reference Drift row for StripEnd " << seid
00529 << " (indexed as " << seid.BuildPlnStripEndKey() << " )"
00530 << " aggregate. " << nearrawdrift->GetAggregateNo() << endl;
00531 if(nearrefdrift->GetNumEntries()<fMinNumPulses) {
00532 MAXMSG("Calib",Msg::kWarning,20)
00533 << "Only " << nearrefdrift->GetNumEntries()
00534 << " entries for "
00535 << seid
00536 << " (indexed as " << seid.BuildPlnStripEndKey() << " )\n";
00537 IncrementErrors(kDriftCalibrator,kDataInsufficient,seid);
00538 return GetDriftFar(seid);
00539 }
00540 float tempRefAdcValue=nearrefdrift->GetMean();
00541 PlexLedId veryTempRefLedId = PlexLedId(nearrefdrift->GetAggregateNo());
00542 PlexLedId tempRefLedId = PlexLedId(GetContext().GetDetector(),
00543 veryTempRefLedId.GetPulserBox(),
00544 veryTempRefLedId.GetLedInBox());
00545 if(tempRefLedId.GetEncoded()!=tempLedId.GetEncoded()) {
00546 MSG("Calib",Msg::kWarning)
00547 << "The drift point led is: " << tempLedId
00548 << " the reference led is: " << tempRefLedId
00549 << " for " << seid << " (indexed as "
00550 << seid.BuildPlnStripEndKey() << ")\t"
00551 << " Oh what to do!!!\n";
00552 IncrementErrors(kDriftCalibrator,kGeneralErr);
00553 return GetDriftFar(seid);
00554 }
00555 float tempRefPinValue=GetReferencePinDiodeValue(tempRefLedId, tempWhichPin);
00556 if(tempRefPinValue<=0) {
00557 if(tempWhichPin==0) {
00558 tempWhichPin=1; // low gain pin.
00559 tempPinValue=GetDriftPinDiodeValue(tempLedId, tempWhichPin);
00560 if(tempPinValue<=0) {
00561 return GetDriftFar(seid);
00562 }
00563 tempRefPinValue=GetReferencePinDiodeValue(tempRefLedId, tempWhichPin);
00564 if(tempRefPinValue<=0) {
00565 return GetDriftFar(seid);
00566 }
00567 }
00568 }
00569 drift.pin = tempPinValue;
00570 drift.refadc = tempRefAdcValue;
00571 drift.refpin = tempRefPinValue;
00572 return drift;
00573
00574 }
|
|
||||||||||||
|
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 127 of file PulserSigLinCalScheme.cxx. References FloatErr. 00129 {
00140
00141 // FIXME: Linearity is applied at the drift stage. This is wrong.
00142 return sigdrift;
00143 }
|
|
||||||||||||
|
Definition at line 320 of file PulserSigLinCalScheme.cxx. References FloatErr, fPinDriftRef, CalScheme::GetContext(), PulserRefDriftPin::GetMean(), PulserRefDriftPin::GetNumEntries(), PlexHandle::GetPinDiodeIds(), DbiResultPtr< T >::GetRowByIndex(), CalScheme::IncrementErrors(), MAXMSG, and MSG. Referenced by GetDriftFar(), and GetDriftPoint(). 00321 {
00322
00323 PlexHandle ph(GetContext());
00324 std::pair<PlexPinDiodeId,PlexPinDiodeId> myPins =
00325 ph.GetPinDiodeIds(ledid); // hi, low
00326 //myGetPinDiodeIds(GetContext(),ledid);
00327
00328 if(highOrLow==0) {//high ==0 low ==1
00329 const PulserRefDriftPin *highpin =fPinDriftRef.GetRowByIndex(myPins.first.GetEncoded());
00330 if(highpin==0) {
00331
00332 MAXMSG("Calib",Msg::kWarning,20)
00333 << "No Reference Point database row for Pin " << myPins.first
00334 << " (indexed as " << myPins.first.GetEncoded() << " )\n";
00335 IncrementErrors(kDriftCalibrator,kMissingRow,ledid);
00336 return -1;
00337 }
00338 else {
00339 MSG("Calib",Msg::kDebug)
00340 << "Got Reference Point database row for Pin " << myPins.first
00341 << " (indexed as " << myPins.first.GetEncoded() << " )\n";
00342
00343 if(highpin->GetNumEntries()<fMinNumPulses) {
00344 MSG("Calib",Msg::kWarning)
00345 << "Only " << highpin->GetNumEntries() << " entries for "
00346 << myPins.first
00347 << " (indexed as " << myPins.first.GetEncoded() << " )" << endl;
00348 IncrementErrors(kDriftCalibrator,kDataInsufficient,ledid);
00349 return -1;
00350 }
00351 return highpin->GetMean();
00352 }
00353 }
00354 else if(highOrLow==1) { //low gain pin
00355 const PulserRefDriftPin *lowpin =fPinDriftRef.GetRowByIndex(myPins.second.GetEncoded());
00356 if(lowpin==0) {
00357 MSG("Calib",Msg::kWarning)
00358 << "No Reference Point database row for Pin " << myPins.second
00359 << " (indexed as " << myPins.second.GetEncoded() << " )\n";
00360 IncrementErrors(kDriftCalibrator,kMissingRow,ledid);
00361 return -1;
00362 }
00363 else {
00364 MSG("Calib",Msg::kDebug)
00365 << "Got Reference Point database row for Pin " << myPins.second
00366 << " (indexed as " << myPins.second.GetEncoded() << " )\n";
00367
00368 if(lowpin->GetNumEntries()<fMinNumPulses) {
00369 MSG("Calib",Msg::kWarning)
00370 << "Only " << lowpin->GetNumEntries() << " entries for "
00371 << myPins.second
00372 << " (indexed as " << myPins.second.GetEncoded() << " )" <<endl;
00373 IncrementErrors(kDriftCalibrator,kDataInsufficient,ledid);
00374 return -1;
00375 }
00376 return lowpin->GetMean();
00377 }
00378 }
00379 return -1;
00380 }
|
|
|
Definition at line 688 of file PulserSigLinCalScheme.cxx. References FloatErr, fRefTemp, fVATempCorFactor, Calibrator::GetTemperature(), Calibrator::Instance(), and MSG. Referenced by ApplyBendyCalib(), ApplyCalib(), and ApplyCalibFar(). 00689 {
00690 //======================================================================
00691 // Purpose: Do VA temperature correction
00692 //======================================================================
00693
00694 float temp = Calibrator::Instance().GetTemperature();
00695
00696 float correction = 1 - fVATempCorFactor * (fRefTemp - temp);
00697
00698 return 1./correction;
00699
00700 MSG("Calib",Msg::kVerbose) << "Got Temperature Correction of: "
00701 << correction << endl;
00702
00703 }
|
|
|
Prints out the current configuration status Should be overridden by implimentation. Reimplemented from CalScheme. Definition at line 83 of file PulserSigLinCalScheme.cxx. References fCalMode, fMinNumPulses, fRefTemp, and fVATempCorFactor. 00084 {
00085 os << " CalMode: " << fCalMode << endl;
00086 os << " MinNumPulses: " << fMinNumPulses << endl;
00087 os << " VA Temperature calibration is " << ((fDoTempCal)?"on":"off") << endl;
00088 if(fDoTempCal) {
00089 os << " VA Temp Correction Factor = 1 / [ 1 - "
00090 << fVATempCorFactor << "*("
00091 << fRefTemp << " - temp) ]" << endl;
00092 }
00093
00094 }
|
|
|
Definition at line 70 of file PulserSigLinCalScheme.h. Referenced by ConfigModified(), GetDriftCorrected(), and PrintConfig(). |
|
|
Definition at line 47 of file PulserSigLinCalScheme.h. Referenced by ConfigModified(). |
|
|
Definition at line 66 of file PulserSigLinCalScheme.h. Referenced by DoReset(), and GetDriftFar(). |
|
|
Definition at line 63 of file PulserSigLinCalScheme.h. Referenced by DoReset(), and GetDriftFar(). |
|
|
Definition at line 68 of file PulserSigLinCalScheme.h. Referenced by ApplyBendyCalib(), and DoReset(). |
|
|
Definition at line 81 of file PulserSigLinCalScheme.h. Referenced by ConfigModified(), and PrintConfig(). |
|
|
Definition at line 65 of file PulserSigLinCalScheme.h. Referenced by DoReset(), and GetDriftPoint(). |
|
|
Definition at line 62 of file PulserSigLinCalScheme.h. Referenced by DoReset(), and GetDriftPoint(). |
|
|
Definition at line 67 of file PulserSigLinCalScheme.h. Referenced by DoReset(), and GetDriftPinDiodeValue(). |
|
|
Definition at line 64 of file PulserSigLinCalScheme.h. Referenced by DoReset(), and GetReferencePinDiodeValue(). |
|
|
Definition at line 50 of file PulserSigLinCalScheme.h. Referenced by GetVATemperatureCorrection(), and PrintConfig(). |
|
|
Definition at line 51 of file PulserSigLinCalScheme.h. Referenced by GetVATemperatureCorrection(), and PrintConfig(). |
1.3.9.1