Project
Loading...
Searching...
No Matches
DigitsWriteoutBufferTRU.h
Go to the documentation of this file.
1// Copyright 2019-2020 CERN and copyright holders of ALICE O2.
2// See https://alice-o2.web.cern.ch/copyright for details of the copyright holders.
3// All rights not expressly granted are reserved.
4//
5// This software is distributed under the terms of the GNU General Public
6// License v3 (GPL Version 3), copied verbatim in the file "COPYING".
7//
8// In applying this license CERN does not waive the privileges and immunities
9// granted to it by virtue of its status as an Intergovernmental Organization
10// or submit itself to any jurisdiction.
11
12//_____________________________________________
13// GENERAL IDEA
14//
15// - Focus on https://github.com/AliceO2Group/AliceO2/blob/dev/Detectors/TPC/simulation/include/TPCSimulation/DigitContainer.h
16// - Comform it to the classes used by EMCAL in https://github.com/AliceO2Group/AliceO2/blob/dev/Detectors/EMCAL/simulation/include/EMCALSimulation/DigitsWriteoutBuffer.h
17// and in https://github.com/AliceO2Group/AliceO2/blob/dev/Detectors/EMCAL/simulation/include/EMCALSimulation/DigitsVectorStream.h
18// - The two concepts are similar
19// - EMCAL's was however adapted to triggered mode
20// - The principle is to reapply the old TPC format to the continuous readout directly
21//
22// 1) the idea of dumping the time bins in 15 bins is dumped
23// 2) the data are pushed to the output stream whenever possible
24// 3) the EndOfRun is implemented to break the push to stream
25// it is a flag set to 1 which is read by the filloutputcontainer
26// 4) no more check of start or end of trigger
27// 5) what about the precollision flags?
28// 6) is there any longer a need to set the time of the sampled digits time?
29
30#ifndef ALICEO2_EMCAL_DIGITSWRITEOUTBUFFERTRU_H_
31#define ALICEO2_EMCAL_DIGITSWRITEOUTBUFFERTRU_H_
32
33#include <memory>
34#include <unordered_map>
35#include <vector>
36#include <deque>
37#include <list>
38#include <gsl/span>
43
44// using namespace o2::emcal;
45
46namespace o2
47{
48namespace emcal
49{
50
58
60{
61 public:
63 DigitsWriteoutBufferTRU(unsigned int nTimeBins = 15);
64
67
69 void clear();
70
72 void flush()
73 {
74 // mDigitStream.clear();
75 }
76
77 void init();
78
81 void reserve(int eventTimeBin);
82
84 void finish();
85
89 void addDigits(unsigned int towerID, std::vector<o2::emcal::Digit>& digList);
90
94 void fillOutputContainer(bool isEndOfTimeFrame, InteractionRecord& nextInteractionRecord, std::vector<TRUElectronics>& patchesFromAllTRUs, LZEROElectronics& LZERO);
95
97 void setLiveTime(unsigned int liveTime) { mLiveTime = liveTime; }
98 void setBusyTime(unsigned int busyTime) { mBusyTime = busyTime; }
99
100 const std::deque<o2::emcal::DigitTimebinTRU>& getTimeBins() const { return mTimeBins; }
101
102 private:
103 unsigned int mBufferSize = 15;
104 unsigned int mLiveTime = 1500;
105 unsigned int mBusyTime = 35000;
106 // unsigned int mPreTriggerTime = 600; ///< EMCal pre-trigger time (ns)
107 unsigned long mTriggerTime = 0;
108 unsigned long mLastEventTime = 0;
109 unsigned int mPhase = 0;
110 bool mFirstEvent = true;
111 std::deque<o2::emcal::DigitTimebinTRU> mTimeBins;
112 unsigned int mFirstTimeBin = 0;
113 bool mEndOfRun = 0;
114 bool mNoPileupMode = false;
115 o2::InteractionRecord mCurrentInteractionRecord;
116
117 ClassDefNV(DigitsWriteoutBufferTRU, 5);
118 // ClassDefNV are for objects which do not inherit from tobject
119 // you do not need classIMP instead
120};
121
122} // namespace emcal
123
124} // namespace o2
125
126#endif /* ALICEO2_EMCAL_DIGITSWRITEOUTBUFFERTRU_H_ */
EMCAL DigitTimebin for the DigitsWriteoutBuffer and DigitsWriteoutBufferTRU.
Container class for time sampled digits to be sent to TRUs in true continuous readout.
void setBusyTime(unsigned int busyTime)
~DigitsWriteoutBufferTRU()=default
Destructor.
void addDigits(unsigned int towerID, std::vector< o2::emcal::Digit > &digList)
void setLiveTime(unsigned int liveTime)
Setters for the live time, busy time, pre-trigger time.
const std::deque< o2::emcal::DigitTimebinTRU > & getTimeBins() const
void flush()
clear DigitsVectorStream
void finish()
This is for the readout window that was interrupted by the end of the run.
void fillOutputContainer(bool isEndOfTimeFrame, InteractionRecord &nextInteractionRecord, std::vector< TRUElectronics > &patchesFromAllTRUs, LZEROElectronics &LZERO)
Container class for Digits, MC lebels, and trigger records.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...