SubShowerSRListModule Class Reference

#include <SubShowerSRListModule.h>

Inheritance diagram for SubShowerSRListModule:
JobCModule

List of all members.

Public Member Functions

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

Detailed Description

Definition at line 19 of file SubShowerSRListModule.h.


Constructor & Destructor Documentation

SubShowerSRListModule::SubShowerSRListModule (  ) 

Definition at line 41 of file SubShowerSRListModule.cxx.

00042 {
00043 }

SubShowerSRListModule::~SubShowerSRListModule (  ) 

Definition at line 46 of file SubShowerSRListModule.cxx.

00047 {
00048 }


Member Function Documentation

void SubShowerSRListModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 51 of file SubShowerSRListModule.cxx.

00052 {
00053 }

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

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

00056 {
00057 
00058   static Registry def_cfg;
00059   static bool been_here = false;
00060   if(been_here)return def_cfg;
00061   been_here=true;
00062   string name = this->JobCModule::GetName();
00063   name += ".config.default";
00064   def_cfg.SetName(name.c_str());
00065 
00066   // Set defaults
00067   def_cfg.Set("SubShowerSRListAlgorithm","AlgSubShowerSRList");
00068   def_cfg.Set("SubShowerSRListAlgConfig","default");
00069   def_cfg.Set("ListIn","CandSliceList");
00070   def_cfg.Set("TrackListIn","CandTrackSRList");
00071   def_cfg.Set("ClusterListIn","CandClusterList");
00072   def_cfg.Set("ListOut","CandSubShowerSRList");
00073   def_cfg.Set("LogLevel","Fatal");
00074   return def_cfg;
00075 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 79 of file SubShowerSRListModule.cxx.

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

00080 {
00081   JobCResult result(JobCResult::kPassed);
00082   
00083   // load configuration 
00084   const char* tmps = 0;
00085   const char* alg_name = 0;
00086   const char* alg_config_name = 0;
00087   const char* list_in = 0;
00088   const char* track_list = 0;
00089   const char* cluster_list = 0;
00090   const char* list_out = 0;
00091   
00092   Registry& cfg = this->GetConfig();
00093   if (cfg.Get("SubShowerSRListAlgorithm",tmps)) alg_name = tmps;
00094   if (cfg.Get("SubShowerSRListAlgConfig",tmps)) alg_config_name = tmps;
00095   if (cfg.Get("ListIn",tmps)) list_in = tmps;
00096   if (cfg.Get("TrackListIn",tmps)) track_list = tmps;
00097   if (cfg.Get("ClusterListIn",tmps)) cluster_list = tmps;
00098   if (cfg.Get("ListOut",tmps)) list_out = tmps;
00099   
00100   // Find PrimaryCandidateRecord fragment in MOM.
00101   CandRecord *candrec = dynamic_cast<CandRecord *>
00102     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00103   if (candrec == 0) {
00104     MSG("SubShowerSR", Msg::kWarning) << "No PrimaryCandidateRecord in MOM." << endl;
00105     result.SetWarning().SetFailed();                                          
00106     return result; // Flag as error condition
00107   }
00108   
00109   // FindCandHandle does not search inheritance, so for now just access by
00110   // object name
00111   CandSliceListHandle *cslh = dynamic_cast<CandSliceListHandle *>
00112     (candrec->FindCandHandle("CandSliceListHandle",list_in));
00113   
00114   // Require number of CandSlices to be non-zero.
00115   if (!cslh || cslh->GetNDaughters() < 1) {
00116     MSG("SubShowerSR", Msg::kWarning)
00117       << "Null CandSlice list.  Bail out of event." << endl;
00118     result.SetFailed();  // don't flag as error condition 
00119     return result;
00120   }
00121   
00122   CandClusterListHandle *cclh = dynamic_cast<CandClusterListHandle *>
00123     (candrec->FindCandHandle("CandClusterListHandle",cluster_list));
00124   if(!cclh) {
00125     MSG("SubShowerSR", Msg::kWarning)
00126       << "Null CandCluster list.  Bail out of event." << endl;    
00127     return result;
00128   }
00129 
00130   CandTrackListHandle *ctlh = dynamic_cast<CandTrackListHandle *>
00131     (candrec->FindCandHandle("CandTrackListHandle",track_list));
00132   if(!ctlh) {
00133     MSG("SubShowerSR", Msg::kWarning)
00134       << "Null CandTrack list." << endl;        
00135     //return result;
00136   }
00137   TObjArray cxin;
00138   cxin.Add(cslh);
00139   cxin.Add(cclh);
00140   cxin.Add(ctlh);
00141   
00142   AlgFactory &af = AlgFactory::GetInstance();
00143   
00144   // Build a CandSubShowerSRList containing all CandSubShowerSRs in Frame.
00145   AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00146   CandContext cx(this, mom);
00147   cx.SetDataIn(&cxin);
00148   cx.SetCandRecord(candrec);
00149 
00150   MSG("SubShowerSR",Msg::kVerbose) << "Making SubShowerSRList" << endl;
00151   CandSubShowerSRListHandle csslh = CandSubShowerSRList::MakeCandidate(adlh, cx);
00152   csslh.SetName(list_out);
00153   csslh.SetTitle(TString("Created by SubShowerSRListModule from ").
00154                  Append(cslh->GetName()));
00155   candrec->SecureCandHandle(csslh);
00156   
00157   return result; // no pass/fail decision
00158 }


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1