00001
00002
00003
00004
00005
00006
00007
00008
00010
00011
00012
00014
00015 #include <cassert>
00016
00017 #include "CalDetDST/AlgFilterChannels.h"
00018 #include "CalDetDST/ChannelsToFilter.h"
00019 #include "DatabaseInterface/DbiResultPtr.h"
00020
00021 #include "Algorithm/AlgConfig.h"
00022 #include "Algorithm/AlgFactory.h"
00023 #include "Algorithm/AlgHandle.h"
00024 #include "CandDigit/CandDigit.h"
00025 #include "CandDigit/CandDigitHandle.h"
00026 #include "CandDigit/CandDigitList.h"
00027 #include "CandDigit/CandDigitListHandle.h"
00028 #include "Candidate/CandContext.h"
00029 #include "MessageService/MsgService.h"
00030
00031
00032 ClassImp(AlgFilterChannels)
00033
00034
00035 CVSID("$Id: AlgFilterChannels.cxx,v 1.2 2008/11/18 17:09:29 rhatcher Exp $");
00036
00037
00038 AlgFilterChannels::AlgFilterChannels()
00039 {
00040 }
00041
00042
00043 AlgFilterChannels::~AlgFilterChannels()
00044 {
00045 }
00046
00047
00048 void AlgFilterChannels::RunAlg(AlgConfig & , CandHandle &ch,
00049 CandContext &cx)
00050 {
00051 MSG("AlgFilterChannels", Msg::kDebug)
00052 << "Starting AlgFilterChannels::RunAlg()" << endl;
00053
00054
00055 assert(cx.GetDataIn());
00056
00057
00058 const CandDigitListHandle *cdlh =
00059 dynamic_cast<const CandDigitListHandle *> (cx.GetDataIn());
00060 assert(cdlh);
00061
00062
00063 ch.SetCandRecord((cdlh->GetCandRecord()));
00064
00065
00066 CandDigitListHandle &cddlh = dynamic_cast<CandDigitListHandle &>(ch);
00067 cddlh.SetAbsTime(cdlh->GetAbsTime());
00068 cddlh.SetIsSparse(cdlh->GetIsSparse());
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
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
00097 TIter cdhiter = cdlh->GetDaughterIterator();
00098 TObject *tob;
00099 while ((tob = cdhiter())) {
00100 CandDigitHandle *cdh = dynamic_cast<CandDigitHandle *>(tob);
00101 if (cdh == 0) continue;
00102 MSG("AlgFilterChannels", Msg::kVerbose)
00103 << "Considering: "<<cdh->GetChannelId()
00104 <<" --> "<<cdh->GetPlexSEIdAltL()<< endl;
00105
00106
00107
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;
00124
00125
00126 CandDigitHandle cddh(*cdh);
00127 ch.AddDaughterLink(cddh, kFALSE);
00128 }
00129 }
00130
00131
00132 void AlgFilterChannels::Trace(const char * ) const
00133 {
00134 }