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

CandDigitList.cxx

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

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