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) {
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()));