AlgDeMuxDigitList Class Reference

#include <AlgDeMuxDigitList.h>

Inheritance diagram for AlgDeMuxDigitList:

AlgBase List of all members.

Public Member Functions

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

Detailed Description

Definition at line 16 of file AlgDeMuxDigitList.h.


Constructor & Destructor Documentation

AlgDeMuxDigitList::AlgDeMuxDigitList (  ) 

Definition at line 41 of file AlgDeMuxDigitList.cxx.

00042 {
00043 }

AlgDeMuxDigitList::~AlgDeMuxDigitList (  )  [virtual]

Definition at line 46 of file AlgDeMuxDigitList.cxx.

00047 {
00048 }


Member Function Documentation

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

Implements AlgBase.

Definition at line 51 of file AlgDeMuxDigitList.cxx.

References CandHandle::AddDaughterLink(), PlexSEIdAltL::DropZeroWeights(), CandDeMuxDigitHandle::DupCandFromBase(), Registry::Get(), AlgFactory::GetAlgHandle(), CandContext::GetDataIn(), CandHandle::GetDaughterIterator(), CandDeMuxDigitListHandle::GetDeMuxDigitListFlagWord(), PlexSEIdAltL::GetDemuxVetoFlag(), AlgFactory::GetInstance(), CandContext::GetMom(), CandDigitHandle::GetPlexSEIdAltL(), CandDigitHandle::GetPlexSEIdAltLWritable(), Msg::kDebug, PlexSEIdAltL::KeepTopWeights(), MSG, PlexSEIdAltL::NormalizeWeights(), AlgHandle::RunAlg(), CandDigitListHandle::SetAbsTime(), CandHandle::SetCandRecord(), and CandDigitListHandle::SetIsSparse().

00053 {
00054    MSG("AlgDeMuxDigitList", Msg::kDebug)
00055                       << "Starting AlgDeMuxDigitList::RunAlg()" << endl;
00056 
00057 // Check for input CandDigitListHandle in CandContext
00058    assert(cx.GetDataIn());
00059 
00060 // Obtain CandContext's CandDigitList as input
00061    const CandDigitListHandle *cdlh =
00062              dynamic_cast<const CandDigitListHandle *> (cx.GetDataIn());
00063    assert(cdlh);   // Check for input CandDigitListHandle in CandContext
00064 
00065 // Set CandRecord pointer in CandDeMuxDigitList to that of CandDigitList
00066    ch.SetCandRecord((cdlh->GetCandRecord())); //Sub-algorithms need this
00067 
00068 // Copy member variables from orig CandDigitList to CandDeMuxDigitList
00069    CandDeMuxDigitListHandle &cddlh =
00070                            dynamic_cast<CandDeMuxDigitListHandle &>(ch);
00071    cddlh.SetAbsTime(cdlh->GetAbsTime());
00072    cddlh.SetIsSparse(cdlh->GetIsSparse());
00073 
00074 // Iterate over CandContext's CandDigitList to find CandDigitHandles.
00075    TIter cdhiter = cdlh->GetDaughterIterator();
00076    TObject *tob;
00077    while ((tob = cdhiter())) {
00078      CandDigitHandle *cdh = dynamic_cast<CandDigitHandle *>(tob);
00079      if (cdh == 0) continue;   // Skip daughter if not a CandDigitHandle
00080 
00081 // Effect copy from CandDigit source to a new CandDeMuxDigit
00082      CandDeMuxDigitHandle cddh =
00083                             CandDeMuxDigitHandle::DupCandFromBase(*cdh);
00084      ch.AddDaughterLink(cddh, kFALSE);           // Don't check for dups
00085    }
00086 
00087 // Get Singleton instance of AlgFactory.
00088    MSG("AlgDeMuxDigitList", Msg::kDebug)
00089                << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00090    AlgFactory &af = AlgFactory::GetInstance();
00091    AlgHandle ah;
00092 
00093 // Get correct Algorithm by name from AlgFactory
00094    const char *tmpcs = 0;
00095    const char *demuxalgorithm = 0;
00096    const char *demuxalgconfig = 0;
00097 
00098    if (ac.Get("DeMuxAlgorithm", tmpcs)) demuxalgorithm = tmpcs;
00099    if (ac.Get("DeMuxAlgConfig", tmpcs)) demuxalgconfig = tmpcs;
00100    ah = af.GetAlgHandle(demuxalgorithm, demuxalgconfig);
00101 
00102    CandContext cxx(this, cx.GetMom());
00103    
00104    ah.RunAlg(ch, cxx);
00105 
00106 // Normalize and/or de-sparsify PlexSEIdAltL, if requested
00107    if (cddlh.GetDeMuxDigitListFlagWord() == 0) {    // Demuxing is valid
00108      Int_t tmpi = 0;
00109      Int_t normwts = 0;  Int_t trimhyps = 0;
00110      if (ac.Get("NormalizeWeights", tmpi)) normwts = tmpi;
00111      if (ac.Get("TrimHyps", tmpi)) trimhyps = tmpi;
00112      if (normwts || trimhyps)  {     // Need to loop over DeMuxDigitList
00113        TIter cddhiter = ch.GetDaughterIterator();
00114        while ((tob = cddhiter())) {
00115          CandDeMuxDigitHandle *cddh =
00116                               dynamic_cast<CandDeMuxDigitHandle *>(tob);
00117          if (cddh == 0) continue;      // Require a CandDeMuxDigitHandle
00118          if (cddh->GetPlexSEIdAltL().GetDemuxVetoFlag() != 0) continue;
00119          PlexSEIdAltL &seidw = cddh->GetPlexSEIdAltLWritable();
00120          if (normwts) seidw.NormalizeWeights(); // Norm wts to 1 if ne 0
00121          if (trimhyps<0) seidw.DropZeroWeights();   // Drop 0 wts if neg
00122          else if (trimhyps>0) seidw.KeepTopWeights(trimhyps);  // Keep N
00123        }
00124      }
00125    }
00126 }

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

Reimplemented from AlgBase.

Definition at line 129 of file AlgDeMuxDigitList.cxx.

00130 {
00131 }


The documentation for this class was generated from the following files:
Generated on Thu Jul 10 22:52:16 2014 for loon by  doxygen 1.4.7