PandaRoot
PndProcess< DataStruct > Class Template Referenceabstract

Base Process class. More...

#include <PndProcess.h>

Inheritance diagram for PndProcess< DataStruct >:
BSEmcCounter< DataStruct > BSEmcParameterLoadingProcess< DataStruct >

Public Member Functions

 PndProcess ()
 
 PndProcess (const std::string &t_processname)
 
virtual ~PndProcess ()
 
virtual void SetDetectorName (const std::string &t_detectorname)
 Set the Detector name. Important, as most EmcParameter need to know for which detector they need to be fetched (each Emc Subdetector has its own set of parameters) More...
 
const std::vector< std::string > & GetListOfRequiredParameters () const
 Get the List Of Required Parameters. More...
 
virtual void SetData (DataStruct *t_data)=0
 Pass the data container ptrs to the process, and store pointers in class members. More...
 
virtual void SetupParameters (const PndParameterRegister *t_parameter)=0
 Fetch all parameters from the PndParameterRegister. More...
 
virtual void PreProcess ()
 PreProcess() is called before the actual Process() call in each event. More...
 
virtual void Process ()=0
 The actual data transformation (digitizing, clustering, etc.) should be defined here. More...
 
virtual void PostProcess ()
 Immediately after calling Process() PostProcess() is called for cleanup of internal process data, or if not needed, to end the time and memory increase measurement started by PreProcess() More...
 
virtual void TearDown ()
 Last actions at the end of the run. More...
 

Protected Attributes

std::vector< std::string > fParameterList {}
 Parameter names required by this PndProcess. Needs to be populated in derived class. More...
 
std::string fDetectorName {""}
 Set Detector name this PndProcess transforms data for. Required for example by EMC Processes to fetch right parameters. More...
 
std::string fProcessName {"PndProcess"}
 Name of current PndProcess (for debugging) More...
 
TStopwatch fTimer {}
 Timer to monitor Process() time. More...
 
Double_t fTotalTime {0}
 Time taken by this Process' Process() More...
 
ProcInfo_t fProcInfo
 Helper to access cpu process Memory Info. More...
 
Long_t fLastMemSize
 

Detailed Description

template<class DataStruct>
class PndProcess< DataStruct >

Base Process class.

Base class for Processes. Processes are intended to help separate data and parameter handling from the implementation of algorithms

Author
Ben Salisbury salis.nosp@m.bury.nosp@m.@hisk.nosp@m.p.un.nosp@m.i-bon.nosp@m.n.de, HISKP Bonn
Date
2021-02

Definition at line 24 of file PndProcess.h.

Constructor & Destructor Documentation

◆ PndProcess() [1/2]

template<class DataStruct>
PndProcess< DataStruct >::PndProcess ( )
inline

Definition at line 26 of file PndProcess.h.

26 {}

◆ PndProcess() [2/2]

template<class DataStruct>
PndProcess< DataStruct >::PndProcess ( const std::string &  t_processname)
inline

Definition at line 27 of file PndProcess.h.

27 : fProcessName(t_processname) {}
std::string fProcessName
Name of current PndProcess (for debugging)
Definition: PndProcess.h:100

◆ ~PndProcess()

template<class DataStruct>
virtual PndProcess< DataStruct >::~PndProcess ( )
inlinevirtual

Definition at line 28 of file PndProcess.h.

28 {}

Member Function Documentation

◆ GetListOfRequiredParameters()

template<class DataStruct>
const std::vector<std::string>& PndProcess< DataStruct >::GetListOfRequiredParameters ( ) const
inline

Get the List Of Required Parameters.

Returns
const std::vector<std::string>&

Definition at line 42 of file PndProcess.h.

Referenced by PndProcessHandler< BSEmcPlotData >::AddProcess().

42 { return fParameterList; }
std::vector< std::string > fParameterList
Parameter names required by this PndProcess. Needs to be populated in derived class.
Definition: PndProcess.h:98

◆ PostProcess()

template<class DataStruct>
virtual void PndProcess< DataStruct >::PostProcess ( )
inlinevirtual

Immediately after calling Process() PostProcess() is called for cleanup of internal process data, or if not needed, to end the time and memory increase measurement started by PreProcess()

Reimplemented in BSEmcOnlineBumpSplitter, and TestPndProcess.

Definition at line 80 of file PndProcess.h.

81  {
82  fTimer.Stop();
83  fTotalTime += fTimer.RealTime();
84  gSystem->GetProcInfo(&fProcInfo);
85  LOG_IF(DEBUG1, fProcInfo.fMemResident - fLastMemSize != 0) << "PndProcess" << fDetectorName << " Process() Memory increase after Process " << fProcessName << ". Increase by "
86  << fProcInfo.fMemResident - fLastMemSize << " KB. Total memory used is: " << fProcInfo.fMemResident << " KB.";
87 
88  fLastMemSize = fProcInfo.fMemResident;
89  };
std::string fProcessName
Name of current PndProcess (for debugging)
Definition: PndProcess.h:100
ProcInfo_t fProcInfo
Helper to access cpu process Memory Info.
Definition: PndProcess.h:103
TStopwatch fTimer
Timer to monitor Process() time.
Definition: PndProcess.h:101
Double_t fTotalTime
Time taken by this Process&#39; Process()
Definition: PndProcess.h:102
Long_t fLastMemSize
Definition: PndProcess.h:104
std::string fDetectorName
Set Detector name this PndProcess transforms data for. Required for example by EMC Processes to fetch...
Definition: PndProcess.h:99

◆ PreProcess()

template<class DataStruct>
virtual void PndProcess< DataStruct >::PreProcess ( )
inlinevirtual

PreProcess() is called before the actual Process() call in each event.

Intended for preprocess setup calls, e.g. for reseting internal process data, or, if not needed, to monitor processing time and memory increase

Reimplemented in TestPndProcess.

Definition at line 62 of file PndProcess.h.

63  {
64  gSystem->GetProcInfo(&fProcInfo);
65  fLastMemSize = fProcInfo.fMemResident;
66  fTimer.Reset();
67  fTimer.Start();
68  };
ProcInfo_t fProcInfo
Helper to access cpu process Memory Info.
Definition: PndProcess.h:103
TStopwatch fTimer
Timer to monitor Process() time.
Definition: PndProcess.h:101
Long_t fLastMemSize
Definition: PndProcess.h:104

◆ Process()

◆ SetData()

◆ SetDetectorName()

template<class DataStruct>
virtual void PndProcess< DataStruct >::SetDetectorName ( const std::string &  t_detectorname)
inlinevirtual

◆ SetupParameters()

◆ TearDown()

template<class DataStruct>
virtual void PndProcess< DataStruct >::TearDown ( )
inlinevirtual

Last actions at the end of the run.

Reimplemented in TestPndProcess.

Definition at line 95 of file PndProcess.h.

95 { LOG(DEBUG) << fProcessName << " - " << fDetectorName << " took " << fTotalTime << " s processing time."; };
std::string fProcessName
Name of current PndProcess (for debugging)
Definition: PndProcess.h:100
Double_t fTotalTime
Time taken by this Process&#39; Process()
Definition: PndProcess.h:102
std::string fDetectorName
Set Detector name this PndProcess transforms data for. Required for example by EMC Processes to fetch...
Definition: PndProcess.h:99

Member Data Documentation

◆ fDetectorName

template<class DataStruct>
std::string PndProcess< DataStruct >::fDetectorName {""}
protected

Set Detector name this PndProcess transforms data for. Required for example by EMC Processes to fetch right parameters.

Definition at line 99 of file PndProcess.h.

Referenced by PndProcess< BSEmcPlotData >::PostProcess(), PndProcess< BSEmcPlotData >::SetDetectorName(), BSEmcParameterLoadingProcess< DataStruct >::SetDetectorName(), and PndProcess< BSEmcPlotData >::TearDown().

◆ fLastMemSize

template<class DataStruct>
Long_t PndProcess< DataStruct >::fLastMemSize
protected

Value containing the memory footprint of the cpu process before the Process() call of this PndProcess, to be able to flag if during Process() used memory increased

Definition at line 104 of file PndProcess.h.

Referenced by PndProcess< BSEmcPlotData >::PostProcess(), and PndProcess< BSEmcPlotData >::PreProcess().

◆ fParameterList

template<class DataStruct>
std::vector<std::string> PndProcess< DataStruct >::fParameterList {}
protected

Parameter names required by this PndProcess. Needs to be populated in derived class.

Definition at line 98 of file PndProcess.h.

Referenced by PndProcess< BSEmcPlotData >::GetListOfRequiredParameters(), and BSEmcParameterLoadingProcess< DataStruct >::SetDetectorName().

◆ fProcessName

template<class DataStruct>
std::string PndProcess< DataStruct >::fProcessName {"PndProcess"}
protected

Name of current PndProcess (for debugging)

Definition at line 100 of file PndProcess.h.

Referenced by PndProcess< BSEmcPlotData >::PostProcess(), and PndProcess< BSEmcPlotData >::TearDown().

◆ fProcInfo

template<class DataStruct>
ProcInfo_t PndProcess< DataStruct >::fProcInfo
protected

Helper to access cpu process Memory Info.

Definition at line 103 of file PndProcess.h.

Referenced by PndProcess< BSEmcPlotData >::PostProcess(), and PndProcess< BSEmcPlotData >::PreProcess().

◆ fTimer

template<class DataStruct>
TStopwatch PndProcess< DataStruct >::fTimer {}
protected

Timer to monitor Process() time.

Definition at line 101 of file PndProcess.h.

Referenced by PndProcess< BSEmcPlotData >::PostProcess(), and PndProcess< BSEmcPlotData >::PreProcess().

◆ fTotalTime

template<class DataStruct>
Double_t PndProcess< DataStruct >::fTotalTime {0}
protected

Time taken by this Process' Process()

Definition at line 102 of file PndProcess.h.

Referenced by PndProcess< BSEmcPlotData >::PostProcess(), and PndProcess< BSEmcPlotData >::TearDown().


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