45 thePixelThreshold(conf.getParameter<int>(
"ChannelThreshold")),
46 theSeedThreshold(conf.getParameter<int>(
"SeedThreshold")),
47 theClusterThreshold(conf.getParameter<int>(
"ClusterThreshold")),
48 theClusterThreshold_L1(conf.getParameter<int>(
"ClusterThreshold_L1")),
49 theConversionFactor(conf.getParameter<int>(
"VCaltoElectronGain")),
50 theConversionFactor_L1(conf.getParameter<int>(
"VCaltoElectronGain_L1")),
51 theOffset(conf.getParameter<int>(
"VCaltoElectronOffset")),
52 theOffset_L1(conf.getParameter<int>(
"VCaltoElectronOffset_L1")),
53 theElectronPerADCGain(conf.getParameter<double>(
"ElectronPerADCGain")),
54 doPhase2Calibration(conf.getParameter<bool>(
"Phase2Calibration")),
55 thePhase2ReadoutMode(conf.getParameter<int>(
"Phase2ReadoutMode")),
56 thePhase2DigiBaseline(conf.getParameter<double>(
"Phase2DigiBaseline")),
57 thePhase2KinkADC(conf.getParameter<int>(
"Phase2KinkADC")),
62 doMissCalibrate(conf.getParameter<bool>(
"MissCalibrate")),
63 doSplitClusters(conf.getParameter<bool>(
"SplitClusters")) {
72 desc.
add<
int>(
"ChannelThreshold", 1000);
73 desc.
add<
bool>(
"MissCalibrate",
true);
74 desc.
add<
bool>(
"SplitClusters",
false);
75 desc.
add<
int>(
"VCaltoElectronGain", 65);
76 desc.
add<
int>(
"VCaltoElectronGain_L1", 65);
77 desc.
add<
int>(
"VCaltoElectronOffset", -414);
78 desc.
add<
int>(
"VCaltoElectronOffset_L1", -414);
79 desc.
add<
int>(
"SeedThreshold", 1000);
80 desc.
add<
int>(
"ClusterThreshold_L1", 4000);
81 desc.
add<
int>(
"ClusterThreshold", 4000);
82 desc.
add<
double>(
"ElectronPerADCGain", 135.);
83 desc.
add<
bool>(
"Phase2Calibration",
false);
84 desc.
add<
int>(
"Phase2ReadoutMode", -1);
85 desc.
add<
double>(
"Phase2DigiBaseline", 1200.);
86 desc.
add<
int>(
"Phase2KinkADC", 8);
98 int nrows = topol.
nrows();
106 edm::LogWarning(
"setup()") <<
"pixel buffer redefined to" << nrows <<
" * " << ncols;
124 template <
typename T>
128 const std::vector<short>& badChannels,
130 typename T::const_iterator
begin = input.begin();
131 typename T::const_iterator
end = input.end();
156 for (
unsigned int i = 0;
i <
theSeeds.size();
i++) {
165 if (cluster.
charge() >= clusterThreshold) {
205 for (
int i = 0;
i < ci->size(); ++
i) {
217 #ifdef PIXELREGRESSION
218 static std::atomic<int> s_ic = 0;
227 edm::LogWarning(
"PixelThresholdClusterizer") <<
" copy_to_buffer called with empty or invalid range" << std::endl;
232 memset(electron, 0, (end - begin) *
sizeof(
int));
237 electron[
i] =
calibrate(di->adc(), di->column(), di->row());
240 assert(i == (end - begin));
246 (*theSiPixelGainCalibrationService_)
255 auto adc = di->adc();
257 electron[
i] = int(
adc * gain + pedestal);
260 assert(i == (end - begin));
265 #ifdef PIXELREGRESSION
266 static std::atomic<int> eqD = 0;
270 int col = di->column();
272 int adc = (di->flag() != 0) ? di->adc() * 10 : electron[
i];
275 #ifdef PIXELREGRESSION
279 std::cout <<
"VI " << eqD <<
' ' << ic <<
' ' << end - begin <<
' ' << i <<
' ' << di->adc() <<
' ' << adc <<
' '
280 << adcOld << std::endl;
300 assert(i == (end - begin));
307 for (
int i = 0;
i < ci->size(); ++
i) {
333 electrons = int(adc * gain);
336 electrons = int((adc + 0.5) * gain);
339 const int dualslope = int(dualslopeparam <= 1 ? 1. :
pow(2, dualslopeparam - 1));
343 electrons = int((adc + 0.5 * dualslope) * gain);
366 float DBpedestal = pedestal * DBgain;
372 float vcal = adc * DBgain - DBpedestal;
397 electrons = int(adc * gain + pedestal);
410 stack<SiPixelCluster::PixelPos, vector<SiPixelCluster::PixelPos> > dead_pixel_stack;
434 acluster.
add(pix, seed_adc);
435 cldata.
add(pix, seed_adc);
438 bool dead_flag =
false;
439 while (!acluster.
empty()) {
441 auto curInd = acluster.
top();
443 for (
auto c =
std::max(0,
int(acluster.
y[curInd]) - 1);
446 for (
auto r =
std::max(0,
int(acluster.
x[curInd]) - 1);
499 bool have_second_cluster =
false;
500 while (!dead_pixel_stack.empty()) {
503 dead_pixel_stack.pop();
510 if (second_cluster.
charge() >= clusterThreshold && first_cluster.
charge() >= clusterThreshold) {
512 have_second_cluster =
true;
517 const std::vector<SiPixelCluster::Pixel>& branch_pixels = second_cluster.
pixels();
518 for (
unsigned int i = 0;
i < branch_pixels.size();
i++) {
519 int temp_x = branch_pixels[
i].x;
520 int temp_y = branch_pixels[
i].y;
521 int temp_adc = branch_pixels[
i].adc;
523 cluster.
add(newpix, temp_adc);
528 if (first_cluster.
charge() >= clusterThreshold && have_second_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...
void push_back(data_type const &d)
static void fillPSetDescription(edm::ParameterSetDescription &desc)
SiPixelArrayBuffer theBuffer
Data storage.
const edm::EventSetup & c
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
const int thePhase2KinkADC
void set_adc(int row, int col, int adc)
static std::string const input
const int thePhase2ReadoutMode
const int theSeedThreshold
void add_adc(int row, int col, int adc)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
edm::DetSet< PixelDigi >::const_iterator DigiIterator
const bool doPhase2Calibration
void add(const PixelPos &pix, int adc)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
virtual float getPedestal(const uint32_t &detID, const int &col, const int &row)=0
constexpr int col() const
const bool doMissCalibrate
int theNumOfRows
Geometry-related information.
unsigned int pxbLayer(const DetId &id) const
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
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
SiPixelGainCalibrationServiceBase * theSiPixelGainCalibrationService_
const double thePhase2DigiBaseline
Pixel cluster – collection of neighboring pixels above threshold.
const bool doSplitClusters
virtual float getGain(const uint32_t &detID, const int &col, const int &row)=0
bool setup(const PixelGeomDetUnit *pixDet)
Private helper methods:
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)
constexpr int row() const
const std::vector< Pixel > pixels() const
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