00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00014
00015 #include "Algorithm/AlgHandle.h"
00016 #include "CandTrackSR/CandTrackSRList.h"
00017 #include "CandTrackSR/CandTrackSRListHandle.h"
00018 #include "CandTrackSR/TrackClusterSR.h"
00019 #include "MessageService/MsgService.h"
00020
00021 ClassImp(CandTrackSRList)
00022
00023
00024 CVSID("$Id: CandTrackSRList.cxx,v 1.14 2004/04/10 00:49:14 gmieg Exp $");
00025
00026
00027 CandTrackSRList::CandTrackSRList() :
00028 fTrackClusterList(0)
00029 , fCPUTime(0.)
00030 {
00031 MSG("Cand", Msg::kDebug)
00032 << "Begin CandTrackSRList::CandTrackSRList() ctor: " << endl
00033 << "UidInt = " << GetUidInt()
00034 << ", ArchUidInt " << GetArchUidInt() << endl
00035 << "No. of links = " << GetNLinks() << endl
00036 << "End CandTrackSRList::CandTrackSRList() ctor." << endl;
00037 }
00038
00039
00040 CandTrackSRList::CandTrackSRList(AlgHandle &ah) :
00041 CandTrackList(ah)
00042 , fTrackClusterList(0)
00043 , fCPUTime(0.)
00044 {
00045
00046
00047
00048
00049
00050
00051 }
00052
00053
00054 CandTrackSRList::CandTrackSRList(AlgHandle &ah, CandHandle &ch,
00055 CandContext &cx) :
00056 CandTrackList(ah)
00057 , fTrackClusterList(new TObjArray)
00058 , fCPUTime(0.)
00059 {
00060 CreateLocalHandle();
00061 MSG("Cand", Msg::kDebug)
00062 << "Begin CandTrackSRList::CandTrackSRList(AlgHandle &, CandHandle &,"
00063 << " CandContext &) ctor: " << endl
00064 << "UidInt = " << GetUidInt()
00065 << ", ArchUidInt " << GetArchUidInt() << endl
00066 << "No. of links = " << GetNLinks() << endl
00067 << "End CandTrackSRList::CandTrackSRList(AlgHandle &, CandHandle &, "
00068 << "CandContext &) ctor." << endl;
00069
00070
00071 {
00072 CandTrackSRListHandle cshl(this);
00073 ch = cshl;
00074 }
00075 ah.RunAlg(ch, cx);
00076 }
00077
00078
00079 CandTrackSRList::CandTrackSRList(const CandTrackSRList &rhs) :
00080 CandTrackList(rhs)
00081 , fTrackClusterList(new TObjArray)
00082 , fCPUTime(rhs.fCPUTime)
00083 {
00084
00085
00086 MSG("Cand", Msg::kDebug)
00087 << "Begin CandTrackSRList::CandTrackSRList"
00088 << "(const CandTrackSRList &rhs) ctor: " << endl
00089 << "UidInt = " << GetUidInt()
00090 << ", ArchUidInt " << GetArchUidInt() << endl
00091 << "No. of links = " << GetNLinks() << endl
00092 << "End CandTrackSRList::CandTrackSRList"
00093 << "(const CandTrackSRList &rhs) ctor." << endl;
00094
00095 for (int i=0; i<=rhs.fTrackClusterList->GetLast(); i++) {
00096 TrackClusterSR *tc =
00097 dynamic_cast<TrackClusterSR*>(rhs.fTrackClusterList->At(i));
00098 fTrackClusterList->Add(new TrackClusterSR(*tc));
00099 }
00100 }
00101
00102
00103 CandTrackSRList::~CandTrackSRList()
00104 {
00105 MSG("Cand", Msg::kDebug)
00106 << "Begin CandTrackSRList::~CandTrackSRList() dtor: " << endl
00107 << "UidInt = " << GetUidInt()
00108 << ", ArchUidInt " << GetArchUidInt() << endl
00109 << "No. of links = " << GetNLinks() << endl
00110 << "End CandTrackSRList::~CandTrackSRList() dtor." << endl;
00111
00112 if (fTrackClusterList) {
00113 for (int i=0; i<=fTrackClusterList->GetLast(); i++) {
00114 TrackClusterSR *tc =
00115 dynamic_cast<TrackClusterSR*>(fTrackClusterList->At(i));
00116 delete tc;
00117 }
00118 delete fTrackClusterList;
00119 }
00120 }
00121
00122
00123 void CandTrackSRList::CreateLocalHandle()
00124 {
00125 SetLocalHandle(new CandTrackSRListHandle(this));
00126 }
00127
00128
00129 CandTrackSRList *CandTrackSRList::Dup() const
00130 {
00131
00132
00133
00134
00135
00136 CandTrackSRList *cb = new CandTrackSRList(*this);
00137 cb->CreateLocalHandle();
00138 TIter iterdau = GetDaughterIterator();
00139 CandHandle *dau;
00140 while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00141 return cb;
00142 }
00143
00144
00145 Bool_t CandTrackSRList::IsEquivalent(const TObject *rhs) const
00146 {
00147 Bool_t result = true;
00148 if (!CandTrackList::IsEquivalent(rhs)) result = false;
00149 TestDisplayCandBanner("CandTrackSRList");
00150 const CandTrackSRList* rCnd =
00151 dynamic_cast<const CandTrackSRList*>(rhs);
00152 if (rCnd == NULL) return false;
00153
00154 result = TestGenericElemPtrTObjArrayPtrEquivalence<TrackClusterSR>(
00155 "fTrackClusterList",
00156 this->fTrackClusterList,
00157 rCnd->fTrackClusterList,
00158 kTRUE) && result;
00159 result = TestEquality("fCPUTime", this->fCPUTime, rCnd->fCPUTime)
00160 && result;
00161
00162 return result;
00163 }
00164
00165
00166 CandTrackSRListHandle CandTrackSRList::MakeCandidate(AlgHandle &ah,
00167 CandContext &cx)
00168 {
00169 CandTrackSRListHandle cshl;
00170 new CandTrackSRList(ah, cshl, cx);
00171 return cshl;
00172 }