RealCalDetPIDModule Class Reference

#include <RealCalDetPIDModule.h>

Inheritance diagram for RealCalDetPIDModule:
JobCModule

List of all members.

Public Member Functions

 RealCalDetPIDModule ()
 ~RealCalDetPIDModule ()
virtual void BeginJob ()
virtual JobCResult Reco (MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void Help ()

Private Attributes

Int_t fNAllowedBefore
Int_t fNAllowedAfter
Int_t fNAllowedOut
Int_t fNRequiredIn
Int_t fTimeFileNum

Detailed Description

Definition at line 15 of file RealCalDetPIDModule.h.


Constructor & Destructor Documentation

RealCalDetPIDModule::RealCalDetPIDModule (  ) 

Definition at line 31 of file RealCalDetPIDModule.cxx.

00032      :
00033    fNAllowedBefore(1), fNAllowedAfter(1), fNAllowedOut(2),fNRequiredIn(1),
00034    fTimeFileNum(0)
00035 {
00036 //======================================================================
00037 // Default constructor
00038 //======================================================================
00039 }

RealCalDetPIDModule::~RealCalDetPIDModule (  ) 

Definition at line 43 of file RealCalDetPIDModule.cxx.

00044 {
00045 //======================================================================
00046 // Destructor
00047 //======================================================================
00048 }


Member Function Documentation

void RealCalDetPIDModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 50 of file RealCalDetPIDModule.cxx.

References AlgFactory::GetInstance(), and AlgFactory::Register().

00051 {
00052      // register my algorithm
00053      AlgFactory& af = AlgFactory::GetInstance();
00054      af.Register("AlgCalDetPID", "default", "libCalDetPID.so", "AlgConfig");
00055      
00056 }

void RealCalDetPIDModule::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 168 of file RealCalDetPIDModule.cxx.

References fNAllowedAfter, fNAllowedBefore, fNAllowedOut, fNRequiredIn, fTimeFileNum, and Registry::Get().

00169 {
00170 //======================================================================
00171 // Configure the module given the Registry r
00172 //======================================================================
00173   int    tmpi;
00174 
00175   if (r.Get("NAllowedBefore",tmpi)) { fNAllowedBefore = tmpi; }
00176   if (r.Get("NAllowedAfter",tmpi)) { fNAllowedAfter = tmpi; }
00177   if (r.Get("NAllowedOut",tmpi)) { fNAllowedOut = tmpi; }
00178   if (r.Get("NRequiredIn",tmpi)) { fNRequiredIn = tmpi; }
00179   if (r.Get("TimeFileNum",tmpi)) { fTimeFileNum = tmpi;}
00180 }

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

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

00141 {
00142 //======================================================================
00143 // Supply the default configuration for the module
00144 //======================================================================
00145   static Registry r; // Default configuration for module
00146 
00147   // Set name of config
00148   std::string name = this->JobCModule::GetName();
00149   name += ".config.default";
00150   r.SetName(name.c_str());
00151 
00152   // Set values in configuration
00153   r.UnLockValues();
00154 
00155   // for AlgCalDetPID
00156   r.Set("NAllowedBefore", 1);
00157   r.Set("NAllowedAfter", 1);
00158   r.Set("NAllowedOut", 2);
00159   r.Set("NRequiredIn", 1);
00160   
00161   r.LockValues();
00162 
00163   return r;
00164 }

void RealCalDetPIDModule::Help (  )  [virtual]

Implement to spew some useful help to cout

Reimplemented from JobCModule.

Definition at line 116 of file RealCalDetPIDModule.cxx.

References Msg::kInfo, and MSG.

00117 {
00118 //======================================================================
00119 // Prints a helpful message
00120 //======================================================================
00121 
00122      MSG("CalDetPID", Msg::kInfo)
00123           <<"RealCalDetPIDModule::Reco():\n"
00124           <<"=======================================================\n"
00125           <<"Construct a CandCalDetPID object and stick it in Mom.\n"
00126           <<"This will return JobCResult::kFailed in case of error.\n"
00127           <<"The constructed CandCaldetPID object"
00128           <<" may correspond to a single\n"
00129           <<"particle (see CalDetParticleType.h) or some"
00130           <<" combination if the PID\n"
00131           <<"is (sufficiently) ambiguous.\n"
00132           <<"========================================================\n"
00133           <<endl;
00134 
00135 }

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 60 of file RealCalDetPIDModule.cxx.

References fNAllowedAfter, fNAllowedBefore, fNAllowedOut, fNRequiredIn, fTimeFileNum, AlgHandle::GetAlgConfig(), AlgFactory::GetAlgHandle(), AlgFactory::GetInstance(), Msg::kError, JobCResult::kFailed, JobCResult::kPassed, Msg::kWarning, Registry::LockValues(), CandCalDetPID::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), Registry::Set(), CandContext::SetCandRecord(), CandContext::SetDataIn(), and Registry::UnLockValues().

00061 {
00062 //======================================================================
00063 // Construct a CandCalDetPID object and stick it in Mom.
00064 // This will return JobCResult::kFailed in case of error.
00065 // The constructed CandCaldetPID object may correspond to a single
00066 // particle (see CalDetParticleType.h" or some combination if the PID
00067 // is (sufficiently) ambiguous.
00068 //======================================================================
00069      JobCResult result=JobCResult::kPassed;
00070      
00071      AlgHandle ah = 
00072           AlgFactory::GetInstance().GetAlgHandle("AlgCalDetPID","default");
00073      
00074      AlgConfig& ac = ah.GetAlgConfig();
00075      // set up algorithm configuration
00076      ac.UnLockValues();
00077      ac.Set("NAllowedBefore",fNAllowedBefore);
00078      ac.Set("NAllowedAfter", fNAllowedAfter);
00079      ac.Set("NAllowedOut", fNAllowedOut);
00080      ac.Set("NRequiredIn", fNRequiredIn);
00081      ac.Set("TimeFileNum", fTimeFileNum);
00082      ac.LockValues();
00083 
00084      CandCalDetSIHandle* csih_ptr 
00085           = DataUtil::GetCandidate<CandCalDetSIHandle>
00086           (mom,"CandCalDetSIHandle");
00087      if(csih_ptr){
00088           CandContext cc(this, mom);
00089           cc.SetDataIn(csih_ptr);
00090 
00091           CandRecord* cr = dynamic_cast<CandRecord*>
00092                (mom->GetFragment("CandRecord","PrimaryCandidateRecord"));
00093           if(cr==0){
00094                MSG("CalDetPID", Msg::kError)
00095                     <<"Could not find a CandRecord?!?! Failing event!"<<endl;
00096                result=JobCResult::kFailed;
00097           }
00098           else{
00099                cc.SetCandRecord(cr);
00100                CandCalDetPIDHandle cpidh = 
00101                     CandCalDetPID::MakeCandidate(ah, cc);
00102                cr->SecureCandHandle(cpidh);
00103           }
00104      }
00105      else {
00106           MSG("CalDetPID", Msg::kWarning)
00107                <<"Could not find a CandCalDetSIHandle. Failing event!"<<endl;
00108           result = JobCResult::kFailed;
00109      }
00110   return result; // kNoDecision, kFailed, etc.
00111 }


Member Data Documentation

Definition at line 34 of file RealCalDetPIDModule.h.

Referenced by Config(), and Reco().

Definition at line 33 of file RealCalDetPIDModule.h.

Referenced by Config(), and Reco().

Definition at line 35 of file RealCalDetPIDModule.h.

Referenced by Config(), and Reco().

Definition at line 36 of file RealCalDetPIDModule.h.

Referenced by Config(), and Reco().

Definition at line 37 of file RealCalDetPIDModule.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