9 constexpr
double highRangeCal = 1800.;
10 constexpr
double lowRangeCal = 260.;
26 const std::vector<CTPPSPixelDigi> &digi,
27 std::vector<CTPPSPixelCluster> &
clusters,
30 std::map<uint32_t, CTPPSPixelROCAnalysisMask>
const &mask = maskera->
analysisMask;
31 std::map<uint32_t, CTPPSPixelROCAnalysisMask>::const_iterator mask_it = mask.find(detId);
33 std::set<std::pair<unsigned char, unsigned char> > maskedPixels;
34 if (mask_it != mask.end())
35 maskedPixels = mask_it->second.maskedPixels;
38 edm::LogInfo(
"RPixDetClusterizer") << detId <<
" received digi.size()=" << digi.size();
50 uint8_t row = RPdit.row();
51 uint8_t column = RPdit.column();
52 if (row > maxRow || column > maxCol)
53 throw cms::Exception(
"CTPPSDigiOutofRange") <<
" row = " << row <<
" column = " << column;
55 std::pair<unsigned char, unsigned char>
pixel = std::make_pair(row, column);
56 unsigned short adc = RPdit.adc();
60 const bool is_in = maskedPixels.find(pixel) != maskedPixels.end();
63 electrons =
calibrate(detId, adc, row, column, pcalibrations);
67 unsigned int index = column * maxRow + row;
82 unsigned int seedIndex = aSeed.
column() * maxRow + aSeed.
row();
93 while (!atempCluster.
empty()) {
95 auto curInd = atempCluster.
top();
97 for (
auto c =
std::max(0,
int(atempCluster.
col[curInd]) - 1);
100 for (
auto r =
std::max(0,
int(atempCluster.
row[curInd]) - 1);
101 r <
std::min(
int(atempCluster.
row[curInd]) + 2, maxRow);
103 unsigned int currIndex =
c * maxRow +
r;
106 clusters.emplace_back(atempCluster.
isize, atempCluster.
adc, atempCluster.
row, atempCluster.
col);
116 clusters.emplace_back(atempCluster.
isize, atempCluster.
adc, atempCluster.
row, atempCluster.
col);
129 gain = DetCalibs.
getGain(col, row) * highRangeCal / lowRangeCal;
130 pedestal = DetCalibs.
getPed(col, row);
131 float vcal = (adc -
pedestal) * gain;
136 electrons = int(adc * gain - pedestal);
140 edm::LogInfo(
"RPixCalibration") <<
"calibrate: adc = " << adc <<
" electrons = " << electrons
141 <<
" gain = " << gain <<
" pedestal = " <<
pedestal;
145 electrons = int(adc * gain - pedestal);
147 edm::LogInfo(
"RPixCalibration") <<
"calibrate: adc = " << adc <<
" electrons = " << electrons
148 <<
" ElectronADCGain = " << gain <<
" pedestal = " <<
pedestal;
151 edm::LogInfo(
"RPixCalibration") <<
"RPixDetClusterizer::calibrate: *** electrons < 0 *** --> " << electrons
152 <<
" --> electrons = 0";
T getUntrackedParameter(std::string const &, T const &) const
const edm::EventSetup & c
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)
const CTPPSPixelGainCalibration & getGainCalibration(const uint32_t &detid) const
int row() const
Access to digi information.
std::vector< RPixCalibDigi > SeedVector_
uint32_t getDetId() const
void make_cluster(RPixCalibDigi const &aSeed, std::vector< CTPPSPixelCluster > &clusters)
int VcaltoElectronOffset_
std::set< CTPPSPixelDigi > rpix_digi_set_
if(conf_.getParameter< bool >("UseStripCablingDB"))
unsigned short SeedADCThreshold_
Log< level::Info, false > LogInfo
static constexpr uint8_t MAXROW
static constexpr uint8_t MAXCOL
unsigned short ADCThreshold_
T getParameter(std::string const &) const
bool addPixel(unsigned char myrow, unsigned char mycol, unsigned short const iadc)
int calibrate(unsigned int, int, int, int, const CTPPSPixelGainCalibrations *pcalibration)
float getPed(const int &col, const int &row) const
void buildClusters(unsigned int detId, const std::vector< CTPPSPixelDigi > &digi, std::vector< CTPPSPixelCluster > &clusters, const CTPPSPixelGainCalibrations *pcalibration, const CTPPSPixelAnalysisMask *mask)
unsigned short top() const
float getGain(const int &col, const int &row) const
uint16_t *__restrict__ uint16_t const *__restrict__ adc