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

CandFitTrackSR.cxx

Go to the documentation of this file.
00001 
00002 // $Id: CandFitTrackSR.cxx,v 1.25 2005/12/07 14:15:55 musser Exp $
00003 //
00004 // CandFitTrackSR
00005 //
00006 // This is a concrete Event Candidate (Reconstruction) object.
00007 // CandFitTrackSR is descended from CandFitTrack.
00008 //
00009 // Each concrete CandBase must define a Dup function.
00010 // CandBase must grant friendship to class CandRefer.
00011 //
00012 // Author:  R. Lee 2001.03.30
00014 
00015 #include "Algorithm/AlgConfig.h"
00016 #include "Algorithm/AlgHandle.h"
00017 #include "CandFitTrackSR/CandFitTrackSR.h"
00018 #include "CandFitTrackSR/CandFitTrackSRHandle.h"
00019 #include "CandFitTrackSR/KalmanPlaneSR.h"
00020 #include "MessageService/MsgService.h"
00021 
00022 ClassImp(CandFitTrackSR)
00023 
00024 //______________________________________________________________________
00025 CVSID("$Id: CandFitTrackSR.cxx,v 1.25 2005/12/07 14:15:55 musser Exp $");
00026 
00027 #include "Candidate/CandBase.tpl"
00028 
00029 //______________________________________________________________________
00030 CandFitTrackSR::CandFitTrackSR() :
00031   fInitialQP(0.),
00032   fNChangedFitPoint(0)
00033 {
00034   Init();
00035 }
00036 
00037 //______________________________________________________________________
00038 CandFitTrackSR::CandFitTrackSR(AlgHandle &ah) :
00039   CandFitTrack(ah),  // Should be the next class up on inheritance chain
00040   fInitialQP(0.),
00041   fNChangedFitPoint(0)
00042 {
00043   Init();
00044 }
00045 
00046 //______________________________________________________________________
00047 CandFitTrackSR::CandFitTrackSR(AlgHandle &ah, CandHandle &ch,
00048                                                       CandContext &cx) :
00049   CandFitTrack(ah),  // Should be the next class up on inheritance chain
00050   fInitialQP(0.),
00051   fNChangedFitPoint(0)
00052 {
00053   CreateLocalHandle();
00054  
00055   Init();
00056 // Run Algorithm to construct Candidate
00057   {                                                    // Start of scope
00058     CandFitTrackSRHandle csh(this);          // csh will go out of scope
00059     ch = csh;                                       // after setting ch.
00060   }                                                      // End of scope
00061   ah.RunAlg(ch, cx);
00062 }
00063 
00064 //______________________________________________________________________
00065 CandFitTrackSR::CandFitTrackSR(const CandFitTrackSR &rhs) :
00066   CandFitTrack(rhs), // Should be the next class up on inheritance chain
00067   fInitialQP(rhs.fInitialQP),
00068   fNChangedFitPoint(rhs.fNChangedFitPoint)
00069 {
00070 
00071   Init();
00072   fVtxExtrapolate[0] = rhs.fVtxExtrapolate[0];
00073   fVtxExtrapolate[1] = rhs.fVtxExtrapolate[1];
00074   fEndExtrapolate[0] = rhs.fEndExtrapolate[0];
00075   fEndExtrapolate[1] = rhs.fEndExtrapolate[1];
00076   for (int i=0; i<=rhs.fTrackClusterList->GetLast(); i++) {
00077     TrackClusterSR *tc =
00078             dynamic_cast<TrackClusterSR*>(rhs.fTrackClusterList->At(i));
00079     TrackClusterSR *newtc = new TrackClusterSR(*tc);
00080     fTrackClusterList->Add(newtc);
00081   }
00082   for (int i=0; i<=rhs.fPlaneList->GetLast(); i++) {
00083     KalmanPlaneSR *kp =
00084                     dynamic_cast<KalmanPlaneSR*>(rhs.fPlaneList->At(i));
00085     KalmanPlaneSR *newkp = new KalmanPlaneSR(kp);
00086     fPlaneList->Add(newkp);
00087   }
00088 
00089   map<TrackClusterSR *,Bool_t>::iterator fBadFitIter;
00090   map<Int_t,Float_t>::iterator fPlanePreChi2Iter;
00091 
00092   for (fBadFitIter = rhs.fBadFit.begin();
00093                         fBadFitIter!=rhs.fBadFit.end(); fBadFitIter++) {
00094     fBadFit[fBadFitIter->first] = fBadFitIter->second;
00095   }
00096 
00097   for (fPlanePreChi2Iter = rhs.fPlanePreChi2.begin();
00098       fPlanePreChi2Iter!=rhs.fPlanePreChi2.end(); fPlanePreChi2Iter++) {
00099     fPlanePreChi2[fPlanePreChi2Iter->first] = fPlanePreChi2Iter->second;
00100   }
00101 
00102 
00103   fdUdZ.erase(fdUdZ.begin(),fdUdZ.end());
00104   map<Int_t,Float_t>::iterator fdUdZIter;
00105   for (fdUdZIter = rhs.fdUdZ.begin(); fdUdZIter!=rhs.fdUdZ.end();
00106                                                           fdUdZIter++) {
00107     fdUdZ[fdUdZIter->first] = fdUdZIter->second;
00108   }
00109 
00110   fdVdZ.erase(fdVdZ.begin(),fdVdZ.end());
00111   map<Int_t,Float_t>::iterator fdVdZIter;
00112   for (fdVdZIter = rhs.fdVdZ.begin(); fdVdZIter!=rhs.fdVdZ.end();
00113                                                           fdVdZIter++) {
00114     fdVdZ[fdVdZIter->first] = fdVdZIter->second;
00115   }
00116 }
00117 
00118 //______________________________________________________________________
00119 CandFitTrackSR::~CandFitTrackSR()
00120 {
00121   if (fPlaneList) {
00122     for (Int_t i=0; i<=fPlaneList->GetLast(); i++) {
00123       KalmanPlaneSR *kp =
00124                         dynamic_cast<KalmanPlaneSR*>(fPlaneList->At(i));
00125       delete kp;
00126     }
00127     delete fPlaneList;
00128   }
00129   if (fTrackClusterList) {
00130     for (Int_t i=0; i<=fTrackClusterList->GetLast(); i++) {
00131       TrackClusterSR *tc =
00132                 dynamic_cast<TrackClusterSR*>(fTrackClusterList->At(i));
00133       delete tc;
00134     }
00135     delete fTrackClusterList;
00136   }
00137 }
00138 
00139 //______________________________________________________________________
00140 void CandFitTrackSR::CreateLocalHandle()
00141 {
00142   SetLocalHandle(new CandFitTrackSRHandle(this));
00143 }
00144 
00145 //______________________________________________________________________
00146 CandFitTrackSR *CandFitTrackSR::Dup() const
00147 {
00148   CandFitTrackSR *cb = new CandFitTrackSR(*this); // Copy-ctor dups ptrs
00149   cb->CreateLocalHandle();   // Initializes fLocalHandle after copy-ctor
00150   TIter iterdau = GetDaughterIterator();
00151   CandHandle *dau;
00152   while ((dau=(CandHandle *) iterdau())) cb->AddDaughterLink(*dau);
00153   return cb;
00154 }
00155 
00156 //______________________________________________________________________
00157 void CandFitTrackSR::Init()
00158 {
00159   fPlaneList = new TObjArray;
00160   fPlaneList->Clear();
00161   fPlaneList->Compress();
00162   fTrackClusterList = new TObjArray;
00163   fTrackClusterList->Clear();
00164   fTrackClusterList->Compress();
00165   fCurrent = 0;
00166   fCurrentU = 0;
00167   fCurrentV = 0;
00168   fVtxExtrapolate[0] = 0;
00169   fVtxExtrapolate[1] = 0;
00170   fEndExtrapolate[0] = 0;
00171   fEndExtrapolate[1] = 0;
00172 }
00173 
00174 //______________________________________________________________________
00175 Bool_t CandFitTrackSR::IsEquivalent(const TObject *rhs) const
00176 {
00177   Bool_t result = true;
00178   if (!CandFitTrack::IsEquivalent(rhs)) result = false;    // superclass
00179   TestDisplayCandBanner("CandFitTrackSR");
00180   const CandFitTrackSR* rCnd = dynamic_cast<const CandFitTrackSR*>(rhs);
00181   if (rCnd == NULL) return false;
00182 
00183   result = TestGenericElemPtrTObjArrayPtrEquivalence<KalmanPlaneSR>(
00184                             "fPlaneList",
00185                             this->fPlaneList,
00186                             rCnd->fPlaneList, kTRUE)          && result;
00187   result = TestGenericElemPtrTObjArrayPtrEquivalence<TrackClusterSR>(
00188                             "fTrackClusterList",
00189                             this->fTrackClusterList,
00190                             rCnd->fTrackClusterList, kTRUE)   && result;
00191   result = TestPtrEquivalence("fCurrent",
00192                             this->fCurrent, 
00193                             rCnd->fCurrent)                   && result;
00194   result = TestPtrEquivalence("fCurrentU",
00195                             this->fCurrentU, 
00196                             rCnd->fCurrentU)                  && result;
00197   result = TestPtrEquivalence("fCurrentV",
00198                             this->fCurrentV, 
00199                             rCnd->fCurrentV)                  && result;
00200   result = TestEquality("fInitialQP",
00201                             this->fInitialQP,
00202                             rCnd->fInitialQP)                 && result;
00203   result = TestEquality("fNChangedFitPoint",
00204                             this->fNChangedFitPoint,
00205                             rCnd->fNChangedFitPoint)          && result;
00206   result = TestArrayEquality("fVtxExtrapolate", 2,
00207                             this->fVtxExtrapolate,
00208                             rCnd->fVtxExtrapolate)            && result;
00209   result = TestArrayEquality("fEndExtrapolate", 2,
00210                             this->fEndExtrapolate,
00211                             rCnd->fEndExtrapolate)            && result;
00212   result = TestEquality("fBadFit",       this->fBadFit, 
00213                                          rCnd->fBadFit)       && result;
00214   result = TestEquality("fPlanePreChi2", this->fPlanePreChi2, 
00215                                          rCnd->fPlanePreChi2) && result;
00216   result = TestEquality("fdUdZ",         this->fdUdZ, 
00217                                          rCnd->fdUdZ)         && result;
00218   result = TestEquality("fdVdZ",         this->fdVdZ, 
00219                                          rCnd->fdVdZ)         && result;
00220 
00221   return result;  
00222 }
00223 
00224 //______________________________________________________________________
00225 CandFitTrackSRHandle CandFitTrackSR::MakeCandidate(AlgHandle &ah,
00226                                                         CandContext &cx)
00227 {
00228   CandFitTrackSRHandle csh;
00229   new CandFitTrackSR(ah, csh, cx);    // csh owns the new CandFitTrackSR
00230   return csh;
00231 }
00232 
00233 //______________________________________________________________________
00234 std::ostream& CandFitTrackSR::FormatToOStream(std::ostream& os,
00235                                            Option_t *option) const
00236 {
00237   CandFitTrack::FormatToOStream(os,option);
00238 
00239   TString opt(option);
00240   if (!opt.Contains("v0")) { // v0 means suppress the data values
00241     const TString& indent = GetIndentString();
00242 
00243     os << indent << GetDataIndent()
00244        << "QP Initial " << fInitialQP
00245        << " NChangedFitPoint " << fNChangedFitPoint
00246        << endl;
00247 
00248     os << indent << "...should have print routines for KalmanPlaneSR" << endl;
00249   }
00250   return os;
00251   
00252 }
00253 
00254 //______________________________________________________________________

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