00001 00002 // 00003 // CandCluster3DList (based on R.Lee's CandClusterSRList) 00004 // 00005 // Concrete CandCluster3DList class 00006 // 00007 // Author: K.Grzelak1@physics.ox.ac.uk 00009 00010 #include "Algorithm/AlgHandle.h" 00011 #include "Candidate/CandContext.h" 00012 #include "Candidate/CandHandle.h" 00013 #include "Cluster3D/CandCluster3DList.h" 00014 #include "Cluster3D/CandCluster3DListHandle.h" 00015 #include "MessageService/MsgService.h" 00016 00017 ClassImp(CandCluster3DList) 00018 00019 CVSID("$Id: CandCluster3DList.cxx,v 1.4 2007/03/01 17:24:59 rhatcher Exp $"); 00020 00021 //______________________________________________________________________ 00022 CandCluster3DList::CandCluster3DList() 00023 { 00024 MSG("Cluster3D", Msg::kDebug) 00025 << "Standard constructor " << endl; 00026 } 00027 00028 //______________________________________________________________________ 00029 CandCluster3DList::CandCluster3DList(AlgHandle &ah) : 00030 //CandClusterList(ah)// Should be the next class up on inheritance chain 00031 CandRecoList(ah)// Should be the next class up on inheritance chain 00032 { 00033 00034 // The sole purpose of this constructor is to transmit the AlgHandle 00035 // up the inheritance chain to CandBase without having to invoke the 00036 // full constructor of an intermediate Candidate type which the highest 00037 // level Candidate might inherit from. One only wants to create the 00038 // LocalHandle and invoke the RunAlg() method in the lowest level class. 00039 } 00040 00041 //______________________________________________________________________ 00042 CandCluster3DList::CandCluster3DList(AlgHandle &ah, CandHandle &ch, 00043 CandContext &cx) : 00044 //CandClusterList(ah)// Should be the next class up on inheritance chain 00045 CandRecoList(ah)// Should be the next class up on inheritance chain 00046 { 00047 CreateLocalHandle(); 00048 // Run Algorithm to construct Candidate 00049 { // Start of scope 00050 CandCluster3DListHandle cshl(this); // cshl will go out of scope 00051 ch = cshl; // after setting ch. 00052 } // End of scope 00053 ah.RunAlg(ch, cx); 00054 } 00055 00056 //______________________________________________________________________ 00057 CandCluster3DList::CandCluster3DList(const CandCluster3DList &rhs) : 00058 //CandClusterList(rhs)//Should be the next class up on inheritance chain 00059 CandRecoList(rhs)//Should be the next class up on inheritance chain 00060 { 00061 00062 //CreateLocalHandle(); // Moved to Dup function following copy-ctor call 00063 00064 } 00065 00066 //______________________________________________________________________ 00067 CandCluster3DList::~CandCluster3DList() 00068 { 00069 MSG("Cluster3D", Msg::kDebug) 00070 << "Destructor " << endl; 00071 } 00072 00073 //______________________________________________________________________ 00074 void CandCluster3DList::CreateLocalHandle() 00075 { 00076 SetLocalHandle(new CandCluster3DListHandle(this)); 00077 } 00078 00079 //______________________________________________________________________ 00080 CandCluster3DList *CandCluster3DList::Dup() const 00081 { 00082 00083 // Base copy ctor dups owned pointers, but defers copying Daughter List. 00084 // Daughter List copy is made in the derived class Dup() function. 00085 // This is because base class copy constructor hasn't yet created 00086 // fLocalHandle with a CandHandle* of the full derived type. 00087 CandCluster3DList *cb = new CandCluster3DList(*this); // Copy-ctor 00088 cb->CreateLocalHandle(); // Initializes fLocalHandle after copy-ctor 00089 TIter iterdau = GetDaughterIterator(); 00090 CandHandle *dau; 00091 while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau); 00092 return cb; 00093 } 00094 00095 //______________________________________________________________________ 00096 Bool_t CandCluster3DList::IsEquivalent(const TObject *rhs) const 00097 { 00098 Bool_t result = true; 00099 //if (!CandClusterList::IsEquivalent(rhs)) result = false; // superclass 00100 if (!CandRecoList::IsEquivalent(rhs)) result = false; // superclass 00101 TestDisplayCandBanner("CandCluster3DList"); 00102 const CandCluster3DList* rCnd = 00103 dynamic_cast<const CandCluster3DList*>(rhs); 00104 if (rCnd == NULL) return false; 00105 00106 TestNothing("CandCluster3DList"); 00107 return result; 00108 } 00109 00110 //______________________________________________________________________ 00111 CandCluster3DListHandle CandCluster3DList::MakeCandidate(AlgHandle &ah, 00112 CandContext &cx) 00113 { 00114 // Create a handle 00115 CandCluster3DListHandle cshl; 00116 00117 // Create Candidate passing in handle, algorithm and context 00118 new CandCluster3DList(ah, cshl, cx); //cshl owns new CandCluster3DList 00119 00120 return cshl; 00121 }
1.3.9.1