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

CandFitTrack.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandFitTrack.cxx,v 1.17 2007/10/13 22:52:44 musser Exp $
00003 //
00004 // CandFitTrack.cxx
00005 //
00006 // This is a concrete Event Candidate (Reconstruction) object.
00007 // CandFitTrack 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
00014 
00015 #include "Algorithm/AlgHandle.h"
00016 #include "MessageService/MsgService.h"
00017 #include "RecoBase/CandFitTrack.h"
00018 #include "RecoBase/CandFitTrackHandle.h"
00019 
00020 ClassImp(CandFitTrack)
00021 
00022 //______________________________________________________________________
00023 CVSID("$Id: CandFitTrack.cxx,v 1.17 2007/10/13 22:52:44 musser Exp $");
00024 
00025 #include "Candidate/CandBase.tpl"
00026 
00027 //______________________________________________________________________
00028 CandFitTrack::CandFitTrack() :
00029   fEMCharge(0.),
00030   fChi2(0.),
00031   fMomentumCurve(0.),
00032   fMomentumRange(0.),
00033   fPass(0),
00034   fBave(0),
00035   fNDOF(0),
00036   fCPUTime(0.),
00037   fVtxQPError(0.),
00038   fNIterate(0),
00039   fVtxUError(0),
00040   fVtxVError(0),
00041   fVtxdUError(0),
00042   fVtxdVError(0),
00043   fEndQP(0.),
00044   fEndQPError(0.),
00045   fEndUError(0.),
00046   fEndVError(0.),
00047   fEnddUError(0.),
00048   fEnddVError(0.),
00049   fNSwimFail(0),
00050   fFinderTrack(0)
00051 {
00052   MSG("Cand", Msg::kDebug)
00053                   << "Begin CandFitTrack::CandFitTrack() ctor: " << endl
00054                                            << "UidInt = " << GetUidInt()
00055                            << ", ArchUidInt " << GetArchUidInt() << endl
00056                              << "No. of links = " << GetNLinks() << endl
00057                     << "End CandFitTrack::CandFitTrack() ctor." << endl;
00058 }
00059 
00060 //______________________________________________________________________
00061 CandFitTrack::CandFitTrack(AlgHandle &ah) :
00062   CandTrack(ah),     // Should be the next class up on inheritance chain
00063   fEMCharge(0.),
00064   fChi2(0.),
00065   fMomentumCurve(0.),
00066   fMomentumRange(0.),
00067   fPass(0),
00068   fBave(0),
00069   fNDOF(0),
00070   fCPUTime(0.),
00071   fVtxQPError(0.),
00072   fNIterate(0),
00073   fVtxUError(0),
00074   fVtxVError(0),
00075   fVtxdUError(0),
00076   fVtxdVError(0),
00077   fEndQP(0.),
00078   fEndQPError(0.),
00079   fEndUError(0.),
00080   fEndVError(0.),
00081   fEnddUError(0.),
00082   fEnddVError(0.),
00083   fNSwimFail(0),  
00084   fFinderTrack(0)
00085 {
00086 
00087 // The sole purpose of this constructor is to transmit the AlgHandle
00088 // up the inheritance chain to CandBase without having to invoke the
00089 // full constructor of an intermediate Candidate type which the highest
00090 // level Candidate might inherit from.  One only wants to create the
00091 // LocalHandle and invoke the RunAlg() method in the lowest level class.
00092 }
00093 
00094 //______________________________________________________________________
00095 CandFitTrack::CandFitTrack(AlgHandle &ah, CandHandle &ch,
00096                                                       CandContext &cx) :
00097   CandTrack(ah),     // Should be the next class up on inheritance chain
00098   fEMCharge(0.),
00099   fChi2(0.),
00100   fMomentumCurve(0.),
00101   fMomentumRange(0.),
00102   fPass(0),
00103   fBave(0),
00104   fNDOF(0),
00105   fCPUTime(0.),
00106   fVtxQPError(0.),
00107   fNIterate(0),
00108   fVtxUError(0),
00109   fVtxVError(0),
00110   fVtxdUError(0),
00111   fVtxdVError(0),
00112   fEndQP(0.),
00113   fEndQPError(0.),
00114   fEndUError(0.),
00115   fEndVError(0.),
00116   fEnddUError(0.),
00117   fEnddVError(0.),
00118   fNSwimFail(0),
00119   fFinderTrack(0)
00120 {
00121   CreateLocalHandle();
00122   MSG("Cand", Msg::kDebug)
00123        << "Begin CandFitTrack::CandFitTrack(AlgHandle &, CandHandle &, "
00124                                       << "CandContext &) ctor: " << endl
00125                                            << "UidInt = " << GetUidInt()
00126                            << ", ArchUidInt " << GetArchUidInt() << endl
00127                              << "No. of links = " << GetNLinks() << endl
00128          << "End CandFitTrack::CandFitTrack(AlgHandle &, CandHandle &, "
00129                                       << "CandContext &) ctor." << endl;
00130 
00131 // Run Algorithm to construct Candidate
00132   {                                                   // Start of scope.
00133     CandFitTrackHandle csh(this);            // csh will go out of scope
00134     ch = csh;                                       // after setting ch.
00135   }                                                     // End of scope.
00136   ah.RunAlg(ch, cx);
00137 }
00138 
00139 //______________________________________________________________________
00140 CandFitTrack::CandFitTrack(const CandFitTrack &rhs) :
00141   CandTrack(rhs),    // Should be the next class up on inheritance chain
00142   fEMCharge(rhs.fEMCharge),
00143   fChi2(rhs.fChi2),
00144   fMomentumCurve(rhs.fMomentumCurve),
00145   fMomentumRange(rhs.fMomentumRange),
00146   fPass(rhs.fPass),
00147   fBave(rhs.fBave),
00148   fNDOF(rhs.fNDOF),
00149   fCPUTime(rhs.fCPUTime),
00150   fVtxQPError(rhs.fVtxQPError),
00151   fNIterate(rhs.fNIterate),
00152   fVtxUError(rhs.fVtxUError),
00153   fVtxVError(rhs.fVtxVError),
00154   fVtxdUError(rhs.fVtxdUError),
00155   fVtxdVError(rhs.fVtxdVError),
00156   fEndQP(rhs.fEndQP),
00157   fEndQPError(rhs.fEndQPError),
00158   fEndUError(rhs.fEndUError),
00159   fEndVError(rhs.fEndVError),
00160   fEnddUError(rhs.fEnddUError),
00161   fEnddVError(rhs.fEnddVError),
00162   fNSwimFail(rhs.fNSwimFail),
00163   fFinderTrack(rhs.fFinderTrack)
00164 {
00165   map<Int_t,Float_t>::iterator fPlaneChi2Iter;
00166   map<Int_t,Float_t>::iterator fPlaneQPIter;
00167 
00168   for (fPlaneChi2Iter = rhs.fPlaneChi2.begin();
00169                fPlaneChi2Iter!=rhs.fPlaneChi2.end(); fPlaneChi2Iter++) {
00170     fPlaneChi2[fPlaneChi2Iter->first] = fPlaneChi2Iter->second;
00171   }
00172   for (fPlaneQPIter = rhs.fPlaneQP.begin();
00173                      fPlaneQPIter!=rhs.fPlaneQP.end(); fPlaneQPIter++) {
00174     fPlaneQP[fPlaneQPIter->first] = fPlaneQPIter->second;
00175   }
00176 
00177 //CreateLocalHandle(); // Moved to Dup function following copy-ctor call
00178   MSG("Cand", Msg::kDebug)
00179     << "Begin CandFitTrack::CandFitTrack(const CandFitTrack &rhs) ctor:"
00180                                    << endl << "UidInt = " << GetUidInt()
00181                            << ", ArchUidInt " << GetArchUidInt() << endl
00182                              << "No. of links = " << GetNLinks() << endl
00183       << "End CandFitTrack::CandFitTrack(const CandFitTrack &rhs) ctor."
00184                                                                 << endl;
00185 }
00186 
00187 //______________________________________________________________________
00188 CandFitTrack::~CandFitTrack()
00189 {
00190   MSG("Cand", Msg::kDebug)
00191                  << "Begin CandFitTrack::~CandFitTrack() dtor: " << endl
00192                                            << "UidInt = " << GetUidInt()
00193                            << ", ArchUidInt " << GetArchUidInt() << endl
00194                              << "No. of links = " << GetNLinks() << endl
00195                    << "End CandFitTrack::~CandFitTrack() dtor." << endl;
00196 }
00197 
00198 //______________________________________________________________________
00199 void CandFitTrack::CreateLocalHandle()
00200 {
00201   SetLocalHandle(new CandFitTrackHandle(this));
00202 }
00203 
00204 //______________________________________________________________________
00205 CandFitTrack *CandFitTrack::Dup() const
00206 {
00207 
00208 // Base copy ctor dups owned pointers, but defers copying Daughter List.
00209 // Daughter List copy is made in the derived class Dup() function.
00210 // This is because base class copy constructor hasn't yet created
00211 // fLocalHandle with a CandHandle* of the full derived type.
00212   CandFitTrack *cb = new CandFitTrack(*this);     // Copy-ctor dups ptrs
00213   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00214   TIter iterdau = GetDaughterIterator();
00215   CandHandle *dau;
00216   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00217   return cb;
00218 }
00219 
00220 //______________________________________________________________________
00221 Bool_t CandFitTrack::IsEquivalent(const TObject *rhs) const
00222 {
00223   Bool_t result = true;
00224   if (!CandTrack::IsEquivalent(rhs)) result = false;  // superclass test
00225   TestDisplayCandBanner("CandFitTrack");
00226   const CandFitTrack* rCnd = dynamic_cast<const CandFitTrack*>(rhs);
00227   if (rCnd == NULL) return false;
00228 
00229   result = TestEquality("fEMCharge",         this->fEMCharge,
00230                                              rCnd->fEMCharge) && result;
00231   result = TestEquality("fChi2",                 this->fChi2,
00232                                                  rCnd->fChi2) && result;
00233   result = TestEquality("fMomentumCurve",
00234                                         this->fMomentumCurve,
00235                                         rCnd->fMomentumCurve) && result;
00236   result = TestEquality("fPass",        this->fPass,
00237                                         rCnd->fPass)          && result;
00238   result = TestEquality("fBave",        this->fBave,
00239                                         rCnd->fBave)          && result;
00240   result = TestEquality("fNDOF",         this->fNDOF, 
00241                                          rCnd->fNDOF)         && result;
00242   result = TestEquality("fCPUTime",      this->fCPUTime, 
00243                                          rCnd->fCPUTime)      && result;
00244   result = TestEquality("fNIterate",
00245                             this->fNIterate,
00246                             rCnd->fNIterate)                  && result;
00247   result = TestEquality("fVtxQPError",   this->fVtxQPError, 
00248                                          rCnd->fVtxQPError)   && result; 
00249   result = TestEquality("fVtxUError",   this->fVtxUError, 
00250                                          rCnd->fVtxUError)   && result; 
00251   result = TestEquality("fVtxVError",   this->fVtxVError, 
00252                                          rCnd->fVtxVError)   && result; 
00253   result = TestEquality("fVtxdUError",   this->fVtxdUError, 
00254                                          rCnd->fVtxdUError)   && result; 
00255   result = TestEquality("fVtxdVError",   this->fVtxdVError, 
00256                                          rCnd->fVtxdVError)   && result; 
00257   result = TestEquality("fFinderTrack",   this->fFinderTrack, 
00258                                          rCnd->fFinderTrack)   && result;
00259   result = TestEquality("fEndQP",
00260                         this->fEndQP,
00261                         rCnd->fEndQP)                     && result;
00262   result = TestEquality("fPlaneChi2",    this->fPlaneChi2, 
00263                                          rCnd->fPlaneChi2)    && result;
00264   result = TestEquality("fPlaneQP",      this->fPlaneQP, 
00265                                          rCnd->fPlaneQP)      && result;
00266   result = TestEquality("fEndUError",    this->fEndUError, 
00267                                          rCnd->fEndUError)    && result;
00268   result = TestEquality("fEndVError",    this->fEndVError, 
00269                                          rCnd->fEndVError)    && result;
00270   result = TestEquality("fEnddUError",   this->fEnddUError, 
00271                                          rCnd->fEnddUError)   && result;
00272   result = TestEquality("fEnddVError",   this->fEnddVError, 
00273                                          rCnd->fEnddVError)   && result;
00274   result = TestEquality("fEndQPError",   this->fEndQPError, 
00275                                          rCnd->fEndQPError)   && result;
00276   result = TestEquality("fNSwimFail",    this->fNSwimFail, 
00277                                          rCnd->fNSwimFail)    && result;
00278 
00279   return result;
00280 }
00281 
00282 //______________________________________________________________________
00283 CandFitTrackHandle CandFitTrack::MakeCandidate(AlgHandle &ah,
00284                                                         CandContext &cx)
00285 {
00286   CandFitTrackHandle csh;
00287   new CandFitTrack(ah, csh, cx);        // csh owns the new CandFitTrack
00288   return csh;
00289 }
00290 
00291 //______________________________________________________________________
00292 std::ostream& CandFitTrack::FormatToOStream(std::ostream& os,
00293                                             Option_t *option) const
00294 {
00295   CandTrack::FormatToOStream(os,option);
00296 
00297   TString opt(option);
00298   if (!opt.Contains("v0")) { // v0 means suppress the data values
00299     const TString& indent = GetIndentString();
00300 
00301     os << indent << GetDataIndent()
00302        << "EMCharge " << fEMCharge
00303        << " Chi2 " << fChi2
00304        << " MomentumCurve " << fMomentumCurve
00305        << " NIterate " << fNIterate
00306        << "NDOF " << fNDOF 
00307        << " " << (fPass?"Pass":"Fail")
00308        << " CPUTime " << fCPUTime
00309        << " VtxUError " << fVtxUError
00310        << " VtxVError " << fVtxVError
00311        << " VtxdUError " << fVtxdUError
00312        << " VtxdVError " << fVtxdVError
00313        << endl;
00314   }
00315   return os;
00316   
00317 }
00318 
00319 //______________________________________________________________________

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