Project
Loading...
Searching...
No Matches
DEDigitizer.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 O2_MCH_SIMULATION_DE_DIGITIZER_H
13#define O2_MCH_SIMULATION_DE_DIGITIZER_H
14
15#include <map>
16#include <random>
17#include <utility>
18#include <vector>
19
22#include "MathUtils/Cartesian.h"
24#include "MCHSimulation/Hit.h"
28
29namespace o2::mch
30{
31
34{
35 public:
36 using DigitsAndLabels = std::pair<std::vector<Digit>, dataformats::MCLabelContainer>;
37
44 DEDigitizer(int deId, math_utils::Transform3D transformation, std::mt19937& random);
45
50 void setFirstTFOrbit(uint32_t firstTFOrbit) { mFirstTFOrbit = firstTFOrbit; }
51
64 void processHit(const Hit& hit, const InteractionRecord& collisionTime, int evID, int srcID);
65
75 void addNoise(const InteractionRecord& firstIR, const InteractionRecord& lastIR);
76
86 size_t digitize(std::map<InteractionRecord, DigitsAndLabels>& irDigitsAndLabels);
87
89 void clear();
90
91 private:
93 struct Signal {
95 uint8_t bcInROF;
96 float charge;
97 std::vector<MCCompLabel> labels;
98 Signal(const InteractionRecord& ir, uint8_t bc, float q, const MCCompLabel& label)
99 : rofIR{ir}, bcInROF{bc}, charge{q}, labels{label} {}
100 };
101
103 void addSignal(int padid, const InteractionRecord& collisionTime, float charge, const MCCompLabel& label);
105 void addNoise(int padid, const InteractionRecord& rofIR);
107 void addNoise(Signal& signal, uint32_t nSamples);
109 void addTimeDispersion(Signal& signal);
111 bool isAboveThreshold(float charge);
113 DigitsAndLabels* addNewDigit(std::map<InteractionRecord, DigitsAndLabels>& irDigitsAndLabels,
114 int padid, const Signal& signal, uint32_t nSamples) const;
116 void appendLastDigit(DigitsAndLabels* digitsAndLabels, const Signal& signal, uint32_t nSamples) const;
117
118 int mDeId;
119 Response mResponse;
120 o2::math_utils::Transform3D mTransformation;
121 mapping::Segmentation mSegmentation;
122
123 std::mt19937& mRandom;
124 std::normal_distribution<float> mMinChargeDist;
125 std::normal_distribution<float> mTimeDist;
126 std::normal_distribution<float> mNoiseDist;
127 std::normal_distribution<float> mNoiseOnlyDist;
128 std::poisson_distribution<int> mNofNoisyPadsDist;
129 std::uniform_int_distribution<int> mPadIdDist;
130 std::uniform_int_distribution<int> mBCDist;
131
132 uint32_t mFirstTFOrbit;
133
134 std::vector<std::vector<Signal>> mSignals;
135};
136
137} // namespace o2::mch
138
139#endif
int16_t charge
Definition RawEventData.h:5
uint64_t bc
Definition RawEventData.h:5
Definition of a container to keep Monte Carlo truth external to simulation objects.
MCH digitizer dealing with a single detection element.
Definition DEDigitizer.h:34
void setFirstTFOrbit(uint32_t firstTFOrbit)
Definition DEDigitizer.h:50
void addNoise(const InteractionRecord &firstIR, const InteractionRecord &lastIR)
void processHit(const Hit &hit, const InteractionRecord &collisionTime, int evID, int srcID)
std::pair< std::vector< Digit >, dataformats::MCLabelContainer > DigitsAndLabels
Definition DEDigitizer.h:36
void clear()
Clear the internal lists of signals.
size_t digitize(std::map< InteractionRecord, DigitsAndLabels > &irDigitsAndLabels)
GLuint GLsizei const GLchar * label
Definition glcorearb.h:2519
@ Signal
A message which is created every time a SIGUSR1 is received.
auto transformation
o2::InteractionRecord ir(0, 0)