00001 00002 // $Id: AlgFitTrack3List.cxx,v 1.2 2003/08/04 14:53:58 rjn Exp $ 00003 // 00004 // AlgFitTrack3List.cxx 00005 // 00006 // Begin_Html<img src="../../pedestrians.gif" align=center> 00007 // <a href="../source_warning.html">Warning for beginners</a>.<br> 00008 // 00009 // AlgFitTrack3List is a concrete FitTrack3List Algorithm class. 00010 // 00011 // Author: R. Lee 2001.03.30 00012 // 00013 // Also see <a href="../../root_crib/index.html">The ROOT Crib</a> and 00014 // <a href="../CandFitTrack3.html"> CandFitTrack3 Classes</a> (part of 00015 // <a href="../index.html">The MINOS Class User Guide</a>)End_Html 00017 00018 #include <cassert> 00019 #include <vector> 00020 extern "C" { 00021 #include <unistd.h> // sysconf 00022 #include <sys/times.h> // times() 00023 } 00024 00025 #include "Algorithm/AlgFactory.h" 00026 #include "Algorithm/AlgHandle.h" 00027 #include "Algorithm/AlgConfig.h" 00028 #include "Candidate/CandContext.h" 00029 #include "CandFitTrack3/AlgFitTrack3List.h" 00030 #include "CandFitTrack3/CandFitTrack3.h" 00031 #include "CandFitTrack3/CandFitTrack3.h" 00032 #include "CandFitTrack3/CandFitTrack3Handle.h" 00033 #include "CandFitTrack3/CandFitTrack3List.h" 00034 #include "CandFitTrack3/CandFitTrack3ListHandle.h" 00035 #include "CandTrackSR/CandTrackSRListHandle.h" 00036 #include "CandTrackSR/TrackClusterSR.h" 00037 #include "Conventions/Mphysical.h" 00038 #include "Conventions/Munits.h" 00039 #include "Conventions/PlaneView.h" 00040 #include "MessageService/MsgService.h" 00041 #include "MinosObjectMap/MomNavigator.h" 00042 #include "Navigation/NavKey.h" 00043 #include "Navigation/NavSet.h" 00044 #include "RecoBase/CandTrackHandle.h" 00045 #include "RecoBase/CandTrackListHandle.h" 00046 #include "RecoBase/CandSliceHandle.h" 00047 #include "RecoBase/CandSliceListHandle.h" 00048 #include "RecoBase/LinearFit.h" 00049 #include "UgliGeometry/UgliGeomHandle.h" 00050 #include "Validity/VldContext.h" 00051 00052 00053 ClassImp(AlgFitTrack3List) 00054 00055 00056 //______________________________________________________________________ 00057 CVSID("$Id: AlgFitTrack3List.cxx,v 1.2 2003/08/04 14:53:58 rjn Exp $"); 00058 00059 //______________________________________________________________________ 00060 AlgFitTrack3List::AlgFitTrack3List() 00061 { 00062 } 00063 00064 //______________________________________________________________________ 00065 AlgFitTrack3List::~AlgFitTrack3List() 00066 { 00067 } 00068 00069 //______________________________________________________________________ 00070 void AlgFitTrack3List::RunAlg(AlgConfig & /* ac */, CandHandle &ch,CandContext &cx) 00071 { 00072 MSG("Alg", Msg::kDebug) 00073 << "Starting AlgFitTrack3List::RunAlg()" << endl; 00074 00075 assert(cx.GetDataIn()); 00076 00077 if (!(cx.GetDataIn()->InheritsFrom("TObjArray"))) { 00078 return; 00079 } 00080 00081 const CandSliceListHandle *slicelist = 0; 00082 const CandTrackListHandle *tracklist = 0; 00083 const CandTrackSRListHandle *tracksrlist = 0; 00084 const TObjArray *cxin = dynamic_cast<const TObjArray *>(cx.GetDataIn()); 00085 for (Int_t i=0; i<=cxin->GetLast(); i++) { 00086 TObject *tobj = cxin->At(i); 00087 if (tobj->InheritsFrom("CandSliceListHandle")) { 00088 slicelist = dynamic_cast<CandSliceListHandle*>(tobj); 00089 } 00090 if (tobj->InheritsFrom("CandTrackListHandle")) { 00091 tracklist = dynamic_cast<CandTrackListHandle*>(tobj); 00092 if (tobj->InheritsFrom("CandTrackSRListHandle")) { 00093 tracksrlist = dynamic_cast<CandTrackSRListHandle*>(tobj); 00094 } 00095 } 00096 } 00097 if (!slicelist || !tracklist) { 00098 MSG("error",Msg::kError) << 00099 "CandSliceListHandle or CandTrackListHandle missing\n"; 00100 } 00101 00102 // Create Candcontext 00103 CandContext cxx(this,cx.GetMom()); 00104 00105 // Get singleton instance of AlgFactory 00106 AlgFactory &af = AlgFactory::GetInstance(); 00107 00108 // Get an AlgHandle to AlgSliceSR with default AlgConfig 00109 AlgHandle ah = af.GetAlgHandle("AlgFitTrack3","default"); 00110 00111 TIter trackItr(tracklist->GetDaughterIterator()); 00112 00113 clock_t dummyt; 00114 struct tms t1; 00115 struct tms t2; 00116 // static double ticksPerSecond = sysconf(_SC_CLK_TCK); 00117 00118 while (CandTrackHandle *track = dynamic_cast<CandTrackHandle*>(trackItr())) { 00119 TObjArray cxin; 00120 cxin.Add(track); 00121 // if (tracksrlist) { 00122 // TObjArray *tclist = tracksrlist->GetTrackClusterList(); 00123 // assert(tclist); 00124 // for (int i=0; i<=tclist->GetLast(); i++) { 00125 // TrackClusterSR *tc = dynamic_cast<TrackClusterSR*>(tclist->At(i)); 00126 // assert(tc); 00127 // MSG("FitTrack3",Msg::kDebug) << "Input TC " << tc->GetPlane() << " " << tc->GetMinStrip() << "/" << tc->GetMaxStrip() << endl; 00128 // } 00129 // cxin.Add(tclist); 00130 // } 00131 cxx.SetDataIn(&cxin); 00132 dummyt = times(&t1); 00133 CandFitTrack3Handle fittrack = CandFitTrack3::MakeCandidate(ah,cxx); 00134 dummyt = times(&t2); 00135 // fittrack.SetCPUTime((Double_t)(t2.tms_utime+t2.tms_stime-t1.tms_utime-t1.tms_stime)/ticksPerSecond); 00136 ch.AddDaughterLink(fittrack); 00137 } 00138 00139 } 00140 00141 00142 //______________________________________________________________________ 00143 void AlgFitTrack3List::Trace(const char * /* c */) const 00144 { 00145 } 00146
1.3.9.1