46 thePixelThreshold(conf.getParameter<
int>(
"ChannelThreshold")),
47 theSeedThreshold(conf.getParameter<
int>(
"SeedThreshold")),
48 theClusterThreshold(conf.getParameter<
int>(
"ClusterThreshold")),
49 theClusterThreshold_L1(conf.getParameter<
int>(
"ClusterThreshold_L1")),
50 theConversionFactor(conf.getParameter<
int>(
"VCaltoElectronGain")),
51 theConversionFactor_L1(conf.getParameter<
int>(
"VCaltoElectronGain_L1")),
52 theOffset(conf.getParameter<
int>(
"VCaltoElectronOffset")),
53 theOffset_L1(conf.getParameter<
int>(
"VCaltoElectronOffset_L1")),
54 theElectronPerADCGain(conf.getParameter<double>(
"ElectronPerADCGain")),
55 doPhase2Calibration(conf.getParameter<
bool>(
"Phase2Calibration")),
56 thePhase2ReadoutMode(conf.getParameter<
int>(
"Phase2ReadoutMode")),
57 thePhase2DigiBaseline(conf.getParameter<double>(
"Phase2DigiBaseline")),
58 thePhase2KinkADC(conf.getParameter<
int>(
"Phase2KinkADC")),
63 doMissCalibrate(conf.getParameter<
bool>(
"MissCalibrate")),
64 doSplitClusters(conf.getParameter<
bool>(
"SplitClusters")) {
73 desc.add<
int>(
"ChannelThreshold", 1000);
74 desc.add<
bool>(
"MissCalibrate",
true);
75 desc.add<
bool>(
"SplitClusters",
false);
76 desc.add<
int>(
"VCaltoElectronGain", 65);
77 desc.add<
int>(
"VCaltoElectronGain_L1", 65);
78 desc.add<
int>(
"VCaltoElectronOffset", -414);
79 desc.add<
int>(
"VCaltoElectronOffset_L1", -414);
80 desc.add<
int>(
"SeedThreshold", 1000);
81 desc.add<
int>(
"ClusterThreshold_L1", 4000);
82 desc.add<
int>(
"ClusterThreshold", 4000);
83 desc.add<
double>(
"ElectronPerADCGain", 135.);
84 desc.add<
bool>(
"Phase2Calibration",
false);
85 desc.add<
int>(
"Phase2ReadoutMode", -1);
86 desc.add<
double>(
"Phase2DigiBaseline", 1200.);
87 desc.add<
int>(
"Phase2KinkADC", 8);
99 int nrows = topol.
nrows();
125 template <
typename T>
129 const std::vector<short>& badChannels,
131 typename T::const_iterator begin =
input.begin();
132 typename T::const_iterator
end =
input.end();
136 edm::LogError(
"PixelThresholdClusterizer") <<
"@SUB=PixelThresholdClusterizer::clusterizeDetUnitT()" 137 <<
" No digis to clusterize";
159 for (
unsigned int i = 0;
i <
theSeeds.size();
i++) {
208 for (
int i = 0;
i < ci->size(); ++
i) {
220 #ifdef PIXELREGRESSION 221 static std::atomic<int> s_ic = 0;
230 edm::LogWarning(
"PixelThresholdClusterizer") <<
" copy_to_buffer called with empty or invalid range" << std::endl;
249 (*theSiPixelGainCalibrationService_)
258 auto adc = di->adc();
268 #ifdef PIXELREGRESSION 269 static std::atomic<int> eqD = 0;
273 int col = di->column();
275 int adc = (di->flag() != 0) ? di->adc() * 10 :
electron[
i];
278 #ifdef PIXELREGRESSION 282 std::cout <<
"VI " << eqD <<
' ' << ic <<
' ' <<
end - begin <<
' ' <<
i <<
' ' << di->adc() <<
' ' <<
adc <<
' ' 283 << adcOld << std::endl;
310 for (
int i = 0;
i < ci->size(); ++
i) {
342 const int dualslope =
int(dualslopeparam <= 1 ? 1. :
pow(2, dualslopeparam - 1));
369 float DBpedestal =
pedestal * DBgain;
375 float vcal =
adc * DBgain - DBpedestal;
413 std::stack<SiPixelCluster::PixelPos, std::vector<SiPixelCluster::PixelPos> > dead_pixel_stack;
440 acluster.
add(pix, seed_adc);
441 cldata.
add(pix, seed_adc);
444 bool dead_flag =
false;
445 while (!acluster.
empty()) {
447 auto curInd = acluster.
top();
449 for (
auto c =
std::max(0,
int(acluster.
y[curInd]) - 1);
452 for (
auto r =
std::max(0,
int(acluster.
x[curInd]) - 1);
458 if (!acluster.
add(newpix, newpix_adc))
462 cldata.
add(newpix, newpix_adc);
506 bool have_second_cluster =
false;
507 while (!dead_pixel_stack.empty()) {
510 dead_pixel_stack.pop();
518 output.push_back(second_cluster);
519 have_second_cluster =
true;
524 const std::vector<SiPixelCluster::Pixel>& branch_pixels = second_cluster.
pixels();
525 for (
unsigned int i = 0;
i < branch_pixels.size();
i++) {
526 auto const temp_x = branch_pixels[
i].x;
527 auto const temp_y = branch_pixels[
i].y;
528 auto const temp_adc = branch_pixels[
i].adc;
530 cluster.
add(newpix, temp_adc);
536 output.push_back(first_cluster);
const int theConversionFactor_L1
void clusterizeDetUnitT(const T &input, const PixelGeomDetUnit *pixDet, const TrackerTopology *tTopo, const std::vector< short > &badChannels, edmNew::DetSetVector< SiPixelCluster >::FastFiller &output)
Cluster pixels. This method operates on a matrix of pixels and finds the largest contiguous cluster a...
static void fillPSetDescription(edm::ParameterSetDescription &desc)
unsigned int pxbLayer(const DetId &id) const
SiPixelArrayBuffer theBuffer
Data storage.
const int theClusterThreshold_L1
PixelThresholdClusterizer(edm::ParameterSet const &conf)
SiPixelCluster make_cluster(const SiPixelCluster::PixelPos &pix, edmNew::DetSetVector< SiPixelCluster >::FastFiller &output)
The actual clustering algorithm: group the neighboring pixels around the seed.
virtual int ncolumns() const =0
virtual int nrows() const =0
virtual bool isDead(const uint32_t &detID, const int &col, const int &row)=0
const int thePixelThreshold
Log< level::Error, false > LogError
const int thePhase2KinkADC
void set_adc(int row, int col, int adc)
static std::string const input
const int thePhase2ReadoutMode
const int theSeedThreshold
const std::vector< Pixel > pixels() const
void add_adc(int row, int col, int adc)
edm::DetSet< PixelDigi >::const_iterator DigiIterator
const bool doPhase2Calibration
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void add(const PixelPos &pix, int adc)
virtual float getPedestal(const uint32_t &detID, const int &col, const int &row)=0
const bool doMissCalibrate
int theNumOfRows
Geometry-related information.
const double theElectronPerADCGain
edmNew::DetSet< SiPixelCluster >::const_iterator ClusterIterator
void clear_buffer(DigiIterator begin, DigiIterator end)
Clear the internal buffer array.
void setSize(int rows, int cols)
std::vector< bool > theFakePixels
const int theClusterThreshold
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibrationService_
const double thePhase2DigiBaseline
Pixel cluster – collection of neighboring pixels above threshold.
const bool doSplitClusters
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
constexpr int row() const
virtual float getGain(const uint32_t &detID, const int &col, const int &row)=0
bool setup(const PixelGeomDetUnit *pixDet)
Private helper methods:
constexpr int col() const
bool add(SiPixelCluster::PixelPos const &p, uint16_t const iadc)
virtual bool isNoisy(const uint32_t &detID, const int &col, const int &row)=0
~PixelThresholdClusterizer() override
int calibrate(int adc, int col, int row)
Log< level::Warning, false > LogWarning
std::vector< SiPixelCluster::PixelPos > theSeeds
Power< A, B >::type pow(const A &a, const B &b)
void copy_to_buffer(DigiIterator begin, DigiIterator end)
Copy adc counts from PixelDigis into the buffer, identify seeds.
uint16_t *__restrict__ uint16_t const *__restrict__ adc
const int theConversionFactor