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

AlgFitTrackSRList.cxx

Go to the documentation of this file.
00001 
00002 // $Id: AlgFitTrackSRList.cxx,v 1.10 2004/08/20 13:48:08 musser Exp $
00003 //
00004 // AlgFitTrackSRList.cxx
00005 //
00006 // Begin_Html<img src="../../pedestrians.gif" align=center>
00007 // <a href="../source_warning.html">Warning for beginners</a>.<br> 
00008 //
00009 // AlgFitTrackSRList is a concrete FitTrackSRList 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="../CandFitTrackSR.html"> CandFitTrackSR 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 "CandFitTrackSR/AlgFitTrackSRList.h"
00030 #include "CandFitTrackSR/CandFitTrackSR.h"
00031 #include "./CandFitTrackSRHandle.h"
00032 #include "CandFitTrackSR/CandFitTrackSRList.h"
00033 #include "CandFitTrackSR/CandFitTrackSRListHandle.h"
00034 #include "CandTrackSR/CandTrackSRListHandle.h"
00035 #include "CandTrackSR/TrackClusterSR.h"
00036 #include "Conventions/Mphysical.h"
00037 #include "Conventions/Munits.h"
00038 #include "Conventions/PlaneView.h"
00039 #include "MessageService/MsgService.h"
00040 #include "MinosObjectMap/MomNavigator.h"
00041 #include "Navigation/NavKey.h"
00042 #include "Navigation/NavSet.h"
00043 #include "RecoBase/CandTrackHandle.h"
00044 #include "RecoBase/CandTrackListHandle.h"
00045 #include "RecoBase/CandSliceHandle.h"
00046 #include "RecoBase/CandSliceListHandle.h"
00047 #include "RecoBase/LinearFit.h"
00048 #include "UgliGeometry/UgliGeomHandle.h"
00049 #include "Validity/VldContext.h"
00050 
00051 
00052 ClassImp(AlgFitTrackSRList)
00053 
00054 
00055 //______________________________________________________________________
00056 CVSID("$Id: AlgFitTrackSRList.cxx,v 1.10 2004/08/20 13:48:08 musser Exp $");
00057 
00058 //______________________________________________________________________
00059 AlgFitTrackSRList::AlgFitTrackSRList()
00060 {
00061 }
00062 
00063 //______________________________________________________________________
00064 AlgFitTrackSRList::~AlgFitTrackSRList()
00065 {
00066 }
00067 
00068 //______________________________________________________________________
00069 void AlgFitTrackSRList::RunAlg(AlgConfig & ac , CandHandle &ch,CandContext &cx)
00070 {
00071   MSG("Alg", Msg::kDebug)
00072                            << "Starting AlgFitTrackSRList::RunAlg()" << endl;
00073 
00074   assert(cx.GetDataIn());
00075 
00076   if (!(cx.GetDataIn()->InheritsFrom("TObjArray"))) {
00077     return;
00078   }
00079 
00080   const char *pTrackAlgConfig = 0;
00081   ac.Get("FitTrackAlgConfig",pTrackAlgConfig);
00082 
00083   const CandSliceListHandle *slicelist = 0;
00084   const CandTrackListHandle *tracklist = 0;
00085   const CandTrackSRListHandle *tracksrlist = 0;
00086   const TObjArray *cxin = dynamic_cast<const TObjArray *>(cx.GetDataIn());
00087   for (Int_t i=0; i<=cxin->GetLast(); i++) {
00088     TObject *tobj = cxin->At(i);
00089     if (tobj->InheritsFrom("CandSliceListHandle")) {
00090       slicelist = dynamic_cast<CandSliceListHandle*>(tobj);
00091     }
00092     if (tobj->InheritsFrom("CandTrackListHandle")) {
00093       tracklist = dynamic_cast<CandTrackListHandle*>(tobj);
00094       if (tobj->InheritsFrom("CandTrackSRListHandle")) {
00095         tracksrlist = dynamic_cast<CandTrackSRListHandle*>(tobj);
00096       }
00097     }
00098   }
00099   if (!slicelist || !tracklist) {
00100     MSG("error",Msg::kError) <<
00101       "CandSliceListHandle or CandTrackListHandle missing\n";
00102   }
00103 
00104 // Create Candcontext
00105   CandContext cxx(this,cx.GetMom());
00106 
00107 // Get singleton instance of AlgFactory
00108   AlgFactory &af = AlgFactory::GetInstance();
00109 
00110 // Get an AlgHandle to AlgSliceSR with default AlgConfig
00111   AlgHandle ah = af.GetAlgHandle("AlgFitTrackSR",pTrackAlgConfig);
00112 
00113   TIter trackItr(tracklist->GetDaughterIterator());
00114 
00115   clock_t dummyt;
00116   struct tms t1;
00117   struct tms t2;
00118   static double ticksPerSecond = sysconf(_SC_CLK_TCK);
00119 
00120   while (CandTrackHandle *track = dynamic_cast<CandTrackHandle*>(trackItr())) {
00121     TObjArray cxin;
00122     cxin.Add(track);
00123     if (tracksrlist) {
00124       TObjArray *tclist = tracksrlist->GetTrackClusterList();
00125       assert(tclist);
00126       for (int i=0; i<=tclist->GetLast(); i++) {
00127         TrackClusterSR *tc = dynamic_cast<TrackClusterSR*>(tclist->At(i));
00128         assert(tc);
00129         MSG("FitTrackSR",Msg::kDebug) << "Input TC " << tc->GetPlane() << " " << tc->GetMinStrip() << "/" << tc->GetMaxStrip() << endl;
00130       }
00131       cxin.Add(tclist);
00132     }
00133     cxx.SetDataIn(&cxin);
00134     dummyt = times(&t1);
00135     CandFitTrackSRHandle fittrack = CandFitTrackSR::MakeCandidate(ah,cxx);
00136     dummyt = times(&t2);
00137     fittrack.SetCPUTime((Double_t)(t2.tms_utime+t2.tms_stime-t1.tms_utime-t1.tms_stime)/ticksPerSecond);
00138     ch.AddDaughterLink(fittrack);
00139   }
00140 
00141 }
00142 
00143 
00144 //______________________________________________________________________
00145 void AlgFitTrackSRList::Trace(const char * /* c */) const
00146 {
00147 }
00148 

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