105 auto badStrips = std::make_unique<SiStripBadStrip>();
112 LogDebug(
"SiPhase2BadStripConfigurableFakeESSource")
113 <<
" There are " << tGeom.
detUnits().size() <<
" modules in this geometry.";
116 for (
auto const& det_u : tGeom.
detUnits()) {
117 const DetId detid = det_u->geographicalId();
118 uint32_t rawId = detid.
rawId();
128 const int nrows = topol.
nrows();
129 const int ncols = topol.ncolumns();
131 LogDebug(
"SiPhase2BadStripConfigurableFakeESSource")
132 <<
"DetId: " << rawId <<
" subdet: " << subid <<
" nrows: " << nrows <<
" ncols: " <<
ncols;
135 std::vector<Phase2TrackerDigi::PackedDigiType> usedChannels;
139 while (usedChannels.size() < nmaxBadStrips) {
140 unsigned short badStripRow = std::floor(CLHEP::RandFlat::shoot(
engine_.get(), 0, nrows));
141 unsigned short badStripCol = std::floor(CLHEP::RandFlat::shoot(
engine_.get(), 0,
ncols));
143 if (
std::find(usedChannels.begin(), usedChannels.end(), badChannel) == usedChannels.end()) {
144 usedChannels.push_back(badChannel);
152 LogDebug(
"SiPhase2BadStripConfigurableFakeESSource")
153 << rawId <<
" (" <<
counter <<
") " 154 <<
" masking " << nmaxBadStrips <<
" strips, used channels size: " << usedChannels.size()
155 <<
", clusters size: " << badChannelsGroups.size();
157 std::vector<unsigned int> theSiStripVector;
160 for (
const auto& [
first, consec] : badChannelsGroups) {
161 unsigned int theBadChannelsRange;
162 theBadChannelsRange = badStrips->encodePhase2(
first, consec);
165 edm::LogInfo(
"SiPhase2BadStripConfigurableFakeESSource")
166 <<
"detid " << rawId <<
" \t" 167 <<
" firstBadStrip " <<
first <<
"\t " 168 <<
" NconsecutiveBadStrips " << consec <<
"\t " 169 <<
" packed integer " << std::hex << theBadChannelsRange <<
std::dec;
171 theSiStripVector.push_back(theBadChannelsRange);
175 if (!badStrips->put(rawId,
range))
177 <<
"[SiPhase2BadStripConfigurableFakeESSource::produce] detid already exists";
186 LogDebug(
"SiPhase2BadStripConfigurableFakeESSource") <<
"end of the detId loops";
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > geomToken_
virtual int nrows() const =0
std::unique_ptr< CLHEP::HepRandomEngine > engine_
const DetContainer & detUnits() const override
Returm a vector of all GeomDet.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
constexpr Detector det() const
get the detector field from this detid
std::map< unsigned short, unsigned short > clusterizeBadChannels(const std::vector< Phase2TrackerDigi::PackedDigiType > &maskedChannels)
ModuleType getDetectorType(DetId) const
static PackedDigiType pixelToChannel(unsigned int row, unsigned int col)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
static constexpr auto TOB
Log< level::Info, false > LogInfo
constexpr uint32_t rawId() const
get the raw id
float badComponentsFraction_
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
std::pair< ContainerIterator, ContainerIterator > Range
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
static constexpr auto TID