00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015 #include "Algorithm/AlgHandle.h"
00016 #include "CandDigit/CandDeMuxDigitList.h"
00017 #include "CandDigit/CandDeMuxDigitListHandle.h"
00018 #include "MessageService/MsgService.h"
00019 #include "MessageService/MsgFormat.h"
00020
00021
00022 #include "TString.h"
00023
00024 ClassImp(CandDeMuxDigitList)
00025
00026
00027 CVSID("$Id: CandDeMuxDigitList.cxx,v 1.6 2004/04/26 03:56:21 rhatcher Exp $");
00028
00029
00030 CandDeMuxDigitList::CandDeMuxDigitList() :
00031 fDeMuxDigitListFlag(0)
00032 , fNumValidPlanesU(0)
00033 , fNumValidPlanesV(0)
00034 , fNumStrayPlanesU(0)
00035 , fNumStrayPlanesV(0)
00036 , fAvgTimeOffset(0.)
00037 {
00038 MSG("Cand", Msg::kDebug)
00039 << "Begin CandDeMuxDigitList::CandDeMuxDigitList() ctor: " << endl
00040 << "UidInt = " << GetUidInt()
00041 << ", ArchUidInt " << GetArchUidInt() << endl
00042 << "No. of links = " << GetNLinks() << endl
00043 << "End CandDeMuxDigitList::CandDeMuxDigitList() ctor." << endl;
00044 }
00045
00046
00047 CandDeMuxDigitList::CandDeMuxDigitList(AlgHandle &ah) :
00048 CandDigitList(ah)
00049 , fDeMuxDigitListFlag(0)
00050 , fNumValidPlanesU(0)
00051 , fNumValidPlanesV(0)
00052 , fNumStrayPlanesU(0)
00053 , fNumStrayPlanesV(0)
00054 , fAvgTimeOffset(0.)
00055 {
00056
00057
00058
00059
00060
00061
00062
00063 }
00064
00065
00066 CandDeMuxDigitList::CandDeMuxDigitList(AlgHandle &ah, CandHandle &ch,
00067 CandContext &cx) :
00068 CandDigitList(ah)
00069 , fDeMuxDigitListFlag(0)
00070 , fNumValidPlanesU(0)
00071 , fNumValidPlanesV(0)
00072 , fNumStrayPlanesU(0)
00073 , fNumStrayPlanesV(0)
00074 , fAvgTimeOffset(0.)
00075 {
00076 CreateLocalHandle();
00077 MSG("Cand", Msg::kDebug)
00078 << "Begin CandDeMuxDigitList::CandDeMuxDigitList(AlgHandle &, CandHandle &, "
00079 << "CandContext& ) ctor: " << endl
00080 << "UidInt = " << GetUidInt()
00081 << ", ArchUidInt " << GetArchUidInt() << endl
00082 << "No. of links = " << GetNLinks() << endl
00083 << "End CandDeMuxDigitList::CandDeMuxDigitList(AlgHandle &, CandHandle &, "
00084 << "CandContext& ) ctor: " << endl;
00085
00086
00087 {
00088 CandDeMuxDigitListHandle cdlh(this);
00089 ch = cdlh;
00090 }
00091 ah.RunAlg(ch, cx);
00092 }
00093
00094
00095 CandDeMuxDigitList::CandDeMuxDigitList(const CandDeMuxDigitList &rhs) :
00096 CandDigitList(rhs)
00097 , fDeMuxDigitListFlag(rhs.fDeMuxDigitListFlag)
00098 , fNumValidPlanesU(rhs.fNumValidPlanesU)
00099 , fNumValidPlanesV(rhs.fNumValidPlanesV)
00100 , fNumStrayPlanesU(rhs.fNumStrayPlanesU)
00101 , fNumStrayPlanesV(rhs.fNumStrayPlanesV)
00102 , fAvgTimeOffset(rhs.fAvgTimeOffset)
00103 {
00104 MSG("Cand", Msg::kDebug)
00105 << "Begin CandDeMuxDigitList::CandDeMuxDigitList(const CandDeMuxDigitList &) "
00106 << "ctor: " << endl
00107 << "UidInt = " << GetUidInt()
00108 << ", ArchUidInt " << GetArchUidInt() << endl
00109 << "No. of links = " << GetNLinks() << endl
00110 << "End CandDeMuxDigitList::CandDeMuxDigitList(const CandDeMuxDigitList &) ctor."
00111 << endl;
00112 }
00113
00114
00115 CandDeMuxDigitList::~CandDeMuxDigitList()
00116 {
00117 MSG("Cand", Msg::kDebug)
00118 << "Begin CandDeMuxDigitList::~CandDeMuxDigitList() " << "dtor: "
00119 << endl
00120 << "UidInt = " << GetUidInt()
00121 << ", ArchUidInt " << GetArchUidInt() << endl
00122 << "No. of links = " << GetNLinks() << endl
00123 << "End CandDeMuxDigitList::~CandDeMuxDigitList() dtor." << endl;
00124 }
00125
00126
00127 void CandDeMuxDigitList::CreateLocalHandle()
00128 {
00129 SetLocalHandle(new CandDeMuxDigitListHandle(this));
00130 }
00131
00132
00133 CandDeMuxDigitList *CandDeMuxDigitList::Dup() const
00134 {
00135
00136
00137
00138
00139
00140
00141 CandDeMuxDigitList *cb = new CandDeMuxDigitList(*this);
00142 cb->CreateLocalHandle();
00143 TIter iterdau = GetDaughterIterator();
00144 CandHandle *dau;
00145 while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00146 return cb;
00147 }
00148
00149
00150 Bool_t CandDeMuxDigitList::IsEquivalent(const TObject *rhs) const
00151 {
00152 Bool_t result = true;
00153 if (!CandDigitList::IsEquivalent(rhs)) result = false;
00154 TestDisplayCandBanner("CandDeMuxDigitList");
00155 const CandDeMuxDigitList* rCnd =
00156 dynamic_cast<const CandDeMuxDigitList*>(rhs);
00157 if (rCnd == NULL) return false;
00158
00159 result = TestEquality("fDeMuxDigitListFlag",
00160 this->fDeMuxDigitListFlag,
00161 rCnd->fDeMuxDigitListFlag) && result;
00162 result = TestEquality("fNumValidPlanesU",
00163 this->fNumValidPlanesU,
00164 rCnd->fNumValidPlanesU) && result;
00165 result = TestEquality("fNumValidPlanesV",
00166 this->fNumValidPlanesV,
00167 rCnd->fNumValidPlanesV) && result;
00168 result = TestEquality("fNumStrayPlanesU",
00169 this->fNumStrayPlanesU,
00170 rCnd->fNumStrayPlanesU) && result;
00171 result = TestEquality("fNumStrayPlanesV",
00172 this->fNumStrayPlanesV,
00173 rCnd->fNumStrayPlanesV) && result;
00174 result = TestEquality("fAvgTimeOffset",
00175 this->fAvgTimeOffset,
00176 rCnd->fAvgTimeOffset) && result;
00177
00178 return result;
00179 }
00180
00181
00182 CandDeMuxDigitListHandle CandDeMuxDigitList::MakeCandidate(
00183 AlgHandle &ah, CandContext &cx)
00184 {
00185
00186
00187 CandDeMuxDigitListHandle cdlh;
00188 new CandDeMuxDigitList(ah, cdlh, cx); return cdlh;
00189 }
00190
00191
00192 std::ostream& CandDeMuxDigitList::FormatToOStream(std::ostream& os,
00193 Option_t *option) const
00194 {
00195 CandDigitList::FormatToOStream(os,option);
00196
00197 TString opt(option);
00198 if (!opt.Contains("v0")) {
00199 const TString& indent = GetIndentString();
00200
00201 static MsgFormat i4("i4");
00202 static MsgFormat timefmt("f18.9");
00203
00204 os << indent << GetDataIndent()
00205 << "NValidPlanes U: " << i4(fNumValidPlanesU)
00206 << " V: " << i4(fNumValidPlanesV)
00207 << " NStrayPlanes U: " << i4(fNumStrayPlanesU)
00208 << " V: " << i4(fNumStrayPlanesV)
00209 << endl;
00210
00211 CandDeMuxDigitList::DeMuxDigitListFlag_t dlflag =
00212 (CandDeMuxDigitList::DeMuxDigitListFlag_t)fDeMuxDigitListFlag;
00213
00214 os << indent << GetDataIndent()
00215 << "AvgTimeOffset " << timefmt(fAvgTimeOffset)
00216 << " FlagWord "
00217 << CandDeMuxDigitList::AsString(dlflag)
00218 << endl;
00219 };
00220 return os;
00221
00222 }
00223
00224
00225 const char* CandDeMuxDigitList::AsString(DeMuxDigitListFlag_t dlflag)
00226 {
00227
00228 if (dlflag == kDeMuxOK) return "=DeMuxOKList=";
00229
00230 std::string result("=");
00231 if (dlflag & kNoVertex ) result += "NoVertex,";
00232 if (dlflag & kTooFewValidPlanes ) result += "TooFewValidPlanes,";
00233 if (dlflag & kNonPhysicalStripSolution ) result += "NonPhysicalStripSolution,";
00234 if (dlflag & kEventFailedFilter ) result += "EventFailedFilter,";
00235 if (dlflag & kEventFailedFilterUViewOnly) result += "EventFailedFilterUViewOnly,";
00236 if (dlflag & kEventFailedFilterVViewOnly) result += "EventFailedFilterVViewOnly,";
00237 if (dlflag & kMultipleMuonEvent ) result += "MultipleMuonEvent,";
00238
00239 static Int_t unknownBits =
00240 ~(kNoVertex|
00241 kTooFewValidPlanes|
00242 kNonPhysicalStripSolution|
00243 kEventFailedFilter|
00244 kEventFailedFilterUViewOnly|
00245 kEventFailedFilterVViewOnly|
00246 kMultipleMuonEvent);
00247 if ( dlflag & unknownBits ) return Form("0x%8.8x",dlflag);
00248
00249
00250 result.replace(result.size()-1,1,"=");
00251 return Form("%s",result.c_str());
00252 }
00253
00254