00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015 #include "Algorithm/AlgHandle.h"
00016 #include "MessageService/MsgService.h"
00017 #include "MessageService/MsgFormat.h"
00018 #include "RecoBase/CandStrip.h"
00019 #include "RecoBase/CandStripHandle.h"
00020
00021 ClassImp(CandStrip)
00022
00023
00024 CVSID("$Id: CandStrip.cxx,v 1.16 2005/02/02 11:38:35 tagg Exp $");
00025
00026 #include "Candidate/CandBase.tpl"
00027
00028
00029
00032 CandStrip::CandStrip() :
00033 fTPos(0.),
00034 fZPos(0.),
00035 fCalTimeType(CalTimeType::kT0)
00036 {
00037 }
00038
00039
00040 CandStrip::CandStrip(AlgHandle &ah) :
00041 CandBase(ah),
00042 fTPos(0.),
00043 fZPos(0.),
00044 fCalTimeType(CalTimeType::kT0)
00045 {
00046 }
00047
00048
00049 CandStrip::CandStrip(AlgHandle &ah, CandHandle &ch, CandContext &cx) :
00050 CandBase(ah),
00051 fTPos(0.),
00052 fZPos(0.),
00053 fCalTimeType(CalTimeType::kT0)
00054 {
00055 CreateLocalHandle();
00056
00057
00058 {
00059 CandStripHandle csh(this);
00060 ch = csh;
00061 }
00062 ah.RunAlg(ch, cx);
00063 }
00064
00065
00066 CandStrip::CandStrip(const CandStrip &rhs) :
00067 CandBase(rhs),
00068 fTPos(rhs.fTPos),
00069 fZPos(rhs.fZPos),
00070 fCalTimeType(rhs.fCalTimeType)
00071 {
00072 fBestStripEnd = rhs.fBestStripEnd;
00073 }
00074
00075
00076 CandStrip::~CandStrip()
00077 {
00078 }
00079
00080
00081 void CandStrip::CreateLocalHandle()
00082 {
00083 SetLocalHandle(new CandStripHandle(this));
00084 }
00085
00086
00087 CandStrip *CandStrip::Dup() const
00088 {
00089
00090
00091
00092
00093
00094 CandStrip *cb = new CandStrip(*this);
00095 cb->CreateLocalHandle();
00096 cb->SetCandRecord(fCandRecord);
00097 TIter iterdau = GetDaughterIterator();
00098 CandHandle *dau;
00099 while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00100 return cb;
00101 }
00102
00103
00104 Bool_t CandStrip::IsEquivalent(const TObject *rhs) const
00105 {
00106 Bool_t result = true;
00107 if (!CandBase::IsEquivalent(rhs)) result = false;
00108 TestDisplayCandBanner("CandStrip");
00109 const CandStrip* rCnd = dynamic_cast<const CandStrip*>(rhs);
00110 if (rCnd == NULL) return false;
00111
00112 result = TestEquality("fTPos", this->fTPos,
00113 rCnd->fTPos) && result;
00114 result = TestEquality("fZPos", this->fZPos,
00115 rCnd->fZPos) && result;
00116 result = TestEquality("fBestStripEnd", this->fBestStripEnd,
00117 rCnd->fBestStripEnd) && result;
00118 result = TestEquality("fCalTimeType", this->fCalTimeType,
00119 rCnd->fCalTimeType) && result;
00120
00121 return result;
00122 }
00123
00124
00125 CandStripHandle CandStrip::MakeCandidate(AlgHandle &ah, CandContext &cx)
00126 {
00127 CandStripHandle csh;
00128 new CandStrip(ah, csh, cx);
00129 return csh;
00130 }
00131
00132
00133 std::ostream& CandStrip::FormatToOStream(std::ostream& os,
00134 Option_t *option) const
00135 {
00136 CandBase::FormatToOStream(os,option);
00137
00138 TString opt(option);
00139 if (!opt.Contains("v0")) {
00140 const TString& indent = GetIndentString();
00141
00142 static MsgFormat tfmt("f6.3");
00143 static MsgFormat zfmt("f8.3");
00144 static MsgFormat indxfmt("i6");
00145 static MsgFormat ifmt("i4");
00146 static MsgFormat timefmt("f10.9");
00147 os << indent << GetDataIndent()
00148 << fBestStripEnd.AsString("c")
00149 << " T=" << tfmt(fTPos)
00150 << " Z=" << zfmt(fZPos)
00151 << " CalTime=" << CalTimeType::AsString(fCalTimeType)
00152 << endl;
00153 }
00154 return os;
00155
00156 }
00157
00158