@@ -35,7 +35,7 @@ class Digitizer
3535
3636 public:
3737 Digitizer ()
38- : mTimeStamp (0 ), mIntRecord (), mEventId (-1 ), mSrcId (-1 ), mMCLabels (), mPmtChargeVsTime (), mNBins (), mPmtResponseGlobal (), mPmtResponseTemp ()
38+ : mTimeStamp (0 ), mIntRecord (), mEventId (-1 ), mSrcId (-1 ), mMCLabels (), mCache (), mPmtChargeVsTime (), mNBins (), mNTimeBinsPerBC (), mPmtResponseGlobal (), mPmtResponseTemp ()
3939 {
4040 }
4141
@@ -53,25 +53,61 @@ class Digitizer
5353 void setSrcId (Int_t id) { mSrcId = id; }
5454 void setInteractionRecord (const InteractionTimeRecord& ir) { mIntRecord = ir; }
5555
56- void process (const std::vector<o2::fv0::Hit>& hits);
57- void analyseWaveformsAndStore (std::vector<fv0::BCData>& digitsBC,
58- std::vector<fv0::ChannelData>& digitsCh,
59- dataformats::MCTruthContainer<fv0::MCLabel>& labels);
56+ void process (const std::vector<o2::fv0::Hit>& hits, std::vector<o2::fv0::BCData>& digitsBC,
57+ std::vector<o2::fv0::ChannelData>& digitsCh, o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);
58+
59+ void flush (std::vector<o2::fv0::BCData>& digitsBC,
60+ std::vector<o2::fv0::ChannelData>& digitsCh,
61+ o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);
6062
6163 const InteractionRecord& getInteractionRecord () const { return mIntRecord ; }
6264 InteractionRecord& getInteractionRecord (InteractionRecord& src) { return mIntRecord ; }
6365 uint32_t getOrbit () const { return mIntRecord .orbit ; }
6466 uint16_t getBC () const { return mIntRecord .bc ; }
6567
68+ using ChannelBCDataF = std::vector<float >;
69+
70+ struct BCCache : public o2 ::InteractionRecord {
71+ std::vector<o2::fv0::MCLabel> labels;
72+ std::array<ChannelBCDataF, Constants::nFv0Channels> mPmtChargeVsTime = {};
73+
74+ void clear ()
75+ {
76+ for (auto & channel : mPmtChargeVsTime ) {
77+ std::fill (channel.begin (), channel.end (), 0 .);
78+ }
79+ labels.clear ();
80+ }
81+
82+ BCCache& operator =(const o2::InteractionRecord& ir)
83+ {
84+ o2::InteractionRecord::operator =(ir);
85+ return *this ;
86+ }
87+ void print () const ;
88+ };
89+
6690 private:
91+ static constexpr int BCCacheMin = 0 , BCCacheMax = 7 , NBC2Cache = 1 + BCCacheMax - BCCacheMin;
92+ void createPulse (float mipFraction, int parID, const double hitTime, std::array<o2::InteractionRecord, NBC2Cache> const & cachedIR,
93+ int nCachedIR, const int detID);
94+
6795 long mTimeStamp ; // TF (run) timestamp
68- InteractionRecord mIntRecord ; // Interaction record (orbit, bc) -> InteractionTimeRecord
96+ InteractionTimeRecord mIntRecord ; // Interaction record (orbit, bc) -> InteractionTimeRecord
6997 Int_t mEventId ; // ID of the current event
7098 Int_t mSrcId ; // signal, background or QED
71- std::vector<fv0::MCLabel> mMCLabels ;
99+ std::deque<fv0::MCLabel> mMCLabels ;
100+ std::deque<BCCache> mCache ;
101+
102+ BCCache& setBCCache (const o2::InteractionRecord& ir);
103+ BCCache* getBCCache (const o2::InteractionRecord& ir);
104+
105+ void storeBC (const BCCache& bc, std::vector<o2::fv0::BCData>& digitsBC, std::vector<o2::fv0::ChannelData>& digitsCh,
106+ o2::dataformats::MCTruthContainer<o2::fv0::MCLabel>& labels);
72107
73108 std::array<std::vector<Float_t>, Constants::nFv0Channels> mPmtChargeVsTime ; // Charge time series aka analogue signal pulse from PM
74- UInt_t mNBins ; // Number of bins in pulse series
109+ UInt_t mNBins ; //
110+ UInt_t mNTimeBinsPerBC ;
75111 Float_t mBinSize ; // Time width of the pulse bin - HPTDC resolution
76112
77113 // / vectors to store the PMT signal from cosmic muons
@@ -80,7 +116,9 @@ class Digitizer
80116
81117 // / Internal helper methods related to conversion of energy-deposition into el. signal
82118 Int_t SimulateLightYield (Int_t pmt, Int_t nPhot) const ;
83- Float_t SimulateTimeCfd (Int_t channel) const ;
119+ Float_t SimulateTimeCfd (const ChannelBCDataF& pulse) const ;
120+ Float_t IntegrateCharge (const ChannelBCDataF& pulse) const ;
121+ // Float_t SimulateTimeCfd(Int_t channel, Int_t iCache) const;
84122
85123 // / Functions related to splitting ring-5 cell signal to two readout channels
86124 static float getDistFromCellCenter (UInt_t cellId, double hitx, double hity);
0 commit comments