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_EMCAL_FEEDIGITIZER_H
13#define ALICEO2_EMCAL_FEEDIGITIZER_H
14
15#include <array>
16#include <memory>
17#include <unordered_map>
18#include <vector>
19#include <list>
20
21#include "Rtypes.h" // for Digitizer::Class, Double_t, ClassDef, etc
22#include "TObject.h" // for TObject
23#include "TRandom3.h"
24
27#include "EMCALBase/Hit.h"
34
35namespace o2
36{
37namespace utils
38{
39class TreeStreamRedirector;
40}
41namespace emcal
42{
43
50class Digitizer : public TObject
51{
52 public:
53 Digitizer() = default;
54 ~Digitizer() override = default;
55 Digitizer(const Digitizer&) = delete;
56 Digitizer& operator=(const Digitizer&) = delete;
57
58 void init();
59 void clear();
60
62 void flush() { mDigits.flush(); }
63
65 void finish() { mDigits.finish(); }
66
68 void process(const std::vector<LabeledDigit>& labeledDigit);
69
70 void setEventTime(o2::InteractionTimeRecord record, bool trigger);
71 double getTriggerTime() const { return mDigits.getTriggerTime(); }
72 double getEventTime() const { return mDigits.getEventTime(); }
73 bool isLive(double t) const { return mDigits.isLive(t); }
74 bool isLive() const { return mDigits.isLive(); }
75 bool isCurrentEventTriggered() const { return mDigits.isCurrentEventTriggered(); }
76
77 void setDebugStreaming(bool doStreaming) { mEnableDebugStreaming = doStreaming; }
78
79 // function returns true if the collision occurs 600ns before the readout window is open
80 bool preTriggerCollision() const { return mDigits.preTriggerCollision(); }
81
83
84 bool doSmearEnergy() const { return mSmearEnergy; }
85 double smearEnergy(double energy);
86 double smearTime(double time, double energy);
87 bool doSimulateTimeResponse() const { return mSimulateTimeResponse; }
88
89 void sampleSDigit(const Digit& sdigit);
90
92 static double rawResponseFunction(double* x, double* par);
93
94 const std::vector<o2::emcal::Digit>& getDigits() const { return mDigits.getDigits(); }
95 const std::vector<o2::emcal::TriggerRecord>& getTriggerRecords() const { return mDigits.getTriggerRecords(); }
97
98 static constexpr int getTOFSamplingBins() { return EMC_TOF_BINS; }
99
100 private:
101 using TimeSampleContainer = std::array<double, constants::EMCAL_MAXTIMEBINS>;
102 static constexpr int EMC_PHASES = 4;
103 static constexpr int EMC_TOF_BINS = 1500;
104 static constexpr double EMC_TOF_MIN = 0;
105 static constexpr double EMC_TOF_MAX = 1500.;
106 static constexpr double EMC_TOF_BINWITH = (EMC_TOF_MAX - EMC_TOF_MIN) / EMC_TOF_BINS;
107 short mEventTimeOffset = 0;
108 short mPhase = 0;
109 UInt_t mROFrameMin = 0;
110 UInt_t mROFrameMax = 0;
111 bool mSmearEnergy = true;
112 bool mSimulateTimeResponse = true;
113 const SimParam* mSimParam = nullptr;
114 bool mIsBeforeFirstRO = false;
115 o2::InteractionRecord mIRFirstSampledTF;
116 double mTimeBCns;
117
118 std::vector<Digit> mTempDigitVector;
120
121 TRandom3* mRandomGenerator = nullptr;
122 std::array<std::array<TimeSampleContainer, EMC_TOF_BINS>, EMC_PHASES>
123 mAmplitudeInTimeBins;
124
125 std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugStream = nullptr;
126 bool mEnableDebugStreaming = false;
127
128 ClassDefOverride(Digitizer, 1);
129};
130} // namespace emcal
131} // namespace o2
132
133#endif /* ALICEO2_EMCAL_FEEDIGITIZER_H */
int16_t time
Definition RawEventData.h:4
Definition of a container to keep Monte Carlo truth external to simulation objects.
A container to hold and manage MC truth information/labels.
EMCAL digit implementation.
Definition Digit.h:34
EMCAL FEE digitizer.
Definition Digitizer.h:51
void flush()
clear DigitsVectorStream
Definition Digitizer.h:62
static double rawResponseFunction(double *x, double *par)
raw pointers used here to allow interface with TF1
Definition Digitizer.cxx:93
bool isLive() const
Definition Digitizer.h:74
void setDebugStreaming(bool doStreaming)
Definition Digitizer.h:77
void setEventTime(o2::InteractionTimeRecord record, bool trigger)
Digitizer(const Digitizer &)=delete
bool isLive(double t) const
Definition Digitizer.h:73
static constexpr int getTOFSamplingBins()
Definition Digitizer.h:98
double getEventTime() const
Definition Digitizer.h:72
Digitizer & operator=(const Digitizer &)=delete
void finish()
This is for the readout window that was interrupted by the end of the run.
Definition Digitizer.h:65
const std::vector< o2::emcal::TriggerRecord > & getTriggerRecords() const
Definition Digitizer.h:95
bool doSmearEnergy() const
Definition Digitizer.h:84
void fillOutputContainer(std::vector< Digit > &digits, o2::dataformats::MCTruthContainer< o2::emcal::MCLabel > &labels)
double smearTime(double time, double energy)
~Digitizer() override=default
const std::vector< o2::emcal::Digit > & getDigits() const
Definition Digitizer.h:94
bool doSimulateTimeResponse() const
Definition Digitizer.h:87
bool isCurrentEventTriggered() const
Definition Digitizer.h:75
double getTriggerTime() const
Definition Digitizer.h:71
void sampleSDigit(const Digit &sdigit)
double smearEnergy(double energy)
bool preTriggerCollision() const
Definition Digitizer.h:80
const o2::dataformats::MCTruthContainer< o2::emcal::MCLabel > & getMCLabels() const
Definition Digitizer.h:96
Container class for time sampled digits.
const std::vector< o2::emcal::Digit > & getDigits() const
void finish()
This is for the readout window that was interrupted by the end of the run.
void flush()
clear DigitsVectorStream
const std::vector< o2::emcal::TriggerRecord > & getTriggerRecords() const
const o2::dataformats::MCTruthContainer< o2::emcal::MCLabel > & getMCLabels() const
EMCal simulation parameters.
Definition SimParam.h:28
GLint GLenum GLint x
Definition glcorearb.h:403
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Common utility functions.
std::vector< Digit > digits