00001
00002
00003
00004
00005
00006
00007
00008
00010
00011
00012
00013
00014
00015
00017
00018 #include <cassert>
00019
00020 #include "Algorithm/AlgConfig.h"
00021 #include "Algorithm/AlgFactory.h"
00022 #include "Algorithm/AlgHandle.h"
00023 #include "CandDigit/AlgDeMuxDigitList.h"
00024 #include "CandDigit/CandDeMuxDigit.h"
00025 #include "CandDigit/CandDeMuxDigitHandle.h"
00026 #include "CandDigit/CandDeMuxDigitList.h"
00027 #include "CandDigit/CandDeMuxDigitListHandle.h"
00028 #include "CandDigit/CandDigit.h"
00029 #include "CandDigit/CandDigitHandle.h"
00030 #include "CandDigit/CandDigitList.h"
00031 #include "CandDigit/CandDigitListHandle.h"
00032 #include "Candidate/CandContext.h"
00033 #include "MessageService/MsgService.h"
00034
00035 ClassImp(AlgDeMuxDigitList)
00036
00037
00038 CVSID("$Id: AlgDeMuxDigitList.cxx,v 1.5 2004/02/11 20:37:14 gmieg Exp $");
00039
00040
00041 AlgDeMuxDigitList::AlgDeMuxDigitList()
00042 {
00043 }
00044
00045
00046 AlgDeMuxDigitList::~AlgDeMuxDigitList()
00047 {
00048 }
00049
00050
00051 void AlgDeMuxDigitList::RunAlg(AlgConfig &ac, CandHandle &ch,
00052 CandContext &cx)
00053 {
00054 MSG("AlgDeMuxDigitList", Msg::kDebug)
00055 << "Starting AlgDeMuxDigitList::RunAlg()" << endl;
00056
00057
00058 assert(cx.GetDataIn());
00059
00060
00061 const CandDigitListHandle *cdlh =
00062 dynamic_cast<const CandDigitListHandle *> (cx.GetDataIn());
00063 assert(cdlh);
00064
00065
00066 ch.SetCandRecord((cdlh->GetCandRecord()));
00067
00068
00069 CandDeMuxDigitListHandle &cddlh =
00070 dynamic_cast<CandDeMuxDigitListHandle &>(ch);
00071 cddlh.SetAbsTime(cdlh->GetAbsTime());
00072 cddlh.SetIsSparse(cdlh->GetIsSparse());
00073
00074
00075 TIter cdhiter = cdlh->GetDaughterIterator();
00076 TObject *tob;
00077 while ((tob = cdhiter())) {
00078 CandDigitHandle *cdh = dynamic_cast<CandDigitHandle *>(tob);
00079 if (cdh == 0) continue;
00080
00081
00082 CandDeMuxDigitHandle cddh =
00083 CandDeMuxDigitHandle::DupCandFromBase(*cdh);
00084 ch.AddDaughterLink(cddh, kFALSE);
00085 }
00086
00087
00088 MSG("AlgDeMuxDigitList", Msg::kDebug)
00089 << "AlgFactory &af = AlgFactory::GetInstance();" << endl;
00090 AlgFactory &af = AlgFactory::GetInstance();
00091 AlgHandle ah;
00092
00093
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
00107 if (cddlh.GetDeMuxDigitListFlagWord() == 0) {
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) {
00113 TIter cddhiter = ch.GetDaughterIterator();
00114 while ((tob = cddhiter())) {
00115 CandDeMuxDigitHandle *cddh =
00116 dynamic_cast<CandDeMuxDigitHandle *>(tob);
00117 if (cddh == 0) continue;
00118 if (cddh->GetPlexSEIdAltL().GetDemuxVetoFlag() != 0) continue;
00119 PlexSEIdAltL &seidw = cddh->GetPlexSEIdAltLWritable();
00120 if (normwts) seidw.NormalizeWeights();
00121 if (trimhyps<0) seidw.DropZeroWeights();
00122 else if (trimhyps>0) seidw.KeepTopWeights(trimhyps);
00123 }
00124 }
00125 }
00126 }
00127
00128
00129 void AlgDeMuxDigitList::Trace(const char * ) const
00130 {
00131 }