ShowerSRListModule Class Reference

#include <ShowerSRListModule.h>

Inheritance diagram for ShowerSRListModule:
JobCModule

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 23 of file ShowerSRListModule.h.


Constructor & Destructor Documentation

ShowerSRListModule::ShowerSRListModule (  ) 

Definition at line 67 of file ShowerSRListModule.cxx.

00068 {
00069 }

ShowerSRListModule::~ShowerSRListModule (  ) 

Definition at line 72 of file ShowerSRListModule.cxx.

00073 {
00074 }


Member Function Documentation

void ShowerSRListModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 77 of file ShowerSRListModule.cxx.

00078 {
00079 }

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

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

00082 { 
00083 
00084 //
00085 //  Purpose:    Method to return default configuration.
00086 //
00087 //  Arguments:  n/a
00088 //
00089 //  Return:     Registry item containing default configuration.
00090 //
00091 
00092   static Registry def_cfg;
00093   static bool been_here = false;
00094   if(been_here)return def_cfg;
00095   been_here=true;
00096 
00097   string name = this->JobCModule::GetName();
00098   name += ".config.default";
00099   def_cfg.SetName(name.c_str());
00100 
00101   // Set defaults
00102   def_cfg.Set("ShowerListAlgorithm","AlgShowerSRList");
00103   def_cfg.Set("ShowerListAlgConfig","default");
00104   def_cfg.Set("ListIn","CandSliceList");
00105   def_cfg.Set("ClusterListIn","CandClusterList");
00106   def_cfg.Set("SubShowerListIn","CandSubShowerSRList");
00107   def_cfg.Set("ListOut","CandShowerList");
00108   def_cfg.Set("LogLevel","Fatal");
00109   return def_cfg;
00110 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 113 of file ShowerSRListModule.cxx.

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

00114 {
00115   JobCResult result(JobCResult::kPassed);
00116 
00117   // load configuration 
00118   const char* tmps = 0;
00119   const char* alg_name = 0;
00120   const char* alg_config_name = 0;
00121   const char* list_in = 0;
00122   const char* cluster_list=0;
00123   const char* subshower_list=0;
00124   const char* list_out = 0;
00125 
00126   Registry& cfg = this->GetConfig();
00127   if (cfg.Get("ShowerListAlgorithm",tmps)) alg_name = tmps;
00128   if (cfg.Get("ShowerListAlgConfig",tmps)) alg_config_name = tmps;
00129   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00130   if (cfg.Get("ClusterListIn",tmps)) cluster_list = tmps;
00131   if (cfg.Get("SubShowerListIn",tmps)) subshower_list = tmps;
00132   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00133   
00134   // Find PrimaryCandidateRecord fragment in MOM.
00135   CandRecord *candrec = dynamic_cast<CandRecord *>
00136      (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00137    if (candrec == 0) {
00138      MSG("ShowerSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00139                                     << endl;
00140      result.SetWarning().SetFailed();
00141      return result;
00142    }
00143    
00144    // (Re)Initialize VldContext in Calibrator
00145    Calibrator::Instance().Reset(*candrec->GetVldContext());
00146 
00147    // Find CandSliceList fragment in PrimaryCandidateRecord.
00148    CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00149      (candrec->FindCandHandle("CandSliceListHandle",list_in));
00150    if(!cslh){
00151      MSG("ShowerSR", Msg::kVerbose)
00152        << "Null CandSlice list. Skip Shower Construction." << endl;
00153      return result;
00154    }
00155    
00156    CandClusterListHandle *cclh = dynamic_cast<CandClusterListHandle *>
00157      (candrec->FindCandHandle("CandClusterListHandle",cluster_list));
00158    if(!cclh){
00159      return result;
00160    }
00161 
00162    CandSubShowerSRListHandle *sslh = dynamic_cast<CandSubShowerSRListHandle *>
00163      (candrec->FindCandHandle("CandSubShowerSRListHandle",subshower_list));  
00164    
00165    if(!sslh) {
00166      MSG("ShowerSS", Msg::kDebug)
00167        << "Null CandSubShower list." << endl;
00168    }
00169 
00170    TObjArray cxin;
00171    cxin.Add(cslh);
00172    cxin.Add(cclh);
00173    if(sslh) cxin.Add(sslh);
00174 
00175    AlgFactory &af = AlgFactory::GetInstance();
00176    AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00177    CandContext cx(this, mom);
00178    cx.SetDataIn(&cxin);
00179    cx.SetCandRecord(candrec);
00180 
00181    if(strcmp(alg_name,"AlgShowerSRList")==0) {
00182      CandShowerListHandle csllh = CandShowerList::MakeCandidate(adlh, cx);
00183      csllh.SetName(list_out);
00184      csllh.SetTitle(TString("Created by ShowerSRListModule from ").
00185                     Append(cslh->GetName()));
00186      candrec->SecureCandHandle(csllh);
00187    }
00188    else if(strcmp(alg_name,"AlgShowerSSList")==0){
00189      CandShowerSRListHandle cssrlh = CandShowerSRList::MakeCandidate(adlh, cx);
00190      cssrlh.SetName(list_out);
00191      cssrlh.SetTitle(TString("Created by ShowerSRListModule from ").
00192                      Append(cslh->GetName()));
00193      candrec->SecureCandHandle(cssrlh);
00194    }
00195 
00196    return result;
00197 
00198 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1