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
76 void setDebugStreaming(bool doStreaming) { mEnableDebugStreaming = doStreaming; }
77
78 // function returns true if the collision occurs 600ns before the readout window is open
79 bool preTriggerCollision() const { return mDigits.preTriggerCollision(); }
80
82
83 bool doSmearEnergy() const { return mSmearEnergy; }
84 double smearEnergy(double energy);
85 double smearTime(double time, double energy);
86 bool doSimulateTimeResponse() const { return mSimulateTimeResponse; }
87
88 void sampleSDigit(const Digit& sdigit);
89
91 static double rawResponseFunction(double* x, double* par);
92
93 const std::vector<o2::emcal::Digit>& getDigits() const { return mDigits.getDigits(); }
94 const std::vector<o2::emcal::TriggerRecord>& getTriggerRecords() const { return mDigits.getTriggerRecords(); }
96
97 static constexpr int getTOFSamplingBins() { return EMC_TOF_BINS; }
98
99 private:
100 using TimeSampleContainer = std::array<double, constants::EMCAL_MAXTIMEBINS>;
101 static constexpr int EMC_PHASES = 4;
102 static constexpr int EMC_TOF_BINS = 1500;
103 static constexpr double EMC_TOF_MIN = 0;
104 static constexpr double EMC_TOF_MAX = 1500.;
105 static constexpr double EMC_TOF_BINWITH = (EMC_TOF_MAX - EMC_TOF_MIN) / EMC_TOF_BINS;
106 short mEventTimeOffset = 0;
107 short mPhase = 0;
108 UInt_t mROFrameMin = 0;
109 UInt_t mROFrameMax = 0;
110 bool mSmearEnergy = true;
111 bool mSimulateTimeResponse = true;
112 const SimParam* mSimParam = nullptr;
113 bool mIsBeforeFirstRO = false;
114 o2::InteractionRecord mIRFirstSampledTF;
115 double mTimeBCns;
116
117 std::vector<Digit> mTempDigitVector;
119
120 TRandom3* mRandomGenerator = nullptr;
121 std::array<std::array<TimeSampleContainer, EMC_TOF_BINS>, EMC_PHASES>
122 mAmplitudeInTimeBins;
123
124 std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugStream = nullptr;
125 bool mEnableDebugStreaming = false;
126
127 ClassDefOverride(Digitizer, 1);
128};
129} // namespace emcal
130} // namespace o2
131
132#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:76
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:97
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:94
bool doSmearEnergy() const
Definition Digitizer.h:83
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:93
bool doSimulateTimeResponse() const
Definition Digitizer.h:86
double getTriggerTime() const
Definition Digitizer.h:71
void sampleSDigit(const Digit &sdigit)
double smearEnergy(double energy)
bool preTriggerCollision() const
Definition Digitizer.h:79
const o2::dataformats::MCTruthContainer< o2::emcal::MCLabel > & getMCLabels() const
Definition Digitizer.h:95
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