CandEvent Class Reference

#include <CandEvent.h>

Inheritance diagram for CandEvent:

CandReco CandBase CandRefCounted FarDetEvent List of all members.

Public Member Functions

 CandEvent ()
virtual std::ostream & FormatToOStream (std::ostream &os, Option_t *option="") const

Static Public Member Functions

static CandEventHandle MakeCandidate (AlgHandle &ah, CandContext &cx)

Protected Member Functions

 CandEvent (AlgHandle &ah)
 CandEvent (AlgHandle &ah, CandHandle &ch, CandContext &cx)
 CandEvent (const CandEvent &rhs)
virtual ~CandEvent ()
virtual void CreateLocalHandle ()
virtual CandEventDup () const
virtual Bool_t IsEquivalent (const TObject *rhs) const

Protected Attributes

TObjArray fShowerList
TObjArray fTrackList
CandShowerHandlefPrimaryShower
CandTrackHandlefPrimaryTrack
Bool_t fContained
Double_t fEnergy

Friends

class CandEventHandle

Detailed Description

Definition at line 30 of file CandEvent.h.


Constructor & Destructor Documentation

CandEvent::CandEvent (  ) 

Definition at line 33 of file CandEvent.cxx.

Referenced by Dup(), and MakeCandidate().

00033                      :
00034   fPrimaryShower(0)
00035   , fPrimaryTrack(0)
00036   , fContained(0)
00037   ,  fEnergy(0.)
00038 {
00039 }

CandEvent::CandEvent ( AlgHandle ah  )  [protected]

Definition at line 42 of file CandEvent.cxx.

00042                                   :
00043   CandReco(ah)       // Should be the next class up on inheritance chain
00044 , fPrimaryShower(0)
00045 , fPrimaryTrack(0)
00046   ,fContained(0)
00047   ,  fEnergy(0.)
00048 {
00049 
00050 // The sole purpose of this constructor is to transmit the AlgHandle
00051 // up the inheritance chain to CandBase without having to invoke the
00052 // full constructor of an intermediate Candidate type which the highest
00053 // level Candidate might inherit from.  One only wants to create the
00054 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00055 }

CandEvent::CandEvent ( AlgHandle ah,
CandHandle ch,
CandContext cx 
) [protected]

Definition at line 58 of file CandEvent.cxx.

References CreateLocalHandle(), and AlgHandle::RunAlg().

00058                                                                    :
00059   CandReco(ah)       // Should be the next class up on inheritance chain
00060 , fPrimaryShower(0)
00061 , fPrimaryTrack(0)
00062   , fContained(0)
00063   ,  fEnergy(0.)
00064 {
00065   CreateLocalHandle();
00066 
00067 // Run Algorithm to construct Candidate
00068   {                                                   // Start of scope.
00069     CandEventHandle csh(this);               // csh will go out of scope
00070     ch = csh;                                       // after setting ch.
00071   }                                                     // End of scope.
00072   ah.RunAlg(ch, cx);
00073 }

CandEvent::CandEvent ( const CandEvent rhs  )  [protected]

Definition at line 76 of file CandEvent.cxx.

References CandHandle::DupHandle(), fPrimaryShower, fPrimaryTrack, fShowerList, and fTrackList.

00076                                          :
00077   CandReco(rhs)      // Should be the next class up on inheritance chain
00078 , fPrimaryShower(0)
00079 , fPrimaryTrack(0)
00080   , fContained(rhs.fContained)
00081   ,  fEnergy(rhs.fEnergy)
00082 {
00083 
00084 //CreateLocalHandle(); // Moved to Dup function following copy-ctor call
00085 
00086 
00087   if (rhs.fPrimaryShower)                   // Make an owned CandHandle*
00088     fPrimaryShower = (rhs.fPrimaryShower)->DupHandle();
00089 
00090   if (rhs.fPrimaryTrack)                    // Make an owned CandHandle*
00091     fPrimaryTrack = (rhs.fPrimaryTrack)->DupHandle();
00092 
00093 // fShowerList and fTrackList contents owned from CandEvent version 2
00094   CandHandle *ch;
00095   TIter shwiter(&rhs.fShowerList);
00096   while ((ch = dynamic_cast<CandHandle *>(shwiter())))
00097     fShowerList.Add(ch->DupHandle());
00098   TIter trkiter(&rhs.fTrackList);
00099   while ((ch = dynamic_cast<CandHandle *>(trkiter())))
00100     fTrackList.Add(ch->DupHandle());
00101 }

CandEvent::~CandEvent (  )  [protected, virtual]

Definition at line 104 of file CandEvent.cxx.

References fPrimaryShower, fPrimaryTrack, fShowerList, and fTrackList.

00105 {
00106 
00107 // fPrimaryShower is owned CandHandle* starting at CandEvent version 2
00108 // fPrimaryTrack is an owned CandHandle* starting at CandEvent version 2
00109 // fCandSlice is an owned CandHandle* starting at CandEvent version 2
00110   delete fPrimaryShower;
00111   delete fPrimaryTrack;
00112 
00113   fShowerList.Delete();  // Owned CandHandle*'s from CandEvent version 2
00114   fTrackList.Delete();   // Owned CandHandle*'s from CandEvent version 2
00115 }


Member Function Documentation

void CandEvent::CreateLocalHandle (  )  [protected, virtual]

Implements CandReco.

Reimplemented in FarDetEvent.

Definition at line 118 of file CandEvent.cxx.

References CandEventHandle, and CandBase::SetLocalHandle().

Referenced by CandEvent(), and Dup().

00119 {
00120   SetLocalHandle(new CandEventHandle(this));
00121 }

CandEvent * CandEvent::Dup (  )  const [protected, virtual]

Implements CandReco.

Reimplemented in FarDetEvent.

Definition at line 124 of file CandEvent.cxx.

References CandBase::AddDaughterLink(), CandEvent(), CreateLocalHandle(), and CandBase::GetDaughterIterator().

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   CandEvent *cb = new CandEvent(*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 }

std::ostream & CandEvent::FormatToOStream ( std::ostream &  os,
Option_t *  option = "" 
) const [virtual]

Reimplemented from CandReco.

Definition at line 177 of file CandEvent.cxx.

References CandBase::DecIndent(), fContained, fEnergy, CandBase::FormatToOStream(), fPrimaryShower, fPrimaryTrack, CandBase::GetDataIndent(), CandBase::GetIndentString(), CandBase::IncIndent(), and CandHandle::Print().

00179 {
00180   CandBase::FormatToOStream(os,option);
00181 
00182   TString opt(option);
00183   if (!opt.Contains("v0")) { // v0 means suppress the data values
00184     const TString& indent = GetIndentString();
00185     os << " Energy " << fEnergy << " Contained " << fContained << endl;
00186      os << indent << GetDataIndent() << "Primary:" << endl;
00187     IncIndent();
00188     if (fPrimaryShower) fPrimaryShower->Print("nd0");
00189     if (fPrimaryTrack)  fPrimaryTrack->Print("nd0");
00190     DecIndent();
00191  
00192   }
00193   return os;
00194 }

Bool_t CandEvent::IsEquivalent ( const TObject *  rhs  )  const [protected, virtual]

Reimplemented from CandReco.

Definition at line 140 of file CandEvent.cxx.

References fContained, fEnergy, fPrimaryShower, fPrimaryTrack, fShowerList, fTrackList, CandBase::IsEquivalent(), CandBase::TestCandHandleDup(), CandBase::TestDisplayCandBanner(), CandBase::TestEquality(), and CandBase::TestTObjArrayCandHandleDup().

00141 {
00142   Bool_t result = true;
00143   if (!CandBase::IsEquivalent(rhs)) result = false;   // superclass test
00144   TestDisplayCandBanner("CandEvent");
00145   const CandEvent* rCnd = dynamic_cast<const CandEvent*>(rhs);
00146   if (rCnd == NULL) return false;
00147 
00148   result = TestTObjArrayCandHandleDup("fShowerList",
00149                                            this->fShowerList,
00150                                            rCnd->fShowerList) && result;
00151   result = TestTObjArrayCandHandleDup("fTrackList",
00152                                             this->fTrackList,
00153                                             rCnd->fTrackList) && result;
00154   result = TestCandHandleDup("fPrimaryShower",
00155                                         this->fPrimaryShower,
00156                                         rCnd->fPrimaryShower) && result;
00157   result = TestCandHandleDup("fPrimaryTrack",
00158                              this->fPrimaryTrack,
00159                              rCnd->fPrimaryTrack) && result;
00160   result = TestEquality("fEnergy",        this->fEnergy,
00161                         rCnd->fEnergy)      && result;
00162   result = TestEquality("fContained",        this->fContained,
00163                         rCnd->fContained)      && result;
00164  
00165   return result;
00166 }

CandEventHandle CandEvent::MakeCandidate ( AlgHandle ah,
CandContext cx 
) [static]

Reimplemented in FarDetEvent.

Definition at line 169 of file CandEvent.cxx.

References CandEvent().

Referenced by AlgEventSSList::BuildEventFromUnassoc(), AlgEventSRList::BuildEventFromUnassoc(), AlgEventSSList::RunAlg(), and AlgEventSRList::RunAlg().

00170 {
00171   CandEventHandle csh;
00172   new CandEvent(ah, csh, cx);              // csh owns the new CandEvent
00173   return csh;
00174 }


Friends And Related Function Documentation

friend class CandEventHandle [friend]

Definition at line 32 of file CandEvent.h.

Referenced by CreateLocalHandle().


Member Data Documentation

Bool_t CandEvent::fContained [protected]

Definition at line 56 of file CandEvent.h.

Referenced by FormatToOStream(), and IsEquivalent().

Double_t CandEvent::fEnergy [protected]

Definition at line 57 of file CandEvent.h.

Referenced by FormatToOStream(), and IsEquivalent().

CandShowerHandle* CandEvent::fPrimaryShower [protected]

Definition at line 53 of file CandEvent.h.

Referenced by CandEvent(), FormatToOStream(), IsEquivalent(), and ~CandEvent().

CandTrackHandle* CandEvent::fPrimaryTrack [protected]

Definition at line 54 of file CandEvent.h.

Referenced by CandEvent(), FormatToOStream(), IsEquivalent(), and ~CandEvent().

TObjArray CandEvent::fShowerList [protected]

Definition at line 50 of file CandEvent.h.

Referenced by CandEvent(), IsEquivalent(), and ~CandEvent().

TObjArray CandEvent::fTrackList [protected]

Definition at line 51 of file CandEvent.h.

Referenced by CandEvent(), IsEquivalent(), and ~CandEvent().


The documentation for this class was generated from the following files:
Generated on Mon Nov 10 00:55:13 2014 for loon by  doxygen 1.4.7