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")) {
74 desc.add<
int>(
"ChannelThreshold", 1000);
75 desc.add<
bool>(
"MissCalibrate",
true);
76 desc.add<
bool>(
"SplitClusters",
false);
77 desc.add<
int>(
"VCaltoElectronGain", 65);
78 desc.add<
int>(
"VCaltoElectronGain_L1", 65);
79 desc.add<
int>(
"VCaltoElectronOffset", -414);
80 desc.add<
int>(
"VCaltoElectronOffset_L1", -414);
81 desc.add<
int>(
"SeedThreshold", 1000);
82 desc.add<
int>(
"ClusterThreshold_L1", 4000);
83 desc.add<
int>(
"ClusterThreshold", 4000);
84 desc.add<
double>(
"ElectronPerADCGain", 135.);
85 desc.add<
bool>(
"Phase2Calibration",
false);
86 desc.add<
int>(
"Phase2ReadoutMode", -1);
87 desc.add<
double>(
"Phase2DigiBaseline", 1200.);
88 desc.add<
int>(
"Phase2KinkADC", 8);
100 int nrows = topol.
nrows();
128 template <
typename T>
132 const std::vector<short>& badChannels,
134 typename T::const_iterator begin =
input.begin();
135 typename T::const_iterator
end =
input.end();
139 edm::LogError(
"PixelThresholdClusterizer") <<
"@SUB=PixelThresholdClusterizer::clusterizeDetUnitT()" 140 <<
" No digis to clusterize";
162 for (
unsigned int i = 0;
i <
theSeeds.size();
i++) {
213 for (
int i = 0;
i < ci->size(); ++
i) {
225 #ifdef PIXELREGRESSION 226 static std::atomic<int> s_ic = 0;
235 edm::LogWarning(
"PixelThresholdClusterizer") <<
" copy_to_buffer called with empty or invalid range" << std::endl;
254 (*theSiPixelGainCalibrationService_)
263 auto adc = di->adc();
273 #ifdef PIXELREGRESSION 274 static std::atomic<int> eqD = 0;
278 int col = di->column();
280 int adc = (di->flag() != 0) ? di->adc() * 10 :
electron[
i];
283 #ifdef PIXELREGRESSION 287 std::cout <<
"VI " << eqD <<
' ' << ic <<
' ' <<
end - begin <<
' ' <<
i <<
' ' << di->adc() <<
' ' <<
adc <<
' ' 288 << adcOld << std::endl;
302 switch (occurrence) {
331 for (
int i = 0;
i < ci->size(); ++
i) {
363 const int dualslope =
int(dualslopeparam <= 1 ? 1. :
pow(2, dualslopeparam - 1));
390 float DBpedestal =
pedestal * DBgain;
396 float vcal =
adc * DBgain - DBpedestal;
434 std::stack<SiPixelCluster::PixelPos, std::vector<SiPixelCluster::PixelPos> > dead_pixel_stack;
461 acluster.
add(pix, seed_adc);
462 cldata.
add(pix, seed_adc);
465 bool dead_flag =
false;
466 while (!acluster.
empty()) {
468 auto curInd = acluster.
top();
470 for (
auto c =
std::max(0,
int(acluster.
y[curInd]) - 1);
473 for (
auto r =
std::max(0,
int(acluster.
x[curInd]) - 1);
479 if (!acluster.
add(newpix, newpix_adc))
483 cldata.
add(newpix, newpix_adc);
527 bool have_second_cluster =
false;
528 while (!dead_pixel_stack.empty()) {
531 dead_pixel_stack.pop();
539 output.push_back(second_cluster);
540 have_second_cluster =
true;
545 const std::vector<SiPixelCluster::Pixel>& branch_pixels = second_cluster.
pixels();
546 for (
unsigned int i = 0;
i < branch_pixels.size();
i++) {
547 auto const temp_x = branch_pixels[
i].x;
548 auto const temp_y = branch_pixels[
i].y;
549 auto const temp_adc = branch_pixels[
i].adc;
551 cluster.
add(newpix, temp_adc);
557 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)
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