51 std::vector<std::pair<uint32_t, std::vector<uint32_t>>>
selectAPVs()
const;
58 : trackTopoToken_(setWhatProduced(this).consumes()) {
59 findingRecord<SiStripBadModuleRcd>();
84 auto quality = std::make_unique<SiStripQuality>();
89 <<
"[produce] number of selected dets to be removed " << selDetIds.size() << std::endl;
92 for (
const auto selId : selDetIds) {
95 unsigned short firstBadStrip{0};
97 unsigned int theBadStripRange{
quality->encode(firstBadStrip, NconsecutiveBadStrips)};
100 ss <<
"detid " << selId <<
" \t"
101 <<
" firstBadStrip " << firstBadStrip <<
"\t "
102 <<
" NconsecutiveBadStrips " << NconsecutiveBadStrips <<
"\t "
103 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec << std::endl;
106 theSiStripVector.push_back(theBadStripRange);
109 edm::LogError(
"SiStripQualityConfigurableFakeESSource") <<
"[produce] detid already exists";
113 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource") <<
ss.str();
118 std::vector<std::pair<uint32_t, std::vector<uint32_t>>> selAPVs{
selectAPVs()};
120 <<
"[produce] number of selected dets to be removed " << selAPVs.size() << std::endl;
122 std::stringstream
ss;
123 for (
const auto& selId : selAPVs) {
125 auto the_detid = selId.first;
127 for (
const auto apv : selId.second) {
128 unsigned short firstBadStrip = apv * 128;
129 unsigned short NconsecutiveBadStrips = 128;
130 unsigned int theBadStripRange{
quality->encode(firstBadStrip, NconsecutiveBadStrips)};
133 ss <<
"detid " << the_detid <<
" \t"
134 <<
" firstBadStrip " << firstBadStrip <<
"\t "
135 <<
" NconsecutiveBadStrips " << NconsecutiveBadStrips <<
"\t "
136 <<
" packed integer " << std::hex << theBadStripRange <<
std::dec << std::endl;
139 theSiStripVector.push_back(theBadStripRange);
143 edm::LogError(
"SiStripQualityConfigurableFakeESSource") <<
"[produce] detid already exists";
148 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource") <<
ss.str();
155 std::stringstream ss1;
156 for (
const auto& badComp :
quality->getBadComponentList()) {
157 ss1 <<
"bad module " << badComp.detid <<
" " << badComp.BadModule <<
"\n";
159 edm::LogInfo(
"SiStripQualityConfigurableFakeESSource") << ss1.str();
166 bool _isSel(uint32_t requested,
168 return (requested == 0) || (requested ==
i);
173 if (subDetStr ==
"TIB")
175 else if (subDetStr ==
"TID")
177 else if (subDetStr ==
"TOB")
179 else if (subDetStr ==
"TEC")
186 std::vector<std::pair<uint32_t, std::vector<uint32_t>>> selList;
190 const uint32_t det{badAPV.getParameter<uint32_t>(
"DetId")};
191 std::vector<uint32_t> apvs{badAPV.getParameter<std::vector<uint32_t>>(
"APVs")};
192 auto pair = std::make_pair(det, apvs);
193 selList.push_back(pair);
199 const TrackerTopology* tTopo,
const std::vector<uint32_t>& detIds)
const {
200 std::vector<uint32_t> selList;
201 std::stringstream
ss;
205 ss <<
"Bad SubDet " << subDetStr <<
" \t";
208 const std::vector<uint32_t> genericBadDetIds{
209 badComp.getUntrackedParameter<std::vector<uint32_t>>(
"detidList", std::vector<uint32_t>())};
210 const bool anySubDet{!genericBadDetIds.empty()};
212 std::cout <<
"genericBadDetIds.size() = " << genericBadDetIds.size() << std::endl;
214 using DetIdIt = std::vector<uint32_t>::const_iterator;
221 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [&genericBadDetIds](uint32_t detId) {
222 std::cout <<
"AnySubDet" << detId << std::endl;
223 return std::find(genericBadDetIds.begin(), genericBadDetIds.end(), detId) != genericBadDetIds.end();
228 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [tTopo, &badComp](uint32_t detectorId) {
229 const DetId detId{detectorId};
231 _isSel(badComp.getParameter<uint32_t>(
"layer"), tTopo->
tibLayer(detId)) &&
232 _isSel(badComp.getParameter<uint32_t>(
"bkw_frw"), tTopo->
tibIsZPlusSide(detId) ? 2 : 1) &&
233 _isSel(badComp.getParameter<uint32_t>(
"int_ext"), tTopo->
tibIsInternalString(detId) ? 1 : 2) &&
234 _isSel(badComp.getParameter<uint32_t>(
"ster"),
236 _isSel(badComp.getParameter<uint32_t>(
"string_"), tTopo->
tibString(detId)) &&
237 _isSel(badComp.getParameter<uint32_t>(
"detid"), detId.rawId()));
241 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [tTopo, &badComp](uint32_t detectorId) {
242 const DetId detId{detectorId};
244 _isSel(badComp.getParameter<uint32_t>(
"wheel"), tTopo->
tidWheel(detId)) &&
245 _isSel(badComp.getParameter<uint32_t>(
"side"), tTopo->
tidIsZPlusSide(detId) ? 2 : 1) &&
246 _isSel(badComp.getParameter<uint32_t>(
"ster"),
248 _isSel(badComp.getParameter<uint32_t>(
"ring"), tTopo->
tidRing(detId)) &&
249 _isSel(badComp.getParameter<uint32_t>(
"detid"), detId.rawId()));
253 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [tTopo, &badComp](uint32_t detectorId) {
254 const DetId detId{detectorId};
256 _isSel(badComp.getParameter<uint32_t>(
"layer"), tTopo->
tobLayer(detId)) &&
257 _isSel(badComp.getParameter<uint32_t>(
"bkw_frw"), tTopo->
tobIsZPlusSide(detId) ? 2 : 1) &&
258 _isSel(badComp.getParameter<uint32_t>(
"ster"),
260 _isSel(badComp.getParameter<uint32_t>(
"rod"), tTopo->
tobRod(detId)) &&
261 _isSel(badComp.getParameter<uint32_t>(
"detid"), detId.rawId()));
265 std::copy_if(beginDetIt, endDetIt, std::back_inserter(selList), [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()));