PandaRoot
PndBurstContainer.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 #ifndef PNDBURSTCONTAINER_HH
14 #define PNDBURSTCONTAINER_HH
15 
16 #include "FairTimeStamp.h"
17 #include "FairMQLogger.h"
18 
19 #include <vector>
20 
22  public:
23  PndBurstContainer() : fThreshold(2E3), fOffset(2E3), fCurrentThreshold(fThreshold), fCurrentOffset(fOffset + fThreshold) { fContainer.resize(3); }
24 
25  std::vector<std::vector<FairTimeStamp *>> ProcessData(std::vector<FairTimeStamp *> data);
26  std::vector<std::vector<FairTimeStamp *>> GetLastData() { return fContainer; }
27 
28  virtual void SetThreshold(double val) { fThreshold = val; }
29  virtual void SetOffset(double val) { fOffset = val; }
30 
31  virtual double GetThreshold() { return fThreshold; }
32  virtual double GetOffset() { return fOffset; }
33 
34  protected:
35  bool IsAboveOffset(FairTimeStamp *val) { return val->GetTimeStamp() > fCurrentOffset; }
36  int CalcContainerPos(FairTimeStamp *val)
37  {
38  int result;
39  double resultD = ((val->GetTimeStamp() - fCurrentThreshold) / fThreshold);
40  result = resultD;
41  if (resultD > 0)
42  result++;
43  return result;
44  }
45 
46  private:
47  std::vector<std::vector<FairTimeStamp *>> fContainer;
48  double fThreshold;
49  double fCurrentThreshold;
50  double fOffset;
51  double fCurrentOffset;
52 };
53 
54 #endif
virtual double GetOffset()
std::vector< std::vector< FairTimeStamp * > > ProcessData(std::vector< FairTimeStamp *> data)
virtual void SetThreshold(double val)
bool IsAboveOffset(FairTimeStamp *val)
virtual void SetOffset(double val)
virtual double GetThreshold()
int CalcContainerPos(FairTimeStamp *val)
std::vector< std::vector< FairTimeStamp * > > GetLastData()