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 dropDuplicates(conf.getParameter<
bool>(
"DropDuplicates")),
57 thePhase2ReadoutMode(conf.getParameter<
int>(
"Phase2ReadoutMode")),
58 thePhase2DigiBaseline(conf.getParameter<double>(
"Phase2DigiBaseline")),
59 thePhase2KinkADC(conf.getParameter<
int>(
"Phase2KinkADC")),
64 doMissCalibrate(conf.getParameter<
bool>(
"MissCalibrate")),
65 doSplitClusters(conf.getParameter<
bool>(
"SplitClusters")) {
75 desc.add<
int>(
"ChannelThreshold", 1000);
76 desc.add<
bool>(
"MissCalibrate",
true);
77 desc.add<
bool>(
"SplitClusters",
false);
78 desc.add<
int>(
"VCaltoElectronGain", 65);
79 desc.add<
int>(
"VCaltoElectronGain_L1", 65);
80 desc.add<
int>(
"VCaltoElectronOffset", -414);
81 desc.add<
int>(
"VCaltoElectronOffset_L1", -414);
82 desc.add<
int>(
"SeedThreshold", 1000);
83 desc.add<
int>(
"ClusterThreshold_L1", 4000);
84 desc.add<
int>(
"ClusterThreshold", 4000);
85 desc.add<
double>(
"ElectronPerADCGain", 135.);
86 desc.add<
bool>(
"DropDuplicates",
true);
87 desc.add<
bool>(
"Phase2Calibration",
false);
88 desc.add<
int>(
"Phase2ReadoutMode", -1);
89 desc.add<
double>(
"Phase2DigiBaseline", 1200.);
90 desc.add<
int>(
"Phase2KinkADC", 8);
102 int nrows = topol.
nrows();
130 template <
typename T>
134 const std::vector<short>& badChannels,
136 typename T::const_iterator begin =
input.begin();
137 typename T::const_iterator
end =
input.end();
141 edm::LogError(
"PixelThresholdClusterizer") <<
"@SUB=PixelThresholdClusterizer::clusterizeDetUnitT()" 142 <<
" No digis to clusterize";
164 for (
unsigned int i = 0;
i <
theSeeds.size();
i++) {
215 for (
int i = 0;
i < ci->size(); ++
i) {
227 #ifdef PIXELREGRESSION 228 static std::atomic<int> s_ic = 0;
237 edm::LogWarning(
"PixelThresholdClusterizer") <<
" copy_to_buffer called with empty or invalid range" << std::endl;
256 (*theSiPixelGainCalibrationService_)
265 auto adc = di->adc();
275 #ifdef PIXELREGRESSION 276 static std::atomic<int> eqD = 0;
280 int col = di->column();
282 int adc = (di->flag() != 0) ? di->adc() * 10 :
electron[
i];
285 #ifdef PIXELREGRESSION 289 std::cout <<
"VI " << eqD <<
' ' << ic <<
' ' <<
end - begin <<
' ' <<
i <<
' ' << di->adc() <<
' ' <<
adc <<
' ' 290 << adcOld << std::endl;
305 switch (occurrence) {
334 for (
int i = 0;
i < ci->size(); ++
i) {
366 const int dualslope =
int(dualslopeparam <= 1 ? 1. :
pow(2, dualslopeparam - 1));
393 float DBpedestal =
pedestal * DBgain;
399 float vcal =
adc * DBgain - DBpedestal;
437 std::stack<SiPixelCluster::PixelPos, std::vector<SiPixelCluster::PixelPos> > dead_pixel_stack;
464 acluster.
add(pix, seed_adc);
465 cldata.
add(pix, seed_adc);
468 bool dead_flag =
false;
469 while (!acluster.
empty()) {
471 auto curInd = acluster.
top();
473 for (
auto c =
std::max(0,
int(acluster.
y[curInd]) - 1);
476 for (
auto r =
std::max(0,
int(acluster.
x[curInd]) - 1);
482 if (!acluster.
add(newpix, newpix_adc))
486 cldata.
add(newpix, newpix_adc);
530 bool have_second_cluster =
false;
531 while (!dead_pixel_stack.empty()) {
534 dead_pixel_stack.pop();
542 output.push_back(second_cluster);
543 have_second_cluster =
true;
548 const std::vector<SiPixelCluster::Pixel>& branch_pixels = second_cluster.
pixels();
549 for (
unsigned int i = 0;
i < branch_pixels.size();
i++) {
550 auto const temp_x = branch_pixels[
i].x;
551 auto const temp_y = branch_pixels[
i].y;
552 auto const temp_adc = branch_pixels[
i].adc;
554 cluster.
add(newpix, temp_adc);
560 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)
int index(int row, int col) const
Definition of indexing within the buffer.
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
std::vector< uint8_t > thePixelOccurrence
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_
def remove(d, key, TELL=False)
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)
const bool dropDuplicates
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