51 std::vector<std::pair<uint32_t, std::vector<uint32_t>>>
selectAPVs()
const;
58 : trackTopoToken_(setWhatProduced(this).consumes()) {
59 findingRecord<SiStripBadModuleRcd>();
88 <<
"[produce] number of selected dets to be removed " << selDetIds.size() << std::endl;
91 for (
const auto selId : selDetIds) {
94 unsigned short firstBadStrip{0};
96 unsigned int theBadStripRange{
quality->encode(firstBadStrip, NconsecutiveBadStrips)};
99 ss <<
"detid " << selId <<
" \t" 100 <<
" firstBadStrip " << firstBadStrip <<
"\t " 101 <<
" NconsecutiveBadStrips " << NconsecutiveBadStrips <<
"\t " 102 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec << std::endl;
105 theSiStripVector.push_back(theBadStripRange);
108 edm::LogError(
"SiStripQualityConfigurableFakeESSource") <<
"[produce] detid already exists";
112 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource") <<
ss.str();
117 std::vector<std::pair<uint32_t, std::vector<uint32_t>>> selAPVs{
selectAPVs()};
119 <<
"[produce] number of selected dets to be removed " << selAPVs.size() << std::endl;
121 std::stringstream
ss;
122 for (
const auto& selId : selAPVs) {
124 auto the_detid = selId.first;
126 for (
const auto apv : selId.second) {
127 unsigned short firstBadStrip = apv * 128;
128 unsigned short NconsecutiveBadStrips = 128;
129 unsigned int theBadStripRange{
quality->encode(firstBadStrip, NconsecutiveBadStrips)};
132 ss <<
"detid " << the_detid <<
" \t" 133 <<
" firstBadStrip " << firstBadStrip <<
"\t " 134 <<
" NconsecutiveBadStrips " << NconsecutiveBadStrips <<
"\t " 135 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec << std::endl;
138 theSiStripVector.push_back(theBadStripRange);
142 edm::LogError(
"SiStripQualityConfigurableFakeESSource") <<
"[produce] detid already exists";
147 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource") <<
ss.str();
154 std::stringstream ss1;
155 for (
const auto& badComp :
quality->getBadComponentList()) {
156 ss1 <<
"bad module " << badComp.detid <<
" " << badComp.BadModule <<
"\n";
158 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource") << ss1.str();
165 bool _isSel(uint32_t requested,
167 return (requested == 0) || (requested ==
i);
172 if (subDetStr ==
"TIB")
174 else if (subDetStr ==
"TID")
176 else if (subDetStr ==
"TOB")
178 else if (subDetStr ==
"TEC")
185 std::vector<std::pair<uint32_t, std::vector<uint32_t>>> selList;
189 const uint32_t det{badAPV.getParameter<uint32_t>(
"DetId")};
190 std::vector<uint32_t> apvs{badAPV.getParameter<std::vector<uint32_t>>(
"APVs")};
191 auto pair = std::make_pair(det, apvs);
192 selList.push_back(pair);
198 const TrackerTopology* tTopo,
const std::vector<uint32_t>& detIds)
const {
199 std::vector<uint32_t> selList;
200 std::stringstream
ss;
204 ss <<
"Bad SubDet " << subDetStr <<
" \t";
207 const std::vector<uint32_t> genericBadDetIds{
208 badComp.getUntrackedParameter<std::vector<uint32_t>>(
"detidList", std::vector<uint32_t>())};
209 const bool anySubDet{!genericBadDetIds.empty()};
211 std::cout <<
"genericBadDetIds.size() = " << genericBadDetIds.size() << std::endl;
213 using DetIdIt = std::vector<uint32_t>::const_iterator;
220 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [&genericBadDetIds](uint32_t
detId) {
222 return std::find(genericBadDetIds.begin(), genericBadDetIds.end(),
detId) != genericBadDetIds.end();
227 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [tTopo, &badComp](uint32_t detectorId) {
230 _isSel(badComp.getParameter<uint32_t>(
"layer"), tTopo->
tibLayer(
detId)) &&
233 _isSel(badComp.getParameter<uint32_t>(
"ster"),
235 _isSel(badComp.getParameter<uint32_t>(
"string_"), tTopo->
tibString(
detId)) &&
236 _isSel(badComp.getParameter<uint32_t>(
"detid"),
detId.rawId()));
240 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [tTopo, &badComp](uint32_t detectorId) {
243 _isSel(badComp.getParameter<uint32_t>(
"wheel"), tTopo->
tidWheel(
detId)) &&
245 _isSel(badComp.getParameter<uint32_t>(
"ster"),
247 _isSel(badComp.getParameter<uint32_t>(
"ring"), tTopo->
tidRing(
detId)) &&
248 _isSel(badComp.getParameter<uint32_t>(
"detid"),
detId.rawId()));
252 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [tTopo, &badComp](uint32_t detectorId) {
255 _isSel(badComp.getParameter<uint32_t>(
"layer"), tTopo->
tobLayer(
detId)) &&
257 _isSel(badComp.getParameter<uint32_t>(
"ster"),
259 _isSel(badComp.getParameter<uint32_t>(
"rod"), tTopo->
tobRod(
detId)) &&
260 _isSel(badComp.getParameter<uint32_t>(
"detid"),
detId.rawId()));
264 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [tTopo, &badComp](uint32_t detectorId) {
267 _isSel(badComp.getParameter<uint32_t>(
"wheel"), tTopo->
tecWheel(
detId)) &&
269 _isSel(badComp.getParameter<uint32_t>(
"ster"), tTopo->
tecIsStereo(
detId) ? 1 : 2) &&
270 _isSel(badComp.getParameter<uint32_t>(
"petal_bkw_frw"), tTopo->
tecIsFrontPetal(
detId) ? 2 : 2) &&
272 _isSel(badComp.getParameter<uint32_t>(
"ring"), tTopo->
tecRing(
detId)) &&
273 _isSel(badComp.getParameter<uint32_t>(
"detid"),
detId.rawId()));
unsigned int tecPetalNumber(const DetId &id) const
std::vector< std::pair< uint32_t, std::vector< uint32_t > > > selectAPVs() const
bool tidIsZPlusSide(const DetId &id) const
T getParameter(std::string const &) const
unsigned int tobLayer(const DetId &id) const
bool tibIsZPlusSide(const DetId &id) const
std::string fullPath() const
std::vector< edm::ParameterSet > Parameters
bool tecIsFrontPetal(const DetId &id) const
static constexpr auto TID
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackTopoToken_
unsigned int tidWheel(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
static const IOVSyncValue & endOfTime()
unsigned int tibString(const DetId &id) const
std::vector< uint32_t > selectDetectors(const TrackerTopology *tTopo, const std::vector< uint32_t > &detIds) const
~SiStripBadModuleConfigurableFakeESSource() override
Log< level::Error, false > LogError
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
unsigned int tecRing(const DetId &id) const
ring id
bool tibIsStereo(const DetId &id) const
T getUntrackedParameter(std::string const &, T const &) const
bool tobIsStereo(const DetId &id) const
bool tibIsRPhi(const DetId &id) const
std::unique_ptr< SiStripBadStrip > ReturnType
static const IOVSyncValue & beginOfTime()
static constexpr auto UNKNOWN
SiStripDetInfo read(std::string filePath)
SiStripBadModuleConfigurableFakeESSource(const edm::ParameterSet &)
bool tobIsZPlusSide(const DetId &id) const
static constexpr auto TOB
bool tobIsRPhi(const DetId &id) const
bool tidIsRPhi(const DetId &id) const
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
Log< level::Info, false > LogInfo
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
constexpr uint32_t rawId() const
get the raw id
bool tecIsZPlusSide(const DetId &id) const
bool tecIsStereo(const DetId &id) const
bool tibIsInternalString(const DetId &id) const
unsigned int tobRod(const DetId &id) const
static constexpr auto TIB
bool tidIsStereo(const DetId &id) const
std::pair< ContainerIterator, ContainerIterator > Range
unsigned int tidRing(const DetId &id) const
ReturnType produce(const SiStripBadModuleRcd &)
unsigned int tibLayer(const DetId &id) const
Parameters m_badComponentList
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
const std::vector< uint32_t > & getAllDetIds() const noexcept
static constexpr auto TEC