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

CandStrip.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandStrip.cxx,v 1.16 2005/02/02 11:38:35 tagg Exp $
00003 //
00004 // CandStrip.cxx
00005 //
00006 // This is a concrete Event Candidate (Reconstruction) object.
00007 // CandStrip 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:  R. Lee
00014 
00015 #include "Algorithm/AlgHandle.h"
00016 #include "MessageService/MsgService.h"
00017 #include "MessageService/MsgFormat.h"
00018 #include "RecoBase/CandStrip.h"
00019 #include "RecoBase/CandStripHandle.h"
00020 
00021 ClassImp(CandStrip)
00022 
00023 //______________________________________________________________________
00024 CVSID("$Id: CandStrip.cxx,v 1.16 2005/02/02 11:38:35 tagg Exp $");
00025 
00026 #include "Candidate/CandBase.tpl"
00027 
00028 //______________________________________________________________________
00029 
00032 CandStrip::CandStrip() :
00033   fTPos(0.),
00034   fZPos(0.),
00035   fCalTimeType(CalTimeType::kT0)
00036 {
00037 }
00038 
00039 //______________________________________________________________________
00040 CandStrip::CandStrip(AlgHandle &ah) :
00041   CandBase(ah),    
00042   fTPos(0.),
00043   fZPos(0.),
00044   fCalTimeType(CalTimeType::kT0)
00045 {
00046 }
00047 
00048 //______________________________________________________________________
00049 CandStrip::CandStrip(AlgHandle &ah, CandHandle &ch, CandContext &cx) :
00050   CandBase(ah),  
00051   fTPos(0.),
00052   fZPos(0.),
00053   fCalTimeType(CalTimeType::kT0)
00054 {
00055   CreateLocalHandle();
00056 
00057 // Run Algorithm to construct Candidate
00058   {                                                   // Start of scope.
00059     CandStripHandle csh(this);               // csh will go out of scope
00060     ch = csh;                                       // after setting ch.
00061   }                                                     // End of scope.
00062   ah.RunAlg(ch, cx);
00063 }
00064 
00065 //______________________________________________________________________
00066 CandStrip::CandStrip(const CandStrip &rhs) :
00067   CandBase(rhs),    
00068   fTPos(rhs.fTPos),
00069   fZPos(rhs.fZPos),
00070   fCalTimeType(rhs.fCalTimeType)
00071 {
00072   fBestStripEnd = rhs.fBestStripEnd;
00073 }
00074 
00075 //______________________________________________________________________
00076 CandStrip::~CandStrip()
00077 {
00078 }
00079 
00080 //______________________________________________________________________
00081 void CandStrip::CreateLocalHandle()
00082 {
00083   SetLocalHandle(new CandStripHandle(this));
00084 }
00085 
00086 //______________________________________________________________________
00087 CandStrip *CandStrip::Dup() const
00088 {
00089 
00090 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00091 // Daughter List copy is made in the derived class Dup() function.
00092 // This is because base class copy constructor hasn't yet created
00093 // fLocalHandle with a CandHandle* of the full derived type.
00094   CandStrip *cb = new CandStrip(*this);           // Copy-ctor dups ptrs
00095   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00096   cb->SetCandRecord(fCandRecord);
00097   TIter iterdau = GetDaughterIterator();
00098   CandHandle *dau;
00099   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00100   return cb;
00101 }
00102 
00103 //______________________________________________________________________
00104 Bool_t CandStrip::IsEquivalent(const TObject *rhs) const
00105 {
00106   Bool_t result = true;
00107   if (!CandBase::IsEquivalent(rhs)) result = false;   // superclass test
00108   TestDisplayCandBanner("CandStrip");
00109   const CandStrip* rCnd = dynamic_cast<const CandStrip*>(rhs);
00110   if (rCnd == NULL) return false;
00111  
00112   result = TestEquality("fTPos",         this->fTPos,
00113                                          rCnd->fTPos)         && result;
00114   result = TestEquality("fZPos",         this->fZPos,
00115                                          rCnd->fZPos)         && result;
00116   result = TestEquality("fBestStripEnd", this->fBestStripEnd,
00117                                          rCnd->fBestStripEnd) && result;
00118   result = TestEquality("fCalTimeType",  this->fCalTimeType,
00119                                          rCnd->fCalTimeType)  && result;
00120 
00121   return result;
00122 }
00123 
00124 //______________________________________________________________________
00125 CandStripHandle CandStrip::MakeCandidate(AlgHandle &ah, CandContext &cx)
00126 {
00127   CandStripHandle csh;
00128   new CandStrip(ah, csh, cx);              // csh owns the new CandStrip
00129   return csh;
00130 }
00131 
00132 //______________________________________________________________________
00133 std::ostream& CandStrip::FormatToOStream(std::ostream& os,
00134                                          Option_t *option) const
00135 {
00136   CandBase::FormatToOStream(os,option);
00137 
00138   TString opt(option);
00139   if (!opt.Contains("v0")) { // v0 means suppress the data values
00140     const TString& indent = GetIndentString();
00141 
00142     static MsgFormat tfmt("f6.3");
00143     static MsgFormat zfmt("f8.3");
00144     static MsgFormat indxfmt("i6");
00145     static MsgFormat ifmt("i4");
00146     static MsgFormat timefmt("f10.9");
00147     os << indent << GetDataIndent()
00148        << fBestStripEnd.AsString("c")
00149        << " T=" << tfmt(fTPos)
00150        << " Z=" << zfmt(fZPos)
00151        << " CalTime=" << CalTimeType::AsString(fCalTimeType)
00152        << endl;
00153   }
00154   return os;
00155   
00156 }
00157 
00158 //______________________________________________________________________

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