TrackSRListModule Class Reference

#include <TrackSRListModule.h>

Inheritance diagram for TrackSRListModule:
JobCModule

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 22 of file TrackSRListModule.h.


Constructor & Destructor Documentation

TrackSRListModule::TrackSRListModule (  ) 

Definition at line 77 of file TrackSRListModule.cxx.

00078 {
00079 }

TrackSRListModule::~TrackSRListModule (  ) 

Definition at line 82 of file TrackSRListModule.cxx.

00083 {
00084 }


Member Function Documentation

void TrackSRListModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 87 of file TrackSRListModule.cxx.

00088 {
00089 }

const Registry & TrackSRListModule::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 91 of file TrackSRListModule.cxx.

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

00092 {
00093 
00094 //
00095 //  Purpose:    Method to return default configuration.
00096 //
00097 //  Arguments:  n/a
00098 //
00099 //  Return:     Registry item containing default configuration.
00100 //
00101 
00102 static Registry def_cfg;
00103   static bool been_here = false;
00104   if(been_here)return def_cfg;
00105   been_here=true;
00106 
00107   string name = this->JobCModule::GetName();
00108   name += ".config.default";
00109   def_cfg.SetName(name.c_str());
00110 
00111   // Set default
00112   def_cfg.Set("TrackListAlgorithm","AlgTrackSRList");
00113   def_cfg.Set("TrackListAlgConfig","default");
00114   def_cfg.Set("ListIn","CandSliceList");
00115   def_cfg.Set("ListOut","CandTrackSRList");
00116   def_cfg.Set("LogLevel","Fatal");
00117   return def_cfg;
00118 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 121 of file TrackSRListModule.cxx.

References CandRecord::FindCandHandle(), Registry::Get(), AlgFactory::GetAlgHandle(), JobCModule::GetConfig(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetName(), CandHandle::GetNDaughters(), RecMinos::GetVldContext(), Calibrator::Instance(), Msg::kInfo, JobCResult::kPassed, Msg::kWarning, CandTrackSRList::MakeCandidate(), MAXMSG, MSG, CalScheme::Reset(), CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandTrackSRListHandle::SetCPUTime(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), CandHandle::SetTitle(), and JobCResult::SetWarning().

00122 {
00123    JobCResult result(JobCResult::kPassed);
00124 // load configuration 
00125   const char* tmps = 0;
00126   const char* alg_name = 0;
00127   const char* alg_config_name = 0;
00128   const char* list_in = 0;
00129   const char* list_out = 0;
00130 
00131   Registry& cfg = this->GetConfig();
00132   if (cfg.Get("TrackListAlgorithm",tmps)) alg_name = tmps;
00133   if (cfg.Get("TrackListAlgConfig",tmps)) alg_config_name = tmps;
00134   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00135   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00136 
00137 // Find PrimaryCandidateRecord fragment in MOM.
00138    CandRecord *candrec = dynamic_cast<CandRecord *>
00139              (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00140    if (candrec == 0) {
00141      MSG("TrackSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00142                                                                 << endl;
00143      result.SetWarning().SetFailed();
00144      return result;
00145 
00146    }
00147 
00148 // (Re)Initialize VldContext in StripCalibrator
00149    Calibrator::Instance().Reset(*candrec->GetVldContext());
00150 
00151 // Find CandSliceList fragment in PrimaryCandidateRecord
00152    CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00153       (candrec->FindCandHandle("CandSliceListHandle",list_in));
00154 
00155 // Require number of CandSlices to be non-zero.
00156    if (!cslh || cslh->GetNDaughters() < 1) {
00157      MAXMSG("TrackSR", Msg::kInfo,1)
00158                   << "Null CandSlice list.  Bail out of event." << endl;
00159 
00160 //--ju 6/22/05 not an error condition, so don't return error code.
00161 //   result.SetWarning().SetFailed();
00162      result.SetFailed();
00163      return result;
00164    }
00165 
00166    TObjArray cxin;
00167    cxin.Add(cslh);
00168 
00169    AlgFactory &af = AlgFactory::GetInstance();
00170 
00171 // Build a CandTrackSRList containing all CandTrackSRs in Frame.
00172    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00173    CandContext cx(this, mom);
00174    cx.SetDataIn(&cxin);
00175    cx.SetCandRecord(candrec);
00176 
00177    clock_t dummyt;
00178    struct tms t1;
00179    struct tms t2;
00180    static double ticksPerSecond = sysconf(_SC_CLK_TCK);
00181    dummyt = times(&t1);
00182 
00183    CandTrackSRListHandle csllh = CandTrackSRList::MakeCandidate(adlh, cx);
00184    csllh.SetName(list_out);
00185    csllh.SetTitle(TString("Created by TrackSRListModule from ").
00186                  Append(cslh->GetName()));
00187 
00188    dummyt = times(&t2);
00189    csllh.SetCPUTime((Double_t)(t2.tms_utime+t2.tms_stime-t1.tms_utime-t1.tms_stime)/ticksPerSecond);
00190 
00191    candrec->SecureCandHandle(csllh);
00192    return result;
00193 }


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1