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

CandFitShowerEM.cxx

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

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