22 os << std::get<2>(
layer);
32 using LayerPair = std::pair<SeedingLayerSetsBuilder::SeedingLayerId, SeedingLayerSetsBuilder::SeedingLayerId>;
33 using ActiveLayerSetToInactiveSetsMap = std::map<LayerPair, edm::VecArray<LayerPair, 5>>;
34 using Stream = std::stringstream;
35 using Span_t = std::pair<float, float>;
37 ActiveLayerSetToInactiveSetsMap createActiveToInactiveMap() {
38 ActiveLayerSetToInactiveSetsMap
map;
40 auto bpix = [](
int layer) {
43 auto fpix_pos = [](
int disk) {
46 auto fpix_neg = [](
int disk) {
50 auto add_permutations = [&](std::array<SeedingLayerSetsBuilder::SeedingLayerId, 4> quads) {
54 if (quads[0] > quads[1] || quads[2] > quads[3])
57 map[std::make_pair(quads[0], quads[1])].emplace_back(quads[2], quads[3]);
58 }
while (std::next_permutation(quads.begin(), quads.end()));
62 add_permutations({{bpix(1), bpix(2), bpix(3), bpix(4)}});
65 add_permutations({{bpix(1), bpix(2), bpix(3), fpix_pos(1)}});
66 add_permutations({{bpix(1), bpix(2), bpix(3), fpix_neg(1)}});
69 add_permutations({{bpix(1), bpix(2), fpix_pos(1), fpix_pos(2)}});
70 add_permutations({{bpix(1), bpix(2), fpix_neg(1), fpix_neg(2)}});
73 add_permutations({{bpix(1), fpix_pos(1), fpix_pos(2), fpix_pos(3)}});
74 add_permutations({{bpix(1), fpix_neg(1), fpix_neg(2), fpix_neg(3)}});
77 LogDebug(
"PixelInactiveAreaFinder") <<
"Active to inactive mapping";
78 for (
const auto& elem :
map) {
80 for (
const auto& layerPair : elem.second) {
81 ss << layerPair.first <<
"+" << layerPair.second <<
",";
83 LogTrace(
"PixelInactiveAreaFinder") <<
" " << elem.first.first <<
"+" << elem.first.second <<
" => " <<
ss.str();
96 using std::setprecision;
100 ss <<
"subdetid:[" << cspan.
subdetId <<
"]" << deli;
102 ss <<
"layer:[" << cspan.
layer <<
"]" << deli;
104 ss <<
"disk:[" << cspan.
disk <<
"]" << deli;
108 << setprecision(16) << showpos <<
"phi:<" << right << setw(12) << cspan.
phiSpan.first <<
"," << left << setw(12)
109 << cspan.
phiSpan.second <<
">" << deli <<
"z:<" << right << setw(7) << cspan.
zSpan.first <<
"," << left
110 << setw(7) << cspan.
zSpan.second <<
">" << deli << noshowpos <<
"r:<" << right << setw(10) << cspan.
rSpan.first
111 <<
"," << left << setw(10) << cspan.
rSpan.second <<
">" << deli;
117 for (
auto const& spansLayers : spansLayerSets) {
118 ss <<
"Overlapping detGroups:\n";
119 for (
auto const& cspan : spansLayers.first) {
120 detGroupSpanInfo(cspan,
ss);
128 bool phiRangesOverlap(
const Span_t& phiSpanA,
const Span_t& phiSpanB) {
130 std::tie(
x1,
x2) = phiSpanA;
131 std::tie(
y1,
y2) = phiSpanB;
145 bool phiMoreClockwise(
float phiA,
float phiB) {
149 bool phiMoreCounterclockwise(
float phiA,
float phiB) {
155 float zAxisIntersection(
const float zrPointA[2],
const float zrPointB[2]) {
156 return (zrPointB[0] - zrPointA[0]) / (zrPointB[1] - zrPointA[1]) * (-zrPointA[1]) + zrPointA[0];
160 std::pair<float, float>&
range) {
163 if (cspanA.
rSpan.second < cspanB.
rSpan.first) {
166 }
else if (cspanA.
rSpan.first > cspanB.
rSpan.second) {
174 if (cspanUpper.
zSpan.second < cspanLower.
zSpan.first) {
176 const float pointUpperDetGroupL[2] = {cspanUpper.
zSpan.second, cspanUpper.
rSpan.second};
177 const float pointLowerDetGroupL[2] = {cspanLower.
zSpan.first, cspanLower.
rSpan.first};
178 lower = zAxisIntersection(pointUpperDetGroupL, pointLowerDetGroupL);
180 const float pointUpperDetGroupU[2] = {cspanUpper.
zSpan.first, cspanUpper.
rSpan.first};
181 const float pointLowerDetGroupU[2] = {cspanLower.
zSpan.second, cspanLower.
rSpan.second};
182 upper = zAxisIntersection(pointUpperDetGroupU, pointLowerDetGroupU);
183 }
else if (cspanUpper.
zSpan.first <= cspanLower.
zSpan.second && cspanLower.
zSpan.first <= cspanUpper.
zSpan.second) {
185 const float pointUpperDetGroupL[2] = {cspanUpper.
zSpan.second, cspanUpper.
rSpan.first};
186 const float pointLowerDetGroupL[2] = {cspanLower.
zSpan.first, cspanLower.
rSpan.second};
187 lower = zAxisIntersection(pointUpperDetGroupL, pointLowerDetGroupL);
189 const float pointUpperDetGroupU[2] = {cspanUpper.
zSpan.first, cspanUpper.
rSpan.first};
190 const float pointLowerDetGroupU[2] = {cspanLower.
zSpan.second, cspanLower.
rSpan.second};
191 upper = zAxisIntersection(pointUpperDetGroupU, pointLowerDetGroupU);
192 }
else if (cspanUpper.
zSpan.first > cspanLower.
zSpan.second) {
194 const float pointUpperDetGroupL[2] = {cspanUpper.
zSpan.second, cspanUpper.
rSpan.first};
195 const float pointLowerDetGroupL[2] = {cspanLower.
zSpan.first, cspanLower.
rSpan.second};
196 lower = zAxisIntersection(pointUpperDetGroupL, pointLowerDetGroupL);
198 const float pointUpperDetGroupU[2] = {cspanUpper.
zSpan.first, cspanUpper.
rSpan.second};
199 const float pointLowerDetGroupU[2] = {cspanLower.
zSpan.second, cspanLower.
rSpan.first};
200 upper = zAxisIntersection(pointUpperDetGroupU, pointLowerDetGroupU);
205 range = std::pair<float, float>(lower, upper);
210 std::pair<float, float>&
range) {
216 if (cspanA.
zSpan.first < 0 && cspanB.
zSpan.first < 0) {
217 if (cspanA.
zSpan.second < cspanB.
zSpan.first) {
218 cspanFurther = cspanA;
219 cspanNearer = cspanB;
220 }
else if (cspanB.
zSpan.second < cspanA.
zSpan.first) {
221 cspanFurther = cspanB;
222 cspanNearer = cspanA;
225 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, same disk propably. Spans:";
227 detGroupSpanInfo(cspanA,
ss);
229 detGroupSpanInfo(cspanB,
ss);
231 LogTrace(
"PixelInactiveAreaFinder") <<
ss.str();
233 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
237 if (cspanFurther.
rSpan.second > cspanNearer.
rSpan.first) {
238 const float pointA[2] = {cspanFurther.
zSpan.second, cspanFurther.
rSpan.second};
239 const float pointB[2] = {cspanNearer.
zSpan.first, cspanNearer.
rSpan.first};
240 lower = zAxisIntersection(pointA, pointB);
241 if (cspanFurther.
rSpan.first > cspanNearer.
rSpan.second) {
242 const float pointC[2] = {cspanFurther.
zSpan.first, cspanFurther.
rSpan.first};
243 const float pointD[2] = {cspanNearer.
zSpan.second, cspanFurther.
rSpan.second};
244 upper = zAxisIntersection(pointC, pointD);
250 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, further detGroup is lower. Spans:";
252 detGroupSpanInfo(cspanA,
ss);
254 detGroupSpanInfo(cspanB,
ss);
256 LogTrace(
"PixelInactiveAreaFinder") <<
ss.str();
258 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
262 }
else if (cspanA.
zSpan.first > 0 && cspanB.
zSpan.first > 0) {
263 if (cspanA.
zSpan.first > cspanB.
zSpan.second) {
264 cspanFurther = cspanA;
265 cspanNearer = cspanB;
266 }
else if (cspanB.
zSpan.first > cspanA.
zSpan.second) {
267 cspanFurther = cspanB;
268 cspanNearer = cspanA;
271 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, same disk propably. Spans:";
273 detGroupSpanInfo(cspanA,
ss);
275 detGroupSpanInfo(cspanB,
ss);
277 LogTrace(
"PixelInactiveAreaFinder") <<
ss.str();
279 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
283 if (cspanFurther.
rSpan.second > cspanNearer.
rSpan.first) {
284 const float pointA[2] = {cspanFurther.
zSpan.first, cspanFurther.
rSpan.second};
285 const float pointB[2] = {cspanNearer.
zSpan.second, cspanNearer.
rSpan.first};
286 upper = zAxisIntersection(pointA, pointB);
287 if (cspanFurther.
rSpan.first > cspanNearer.
rSpan.second) {
288 const float pointC[2] = {cspanFurther.
zSpan.second, cspanFurther.
rSpan.first};
289 const float pointD[2] = {cspanNearer.
zSpan.first, cspanFurther.
rSpan.second};
290 lower = zAxisIntersection(pointC, pointD);
296 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, further detGroup lower. Spans:";
298 detGroupSpanInfo(cspanA,
ss);
300 detGroupSpanInfo(cspanB,
ss);
302 LogTrace(
"PixelInactiveAreaFinder") <<
ss.str();
304 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
310 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, different sides of z axis. Spans:";
312 detGroupSpanInfo(cspanA,
ss);
314 detGroupSpanInfo(cspanB,
ss);
316 LogTrace(
"PixelInactiveAreaFinder") <<
ss.str();
318 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
322 range = std::pair<float, float>(lower, upper);
328 std::pair<float, float>&
range) {
331 if (cspanEnd.
rSpan.second > cspanBar.
rSpan.first) {
332 if (cspanEnd.
zSpan.second < cspanBar.
zSpan.first) {
334 const float pointA[2] = {cspanEnd.
zSpan.second, cspanEnd.
rSpan.second};
335 const float pointB[2] = {cspanBar.
zSpan.first, cspanBar.
rSpan.first};
336 lower = zAxisIntersection(pointA, pointB);
337 if (cspanEnd.
rSpan.first > cspanBar.
rSpan.second) {
339 const float pointC[2] = {cspanEnd.
zSpan.first, cspanEnd.
rSpan.first};
340 const float pointD[2] = {cspanBar.
zSpan.second, cspanBar.
rSpan.second};
341 upper = zAxisIntersection(pointC, pointD);
345 }
else if (cspanEnd.
zSpan.first > cspanBar.
zSpan.second) {
347 const float pointA[2] = {cspanEnd.
zSpan.first, cspanEnd.
rSpan.second};
348 const float pointB[2] = {cspanBar.
zSpan.second, cspanBar.
rSpan.first};
349 upper = zAxisIntersection(pointA, pointB);
350 if (cspanEnd.
rSpan.first > cspanBar.
rSpan.second) {
351 const float pointC[2] = {cspanEnd.
zSpan.second, cspanEnd.
rSpan.first};
352 const float pointD[2] = {cspanBar.
zSpan.first, cspanBar.
rSpan.second};
353 lower = zAxisIntersection(pointC, pointD);
363 range = std::pair<float, float>(lower, upper);
369 std::pair<edm::VecArray<PixelInactiveAreaFinder::Area, 2>, std::vector<PixelInactiveAreaFinder::LayerSetIndex>>>
374 std::vector<std::pair<VecArray2<Area>, std::vector<LayerSetIndex>>>
ret;
375 for (
auto&
item : spansLayerSets) {
376 auto& innerSpan =
item.first[0];
377 auto& outerSpan =
item.first[1];
380 innerSpan.rSpan.second,
381 innerSpan.phiSpan.first,
382 innerSpan.phiSpan.second,
383 innerSpan.zSpan.first,
384 innerSpan.zSpan.second);
386 outerSpan.rSpan.second,
387 outerSpan.phiSpan.first,
388 outerSpan.phiSpan.second,
389 outerSpan.zSpan.first,
390 outerSpan.zSpan.second);
397 std::vector<std::pair<edm::VecArray<PixelInactiveAreaFinder::DetGroupSpan, 2>,
398 std::vector<PixelInactiveAreaFinder::LayerSetIndex>>>
404 std::vector<std::pair<VecArray2<DetGroupSpan>, std::vector<LayerSetIndex>>>
ret;
407 <<
" z half width " << zwidth;
410 const auto& layerIdxPair = (*inactiveLayerPairIndices_)[
i];
411 const auto& innerSpans = inactiveSpans_[layerIdxPair.first];
412 const auto& outerSpans = inactiveSpans_[layerIdxPair.second];
414 for (
const auto& innerSpan : innerSpans) {
415 for (
const auto& outerSpan : outerSpans) {
416 if (phiRangesOverlap(innerSpan.phiSpan, outerSpan.phiSpan)) {
417 std::pair<float, float>
range(0, 0);
419 bool zOverlap =
false;
420 const auto innerDet = std::get<0>((*inactiveLayers_)[layerIdxPair.first]);
421 const auto outerDet = std::get<0>((*inactiveLayers_)[layerIdxPair.second]);
424 zOverlap = getZAxisOverlapRangeBarrel(innerSpan, outerSpan,
range);
426 zOverlap = getZAxisOverlapRangeBarrelEndcap(innerSpan, outerSpan,
range);
429 zOverlap = getZAxisOverlapRangeEndcap(innerSpan, outerSpan,
range);
431 throw cms::Exception(
"LogicError") <<
"Forward->barrel transition is not supported";
441 detGroupSpanInfo(innerSpan,
ss);
443 detGroupSpanInfo(outerSpan,
ss);
444 LogTrace(
"PixelInactiveAreaFinder") <<
" adding areas for active layer sets " <<
ss.str();
461 const std::vector<SeedingLayerSetsBuilder::SeedingLayerId>&
seedingLayers,
464 :
debug_(iConfig.getUntrackedParameter<
bool>(
"debug")),
470 badPixelFEDChannelsTokens_(
471 edm::vector_transform(iConfig.getParameter<std::vector<edm::InputTag>>(
"badPixelFEDChannelCollectionLabels"),
472 [&](
const auto&
tag) { return iC.consumes<PixelFEDChannelCollection>(tag); })),
473 trackerGeometryToken_(iC.esConsumes()),
474 trackerTopologyToken_(iC.esConsumes()),
475 pixelQualityToken_(iC.esConsumes()) {
478 LogTrace(
"PixelInactiveAreaFinder") <<
"Input layer subdet " << std::get<0>(
layer) <<
" side " 479 << static_cast<unsigned int>(std::get<1>(
layer)) <<
" layer " 480 << std::get<2>(
layer);
484 auto findOrAdd = [&](SeedingLayerId
layer) ->
unsigned short {
486 if (
found == inactiveLayers_.cend()) {
487 auto ret = inactiveLayers_.size();
488 inactiveLayers_.push_back(
layer);
495 const auto activeToInactiveMap = createActiveToInactiveMap();
500 for (
const auto& layerSet : seedingLayerSetsLooper.makeRange(
seedingLayers)) {
501 assert(layerSet.size() == 2);
502 auto found = activeToInactiveMap.find(std::make_pair(layerSet[0], layerSet[1]));
503 if (
found == activeToInactiveMap.end()) {
505 <<
"Encountered layer pair " << layerSet[0] <<
"+" << layerSet[1]
506 <<
" not found from the internal 'active layer pairs' to 'inactive layer pairs' mapping; either fix the " 507 "input or the mapping (in PixelInactiveAreaFinder.cc)";
510 LogTrace(
"PixelInactiveAreaFinder") <<
"Input layer set " << layerSet[0] <<
"+" << layerSet[1];
511 for (
const auto& inactiveLayerSet :
found->second) {
512 auto innerInd = findOrAdd(inactiveLayerSet.first);
513 auto outerInd = findOrAdd(inactiveLayerSet.second);
516 inactiveLayerSetIndices_.cbegin(), inactiveLayerSetIndices_.cend(), std::make_pair(innerInd, outerInd));
517 if (
found == inactiveLayerSetIndices_.end()) {
518 inactiveLayerSetIndices_.emplace_back(innerInd, outerInd);
519 layerSetIndexInactiveToActive_.push_back(std::vector<LayerSetIndex>{
i});
521 layerSetIndexInactiveToActive_.at(
std::distance(inactiveLayerSetIndices_.cbegin(),
found))
526 <<
" inactive layer set " << inactiveLayerSet.first <<
"+" << inactiveLayerSet.second;
533 LogDebug(
"PixelInactiveAreaFinder") <<
"All inactive layer sets";
534 for (
const auto& idxPair : inactiveLayerSetIndices_) {
535 LogTrace(
"PixelInactiveAreaFinder") <<
" " << inactiveLayers_[idxPair.first] <<
"+" 536 << inactiveLayers_[idxPair.second];
542 desc.add<std::vector<edm::InputTag>>(
"inactivePixelDetectorLabels",
544 ->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
545 desc.add<std::vector<edm::InputTag>>(
"badPixelFEDChannelCollectionLabels",
547 ->setComment(
"One or more PixelFEDChannelCollections of modules+ROCs to mask on the fly for a given event");
548 desc.add<
bool>(
"ignoreSingleFPixPanelModules",
false);
550 desc.addUntracked<
bool>(
"debug",
false);
551 desc.addUntracked<
bool>(
"createPlottingFiles",
false);
578 for (
const auto& span : container) {
591 doWork(cspans.first);
592 doWork(cspans.second);
598 printOverlapSpans(
ret);
614 <<
"This module supports only a detector with 4 pixel barrel layers, the current geometry has " 619 <<
"This module supports only a detector with 3 pixel forward disks, the current geometry has " 623 std::array<std::array<unsigned short, 100>, 4>
counts = {};
629 <<
"Got a ladder with number " <<
ladder 630 <<
" while the expected maximum was 100; either something is wrong or the maximum has to be increased.";
639 throw cms::Exception(
"LogicError") <<
"Ladder 1 of layer 1 has 0 modules, something fishy is going on.";
643 <<
"; below are number of ladders per layer";
657 <<
"Layer " << (
layer + 1) <<
" had " << fail
658 <<
" ladders whose number of modules/ladder differed from the ladder 1 of layer 1 (" <<
nModulesPerLadder 659 <<
"). Something fishy is going on.";
685 auto addDetId = [&](
const auto id) {
686 const auto detid =
DetId(
id);
687 const auto subdet = detid.subdetId();
698 for (
auto const& disabledModule : pixelQuality.getBadComponentList()) {
699 addDetId(disabledModule.DetID);
706 for (
const auto&
id : *detIds) {
715 iEvent.getByToken(
token, pixelFEDChannelCollectionHandle);
716 for (
const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
717 addDetId(disabledChannels.detId());
733 using std::noshowpos;
736 using std::setprecision;
741 ss <<
"id:[" << det <<
"]" << deli;
747 ss <<
"layer:[" <<
layer <<
"]" << deli <<
"ladder:[" << right << setw(2) <<
ladder <<
"]" << deli <<
"module:[" 753 ss << left << setw(6) <<
"disk:" 754 <<
"[" << right << disk <<
"]" << deli << left << setw(7) <<
"blade:" 755 <<
"[" << setw(2) << right << blade <<
"]" << deli << left << setw(7) <<
"panel:" 756 <<
"[" << right << panel <<
"]" << deli;
758 float phiA, phiB, zA, zB, rA, rB;
760 tie(phiA, phiB) = detSurface.
phiSpan();
761 tie(zA, zB) = detSurface.zSpan();
762 tie(rA, rB) = detSurface.rSpan();
763 ss << setprecision(16) <<
fixed << showpos << setfill(
' ') <<
"phi:[" << right << setw(12) << phiA <<
"," << left
764 << setw(12) << phiB <<
"]" << deli <<
"z:[" << right << setw(7) << zA <<
"," << left << setw(7) << zB <<
"]" 765 << deli << noshowpos <<
"r:[" << right << setw(10) << rA <<
"," << left << setw(10) << rB <<
"]" << deli;
768 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Barrel detectors:";
775 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
783 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Bad barrel detectors:";
790 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
801 for (
auto const& detGroup : badDetGroupsBar) {
802 ss << std::setfill(
' ') << std::left << std::setw(16) <<
"DetGroup:";
807 detGroupSpanInfo(cspan,
ss);
809 for (
auto const& det : detGroup) {
815 for (
auto const& detGroup : badDetGroupsEnd) {
816 ss << std::setfill(
' ') << std::left << std::setw(16) <<
"DetGroup:";
821 detGroupSpanInfo(cspan,
ss);
823 for (
auto const& det : detGroup) {
834 for (
auto const& cspan : cspans.first) {
835 detGroupSpanInfo(cspan,
ss);
838 for (
auto const& cspan : cspans.second) {
839 detGroupSpanInfo(cspan,
ss);
847 std::ofstream fsDet(
"DETECTORS.txt");
852 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
860 std::ofstream fsBadDet(
"BADDETECTORS.txt");
869 fsBadDet <<
ss.rdbuf();
872 std::ofstream fsSpans(
"DETGROUPSPANS.txt");
874 for (
auto const& cspan : cspans.first) {
875 detGroupSpanInfo(cspan,
ss);
878 for (
auto const& cspan : cspans.second) {
879 detGroupSpanInfo(cspan,
ss);
882 fsSpans <<
ss.rdbuf();
891 using std::remove_if;
895 auto const& detId =
DetId(det);
896 unsigned int layer = tTopo->pxbLayer(detId);
897 unsigned int ladder = tTopo->pxbLadder(detId);
898 unsigned int module = tTopo->pxbModule(detId);
902 adj.push_back(tTopo->pxbDetId(
layer, ((
ladder - 1) - 1 + nLads) % nLads + 1,
module)());
913 adj.erase(remove_if(adj.begin(), adj.end(), [&](
auto c) {
return this->
detWorks(
c); }), adj.end());
921 Span_t phiSpan, phiSpanComp;
923 unsigned int disk, diskComp;
926 tie(
z,
ignore) = detSurf.zSpan();
930 auto const& detIdComp =
DetId(detComp);
933 phiSpanComp = detSurfComp.phiSpan();
934 tie(zComp,
ignore) = detSurfComp.zSpan();
935 if (det != detComp && disk == diskComp &&
z * zComp > 0 && phiRangesOverlap(phiSpan, phiSpanComp)) {
936 adj.push_back(detComp);
944 std::queue<det_t> workQueue;
947 foundDets.insert(initDet);
948 workQueue.push(initDet);
950 while (!workQueue.empty()) {
951 workDet = workQueue.front();
960 for (
auto const& badDet : badAdjDets) {
961 if (foundDets.find(badDet) == foundDets.end()) {
963 foundDets.insert(badDet);
964 workQueue.push(badDet);
974 if (foundDets.find(badDet) == foundDets.end()) {
984 if (foundDets.find(badDet) == foundDets.end()) {
992 detGroups.push_back(adjacentDets);
1000 if (detGroup.empty()) {
1008 using LadderSet = std::set<uint>;
1009 using LadVec = std::vector<uint>;
1011 for (
auto const& det : detGroup) {
1014 LadVec ladv(lads.begin(), lads.end());
1018 uint currentLadder = ladv[0];
1019 uint previousLadder = ladv[(ladv.size() +
i - 1) % ladv.size()];
1021 while ((nLadders + currentLadder - 1) % nLadders == previousLadder) {
1023 currentLadder = ladv[
i % ladv.size()];
1024 previousLadder = ladv[(ladv.size() +
i - 1) % ladv.size()];
1025 if (
i == ladv.size()) {
1031 uint startLadder = currentLadder;
1032 uint endLadder = previousLadder;
1048 DetGroup::const_iterator startDetIter = detGroup.begin();
1049 Span_t phiSpan, phiSpanComp;
1052 phiSpan = tGeom->idToDet(
DetId(*startDetIter))->surface().phiSpan();
1053 for (DetGroup::const_iterator compDetIter = detGroup.begin(); compDetIter != detGroup.end(); ++compDetIter) {
1054 phiSpanComp = tGeom->idToDet(
DetId(*compDetIter))->surface().phiSpan();
1055 if (phiRangesOverlap(phiSpan, phiSpanComp) && phiMoreClockwise(phiSpanComp.first, phiSpan.first) &&
1056 startDetIter != compDetIter) {
1058 if (
counter > detGroup.size()) {
1063 startDetIter = compDetIter;
1065 }
else if (compDetIter == detGroup.end() - 1) {
1070 cspan.
phiSpan.first = phiSpan.first;
1073 DetGroup::const_iterator endDetIter = detGroup.begin();
1076 phiSpan = tGeom->idToDet(
DetId(*endDetIter))->surface().phiSpan();
1077 for (DetGroup::const_iterator compDetIter = detGroup.begin(); compDetIter != detGroup.end(); ++compDetIter) {
1078 phiSpanComp = tGeom->idToDet(
DetId(*compDetIter))->surface().phiSpan();
1079 if (phiRangesOverlap(phiSpan, phiSpanComp) && phiMoreCounterclockwise(phiSpanComp.second, phiSpan.second) &&
1080 endDetIter != compDetIter) {
1082 if (
counter > detGroup.size()) {
1087 endDetIter = compDetIter;
1089 }
else if (compDetIter == detGroup.end() - 1) {
1094 cspan.
phiSpan.second = phiSpan.second;
1097 auto cmpFun = [
this](
det_t detA,
det_t detB) {
1102 auto minmaxIters = std::minmax_element(detGroup.begin(), detGroup.end(), cmpFun);
1107 auto cmpFun = [
this](
det_t detA,
det_t detB) {
1112 auto minmaxIters = std::minmax_element(detGroup.begin(), detGroup.end(), cmpFun);
1117 auto firstDetIt = detGroup.begin();
1118 if (firstDetIt != detGroup.end()) {
1138 for (
auto const& detGroup : badDetGroupsBar) {
1141 cspansBarrel.push_back(cspan);
1143 for (
auto const& detGroup : badDetGroupsEnd) {
1146 cspansEndcap.push_back(cspan);
constexpr double deltaPhi(double phi1, double phi2)
unsigned int pxbLayer(const DetId &id) const
SeedingLayerSetsBuilder::SeedingLayerId SeedingLayerId
unsigned int pxfBlade(const DetId &id) const
const DetContainer & detsPXB() const
std::vector< uint32_t > DetGroup
unsigned int numberOfLayers(int subdet) const
std::vector< edm::EDGetTokenT< DetIdCollection > > inactivePixelDetectorTokens_
const bool ignoreSingleFPixPanelModules_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopologyToken_
std::array< unsigned short, 4 > nBPixLadders
ret
prodAgent to be discontinued
DetContainer badPixelDetsEndcap_
Global3DPoint GlobalPoint
std::vector< std::pair< VecArray2< Area >, std::vector< LayerSetIndex > > > areasAndLayerSets(const GlobalPoint &point, float zwidth) const
std::ostream & operator<<(std::ostream &os, SeedingLayerSetsBuilder::SeedingLayerId layer)
const DetContainer & detsPXF() const
edm::ESGetToken< SiPixelQuality, SiPixelQualityRcd > pixelQualityToken_
unsigned int pxbLadder(const DetId &id) const
auto vector_transform(std::vector< InputType > const &input, Function predicate) -> std::vector< typename std::remove_cv< typename std::remove_reference< decltype(predicate(input.front()))>::type >::type >
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
void updatePixelDets(const edm::EventSetup &iSetup)
static void fillDescriptions(edm::ParameterSetDescription &desc)
unsigned int layer(const DetId &id) const
DetGroup reachableDetGroup(const det_t &initDet, DetectorSet &foundDets)
constexpr std::array< uint8_t, layerIndexSize > layer
std::vector< std::pair< unsigned short, unsigned short > > inactiveLayerSetIndices_
void getRSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
std::vector< std::pair< VecArray2< DetGroupSpan >, std::vector< LayerSetIndex > > > spansAndLayerSets(const GlobalPoint &point, float zwidth) const
void printBadDetGroupSpans()
DetGroupContainer badDetGroupsEndcap()
std::tuple< GeomDetEnumerators::SubDetector, TrackerDetSide, int > SeedingLayerId
std::pair< float, float > zSpan
void getPhiSpanBarrel(const DetGroup &detGroup, DetGroupSpan &cspan)
std::pair< float, float > const & zSpan() const
def unique(seq, keepstr=True)
void detInfo(const det_t &det, Stream &ss)
unsigned int pxfDisk(const DetId &id) const
std::set< uint32_t > DetectorSet
DetGroupContainer badDetGroupsBarrel()
void createPlottingFiles()
DetGroup badAdjecentDetsBarrel(const det_t &det)
std::pair< float, float > const & phiSpan() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
InactiveAreas inactiveAreas(const edm::Event &iEvent, const edm::EventSetup &iSetup)
bool getData(T &iHolder) const
std::pair< float, float > const & rSpan() const
const TrackerGeometry * trackerGeometry_
Log< level::Warning, true > LogPrint
DetId pxbDetId(uint32_t layer, uint32_t ladder, uint32_t module) const
const TrackerGeomDet * idToDet(DetId) const override
void getBadPixelDets(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< DetGroup > DetGroupContainer
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > badPixelFEDChannelsTokens_
unsigned int pxfPanel(const DetId &id) const
std::pair< float, float > phiSpan
DetContainer badPixelDetsBarrel_
PixelInactiveAreaFinder(const edm::ParameterSet &iConfig, const std::vector< SeedingLayerId > &seedingLayers, const SeedingLayerSetsLooper &seedingLayerSetsLooper, edm::ConsumesCollector &&iC)
const Plane & surface() const
The nominal surface of the GeomDet.
const TrackerTopology * trackerTopology_
std::vector< DetGroupSpan > DetGroupSpanContainer
DetContainer pixelDetsEndcap_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeometryToken_
void getSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
bool check(const edm::EventSetup &iSetup)
DetContainer pixelDetsBarrel_
deadvectors [0] push_back({0.0175431, 0.538005, 6.80997, 13.29})
unsigned short nModulesPerLadder
void emplace_back(Args &&... args)
static std::atomic< unsigned int > counter
void getPhiSpanEndcap(const DetGroup &detGroup, DetGroupSpan &cspan)
DetGroupSpanContainerPair detGroupSpans()
std::pair< float, float > rSpan
DetGroup badAdjecentDetsEndcap(const det_t &det)
unsigned int pxbModule(const DetId &id) const
std::pair< DetGroupSpanContainer, DetGroupSpanContainer > DetGroupSpanContainerPair
std::vector< std::vector< LayerSetIndex > > layerSetIndexInactiveToActive_
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
std::vector< SeedingLayerId > inactiveLayers_
const bool createPlottingFiles_
SeedingLayerSetsHits::LayerSetIndex LayerSetIndex
void getZSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
edm::ESWatcher< TrackerDigiGeometryRecord > geometryWatcher_