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

CandTrackSR.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandTrackSR.cxx,v 1.27 2005/02/02 17:17:01 tagg Exp $
00003 //
00004 // CandTrackSR
00005 //
00006 // This is a concrete Event Candidate (Reconstruction) object.
00007 // CandTrackSR is descended from CandTrack.
00008 //
00009 // Each concrete CandBase must define a Dup function.
00010 // CandBase must grant friendship to class CandRefer.
00011 //
00012 // Author:  R. Lee 2001.02.26
00014 
00015 #include "TClass.h"
00016 #include "TObjArray.h"
00017 
00018 #include "Algorithm/AlgHandle.h"
00019 #include "CandTrackSR/CandTrackSR.h"
00020 #include "CandTrackSR/CandTrackSRHandle.h"
00021 #include "MessageService/MsgService.h"
00022 
00023 ClassImp(CandTrackSR)
00024 
00025 //______________________________________________________________________
00026 CVSID("$Id: CandTrackSR.cxx,v 1.27 2005/02/02 17:17:01 tagg Exp $");
00027 
00028 #include "Candidate/CandBase.tpl"
00029 
00030 //______________________________________________________________________
00031 CandTrackSR::CandTrackSR() :
00032   fClusterList(0),
00033   fUTrack(0),
00034   fVTrack(0),
00035   fNTrackStrip(0),
00036   fNTrackDigit(0),
00037   fNTimeFitDigit(0),
00038   fTimeFitChi2(0.)
00039 {
00040   MSG("Cand", Msg::kDebug)
00041                     << "Begin CandTrackSR::CandTrackSR() ctor: " << endl
00042                                            << "UidInt = " << GetUidInt()
00043                            << ", ArchUidInt " << GetArchUidInt() << endl
00044                              << "No. of links = " << GetNLinks() << endl
00045                       << "End CandTrackSR::CandTrackSR() ctor." << endl;
00046 }
00047 
00048 //______________________________________________________________________
00049 CandTrackSR::CandTrackSR(AlgHandle &ah) :
00050   CandTrack(ah),     // Should be the next class up on inheritance chain
00051   fClusterList(0),
00052   fUTrack(0),
00053   fVTrack(0),
00054   fNTrackStrip(0),
00055   fNTrackDigit(0),
00056   fNTimeFitDigit(0),
00057   fTimeFitChi2(0.)
00058 {
00059 
00060 // The sole purpose of this constructor is to transmit the AlgHandle
00061 // up the inheritance chain to CandBase without having to invoke the
00062 // full constructor of an intermediate Candidate type which the highest
00063 // level Candidate might inherit from.  One only wants to create the
00064 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00065 }
00066 
00067 //______________________________________________________________________
00068 CandTrackSR::CandTrackSR(AlgHandle &ah, CandHandle &ch,
00069                                                       CandContext &cx) :
00070   CandTrack(ah),     // Should be the next class up on inheritance chain
00071   fClusterList(0),
00072   fUTrack(0),
00073   fVTrack(0),
00074   fNTrackStrip(0),
00075   fNTrackDigit(0),
00076   fNTimeFitDigit(0),
00077   fTimeFitChi2(0.)
00078 {
00079   CreateLocalHandle();
00080   MSG("Cand", Msg::kDebug)
00081          << "Begin CandTrackSR::CandTrackSR(AlgHandle &, CandHandle &, "
00082                                       << "CandContext &) ctor: " << endl
00083                                            << "UidInt = " << GetUidInt()
00084                            << ", ArchUidInt " << GetArchUidInt() << endl
00085                              << "No. of links = " << GetNLinks() << endl
00086            << "End CandTrackSR::CandTrackSR(AlgHandle &, CandHandle &, "
00087                                       << "CandContext &) ctor." << endl;
00088 
00089   fClusterList = new TObjArray;
00090 
00091 // Run Algorithm to construct Candidate
00092   {                                                   // Start of scope.
00093     CandTrackSRHandle csh(this);             // csh will go out of scope
00094     ch = csh;                                       // after setting ch.
00095   }                                                     // End of scope.
00096   ah.RunAlg(ch, cx);
00097 }
00098 
00099 //______________________________________________________________________
00100 CandTrackSR::CandTrackSR(const CandTrackSR &rhs) :
00101   CandTrack(rhs)     // Should be the next class up on inheritance chain
00102 , fClusterList(0)                        // Made a deep copy from vers 6
00103 , fUTrack(new Track2DSR(*rhs.fUTrack))     //gmi: Supposedly a deep copy
00104 , fVTrack(new Track2DSR(*rhs.fVTrack))     //gmi: Supposedly a deep copy
00105 , fNTrackStrip(rhs.fNTrackStrip)
00106 , fNTrackDigit(rhs.fNTrackDigit)
00107 , fNTimeFitDigit(rhs.fNTimeFitDigit)
00108 , fTimeFitChi2(rhs.fTimeFitChi2)
00109 {
00110 
00111 //CreateLocalHandle(); // Moved to Dup function following copy-ctor call
00112   MSG("Cand", Msg::kDebug)
00113        << "Begin CandTrackSR::CandTrackSR(const CandTrackSR &rhs) ctor:"
00114                                    << endl << "UidInt = " << GetUidInt()
00115                            << ", ArchUidInt " << GetArchUidInt() << endl
00116                              << "No. of links = " << GetNLinks() << endl
00117          << "End CandTrackSR::CandTrackSR(const CandTrackSR &rhs) ctor."
00118                                                                 << endl;
00119 
00120 // fClusterList contents owned from CandTrackSR version 6
00121   if (rhs.fClusterList) {
00122     fClusterList = new TObjArray;
00123     CandHandle *ch;
00124     TIter cliter(rhs.fClusterList);
00125     while ((ch = dynamic_cast<CandHandle *>(cliter())))
00126       fClusterList->Add(ch->DupHandle());
00127   }
00128 }
00129 
00130 //______________________________________________________________________
00131 CandTrackSR::~CandTrackSR()
00132 {
00133   MSG("Cand", Msg::kDebug)
00134                    << "Begin CandTrackSR::~CandTrackSR() dtor: " << endl
00135                                            << "UidInt = " << GetUidInt()
00136                            << ", ArchUidInt " << GetArchUidInt() << endl
00137                              << "No. of links = " << GetNLinks() << endl
00138                      << "End CandTrackSR::~CandTrackSR() dtor." << endl;
00139 
00140   if (fClusterList) {
00141     fClusterList->Delete();  // Owned CandHandle*'s from CandTrackSR v 6
00142     delete fClusterList;
00143   }
00144     delete fUTrack;
00145     delete fVTrack;
00146 }
00147 
00148 //______________________________________________________________________
00149 void CandTrackSR::CreateLocalHandle()
00150 {
00151   SetLocalHandle(new CandTrackSRHandle(this));
00152 }
00153 
00154 //______________________________________________________________________
00155 CandTrackSR *CandTrackSR::Dup() const
00156 {
00157 
00158 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00159 // Daughter List copy is made in the derived class Dup() function.
00160 // This is because base class copy constructor hasn't yet created
00161 // fLocalHandle with a CandHandle* of the full derived type.
00162   CandTrackSR *cb = new CandTrackSR(*this);       // Copy-ctor dups ptrs
00163   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00164   TIter iterdau = GetDaughterIterator();
00165   CandHandle *dau;
00166   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00167   return cb;
00168 }
00169 
00170 //______________________________________________________________________
00171 Bool_t CandTrackSR::IsEquivalent(const TObject *rhs) const
00172 {
00173   Bool_t result = true;
00174   if (!CandTrack::IsEquivalent(rhs)) result = false;  // superclass test
00175   TestDisplayCandBanner("CandTrackSR");
00176   const CandTrackSR* rCnd = dynamic_cast<const CandTrackSR*>(rhs);
00177   if (rCnd == NULL) return false;
00178 
00179   result = TestGenericElemPtrTObjArrayPtrEquality<CandClusterHandle>(
00180                                         "fClusterList",
00181                                         this->fClusterList,
00182                                         rCnd->fClusterList)   && result;
00183   result = TestPtrEquivalence("fUTrack",
00184                                         this->fUTrack,
00185                                         rCnd->fUTrack)        && result;
00186   result = TestPtrEquivalence("fVTrack",
00187                                         this->fVTrack,
00188                                         rCnd->fVTrack)        && result;
00189   result = TestEquality("fNTrackStrip", this->fNTrackStrip,
00190                                         rCnd->fNTrackStrip)   && result;
00191   result = TestEquality("fNTrackDigit", this->fNTrackDigit,
00192                                         rCnd->fNTrackDigit)   && result;
00193   result = TestEquality("fNTimeFitDigit",
00194                                         this->fNTimeFitDigit,
00195                                         rCnd->fNTimeFitDigit) && result;
00196   result = TestEquality("fTimeFitChi2", this->fTimeFitChi2,
00197                                         rCnd->fTimeFitChi2)   && result;
00198 
00199   return result;
00200 }
00201 
00202 //______________________________________________________________________
00203 CandTrackSRHandle CandTrackSR::MakeCandidate(AlgHandle &ah,
00204                                                         CandContext &cx)
00205 {
00206   CandTrackSRHandle csh;
00207   new CandTrackSR(ah, csh, cx);          // csh owns the new CandTrackSR
00208   return csh;
00209 }
00210 
00211 //______________________________________________________________________
00212 void CandTrackSR::Streamer(TBuffer &R__b)
00213 {
00214 
00215 // Stream an object of class CandTrackSR.
00216   if (R__b.IsReading()) {
00217     UInt_t R__s, R__c;
00218     Version_t R__v = R__b.ReadVersion(&R__s, &R__c);
00219     CandTrackSR::Class()->ReadBuffer(R__b, this, R__v, R__s, R__c);
00220     if (R__v < 6) {
00221 
00222 // fClusterList contents owned from CandTrackSR version 6
00223       if (fClusterList) {
00224         CandHandle *ch;
00225         TIter cliter(fClusterList);
00226         while ((ch = dynamic_cast<CandHandle *>(cliter())))
00227           fClusterList->AddAt(ch->DupHandle(),
00228                                              fClusterList->IndexOf(ch));
00229       }
00230     }
00231   }
00232   else {
00233     CandTrackSR::Class()->WriteBuffer(R__b, this);
00234   }
00235 }

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