44 conf_(conf), bufferAlreadySet(
false), theNumOfRows(0), theNumOfCols(0), detid_(0)
48 conf_.getParameter<
int>(
"ChannelThreshold");
50 conf_.getParameter<
int>(
"SeedThreshold");
52 conf_.getParameter<
double>(
"ClusterThreshold");
54 conf_.getParameter<
int>(
"VCaltoElectronGain");
56 conf_.getParameter<
int>(
"VCaltoElectronOffset");
60 doMissCalibrate=conf_.getUntrackedParameter<
bool>(
"MissCalibrate",
true);
61 doSplitClusters = conf.
getParameter<
bool>(
"SplitClusters");
62 theBuffer.setSize( theNumOfRows, theNumOfCols );
77 int nrows = topol.
nrows();
83 if ( nrows > theBuffer.rows() ||
84 ncols > theBuffer.columns() )
92 theBuffer.setSize(nrows,ncols);
93 bufferAlreadySet =
true;
107 const std::vector<short>& badChannels,
117 if ( !
setup(pixDet) )
120 detid_ = input.
detId();
124 copy_to_buffer(begin, end);
134 for (
unsigned int i = 0;
i < theSeeds.size();
i++)
139 if ( theBuffer(theSeeds[
i]) >= theSeedThreshold )
146 if ( cluster.
charge() >= theClusterThreshold)
158 clear_buffer(begin, end);
175 theBuffer.set_adc( di->row(), di->column(), 0 );
187 int col = di->column();
188 int adc = calibrate(di->adc(),col,row);
189 if ( adc >= thePixelThreshold)
191 theBuffer.set_adc( row, col, adc);
192 if ( adc >= theSeedThreshold)
207 if ( doMissCalibrate )
211 if ( !theSiPixelGainCalibrationService_->isDead(detid_,col,row) &&
212 !theSiPixelGainCalibrationService_->isNoisy(detid_,col,row) )
223 float DBgain = theSiPixelGainCalibrationService_->getGain(detid_, col, row);
224 float DBpedestal = theSiPixelGainCalibrationService_->getPedestal(detid_, col, row) * DBgain;
231 float vcal = adc * DBgain - DBpedestal;
246 electrons = int( vcal * theConversionFactor + theOffset);
252 const float gain = 135.;
253 const float pedestal = 0.;
254 electrons = int(adc * gain + pedestal);
270 stack<SiPixelCluster::PixelPos, vector<SiPixelCluster::PixelPos> > pixel_stack;
271 stack<SiPixelCluster::PixelPos, vector<SiPixelCluster::PixelPos> > dead_pixel_stack;
279 if ( theSiPixelGainCalibrationService_->isDead(detid_,pix.
col(),pix.
row()) ||
280 theSiPixelGainCalibrationService_->isNoisy(detid_,pix.
col(),pix.
row()) )
283 theBuffer.set_adc(pix, 1);
287 seed_adc = theBuffer(pix.
row(), pix.
col());
288 theBuffer.set_adc( pix, 1);
294 pixel_stack.push( pix);
295 bool dead_flag =
false;
296 while ( ! pixel_stack.empty())
300 for (
int r = curpix.
row()-1;
r <= curpix.
row()+1; ++
r)
302 for (
int c = curpix.
col()-1;
c <= curpix.
col()+1; ++
c)
304 if ( theBuffer(
r,
c) >= thePixelThreshold)
308 cluster.
add( newpix, theBuffer(
r,
c));
309 theBuffer.set_adc( newpix, 1);
310 pixel_stack.push( newpix);
347 if (dead_flag && doSplitClusters)
351 bool have_second_cluster =
false;
352 while ( !dead_pixel_stack.empty() )
356 theBuffer.set_adc(deadpix, 1);
362 if ( second_cluster.
charge() >= theClusterThreshold &&
363 first_cluster.
charge() >= theClusterThreshold )
366 have_second_cluster =
true;
371 const std::vector<SiPixelCluster::Pixel>& branch_pixels = second_cluster.
pixels();
372 for (
unsigned int i = 0;
i<branch_pixels.size();
i++)
374 int temp_x = branch_pixels[
i].x;
375 int temp_y = branch_pixels[
i].y;
376 int temp_adc = branch_pixels[
i].adc;
378 cluster.
add(newpix, temp_adc);}
382 if ( first_cluster.
charge() >= theClusterThreshold && have_second_cluster)
int adc(sample_type sample)
get the ADC sample (12 bits)
T getParameter(std::string const &) const
void push_back(data_type const &d)
void clusterizeDetUnit(const edm::DetSet< PixelDigi > &input, const PixelGeomDetUnit *pixDet, 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...
PixelThresholdClusterizer(edm::ParameterSet const &conf)
det_id_type detId() const
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
~PixelThresholdClusterizer()
edm::DetSet< PixelDigi >::const_iterator DigiIterator
void add(const PixelPos &pix, int adc)
void clear_buffer(DigiIterator begin, DigiIterator end)
Clear the internal buffer array.
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Pixel cluster – collection of neighboring pixels above threshold.
bool setup(const PixelGeomDetUnit *pixDet)
Private helper methods:
int calibrate(int adc, int col, int row)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
const std::vector< Pixel > pixels() const
void copy_to_buffer(DigiIterator begin, DigiIterator end)
Copy adc counts from PixelDigis into the buffer, identify seeds.