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);
582 for (
const auto& span : container) {
595 doWork(cspans.first);
596 doWork(cspans.second);
602 printOverlapSpans(
ret);
618 <<
"This module supports only a detector with 4 pixel barrel layers, the current geometry has " 623 <<
"This module supports only a detector with 3 pixel forward disks, the current geometry has " 627 std::array<std::array<unsigned short, 100>, 4>
counts = {};
633 <<
"Got a ladder with number " <<
ladder 634 <<
" while the expected maximum was 100; either something is wrong or the maximum has to be increased.";
643 throw cms::Exception(
"LogicError") <<
"Ladder 1 of layer 1 has 0 modules, something fishy is going on.";
647 <<
"; below are number of ladders per layer";
661 <<
"Layer " << (
layer + 1) <<
" had " << fail
662 <<
" ladders whose number of modules/ladder differed from the ladder 1 of layer 1 (" <<
nModulesPerLadder 663 <<
"). Something fishy is going on.";
689 auto addDetId = [&](
const auto id) {
690 const auto detid =
DetId(
id);
691 const auto subdet = detid.subdetId();
702 for (
auto const& disabledModule : pixelQuality.getBadComponentList()) {
703 addDetId(disabledModule.DetID);
710 for (
const auto&
id : *detIds) {
719 iEvent.getByToken(
token, pixelFEDChannelCollectionHandle);
720 for (
const auto& disabledChannels : *pixelFEDChannelCollectionHandle) {
721 addDetId(disabledChannels.detId());
737 using std::noshowpos;
740 using std::setprecision;
745 ss <<
"id:[" << det <<
"]" << deli;
751 ss <<
"layer:[" <<
layer <<
"]" << deli <<
"ladder:[" << right << setw(2) <<
ladder <<
"]" << deli <<
"module:[" 757 ss << left << setw(6) <<
"disk:" 758 <<
"[" << right << disk <<
"]" << deli << left << setw(7) <<
"blade:" 759 <<
"[" << setw(2) << right << blade <<
"]" << deli << left << setw(7) <<
"panel:" 760 <<
"[" << right << panel <<
"]" << deli;
762 float phiA, phiB, zA, zB, rA, rB;
764 tie(phiA, phiB) = detSurface.
phiSpan();
765 tie(zA, zB) = detSurface.zSpan();
766 tie(rA, rB) = detSurface.rSpan();
767 ss << setprecision(16) <<
fixed << showpos << setfill(
' ') <<
"phi:[" << right << setw(12) << phiA <<
"," << left
768 << setw(12) << phiB <<
"]" << deli <<
"z:[" << right << setw(7) << zA <<
"," << left << setw(7) << zB <<
"]" 769 << deli << noshowpos <<
"r:[" << right << setw(10) << rA <<
"," << left << setw(10) << rB <<
"]" << deli;
772 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Barrel detectors:";
779 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
787 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Bad barrel detectors:";
794 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
805 for (
auto const& detGroup : badDetGroupsBar) {
806 ss << std::setfill(
' ') << std::left << std::setw(16) <<
"DetGroup:";
811 detGroupSpanInfo(cspan,
ss);
813 for (
auto const& det : detGroup) {
819 for (
auto const& detGroup : badDetGroupsEnd) {
820 ss << std::setfill(
' ') << std::left << std::setw(16) <<
"DetGroup:";
825 detGroupSpanInfo(cspan,
ss);
827 for (
auto const& det : detGroup) {
838 for (
auto const& cspan : cspans.first) {
839 detGroupSpanInfo(cspan,
ss);
842 for (
auto const& cspan : cspans.second) {
843 detGroupSpanInfo(cspan,
ss);
851 std::ofstream fsDet(
"DETECTORS.txt");
856 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
864 std::ofstream fsBadDet(
"BADDETECTORS.txt");
873 fsBadDet <<
ss.rdbuf();
876 std::ofstream fsSpans(
"DETGROUPSPANS.txt");
878 for (
auto const& cspan : cspans.first) {
879 detGroupSpanInfo(cspan,
ss);
882 for (
auto const& cspan : cspans.second) {
883 detGroupSpanInfo(cspan,
ss);
886 fsSpans <<
ss.rdbuf();
895 using std::remove_if;
906 adj.push_back(tTopo->pxbDetId(
layer, ((
ladder - 1) - 1 + nLads) % nLads + 1,
module)());
917 adj.erase(remove_if(adj.begin(), adj.end(), [&](
auto c) {
return this->
detWorks(
c); }), adj.end());
925 Span_t phiSpan, phiSpanComp;
927 unsigned int disk, diskComp;
930 tie(
z,
ignore) = detSurf.zSpan();
934 auto const& detIdComp =
DetId(detComp);
937 phiSpanComp = detSurfComp.phiSpan();
938 tie(zComp,
ignore) = detSurfComp.zSpan();
939 if (det != detComp && disk == diskComp &&
z * zComp > 0 && phiRangesOverlap(phiSpan, phiSpanComp)) {
940 adj.push_back(detComp);
948 std::queue<det_t> workQueue;
951 foundDets.insert(initDet);
952 workQueue.push(initDet);
954 while (!workQueue.empty()) {
955 workDet = workQueue.front();
964 for (
auto const& badDet : badAdjDets) {
965 if (foundDets.find(badDet) == foundDets.end()) {
967 foundDets.insert(badDet);
968 workQueue.push(badDet);
978 if (foundDets.find(badDet) == foundDets.end()) {
988 if (foundDets.find(badDet) == foundDets.end()) {
996 detGroups.push_back(adjacentDets);
1004 if (detGroup.empty()) {
1012 using LadderSet = std::set<uint>;
1013 using LadVec = std::vector<uint>;
1015 for (
auto const& det : detGroup) {
1018 LadVec ladv(lads.begin(), lads.end());
1022 uint currentLadder = ladv[0];
1023 uint previousLadder = ladv[(ladv.size() +
i - 1) % ladv.size()];
1025 while ((nLadders + currentLadder - 1) % nLadders == previousLadder) {
1027 currentLadder = ladv[
i % ladv.size()];
1028 previousLadder = ladv[(ladv.size() +
i - 1) % ladv.size()];
1029 if (
i == ladv.size()) {
1035 uint startLadder = currentLadder;
1036 uint endLadder = previousLadder;
1052 DetGroup::const_iterator startDetIter = detGroup.begin();
1053 Span_t phiSpan, phiSpanComp;
1056 phiSpan = tGeom->idToDet(
DetId(*startDetIter))->surface().phiSpan();
1057 for (DetGroup::const_iterator compDetIter = detGroup.begin(); compDetIter != detGroup.end(); ++compDetIter) {
1058 phiSpanComp = tGeom->idToDet(
DetId(*compDetIter))->surface().phiSpan();
1059 if (phiRangesOverlap(phiSpan, phiSpanComp) && phiMoreClockwise(phiSpanComp.first, phiSpan.first) &&
1060 startDetIter != compDetIter) {
1062 if (
counter > detGroup.size()) {
1067 startDetIter = compDetIter;
1069 }
else if (compDetIter == detGroup.end() - 1) {
1074 cspan.
phiSpan.first = phiSpan.first;
1077 DetGroup::const_iterator endDetIter = detGroup.begin();
1080 phiSpan = tGeom->idToDet(
DetId(*endDetIter))->surface().phiSpan();
1081 for (DetGroup::const_iterator compDetIter = detGroup.begin(); compDetIter != detGroup.end(); ++compDetIter) {
1082 phiSpanComp = tGeom->idToDet(
DetId(*compDetIter))->surface().phiSpan();
1083 if (phiRangesOverlap(phiSpan, phiSpanComp) && phiMoreCounterclockwise(phiSpanComp.second, phiSpan.second) &&
1084 endDetIter != compDetIter) {
1086 if (
counter > detGroup.size()) {
1091 endDetIter = compDetIter;
1093 }
else if (compDetIter == detGroup.end() - 1) {
1098 cspan.
phiSpan.second = phiSpan.second;
1101 auto cmpFun = [
this](
det_t detA,
det_t detB) {
1106 auto minmaxIters = std::minmax_element(detGroup.begin(), detGroup.end(), cmpFun);
1111 auto cmpFun = [
this](
det_t detA,
det_t detB) {
1116 auto minmaxIters = std::minmax_element(detGroup.begin(), detGroup.end(), cmpFun);
1121 auto firstDetIt = detGroup.begin();
1122 if (firstDetIt != detGroup.end()) {
1142 for (
auto const& detGroup : badDetGroupsBar) {
1145 cspansBarrel.push_back(cspan);
1147 for (
auto const& detGroup : badDetGroupsEnd) {
1150 cspansEndcap.push_back(cspan);
constexpr double deltaPhi(double phi1, double phi2)
unsigned int pxbLayer(const DetId &id) const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
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)
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)
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)
std::vector< Frame > Stream
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_