Project
Loading...
Searching...
No Matches
DigitizerTRU.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_TRIGGERDIGITIZER_H
13#define ALICEO2_EMCAL_TRIGGERDIGITIZER_H
14
15#include <memory>
16#include <unordered_map>
17#include <vector>
18#include <list>
19
20#include "Rtypes.h" // for DigitizerTRU::Class, Double_t, ClassDef, etc
21#include "TObject.h" // for TObject
22#include "TRandom3.h"
23
25#include "EMCALBase/Hit.h"
34#include "EMCALCalib/FeeDCS.h"
35
36namespace o2
37{
38namespace utils
39{
40class TreeStreamRedirector;
41}
42namespace emcal
43{
44class FeeDCS;
45
53{
54 public:
55 DigitizerTRU() = default;
56 ~DigitizerTRU() = default;
57 DigitizerTRU(const DigitizerTRU&) = delete;
59
60 void init();
61 void clear();
62
64 void setPatches();
65
67 void flush() { mDigits.flush(); }
68
70 void finish();
71
73 void process(const gsl::span<const Digit> summableDigits);
74
77 std::vector<std::tuple<int, Digit>> makeAnaloguesFastorSums(const gsl::span<const Digit> sdigits);
78
80
82 void setGeometry(o2::emcal::Geometry* gm) { mGeometry = gm; }
83
85 void setFEE(o2::emcal::FeeDCS* fees) { mFeeDCS = fees; }
86
90
91 void setWindowStartTime(int time) { mTimeWindowStart = time; }
92 void setDebugStreaming(bool doStreaming) { mEnableDebugStreaming = doStreaming; }
93
95
96 bool doSmearEnergy() const { return mSmearEnergy; }
97 double smearEnergy(double energy);
98 double smearTime(double time, double energy);
99 bool doSimulateTimeResponse() const { return mSimulateTimeResponse; }
100
101 void sampleSDigit(const Digit& sdigit);
102
105 {
106 mDebugStream->Close();
107 // mDebugStreamPatch->Close();
108 }
109
111 bool isDebugMode() { return mEnableDebugStreaming; }
112
114 const std::vector<EMCALTriggerInputs>& getTriggerInputs() { return LZERO.getTriggerInputs(); }
115
117 std::vector<TRUElectronics> getPatchesVector() { return patchesFromAllTRUs; }
118
120 static double rawResponseFunction(double* x, double* par);
121
123 int GetTRUIndexFromSTUIndex(Int_t id, Int_t detector);
124 int GetChannelForMaskRun2(int mask, int bitnumber, bool onethirdsm);
125 std::vector<int> GetAbsFastORIndexFromMask();
126
127 private:
128 short mEventTimeOffset = 0;
129 bool mSmearEnergy = true;
130 bool mSimulateTimeResponse = true;
131 // const SimParam* mSimParam = nullptr; ///< SimParam object
132
133 std::vector<Digit> mTempDigitVector;
134 // std::unordered_map<Int_t, std::list<LabeledDigit>> mDigits; ///< used to sort digits and labels by tower
137 std::vector<TRUElectronics> patchesFromAllTRUs;
138
139 // TRandom3* mRandomGenerator = nullptr; ///< random number generator
140 std::array<double, constants::EMCAL_MAXTIMEBINS>
141 mAmplitudeInTimeBins;
142
143 // TriggerMappingV2* mTriggerMap = nullptr; ///< Trigger map for tower to fastor ID
144 Geometry* mGeometry = nullptr;
145
146 int mTimeWindowStart = 7;
147 int mDelay = 7;
148 bool mWasTriggerFound = false;
149 int mPreviousTriggerSize = 0;
150
151 std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugStream = nullptr;
152 // std::unique_ptr<o2::utils::TreeStreamRedirector> mDebugStreamPatch = nullptr;
153 bool mEnableDebugStreaming = false;
154 o2::emcal::FeeDCS* mFeeDCS;
155
156 ClassDefNV(DigitizerTRU, 1);
157};
158} // namespace emcal
159} // namespace o2
160
161#endif /* ALICEO2_EMCAL_TRIGGERDIGITIZER_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 DigitizerTRU, digitizes with the help of a temporary description based upon a pol9*Heavyside.
int GetChannelForMaskRun2(int mask, int bitnumber, bool onethirdsm)
bool doSmearEnergy() const
const std::vector< EMCALTriggerInputs > & getTriggerInputs()
Getter for triggers.
void setDebugStreaming(bool doStreaming)
void setWindowStartTime(int time)
std::vector< int > GetAbsFastORIndexFromMask()
double smearEnergy(double energy)
void setEventTime(o2::InteractionTimeRecord record)
int GetTRUIndexFromSTUIndex(Int_t id, Int_t detector)
Utility functions obtained from QC for EMC.
void finish()
This is for the readout window that was interrupted by the end of the run.
void setMaskedFastOrsInLZERO()
Sets the masked fastOrs from the CCDB in the LZERO.
DigitizerTRU(const DigitizerTRU &)=delete
void setGeometry(o2::emcal::Geometry *gm)
Sets geometry for trigger mapping.
void sampleSDigit(const Digit &sdigit)
DigitizerTRU & operator=(const DigitizerTRU &)=delete
std::vector< std::tuple< int, Digit > > makeAnaloguesFastorSums(const gsl::span< const Digit > sdigits)
void fillOutputContainer(std::vector< Digit > &digits, o2::dataformats::MCTruthContainer< o2::emcal::MCLabel > &labels)
bool doSimulateTimeResponse() const
static double rawResponseFunction(double *x, double *par)
raw pointers used here to allow interface with TF1
double smearTime(double time, double energy)
std::vector< TRUElectronics > getPatchesVector()
Getter for patches.
void endDebugStream()
Close the TreeStreamer to make the file readable.
void flush()
clear DigitsVectorStream
void setPatches()
Sets patches for the current geometry.
bool isDebugMode()
Getter for debug mode.
void setFEE(o2::emcal::FeeDCS *fees)
Sets FEE DCS for the masking of the fastOrs.
Container class for time sampled digits to be sent to TRUs in true continuous readout.
void flush()
clear DigitsVectorStream
EMCAL geometry definition.
Definition Geometry.h:40
Container class for Digits, MC lebels, and trigger records.
const std::vector< EMCALTriggerInputs > & getTriggerInputs() const
Getter for the trigger inputs found by the LZERO algorithm.
GLint GLenum GLint x
Definition glcorearb.h:403
GLint GLuint mask
Definition glcorearb.h:291
a couple of static helper functions to create timestamp values for CCDB queries or override obsolete ...
Common utility functions.
std::vector< Digit > digits