00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015 #include "TClass.h"
00016
00017 #include "Algorithm/AlgHandle.h"
00018 #include "MessageService/MsgService.h"
00019 #include "MessageService/MsgFormat.h"
00020 #include "RecoBase/CandCluster.h"
00021 #include "RecoBase/CandClusterHandle.h"
00022 #include "RecoBase/CandSliceHandle.h"
00023
00024 ClassImp(CandCluster)
00025
00026
00027 CVSID("$Id: CandCluster.cxx,v 1.13 2005/02/02 11:38:35 tagg Exp $");
00028
00029 #include "Candidate/CandBase.tpl"
00030
00031
00032 CandCluster::CandCluster() :
00033 fCandSlice(0),
00034 fTrackLike(0),
00035 fShowerLike(0)
00036 {
00037 MSG("Cand", Msg::kDebug)
00038 << "Begin CandCluster::CandCluster() ctor: " << endl
00039 << "UidInt = " << GetUidInt()
00040 << ", ArchUidInt " << GetArchUidInt() << endl
00041 << "No. of links = " << GetNLinks() << endl
00042 << "End CandCluster::CandCluster() ctor." << endl;
00043 }
00044
00045
00046 CandCluster::CandCluster(AlgHandle &ah) :
00047 CandBase(ah),
00048 fCandSlice(0),
00049 fTrackLike(0),
00050 fShowerLike(0)
00051 {
00052
00053
00054
00055
00056
00057
00058 }
00059
00060
00061 CandCluster::CandCluster(AlgHandle &ah, CandHandle &ch,
00062 CandContext &cx) :
00063 CandBase(ah),
00064 fCandSlice(0),
00065 fTrackLike(0),
00066 fShowerLike(0)
00067 {
00068 CreateLocalHandle();
00069 MSG("Cand", Msg::kDebug)
00070 << "Begin CandCluster::CandCluster(AlgHandle &, CandHandle &, "
00071 << "CandContext &) ctor: " << endl
00072 << "UidInt = " << GetUidInt()
00073 << ", ArchUidInt " << GetArchUidInt() << endl
00074 << "No. of links = " << GetNLinks() << endl
00075 << "End CandCluster::CandCluster(AlgHandle &, CandHandle &, "
00076 << "CandContext &) ctor." << endl;
00077
00078
00079 {
00080 CandClusterHandle cdh(this);
00081 ch = cdh;
00082 }
00083 ah.RunAlg(ch, cx);
00084 }
00085
00086
00087 CandCluster::CandCluster(const CandCluster &rhs) :
00088 CandBase(rhs),
00089 fCandSlice(0),
00090 fTrackLike(rhs.fTrackLike),
00091 fShowerLike(rhs.fShowerLike)
00092 {
00093
00094
00095 MSG("Cand", Msg::kDebug)
00096 << "Begin CandCluster::CandCluster(const CandCluster &rhs) ctor: "
00097 << endl
00098 << "UidInt = " << GetUidInt()
00099 << ", ArchUidInt " << GetArchUidInt() << endl
00100 << "No. of links = " << GetNLinks() << endl
00101 << "End CandCluster::CandCluster(const CandCluster &rhs) ctor."
00102 << endl;
00103
00104 if (rhs.fCandSlice)
00105 fCandSlice = (rhs.fCandSlice)->DupHandle();
00106
00107 }
00108
00109
00110 CandCluster::~CandCluster()
00111 {
00112 MSG("Cand", Msg::kDebug)
00113 << "Begin CandCluster::~CandCluster() dtor: " << endl
00114 << "UidInt = " << GetUidInt()
00115 << ", ArchUidInt " << GetArchUidInt() << endl
00116 << "No. of links = " << GetNLinks() << endl
00117 << "End CandCluster::~CandCluster() dtor." << endl;
00118
00119
00120 delete fCandSlice;
00121 }
00122
00123
00124 void CandCluster::CreateLocalHandle()
00125 {
00126 SetLocalHandle(new CandClusterHandle(this));
00127 }
00128
00129
00130 CandCluster *CandCluster::Dup() const
00131 {
00132
00133
00134
00135
00136
00137 CandCluster *cb = new CandCluster(*this);
00138 cb->CreateLocalHandle();
00139 cb->SetCandRecord(fCandRecord);
00140 TIter iterdau = GetDaughterIterator();
00141 CandHandle *dau;
00142 while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00143 return cb;
00144 }
00145
00146
00147 Bool_t CandCluster::IsEquivalent(const TObject *rhs) const
00148 {
00149 Bool_t result = true;
00150 if (!CandBase::IsEquivalent(rhs)) result = false;
00151 TestDisplayCandBanner("CandCluster");
00152 const CandCluster* rCnd = dynamic_cast<const CandCluster*>(rhs);
00153 if (rCnd == NULL) return false;
00154
00155 result = TestCandHandleDup("fCandSlice", this->fCandSlice,
00156 rCnd->fCandSlice) && result;
00157 result = TestEquality("fTrackLike", this->fTrackLike,
00158 rCnd->fTrackLike) && result;
00159
00160 result = TestEquality("fShowerLike", this->fShowerLike,
00161 rCnd->fShowerLike) && result;
00162 return result;
00163 }
00164
00165
00166 CandClusterHandle CandCluster::MakeCandidate(AlgHandle &ah,
00167 CandContext &cx)
00168 {
00169 CandClusterHandle cdh;
00170 new CandCluster(ah, cdh, cx);
00171 return cdh;
00172 }
00173
00174
00175 std::ostream& CandCluster::FormatToOStream(std::ostream& os,
00176 Option_t *option) const
00177 {
00178 CandBase::FormatToOStream(os,option);
00179
00180
00181 TString opt(option);
00182 if (!opt.Contains("v0")) {
00183 const TString& indent = GetIndentString();
00184
00185 os << indent << GetDataIndent()
00186 << "TrackLike=" << (fTrackLike?"true":"false")
00187 << " ShowerLike=" << (fShowerLike?"true":"false")
00188 << endl;
00189 }
00190 return os;
00191
00192 }
00193
00194
00195 void CandCluster::Streamer(TBuffer &R__b)
00196 {
00197
00198
00199 if (R__b.IsReading()) {
00200 UInt_t R__s, R__c;
00201 Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
00202 CandCluster::Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
00203 if (R__v < 2) {
00204 if (fCandSlice) fCandSlice = fCandSlice->DupHandle();
00205 }
00206 }
00207 else {
00208 CandCluster::Class()->WriteBuffer(R__b, this);
00209 }
00210 }
00211
00212