Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

CandTrackSRList.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandTrackSRList.cxx,v 1.14 2004/04/10 00:49:14 gmieg Exp $
00003 //
00004 // CandTrackSRList
00005 //
00006 // This is a concrete Event Candidate (Reconstruction) object.
00007 // CandTrackSRList is descended from CandTrackList.
00008 //
00009 // Each concrete CandBase must define a Dup function.
00010 // CandBase must grant friendship to class CandRefer.
00011 //
00012 // Author:  R. Lee 2001.02.26
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)  // Should be the next class up on inheritance chain
00042 , fTrackClusterList(0)
00043 , fCPUTime(0.)
00044 {
00045 
00046 // The sole purpose of this constructor is to transmit the AlgHandle
00047 // up the inheritance chain to CandBase without having to invoke the
00048 // full constructor of an intermediate Candidate type which the highest
00049 // level Candidate might inherit from.  One only wants to create the
00050 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00051 }
00052 
00053 //______________________________________________________________________
00054 CandTrackSRList::CandTrackSRList(AlgHandle &ah, CandHandle &ch,
00055                                                       CandContext &cx) :
00056   CandTrackList(ah)  // Should be the next class up on inheritance chain
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 // Run Algorithm to construct Candidate
00071   {                                                   // Start of scope.
00072     CandTrackSRListHandle cshl(this);       // cshl will go out of scope
00073     ch = cshl;                                      // after setting ch.
00074   }                                                     // End of scope.
00075   ah.RunAlg(ch, cx);
00076 }
00077 
00078 //______________________________________________________________________
00079 CandTrackSRList::CandTrackSRList(const CandTrackSRList &rhs) :
00080   CandTrackList(rhs) // Should be the next class up on inheritance chain
00081 , fTrackClusterList(new TObjArray)
00082 , fCPUTime(rhs.fCPUTime)
00083 {
00084 
00085 //CreateLocalHandle(); // Moved to Dup function following copy-ctor call
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 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00133 // Daughter List copy is made in the derived class Dup() function.
00134 // This is because base class copy constructor hasn't yet created
00135 // fLocalHandle with a CandHandle* of the full derived type.
00136   CandTrackSRList *cb = new CandTrackSRList(*this);         // Copy-ctor
00137   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
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;   // superclass
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); //cshl owns the new CandTrackSRList
00171   return cshl;
00172 }

Generated on Mon Feb 15 11:06:30 2010 for loon by  doxygen 1.3.9.1