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

CandDeMuxDigitList.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandDeMuxDigitList.cxx,v 1.6 2004/04/26 03:56:21 rhatcher Exp $
00003 //
00004 // CandDeMuxDigitList.cxx
00005 //
00006 // This is a concrete Event Candidate (Reconstruction) object.
00007 // CandDeMuxDigitList 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/CandDeMuxDigitList.h"
00017 #include "CandDigit/CandDeMuxDigitListHandle.h"
00018 #include "MessageService/MsgService.h"
00019 #include "MessageService/MsgFormat.h"
00020 
00021 // TString is needed for Form()
00022 #include "TString.h"
00023 
00024 ClassImp(CandDeMuxDigitList)
00025 
00026 //______________________________________________________________________
00027 CVSID("$Id: CandDeMuxDigitList.cxx,v 1.6 2004/04/26 03:56:21 rhatcher Exp $");
00028 
00029 //______________________________________________________________________
00030 CandDeMuxDigitList::CandDeMuxDigitList() :
00031   fDeMuxDigitListFlag(0)
00032 , fNumValidPlanesU(0)
00033 , fNumValidPlanesV(0)
00034 , fNumStrayPlanesU(0)
00035 , fNumStrayPlanesV(0)
00036 , fAvgTimeOffset(0.)
00037 {
00038   MSG("Cand", Msg::kDebug)
00039       << "Begin CandDeMuxDigitList::CandDeMuxDigitList() ctor: " << endl
00040                                            << "UidInt = " << GetUidInt()
00041                            << ", ArchUidInt " << GetArchUidInt() << endl
00042                              << "No. of links = " << GetNLinks() << endl
00043         << "End CandDeMuxDigitList::CandDeMuxDigitList() ctor." << endl;
00044 }
00045 
00046 //______________________________________________________________________
00047 CandDeMuxDigitList::CandDeMuxDigitList(AlgHandle &ah) :
00048   CandDigitList(ah)  // Should be the next class up on inheritance chain
00049 , fDeMuxDigitListFlag(0)
00050 , fNumValidPlanesU(0)
00051 , fNumValidPlanesV(0)
00052 , fNumStrayPlanesU(0)
00053 , fNumStrayPlanesV(0)
00054 , fAvgTimeOffset(0.)
00055 {
00056 
00057 // The sole purpose of this constructor is to transmit the AlgHandle
00058 // up the inheritance chain to CandBase without having to invoke the
00059 // full constructor of an intermediate Candidate type which the highest
00060 // level Candidate might inherit from.  One only wants to create the
00061 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00062 
00063 }
00064 
00065 //______________________________________________________________________
00066 CandDeMuxDigitList::CandDeMuxDigitList(AlgHandle &ah, CandHandle &ch,
00067                                                       CandContext &cx) :
00068   CandDigitList(ah)  // Should be the next class up on inheritance chain
00069 , fDeMuxDigitListFlag(0)
00070 , fNumValidPlanesU(0)
00071 , fNumValidPlanesV(0)
00072 , fNumStrayPlanesU(0)
00073 , fNumStrayPlanesV(0)
00074 , fAvgTimeOffset(0.)
00075 {
00076   CreateLocalHandle();
00077   MSG("Cand", Msg::kDebug)
00078    << "Begin CandDeMuxDigitList::CandDeMuxDigitList(AlgHandle &, CandHandle &, "
00079                                       << "CandContext& ) ctor: " << endl
00080                                            << "UidInt = " << GetUidInt()
00081                            << ", ArchUidInt " << GetArchUidInt() << endl
00082                              << "No. of links = " << GetNLinks() << endl
00083    << "End CandDeMuxDigitList::CandDeMuxDigitList(AlgHandle &, CandHandle &, "
00084                                      << "CandContext& ) ctor: " << endl;
00085 
00086 // Run Algorithm to construct Candidate
00087    {                                                  // Start of scope.
00088      CandDeMuxDigitListHandle cdlh(this);   // cdlh will go out of scope
00089      ch = cdlh;                                     // after setting ch.
00090    }                                                    // End of scope.
00091    ah.RunAlg(ch, cx);
00092 }
00093 
00094 //______________________________________________________________________
00095 CandDeMuxDigitList::CandDeMuxDigitList(const CandDeMuxDigitList &rhs) :
00096   CandDigitList(rhs) // Should be the next class up on inheritance chain
00097 , fDeMuxDigitListFlag(rhs.fDeMuxDigitListFlag)
00098 , fNumValidPlanesU(rhs.fNumValidPlanesU)
00099 , fNumValidPlanesV(rhs.fNumValidPlanesV)
00100 , fNumStrayPlanesU(rhs.fNumStrayPlanesU)
00101 , fNumStrayPlanesV(rhs.fNumStrayPlanesV)
00102 , fAvgTimeOffset(rhs.fAvgTimeOffset)
00103 {
00104   MSG("Cand", Msg::kDebug)
00105 << "Begin CandDeMuxDigitList::CandDeMuxDigitList(const CandDeMuxDigitList &) "
00106                                                      << "ctor: " << endl
00107                                            << "UidInt = " << GetUidInt()
00108                            << ", ArchUidInt " << GetArchUidInt() << endl
00109                              << "No. of links = " << GetNLinks() << endl
00110 << "End CandDeMuxDigitList::CandDeMuxDigitList(const CandDeMuxDigitList &) ctor."
00111                                                                 << endl;
00112 }
00113 
00114 //______________________________________________________________________
00115 CandDeMuxDigitList::~CandDeMuxDigitList()
00116 {
00117   MSG("Cand", Msg::kDebug)
00118        << "Begin CandDeMuxDigitList::~CandDeMuxDigitList() " << "dtor: "
00119        << endl
00120                                            << "UidInt = " << GetUidInt()
00121                            << ", ArchUidInt " << GetArchUidInt() << endl
00122                              << "No. of links = " << GetNLinks() << endl
00123        << "End CandDeMuxDigitList::~CandDeMuxDigitList() dtor." << endl;
00124 }
00125 
00126 //______________________________________________________________________
00127 void CandDeMuxDigitList::CreateLocalHandle()
00128 {
00129   SetLocalHandle(new CandDeMuxDigitListHandle(this));
00130 }
00131 
00132 //______________________________________________________________________
00133 CandDeMuxDigitList *CandDeMuxDigitList::Dup() const
00134 {
00135 
00136 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00137 // Daughter List copy is made in the derived class Dup() function.
00138 // This is because base class copy constructor hasn't yet created
00139 // fLocalHandle with a CandHandle* of the full derived type.
00140 // Copy-ctor dups ptrs
00141   CandDeMuxDigitList *cb = new CandDeMuxDigitList(*this);
00142   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00143   TIter iterdau = GetDaughterIterator();
00144   CandHandle *dau;
00145   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00146   return cb;
00147 }
00148 
00149 //______________________________________________________________________
00150 Bool_t CandDeMuxDigitList::IsEquivalent(const TObject *rhs) const
00151 {
00152   Bool_t result = true;
00153   if (!CandDigitList::IsEquivalent(rhs)) result = false;   // superclass
00154   TestDisplayCandBanner("CandDeMuxDigitList");
00155   const CandDeMuxDigitList* rCnd =
00156                            dynamic_cast<const CandDeMuxDigitList*>(rhs);
00157   if (rCnd == NULL) return false;
00158 
00159   result = TestEquality("fDeMuxDigitListFlag",
00160                                    this->fDeMuxDigitListFlag, 
00161                                    rCnd->fDeMuxDigitListFlag) && result;
00162   result = TestEquality("fNumValidPlanesU",
00163                                    this->fNumValidPlanesU, 
00164                                    rCnd->fNumValidPlanesU)    && result;
00165   result = TestEquality("fNumValidPlanesV",
00166                                    this->fNumValidPlanesV,
00167                                    rCnd->fNumValidPlanesV)    && result;
00168   result = TestEquality("fNumStrayPlanesU",
00169                                    this->fNumStrayPlanesU, 
00170                                    rCnd->fNumStrayPlanesU)    && result;
00171   result = TestEquality("fNumStrayPlanesV",
00172                                    this->fNumStrayPlanesV, 
00173                                    rCnd->fNumStrayPlanesV)    && result;
00174   result = TestEquality("fAvgTimeOffset",
00175                                    this->fAvgTimeOffset, 
00176                                    rCnd->fAvgTimeOffset)      && result;
00177 
00178   return result;
00179 }
00180 
00181 //______________________________________________________________________
00182 CandDeMuxDigitListHandle CandDeMuxDigitList::MakeCandidate(
00183                                          AlgHandle &ah, CandContext &cx)
00184 {
00185 
00186 //cdlh owns new CandDeMuxDigitList
00187   CandDeMuxDigitListHandle cdlh;
00188   new CandDeMuxDigitList(ah, cdlh, cx);  return cdlh;
00189 }
00190 
00191 //______________________________________________________________________
00192 std::ostream& CandDeMuxDigitList::FormatToOStream(std::ostream& os,
00193                                                         Option_t *option) const
00194 {
00195   CandDigitList::FormatToOStream(os,option);
00196 
00197   TString opt(option);
00198   if (!opt.Contains("v0")) { // v0 means suppress the data values
00199     const TString& indent = GetIndentString();
00200     
00201     static MsgFormat i4("i4");
00202     static MsgFormat timefmt("f18.9");
00203 
00204     os << indent << GetDataIndent()
00205        << "NValidPlanes U: " << i4(fNumValidPlanesU)
00206        << " V: " << i4(fNumValidPlanesV)
00207        << "   NStrayPlanes U: " << i4(fNumStrayPlanesU)
00208        << " V: " << i4(fNumStrayPlanesV)
00209        << endl;
00210     
00211     CandDeMuxDigitList::DeMuxDigitListFlag_t dlflag = 
00212       (CandDeMuxDigitList::DeMuxDigitListFlag_t)fDeMuxDigitListFlag;
00213     
00214     os << indent << GetDataIndent()
00215        << "AvgTimeOffset " << timefmt(fAvgTimeOffset)
00216        << " FlagWord " 
00217        << CandDeMuxDigitList::AsString(dlflag)
00218        << endl;
00219   };
00220   return os;
00221   
00222 }
00223 
00224 //______________________________________________________________________
00225 const char* CandDeMuxDigitList::AsString(DeMuxDigitListFlag_t dlflag)
00226 {
00227 
00228   if (dlflag == kDeMuxOK) return "=DeMuxOKList=";
00229 
00230   std::string result("=");
00231   if (dlflag & kNoVertex                  ) result += "NoVertex,";
00232   if (dlflag & kTooFewValidPlanes         ) result += "TooFewValidPlanes,";
00233   if (dlflag & kNonPhysicalStripSolution  ) result += "NonPhysicalStripSolution,";
00234   if (dlflag & kEventFailedFilter         ) result += "EventFailedFilter,";
00235   if (dlflag & kEventFailedFilterUViewOnly) result += "EventFailedFilterUViewOnly,";
00236   if (dlflag & kEventFailedFilterVViewOnly) result += "EventFailedFilterVViewOnly,";
00237   if (dlflag & kMultipleMuonEvent         ) result += "MultipleMuonEvent,";
00238 
00239   static Int_t unknownBits = 
00240     ~(kNoVertex|
00241       kTooFewValidPlanes|
00242       kNonPhysicalStripSolution|
00243       kEventFailedFilter|
00244       kEventFailedFilterUViewOnly|
00245       kEventFailedFilterVViewOnly|
00246       kMultipleMuonEvent);
00247   if ( dlflag & unknownBits ) return Form("0x%8.8x",dlflag);  // dump hex if unknown bits
00248 
00249   // replace trailing ',' with = delimiter
00250   result.replace(result.size()-1,1,"=");
00251   return Form("%s",result.c_str());
00252 }
00253 
00254 //______________________________________________________________________

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