PurgeCandidateModule Class Reference

#include <PurgeCandidateModule.h>

Inheritance diagram for PurgeCandidateModule:
JobCModule

List of all members.

Public Member Functions

 PurgeCandidateModule ()
 ~PurgeCandidateModule ()
JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)

Private Attributes

std::string fCandidates

Detailed Description

Id
PurgeCandidateModule.h,v 1.1 2005/06/30 10:22:42 tagg Exp

(Document me!)

n.tagg1@physics.ox.ac.uk

Definition at line 12 of file PurgeCandidateModule.h.


Constructor & Destructor Documentation

PurgeCandidateModule::PurgeCandidateModule (  ) 

A module to purge (delete) candidates from Mom.

Definition at line 21 of file PurgeCandidateModule.cxx.

00021                                            : 
00022   fCandidates("")
00023 {
00027 }

PurgeCandidateModule::~PurgeCandidateModule (  ) 

A module to purge (delete) candidates from Mom.

Definition at line 30 of file PurgeCandidateModule.cxx.

00031 {
00035 }


Member Function Documentation

void PurgeCandidateModule::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.

Configure the module given the Registry r

Reimplemented from JobCModule.

Definition at line 105 of file PurgeCandidateModule.cxx.

References fCandidates, and Registry::GetCharString().

00106 {
00110   fCandidates = r.GetCharString("Candidates");
00111 }

const Registry & PurgeCandidateModule::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; }

Supply the default configuration for the module

Reimplemented from JobCModule.

Definition at line 83 of file PurgeCandidateModule.cxx.

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

00084 {
00088   static Registry r; // Default configuration for module
00089 
00090   // Set name of config
00091   std::string name = this->GetName();
00092   name += ".config.default";
00093   r.SetName(name.c_str());
00094 
00095   // Set values in configuration
00096   r.UnLockValues();
00097   r.Set("Candidates","CandStripListHandle,CandSliceListHandle,CandClusterListHandle,CandShowerListHandle,CandEventListHandle");
00098   r.LockValues();
00099 
00100   return r;
00101 }

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

Implement this for read-write access to the MomNavigator

Deletes the listed CandHandle types. By default, it deletes everything that is not a CandDigit.

Reimplemented from JobCModule.

Definition at line 39 of file PurgeCandidateModule.cxx.

References fCandidates, CandRecord::FindCandHandle(), MomNavigator::GetFragment(), Msg::kDebug, JobCResult::kFailed, JobCResult::kPassed, Msg::kWarning, MSG, n, and CandRecord::RemoveCandHandle().

00040 {
00045   vector<string> list;
00046   UInt_t n = fCandidates.length();
00047   UInt_t start = 0;
00048   UInt_t end = n;
00049   while(start<n) {
00050     UInt_t pos = fCandidates.find_first_of(',',start);
00051     if(pos==string::npos) end = n;
00052     else                  end=pos;
00053     if(start>=end) break;
00054     list.push_back(fCandidates.substr(start,end-start));
00055     start = end+1;
00056     end = n;
00057   }
00058   
00059   // Find PrimaryCandidateRecord fragment in MOM.
00060   CandRecord *candrec = dynamic_cast<CandRecord *>
00061     (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00062   if (candrec == 0) {
00063     MSG("DataUtil", Msg::kWarning) << "No PrimaryCandidateRecord in MOM."
00064                                    << endl;
00065     return JobCResult::kFailed;
00066   }
00067   
00068   for(UInt_t i=0;i<list.size(); i++) {
00069     CandHandle* ch;
00070     while( (ch = candrec->FindCandHandle(list[i].c_str())) ) {
00071       if(candrec->RemoveCandHandle(ch))
00072         MSG("DataUtil",Msg::kDebug)   << "Purged " << list[i] << endl;
00073       else 
00074         MSG("DataUtil",Msg::kWarning) << "Cand find " << list[i] << " to purge" << endl;    
00075     }
00076   }
00077 
00078   return JobCResult::kPassed; // kNoDecision, kFailed, etc.
00079 }


Member Data Documentation

std::string PurgeCandidateModule::fCandidates [private]

Definition at line 29 of file PurgeCandidateModule.h.

Referenced by 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