Project
Loading...
Searching...
No Matches
Digitizer.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#ifndef ALICEO2_FV0_DIGITIZER_H
13#define ALICEO2_FV0_DIGITIZER_H
14
21#include "FV0Base/Constants.h"
24#include <array>
25#include <vector>
26
27namespace o2
28{
29namespace fv0
30{
32{
33 private:
35
36 public:
38 : mTimeStamp(0), mIntRecord(), mEventId(-1), mSrcId(-1), mMCLabels(), mCache(), mPmtChargeVsTime(), mNBins(), mNTimeBinsPerBC(), mPmtResponseGlobalRing5(), mPmtResponseGlobalRingA1ToA4(), mPmtResponseTemp(), mLastBCCache(), mCfdStartIndex()
39 {
40 }
41
43 ~Digitizer() = default;
44
45 Digitizer(const Digitizer&) = delete;
46 Digitizer& operator=(const Digitizer&) = delete;
47
48 void clear();
49 void init();
50
51 void setTimeStamp(long t) { mTimeStamp = t; }
52 void setEventId(Int_t id) { mEventId = id; }
53 void setSrcId(Int_t id) { mSrcId = id; }
54 void setInteractionRecord(const InteractionTimeRecord& ir) { mIntRecord = ir; }
55 void setDeadChannelMap(o2::fit::DeadChannelMap const* deadChannelMap) { mDeadChannelMap = deadChannelMap; };
56
57 void process(const std::vector<o2::fv0::Hit>& hits, std::vector<o2::fv0::Digit>& digitsBC,
58 std::vector<o2::fv0::ChannelData>& digitsCh, std::vector<o2::fv0::DetTrigInput>& digitsTrig,
60
61 void flush(std::vector<o2::fv0::Digit>& digitsBC,
62 std::vector<o2::fv0::ChannelData>& digitsCh,
63 std::vector<o2::fv0::DetTrigInput>& digitsTrig,
65
66 const InteractionRecord& getInteractionRecord() const { return mIntRecord; }
68 uint32_t getOrbit() const { return mIntRecord.orbit; }
69 uint16_t getBC() const { return mIntRecord.bc; }
70
71 using ChannelDigitF = std::vector<float>;
72
74 std::vector<o2::fv0::MCLabel> labels;
75 std::array<ChannelDigitF, Constants::nFv0Channels> mPmtChargeVsTime = {};
76
77 void clear()
78 {
79 for (auto& channel : mPmtChargeVsTime) {
80 std::fill(std::begin(channel), std::end(channel), 0.);
81 }
82 labels.clear();
83 }
84
90 void print() const;
91 };
92
93 private:
94 static constexpr int BCCacheMin = 0, BCCacheMax = 7, NBC2Cache = 1 + BCCacheMax - BCCacheMin;
103 void createPulse(float mipFraction, int parID, const double hitTime, const float hitR,
104 std::array<o2::InteractionRecord, NBC2Cache> const& cachedIR, int nCachedIR, const int detID);
105
106 long mTimeStamp; // TF (run) timestamp
107 InteractionTimeRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord
108 Int_t mEventId; // ID of the current event
109 Int_t mSrcId; // signal, background or QED
110 std::deque<fv0::MCLabel> mMCLabels;
111 std::deque<BCCache> mCache;
112
113 BCCache& setBCCache(const o2::InteractionRecord& ir);
114 BCCache* getBCCache(const o2::InteractionRecord& ir);
115
116 void storeBC(const BCCache& bc,
117 std::vector<o2::fv0::Digit>& digitsBC,
118 std::vector<o2::fv0::ChannelData>& digitsCh,
119 std::vector<o2::fv0::DetTrigInput>& digitsTrig,
121 bool isRing5(int detID);
122
123 std::array<std::vector<Float_t>, Constants::nFv0Channels> mPmtChargeVsTime; // Charge time series aka analogue signal pulse from PM
124 UInt_t mNBins; //
125 UInt_t mNTimeBinsPerBC;
126 Float_t mBinSize; // Time width of the pulse bin - HPTDC resolution
127
129 std::vector<Double_t> mPmtResponseGlobalRing5;
130 std::vector<Double_t> mPmtResponseGlobalRingA1ToA4;
131 std::vector<Double_t> mPmtResponseTemp;
132
134 BCCache mLastBCCache; // buffer for the last BC
135 std::array<int, Constants::nFv0Channels> mCfdStartIndex; // start indices for the CFD detector
136
137 o2::fit::DeadChannelMap const* mDeadChannelMap = nullptr;
138
140 Int_t SimulateLightYield(Int_t pmt, Int_t nPhot) const;
141 Float_t SimulateTimeCfd(int& startIndex, const ChannelDigitF& pulseLast, const ChannelDigitF& pulse) const;
142 Float_t IntegrateCharge(const ChannelDigitF& pulse) const;
143
145 static float getDistFromCellCenter(UInt_t cellId, double hitx, double hity);
146 static float getSignalFraction(float distanceFromXc, bool isFirstChannel);
147
148 ClassDefNV(Digitizer, 2);
149};
150
151// Function used to split the ring-5 cell signal into two readout channels depending on hit position
152inline float sigmoidPmtRing5(float x)
153{
154 return -0.668453 / (1.0 + TMath::Exp(TMath::Abs(x) / 3.64327)) + 0.834284;
155};
156
157} // namespace fv0
158} // namespace o2
159
160#endif
std::vector< std::string > labels
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
Dead channel map for FIT.
General constants in FV0.
Container class to store time and charge values of single FV0 channel.
Definition of the FV0 detector class.
uint64_t bc
Definition RawEventData.h:5
Definition of a container to keep Monte Carlo truth external to simulation objects.
A container to hold and manage MC truth information/labels.
~Digitizer()=default
Destructor.
Digitizer & operator=(const Digitizer &)=delete
void flush(std::vector< o2::fv0::Digit > &digitsBC, std::vector< o2::fv0::ChannelData > &digitsCh, std::vector< o2::fv0::DetTrigInput > &digitsTrig, o2::dataformats::MCTruthContainer< o2::fv0::MCLabel > &labels)
uint32_t getOrbit() const
Definition Digitizer.h:68
uint16_t getBC() const
Definition Digitizer.h:69
void setTimeStamp(long t)
Definition Digitizer.h:51
void setInteractionRecord(const InteractionTimeRecord &ir)
Definition Digitizer.h:54
void setEventId(Int_t id)
Definition Digitizer.h:52
void setSrcId(Int_t id)
Definition Digitizer.h:53
const InteractionRecord & getInteractionRecord() const
Definition Digitizer.h:66
void setDeadChannelMap(o2::fit::DeadChannelMap const *deadChannelMap)
Definition Digitizer.h:55
Digitizer(const Digitizer &)=delete
std::vector< float > ChannelDigitF
Definition Digitizer.h:71
InteractionRecord & getInteractionRecord(InteractionRecord &src)
Definition Digitizer.h:67
GLint GLenum GLint x
Definition glcorearb.h:403
GLenum src
Definition glcorearb.h:1767
GLuint id
Definition glcorearb.h:650
float sigmoidPmtRing5(float x)
Definition Digitizer.h:152
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
uint32_t orbit
LHC orbit.
uint16_t bc
bunch crossing ID of interaction
InteractionRecord & operator=(const InteractionRecord &src)=default
static constexpr int nFv0Channels
Definition Constants.h:32
std::vector< o2::fv0::MCLabel > labels
Definition Digitizer.h:74
BCCache & operator=(const o2::InteractionRecord &ir)
Definition Digitizer.h:85
std::array< ChannelDigitF, Constants::nFv0Channels > mPmtChargeVsTime
Definition Digitizer.h:75
o2::InteractionRecord ir(0, 0)