AnalysisModule Class Reference

#include <AnalysisModule.h>

Inheritance diagram for AnalysisModule:
JobCModule

List of all members.

Public Member Functions

 AnalysisModule ()
virtual ~AnalysisModule ()
void BeginJob ()
JobCResult Ana (const MomNavigator *mom)
const RegistryDefaultConfig () const
void Config (const Registry &r)
void Help ()
void EndJob ()

Private Attributes

std::string fFileName
std::string fTreeName
std::string fDataPath
TChain * fChain
ANtpEventInfofEventInfo
ANtpHeaderInfofHeaderInfo
ANtpShowerInfofShowerInfo
ANtpTrackInfofTrackInfo
ANtpTruthInfofTruthInfo

Detailed Description

Definition at line 39 of file AnalysisModule.h.


Constructor & Destructor Documentation

AnalysisModule::AnalysisModule (  ) 

Definition at line 41 of file AnalysisModule.cxx.

00041                                :
00042     fFileName("beamTestResults.root"),
00043     fTreeName("ANtp"),
00044     fDataPath("data/*.root")
00045 {
00046     MSG("JobC", Msg::kDebug) << "AnalysisModule::Constructor" << endl;
00047         
00048     //make histograms for raw distributions
00049 
00050         
00051     //histograms for cut distributions
00052         
00053     //the info objects
00054     fHeaderInfo = new ANtpHeaderInfo();
00055     fEventInfo = new ANtpEventInfo();
00056     fShowerInfo = new ANtpShowerInfo();
00057     fTrackInfo = new ANtpTrackInfo();
00058     
00059 }

AnalysisModule::~AnalysisModule (  )  [virtual]

Definition at line 62 of file AnalysisModule.cxx.

00063 {
00064 
00065   MSG("JobC", Msg::kDebug) << "AnalysisModule::Destructor" << endl;
00066 
00067 }


Member Function Documentation

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

Implement this for read only access to the MomNavigator

Reimplemented from JobCModule.

Definition at line 81 of file AnalysisModule.cxx.

00082 {
00083     MSG("AnalysisModule", Msg::kDebug) << "start ana" << endl;
00084     
00085     JobCResult result(JobCResult::kPassed);
00086     
00087     //get the records from MOM
00088     assert(mom);
00089         
00090     return result;
00091 }

void AnalysisModule::BeginJob ( void   )  [virtual]

Implement for notification of begin of job

Reimplemented from JobCModule.

Definition at line 70 of file AnalysisModule.cxx.

00071 {
00072     MSG("AnalysisModule", Msg::kDebug) << "start BeginJob" << endl;
00073 
00074     
00075     return;
00076 }

void AnalysisModule::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 153 of file AnalysisModule.cxx.

00154 {
00155     int         tmpb;  // a temp bool. See comment under DefaultConfig...
00156     int         tmpi;  // a temp int.
00157     double      tmpd;  // a temp double.
00158     const char* tmps;  // a temp string
00159 
00160     if (r.Get("FileName",               tmps)) fFileName               = tmps;
00161     if (r.Get("TreeName",               tmps)) fTreeName               = tmps;
00162     if (r.Get("DataPath",               tmps)) fDataPath               = tmps;
00163 
00164     tmpb = 0;
00165     tmpi = 0;
00166     tmpd = 0.;
00167 
00168     return;
00169 }

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

00132 {
00133     
00134     int itrue = 1;  // work around for lack of bool in registry
00135     int ifalse = 0; // work around for lack of bool in registry
00136     
00137     static Registry r;
00138     
00139     r.UnLockValues();
00140     
00141     r.Set("FileName",               "analysisResults.root");
00142     r.Set("TreeName",               "ANtp");
00143     r.Set("DataPath",               "data/*.root");
00144     
00145     r.LockValues();
00146 
00147     itrue = ifalse;
00148 
00149     return r;
00150 }

void AnalysisModule::EndJob (  )  [virtual]

Implement for notification of end of job

Reimplemented from JobCModule.

Definition at line 103 of file AnalysisModule.cxx.

00104 {
00105 
00106     MSG("AnalysisModule", Msg::kInfo) << "start end job method" << endl;        
00107     
00108     //create a chain for the analysis ntuples with name in fTreeName
00109     fChain = new TChain(fTreeName.c_str());
00110     
00111     MSG("AnalysisModule", Msg::kInfo) << "path = " << fDataPath << endl;
00112     
00113     //add the files to the chain
00114     fChain->Add(fDataPath.c_str());
00115     
00116     //attach the info objects to the chains
00117     fChain->SetBranchAddress("header.", &fHeaderInfo);
00118     fChain->SetBranchAddress("event.", &fEventInfo);
00119     fChain->SetBranchAddress("shower.", &fShowerInfo);
00120     fChain->SetBranchAddress("track.", &fTrackInfo);
00121     fChain->SetBranchAddress("truth.", &fTruthInfo);
00122 
00123     //do your analysis here.  probably best to write methods to do individual bits 
00124     //of analysis like declaring and filling histograms, drawing histograms, 
00125     //checking if the event vertex is in the fiducial volume, etc
00126     
00127     return;
00128 }

void AnalysisModule::Help (  )  [virtual]

Implement to spew some useful help to cout

Reimplemented from JobCModule.

Definition at line 94 of file AnalysisModule.cxx.

00095 {
00096   MSG("JobC", Msg::kInfo) 
00097     << "AnalysisModule::Help\n"
00098     <<"AnalysisModule is a module which analyzes beam data."
00099     << endl;
00100 }


Member Data Documentation

TChain* AnalysisModule::fChain [private]

Definition at line 58 of file AnalysisModule.h.

std::string AnalysisModule::fDataPath [private]

Definition at line 57 of file AnalysisModule.h.

Definition at line 60 of file AnalysisModule.h.

std::string AnalysisModule::fFileName [private]

Definition at line 55 of file AnalysisModule.h.

Definition at line 61 of file AnalysisModule.h.

Definition at line 62 of file AnalysisModule.h.

Definition at line 63 of file AnalysisModule.h.

std::string AnalysisModule::fTreeName [private]

Definition at line 56 of file AnalysisModule.h.

Definition at line 64 of file AnalysisModule.h.


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

Generated on 2 Nov 2017 for loon by  doxygen 1.6.1