Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

AlgDigit.cxx

Go to the documentation of this file.
00001 
00002 // $Id: AlgDigit.cxx,v 1.26 2009/10/12 18:39:08 tagg Exp $
00003 //
00004 // AlgDigit.cxx
00005 //
00006 // AlgDigit is a concrete Digit Algorithm class.
00007 //
00008 // Author:  G. Irwin 4/2000
00010 
00011 #include <cassert>
00012 
00013 #include "Calibrator/Calibrator.h"
00014 #include "CandData/CandRecord.h"
00015 #include "CandDigit/AlgDigit.h"
00016 #include "CandDigit/CandDigitHandle.h"
00017 #include "Candidate/CandContext.h"
00018 #include "Conventions/Munits.h"
00019 #include "MessageService/MsgService.h"
00020 #include "Plex/PlexHandle.h"
00021 #include "Plex/PlexSEIdAltL.h"
00022 #include "RawData/RawChannelId.h"
00023 #include "RawData/RawDigit.h"
00024 #include "RawData/RawHeader.h"
00025 #include "RawData/RawRecord.h"
00026 #include "Validity/VldContext.h"
00027 
00028 ClassImp(AlgDigit)
00029 
00030 //______________________________________________________________________
00031 //CVSID("$Id: AlgDigit.cxx,v 1.26 2009/10/12 18:39:08 tagg Exp $");
00032 
00033 //______________________________________________________________________
00034 AlgDigit::AlgDigit()
00035 {
00036 }
00037 
00038 //______________________________________________________________________
00039 AlgDigit::~AlgDigit()
00040 {
00041 }
00042 
00043 //______________________________________________________________________
00044 void AlgDigit::RunAlg(AlgConfig & /* ac */, CandHandle &ch,
00045                                                         CandContext &cx)
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 // Removed again my N.Tagg. This does the wrong thing in 99.9% of all cases,
00088 // as documented in Doc-DB 1870.  
00089 //   t += (digit->GetCrateT0()).GetNanoSec() * Munits::ns;
00090 
00091 // And account for snarls overlapping 1 sec boundary. (A.Weber)
00092 // This assumes that the crate t0 is the t0 coresponding to the hit.
00093 // t now be <0 or >1
00094    t += ( (digit->GetCrateT0()).GetSec() -
00095           (vldc.GetTimeStamp()).GetSec() ) * Munits::s;
00096 
00097 #ifdef ENABLE_DEBUG_MSG
00098    MSG("Alg", Msg::kDebug) << "rdid = " << digitRCId << endl
00099                         << "    tdc = " << digit->GetTDC() << " nsec = "
00100    << cal.GetTimeFromTDC(digit->GetTDC(),
00101                   digitRCId) << " t = " << t << endl << "    CrT0_ns = "
00102                         << (digit->GetCrateT0()).GetNanoSec()*Munits::ns
00103                        << " CrT0_s = " << (digit->GetCrateT0()).GetSec()
00104           << " TrigTime_s = " << (vldc.GetTimeStamp()).GetSec() << endl;
00105 #endif
00106 
00107    cdh.SetTime(t);
00108 
00109 // Get a PlexHandle for PlexStripEndId to RawChannelId conversions
00110    PlexHandle ph(vldc);
00111 
00112 // Fill and calibrate PlexSEIdAltL
00113    PlexSEIdAltL altlist =
00114                       ph.GetSEIdAltL(digitRCId, &cal,
00115                       (int)(digit->GetADC()-adc_offset), cdh.GetTime());
00116 
00117    cdh.SetPlexSEIdAltL(altlist);
00118 }
00119 
00120 //______________________________________________________________________
00121 void AlgDigit::Trace(const char * /* c */) const
00122 {
00123 }

Generated on Mon Feb 15 11:06:17 2010 for loon by  doxygen 1.3.9.1