FitTrackSRListModule Class Reference

#include <FitTrackSRListModule.h>

Inheritance diagram for FitTrackSRListModule:
JobCModule

List of all members.

Public Member Functions

 FitTrackSRListModule ()
 ~FitTrackSRListModule ()
void BeginJob ()
JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const

Detailed Description

Definition at line 36 of file FitTrackSRListModule.h.


Constructor & Destructor Documentation

FitTrackSRListModule::FitTrackSRListModule (  ) 

Definition at line 55 of file FitTrackSRListModule.cxx.

00056 {
00057 }

FitTrackSRListModule::~FitTrackSRListModule (  ) 

Definition at line 60 of file FitTrackSRListModule.cxx.

00061 {
00062 }


Member Function Documentation

void FitTrackSRListModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 65 of file FitTrackSRListModule.cxx.

00066 {
00067 }

const Registry & FitTrackSRListModule::DefaultConfig ( void   )  const [virtual]

Get the default configuration registry. This should normally be overridden. One useful idiom is to implement it like:

const Registry& MyModule::DefaultConfig() const { static Registry cfg; // never is destroyed if (cfg.Size()) return cfg; // already filled it // set defaults: cfg.Set("TheAnswer",42); cfg.Set("Units","unknown"); return cfg; }

Reimplemented from JobCModule.

Definition at line 71 of file FitTrackSRListModule.cxx.

References JobCModule::GetName(), and Registry::Set().

00072 {
00073 //  
00074 //  Purpose:    Method to return default configuration.
00075 //  
00076 //  Arguments:  n/a
00077 //  
00078 //  Return:     Registry item containing default configuration.
00079 //
00080 
00081 
00082   static Registry def_cfg;
00083   static bool been_here = false;
00084   if(been_here)return def_cfg;
00085   been_here=true;
00086 
00087   string name = this->JobCModule::GetName();
00088   name += ".config.default";
00089   def_cfg.SetName(name.c_str());
00090 
00091   // Set default
00092   def_cfg.Set("FitTrackListAlgorithm","AlgFitTrackSRList");
00093   def_cfg.Set("FitTrackListAlgConfig","default");
00094   def_cfg.Set("ListIn","CandSliceList");
00095   def_cfg.Set("ListOut","CandFitTrackSRList");
00096   def_cfg.Set("LogLevel","Fatal");
00097   return def_cfg;
00098 }

JobCResult FitTrackSRListModule::Reco ( MomNavigator mom  )  [virtual]

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 103 of file FitTrackSRListModule.cxx.

References CandRecord::FindCandHandle(), Registry::Get(), AlgFactory::GetAlgHandle(), JobCModule::GetConfig(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetName(), CandHandle::GetNDaughters(), Msg::kDebug, JobCResult::kPassed, Msg::kWarning, CandFitTrackSRList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), CandHandle::SetTitle(), and JobCResult::SetWarning().

00104 {
00105   
00106   JobCResult result(JobCResult::kPassed); // The default result
00107   // load configuration 
00108   const char* tmps = 0;
00109   const char* alg_name = 0;
00110   const char* alg_config_name = 0;
00111   const char* list_in = 0;
00112   const char* list_out = 0;
00113   
00114   Registry& cfg = this->GetConfig();
00115   if (cfg.Get("FitTrackListAlgorithm",tmps)) alg_name = tmps;
00116   if (cfg.Get("FitTrackListAlgConfig",tmps)) alg_config_name = tmps;
00117   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00118   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00119 
00120 
00121 // Find PrimaryCandidateRecord fragment in MOM.
00122    CandRecord *candrec = dynamic_cast<CandRecord *>
00123              (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00124    if (candrec == 0) {
00125      MSG("FitTrackSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00126                                       << endl;
00127      // Return failed with warning result
00128      result.SetWarning().SetFailed();
00129      return result;
00130    }
00131 
00132 // Require number of CandSlices to be non-zero.
00133    CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00134       (candrec->FindCandHandle("CandSliceListHandle",list_in));
00135    if (!cslh || cslh->GetNDaughters() < 1) {
00136      MSG("FitTrackSR", Msg::kDebug)
00137                   << "Null CandSlice list.  Bail out of event." << endl;
00138      result.SetFailed();
00139      return result;
00140    }
00141 
00142    CandTrackListHandle *ctlh = dynamic_cast<CandTrackListHandle *>
00143      (candrec->FindCandHandle("CandTrackListHandle"));
00144    // Require number of CandTracks to be non-zero.
00145    if (!ctlh || ctlh->GetNDaughters() < 1) {
00146      MSG("FitTrackSR", Msg::kDebug)
00147        << "Null CandTrack list.  Bail out of event." << endl;
00148      return result;
00149    }
00150 
00151    /*
00152    clock_t dummyt;
00153    struct tms t1;
00154    struct tms t2;
00155    static double ticksPerSecond = sysconf(_SC_CLK_TCK);
00156    dummyt = times(&t1);
00157    */
00158 
00159    TObjArray cxin;
00160    cxin.Add(cslh);
00161    cxin.Add(ctlh);
00162 
00163    AlgFactory &af = AlgFactory::GetInstance();
00164 
00165 // Build a CandFitTrackSRList containing all CandFitTrackSRs in Frame.
00166    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00167    CandContext cx(this, mom);
00168    cx.SetDataIn(&cxin);
00169    cx.SetCandRecord(candrec);
00170    CandFitTrackSRListHandle ctllh = CandFitTrackSRList::MakeCandidate(adlh, cx);
00171 
00172    //      dummyt = times(&t2);
00173    //   cout << " fitter time " << (Double_t)(t2.tms_utime+t2.tms_stime-t1.tms_utime-t1.tms_stime)/ticksPerSecond << endl;
00174    ctllh.SetName(list_out);
00175    ctllh.SetTitle(TString("Created by FitTrackSRListModule from ").
00176                  Append(ctlh->GetName()));
00177    candrec->SecureCandHandle(ctllh);
00178 
00179    return result;
00180 }


The documentation for this class was generated from the following files:

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1