95 edm::LogInfo(
"SiPhase2BadStripChannelBuilder") <<
"... creating dummy SiStripBadStrip Data" << std::endl;
97 auto obj = std::make_unique<SiStripBadStrip>();
105 <<
" There are " <<
tGeom_->detUnits().size() <<
" modules in this geometry." << std::endl;
107 for (
auto const& det_u :
tGeom_->detUnits()) {
108 const DetId detid = det_u->geographicalId();
109 uint32_t rawId = detid.
rawId();
114 LogDebug(
"SiPhase2BadStripChannelBuilder") << rawId <<
" is a " << subid <<
" det" << std::endl;
120 const int nrows = topol.
nrows();
121 const int ncols = topol.ncolumns();
123 LogDebug(
"SiPhase2BadStripChannelBuilder")
124 <<
"DetId: " << rawId <<
" subdet: " << subid <<
" nrows: " << nrows <<
" ncols: " <<
ncols << std::endl;
126 std::vector<unsigned int> theSiStripVector;
130 LogDebug(
"SiPhase2BadStripChannelBuilder") <<
"using the NAIVE algorithm" << std::endl;
132 unsigned short firstBadStrip = std::floor(CLHEP::RandFlat::shoot(
engine_, 0, nrows));
133 unsigned short NconsecutiveBadStrips = std::floor(CLHEP::RandFlat::shoot(
engine_, 1, 10));
136 if (firstBadStrip + NconsecutiveBadStrips > nrows) {
137 NconsecutiveBadStrips = nrows - firstBadStrip;
140 unsigned int theBadStripRange;
141 theBadStripRange =
obj->encodePhase2(firstBadStrip, NconsecutiveBadStrips);
145 <<
"detid " << rawId <<
" \t" 146 <<
" firstBadStrip " << firstBadStrip <<
"\t " 147 <<
" NconsecutiveBadStrips " << NconsecutiveBadStrips <<
"\t " 148 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec << std::endl;
150 theSiStripVector.push_back(theBadStripRange);
154 LogDebug(
"SiPhase2BadStripChannelBuilder") <<
"using the RANDOM algorithm" << std::endl;
157 std::vector<Phase2TrackerDigi::PackedDigiType> usedChannels;
161 LogDebug(
"SiPhase2BadStripChannelBuilder")
162 << __FUNCTION__ <<
" " << __LINE__ <<
" will mask: " << nmaxBadStrips <<
" strips" << std::endl;
164 while (usedChannels.size() < nmaxBadStrips) {
165 unsigned short badStripRow = std::floor(CLHEP::RandFlat::shoot(
engine_, 0, nrows));
166 unsigned short badStripCol = std::floor(CLHEP::RandFlat::shoot(
engine_, 0,
ncols));
169 LogDebug(
"SiPhase2BadStripChannelBuilder")
170 << __FUNCTION__ <<
" " << __LINE__ <<
": masking channel " << badChannel <<
" (" << badStripRow
171 <<
"," << badStripCol <<
")" << std::endl;
173 if (
std::find(usedChannels.begin(), usedChannels.end(), badChannel) == usedChannels.end()) {
174 usedChannels.push_back(badChannel);
180 for (
const auto& [
first, consec] : badChannelsGroups) {
181 unsigned int theBadChannelsRange;
182 theBadChannelsRange =
obj->encodePhase2(
first, consec);
186 <<
"detid " << rawId <<
" \t" 187 <<
" firstBadStrip " <<
first <<
"\t " 188 <<
" NconsecutiveBadStrips " << consec <<
"\t " 189 <<
" packed integer " << std::hex << theBadChannelsRange <<
std::dec << std::endl;
191 theSiStripVector.push_back(theBadChannelsRange);
198 throw cms::Exception(
"Inconsistent configuration") <<
"Did not specifiy the right algorithm to be run";
204 <<
"[SiPhase2BadStripChannelBuilder::getNewObject] detid already exists" << std::endl;
221 edm::LogError(
"SiPhase2BadStripChannelBuilder") <<
"Service is unavailable" << std::endl;
cond::Time_t beginOfTime() const
virtual int nrows() const =0
Log< level::Error, false > LogError
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
void createOneIOV(const T &payload, cond::Time_t firstSinceTime, const std::string &recordName)
CLHEP::HepRandomEngine * engine_
std::unique_ptr< TrackerGeometry > tGeom_
void appendOneIOV(const T &payload, cond::Time_t sinceTime, const std::string &recordName)
bool isNewTagRequest(const std::string &recordName)
cond::Time_t currentTime() 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
std::map< unsigned short, unsigned short > clusterizeBadChannels(const std::vector< Phase2TrackerDigi::PackedDigiType > &maskedChannels)
constexpr uint32_t rawId() const
get the raw id
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
std::pair< ContainerIterator, ContainerIterator > Range
const float badComponentsFraction_
badChannelAlgo theBCAlgo_
static constexpr auto TID