18 #include "CLHEP/Random/RandFlat.h"
23 : conf_(conf), dn0(dn), sn0(sn), pn0(pn), rn0(rn) {
33 std::cout <<
"FP420ClusterMain constructor: ElectronPerADC = " << ElectronPerADC_ << std::endl;
34 std::cout <<
" clusterMode = " << clusterMode_ << std::endl;
35 std::cout <<
" ChannelThreshold = " << ChannelThreshold << std::endl;
36 std::cout <<
" SeedThreshold = " << SeedThreshold << std::endl;
37 std::cout <<
" ClusterThreshold = " << ClusterThreshold << std::endl;
38 std::cout <<
" MaxVoidsInCluster = " << MaxVoidsInCluster << std::endl;
70 std::cout <<
"FP420ClusterMain constructor: sn0 = " <<
sn0 <<
" pn0=" <<
pn0 <<
" dn0=" <<
dn0 <<
" rn0=" <<
rn0
72 std::cout <<
"FP420ClusterMain constructor: ENC = " <<
ENC_ << std::endl;
83 std::cout <<
"using a SingleNoiseValue and good electrode flags" << std::endl;
87 std::cout <<
"using Noise and BadElectrode flags accessed from DB" << std::endl;
91 if (clusterMode_ ==
"ClusterProducerFP420") {
99 std::cout <<
"ERROR:FP420ClusterMain: No valid clusterizer selected" << std::endl;
114 std::vector<ClusterNoiseFP420>& electrodnoise)
124 std::cout <<
"FP420ClusterMain: OK1" << std::endl;
127 int number_detunits = 0;
128 int number_localelectroderechits = 0;
138 for (
int det = 1; det <
dn0; det++) {
139 for (
int sector = 1; sector <
sn0; sector++) {
140 for (
int zmodule = 1; zmodule <
pn0; zmodule++) {
145 std::cout <<
" FP420ClusterMain:1 run loop index no iu = " << detID << std::endl;
171 std::vector<HDigiFP420> dcollector;
174 std::cout <<
" FP420ClusterMain:2 number_detunits = " << number_detunits << std::endl;
176 digiRange = input->get(detID);
181 std::cout <<
" FP420ClusterMain: input->get DONE dcollector.size()=" << dcollector.size() << std::endl;
186 for (; sort_begin != sort_end; ++sort_begin) {
187 dcollector.push_back(*sort_begin);
189 if (!dcollector.empty()) {
193 std::cout <<
" FP420ClusterMain: channel Begin = " << (digiRangeIteratorBegin)->channel() << std::endl;
194 std::cout <<
" FP420ClusterMain: channel end = " << (digiRangeIteratorEnd - 1)->channel() << std::endl;
197 std::cout <<
" FP420ClusterMain:3 noise treatment " << std::endl;
200 std::vector<ClusterFP420> collector;
218 for (
int electrode = 0; electrode <
numStrips; ++electrode) {
221 theElectrodData.
setData(noise, badFlag);
222 vnoise.push_back(theElectrodData);
226 std::cout <<
" FP420ClusterMain:5 BadElectrodeProbability added " << std::endl;
234 digiRangeIteratorBegin, digiRangeIteratorEnd, detID, vnoise,
xytype,
verbosity);
237 std::cout <<
" FP420ClusterMain:6 threeThreshold OK " << std::endl;
255 if (!collector.empty()) {
257 inputRange.first = collector.begin();
258 inputRange.second = collector.end();
261 std::cout <<
" FP420ClusterMain:7 collector.size()>0 " << std::endl;
266 unsigned int detID0 = 0;
268 std::cout <<
" FP420ClusterMain:8 first soutput->put " << std::endl;
270 soutput->
put(inputRange, detID0);
275 std::cout <<
" FP420ClusterMain:9 soutput->put " << std::endl;
277 soutput->
put(inputRange, detID);
279 number_localelectroderechits += collector.size();
284 << number_localelectroderechits <<
" ClusterFP420s in " << number_detunits <<
" DetUnits."
295 for (
int det = 1; det <
dn0; det++) {
296 for (
int sector = 1; sector <
sn0; sector++) {
297 for (
int zmodule = 1; zmodule <
pn0; zmodule++) {
301 std::cout <<
" iu = " << iu <<
" sector = " << sector <<
" zmodule = " << zmodule <<
" zside = " <<
zside
302 <<
" det=" << det << std::endl;
303 std::vector<ClusterFP420> collector;
306 outputRange = soutput->
get(iu);
310 for (; sort_begin != sort_end; ++sort_begin) {
311 collector.push_back(*sort_begin);
315 std::cout <<
" =========== FP420ClusterMain:check: iu= " << iu <<
" zside = " <<
zside << std::endl;
316 std::cout <<
" ======renew collector size = " << collector.size() << std::endl;
319 std::vector<ClusterFP420>::const_iterator simHitIter = collector.begin();
320 std::vector<ClusterFP420>::const_iterator simHitIterEnd = collector.end();
322 for (; simHitIter != simHitIterEnd; ++simHitIter) {
331 for (
unsigned int i = 0;
i < icluster.
amplitudes().size();
i++) {
336 std::cout <<
" =======================" << std::endl;
355 std::cout <<
"======= FP420ClusterMain: end of check " << std::endl;
T getUntrackedParameter(std::string const &, T const &) const
void run(edm::Handle< DigiCollectionFP420 > &input, ClusterCollectionFP420 *soutput, std::vector< ClusterNoiseFP420 > &noise)
Runs the algorithm.
std::vector< ClusterFP420 >::const_iterator ContainerIterator
ClusterProducerFP420 * threeThreshold_
std::vector< HDigiFP420 >::const_iterator ContainerIterator
std::vector< ClusterNoiseFP420::ElectrodData > ElectrodNoiseVector
void put(Range input, unsigned int detID)
const std::vector< short > & amplitudes() const
double BadElectrodeProbability_
static std::string const input
float barycenterW() const
static unsigned packMYIndex(int rn0, int pn0, int sn0, int det, int zside, int sector, int zmodule)
std::pair< ContainerIterator, ContainerIterator > Range
const Range get(unsigned int detID) const
T getParameter(std::string const &) const
FP420ClusterMain(const edm::ParameterSet &conf, int dn, int sn, int pn, int rn)
std::vector< ClusterFP420 > clusterizeDetUnitPixels(HDigiFP420Iter begin, HDigiFP420Iter end, unsigned int detid, const ElectrodNoiseVector &vnoise, unsigned int xytype, int verb)
bool UseNoiseBadElectrodeFlagFromDB_
std::pair< ContainerIterator, ContainerIterator > Range