44 std::vector<std::pair<uint32_t,std::vector<uint32_t> > >
selectAPVs()
const;
55 findingRecord<SiStripBadModuleRcd>();
79 auto quality = std::make_unique<SiStripQuality>();
85 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource")<<
"[produce] number of selected dets to be removed " << selDetIds.size() <<std::endl;
88 for (
const auto selId : selDetIds ) {
91 unsigned short firstBadStrip{0};
92 unsigned short NconsecutiveBadStrips = reader->getNumberOfApvsAndStripLength(selId).first * 128;
93 unsigned int theBadStripRange{
quality->encode(firstBadStrip,NconsecutiveBadStrips)};
96 ss <<
"detid " << selId <<
" \t" 97 <<
" firstBadStrip " << firstBadStrip <<
"\t " 98 <<
" NconsecutiveBadStrips " << NconsecutiveBadStrips <<
"\t " 99 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec 103 theSiStripVector.push_back(theBadStripRange);
106 edm::LogError(
"SiStripQualityConfigurableFakeESSource") <<
"[produce] detid already exists";
110 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource") << ss.str();
116 std::vector<std::pair<uint32_t,std::vector<uint32_t> > > selAPVs{
selectAPVs()};
117 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource")<<
"[produce] number of selected dets to be removed " << selAPVs.size() <<std::endl;
119 std::stringstream ss;
120 for (
const auto selId : selAPVs ) {
122 auto the_detid = selId.first;
124 for(
const auto apv : selId.second ) {
126 unsigned short firstBadStrip = apv*128;
127 unsigned short NconsecutiveBadStrips = 128;
128 unsigned int theBadStripRange{
quality->encode(firstBadStrip,NconsecutiveBadStrips)};
131 ss <<
"detid " << the_detid <<
" \t" 132 <<
" firstBadStrip " << firstBadStrip <<
"\t " 133 <<
" NconsecutiveBadStrips " << NconsecutiveBadStrips <<
"\t " 134 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec 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, uint32_t
i )
167 return ( requested == 0 ) || ( requested ==
i );
184 std::vector<std::pair<uint32_t,std::vector<uint32_t> > > selList;
188 const uint32_t det{badAPV.getParameter<uint32_t>(
"DetId")};
189 std::vector<uint32_t> apvs{badAPV.getParameter<std::vector<uint32_t> >(
"APVs")};
190 auto pair = std::make_pair(det,apvs);
191 selList.push_back(pair);
199 std::vector<uint32_t> selList;
200 std::stringstream ss;
203 if (
m_printDebug) ss <<
"Bad SubDet " << subDetStr <<
" \t";
206 const std::vector<uint32_t> genericBadDetIds{badComp.getUntrackedParameter<std::vector<uint32_t>>(
"detidList", std::vector<uint32_t>())};
207 const bool anySubDet{ ! genericBadDetIds.empty() };
209 std::cout <<
"genericBadDetIds.size() = " << genericBadDetIds.size() << std::endl;
211 using DetIdIt = std::vector<uint32_t>::const_iterator;
216 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
217 [&genericBadDetIds] ( uint32_t detId ) {
218 std::cout <<
"AnySubDet" << detId << std::endl;
219 return std::find(genericBadDetIds.begin(), genericBadDetIds.end(), detId) != genericBadDetIds.end();
224 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
225 [tTopo,&badComp] ( uint32_t detectorId ) {
226 const DetId detId{detectorId};
228 && _isSel(badComp.getParameter<uint32_t>(
"layer") , tTopo->
tibLayer(detId))
229 && _isSel(badComp.getParameter<uint32_t>(
"bkw_frw"), tTopo->
tibIsZPlusSide(detId) ? 2 : 1 )
230 && _isSel(badComp.getParameter<uint32_t>(
"int_ext"), tTopo->
tibIsInternalString(detId) ? 1 : 2 )
231 && _isSel(badComp.getParameter<uint32_t>(
"ster") , tTopo->
tibIsStereo(detId) ? 1 : ( tTopo->
tibIsRPhi(detId) ? 2 : -1 ))
232 && _isSel(badComp.getParameter<uint32_t>(
"string_"), tTopo->
tibString(detId))
233 && _isSel(badComp.getParameter<uint32_t>(
"detid") , detId.rawId())
238 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
239 [tTopo,&badComp] ( uint32_t detectorId ) {
240 const DetId detId{detectorId};
242 && _isSel(badComp.getParameter<uint32_t>(
"wheel"), tTopo->
tidWheel(detId))
243 && _isSel(badComp.getParameter<uint32_t>(
"side") , tTopo->
tidIsZPlusSide(detId) ? 2 : 1 )
244 && _isSel(badComp.getParameter<uint32_t>(
"ster") , tTopo->
tidIsStereo(detId) ? 1 : ( tTopo->
tidIsRPhi(detId) ? 2 : -1 ) )
245 && _isSel(badComp.getParameter<uint32_t>(
"ring") , tTopo->
tidRing(detId))
246 && _isSel(badComp.getParameter<uint32_t>(
"detid"), detId.rawId())
251 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
252 [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") , tTopo->
tobIsStereo(detId) ? 1 : ( tTopo->
tobIsRPhi(detId) ? 2 : -1 ))
258 && _isSel(badComp.getParameter<uint32_t>(
"rod") , tTopo->
tobRod(detId))
259 && _isSel(badComp.getParameter<uint32_t>(
"detid") , detId.rawId())
264 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList),
265 [tTopo,&badComp] ( uint32_t detectorId ) {
266 const DetId detId{detectorId};
268 && _isSel(badComp.getParameter<uint32_t>(
"wheel") , tTopo->
tecWheel(detId))
269 && _isSel(badComp.getParameter<uint32_t>(
"side") , tTopo->
tecIsZPlusSide(detId) ? 2 : 1 )
270 && _isSel(badComp.getParameter<uint32_t>(
"ster") , tTopo->
tecIsStereo(detId) ? 1 : 2 )
271 && _isSel(badComp.getParameter<uint32_t>(
"petal_bkw_frw"), tTopo->
tecIsFrontPetal(detId) ? 2 : 2)
272 && _isSel(badComp.getParameter<uint32_t>(
"petal") , tTopo->
tecPetalNumber(detId))
273 && _isSel(badComp.getParameter<uint32_t>(
"ring") , tTopo->
tecRing(detId))
274 && _isSel(badComp.getParameter<uint32_t>(
"detid") , detId.rawId())
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
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
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
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
bool tibIsRPhi(const DetId &id) const
static const IOVSyncValue & beginOfTime()
const DepRecordT getRecord() const
bool tobIsZPlusSide(const DetId &id) const
std::vector< std::pair< uint32_t, std::vector< uint32_t > > > selectAPVs() const
SiStripBadModuleConfigurableFakeESSource(const edm::ParameterSet &)
void setIntervalFor(const edm::eventsetup::EventSetupRecordKey &, const edm::IOVSyncValue &iov, edm::ValidityInterval &iValidity) override
bool tecIsFrontPetal(const DetId &id) const
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
bool tecIsZPlusSide(const DetId &id) const
std::pair< ContainerIterator, ContainerIterator > Range
unsigned int tecPetalNumber(const DetId &id) const
#define DEFINE_FWK_EVENTSETUP_SOURCE(type)
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
T const * product() const
unsigned int tobLayer(const DetId &id) const