FitTrackCamListModule Class Reference

#include <FitTrackCamListModule.h>

Inheritance diagram for FitTrackCamListModule:
JobCModule

List of all members.

Public Member Functions

 FitTrackCamListModule ()
 ~FitTrackCamListModule ()
void BeginJob ()
void EndJob ()
JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
const char * GetName () const

Private Attributes

TString fListIn
TString fListOut
TString fAlgName
TString fAlgConfig
TString fAlgFitName
int fUseGeoSwimmer

Detailed Description

Definition at line 14 of file FitTrackCamListModule.h.


Constructor & Destructor Documentation

FitTrackCamListModule::FitTrackCamListModule (  ) 

Definition at line 33 of file FitTrackCamListModule.cxx.

References fAlgConfig, fAlgFitName, fAlgName, and fListIn.

00034 {
00035   fAlgName="AlgFitTrackCamList";
00036   fAlgConfig="default";
00037 
00038   fAlgFitName="AlgFitTrackCam";
00039 
00040   fListIn="CandTrackSRList";
00041 
00042 }

FitTrackCamListModule::~FitTrackCamListModule (  ) 

Definition at line 47 of file FitTrackCamListModule.cxx.

00048 {
00049 }


Member Function Documentation

void FitTrackCamListModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 54 of file FitTrackCamListModule.cxx.

References Msg::kDebug, and MSG.

00055 {
00056   MSG("FitTrackCamListModule", Msg::kDebug) << " Track Fitter startup complete " << endl;
00057 }

void FitTrackCamListModule::Config ( const Registry r  )  [virtual]

Return the actual configuration. If your module directly pulls its configuration from the fConfig Registry, you don't need to override this. Override if you have local config variables.

Reimplemented from JobCModule.

Definition at line 185 of file FitTrackCamListModule.cxx.

References fAlgConfig, fAlgName, fListIn, fListOut, fUseGeoSwimmer, and Registry::Get().

00186 {
00187 //======================================================================
00188 // Configure the module given the Registry r
00189 //======================================================================
00190 
00191   const char* tmps;
00192   int   tmpi;
00193   if (r.Get("NameListIn",tmps)) { fListIn = tmps; }
00194   if (r.Get("NameListOut",tmps)) { fListOut = tmps; }
00195   if (r.Get("FitTrackCamAlgorithm",tmps)) { fAlgName = tmps; }
00196   if (r.Get("FitTrackCamAlgConfig",tmps)) { fAlgConfig = tmps; }
00197   if (r.Get("UseGeoSwimmer",tmpi)) { fUseGeoSwimmer = tmpi; }
00198 
00199 }

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

References GetName(), Registry::LockValues(), Registry::Set(), and Registry::UnLockValues().

00159 {
00160 //======================================================================
00161 // Supply the default configuration for the module
00162 //======================================================================
00163   static Registry r; // Default configuration for module
00164 
00165   // Set name of config
00166   std::string name = this->GetName();
00167   name += ".config.default";
00168   r.SetName(name.c_str());
00169 
00170   // Set values in configuration
00171   r.UnLockValues();
00172   r.Set("NameListIn","CandTrackSRList");
00173   r.Set("NameListOut","CandFitTrackCamList");
00174   r.Set("FitTrackCamAlgorithm","AlgFitTrackCamList");
00175   r.Set("FitTrackCamAlgConfig","default");
00176   r.Set("UseGeoSwimmer",1);
00177   r.LockValues();
00178 
00179   return r;
00180 }

void FitTrackCamListModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 62 of file FitTrackCamListModule.cxx.

00063 {
00064 }

const char * FitTrackCamListModule::GetName (  )  const

Returns the canonical name of this module

Reimplemented from JobCModule.

Definition at line 149 of file FitTrackCamListModule.cxx.

Referenced by DefaultConfig().

00150 {
00151   const char* tmps = "FitTrackCamListModule";
00152   return tmps;
00153 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 69 of file FitTrackCamListModule.cxx.

References fAlgConfig, fAlgFitName, fAlgName, CandRecord::FindCandHandle(), fListIn, fListOut, fUseGeoSwimmer, Registry::Get(), AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetNDaughters(), RawRecord::GetRawHeader(), RawDaqHeader::GetRun(), RawDaqSnarlHeader::GetSnarl(), JobCResult::kAOK, Msg::kDebug, JobCResult::kPassed, Msg::kWarning, Registry::LockKeys(), Registry::LockValues(), CandFitTrackCamList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), Registry::Set(), CandContext::SetCandRecord(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), CandHandle::SetTitle(), Registry::UnLockKeys(), and Registry::UnLockValues().

00070 {
00071   JobCResult result(JobCResult::kPassed);
00072   
00073   const char* alg_name = 0;
00074   const char* alg_config_name = 0;
00075   const char* algfit_name = 0;
00076   
00077   // Get CandRecord
00078   CandRecord *candrec = dynamic_cast<CandRecord *> (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00079   if(!candrec)
00080     {
00081       MSG("FitTrackCamListModule", Msg::kWarning) << " Failed to Find CandRecord " << endl;
00082       return result.SetFailed();
00083     }
00084 
00085   // Get RawRecord, in particular a DaqSnarl record
00086   RawRecord *rr = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord",0,"DaqSnarl"));
00087   if(rr==0){
00088     MSG("FitTrackCamListModule", Msg::kWarning) << " Failed to Find RawRecord " << endl;
00089     return result.SetFailed();
00090   }
00091   
00092   // Get RawHeader
00093   else {
00094     const RawDaqSnarlHeader* hdr = dynamic_cast<const RawDaqSnarlHeader*>(rr->GetRawHeader());
00095     if(hdr){
00096       MSG("FitTrackCamListModule", Msg::kDebug) << "Run, Snarl: "<<hdr->GetRun()<<", "<< hdr->GetSnarl()<<endl; 
00097     }
00098   }
00099 
00100 
00101   // Get CandTrackListHandle
00102   CandTrackListHandle* track_list = dynamic_cast<CandTrackListHandle*>(candrec->FindCandHandle("CandTrackListHandle",fListIn.Data()));
00103   //assert(track_list);
00104   if( !track_list || (track_list && track_list->GetNDaughters()<1) )
00105     {
00106       // Require number of CandTracks to be non-zero.
00107       if(!track_list) {
00108         MSG("FitTrackCamListModule", Msg::kDebug) << " Failed to Find " << fListIn.Data() << endl;}
00109       else if(track_list && track_list->GetNDaughters()<1) {
00110         MSG("FitTrackCamListModule", Msg::kDebug) << " No tracks found. Empty " << fListIn.Data() << endl;}
00111 
00112       //return JobCResult::kPassed;
00113       return JobCResult::kAOK;     // Otherwise no further processing of record
00114     }
00115 
00116 
00117   AlgFactory &af = AlgFactory::GetInstance();
00118   alg_name=fAlgName.Data(); alg_config_name=fAlgConfig.Data();
00119   AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00120 
00121   algfit_name=fAlgFitName.Data();
00122   AlgHandle adlhfit = af.GetAlgHandle(algfit_name,alg_config_name);
00123   
00124   AlgConfig &algfit = adlhfit.GetAlgConfig();
00125 
00126   algfit.UnLockValues();
00127   algfit.UnLockKeys();
00128   int fSet;
00129   if(!algfit.Get("UseGeoSwimmer",fSet)) {
00130     algfit.Set("UseGeoSwimmer",fUseGeoSwimmer);
00131   }
00132   algfit.LockValues();
00133   algfit.LockKeys();
00134 
00135   CandContext cx(this, mom);
00136   cx.SetCandRecord(candrec);
00137   cx.SetDataIn(track_list);
00138   CandFitTrackCamListHandle cftlh = CandFitTrackCamList::MakeCandidate(adlh, cx);
00139   cftlh.SetName(fListOut.Data());
00140   cftlh.SetTitle(TString("Created by FitTrackCamListModule"));
00141   candrec->SecureCandHandle(cftlh);
00142    
00143   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00144 }


Member Data Documentation

Definition at line 38 of file FitTrackCamListModule.h.

Referenced by Config(), FitTrackCamListModule(), and Reco().

Definition at line 40 of file FitTrackCamListModule.h.

Referenced by FitTrackCamListModule(), and Reco().

Definition at line 37 of file FitTrackCamListModule.h.

Referenced by Config(), FitTrackCamListModule(), and Reco().

TString FitTrackCamListModule::fListIn [private]

Definition at line 35 of file FitTrackCamListModule.h.

Referenced by Config(), FitTrackCamListModule(), and Reco().

Definition at line 36 of file FitTrackCamListModule.h.

Referenced by Config(), and Reco().

Definition at line 42 of file FitTrackCamListModule.h.

Referenced by Config(), and Reco().


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1