AtmosShowerListModule Class Reference

#include <AtmosShowerListModule.h>

Inheritance diagram for AtmosShowerListModule:
JobCModule

List of all members.

Public Member Functions

 AtmosShowerListModule ()
 ~AtmosShowerListModule ()
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 fTrackListIn
TString fListOut
TString fAlgName
TString fAlgConfig

Detailed Description

Definition at line 17 of file AtmosShowerListModule.h.


Constructor & Destructor Documentation

AtmosShowerListModule::AtmosShowerListModule (  ) 

Definition at line 49 of file AtmosShowerListModule.cxx.

References fAlgConfig, fAlgName, fListIn, and fTrackListIn.

00050 {
00051   fAlgName="AlgAtmosShowerList";
00052   fAlgConfig="default";
00053 
00054   fListIn="CandSliceList";
00055   fTrackListIn="CandFitTrackCamList";
00056 }

AtmosShowerListModule::~AtmosShowerListModule (  ) 

Definition at line 61 of file AtmosShowerListModule.cxx.

00062 {
00063 }


Member Function Documentation

void AtmosShowerListModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 68 of file AtmosShowerListModule.cxx.

References AlgFactory::GetInstance(), Msg::kInfo, MSG, and AlgFactory::Register().

00069 {
00070   // Register algorithms
00071   AlgFactory &af = AlgFactory::GetInstance();
00072   af.Register("AlgAtmosShowerList", "default", "libAtNuReco.so", "AlgConfig");
00073   af.Register("AlgShowerCam", "default", "libAtNuReco.so", "AlgConfig");
00074 
00075   MSG("AtmosShowerListModule", Msg::kInfo) << " Shower finder startup complete " << endl;
00076 }

void AtmosShowerListModule::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 207 of file AtmosShowerListModule.cxx.

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

00208 {
00209   //======================================================================
00210   // Configure the module given the Registry r
00211   //======================================================================
00212   const char* tmps;
00213   if (r.Get("NameListIn",tmps)) { fListIn = tmps; }
00214   if (r.Get("NameTrackListIn",tmps)) { fTrackListIn = tmps; }
00215   if (r.Get("NameListOut",tmps)) { fListOut = tmps; }
00216   if (r.Get("AtmosShowerAlgorithm",tmps)) { fAlgName = tmps; }
00217   if (r.Get("AtmosShowerAlgConfig",tmps)) { fAlgConfig = tmps; }
00218 }

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

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

00181 {
00182   //======================================================================
00183   // Supply the default configuration for the module
00184   //======================================================================
00185   static Registry r; // Default configuration for module
00186 
00187   // Set name of config
00188   std::string name = this->GetName();
00189   name += ".config.default";
00190   r.SetName(name.c_str());
00191 
00192   // Set values in configuration
00193   r.UnLockValues();
00194   r.Set("NameListIn","CandSliceList");
00195   r.Set("NameTrackListIn","CandFitTrackCamList");
00196   r.Set("NameListOut","CandShowerAtNuList");
00197   r.Set("AtmosShowerAlgorithm","AlgAtmosShowerList");
00198   r.Set("AtmosShowerAlgConfig","default");
00199   r.LockValues();
00200 
00201   return r;
00202 }

void AtmosShowerListModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 81 of file AtmosShowerListModule.cxx.

00082 {
00083 }

const char * AtmosShowerListModule::GetName (  )  const

Returns the canonical name of this module

Reimplemented from JobCModule.

Definition at line 171 of file AtmosShowerListModule.cxx.

Referenced by DefaultConfig().

00172 {
00173   const char* tmps = "AtmosShowerListModule";
00174   return tmps;
00175 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 88 of file AtmosShowerListModule.cxx.

References fAlgConfig, fAlgName, CandRecord::FindCandHandle(), fListIn, fListOut, fTrackListIn, AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandHandle::GetNDaughters(), RawRecord::GetRawHeader(), RawDaqHeader::GetRun(), RawDaqSnarlHeader::GetSnarl(), JobCResult::kAOK, Msg::kDebug, Msg::kInfo, JobCResult::kPassed, Msg::kVerbose, Msg::kWarning, CandShowerAtNuList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), CandContext::SetCandRecord(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), and CandHandle::SetTitle().

00089 {
00090   JobCResult result(JobCResult::kPassed);
00091   
00092   const char* alg_name = 0;
00093   const char* alg_config_name = 0;
00094   
00095   // Get CandRecord
00096   CandRecord *candrec = dynamic_cast<CandRecord *> (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00097   if(!candrec)
00098     {
00099       MSG("AtmosShowerListModule", Msg::kWarning) << " Failed to Find CandRecord " << endl;
00100       return result.SetFailed();
00101     }
00102 
00103   // Get RawRecord
00104   RawRecord *rr = dynamic_cast<RawRecord *>(mom->GetFragment("RawRecord"));
00105   if(rr==0){
00106     MSG("AtmosShowerListModule", Msg::kWarning) << " Failed to Find RawRecord " << endl;
00107     return result.SetFailed();
00108   }
00109   
00110   // Get RawHeader
00111   else {
00112     const RawDaqSnarlHeader* hdr = dynamic_cast<const RawDaqSnarlHeader*>(rr->GetRawHeader());
00113     if(hdr){
00114       MSG("AtmosShowerListModule", Msg::kVerbose) << "AtmosShowerListModule:Reco Run:Snarl "<<hdr->GetRun()<<":"<< hdr->GetSnarl()<<endl; 
00115     }
00116   }
00117 
00118   // Setup CandContext
00119   CandContext cx(this, mom);
00120   cx.SetCandRecord(candrec);
00121   TObjArray shwlistcxt;
00122 
00123   // Get CandSliceListHandle
00124   CandSliceListHandle* slice_list = dynamic_cast<CandSliceListHandle*>(candrec->FindCandHandle("CandSliceListHandle",fListIn.Data()));
00125   if( !slice_list || (slice_list && slice_list->GetNDaughters()<1) )
00126     {
00127       // Require number of CandSlices to be non-zero.
00128       MSG("AtmosShowerListModule", Msg::kWarning) << " Failed to Find " << fListIn.Data() << endl;
00129       //return JobCResult::kPassed;
00130       return JobCResult::kAOK;     // Otherwise no further processing of record
00131     }
00132   else { shwlistcxt.Add(slice_list); MSG("AtmosShowerListModule", Msg::kDebug) << "Found " << fListIn.Data() << endl; }
00133 
00134   // Get CandTrackListHandle
00135   CandTrackListHandle* track_list = dynamic_cast<CandTrackListHandle*>(candrec->FindCandHandle("CandTrackListHandle",fTrackListIn.Data()));
00136   if( !track_list || (track_list && track_list->GetNDaughters()<1) )
00137     {
00138       // Require number of CandSlices to be non-zero.
00139       MSG("AtmosShowerListModule", Msg::kWarning) << " Failed to Find " << fTrackListIn.Data() << endl;
00140     }
00141   else { shwlistcxt.Add(track_list); MSG("AtmosShowerListModule", Msg::kDebug) << "Found " << fTrackListIn.Data() << endl; }
00142 
00143   AlgFactory &af = AlgFactory::GetInstance();
00144   alg_name=fAlgName.Data(); alg_config_name=fAlgConfig.Data();
00145   AlgHandle adlh = af.GetAlgHandle(alg_name,alg_config_name);
00146 
00147   cx.SetDataIn(&shwlistcxt);
00148 
00149   clock_t dummyt;
00150   struct tms t1;
00151   struct tms t2;
00152   static double ticksPerSecond = sysconf(_SC_CLK_TCK);
00153   
00154   dummyt = times(&t1);
00155   CandShowerAtNuListHandle cslh = CandShowerAtNuList::MakeCandidate(adlh, cx);
00156   dummyt = times(&t2);
00157   //cslh.SetCPUTime((Double_t)(t2.tms_utime+t2.tms_stime-t1.tms_utime-t1.tms_stime)/ticksPerSecond);
00158 
00159   MSG("AtmosShowerListModule", Msg::kInfo) << "CandShowerAtNu CPUTime " << (Double_t)(t2.tms_utime+t2.tms_stime-t1.tms_utime-t1.tms_stime)/ticksPerSecond << endl;
00160   
00161   cslh.SetName(fListOut.Data());
00162   cslh.SetTitle(TString("Created by AtmosShowerListModule"));
00163   candrec->SecureCandHandle(cslh);
00164   
00165   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00166 }


Member Data Documentation

Definition at line 42 of file AtmosShowerListModule.h.

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

Definition at line 41 of file AtmosShowerListModule.h.

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

TString AtmosShowerListModule::fListIn [private]

Definition at line 38 of file AtmosShowerListModule.h.

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

Definition at line 40 of file AtmosShowerListModule.h.

Referenced by Config(), and Reco().

Definition at line 39 of file AtmosShowerListModule.h.

Referenced by AtmosShowerListModule(), 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