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();
135 edm::LogError(
"PixelThresholdClusterizer") <<
"@SUB=PixelThresholdClusterizer::clusterizeDetUnitT()"
136 <<
" No digis to clusterize";
158 for (
unsigned int i = 0;
i <
theSeeds.size();
i++) {
167 if (cluster.
charge() >= clusterThreshold) {
207 for (
int i = 0;
i < ci->size(); ++
i) {
219 #ifdef PIXELREGRESSION
220 static std::atomic<int> s_ic = 0;
229 edm::LogWarning(
"PixelThresholdClusterizer") <<
" copy_to_buffer called with empty or invalid range" << std::endl;
234 memset(electron, 0, (end - begin) *
sizeof(
int));
239 electron[
i] =
calibrate(di->adc(), di->column(), di->row());
242 assert(i == (end - begin));
248 (*theSiPixelGainCalibrationService_)
257 auto adc = di->adc();
259 electron[
i] = int(
adc * gain + pedestal);
262 assert(i == (end - begin));
267 #ifdef PIXELREGRESSION
268 static std::atomic<int> eqD = 0;
272 int col = di->column();
274 int adc = (di->flag() != 0) ? di->adc() * 10 : electron[
i];
277 #ifdef PIXELREGRESSION
281 std::cout <<
"VI " << eqD <<
' ' << ic <<
' ' << end - begin <<
' ' << i <<
' ' << di->adc() <<
' ' << adc <<
' '
282 << adcOld << std::endl;
302 assert(i == (end - begin));
309 for (
int i = 0;
i < ci->size(); ++
i) {
335 electrons = int(adc * gain);
338 electrons = int((adc + 0.5) * gain);
341 const int dualslope = int(dualslopeparam <= 1 ? 1. :
pow(2, dualslopeparam - 1));
345 electrons = int((adc + 0.5 * dualslope) * gain);
368 float DBpedestal = pedestal * DBgain;
374 float vcal = adc * DBgain - DBpedestal;
399 electrons = int(adc * gain + pedestal);
412 stack<SiPixelCluster::PixelPos, vector<SiPixelCluster::PixelPos> > dead_pixel_stack;
436 acluster.
add(pix, seed_adc);
437 cldata.
add(pix, seed_adc);
440 bool dead_flag =
false;
441 while (!acluster.
empty()) {
443 auto curInd = acluster.
top();
445 for (
auto c =
std::max(0,
int(acluster.
y[curInd]) - 1);
448 for (
auto r =
std::max(0,
int(acluster.
x[curInd]) - 1);
501 bool have_second_cluster =
false;
502 while (!dead_pixel_stack.empty()) {
505 dead_pixel_stack.pop();
512 if (second_cluster.
charge() >= clusterThreshold && first_cluster.
charge() >= clusterThreshold) {
514 have_second_cluster =
true;
519 const std::vector<SiPixelCluster::Pixel>& branch_pixels = second_cluster.
pixels();
520 for (
unsigned int i = 0;
i < branch_pixels.size();
i++) {
521 int temp_x = branch_pixels[
i].x;
522 int temp_y = branch_pixels[
i].y;
523 int temp_adc = branch_pixels[
i].adc;
525 cluster.
add(newpix, temp_adc);
530 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
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
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