AlgDigit Class Reference

#include <AlgDigit.h>

Inheritance diagram for AlgDigit:
AlgBase

List of all members.

Public Member Functions

 AlgDigit ()
virtual ~AlgDigit ()
virtual void RunAlg (AlgConfig &ac, CandHandle &ch, CandContext &cx)
virtual void Trace (const char *c) const

Detailed Description

Definition at line 16 of file AlgDigit.h.


Constructor & Destructor Documentation

AlgDigit::AlgDigit (  ) 

Definition at line 34 of file AlgDigit.cxx.

00035 {
00036 }

AlgDigit::~AlgDigit (  )  [virtual]

Definition at line 39 of file AlgDigit.cxx.

00040 {
00041 }


Member Function Documentation

void AlgDigit::RunAlg ( AlgConfig ac,
CandHandle ch,
CandContext cx 
) [virtual]

Implements AlgBase.

Definition at line 44 of file AlgDigit.cxx.

References digit(), RawDigit::GetADC(), CandContext::GetCandRecord(), RawDigit::GetChannel(), RawDigit::GetCrateT0(), CandContext::GetDataIn(), RawChannelId::GetElecType(), RawDigit::GetErrorCode(), PlexHandle::GetSEIdAltL(), RawDigit::GetTDC(), Calibrator::GetTimeFromTDC(), VldContext::GetTimeStamp(), RecMinos::GetVldContext(), Calibrator::Instance(), Msg::kDebug, ElecType::kQIE, MSG, Munits::ns, and Munits::s.

00046 {
00047 
00048 #ifdef ENABLE_DEBUG_MSG
00049    MSG("Alg", Msg::kDebug) << "Starting AlgDigit::RunAlg()" << endl;
00050 #endif
00051 
00052    assert(ch.InheritsFrom("CandDigitHandle"));
00053    CandDigitHandle &cdh = (CandDigitHandle &) ch;
00054 
00055    const RawDigit *digit =
00056                         dynamic_cast<const RawDigit *> (cx.GetDataIn());
00057    assert(digit);
00058 
00059    const Calibrator& cal = Calibrator::Instance();
00060    
00061    const RawChannelId digitRCId = digit->GetChannel();
00062 
00063 // Get VldContext
00064    const VldContext &vldc = *(cx.GetCandRecord()->GetVldContext());
00065 
00066 // Use CandDigitHandle methods to set CandDigit member variables.
00067    cdh.SetChannelId(digitRCId);
00068 
00069 // Take off a 50 ADC offset from QIE channels.
00070    Double_t adc_offset  = 0.;
00071    if (digitRCId.GetElecType()==ElecType::kQIE) {
00072      adc_offset = 50.;
00073      cdh.SetQieErrorBits(digit->GetErrorCode());
00074    }
00075    else
00076      cdh.SetVaErrorBits(digit->GetErrorCode());
00077 
00078 // Set charge to offset-subtracted ADC value ( ~60. * p.e. )
00079    cdh.SetCharge(((Double_t) digit->GetADC()) - adc_offset);
00080 
00081 // Convert TDC counts to Double_t.  Don't subtract Trigger time offset.
00082    Double_t t = cal.
00083                  GetTimeFromTDC(digit->GetTDC(), digitRCId);
00084 
00085 // Add CrateT0 (A.Weber)
00086 // this is needed to account for the counter->reset hold-off during the spill
00087 //---
00088 // Removed again my N.Tagg. This does the wrong thing in 99.9% of all cases,
00089 // as documented in Doc-DB 1870.  
00090 //---
00091 // RWH 2013-05-28 note
00092 // After discussion w/ Phil Adamson, I better understand the confusion
00093 // about the use of crate_t0.  To get a distribution of digits with 
00094 // a 10us width at a constant offset from VldContext's VldTimeStamp
00095 // it looks like one must add in the crate_t0.  But this *isn't* because
00096 // digits are time since crate_t0, but it appears to be because 
00097 // VldContext's timestamp had crate_t0 (incorrectly) subtracted from the 
00098 // real time in the *offline* code.
00099 // kMdBlockCrateReadout
00100 // See:   components/tp/tpTrigger/createBlockSnarlHeader.c
00101 //     uses getTimeFrameCounterZeroTime()  in tpTimeFrameParameters.c
00102 // which states:
00103 //    /* Counter reset and TF start assumed the same */
00104 // createBlockSnarlHeader called by tpTimeFrameProcess.c
00105 // similarly the createBlockCrateReadout.c uses getTimeFrameCounterZeroTime()
00106 // to create kMdBlockCrateReadout blocks (== RawDigitDataBlock in offline)
00107 //---
00108 //   t += (digit->GetCrateT0()).GetNanoSec() * Munits::ns;
00109 
00110 
00111 // And account for snarls overlapping 1 sec boundary. (A.Weber)
00112 // This assumes that the crate t0 is the t0 coresponding to the hit.
00113 // t now be <0 or >1
00114    t += ( (digit->GetCrateT0()).GetSec() -
00115           (vldc.GetTimeStamp()).GetSec() ) * Munits::s;
00116 
00117 #ifdef ENABLE_DEBUG_MSG
00118    MSG("Alg", Msg::kDebug) << "rdid = " << digitRCId << endl
00119                         << "    tdc = " << digit->GetTDC() << " nsec = "
00120    << cal.GetTimeFromTDC(digit->GetTDC(),
00121                   digitRCId) << " t = " << t << endl << "    CrT0_ns = "
00122                         << (digit->GetCrateT0()).GetNanoSec()*Munits::ns
00123                        << " CrT0_s = " << (digit->GetCrateT0()).GetSec()
00124           << " TrigTime_s = " << (vldc.GetTimeStamp()).GetSec() << endl;
00125 #endif
00126 
00127    cdh.SetTime(t);
00128 
00129 // Get a PlexHandle for PlexStripEndId to RawChannelId conversions
00130    PlexHandle ph(vldc);
00131 
00132 // Fill and calibrate PlexSEIdAltL
00133    PlexSEIdAltL altlist =
00134                       ph.GetSEIdAltL(digitRCId, &cal,
00135                       (int)(digit->GetADC()-adc_offset), cdh.GetTime());
00136 
00137    cdh.SetPlexSEIdAltL(altlist);
00138 }

void AlgDigit::Trace ( const char *  c  )  const [virtual]

Reimplemented from AlgBase.

Definition at line 141 of file AlgDigit.cxx.

00142 {
00143 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1