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

CandSlice.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandSlice.cxx,v 1.10 2005/02/02 11:38:35 tagg Exp $
00003 //
00004 // CandSlice.cxx
00005 //
00006 // This is a concrete Event Candidate (Reconstruction) object.
00007 // CandSlice is descended from CandBase.
00008 //
00009 // Each concrete CandBase must define a Dup function.
00010 // CandBase must grant friendship to class CandRefer.
00011 //
00012 // Author:  R. Lee
00014 
00015 #include "Algorithm/AlgHandle.h"
00016 #include "MessageService/MsgService.h"
00017 #include "MessageService/MsgFormat.h"
00018 #include "RecoBase/CandSlice.h"
00019 #include "RecoBase/CandSliceHandle.h"
00020 
00021 ClassImp(CandSlice)
00022 
00023 //______________________________________________________________________
00024 CVSID("$Id: CandSlice.cxx,v 1.10 2005/02/02 11:38:35 tagg Exp $");
00025 
00026 #include "Candidate/CandBase.tpl"
00027 
00028 //______________________________________________________________________
00029 CandSlice::CandSlice()
00030 {
00031   MSG("Cand", Msg::kDebug)
00032                         << "Begin CandSlice::CandSlice() ctor: " << endl
00033                                            << "UidInt = " << GetUidInt()
00034                            << ", ArchUidInt " << GetArchUidInt() << endl
00035                              << "No. of links = " << GetNLinks() << endl
00036                           << "End CandSlice::CandSlice() ctor." << endl;
00037 }
00038 
00039 //______________________________________________________________________
00040 CandSlice::CandSlice(AlgHandle &ah) :
00041   CandBase(ah)      // Should be the next class up on inheritance chain
00042  
00043 {
00044 
00045 // The sole purpose of this constructor is to transmit the AlgHandle
00046 // up the inheritance chain to CandBase without having to invoke the
00047 // full constructor of an intermediate Candidate type which the highest
00048 // level Candidate might inherit from.  One only wants to create the
00049 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00050 }
00051 
00052 //______________________________________________________________________
00053 CandSlice::CandSlice(AlgHandle &ah, CandHandle &ch, CandContext &cx) :
00054   CandBase(ah)      // Should be the next class up on inheritance chain
00055  
00056 {
00057   CreateLocalHandle();
00058   MSG("Cand", Msg::kDebug)
00059              << "Begin CandSlice::CandSlice(AlgHandle &, CandHandle &, "
00060                                       << "CandContext &) ctor: " << endl
00061                                            << "UidInt = " << GetUidInt()
00062                            << ", ArchUidInt " << GetArchUidInt() << endl
00063                              << "No. of links = " << GetNLinks() << endl
00064                << "End CandSlice::CandSlice(AlgHandle &, CandHandle &, "
00065                                       << "CandContext &) ctor." << endl;
00066 
00067 // Run Algorithm to construct Candidate
00068    {                                                  // Start of scope.
00069      CandSliceHandle cdh(this);              // cdh will go out of scope
00070      ch = cdh;                                      // after setting ch.
00071    }                                                    // End of scope.
00072    ah.RunAlg(ch, cx);
00073 }
00074 
00075 //______________________________________________________________________
00076 CandSlice::CandSlice(const CandSlice &rhs) :
00077   CandBase(rhs)     // Should be the next class up on inheritance chain
00078 
00079 {
00080 
00081 //CreateLocalHandle(); // Moved to Dup function following copy-ctor call
00082   MSG("Cand", Msg::kDebug)
00083     << "Begin CandSlice::CandSlice(const CandSlice &rhs) ctor: " << endl
00084                                            << "UidInt = " << GetUidInt()
00085                            << ", ArchUidInt " << GetArchUidInt() << endl
00086                              << "No. of links = " << GetNLinks() << endl
00087       << "End CandSlice::CandSlice(const CandSlice &rhs) ctor." << endl;
00088 }
00089 
00090 //______________________________________________________________________
00091 CandSlice::~CandSlice()
00092 {
00093   MSG("Cand", Msg::kDebug)
00094                        << "Begin CandSlice::~CandSlice() dtor: " << endl
00095                                            << "UidInt = " << GetUidInt()
00096                            << ", ArchUidInt " << GetArchUidInt() << endl
00097                              << "No. of links = " << GetNLinks() << endl
00098                          << "End CandSlice::~CandSlice() dtor." << endl;
00099 }
00100 
00101 //______________________________________________________________________
00102 void CandSlice::CreateLocalHandle()
00103 {
00104   SetLocalHandle(new CandSliceHandle(this));
00105 }
00106 
00107 //______________________________________________________________________
00108 CandSlice *CandSlice::Dup() const
00109 {
00110 
00111 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00112 // Daughter List copy is made in the derived class Dup() function.
00113 // This is because base class copy constructor hasn't yet created
00114 // fLocalHandle with a CandHandle* of the full derived type.
00115   CandSlice *cb = new CandSlice(*this);           // Copy-ctor dups ptrs
00116   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00117   TIter iterdau = GetDaughterIterator();
00118   CandHandle *dau;
00119   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00120   return cb;
00121 }
00122 
00123 //______________________________________________________________________
00124 Bool_t CandSlice::IsEquivalent(const TObject *rhs) const
00125 {
00126   Bool_t result = true;
00127   if (!CandBase::IsEquivalent(rhs)) result = false;   // superclass test
00128   TestDisplayCandBanner("CandSlice");
00129   const CandSlice* rCnd = dynamic_cast<const CandSlice*>(rhs);
00130   if (rCnd == NULL) return false;
00131 
00132   
00133   return result;
00134 }
00135 
00136 //______________________________________________________________________
00137 CandSliceHandle CandSlice::MakeCandidate(AlgHandle &ah, CandContext &cx)
00138 {
00139   CandSliceHandle cdh;
00140   new CandSlice(ah, cdh, cx);              // cdh owns the new CandSlice
00141   return cdh;
00142 }
00143 
00144 //______________________________________________________________________
00145 std::ostream& CandSlice::FormatToOStream(std::ostream& os,
00146                                          Option_t *option) const
00147 {
00148   CandBase::FormatToOStream(os,option);
00149   return os;
00150   
00151 }
00152 
00153 //______________________________________________________________________

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