PandaRoot
PndProcessTask< DataStruct > Class Template Referenceabstract

Task based version of a PndProcessHandler. More...

#include <PndProcessTask.h>

Inheritance diagram for PndProcessTask< DataStruct >:
PndPersistencyTask PndProcessHandler< DataStruct >

Public Member Functions

 PndProcessTask (const std::string &t_detectorName)
 
virtual ~PndProcessTask ()
 
virtual InitStatus Init () final
 Initialise this task. This must be called AFTER SetParContainers(), otherwise we will try to pass the parameters to the PndProcesses, while the parameter were not fetched yet. More...
 
virtual void Exec (Option_t *t_opt=nullptr)
 Prepare Task for processing of PndProcess (e.g. reset data arrays), process the PndProcesses and do cleanup during the PostProcessing. More...
 
virtual void Finish ()
 End the task, call TearDown for all PndProcesses. More...
 
- Public Member Functions inherited from PndPersistencyTask
 PndPersistencyTask ()
 
 PndPersistencyTask (const char *name, Int_t iVerbose=1)
 
virtual ~PndPersistencyTask ()
 
void SetPersistency (Bool_t val=kTRUE)
 
Bool_t GetPersistency ()
 
- Public Member Functions inherited from PndProcessHandler< DataStruct >
 PndProcessHandler (const std::string &t_detectorname="")
 
virtual ~PndProcessHandler ()
 
void AddProcess (PndProcess< DataStruct > *)
 Add a PndProcess of appropriate type to the list of PndProcesses to be managed. More...
 
void CallProcesses ()
 Call for all PndProcesses the PreProcess/Process/PosProcess functions. More...
 
void SetupProcesses ()
 Call for each PndProcess the SetData and SetupParameter. More...
 
const std::vector< PndProcess< DataStruct > * > & GetProcesses ()
 
const DataStruct * GetCopyOfData () const
 
DataStruct * GetPtrToData ()
 
PndParameterRegisterGetParameterRegister ()
 
const PndParameterRegisterGetParameterRegister () const
 
const std::string & GetDetectorName () const
 

Protected Member Functions

void SetParContainers () final
 Fetch the FairRuntimeDb and populate the PndParameterRegister with all requested parameter. Has to be called before Init() More...
 
virtual void PreProcessing (Option_t *)
 Do some task preparation before PndProcesses are run once per event. More...
 
virtual void PostProcessing (Option_t *)
 Do some task post clean up after PndProcesses are run once per event. More...
 
virtual void SetupDataArrays ()=0
 Define which data containers need to be fetched from the FairRootManager, pass the data container addresses into a simple struct to distribute the addresses to the PndProcesses so they can read and write the data to them. Needs to be implemented in the derived PndProcessTask, such as the BSEmcClusteringTask. More...
 
- Protected Member Functions inherited from PndProcessHandler< DataStruct >
virtual void SetupProcess (PndProcess< DataStruct > *t_process)
 

Additional Inherited Members

- Protected Attributes inherited from PndProcessHandler< DataStruct >
std::vector< PndProcess< DataStruct > * > fProcesses {}
 
std::unique_ptr< DataStruct > fData {new DataStruct}
 
std::unique_ptr< PndParameterRegisterfParameterRegister {new PndParameterRegister}
 
std::string fDetectorName {""}
 

Detailed Description

template<class DataStruct>
class PndProcessTask< DataStruct >

Task based version of a PndProcessHandler.

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
Template Parameters
DataStruct

Definition at line 28 of file PndProcessTask.h.

Constructor & Destructor Documentation

◆ PndProcessTask()

template<class DataStruct >
PndProcessTask< DataStruct >::PndProcessTask ( const std::string &  t_detectorName)

Definition at line 83 of file PndProcessTask.h.

84 {
85 }
Base class for classes handling a set of PndProcesses.

◆ ~PndProcessTask()

template<class DataStruct >
PndProcessTask< DataStruct >::~PndProcessTask ( )
virtual

Definition at line 88 of file PndProcessTask.h.

89 {
90 }

Member Function Documentation

◆ Exec()

template<class DataStruct >
void PndProcessTask< DataStruct >::Exec ( Option_t *  t_opt = nullptr)
virtual

Prepare Task for processing of PndProcess (e.g. reset data arrays), process the PndProcesses and do cleanup during the PostProcessing.

Definition at line 106 of file PndProcessTask.h.

107 {
108  PreProcessing(t_option);
109  this->CallProcesses();
110  PostProcessing(t_option);
111 }
void CallProcesses()
Call for all PndProcesses the PreProcess/Process/PosProcess functions.
virtual void PostProcessing(Option_t *)
Do some task post clean up after PndProcesses are run once per event.
virtual void PreProcessing(Option_t *)
Do some task preparation before PndProcesses are run once per event.

◆ Finish()

template<class DataStruct >
void PndProcessTask< DataStruct >::Finish ( )
virtual

End the task, call TearDown for all PndProcesses.

Definition at line 114 of file PndProcessTask.h.

115 {
116  LOG(INFO) << "PndProcessTask: Finish - " << this->fDetectorName;
117  for (PndProcess<DataStruct> *process : this->fProcesses) {
118  process->TearDown();
119  }
120 }
Base Process class.
Definition: PndProcess.h:24
std::string fDetectorName
std::vector< PndProcess< DataStruct > * > fProcesses

◆ Init()

template<class DataStruct >
InitStatus PndProcessTask< DataStruct >::Init ( )
finalvirtual

Initialise this task. This must be called AFTER SetParContainers(), otherwise we will try to pass the parameters to the PndProcesses, while the parameter were not fetched yet.

Returns
InitStatus

Definition at line 93 of file PndProcessTask.h.

94 {
95  InitStatus result = kSUCCESS;
96  try {
98  this->SetupProcesses();
99  } catch (const std::exception &e) {
100  result = kERROR;
101  }
102  return result;
103 }
virtual void SetupDataArrays()=0
Define which data containers need to be fetched from the FairRootManager, pass the data container add...
void SetupProcesses()
Call for each PndProcess the SetData and SetupParameter.

◆ PostProcessing()

template<class DataStruct >
void PndProcessTask< DataStruct >::PostProcessing ( Option_t *  )
protectedvirtual

Do some task post clean up after PndProcesses are run once per event.

Reimplemented in BSEmcClusteringTask, BSEmcPlotTask, BSEmcDigitizerTask, and BSEmcMCHitProducerTask.

Definition at line 129 of file PndProcessTask.h.

Referenced by PndProcessTask< BSEmcPlotData >::Exec().

130 {
131  LOG(trace) << "PndProcessTask: PostProcessing - " << this->fDetectorName;
132 }
std::string fDetectorName

◆ PreProcessing()

template<class DataStruct >
void PndProcessTask< DataStruct >::PreProcessing ( Option_t *  )
protectedvirtual

Do some task preparation before PndProcesses are run once per event.

Reimplemented in BSEmcClusteringTask, BSEmcPlotTask, BSEmcDigitizerTask, and BSEmcMCHitProducerTask.

Definition at line 123 of file PndProcessTask.h.

Referenced by PndProcessTask< BSEmcPlotData >::Exec().

124 {
125  LOG(trace) << "PndProcessTask: PreProcessing - " << this->fDetectorName;
126 }
std::string fDetectorName

◆ SetParContainers()

template<class DataStruct >
void PndProcessTask< DataStruct >::SetParContainers ( )
finalprotected

Fetch the FairRuntimeDb and populate the PndParameterRegister with all requested parameter. Has to be called before Init()

Definition at line 135 of file PndProcessTask.h.

136 {
137  // Get run and runtime database
138  FairRun *run = FairRun::Instance();
139  if (run == nullptr) {
140  Fatal("SetParContainers", "No analysis run");
141  }
142  FairRuntimeDb *db = run->GetRuntimeDb();
143  if (db == nullptr) {
144  Fatal("SetParContainers", "No runtime database");
145  }
146 
147  LOG(DEBUG) << "PndProcessTask - " << this->fDetectorName << " SetParContainers()";
148  for (const std::string &parameterName : this->fParameterRegister->GetRequestList()) {
149  LOG(DEBUG) << parameterName;
150  this->fParameterRegister->SetParameter(parameterName, db->getContainer(parameterName.c_str()));
151  }
152 }
std::unique_ptr< PndParameterRegister > fParameterRegister
std::string fDetectorName

◆ SetupDataArrays()

template<class DataStruct>
virtual void PndProcessTask< DataStruct >::SetupDataArrays ( )
protectedpure virtual

Define which data containers need to be fetched from the FairRootManager, pass the data container addresses into a simple struct to distribute the addresses to the PndProcesses so they can read and write the data to them. Needs to be implemented in the derived PndProcessTask, such as the BSEmcClusteringTask.

Implemented in BSEmcClusteringTask, BSEmcPlotTask, BSEmcDigitizerTask, and BSEmcMCHitProducerTask.

Referenced by PndProcessTask< BSEmcPlotData >::Init().


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