00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015 #include "Algorithm/AlgHandle.h"
00016 #include "CandDigit/CandDeMuxDigit.h"
00017 #include "CandDigit/CandDeMuxDigitHandle.h"
00018 #include "MessageService/MsgService.h"
00019
00020 ClassImp(CandDeMuxDigit)
00021
00022
00023 CVSID("$Id: CandDeMuxDigit.cxx,v 1.5 2004/04/26 03:56:21 rhatcher Exp $");
00024
00025
00026 CandDeMuxDigit::CandDeMuxDigit() :
00027 fDeMuxDigitFlag(0)
00028 {
00029
00030 MSG("Cand", Msg::kDebug)
00031 << "Begin CandDeMuxDigit::CandDeMuxDigit() ctor: " << endl
00032 << "UidInt = " << GetUidInt()
00033 << ", ArchUidInt " << GetArchUidInt() << endl
00034 << "No. of links = " << GetNLinks() << endl
00035 << "End CandDeMuxDigit::CandDeMuxDigit() ctor." << endl;
00036 }
00037
00038
00039 CandDeMuxDigit::CandDeMuxDigit(AlgHandle &ah) :
00040 CandDigit(ah),
00041 fDeMuxDigitFlag(0)
00042 {
00043
00044
00045
00046
00047
00048
00049
00050 }
00051
00052
00053 CandDeMuxDigit::CandDeMuxDigit(AlgHandle &ah, CandHandle &ch,
00054 CandContext &cx) :
00055 CandDigit(ah),
00056 fDeMuxDigitFlag(0)
00057 {
00058 CreateLocalHandle();
00059 MSG("Cand", Msg::kDebug)
00060 << "Begin CandDeMuxDigit::CandDeMuxDigit(AlgHandle &, CandHandle &, "
00061 << "CandContext &) ctor: " << endl
00062 << "UidInt = " << GetUidInt()
00063 << ", ArchUidInt " << GetArchUidInt() << endl
00064 << "No. of links = " << GetNLinks() << endl
00065 << "End CandDeMuxDigit::CandDeMuxDigit(AlgHandle &, CandHandle &, "
00066 << "CandContext &) ctor." << endl;
00067
00068
00069 {
00070 CandDeMuxDigitHandle cdh(this);
00071 ch = cdh;
00072 }
00073 ah.RunAlg(ch, cx);
00074 }
00075
00076
00077 CandDeMuxDigit::CandDeMuxDigit(const CandDeMuxDigit &rhs) :
00078 CandDigit(rhs),
00079 fDeMuxDigitFlag(rhs.fDeMuxDigitFlag)
00080 {
00081 MSG("Cand", Msg::kDebug)
00082 << "Begin CandDeMuxDigit::CandDeMuxDigit(const CandDeMuxDigit&rhs)ctor:"
00083 << endl
00084 << "UidInt = " << GetUidInt()
00085 << ", ArchUidInt " << GetArchUidInt() << endl
00086 << "No. of links = " << GetNLinks() << endl
00087 << "End CandDeMuxDigit::CandDeMuxDigit(const CandDeMuxDigit &rhs) ctor."
00088 << endl;
00089 }
00090
00091
00092 CandDeMuxDigit::CandDeMuxDigit(const CandDigit &rhs) :
00093 CandDigit(rhs),
00094 fDeMuxDigitFlag(0)
00095 {
00096 MSG("Cand", Msg::kDebug)
00097 << "Begin CandDeMuxDigit::CandDeMuxDigit(const CandDigit&rhs)ctor:"
00098 << endl
00099 << "UidInt = " << GetUidInt()
00100 << ", ArchUidInt " << GetArchUidInt() << endl
00101 << "No. of links = " << GetNLinks() << endl
00102 << "End CandDeMuxDigit::CandDeMuxDigit(const CandDigit &rhs) ctor."
00103 << endl;
00104 }
00105
00106
00107 CandDeMuxDigit::~CandDeMuxDigit()
00108 {
00109 MSG("Cand", Msg::kDebug)
00110 << "Begin CandDeMuxDigit::~CandDeMuxDigit() dtor: " << endl
00111 << "UidInt = " << GetUidInt()
00112 << ", ArchUidInt " << GetArchUidInt() << endl
00113 << "No. of links = " << GetNLinks() << endl
00114 << "End CandDeMuxDigit::~CandDeMuxDigit() dtor." << endl;
00115 }
00116
00117
00118 void CandDeMuxDigit::CreateLocalHandle()
00119 {
00120 SetLocalHandle(new CandDeMuxDigitHandle(this));
00121 }
00122
00123
00124 CandDeMuxDigit *CandDeMuxDigit::Dup() const
00125 {
00126
00127
00128
00129
00130
00131 CandDeMuxDigit *cb = new CandDeMuxDigit(*this);
00132 cb->CreateLocalHandle();
00133 TIter iterdau = GetDaughterIterator();
00134 CandHandle *dau;
00135 while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00136 return cb;
00137 }
00138
00139
00140 Bool_t CandDeMuxDigit::IsEquivalent(const TObject *rhs) const
00141 {
00142 Bool_t result = true;
00143 if (!CandDigit::IsEquivalent(rhs)) result = false;
00144 TestDisplayCandBanner("CandDeMuxDigit");
00145 const CandDeMuxDigit* rCnd = dynamic_cast<const CandDeMuxDigit*>(rhs);
00146 if (rCnd == NULL) return false;
00147
00148 result = TestEquality("fDeMuxDigitFlag",
00149 this->fDeMuxDigitFlag,
00150 rCnd->fDeMuxDigitFlag) && result;
00151
00152 return result;
00153 }
00154
00155
00156 CandDeMuxDigitHandle CandDeMuxDigit::MakeCandidate(AlgHandle &ah,
00157 CandContext &cx)
00158 {
00159 CandDeMuxDigitHandle cdh;
00160 new CandDeMuxDigit(ah, cdh, cx);
00161 return cdh;
00162 }
00163
00164
00165 std::ostream& CandDeMuxDigit::FormatToOStream(std::ostream& os,
00166 Option_t *option) const
00167 {
00168 CandDigit::FormatToOStream(os,option);
00169
00170 TString opt(option);
00171 if (!opt.Contains("v0")) {
00172 const TString& indent = GetIndentString();
00173 os << indent << GetDataIndent()
00174 << AsString((DeMuxDigitFlag_t)fDeMuxDigitFlag)
00175 << endl;
00176 }
00177 return os;
00178
00179 }
00180
00181
00182 const char* CandDeMuxDigit::AsString(DeMuxDigitFlag_t dflag)
00183 {
00184 if (dflag == kDeMuxOK) return "=DeMuxOK=";
00185
00186 std::string result("=");
00187 if (dflag & kXTalk ) result += "XTalk,";
00188 if (dflag & kLowSignal ) result += "LowSignal,";
00189
00190 static Int_t unknownBits = ~(kXTalk|kLowSignal);
00191 if ( dflag & unknownBits ) return Form("0x%8.8x",dflag);
00192
00193
00194 result.replace(result.size()-1,1,"=");
00195 return Form("%s",result.c_str());
00196 }
00197
00198