FillHistBase Class Reference

#include <FillHistBase.h>

Inheritance diagram for FillHistBase:
ExportPulse MakeAnalysedPulses MakeDetectorPulses MakeMuonEvents MakeTemplate MyModule PlotAmplitude PlotAmpVsTDiff PlotTime PulseViewer SimpleHistograms

Public Member Functions

 FillHistBase (const char *module_name, modules::options *opts=NULL, TSetupData *setup=NULL)
 Constructor of a module class. Provides several virtual methods that should be overloaded in the derived class. Derived classes should hard-code their name as the first argument to the constructor.
virtual ~FillHistBase ()
int ProcessGenericEntry (TGlobalData *gData, TSetupData *gSetup)
virtual int BeforeFirstEntry (TGlobalData *gData, TSetupData *setup)
virtual int AfterLastEntry (TGlobalData *gData, TSetupData *setup)
void SetAlias (const std::string &alias)
std::string GetAlias () const
const char * GetName () const
 Get the name of this module as given to the constructor of the base class.

Protected Member Functions

bool Debug () const

Protected Attributes

TDirectory * dir
TSetupDatafSetup

Private Member Functions

virtual int ProcessEntry (TGlobalData *gData, TSetupData *gSetup)
 The big kahuna. Overload this in the derived class and it will be called for each event.

Private Attributes

bool fDebug
std::string fAlias

Detailed Description

Base class for a generic analysis module. Provides several virtual methods for the derived class to overload. Also sets up a directory where all histograms and other ROOT objects created by the module will be saved in the output root file.

Definition at line 17 of file FillHistBase.h.


Constructor & Destructor Documentation

FillHistBase::FillHistBase ( const char *  module_name,
modules::options opts = NULL,
TSetupData setup = NULL 
)

Constructor of a module class. Provides several virtual methods that should be overloaded in the derived class. Derived classes should hard-code their name as the first argument to the constructor.

Parameters:
module_name The name of the module
opts Options given to the module from the modules file
setup [To be removed soon]

Definition at line 5 of file FillHistBase.cpp.

References dir, fDebug, modules::options::GetBool(), modules::options::GetOption(), and modules::options::HasOption().

00005                                                                                                    :
00006         fSetup(setup),fDebug(false){
00007   if(opts){
00008     fDebug=(opts->HasOption("debug") && (opts->GetOption("debug").empty() || opts->GetBool("debug")));
00009     //std::cout<<"Should we debug module: "<<HistogramDirectoryName<<": "<<(fDebug?"yes":"no")<<std::endl;
00010   }
00011   dir = gDirectory->mkdir(HistogramDirectoryName);
00012   dir->cd();
00013 }

FillHistBase::~FillHistBase (  )  [virtual]

Definition at line 15 of file FillHistBase.cpp.

00016 {
00017 }


Member Function Documentation

virtual int FillHistBase::AfterLastEntry ( TGlobalData gData,
TSetupData setup 
) [inline, virtual]

Optional method which is called once after the main event loop Can be used to dump a summary or finalise a histogram

Returns:
0 on sucess and non-zero if a problem occurred

Reimplemented in PulseViewer.

Definition at line 44 of file FillHistBase.h.

00044 {return 0;};

virtual int FillHistBase::BeforeFirstEntry ( TGlobalData gData,
TSetupData setup 
) [inline, virtual]

Optional method which is called once before the main event loop Can be used to parse options and setup histograms.

Returns:
0 on sucess and non-zero if a problem occurred

Reimplemented in ExportPulse, PulseViewer, MakeAnalysedPulses, MakeDetectorPulses, and MakeMuonEvents.

Definition at line 39 of file FillHistBase.h.

00039 {return 0;};

bool FillHistBase::Debug (  )  const [inline, protected]

Check whether this module was asked to print extra debug information

Returns:
true if 'debug' was given in the modules file, false if not

Definition at line 60 of file FillHistBase.h.

References fDebug.

Referenced by MakeAnalysedPulses::AddGenerator(), ExportPulse::AddToExportList(), PulseViewer::AfterLastEntry(), MakeMuonEvents::BeforeFirstEntry(), PulseViewer::ConsiderDrawing(), MakeDetectorPulses::MakeGenerator(), ExportPulse::PlotTPI(), MakeAnalysedPulses::ProcessEntry(), and PulseViewer::ProcessEntry().

00060 {return fDebug;};

std::string FillHistBase::GetAlias (  )  const [inline]

Returns a string for the alias of this module. May be empty if no alias was given in the modules file.

Definition at line 52 of file FillHistBase.h.

References fAlias.

00052 {return fAlias;};

const char* FillHistBase::GetName (  )  const [inline]

Get the name of this module as given to the constructor of the base class.

Definition at line 55 of file FillHistBase.h.

References dir.

Referenced by PlotTime::ProcessEntry(), and PlotAmplitude::ProcessEntry().

00055 {return dir->GetName();};

int FillHistBase::ProcessEntry ( TGlobalData gData,
TSetupData gSetup 
) [private, virtual]

The big kahuna. Overload this in the derived class and it will be called for each event.

Parameters:
gData Pointer to current map of all TPIs [ WILL CHANGE SHORTLY ]
gSetup Pointer to TSetupData for this run [ WILL CHANGE SHORTLY ]
Returns:
0 on success and non-zero on failure

Reimplemented in ExportPulse, PlotAmplitude, PlotAmpVsTDiff, PlotTime, PulseViewer, MakeAnalysedPulses, MakeTemplate, MakeDetectorPulses, and MakeMuonEvents.

Definition at line 19 of file FillHistBase.cpp.

Referenced by ProcessGenericEntry().

00019                                                                     {
00020   // This is a virtual function and should be overwritten by the deriving analysis module!
00021   return 0;
00022 }

int FillHistBase::ProcessGenericEntry ( TGlobalData gData,
TSetupData gSetup 
)

Method called by the main event loop for each entry in the input root tree. Does some simple work, then hooks into the derived class through ProcessEntry.

Returns:
0 on sucess and non-zero if a problem occurred

Definition at line 24 of file FillHistBase.cpp.

References dir, and ProcessEntry().

00024                                                                            {
00025   // This is called by our main routine and would allow later to split into different 
00026   // process routines if we have more than one Tree and hence different tpyes of data input.
00027 
00028   if(dir) dir->cd();
00029   int ret = ProcessEntry(gData, gSetup);
00030   gDirectory->cd("/");
00031 
00032   return ret;
00033 }

void FillHistBase::SetAlias ( const std::string &  alias  )  [inline]

Sets the alias for this module, which should be provided in the modules file

Definition at line 48 of file FillHistBase.h.

References fAlias.

Referenced by modules::factory::createModule().

00048 {fAlias=alias;};


Field Documentation

TDirectory* FillHistBase::dir [protected]
std::string FillHistBase::fAlias [private]

Definition at line 78 of file FillHistBase.h.

Referenced by GetAlias(), and SetAlias().

bool FillHistBase::fDebug [private]

Definition at line 77 of file FillHistBase.h.

Referenced by Debug(), and FillHistBase().

Reimplemented in ExportPulse.

Definition at line 74 of file FillHistBase.h.


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

Generated on 10 Jun 2014 for AlcapDAQ by  doxygen 1.6.1