Project
Loading...
Searching...
No Matches
ChipDigitsContainer.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_TRK_CHIPDIGITSCONTAINER_
13#define ALICEO2_TRK_CHIPDIGITSCONTAINER_
14
18#include "TRKBase/Specs.h"
20#include <fairlogger/Logger.h>
21#include <TRandom.h>
22
23namespace o2::trkft3
24{
25
27{
28 public:
29 explicit ChipDigitsContainer(UShort_t idx = 0);
30
32
34 static ULong64_t getOrderingKey(UInt_t roframe, UShort_t row, UShort_t col)
35 {
36 return (static_cast<ULong64_t>(roframe) << (8 * sizeof(UInt_t))) + (static_cast<ULong64_t>(col) << (8 * sizeof(Short_t))) + row;
37 }
38
40 void addNoise(UInt_t rofMin, UInt_t rofMax, const o2::itsmft::DigiParams* params, int maxRows = o2::itsmft::SegmentationAlpide::NRows, int maxCols = o2::itsmft::SegmentationAlpide::NCols) = delete;
41 template <int DetID>
42 void addNoise(UInt_t rofMin, UInt_t rofMax, const o2::trkft3::DigiParams<DetID>* params, int subDetID, int layer);
43
45};
46
47} // namespace o2::trkft3
48
49template <int DetID>
50void o2::trkft3::ChipDigitsContainer::addNoise(UInt_t rofMin, UInt_t rofMax, const o2::trkft3::DigiParams<DetID>* params, int subDetID, int layer)
51{
52 UInt_t row = 0;
53 UInt_t col = 0;
54 Int_t nhits = 0;
55 float mean = 0.f;
56 int nel = 0;
57 int maxRows = 0;
58 int maxCols = 0;
59
60 if (subDetID == 0) {
61 maxRows = o2::trk::constants::VD::petal::layer::nRows[layer];
62 maxCols = o2::trk::constants::VD::petal::layer::nCols;
63 } else {
66 }
67 mean = params->getNoisePerPixel() * maxRows * maxCols;
68 nel = static_cast<int>(params->getChargeThreshold() * 1.1);
69
70 LOG(debug) << "Adding noise for chip " << mChipIndex << " with mean " << mean << " and charge " << nel;
71
72 for (UInt_t rof = rofMin; rof <= rofMax; rof++) {
73 nhits = gRandom->Poisson(mean);
74 for (Int_t i = 0; i < nhits; ++i) {
75 row = gRandom->Integer(maxRows);
76 col = gRandom->Integer(maxCols);
77 LOG(debug) << "Generated noise hit at ROF " << rof << ", row " << row << ", col " << col;
79 continue;
80 }
82 continue;
83 }
84 auto key = getOrderingKey(rof, row, col);
85 if (!findDigit(key)) {
86 addDigit(key, rof, row, col, nel, o2::MCCompLabel(true));
87 }
88 }
89 }
90}
91
92#endif // ALICEO2_TRK_CHIPDIGITSCONTAINER_
Simulation parameters for the TRK digitizer. Based on the ITS2 and ITS3 digitizer parameters.
std::ostringstream debug
int32_t i
transient container for single chip digits accumulation
uint32_t col
Definition RawData.h:4
Definition of the SegmentationAlpide class.
Definition of the SegmentationChipclass.
specs of the ALICE3 TRK
StringRef key
Container for similated points connected to a given chip.
void addDigit(ULong64_t key, UInt_t roframe, UShort_t row, UShort_t col, int charge, o2::MCCompLabel lbl)
const o2::itsmft::NoiseMap * mNoiseMap
o2::itsmft::PreDigit * findDigit(ULong64_t key)
const o2::itsmft::NoiseMap * mDeadChanMap
bool isNoisy(int chip, int row, int col) const
Definition NoiseMap.h:151
ClassDefNV(ChipDigitsContainer, 1)
static ULong64_t getOrderingKey(UInt_t roframe, UShort_t row, UShort_t col)
Get global ordering key made of readout frame, column and row.
void addNoise(UInt_t rofMin, UInt_t rofMax, const o2::itsmft::DigiParams *params, int maxRows=o2::itsmft::SegmentationAlpide::NRows, int maxCols=o2::itsmft::SegmentationAlpide::NCols)=delete
Adds noise digits, deleted the one using the itsmft::DigiParams interface.
GLenum const GLfloat * params
Definition glcorearb.h:272
GLenum GLuint GLint GLint layer
Definition glcorearb.h:1310
LOG(info)<< "Compressed in "<< sw.CpuTime()<< " s"
std::vector< int > row