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

CandCluster3D.cxx

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

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