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

CandShowerSR.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandShowerSR.cxx,v 1.11 2005/08/28 00:17:19 gmieg Exp $
00003 //
00004 // CandShowerSR.cxx
00005 //
00007 
00008 #include "TClass.h"
00009 
00010 #include "Algorithm/AlgHandle.h"
00011 #include "MessageService/MsgService.h"
00012 #include "CandShowerSR/CandShowerSR.h"
00013 #include "CandShowerSR/CandShowerSRHandle.h"
00014 
00015 ClassImp(CandShowerSR)
00016 
00017 //______________________________________________________________________
00018 CVSID("$Id: CandShowerSR.cxx,v 1.11 2005/08/28 00:17:19 gmieg Exp $");
00019 
00020 //______________________________________________________________________
00021 CandShowerSR::CandShowerSR() :
00022   nUSubShowers(0), nVSubShowers(0)
00023 {
00024   MSG("Cand", Msg::kDebug)
00025     << "Begin CandShowerSR::CandShowerSR() ctor: " << endl
00026     << "UidInt = " << GetUidInt()
00027     << ", ArchUidInt " << GetArchUidInt() << endl
00028     << "No. of links = " << GetNLinks() << endl
00029     << "End CandShowerSR::CandShowerSR() ctor." << endl;
00030 }
00031 
00032 //______________________________________________________________________
00033 CandShowerSR::CandShowerSR(AlgHandle &ah) :
00034   CandShower(ah),      // Should be the next class up on inheritance chain
00035   nUSubShowers(0), nVSubShowers(0)
00036 {
00037 
00038 // The sole purpose of this constructor is to transmit the AlgHandle
00039 // up the inheritance chain to CandBase without having to invoke the
00040 // full constructor of an intermediate Candidate type which the highest
00041 // level Candidate might inherit from.  One only wants to create the
00042 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00043 }
00044 
00045 //______________________________________________________________________
00046 CandShowerSR::CandShowerSR(AlgHandle &ah, CandHandle &ch, CandContext &cx) :
00047   CandShower(ah),      // Should be the next class up on inheritance chain
00048   nUSubShowers(0), nVSubShowers(0)
00049 {
00050   CreateLocalHandle();
00051   MSG("Cand", Msg::kDebug)
00052     << "Begin CandShowerSR::CandShowerSR(AlgHandle &, CandHandle &, "
00053     << "CandContext &) ctor: " << endl
00054     << "UidInt = " << GetUidInt()
00055     << ", ArchUidInt " << GetArchUidInt() << endl
00056     << "No. of links = " << GetNLinks() << endl
00057     << "End CandShowerSR::CandShowerSR(AlgHandle &, CandHandle &, "
00058     << "CandContext &) ctor." << endl;
00059   
00060   // Run Algorithm to construct Candidate
00061   {                                                   // Start of scope.
00062     CandShowerSRHandle csh(this);              // csh will go out of scope
00063     ch = csh;                                       // after setting ch.
00064   }                                                     // End of scope.
00065   ah.RunAlg(ch, cx);
00066 }
00067 
00068 //______________________________________________________________________
00069 CandShowerSR::CandShowerSR(const CandShowerSR &rhs) :
00070   CandShower(rhs),     // Should be the next class up on inheritance chain
00071   nUSubShowers(rhs.nUSubShowers), nVSubShowers(rhs.nVSubShowers)
00072 {
00073 
00074   //CreateLocalHandle(); // Moved to Dup function following copy-ctor call
00075   MSG("Cand", Msg::kDebug)
00076     << "Begin CandShowerSR::CandShowerSR(const CandShowerSR &rhs) ctor: " << endl
00077     << "UidInt = " << GetUidInt()
00078     << ", ArchUidInt " << GetArchUidInt() << endl
00079     << "No. of links = " << GetNLinks() << endl
00080     << "End CandShowerSR::CandShowerSR(const CandShowerSR &rhs) ctor." << endl;
00081   
00082   // fSubShowerList contents owned from CandShowerSR version 1
00083   CandHandle *ch;
00084   TIter ssiter(&rhs.fSubShowerList);
00085   while ((ch = dynamic_cast<CandHandle *>(ssiter())))
00086     fSubShowerList.Add(ch->DupHandle());
00087 }
00088 
00089 //______________________________________________________________________
00090 CandShowerSR::~CandShowerSR()
00091 {
00092   MSG("Cand", Msg::kDebug)
00093     << "Begin CandShowerSR::~CandShowerSR() dtor: " << endl
00094     << "UidInt = " << GetUidInt()
00095     << ", ArchUidInt " << GetArchUidInt() << endl
00096     << "No. of links = " << GetNLinks() << endl
00097     << "End CandShowerSR::~CandShowerSR() dtor." << endl;
00098   
00099   fSubShowerList.Delete();   // Owned CandHandle*'s from CandShowerSR vers 1
00100 }
00101 
00102 //______________________________________________________________________
00103 void CandShowerSR::CreateLocalHandle()
00104 {
00105   SetLocalHandle(new CandShowerSRHandle(this));
00106 }
00107 
00108 //______________________________________________________________________
00109 CandShowerSR *CandShowerSR::Dup() const
00110 {
00111   
00112 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00113 // Daughter List copy is made in the derived class Dup() function.
00114 // This is because base class copy constructor hasn't yet created
00115 // fLocalHandle with a CandHandle* of the full derived type.
00116   CandShowerSR *cb = new CandShowerSR(*this);         // Copy-ctor dups ptrs
00117   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00118   TIter iterdau = GetDaughterIterator();
00119   CandHandle *dau;
00120   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00121   return cb;
00122 }
00123 
00124 //______________________________________________________________________
00125 Bool_t CandShowerSR::IsEquivalent(const TObject *rhs) const
00126 {
00127   Bool_t result = true;
00128   if (!CandShower::IsEquivalent(rhs)) result = false;   // superclass test
00129   TestDisplayCandBanner("CandShowerSR");
00130   const CandShowerSR* rCnd = dynamic_cast<const CandShowerSR*>(rhs);
00131   if (rCnd == NULL) return false;
00132   
00133   result = TestTObjArrayCandHandleDup("fSubShowerList", 
00134                                       this->fSubShowerList,
00135                                       rCnd->fSubShowerList) && result;
00136   result = TestEquality("nUSubShowers",this->nUSubShowers,rCnd->nUSubShowers) && result;
00137   result = TestEquality("nVSubShowers",this->nVSubShowers,rCnd->nVSubShowers) && result;
00138 
00139   return result;
00140 }
00141 
00142 //______________________________________________________________________
00143 CandShowerSRHandle CandShowerSR::MakeCandidate(AlgHandle &ah,
00144                                                CandContext &cx)
00145 {
00146   CandShowerSRHandle csh;
00147   new CandShowerSR(ah, csh, cx);            // csh owns the new CandShowerSR
00148   return csh;
00149 }
00150 
00151 //______________________________________________________________________
00152 std::ostream& CandShowerSR::FormatToOStream(std::ostream& os,
00153                                             Option_t *option) const
00154 {
00155   CandShower::FormatToOStream(os,option);
00156 
00157   TString opt(option);
00158   if (!opt.Contains("v0")) { // v0 means suppress the data values
00159     const TString& indent = GetIndentString();
00160     
00161     os << indent << GetDataIndent()
00162        << "fSubShowerList.size " << fSubShowerList.GetSize()
00163        << " Num U SubShowers " << nUSubShowers
00164        << " Num V SubShowers " << nVSubShowers
00165        << endl;
00166   }
00167   return os; 
00168 }

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