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