AlgDigitList Class Reference

#include <AlgDigitList.h>

Inheritance diagram for AlgDigitList:
AlgBase

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 16 of file AlgDigitList.h.


Constructor & Destructor Documentation

AlgDigitList::AlgDigitList (  ) 

Definition at line 45 of file AlgDigitList.cxx.

00046 {
00047 }

AlgDigitList::~AlgDigitList (  )  [virtual]

Definition at line 50 of file AlgDigitList.cxx.

00051 {
00052 }


Member Function Documentation

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

Implements AlgBase.

Definition at line 55 of file AlgDigitList.cxx.

References CandHandle::AddDaughterLink(), Registry::Get(), AlgFactory::GetAlgHandle(), CandContext::GetCandRecord(), RawDigit::GetChannel(), CandContext::GetDataIn(), RawDigitDataBlock::GetDatumIter(), AlgFactory::GetInstance(), CandContext::GetMom(), RawDigitDataBlock::GetNSparsModeCrates(), RawDigitDataBlock::GetNumberOfCrates(), RawDigitDataBlock::GetNumberOfDigits(), RawRecord::GetRawBlockIter(), PlexHandle::GetReadoutType(), RecMinos::GetVldContext(), Msg::kDebug, Msg::kInfo, ReadoutType::kScintStrip, CandDigit::MakeCandidate(), MSG, Munits::nanosecond, CandDigitListHandle::SetAbsTime(), CandDigitListHandle::SetIsSparse(), and CandDigitHandle::SetRawDigitIndex().

00057 {
00058 #ifdef ENABLE_DEBUG_MSG
00059    MSG("AlgDigitList", Msg::kDebug)
00060                            << "Starting AlgDigitList::RunAlg()" << endl;
00061 #endif
00062 
00063    assert(cx.GetDataIn());
00064 
00065 // Get VldContext
00066    const VldContext &vldc = *(cx.GetCandRecord()->GetVldContext());
00067 
00068 // Iterate over RawDigitDataBlock or CandDigitList daughters.
00069    if (cx.GetDataIn()->InheritsFrom("RawRecord")) {
00070 
00071 #ifdef ONLYSCINT
00072      PlexHandle ph(vldc);
00073 #endif
00074 
00075 // Set up to iterate over input RawDigit's to fill output CandDigitList.
00076 
00077 // Get Singleton instance of AlgFactory.
00078 #ifdef ENABLE_DEBUG_MSG
00079      MSG("AlgDigitList", Msg::kDebug)
00080                << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00081 #endif
00082      AlgFactory &af = AlgFactory::GetInstance();
00083 
00084 // Get correct Algorithm by name from AlgFactory
00085      const char *tmpcs = 0;
00086      const char *digitalgorithm = 0;
00087      const char *digitalgconfig = 0;
00088 
00089      if (ac.Get("DigitAlgorithm", tmpcs)) digitalgorithm = tmpcs;
00090      if (ac.Get("DigitAlgConfig", tmpcs)) digitalgconfig = tmpcs;
00091 
00092 // Get an AlgHandle to an Algorithm with requested AlgConfig.
00093 #ifdef ENABLE_DEBUG_MSG
00094      MSG("AlgDigitList", Msg::kDebug)
00095          << "AlgHandle ah = af.GetAlgHandle("
00096          << digitalgorithm << ", "
00097          << digitalgconfig << ");" << endl;
00098 #endif
00099      AlgHandle ah = af.GetAlgHandle(digitalgorithm, digitalgconfig);
00100 
00101 #ifdef ENABLE_DEBUG_MSG
00102      MSG("AlgDigitList", Msg::kDebug)
00103                                << "Create CandContext instance." << endl
00104                                     << "CandContext cxx(this);" << endl;
00105 #endif
00106      CandContext cxx(this, cx.GetMom());
00107 
00108 // Set CandRecord pointer in CandContext.
00109 #ifdef ENABLE_DEBUG_MSG
00110      MSG("AlgDigitList", Msg::kDebug)
00111                     << "Set CandRecord pointer in CandContext." << endl;
00112 #endif
00113      cxx.SetCandRecord(cx.GetCandRecord());
00114 
00115      Bool_t isSparse = true;              // sparsified unless otherwise
00116 
00117 // Iterate over RawRecord's RawDataBlockList to find RawDigitDataBlock.
00118      RawRecord *rr = (RawRecord *) (cx.GetDataIn());
00119      TIter rdbit = rr->GetRawBlockIter();
00120      TObject *tob;
00121      while ((tob = rdbit())) {
00122        if (tob->InheritsFrom("RawDigitDataBlock")) {
00123          RawDigitDataBlock *rdb = (RawDigitDataBlock *) tob;
00124          TIter rdit = rdb->GetDatumIter();
00125          RawDigit *rd;
00126          Int_t rawdigitindex = -1;
00127 
00128          Int_t ndigits = rdb->GetNumberOfDigits();
00129          Bool_t blkIsSparse = 
00130             ( rdb->GetNumberOfCrates() == rdb->GetNSparsModeCrates());
00131          isSparse &= blkIsSparse;
00132          if (!blkIsSparse) 
00133            MSG("AlgDigitList", Msg::kInfo) 
00134          << "AlgDigitList finds RawDigitDataBlock is Unsparsified with " 
00135                                << ndigits << " digits " << endl << endl;
00136 
00137          while ((rd = (RawDigit *) rdit())) { 
00138            ++rawdigitindex;
00139 
00140 #ifdef ENABLE_DEBUG_MSG
00141            MSG("AlgDigitList", Msg::kDebug)
00142              << "Set RawDigit object as CandContext input data." << endl
00143                                         << "cxx.SetDataIn(rd);" << endl;
00144 #endif
00145 
00146 #ifdef ONLYSCINT
00147 // skip all non-scint readouts
00148            if (ph.GetReadoutType(rd->GetChannel()) != 
00149                ReadoutType::kScintStrip) continue;
00150 #endif
00151 
00152            cxx.SetDataIn(rd);
00153 
00154 #ifdef ENABLE_DEBUG_MSG
00155            MSG("AlgDigitList", Msg::kDebug)
00156                   << "Get handle to CandDigit." << endl
00157                   << "cdh = CandDigit::MakeCandidate(ah, cxx);" << endl;
00158 #endif
00159 
00160            CandDigitHandle cdh = CandDigit::MakeCandidate(ah, cxx);
00161            cdh.SetRawDigitIndex(rawdigitindex);
00162 
00163            ch.AddDaughterLink(cdh, kFALSE);      // Don't check for dups
00164          }
00165        }
00166      }
00167 
00168 // Set absolute time offset in CandDigitList.
00169 // It's no longer subtracted from CandDigits in AlgDigit.
00170      CandDigitListHandle &cdlh =
00171                                 dynamic_cast<CandDigitListHandle &>(ch);
00172      cdlh.SetAbsTime(((Double_t) vldc.GetTimeStamp().GetNanoSec()) *
00173                                                     Munits::nanosecond);
00174 
00175 // Set CandDigitList sparsification flag.
00176      cdlh.SetIsSparse(isSparse);
00177    }
00178 
00179    else if (cx.GetDataIn()->InheritsFrom("TCollection")) {
00180      TCollection *cdl = (TCollection *) cx.GetDataIn();
00181      TIter cdit(cdl);
00182      CandDigitHandle *cdh;
00183      while ((cdh = (CandDigitHandle *) cdit())) {
00184        ch.AddDaughterLink(*cdh, kFALSE);         // Don't check for dups
00185      }
00186    }
00187 }

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

Reimplemented from AlgBase.

Definition at line 190 of file AlgDigitList.cxx.

00191 {
00192 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1