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
20#include "FV0Base/Constants.h"
23#include <array>
24#include <vector>
25
26namespace o2
27{
28namespace fv0
29{
31{
32 private:
34
35 public:
37 : mTimeStamp(0), mIntRecord(), mEventId(-1), mSrcId(-1), mMCLabels(), mCache(), mPmtChargeVsTime(), mNBins(), mNTimeBinsPerBC(), mPmtResponseGlobalRing5(), mPmtResponseGlobalRingA1ToA4(), mPmtResponseTemp(), mLastBCCache(), mCfdStartIndex()
38 {
39 }
40
42 ~Digitizer() = default;
43
44 Digitizer(const Digitizer&) = delete;
45 Digitizer& operator=(const Digitizer&) = delete;
46
47 void clear();
48 void init();
49
50 void setTimeStamp(long t) { mTimeStamp = t; }
51 void setEventId(Int_t id) { mEventId = id; }
52 void setSrcId(Int_t id) { mSrcId = id; }
53 void setInteractionRecord(const InteractionTimeRecord& ir) { mIntRecord = ir; }
54
55 void process(const std::vector<o2::fv0::Hit>& hits, std::vector<o2::fv0::Digit>& digitsBC,
56 std::vector<o2::fv0::ChannelData>& digitsCh, std::vector<o2::fv0::DetTrigInput>& digitsTrig,
58
59 void flush(std::vector<o2::fv0::Digit>& digitsBC,
60 std::vector<o2::fv0::ChannelData>& digitsCh,
61 std::vector<o2::fv0::DetTrigInput>& digitsTrig,
63
64 const InteractionRecord& getInteractionRecord() const { return mIntRecord; }
66 uint32_t getOrbit() const { return mIntRecord.orbit; }
67 uint16_t getBC() const { return mIntRecord.bc; }
68
69 using ChannelDigitF = std::vector<float>;
70
72 std::vector<o2::fv0::MCLabel> labels;
73 std::array<ChannelDigitF, Constants::nFv0Channels> mPmtChargeVsTime = {};
74
75 void clear()
76 {
77 for (auto& channel : mPmtChargeVsTime) {
78 std::fill(std::begin(channel), std::end(channel), 0.);
79 }
80 labels.clear();
81 }
82
88 void print() const;
89 };
90
91 private:
92 static constexpr int BCCacheMin = 0, BCCacheMax = 7, NBC2Cache = 1 + BCCacheMax - BCCacheMin;
101 void createPulse(float mipFraction, int parID, const double hitTime, const float hitR,
102 std::array<o2::InteractionRecord, NBC2Cache> const& cachedIR, int nCachedIR, const int detID);
103
104 long mTimeStamp; // TF (run) timestamp
105 InteractionTimeRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord
106 Int_t mEventId; // ID of the current event
107 Int_t mSrcId; // signal, background or QED
108 std::deque<fv0::MCLabel> mMCLabels;
109 std::deque<BCCache> mCache;
110
111 BCCache& setBCCache(const o2::InteractionRecord& ir);
112 BCCache* getBCCache(const o2::InteractionRecord& ir);
113
114 void storeBC(const BCCache& bc,
115 std::vector<o2::fv0::Digit>& digitsBC,
116 std::vector<o2::fv0::ChannelData>& digitsCh,
117 std::vector<o2::fv0::DetTrigInput>& digitsTrig,
119 bool isRing5(int detID);
120
121 std::array<std::vector<Float_t>, Constants::nFv0Channels> mPmtChargeVsTime; // Charge time series aka analogue signal pulse from PM
122 UInt_t mNBins; //
123 UInt_t mNTimeBinsPerBC;
124 Float_t mBinSize; // Time width of the pulse bin - HPTDC resolution
125
127 std::vector<Double_t> mPmtResponseGlobalRing5;
128 std::vector<Double_t> mPmtResponseGlobalRingA1ToA4;
129 std::vector<Double_t> mPmtResponseTemp;
130
132 BCCache mLastBCCache; // buffer for the last BC
133 std::array<int, Constants::nFv0Channels> mCfdStartIndex; // start indices for the CFD detector
134
136 Int_t SimulateLightYield(Int_t pmt, Int_t nPhot) const;
137 Float_t SimulateTimeCfd(int& startIndex, const ChannelDigitF& pulseLast, const ChannelDigitF& pulse) const;
138 Float_t IntegrateCharge(const ChannelDigitF& pulse) const;
139
141 static float getDistFromCellCenter(UInt_t cellId, double hitx, double hity);
142 static float getSignalFraction(float distanceFromXc, bool isFirstChannel);
143
144 ClassDefNV(Digitizer, 2);
145};
146
147// Function used to split the ring-5 cell signal into two readout channels depending on hit position
148inline float sigmoidPmtRing5(float x)
149{
150 return -0.668453 / (1.0 + TMath::Exp(TMath::Abs(x) / 3.64327)) + 0.834284;
151};
152
153} // namespace fv0
154} // namespace o2
155
156#endif
Class to describe fired triggered and/or stored channels for the BC and to refer to channel data.
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:66
uint16_t getBC() const
Definition Digitizer.h:67
void setTimeStamp(long t)
Definition Digitizer.h:50
void setInteractionRecord(const InteractionTimeRecord &ir)
Definition Digitizer.h:53
void setEventId(Int_t id)
Definition Digitizer.h:51
void setSrcId(Int_t id)
Definition Digitizer.h:52
const InteractionRecord & getInteractionRecord() const
Definition Digitizer.h:64
Digitizer(const Digitizer &)=delete
std::vector< float > ChannelDigitF
Definition Digitizer.h:69
InteractionRecord & getInteractionRecord(InteractionRecord &src)
Definition Digitizer.h:65
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:148
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:72
BCCache & operator=(const o2::InteractionRecord &ir)
Definition Digitizer.h:83
std::array< ChannelDigitF, Constants::nFv0Channels > mPmtChargeVsTime
Definition Digitizer.h:73
o2::InteractionRecord ir(0, 0)