AlgFilterChannels Class Reference

#include <AlgFilterChannels.h>

Inheritance diagram for AlgFilterChannels:
AlgBase

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 16 of file AlgFilterChannels.h.


Constructor & Destructor Documentation

AlgFilterChannels::AlgFilterChannels (  ) 

Definition at line 38 of file AlgFilterChannels.cxx.

00039 {
00040 }

AlgFilterChannels::~AlgFilterChannels (  )  [virtual]

Definition at line 43 of file AlgFilterChannels.cxx.

00044 {
00045 }


Member Function Documentation

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

Implements AlgBase.

Definition at line 48 of file AlgFilterChannels.cxx.

References CandHandle::AddDaughterLink(), CandDigitHandle::GetChannelId(), CandContext::GetDataIn(), DbiResultPtr< T >::GetNumRows(), CandDigitHandle::GetPlexSEIdAltL(), DbiResultPtr< T >::GetRow(), ChannelsToFilter::IsSameChannel(), Msg::kDebug, Msg::kFatal, Msg::kVerbose, MSG, CandDigitListHandle::SetAbsTime(), CandHandle::SetCandRecord(), and CandDigitListHandle::SetIsSparse().

00050 {
00051    MSG("AlgFilterChannels", Msg::kDebug)
00052                      << "Starting AlgFilterChannels::RunAlg()" << endl;
00053 
00054 // Check for input CandDigitListHandle in CandContext
00055    assert(cx.GetDataIn());
00056 
00057 // Obtain CandContext's CandDigitList as input
00058    const CandDigitListHandle *cdlh =
00059              dynamic_cast<const CandDigitListHandle *> (cx.GetDataIn());
00060    assert(cdlh);   // Check for input CandDigitListHandle in CandContext
00061 
00062 // Set CandRecord pointer in new CandDigitList to that of CandDigitList
00063    ch.SetCandRecord((cdlh->GetCandRecord())); //Sub-algorithms need this
00064 
00065 // Copy member variables from orig CandDigitList to new CandDigitList
00066    CandDigitListHandle &cddlh = dynamic_cast<CandDigitListHandle &>(ch);
00067    cddlh.SetAbsTime(cdlh->GetAbsTime());
00068    cddlh.SetIsSparse(cdlh->GetIsSparse());
00069 
00070 // open a connection to the db
00071 
00072 /*
00073    // this bit of code doesn't work!
00074    // apparently, cx.GetCandRecord() returns a bad pointer
00075    // as cx.SetCandRecord() never gets called by the module
00076    // arghh!
00077 
00078    const VldContext* vcp = cx.GetCandRecord()->GetVldContext();
00079    if(!vcp ){
00080       MSG("AlgFilterChannels", Msg::kFatal)
00081          << "Couldn't get a VldContext?!" << endl;
00082       return;
00083    }
00084 */
00085    // try to get a vld context from the digitlisthandle
00086    const VldContext* vcp = cdlh->GetVldContext();
00087    if(!vcp ){
00088       MSG("AlgFilterChannels", Msg::kFatal)
00089          << "Couldn't get a VldContext?!" << endl;
00090       return;
00091    }
00092    
00093  
00094    DbiResultPtr<ChannelsToFilter> rptr(*vcp);   
00095 
00096 // Iterate over CandContext's CandDigitList to find CandDigitHandles.
00097    TIter cdhiter = cdlh->GetDaughterIterator();
00098    TObject *tob;
00099    while ((tob = cdhiter())) {
00100      CandDigitHandle *cdh = dynamic_cast<CandDigitHandle *>(tob);
00101      if (cdh == 0) continue;   // Skip daughter if not a CandDigitHandle
00102      MSG("AlgFilterChannels", Msg::kVerbose)
00103         << "Considering: "<<cdh->GetChannelId()
00104         <<" --> "<<cdh->GetPlexSEIdAltL()<< endl;
00105 
00106      // very simple, just ask the result pointer if this is a 
00107      // channel in its list
00108      bool cutit=false;
00109      MSG("AlgFilterChannels", Msg::kVerbose)
00110         << "Filtering out "<<rptr.GetNumRows()<<" channels."<<endl;
00111 
00112      for(unsigned int i=0; i<rptr.GetNumRows(); i++){
00113         const ChannelsToFilter* ctof = rptr.GetRow(i);
00114         MSG("AlgFilterChannels", Msg::kVerbose)
00115            <<"Is it this one? :  "<<(*ctof)<<endl;
00116            if( ctof->IsSameChannel(cdh) ) {
00117               cutit=true;
00118               MSG("AlgFilterChannels", Msg::kDebug)
00119                  <<"Cut this "<< (*ctof) <<endl;
00120               break;
00121            }
00122      }
00123      if(cutit) continue; // don't add this digit to the new list!
00124 
00125 // Effect copy of wanted digits from orig CandDigitList to daughter list
00126      CandDigitHandle cddh(*cdh);
00127      ch.AddDaughterLink(cddh, kFALSE);           // Don't check for dups
00128    }
00129 }

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

Reimplemented from AlgBase.

Definition at line 132 of file AlgFilterChannels.cxx.

00133 {
00134 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1