SliceFromChopModule Class Reference

#include <SliceFromChopModule.h>

Inheritance diagram for SliceFromChopModule:

JobCModule List of all members.

Public Member Functions

 SliceFromChopModule ()
 ~SliceFromChopModule ()
JobCResult Ana (const MomNavigator *mom)
JobCResult Reco (MomNavigator *mom)
void EndJob ()
const RegistryDefaultConfig () const

Private Attributes

StripStat fStats

Detailed Description

Definition at line 14 of file SliceFromChopModule.h.


Constructor & Destructor Documentation

SliceFromChopModule::SliceFromChopModule (  ) 

Definition at line 34 of file SliceFromChopModule.cxx.

References fStats, Msg::kDebug, and MSG.

00035 {
00036 
00037   // A copy of Peter's StripStat code, copied from th StripSRListModule constructor.
00038   // Jan, 2006
00039   TFolder *lf = dynamic_cast<TFolder *>(gROOT->FindObject("Loon"));
00040   if (lf==0) {
00041     MSG("Chop", Msg::kDebug) << "Creating Loon TFolder" << endl;
00042     lf = gROOT->GetRootFolder()->AddFolder("Loon", "Loon analysis");
00043     gROOT->GetListOfBrowsables()->Add(lf, "Loon");
00044   }
00045   TFolder* statFolder = lf->AddFolder("CandStripSR", "CandStripSR statistics");
00046   statFolder->Add(&fStats);
00047 
00048 }

SliceFromChopModule::~SliceFromChopModule (  ) 

Definition at line 52 of file SliceFromChopModule.cxx.

00053 {
00054 }


Member Function Documentation

JobCResult SliceFromChopModule::Ana ( const MomNavigator mom  )  [virtual]

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 127 of file SliceFromChopModule.cxx.

References JobCResult::kPassed.

00128 {
00129   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00130 }

const Registry & SliceFromChopModule::DefaultConfig (  )  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 134 of file SliceFromChopModule.cxx.

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

00135 {
00136   //======================================================================
00137   // Supply the default configuration for the module
00138   //======================================================================
00139   static Registry r; // Default configuration for module
00140   
00141   // Set name of config
00142   std::string name = this->JobCModule::GetName();
00143   name += ".config.default";
00144   r.SetName(name.c_str());
00145   
00146   // Set values in configuration
00147   r.UnLockValues();
00148   r.Set("SliceFromChopAlgorithm","AlgSliceListFromChopList");
00149   r.Set("SliceFromChopAlgConfig","default");
00150   r.Set("StripFromSliceAlgorithm","AlgStripListFromSliceList");
00151   r.Set("StripFromSliceAlgConfig","default");
00152   r.Set("ChopListIn",     "candchoplist");
00153   r.Set("SliceListOut",   "CandSliceList");
00154   r.Set("StripListOut",   "candstriplist");
00155 
00156   r.LockValues();
00157 
00158   return r;
00159 }

void SliceFromChopModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 57 of file SliceFromChopModule.cxx.

References fStats, and StripStat::Print().

00058 { 
00059   // For Peter's stats.
00060   fStats.Print();
00061 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 66 of file SliceFromChopModule.cxx.

References CandRecord::FindCandHandle(), Registry::GetCharString(), JobCModule::GetConfig(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), JobCResult::kPassed, Msg::kWarning, CandStripList::MakeCandidate(), CandSliceList::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), CandHandle::SetCandRecord(), CandContext::SetCandRecord(), CandContext::SetDataIn(), JobCResult::SetFailed(), CandHandle::SetName(), CandHandle::SetTitle(), and JobCResult::SetWarning().

00067 {
00068   JobCResult result = JobCResult::kPassed;
00069 
00070   // config.
00071   Registry& cfg = this->GetConfig();
00072   const char* chopListIn = cfg.GetCharString("ChopListIn");
00073   const char* sliceListOut = cfg.GetCharString("SliceListOut");
00074   const char* stripListOut = cfg.GetCharString("StripListOut");
00075 
00076   // Find PrimaryCandidateRecord fragment in MOM.
00077   CandRecord *candrec = dynamic_cast<CandRecord *>
00078     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00079   if (candrec == 0) {
00080     MSG("SliceFromChop", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00081                                         << endl;
00082     result.SetWarning().SetFailed();
00083     return result;
00084   }
00085 
00086   // find the list of slices.
00087   CandChopListHandle *chopList = dynamic_cast<CandChopListHandle*>
00088     (candrec->FindCandHandle("CandChopListHandle", chopListIn));
00089 
00090   // Set up the restripper algorithm
00091   AlgFactory &af = AlgFactory::GetInstance();
00092   AlgHandle adlh = af.GetAlgHandle( cfg.GetCharString("SliceFromChopAlgorithm"),
00093                                     cfg.GetCharString("SliceFromChopAlgConfig") );
00094   CandContext cx(this, mom);
00095   cx.SetDataIn(chopList);
00096   cx.SetCandRecord(candrec);
00097 
00098   CandSliceListHandle outSliceList = CandSliceList::MakeCandidate(adlh,cx);
00099   outSliceList.SetName(sliceListOut);
00100   outSliceList.SetTitle("Slices created from Chops"); 
00101   outSliceList.SetCandRecord(candrec);
00102   candrec->SecureCandHandle(outSliceList);
00103   
00104 
00105   // We now have a list of slices. Now also make a global strip list.
00106   {
00107   adlh = af.GetAlgHandle( cfg.GetCharString("StripFromSliceAlgorithm"),
00108                           cfg.GetCharString("StripFromSliceAlgConfig") );
00109   cx.SetDataIn(&outSliceList);
00110   cx.SetCandRecord(candrec);
00111 
00112   CandStripListHandle outStrips = CandStripList::MakeCandidate(adlh,cx);
00113   outStrips.SetName(stripListOut);
00114   outStrips.SetTitle("Strips aggregated from Slices"); 
00115   outStrips.SetCandRecord(candrec);
00116   candrec->SecureCandHandle(outStrips);
00117   
00118   }
00119 
00120   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00121 }


Member Data Documentation

StripStat SliceFromChopModule::fStats [private]

Definition at line 32 of file SliceFromChopModule.h.

Referenced by EndJob(), and SliceFromChopModule().


The documentation for this class was generated from the following files:
Generated on Thu Jul 10 22:53:43 2014 for loon by  doxygen 1.4.7