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_FDD_DIGITIZER_H
13#define ALICEO2_FDD_DIGITIZER_H
14
15#include "DataFormatsFDD/Hit.h"
23#include "FDDBase/Constants.h"
27#include <vector>
28#include <array>
29#include <deque>
30#include <bitset>
31
32namespace o2
33{
34namespace fdd
35{
37{
38
39 private:
40 typedef math_utils::RandomRing</*float_v::size()*/ 4 * DigitizationParameters::PheRRSize> HitRandomRingType;
41 typedef math_utils::RandomRing</*float_v::size()*/ 4 * DigitizationParameters::HitRRSize> PheRandomRingType;
42
43 using ChannelBCDataF = std::array<float, NTimeBinsPerBC>;
44
45 public:
47 std::array<ChannelBCDataF, Nchannels> pulse = {};
48 std::vector<o2::fdd::MCLabel> labels;
49
50 BCCache();
51
52 void clear()
53 {
54 for (auto& chan : pulse) {
55 chan.fill(0.);
56 }
57 }
58
64 void print() const;
65 };
66
67 void process(const std::vector<o2::fdd::Hit>& hits,
68 std::vector<o2::fdd::Digit>& digitsBC,
69 std::vector<o2::fdd::ChannelData>& digitsCh,
70 std::vector<o2::fdd::DetTrigInput>& digitsTrig,
72
73 void flush(std::vector<o2::fdd::Digit>& digitsBC,
74 std::vector<o2::fdd::ChannelData>& digitsCh,
75 std::vector<o2::fdd::DetTrigInput>& digitsTrig,
77
78 void setEventTime(long value) { mEventTime = value; }
79 void setEventID(int id) { mEventID = id; }
80 void setSrcID(int id) { mSrcID = id; }
82
83 void setTriggers(o2::fdd::Digit* digit);
84 int simulateLightYield(int pmt, int nPhot);
85 float simulateTimeCFD(const ChannelBCDataF& pulse);
86 float integrateCharge(const ChannelBCDataF& pulse);
87
88 void init();
89 void finish();
90
91 void setDeadChannelMap(o2::fit::DeadChannelMap const* deadChannelMap) { mDeadChannelMap = deadChannelMap; };
92
93 private:
94 static constexpr int BCCacheMin = -1, BCCacheMax = 10, NBC2Cache = 1 + BCCacheMax - BCCacheMin;
95
96 void createPulse(int nphe, int parID, double timeHit, std::array<o2::InteractionRecord, NBC2Cache> const& cachedIR, int nCachedIR, int channel);
97
98 BCCache& setBCCache(const o2::InteractionRecord& ir);
99 BCCache* getBCCache(const o2::InteractionRecord& ir);
100
101 void storeBC(const BCCache& bc,
102 std::vector<o2::fdd::Digit>& digitsBC, std::vector<o2::fdd::ChannelData>& digitsCh, std::vector<o2::fdd::DetTrigInput>& digitsTrig,
104
105 long mEventTime; // TF (run) timestamp
106 o2::InteractionTimeRecord mIntRecord; // Interaction record (orbit, bc) -> InteractionTimeRecord
107 int mEventID; // ID of the current event
108 int mSrcID; // signal, background or QED
109 std::deque<BCCache> mCache; // cached BCs data
110 o2::fdd::Triggers mTriggers;
111
112 DigitizationParameters parameters;
113
114 ChannelBCDataF mTimeCFD; // Time series for CFD measurement
115 static constexpr float mBinSize = o2::constants::lhc::LHCBunchSpacingNS / NTimeBinsPerBC; // Time width of the pulse bin - HPTDC resolution
116 float mPmtTimeIntegral;
117
118 // Random rings
119 HitRandomRingType mRndScintDelay;
120 PheRandomRingType mRndGainVar;
121 PheRandomRingType mRndSignalShape;
122
123 // 8 tables starting at different sub-bin positions, i.e, [-4:4] / 8 * mBinSize
124 // wit each table containg values for start + [-2:2:mBinSize] * DigitizationParameters::mPmtTransitTime
125 std::array<std::vector<float>, DigitizationParameters::NResponseTables> mPMResponseTables;
126
127 static Double_t PMResponse(Double_t x);
128 static Double_t PMResponse(Double_t* x, Double_t*);
129 static Double_t SinglePhESpectrum(Double_t* x, Double_t* par);
130
131 o2::fit::DeadChannelMap const* mDeadChannelMap = nullptr;
132
133 ClassDefNV(Digitizer, 4);
134};
135} // namespace fdd
136} // namespace o2
137
138#endif
Dead channel map for FIT.
Container class to store values of single FDD channel.
Definition of the Detector class.
uint64_t bc
Definition RawEventData.h:5
Timeframe settings Average distance in cm of events merged into Randomize distance around average distance of merged events Simulate correct bunch interactions instead of placing only the average number of events A value[n] sets TFlen for[n] collisions in Number of bunches per trainsort Number of bunch trains Instantaneous interaction rate Do not simulate border Total number of collisions to be placed in the interior of all time Do not select random but walk over array of events in stride steps h Event generator settings h configStandalone Use CPU for GPU Force usage of the specified GPU device no CPU fallback Continue processing after an error First event to process
std::vector< o2::MCCompLabel > labels
Header to collect LHC related constants.
Definition of a container to keep Monte Carlo truth external to simulation objects.
A container to hold and manage MC truth information/labels.
void setEventID(int id)
Definition Digitizer.h:79
int simulateLightYield(int pmt, int nPhot)
void setEventTime(long value)
Definition Digitizer.h:78
void setSrcID(int id)
Definition Digitizer.h:80
float simulateTimeCFD(const ChannelBCDataF &pulse)
void setInteractionRecord(const o2::InteractionTimeRecord &src)
Definition Digitizer.h:81
void setDeadChannelMap(o2::fit::DeadChannelMap const *deadChannelMap)
Definition Digitizer.h:91
float integrateCharge(const ChannelBCDataF &pulse)
void setTriggers(o2::fdd::Digit *digit)
void flush(std::vector< o2::fdd::Digit > &digitsBC, std::vector< o2::fdd::ChannelData > &digitsCh, std::vector< o2::fdd::DetTrigInput > &digitsTrig, o2::dataformats::MCTruthContainer< o2::fdd::MCLabel > &labels)
GLint GLenum GLint x
Definition glcorearb.h:403
GLenum src
Definition glcorearb.h:1767
GLsizei const GLfloat * value
Definition glcorearb.h:819
GLuint id
Definition glcorearb.h:650
constexpr int NTimeBinsPerBC
Definition Constants.h:38
struct o2::upgrades_utils::@478 fdd
Collision labels.
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
InteractionRecord & operator=(const InteractionRecord &src)=default
BCCache & operator=(const o2::InteractionRecord &ir)
Definition Digitizer.h:59
std::vector< o2::fdd::MCLabel > labels
Definition Digitizer.h:48
std::array< ChannelBCDataF, Nchannels > pulse
Definition Digitizer.h:47
o2::InteractionRecord ir(0, 0)