51 std::vector<std::pair<uint32_t, std::vector<uint32_t>>>
selectAPVs()
const;
58 : trackTopoToken_(setWhatProduced(this).consumes()) {
59 findingRecord<SiStripBadModuleRcd>();
79 using namespace edm::es;
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) {
221 std::cout <<
"AnySubDet" << detId << std::endl;
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) {
228 const DetId detId{detectorId};
230 _isSel(badComp.getParameter<uint32_t>(
"layer"), tTopo->
tibLayer(detId)) &&
231 _isSel(badComp.getParameter<uint32_t>(
"bkw_frw"), tTopo->
tibIsZPlusSide(detId) ? 2 : 1) &&
232 _isSel(badComp.getParameter<uint32_t>(
"int_ext"), tTopo->
tibIsInternalString(detId) ? 1 : 2) &&
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) {
241 const DetId detId{detectorId};
243 _isSel(badComp.getParameter<uint32_t>(
"wheel"), tTopo->
tidWheel(detId)) &&
244 _isSel(badComp.getParameter<uint32_t>(
"side"), tTopo->
tidIsZPlusSide(detId) ? 2 : 1) &&
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) {
253 const DetId detId{detectorId};
255 _isSel(badComp.getParameter<uint32_t>(
"layer"), tTopo->
tobLayer(detId)) &&
256 _isSel(badComp.getParameter<uint32_t>(
"bkw_frw"), tTopo->
tobIsZPlusSide(detId) ? 2 : 1) &&
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) {
265 const DetId detId{detectorId};
267 _isSel(badComp.getParameter<uint32_t>(
"wheel"), tTopo->
tecWheel(detId)) &&
268 _isSel(badComp.getParameter<uint32_t>(
"side"), tTopo->
tecIsZPlusSide(detId) ? 2 : 1) &&
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) &&
271 _isSel(badComp.getParameter<uint32_t>(
"petal"), tTopo->
tecPetalNumber(detId)) &&
272 _isSel(badComp.getParameter<uint32_t>(
"ring"), tTopo->
tecRing(detId)) &&
273 _isSel(badComp.getParameter<uint32_t>(
"detid"), detId.rawId()));
T getUntrackedParameter(std::string const &, T const &) const
unsigned int tibLayer(const DetId &id) const
unsigned int tibString(const DetId &id) const
unsigned int tidRing(const DetId &id) const
bool tobIsStereo(const DetId &id) const
std::vector< edm::ParameterSet > Parameters
static constexpr auto TID
const edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackTopoToken_
unsigned int tecRing(const DetId &id) const
ring id
static const IOVSyncValue & endOfTime()
constexpr uint32_t rawId() const
get the raw id
unsigned int tidWheel(const DetId &id) 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)
bool tobIsRPhi(const DetId &id) const
bool tidIsStereo(const DetId &id) const
bool tibIsZPlusSide(const DetId &id) const
bool tecIsStereo(const DetId &id) const
std::unique_ptr< SiStripBadStrip > ReturnType
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
bool tibIsRPhi(const DetId &id) const
static const IOVSyncValue & beginOfTime()
bool tobIsZPlusSide(const DetId &id) const
static constexpr auto UNKNOWN
std::vector< std::pair< uint32_t, std::vector< uint32_t > > > selectAPVs() const
const std::pair< unsigned short, double > getNumberOfApvsAndStripLength(uint32_t detId) const
SiStripDetInfo read(std::string filePath)
SiStripBadModuleConfigurableFakeESSource(const edm::ParameterSet &)
static constexpr auto TOB
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
bool tecIsFrontPetal(const DetId &id) const
Log< level::Info, false > LogInfo
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
bool tidIsRPhi(const DetId &id) const
bool tidIsZPlusSide(const DetId &id) const
std::vector< uint32_t > selectDetectors(const TrackerTopology *tTopo, const std::vector< uint32_t > &detIds) const
bool tibIsStereo(const DetId &id) const
T getParameter(std::string const &) const
static constexpr auto TIB
bool tecIsZPlusSide(const DetId &id) const
__host__ __device__ constexpr RandomIt lower_bound(RandomIt first, RandomIt last, const T &value, Compare comp={})
std::pair< ContainerIterator, ContainerIterator > Range
std::string fullPath() const
unsigned int tecPetalNumber(const DetId &id) const
ReturnType produce(const SiStripBadModuleRcd &)
Parameters m_badComponentList
unsigned int tobRod(const DetId &id) const
bool tibIsInternalString(const DetId &id) const
unsigned int tecWheel(const DetId &id) const
const std::vector< uint32_t > & getAllDetIds() const noexcept
static constexpr auto TEC
unsigned int tobLayer(const DetId &id) const