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

CandDeMuxDigit.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandDeMuxDigit.cxx,v 1.5 2004/04/26 03:56:21 rhatcher Exp $
00003 //
00004 // CandDeMuxDigit.cxx
00005 //
00006 // This is a concrete DeMuxDigit Candidate (Reconstruction) object.
00007 // CandDeMuxDigit is descended from CandDigit.
00008 //
00009 // Each concrete CandBase must define a Dup function.
00010 // CandBase must grant friendship to class CandRefer.
00011 //
00012 // Author:  G. Irwin 5/2002
00014 
00015 #include "Algorithm/AlgHandle.h"
00016 #include "CandDigit/CandDeMuxDigit.h"
00017 #include "CandDigit/CandDeMuxDigitHandle.h"
00018 #include "MessageService/MsgService.h"
00019 
00020 ClassImp(CandDeMuxDigit)
00021 
00022 //______________________________________________________________________
00023 CVSID("$Id: CandDeMuxDigit.cxx,v 1.5 2004/04/26 03:56:21 rhatcher Exp $");
00024 
00025 //______________________________________________________________________
00026 CandDeMuxDigit::CandDeMuxDigit() :
00027   fDeMuxDigitFlag(0)
00028 {
00029 
00030   MSG("Cand", Msg::kDebug)
00031               << "Begin CandDeMuxDigit::CandDeMuxDigit() ctor: " << endl
00032                                            << "UidInt = " << GetUidInt()
00033                            << ", ArchUidInt " << GetArchUidInt() << endl
00034                              << "No. of links = " << GetNLinks() << endl
00035                 << "End CandDeMuxDigit::CandDeMuxDigit() ctor." << endl;
00036 }
00037 
00038 //______________________________________________________________________
00039 CandDeMuxDigit::CandDeMuxDigit(AlgHandle &ah) :
00040   CandDigit(ah),     // Should be the next class up on inheritance chain
00041   fDeMuxDigitFlag(0)
00042 {
00043 
00044 // The sole purpose of this constructor is to transmit the AlgHandle
00045 // up the inheritance chain to CandBase without having to invoke the
00046 // full constructor of an intermediate Candidate type which the highest
00047 // level Candidate might inherit from.  One only wants to create the
00048 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00049 
00050 }
00051 
00052 //______________________________________________________________________
00053 CandDeMuxDigit::CandDeMuxDigit(AlgHandle &ah, CandHandle &ch,
00054                                                       CandContext &cx) :
00055   CandDigit(ah),     // Should be the next class up on inheritance chain
00056   fDeMuxDigitFlag(0)
00057 {
00058   CreateLocalHandle();
00059   MSG("Cand", Msg::kDebug)
00060    << "Begin CandDeMuxDigit::CandDeMuxDigit(AlgHandle &, CandHandle &, "
00061                                       << "CandContext &) ctor: " << endl
00062                                            << "UidInt = " << GetUidInt()
00063                            << ", ArchUidInt " << GetArchUidInt() << endl
00064                              << "No. of links = " << GetNLinks() << endl
00065      << "End CandDeMuxDigit::CandDeMuxDigit(AlgHandle &, CandHandle &, "
00066                                       << "CandContext &) ctor." << endl;
00067 
00068 // Run Algorithm to construct Candidate
00069    {                                                  // Start of scope.
00070      CandDeMuxDigitHandle cdh(this);         // cdh will go out of scope
00071      ch = cdh;                                      // after setting ch.
00072    }                                                    // End of scope.
00073    ah.RunAlg(ch, cx);
00074 }
00075 
00076 //______________________________________________________________________
00077 CandDeMuxDigit::CandDeMuxDigit(const CandDeMuxDigit &rhs) :
00078   CandDigit(rhs),    // Should be the next class up on inheritance chain
00079   fDeMuxDigitFlag(rhs.fDeMuxDigitFlag)
00080 {
00081   MSG("Cand", Msg::kDebug)
00082 << "Begin CandDeMuxDigit::CandDeMuxDigit(const CandDeMuxDigit&rhs)ctor:"
00083                                                                  << endl
00084                                            << "UidInt = " << GetUidInt()
00085                            << ", ArchUidInt " << GetArchUidInt() << endl
00086                              << "No. of links = " << GetNLinks() << endl
00087 << "End CandDeMuxDigit::CandDeMuxDigit(const CandDeMuxDigit &rhs) ctor."
00088                                                                 << endl;
00089 }
00090 
00091 //______________________________________________________________________
00092 CandDeMuxDigit::CandDeMuxDigit(const CandDigit &rhs) : // Special method
00093   CandDigit(rhs),    // Should be the next class up on inheritance chain
00094   fDeMuxDigitFlag(0)
00095 {
00096   MSG("Cand", Msg::kDebug)
00097 << "Begin CandDeMuxDigit::CandDeMuxDigit(const CandDigit&rhs)ctor:"
00098                                                                  << endl
00099                                            << "UidInt = " << GetUidInt()
00100                            << ", ArchUidInt " << GetArchUidInt() << endl
00101                              << "No. of links = " << GetNLinks() << endl
00102 << "End CandDeMuxDigit::CandDeMuxDigit(const CandDigit &rhs) ctor."
00103                                                                 << endl;
00104 }
00105 
00106 //______________________________________________________________________
00107 CandDeMuxDigit::~CandDeMuxDigit()
00108 {
00109   MSG("Cand", Msg::kDebug)
00110              << "Begin CandDeMuxDigit::~CandDeMuxDigit() dtor: " << endl
00111                                            << "UidInt = " << GetUidInt()
00112                            << ", ArchUidInt " << GetArchUidInt() << endl
00113                              << "No. of links = " << GetNLinks() << endl
00114                << "End CandDeMuxDigit::~CandDeMuxDigit() dtor." << endl;
00115 }
00116 
00117 //______________________________________________________________________
00118 void CandDeMuxDigit::CreateLocalHandle()
00119 {
00120   SetLocalHandle(new CandDeMuxDigitHandle(this));
00121 }
00122 
00123 //______________________________________________________________________
00124 CandDeMuxDigit *CandDeMuxDigit::Dup() const
00125 {
00126 
00127 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00128 // Daughter List copy is made in the derived class Dup() function.
00129 // This is because base class copy constructor hasn't yet created
00130 // fLocalHandle with a CandHandle* of the full derived type.
00131   CandDeMuxDigit *cb = new CandDeMuxDigit(*this); // Copy-ctor dups ptrs
00132   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00133   TIter iterdau = GetDaughterIterator();
00134   CandHandle *dau;
00135   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00136   return cb;
00137 }
00138 
00139 //______________________________________________________________________
00140 Bool_t CandDeMuxDigit::IsEquivalent(const TObject *rhs) const
00141 {
00142   Bool_t result = true;
00143   if (!CandDigit::IsEquivalent(rhs)) result = false;  // superclass test
00144   TestDisplayCandBanner("CandDeMuxDigit");
00145   const CandDeMuxDigit* rCnd = dynamic_cast<const CandDeMuxDigit*>(rhs);
00146   if (rCnd == NULL) return false;
00147   
00148   result = TestEquality("fDeMuxDigitFlag",
00149                                        this->fDeMuxDigitFlag,
00150                                        rCnd->fDeMuxDigitFlag) && result;
00151 
00152   return result;
00153 }
00154 
00155 //______________________________________________________________________
00156 CandDeMuxDigitHandle CandDeMuxDigit::MakeCandidate(AlgHandle &ah,
00157                                                         CandContext &cx)
00158 {
00159   CandDeMuxDigitHandle cdh;
00160   new CandDeMuxDigit(ah, cdh, cx);    // cdh owns the new CandDeMuxDigit
00161   return cdh;
00162 }
00163 
00164 //______________________________________________________________________
00165 std::ostream& CandDeMuxDigit::FormatToOStream(std::ostream& os,
00166                                               Option_t *option) const
00167 {
00168   CandDigit::FormatToOStream(os,option);
00169 
00170   TString opt(option);
00171   if (!opt.Contains("v0")) { // v0 means suppress the data values
00172     const TString& indent = GetIndentString();
00173     os << indent << GetDataIndent()
00174        << AsString((DeMuxDigitFlag_t)fDeMuxDigitFlag)
00175        << endl;
00176   }
00177   return os;
00178   
00179 }
00180 
00181 //______________________________________________________________________
00182 const char* CandDeMuxDigit::AsString(DeMuxDigitFlag_t dflag)
00183 {
00184   if (dflag == kDeMuxOK) return "=DeMuxOK=";
00185   
00186   std::string result("=");
00187   if (dflag & kXTalk     ) result += "XTalk,";
00188   if (dflag & kLowSignal ) result += "LowSignal,";
00189 
00190   static Int_t unknownBits = ~(kXTalk|kLowSignal);
00191   if ( dflag & unknownBits ) return Form("0x%8.8x",dflag);  // dump hex if unknown bits
00192 
00193   // replace trailing ',' with = delimiter
00194   result.replace(result.size()-1,1,"=");
00195   return Form("%s",result.c_str());
00196 }
00197 
00198 //______________________________________________________________________

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