CalDetSIModule Class Reference

#include <CalDetSIModule.h>

Inheritance diagram for CalDetSIModule:
JobCModule

List of all members.

Public Member Functions

 CalDetSIModule ()
virtual ~CalDetSIModule ()
void BeginJob ()
virtual JobCResult Reco (MomNavigator *mom)
virtual void HandleCommand (JobCommand *cmd)

Private Attributes

Bool_t fIsMC

Detailed Description

Definition at line 17 of file CalDetSIModule.h.


Constructor & Destructor Documentation

CalDetSIModule::CalDetSIModule (  ) 

Definition at line 30 of file CalDetSIModule.cxx.

References Msg::kDebug, and MSG.

00030                                :
00031   fIsMC(kFALSE)
00032 
00033 {
00034 
00035   MSG("CalDetSI", Msg::kDebug)<<"CalDetSIModule::Construct"<<endl;
00036 
00037 } //constructor

CalDetSIModule::~CalDetSIModule (  )  [virtual]

Definition at line 41 of file CalDetSIModule.cxx.

00041 {} //destructor


Member Function Documentation

void CalDetSIModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 45 of file CalDetSIModule.cxx.

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

00046 {
00047 MSG("CalDetSI", Msg::kVerbose) << "CalDetSIModule::BeginJob\n";
00048 
00049 // Get Singleton instance of AlgFactory.
00050   AlgFactory &af = AlgFactory::GetInstance();
00051 
00052 
00053 // Register (Algorithm, configset) by names ("AlgCalDetSI", "default")
00054     af.Register("AlgCalDetSI", "default", "libCandCalDetSI.so", "AlgConfig");
00055 
00056 // Register (Algorithm, configset) by names ("AlgCalDetSI", "default")
00057     //    af.Register("AlgCalDetSI", "default", "libCandCalDetSI.so",
00058     //   "AlgConfig");
00059   /*
00060 
00061     //MonteCarlo Stuff
00062   if (fListsToMake & kMCList) {
00063 
00064 // Register (Algorithm, configset) by names ("AlgMCDigit", "default")
00065     af.Register("AlgMCDigit", "default", "libCandDigit.so",
00066                                                            "AlgConfig");
00067 
00068 // Register an alternative configset for ("AlgMCDigitList", "default")
00069     af.Register("AlgMCDigitList", "default", "libCandDigit.so",
00070                                                            "AlgConfig");
00071   }
00072 
00073   */
00074 }//end BeginJob

void CalDetSIModule::HandleCommand ( JobCommand command  )  [virtual]

Implement to handle a JobCommand

Reimplemented from JobCModule.

Definition at line 125 of file CalDetSIModule.cxx.

References fIsMC, Msg::kInfo, MSG, and JobCommand::PopCmd().

00126 {
00127   const char *c = cmd->PopCmd();
00128   if(c){
00129     string sc(c);
00130     
00131     if(sc=="MonteCarlo"){
00132       fIsMC = kTRUE;
00133     }
00134 
00135     MSG("CalDetSIModule", Msg::kInfo)<<"Prepared for a MonteCarlo File"<<endl;
00136   
00137   }
00138 
00139 }//end HandleCommand

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

Implement this for read-write access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 78 of file CalDetSIModule.cxx.

References MomNavigator::AdoptFragment(), fIsMC, AlgFactory::GetAlgHandle(), MomNavigator::GetFragment(), AlgFactory::GetInstance(), CandCalDetSIHandle::GetIsSnarlRecord(), Msg::kDebug, JobCResult::kFailed, Msg::kInfo, JobCResult::kPassed, CandCalDetSI::MakeCandidate(), MSG, CandRecord::SecureCandHandle(), and CandContext::SetDataIn().

00079 {
00080 
00081   MSG("CalDetSIModule",Msg::kDebug)<<"Beginning Reco"<<endl;
00082   //get a data fragment
00083   RawRecord *rr = dynamic_cast<RawRecord *> (mom->GetFragment("RawRecord"));
00084 
00085   AlgFactory &af = AlgFactory::GetInstance();
00086   AlgHandle ah = af.GetAlgHandle("AlgCalDetSI", "default");
00087 
00088   //create a CandContext
00089   CandContext cx(this, mom);
00090   cx.SetDataIn(rr);
00091 
00092   //make the candcaldetsi
00093   MSG("CalDetSIModule",Msg::kDebug)<<"About to make candidate"<<endl;
00094   CandCalDetSIHandle csih = CandCalDetSI::MakeCandidate(ah, cx); 
00095   if(!csih.GetIsSnarlRecord()&&!fIsMC){
00096     MSG("CalDetSIModule",Msg::kDebug)<<"csih is not a snarl record or MC"<<endl;
00097     return JobCResult(JobCResult::kFailed);
00098   }
00099 
00100   //give the CandCalDetSIHandle to the candrecord
00101   if(!fIsMC){
00102     CandRecord *candrec = dynamic_cast<CandRecord *>
00103       (mom->GetFragment("CandRecord", "PrimaryCandidateRecord"));
00104     if (candrec == 0) {
00105       MSG("CalDetSIModule", Msg::kInfo) 
00106         << "No PrimaryCandidateRecord in MOM."<< endl;
00107       return JobCResult(JobCResult::kFailed);
00108     }
00109 
00110     candrec->SecureCandHandle(csih);
00111   }
00112 
00113   //older version, gave candcaldetsihandle to mom, also works with MC files
00114   else{
00115     CandCalDetSIHandle *onheap = new CandCalDetSIHandle(csih); //copy handle
00116     mom->AdoptFragment(onheap);  //give new candidate caldetsi to mom
00117   }
00118   
00119   return JobCResult(JobCResult::kPassed);  
00120 
00121 }//end Reco


Member Data Documentation

Bool_t CalDetSIModule::fIsMC [private]

Definition at line 19 of file CalDetSIModule.h.

Referenced by HandleCommand(), and Reco().


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

Generated on 22 Nov 2017 for loon by  doxygen 1.6.1