29 const std::vector<CTPPSPixelDigi> &digi,
30 std::vector<CTPPSPixelCluster> &
clusters,
33 std::map<uint32_t, CTPPSPixelROCAnalysisMask>
const &
mask = maskera->
analysisMask;
34 std::set<std::pair<unsigned char, unsigned char> > maskedPixels;
36 bool fullyMaskedRoc[6][6] = {{
false}};
41 for (
auto const &det :
mask) {
42 uint32_t planeId = det.first & ~rocMask;
44 if (planeId ==
detId) {
45 unsigned int rocNum = (det.first & rocMask) >> rocOffset;
47 throw cms::Exception(
"InvalidRocNumber") <<
"roc number from mask: " << rocNum;
48 if (det.second.fullMask)
49 fullyMaskedRoc[currentId.
plane()][rocNum] =
true;
50 for (
auto const &paio : det.second.maskedPixels) {
51 std::pair<unsigned char, unsigned char> pa = paio;
54 std::pair<int, int> modPix(modRow, modCol);
55 maskedPixels.insert(modPix);
61 edm::LogInfo(
"RPixDetClusterizer") <<
detId <<
" received digi.size()=" << digi.size();
73 uint8_t row = RPdit.row();
74 uint8_t column = RPdit.column();
75 if (row > maxRow || column > maxCol)
76 throw cms::Exception(
"CTPPSDigiOutofRange") <<
" row = " << row <<
" column = " << column;
78 std::pair<unsigned char, unsigned char>
pixel = std::make_pair(row, column);
79 unsigned short adc = RPdit.adc();
83 const bool is_in = maskedPixels.find(
pixel) != maskedPixels.end();
86 int piano = currentId.
plane();
87 int rocId = pI.
getROCId(column, row);
89 if (!is_in && !fullyMaskedRoc[piano][rocId]) {
95 unsigned int index = column * maxRow + row;
110 unsigned int seedIndex = aSeed.
column() * maxRow + aSeed.
row();
121 while (!atempCluster.
empty()) {
123 auto curInd = atempCluster.
top();
125 for (
auto c =
std::max(0,
int(atempCluster.
col[curInd]) - 1);
126 c <
std::min(
int(atempCluster.
col[curInd]) + 2, maxCol);
128 for (
auto r =
std::max(0,
int(atempCluster.
row[curInd]) - 1);
129 r <
std::min(
int(atempCluster.
row[curInd]) + 2, maxRow);
131 unsigned int currIndex =
c * maxRow +
r;
176 <<
" ElectronADCGain = " <<
gain <<
" pedestal = " <<
pedestal;
179 edm::LogInfo(
"RPixCalibration") <<
"RPixDetClusterizer::calibrate: *** electrons < 0 *** --> " <<
electrons 180 <<
" --> electrons = 0";
float getPed(const int &col, const int &row) const
T getParameter(std::string const &) const
unsigned short adc[MAXSIZE]
std::map< unsigned int, RPixCalibDigi > calib_rpix_digi_map_
std::map< uint32_t, CTPPSPixelROCAnalysisMask > analysisMask
bool doSingleCalibration_
RPixDetClusterizer(edm::ParameterSet const &conf)
T getUntrackedParameter(std::string const &, T const &) const
float getGain(const int &col, const int &row) const
uint32_t getDetId() const
std::vector< RPixCalibDigi > SeedVector_
void make_cluster(RPixCalibDigi const &aSeed, std::vector< CTPPSPixelCluster > &clusters)
int VcaltoElectronOffset_
std::set< CTPPSPixelDigi > rpix_digi_set_
unsigned short SeedADCThreshold_
Log< level::Info, false > LogInfo
static constexpr uint8_t MAXROW
static constexpr uint8_t MAXCOL
unsigned short ADCThreshold_
const CTPPSPixelGainCalibration & getGainCalibration(const uint32_t &detid) const
bool addPixel(unsigned char myrow, unsigned char mycol, unsigned short const iadc)
int getROCId(const int col, const int row) const
int calibrate(unsigned int, int, int, int, const CTPPSPixelGainCalibrations *pcalibration)
int transformToModule(const int colROC, const int rowROC, const int rocId, int &col, int &row) const
void buildClusters(unsigned int detId, const std::vector< CTPPSPixelDigi > &digi, std::vector< CTPPSPixelCluster > &clusters, const CTPPSPixelGainCalibrations *pcalibration, const CTPPSPixelAnalysisMask *mask)
int row() const
Access to digi information.
unsigned short top() const
uint16_t *__restrict__ uint16_t const *__restrict__ adc