PandaRoot
PndWriteoutBuffer Class Referenceabstract

A container class to store digi data during events. More...

#include <PndWriteoutBuffer.h>

Inheritance diagram for PndWriteoutBuffer:

Public Member Functions

 PndWriteoutBuffer ()
 
 PndWriteoutBuffer (TString branchName, TString className, TString folderName, Bool_t persistance)
 
virtual ~PndWriteoutBuffer ()
 
virtual void WriteOutData (double time)
 
virtual void WriteOutAllData ()
 
virtual void SaveDataToTree (Bool_t val=kTRUE)
 If SaveDataToTree is set the data is stored at the end of the buffering into the given TClonesArray. More...
 
virtual void ActivateBuffering (Bool_t val=kTRUE)
 fActivateBuffering has to be set to kTRUE to use the buffering. Otherwise the data is directly stored in the given TClonesArray. More...
 
virtual std::vector< FairTimeStamp * > GetRemoveOldData (double time)
 
virtual std::vector< FairTimeStamp * > GetAllData ()
 
virtual void FillNewData (FairTimeStamp *data, double activeTime)
 
virtual Int_t GetNData ()
 
virtual void AddNewDataToTClonesArray (FairTimeStamp *data)=0
 store the data from the FairTimeStamp pointer in a TClonesArray (you have to cast it to your type of data) More...
 
virtual void DeleteOldData ()
 
virtual double FindTimeForData (FairTimeStamp *data)=0
 if the same data object (like a pad or a pixel) is already present in the buffer, the time of this object has to be returned otherwise -1 More...
 
virtual void FillDataMap (FairTimeStamp *data, double activeTime)=0
 add a new element in the search buffer More...
 
virtual void EraseDataFromDataMap (FairTimeStamp *data)=0
 delete the element from the search buffer (see PndSdsDigiPixelWriteoutBuffer) More...
 
virtual void SetVerbose (Int_t val)
 

Protected Member Functions

virtual std::vector< std::pair< double, FairTimeStamp * > > Modify (std::pair< double, FairTimeStamp *> oldData, std::pair< double, FairTimeStamp *> newData)
 
 ClassDef (PndWriteoutBuffer, 1)
 

Protected Attributes

std::multimap< double, FairTimeStamp * > fDeadTime_map
 
TString fBranchName
 
TString fClassName
 
Bool_t fTreeSave
 
Bool_t fActivateBuffering
 
Int_t fVerbose
 

Detailed Description

A container class to store digi data during events.

Author
Tobias Stockmanns The PndWriteoutBuffer class provides a container which handles the storage of data between events. The data has to be given with an active time, the absolute time the data is active in the detector and can influence the output of the data. FillNewData is used to put new data into the container. WriteOutData with a given actual time stores the data which has an active time older than the given time in the corresponding TClonesArray of the FairRootManager. At the end of the task WriteOutAllData has to be called to store the data which is still in the buffer. If one adds data via FillNewData into the buffer which is already present in the buffer, Modify is called. The standard behavior of Modify is that the new data is ignored to simulate pile-up. If a different behavior is wanted one has to overwrite Modify in a derived class.

The data which should be stored in the buffer has to be derived from FairTimeStamp. It needs an operator< and a method equal if the same detector element is hit.

To use this buffer one has to derive his own buffer class from FairWriteoutBuffer and overwrite the pure virtual functions.

Definition at line 33 of file PndWriteoutBuffer.h.

Constructor & Destructor Documentation

◆ PndWriteoutBuffer() [1/2]

PndWriteoutBuffer::PndWriteoutBuffer ( )
inline

Definition at line 35 of file PndWriteoutBuffer.h.

◆ PndWriteoutBuffer() [2/2]

PndWriteoutBuffer::PndWriteoutBuffer ( TString  branchName,
TString  className,
TString  folderName,
Bool_t  persistance 
)

◆ ~PndWriteoutBuffer()

virtual PndWriteoutBuffer::~PndWriteoutBuffer ( )
inlinevirtual

Definition at line 37 of file PndWriteoutBuffer.h.

References WriteOutAllData(), and WriteOutData().

37 {};

Member Function Documentation

◆ ActivateBuffering()

virtual void PndWriteoutBuffer::ActivateBuffering ( Bool_t  val = kTRUE)
inlinevirtual

fActivateBuffering has to be set to kTRUE to use the buffering. Otherwise the data is directly stored in the given TClonesArray.

Definition at line 43 of file PndWriteoutBuffer.h.

References fActivateBuffering, FillNewData(), GetAllData(), and GetRemoveOldData().

◆ AddNewDataToTClonesArray()

virtual void PndWriteoutBuffer::AddNewDataToTClonesArray ( FairTimeStamp *  data)
pure virtual

store the data from the FairTimeStamp pointer in a TClonesArray (you have to cast it to your type of data)

Referenced by GetNData().

◆ ClassDef()

PndWriteoutBuffer::ClassDef ( PndWriteoutBuffer  ,
 
)
protected

◆ DeleteOldData()

virtual void PndWriteoutBuffer::DeleteOldData ( )
inlinevirtual

Definition at line 54 of file PndWriteoutBuffer.h.

References EraseDataFromDataMap(), fBranchName, FillDataMap(), and FindTimeForData().

55  {
56  TClonesArray *myArray = FairRootManager::Instance()->GetTClonesArray(fBranchName);
57  myArray->Delete();
58  }

◆ EraseDataFromDataMap()

virtual void PndWriteoutBuffer::EraseDataFromDataMap ( FairTimeStamp *  data)
pure virtual

delete the element from the search buffer (see PndSdsDigiPixelWriteoutBuffer)

Referenced by DeleteOldData().

◆ FillDataMap()

virtual void PndWriteoutBuffer::FillDataMap ( FairTimeStamp *  data,
double  activeTime 
)
pure virtual

add a new element in the search buffer

Referenced by DeleteOldData().

◆ FillNewData()

virtual void PndWriteoutBuffer::FillNewData ( FairTimeStamp *  data,
double  activeTime 
)
virtual

Referenced by ActivateBuffering().

◆ FindTimeForData()

virtual double PndWriteoutBuffer::FindTimeForData ( FairTimeStamp *  data)
pure virtual

if the same data object (like a pad or a pixel) is already present in the buffer, the time of this object has to be returned otherwise -1

Referenced by DeleteOldData().

◆ GetAllData()

virtual std::vector<FairTimeStamp *> PndWriteoutBuffer::GetAllData ( )
virtual

Referenced by ActivateBuffering().

◆ GetNData()

virtual Int_t PndWriteoutBuffer::GetNData ( )
inlinevirtual

Definition at line 51 of file PndWriteoutBuffer.h.

References AddNewDataToTClonesArray(), and fDeadTime_map.

51 { return fDeadTime_map.size(); }
std::multimap< double, FairTimeStamp * > fDeadTime_map

◆ GetRemoveOldData()

virtual std::vector<FairTimeStamp *> PndWriteoutBuffer::GetRemoveOldData ( double  time)
virtual

Referenced by ActivateBuffering().

◆ Modify()

virtual std::vector<std::pair<double, FairTimeStamp *> > PndWriteoutBuffer::Modify ( std::pair< double, FairTimeStamp *>  oldData,
std::pair< double, FairTimeStamp *>  newData 
)
inlineprotectedvirtual

Modify defines the behavior of the buffer if data should be stored which is already in the buffer. Parameters are the old data with the active time, the new data with an active time. Modify returns than a vector with the new data which should be stored.

Definition at line 70 of file PndWriteoutBuffer.h.

71  {
72  std::vector<std::pair<double, FairTimeStamp *>> result;
73  result.push_back(oldData);
74  return result;
75  }

◆ SaveDataToTree()

virtual void PndWriteoutBuffer::SaveDataToTree ( Bool_t  val = kTRUE)
inlinevirtual

If SaveDataToTree is set the data is stored at the end of the buffering into the given TClonesArray.

Definition at line 42 of file PndWriteoutBuffer.h.

References fTreeSave.

◆ SetVerbose()

virtual void PndWriteoutBuffer::SetVerbose ( Int_t  val)
inlinevirtual

Definition at line 65 of file PndWriteoutBuffer.h.

References fVerbose.

65 { fVerbose = val; }

◆ WriteOutAllData()

virtual void PndWriteoutBuffer::WriteOutAllData ( )
virtual

Referenced by ~PndWriteoutBuffer().

◆ WriteOutData()

virtual void PndWriteoutBuffer::WriteOutData ( double  time)
virtual

Referenced by ~PndWriteoutBuffer().

Member Data Documentation

◆ fActivateBuffering

Bool_t PndWriteoutBuffer::fActivateBuffering
protected

Definition at line 82 of file PndWriteoutBuffer.h.

Referenced by ActivateBuffering().

◆ fBranchName

TString PndWriteoutBuffer::fBranchName
protected

Definition at line 79 of file PndWriteoutBuffer.h.

Referenced by DeleteOldData().

◆ fClassName

TString PndWriteoutBuffer::fClassName
protected

Definition at line 80 of file PndWriteoutBuffer.h.

◆ fDeadTime_map

std::multimap<double, FairTimeStamp *> PndWriteoutBuffer::fDeadTime_map
protected

Definition at line 77 of file PndWriteoutBuffer.h.

Referenced by GetNData().

◆ fTreeSave

Bool_t PndWriteoutBuffer::fTreeSave
protected

Definition at line 81 of file PndWriteoutBuffer.h.

Referenced by SaveDataToTree().

◆ fVerbose

Int_t PndWriteoutBuffer::fVerbose
protected

Definition at line 83 of file PndWriteoutBuffer.h.

Referenced by SetVerbose().


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