ClusterSRListModule Class Reference

#include <ClusterSRListModule.h>

Inheritance diagram for ClusterSRListModule:
JobCModule

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 21 of file ClusterSRListModule.h.


Constructor & Destructor Documentation

ClusterSRListModule::ClusterSRListModule (  ) 

Definition at line 47 of file ClusterSRListModule.cxx.

00048 {
00049 }

ClusterSRListModule::~ClusterSRListModule (  ) 

Definition at line 52 of file ClusterSRListModule.cxx.

00053 {
00054 }


Member Function Documentation

void ClusterSRListModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 57 of file ClusterSRListModule.cxx.

00058 {
00059 }

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

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

00062 {
00063 
00064 //
00065 //  Purpose:    Method to return default configuration.
00066 //
00067 //  Arguments:  n/a
00068 //
00069 //  Return:     Registry item containing default configuration.
00070 //
00071 
00072 
00073   static Registry def_cfg;
00074   static bool been_here = false;
00075   if(been_here)return def_cfg;
00076   been_here=true;
00077   string name = this->JobCModule::GetName();
00078   name += ".config.default";
00079   def_cfg.SetName(name.c_str());
00080 
00081   // Set defaults
00082   def_cfg.Set("ClusterListAlgorithm","AlgClusterSRList");
00083   def_cfg.Set("ClusterListAlgConfig","default");
00084   def_cfg.Set("ListIn","CandSliceList");
00085   def_cfg.Set("ListOut","CandClusterList");
00086   def_cfg.Set("LogLevel","Fatal");
00087   return def_cfg;
00088 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 92 of file ClusterSRListModule.cxx.

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

00093 {
00094   JobCResult result(JobCResult::kPassed);
00095   
00096   // load configuration 
00097   const char* tmps = 0;
00098   const char* alg_name = 0;
00099   const char* alg_config_name = 0;
00100   const char* list_in = 0;
00101   const char* list_out = 0;
00102   
00103   Registry& cfg = this->GetConfig();
00104   if (cfg.Get("ClusterListAlgorithm",tmps)) alg_name = tmps;
00105   if (cfg.Get("ClusterListAlgConfig",tmps)) alg_config_name = tmps;
00106   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00107   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00108   
00109   // Find PrimaryCandidateRecord fragment in MOM.
00110   CandRecord *candrec = dynamic_cast<CandRecord *>
00111     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00112   if (candrec == 0) {
00113     MSG("ClusterSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM." << endl;
00114     result.SetWarning().SetFailed();                                          
00115     return result; // Flag as error condition
00116   }
00117   
00118   // FindCandHandle does not search inheritance, so for now just access by
00119   // object name
00120   CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00121     (candrec->FindCandHandle("CandSliceListHandle",list_in));
00122   
00123   // Require number of CandSlices to be non-zero.
00124   if (!cslh || cslh->GetNDaughters() < 1) {
00125     MAXMSG("ClusterSR", Msg::kInfo,1)
00126       << "Null CandSlice list.  Bail out of event." << endl;
00127 
00128 //--ju 6/23/05 not really an error condition, so keep messages to a minimum
00129 //  result.SetWarning().SetFailed();
00130     result.SetFailed();
00131     return result;
00132   }
00133 
00134    AlgFactory &af = AlgFactory::GetInstance();
00135 
00136 // Build a CandClusterSRList containing all CandClusterSRs in Frame.
00137    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00138    CandContext cx(this, mom);
00139    cx.SetDataIn(cslh);
00140    cx.SetCandRecord(candrec);
00141 
00142    CandClusterListHandle csllh = CandClusterList::MakeCandidate(adlh, cx);
00143    csllh.SetName(list_out);
00144    csllh.SetTitle(TString("Created by ClusterSRListModule from ").
00145                  Append(cslh->GetName()));
00146    candrec->SecureCandHandle(csllh);
00147 
00148    return result; // no pass/fail decision
00149 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1