26 os << std::get<2>(layer);
37 using LayerPair = std::pair<SeedingLayerSetsBuilder::SeedingLayerId, SeedingLayerSetsBuilder::SeedingLayerId>;
38 using ActiveLayerSetToInactiveSetsMap = std::map<LayerPair, edm::VecArray<LayerPair, 5> >;
39 using Stream = std::stringstream;
40 using Span_t = std::pair<float,float>;
42 ActiveLayerSetToInactiveSetsMap createActiveToInactiveMap() {
43 ActiveLayerSetToInactiveSetsMap
map;
45 auto bpix = [](
int layer) {
48 auto fpix_pos = [](
int disk) {
51 auto fpix_neg = [](
int disk) {
55 auto add_permutations = [&](std::array<SeedingLayerSetsBuilder::SeedingLayerId, 4> quads) {
59 if(quads[0] > quads[1] || quads[2] > quads[3])
continue;
61 map[std::make_pair(quads[0], quads[1])].emplace_back(quads[2], quads[3]);
62 }
while(std::next_permutation(quads.begin(), quads.end()));
66 add_permutations({{bpix(1), bpix(2), bpix(3), bpix(4)}});
69 add_permutations({{bpix(1), bpix(2), bpix(3), fpix_pos(1)}});
70 add_permutations({{bpix(1), bpix(2), bpix(3), fpix_neg(1)}});
73 add_permutations({{bpix(1), bpix(2), fpix_pos(1), fpix_pos(2)}});
74 add_permutations({{bpix(1), bpix(2), fpix_neg(1), fpix_neg(2)}});
77 add_permutations({{bpix(1), fpix_pos(1), fpix_pos(2), fpix_pos(3)}});
78 add_permutations({{bpix(1), fpix_neg(1), fpix_neg(2), fpix_neg(3)}});
81 LogDebug(
"PixelInactiveAreaFinder") <<
"Active to inactive mapping";
82 for(
const auto&
elem: map) {
84 for(
const auto& layerPair:
elem.second) {
85 ss << layerPair.first <<
"+" << layerPair.second <<
",";
87 LogTrace(
"PixelInactiveAreaFinder") <<
" " <<
elem.first.first <<
"+" <<
elem.first.second <<
" => " << ss.str();
100 using std::setprecision;
106 ss <<
"subdetid:[" << cspan.
subdetId <<
"]" << deli;
108 ss <<
"layer:[" << cspan.
layer <<
"]" << deli;
111 ss <<
"disk:[" << cspan.
disk <<
"]" << deli;
117 <<
"phi:<" << right << setw(12) << cspan.
phiSpan.first <<
"," << left << setw(12) << cspan.
phiSpan.second <<
">" << deli
118 <<
"z:<" << right << setw(7) << cspan.
zSpan.first <<
"," << left << setw(7) << cspan.
zSpan.second <<
">" << deli << noshowpos
119 <<
"r:<" << right << setw(10) << cspan.
rSpan.first <<
"," << left << setw(10) << cspan.
rSpan.second <<
">" << deli
126 for(
auto const &spansLayers: spansLayerSets) {
127 ss <<
"Overlapping detGroups:\n";
128 for(
auto const cspan : spansLayers.first) {
129 detGroupSpanInfo(cspan,ss);
137 bool phiRangesOverlap(
const Span_t&phiSpanA,
const Span_t&phiSpanB) {
139 std::tie(x1,x2) = phiSpanA;
140 std::tie(y1,y2) = phiSpanB;
142 if(x1<=x2 && y1<=y2){
143 return x1<=y2 && y1 <=
x2;
144 }
else if (( x1>x2 && y1 <= y2) || (y1 > y2 && x1 <= x2 )){
145 return y1 <= x2 || x1 <= y2;
146 }
else if (x1 > x2 && y1 > y2){
154 bool phiMoreClockwise(
float phiA,
float phiB) {
158 bool phiMoreCounterclockwise(
float phiA,
float phiB) {
164 float zAxisIntersection(
const float zrPointA[2],
const float zrPointB[2]){
165 return (zrPointB[0]-zrPointA[0])/(zrPointB[1]-zrPointA[1])*(-zrPointA[1])+zrPointA[0];
173 }
else if(cspanA.
rSpan.first > cspanB.
rSpan.second){
181 if(cspanUpper.
zSpan.second < cspanLower.
zSpan.first){
183 const float pointUpperDetGroupL[2] = {cspanUpper.
zSpan.second, cspanUpper.
rSpan.second};
184 const float pointLowerDetGroupL[2] = {cspanLower.
zSpan.first, cspanLower.
rSpan.first};
185 lower = zAxisIntersection(pointUpperDetGroupL,pointLowerDetGroupL);
187 const float pointUpperDetGroupU[2] = {cspanUpper.
zSpan.first, cspanUpper.
rSpan.first};
188 const float pointLowerDetGroupU[2] = {cspanLower.
zSpan.second, cspanLower.
rSpan.second};
189 upper = zAxisIntersection(pointUpperDetGroupU,pointLowerDetGroupU);
190 }
else if (cspanUpper.
zSpan.first <= cspanLower.
zSpan.second && cspanLower.
zSpan.first <= cspanUpper.
zSpan.second){
192 const float pointUpperDetGroupL[2] = {cspanUpper.
zSpan.second, cspanUpper.
rSpan.first};
193 const float pointLowerDetGroupL[2] = {cspanLower.
zSpan.first, cspanLower.
rSpan.second};
194 lower = zAxisIntersection(pointUpperDetGroupL,pointLowerDetGroupL);
196 const float pointUpperDetGroupU[2] = {cspanUpper.
zSpan.first, cspanUpper.
rSpan.first};
197 const float pointLowerDetGroupU[2] = {cspanLower.
zSpan.second, cspanLower.
rSpan.second};
198 upper = zAxisIntersection(pointUpperDetGroupU,pointLowerDetGroupU);
199 }
else if (cspanUpper.
zSpan.first > cspanLower.
zSpan.second){
201 const float pointUpperDetGroupL[2] = {cspanUpper.
zSpan.second, cspanUpper.
rSpan.first};
202 const float pointLowerDetGroupL[2] = {cspanLower.
zSpan.first, cspanLower.
rSpan.second};
203 lower = zAxisIntersection(pointUpperDetGroupL,pointLowerDetGroupL);
205 const float pointUpperDetGroupU[2] = {cspanUpper.
zSpan.first, cspanUpper.
rSpan.second};
206 const float pointLowerDetGroupU[2] = {cspanLower.
zSpan.second, cspanLower.
rSpan.first};
207 upper = zAxisIntersection(pointUpperDetGroupU,pointLowerDetGroupU);
212 range = std::pair<float,float>(lower,
upper);
221 if(cspanA.
zSpan.first < 0 && cspanB.
zSpan.first < 0){
223 cspanFurther = cspanA;
224 cspanNearer = cspanB;
225 }
else if (cspanB.
zSpan.second < cspanA.
zSpan.first){
226 cspanFurther = cspanB;
227 cspanNearer = cspanA;
230 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, same disk propably. Spans:";
232 detGroupSpanInfo(cspanA,ss);ss<<std::endl;detGroupSpanInfo(cspanB,ss);ss<<std::endl;
234 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
238 if(cspanFurther.
rSpan.second > cspanNearer.
rSpan.first){
239 const float pointA[2] = {cspanFurther.
zSpan.second, cspanFurther.
rSpan.second};
240 const float pointB[2] = {cspanNearer.
zSpan.first, cspanNearer.
rSpan.first};
241 lower = zAxisIntersection(pointA,pointB);
242 if(cspanFurther.
rSpan.first > cspanNearer.
rSpan.second){
243 const float pointC[2] = {cspanFurther.
zSpan.first, cspanFurther.
rSpan.first};
244 const float pointD[2] = {cspanNearer.
zSpan.second, cspanFurther.
rSpan.second};
245 upper = zAxisIntersection(pointC,pointD);
251 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, further detGroup is lower. Spans:";
253 detGroupSpanInfo(cspanA,ss);ss<<std::endl;detGroupSpanInfo(cspanB,ss);ss<<std::endl;
255 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
259 }
else if(cspanA.
zSpan.first > 0 && cspanB.
zSpan.first > 0){
260 if(cspanA.
zSpan.first > cspanB.
zSpan.second ){
261 cspanFurther = cspanA;
262 cspanNearer = cspanB;
263 }
else if(cspanB.
zSpan.first > cspanA.
zSpan.second){
264 cspanFurther = cspanB;
265 cspanNearer = cspanA;
268 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, same disk propably. Spans:";
270 detGroupSpanInfo(cspanA,ss);ss<<std::endl;detGroupSpanInfo(cspanB,ss);ss<<std::endl;
272 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
276 if(cspanFurther.
rSpan.second > cspanNearer.
rSpan.first){
277 const float pointA[2] = {cspanFurther.
zSpan.first, cspanFurther.
rSpan.second};
278 const float pointB[2] = {cspanNearer.
zSpan.second, cspanNearer.
rSpan.first};
279 upper = zAxisIntersection(pointA,pointB);
280 if(cspanFurther.
rSpan.first > cspanNearer.
rSpan.second){
281 const float pointC[2] = {cspanFurther.
zSpan.second, cspanFurther.
rSpan.first};
282 const float pointD[2] = {cspanNearer.
zSpan.first, cspanFurther.
rSpan.second};
283 lower = zAxisIntersection(pointC,pointD);
289 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, further detGroup lower. Spans:";
291 detGroupSpanInfo(cspanA,ss);ss<<std::endl;detGroupSpanInfo(cspanB,ss);ss<<std::endl;
293 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
299 LogTrace(
"PixelInactiveAreaFinder") <<
"No overlap, different sides of z axis. Spans:";
301 detGroupSpanInfo(cspanA,ss);ss<<std::endl;detGroupSpanInfo(cspanB,ss);ss<<std::endl;
303 LogTrace(
"PixelInactiveAreaFinder") <<
"**";
307 range = std::pair<float,float>(lower,
upper);
314 if(cspanEnd.
rSpan.second > cspanBar.
rSpan.first){
315 if(cspanEnd.
zSpan.second < cspanBar.
zSpan.first){
317 const float pointA[2] = {cspanEnd.
zSpan.second, cspanEnd.
rSpan.second};
318 const float pointB[2] = {cspanBar.
zSpan.first, cspanBar.
rSpan.first};
319 lower = zAxisIntersection(pointA,pointB);
320 if(cspanEnd.
rSpan.first > cspanBar.
rSpan.second){
322 const float pointC[2] = {cspanEnd.
zSpan.first, cspanEnd.
rSpan.first};
323 const float pointD[2] = {cspanBar.
zSpan.second, cspanBar.
rSpan.second};
324 upper = zAxisIntersection(pointC,pointD);
328 }
else if (cspanEnd.
zSpan.first > cspanBar.
zSpan.second){
330 const float pointA[2] = {cspanEnd.
zSpan.first, cspanEnd.
rSpan.second};
331 const float pointB[2] = {cspanBar.
zSpan.second, cspanBar.
rSpan.first};
332 upper = zAxisIntersection(pointA,pointB);
333 if(cspanEnd.
rSpan.first > cspanBar.
rSpan.second){
334 const float pointC[2] = {cspanEnd.
zSpan.second,cspanEnd.
rSpan.first};
335 const float pointD[2] = {cspanBar.
zSpan.first, cspanBar.
rSpan.second};
336 lower = zAxisIntersection(pointC,pointD);
346 range = std::pair<float,float>(lower,
upper);
351 std::vector<std::pair<edm::VecArray<PixelInactiveAreaFinder::Area, 2>, std::vector<PixelInactiveAreaFinder::LayerSetIndex> > >
356 std::vector<std::pair<VecArray2<Area>, std::vector<LayerSetIndex> > > ret;
357 for(
auto& item: spansLayerSets) {
358 auto& innerSpan = item.first[0];
359 auto& outerSpan = item.first[1];
361 areas.
emplace_back(innerSpan.rSpan.first, innerSpan.rSpan.second,
362 innerSpan.phiSpan.first, innerSpan.phiSpan.second,
363 innerSpan.zSpan.first, innerSpan.zSpan.second);
364 areas.
emplace_back(outerSpan.rSpan.first, outerSpan.rSpan.second,
365 outerSpan.phiSpan.first, outerSpan.phiSpan.second,
366 outerSpan.zSpan.first, outerSpan.zSpan.second);
373 std::vector<std::pair<edm::VecArray<PixelInactiveAreaFinder::DetGroupSpan, 2>, std::vector<PixelInactiveAreaFinder::LayerSetIndex> > >
376 const float zmin = point.
z()-zwidth;
377 const float zmax = point.
z()+zwidth;
379 std::vector<std::pair<VecArray2<DetGroupSpan>, std::vector<LayerSetIndex> > > ret;
381 LogDebug(
"PixelInactiveAreaFinder") <<
"Origin at " << point.
x() <<
"," << point.
y() <<
"," << point.
z() <<
" z half width " << zwidth;
384 const auto& layerIdxPair = (*inactiveLayerPairIndices_)[
i];
388 for(
const auto& innerSpan: innerSpans) {
389 for(
const auto& outerSpan: outerSpans) {
391 if(phiRangesOverlap(innerSpan.phiSpan, outerSpan.phiSpan)) {
392 std::pair<float,float> range(0,0);
394 bool zOverlap =
false;
395 const auto innerDet = std::get<0>((*inactiveLayers_)[layerIdxPair.first]);
396 const auto outerDet = std::get<0>((*inactiveLayers_)[layerIdxPair.second]);
399 zOverlap = getZAxisOverlapRangeBarrel(innerSpan, outerSpan, range);
401 zOverlap = getZAxisOverlapRangeBarrelEndcap(innerSpan, outerSpan, range);
405 zOverlap = getZAxisOverlapRangeEndcap(innerSpan, outerSpan, range);
407 throw cms::Exception(
"LogicError") <<
"Forward->barrel transition is not supported";
410 if(zOverlap && zmin <= range.second && range.first <= zmax) {
417 detGroupSpanInfo(innerSpan, ss);
419 detGroupSpanInfo(outerSpan, ss);
420 LogTrace(
"PixelInactiveAreaFinder") <<
" adding areas for active layer sets " << ss.str();
440 debug_(iConfig.getUntrackedParameter<
bool>(
"debug")),
448 LogTrace(
"PixelInactiveAreaFinder") <<
"Input layer subdet " << std::get<0>(layer) <<
" side " << static_cast<unsigned int>(std::get<1>(layer)) <<
" layer " << std::get<2>(layer);
463 const auto activeToInactiveMap = createActiveToInactiveMap();
468 for(
const auto& layerSet: seedingLayerSetsLooper.makeRange(seedingLayers)) {
469 assert(layerSet.size() == 2);
470 auto found = activeToInactiveMap.find(std::make_pair(layerSet[0], layerSet[1]));
471 if(found == activeToInactiveMap.end()) {
472 throw cms::Exception(
"Configuration") <<
"Encountered layer pair " << layerSet[0] <<
"+" << layerSet[1] <<
" not found from the internal 'active layer pairs' to 'inactive layer pairs' mapping; either fix the input or the mapping (in PixelInactiveAreaFinder.cc)";
475 LogTrace(
"PixelInactiveAreaFinder") <<
"Input layer set " << layerSet[0] <<
"+" << layerSet[1];
476 for(
const auto& inactiveLayerSet: found->second) {
477 auto innerInd = findOrAdd(inactiveLayerSet.first);
478 auto outerInd = findOrAdd(inactiveLayerSet.second);
489 LogTrace(
"PixelInactiveAreaFinder") <<
" inactive layer set " << inactiveLayerSet.first <<
"+" << inactiveLayerSet.second;
497 LogDebug(
"PixelInactiveAreaFinder") <<
"All inactive layer sets";
505 desc.
add<std::vector<edm::InputTag>>(
"inactivePixelDetectorLabels", std::vector<edm::InputTag>{{
edm::InputTag(
"siPixelDigis")}})->setComment(
"One or more DetIdCollections of modules to mask on the fly for a given event");
506 desc.
add<std::vector<edm::InputTag>>(
"badPixelFEDChannelCollectionLabels", std::vector<edm::InputTag>())->
setComment(
"One or more PixelFEDChannelCollections of modules+ROCs to mask on the fly for a given event");
507 desc.
add<
bool>(
"ignoreSingleFPixPanelModules",
false);
545 for(
const auto& span: container) {
556 doWork(cspans.first);
557 doWork(cspans.second);
565 printOverlapSpans(ret);
586 std::array<std::array<unsigned short, 100>, 4> counts = {};
591 throw cms::Exception(
"LogicError") <<
"Got a ladder with number " <<
ladder <<
" while the expected maximum was 100; either something is wrong or the maximum has to be increased.";
593 counts[layer-1][
ladder-1] += 1;
600 throw cms::Exception(
"LogicError") <<
"Ladder 1 of layer 1 has 0 modules, something fishy is going on.";
603 LogDebug(
"PixelInactiveAreaFinder") <<
"Number of modules per ladder " <<
nModulesPerLadder <<
"; below are number of ladders per layer";
606 for(
unsigned layer=0; layer<4; ++layer) {
607 nBPixLadders[layer] = std::count_if(counts[layer].
begin(), counts[layer].
end(), [](
unsigned short val) {
return val > 0; });
608 LogTrace(
"PixelInactiveAreaFinder") <<
"BPix layer " << (layer+1) <<
" has " <<
nBPixLadders[layer] <<
" ladders";
610 auto fail = std::count_if(counts[layer].
begin(), counts[layer].
end(), [&](
unsigned short val) {
return val !=
nModulesPerLadder && val > 0; });
612 throw cms::Exception(
"LogicError") <<
"Layer " << (layer+1) <<
" had " << fail <<
" ladders whose number of modules/ladder differed from the ladder 1 of layer 1 (" <<
nModulesPerLadder <<
"). Something fishy is going on.";
639 auto addDetId = [&](
const auto id) {
640 const auto detid =
DetId(
id);
641 const auto subdet = detid.subdetId();
655 addDetId(disabledModule.DetID);
662 for(
const auto&
id: *detIds) {
671 iEvent.
getByToken(token, pixelFEDChannelCollectionHandle);
672 for(
const auto& disabledChannels: *pixelFEDChannelCollectionHandle) {
673 addDetId(disabledChannels.detId());
688 using std::noshowpos;
692 using std::setprecision;
695 ss <<
"id:[" << det <<
"]" <<deli;
701 ss <<
"layer:[" << layer <<
"]" << deli
702 <<
"ladder:[" << right << setw(2) << ladder <<
"]" << deli
703 <<
"module:[" << module <<
"]" << deli;
708 ss << left << setw(6) <<
"disk:" <<
"[" << right << disk <<
"]" << deli
709 << left << setw(7) <<
"blade:" <<
"[" << setw(2) << right << blade <<
"]" << deli
710 << left << setw(7) <<
"panel:" <<
"[" << right << panel <<
"]" << deli;
712 float phiA,phiB,zA,zB,rA,rB;
714 tie(phiA,phiB) = detSurface.
phiSpan();
715 tie(zA,zB) = detSurface.zSpan();
716 tie(rA,rB) = detSurface.rSpan();
722 <<
"phi:[" << right << setw(12) << phiA <<
"," << left << setw(12) << phiB <<
"]" << deli
723 <<
"z:[" << right << setw(7) << zA <<
"," << left << setw(7) << zB <<
"]" << deli << noshowpos
724 <<
"r:[" << right << setw(10) << rA <<
"," << left << setw(10) << rB <<
"]" << deli;
728 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Barrel detectors:";
734 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
741 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Bad barrel detectors:";
747 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
757 for(
auto const & detGroup : badDetGroupsBar){
758 ss << std::setfill(
' ') << std::left << std::setw(16) <<
"DetGroup:";
763 detGroupSpanInfo(cspan,ss);
765 for(
auto const & det : detGroup){
770 for(
auto const & detGroup : badDetGroupsEnd){
771 ss << std::setfill(
' ') << std::left << std::setw(16) <<
"DetGroup:";
776 detGroupSpanInfo(cspan,ss);
778 for(
auto const & det : detGroup){
788 for(
auto const & cspan : cspans.first){
789 detGroupSpanInfo(cspan,ss);ss<<std::endl;
791 for(
auto const & cspan : cspans.second){
792 detGroupSpanInfo(cspan,ss);ss<<std::endl;
799 std::ofstream fsDet(
"DETECTORS.txt");
804 edm::LogPrint(
"PixelInactiveAreaFinder") <<
"Endcap detectors;";
812 std::ofstream fsBadDet(
"BADDETECTORS.txt");
821 fsBadDet << ss.rdbuf();
824 std::ofstream fsSpans(
"DETGROUPSPANS.txt");
826 for(
auto const & cspan : cspans.first){
827 detGroupSpanInfo(cspan,ss);ss<<std::endl;
829 for(
auto const & cspan : cspans.second){
830 detGroupSpanInfo(cspan,ss);ss<<std::endl;
832 fsSpans << ss.rdbuf();
847 using std::remove_if;
853 auto const & detId =
DetId(det);
854 unsigned int layer = tTopo->pxbLayer (detId);
855 unsigned int ladder = tTopo->pxbLadder(detId);
856 unsigned int module = tTopo->pxbModule(detId);
859 adj.push_back( tTopo->pxbDetId( layer, ((ladder-1)+1)%nLads+1, module )() );
860 adj.push_back( tTopo->pxbDetId( layer, ((ladder-1)-1+nLads)%nLads+1, module )() );
863 adj.push_back( tTopo->pxbDetId( layer, ladder, module+1 )() );
866 adj.push_back( tTopo->pxbDetId( layer, ladder, module-1 )() );
869 adj.push_back( tTopo->pxbDetId( layer, ladder, module+1 )() );
870 adj.push_back( tTopo->pxbDetId( layer, ladder, module-1 )() );
873 adj.erase(remove_if(adj.begin(),adj.end(),bind1st(
882 Span_t phiSpan, phiSpanComp;
884 unsigned int disk, diskComp;
887 tie(z,
ignore) = detSurf.zSpan();
891 auto const & detIdComp =
DetId(detComp);
894 phiSpanComp = detSurfComp.phiSpan();
895 tie(zComp,
ignore) = detSurfComp.zSpan();
896 if(det != detComp && disk == diskComp && z*zComp > 0
897 && phiRangesOverlap(phiSpan,phiSpanComp)){
898 adj.push_back(detComp);
905 std::queue<det_t> workQueue;
908 foundDets.insert(initDet);
909 workQueue.push(initDet);
910 reachableDetGroup.push_back(initDet);
911 while(!workQueue.empty()){
912 workDet = workQueue.front();workQueue.pop();
920 for(
auto const & badDet : badAdjDets){
921 if(foundDets.find(badDet) == foundDets.end()){
922 reachableDetGroup.push_back(badDet);
923 foundDets.insert(badDet);
924 workQueue.push(badDet);
934 if(foundDets.find(badDet) == foundDets.end()){
944 if(foundDets.find(badDet) == foundDets.end()){
952 detGroups.push_back(adjacentDets);
960 if(detGroup.empty()){
968 using LadderSet = std::set<uint>;
969 using LadVec = std::vector<uint>;
971 for(
auto const & det : detGroup){
974 LadVec ladv(lads.begin(),lads.end());
978 uint currentLadder = ladv[0];
979 uint previousLadder = ladv[ (ladv.size()+i-1) % ladv.size() ];
981 while ( (nLadders+currentLadder-1)%nLadders == previousLadder ){
983 currentLadder = ladv[i%ladv.size()];
984 previousLadder = ladv[ (ladv.size()+i-1)%ladv.size() ];
985 if(i == ladv.size()){
991 uint startLadder = currentLadder;
992 uint endLadder = previousLadder;
1008 DetGroup::const_iterator startDetIter = detGroup.begin();
1009 Span_t phiSpan,phiSpanComp;
1012 phiSpan = tGeom->idToDet(
DetId(*startDetIter))->surface().phiSpan();
1013 for(DetGroup::const_iterator compDetIter=detGroup.begin();compDetIter!=detGroup.end();++compDetIter){
1014 phiSpanComp = tGeom->idToDet(
DetId(*compDetIter))->surface().phiSpan();
1015 if(phiRangesOverlap(phiSpan,phiSpanComp)
1016 && phiMoreClockwise(phiSpanComp.first,phiSpan.first)
1017 && startDetIter != compDetIter)
1020 if(counter > detGroup.size()){
1025 startDetIter = compDetIter;
break;
1026 }
else if (compDetIter == detGroup.end()-1){
1031 cspan.
phiSpan.first = phiSpan.first;
1034 DetGroup::const_iterator endDetIter = detGroup.begin();
1037 phiSpan = tGeom->idToDet(
DetId(*endDetIter))->surface().phiSpan();
1038 for(DetGroup::const_iterator compDetIter=detGroup.begin();compDetIter!=detGroup.end();++compDetIter){
1039 phiSpanComp = tGeom->idToDet(
DetId(*compDetIter))->surface().phiSpan();
1040 if(phiRangesOverlap(phiSpan,phiSpanComp)
1041 && phiMoreCounterclockwise(phiSpanComp.second,phiSpan.second)
1042 && endDetIter != compDetIter)
1045 if(counter > detGroup.size()){
1050 endDetIter = compDetIter;
break;
1051 }
else if (compDetIter == detGroup.end()-1){
1056 cspan.
phiSpan.second = phiSpan.second;
1059 auto cmpFun = [
this] (
det_t detA,
det_t detB){
1067 auto minmaxIters = std::minmax_element(detGroup.begin(),detGroup.end(),cmpFun);
1072 auto cmpFun = [
this] (
det_t detA,
det_t detB){
1080 auto minmaxIters = std::minmax_element(detGroup.begin(),detGroup.end(),cmpFun);
1085 auto firstDetIt = detGroup.begin();
1086 if(firstDetIt != detGroup.end()){
1106 for(
auto const & detGroup : badDetGroupsBar){
1109 cspansBarrel.push_back(cspan);
1111 for(
auto const & detGroup : badDetGroupsEnd){
1114 cspansEndcap.push_back(cspan);
void setComment(std::string const &value)
std::pair< DetGroupSpanContainer, DetGroupSpanContainer > DetGroupSpanContainerPair
const std::vector< std::pair< unsigned short, unsigned short > > * inactiveLayerPairIndices_
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
SeedingLayerSetsBuilder::SeedingLayerId SeedingLayerId
std::vector< std::pair< VecArray2< Area >, std::vector< LayerSetIndex > > > areasAndLayerSets(const GlobalPoint &point, float zwidth) const
const std::vector< std::vector< LayerSetIndex > > * layerSetIndexInactiveToActive_
std::vector< uint32_t > DetGroup
std::vector< edm::EDGetTokenT< DetIdCollection > > inactivePixelDetectorTokens_
const bool ignoreSingleFPixPanelModules_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
std::pair< float, float > const & phiSpan() const
std::array< unsigned short, 4 > nBPixLadders
unsigned int pxfDisk(const DetId &id) const
std::pair< float, float > const & zSpan() const
std::pair< float, float > const & rSpan() const
DetContainer badPixelDetsEndcap_
unsigned int pxbLadder(const DetId &id) const
Global3DPoint GlobalPoint
std::ostream & operator<<(std::ostream &os, SeedingLayerSetsBuilder::SeedingLayerId layer)
unsigned int pxbModule(const DetId &id) const
std::pair< float, float > zSpan
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)
void emplace_back(Args &&...args)
static void fillDescriptions(edm::ParameterSetDescription &desc)
const Plane & surface() const
The nominal surface of the GeomDet.
DetGroup reachableDetGroup(const det_t &initDet, DetectorSet &foundDets)
unsigned int numberOfLayers(int subdet) const
std::vector< std::pair< unsigned short, unsigned short > > inactiveLayerSetIndices_
void getRSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
void printBadDetGroupSpans()
DetGroupContainer badDetGroupsEndcap()
std::tuple< GeomDetEnumerators::SubDetector, TrackerDetSide, int > SeedingLayerId
void getPhiSpanBarrel(const DetGroup &detGroup, DetGroupSpan &cspan)
std::pair< float, float > rSpan
def unique(seq, keepstr=True)
void detInfo(const det_t &det, Stream &ss)
const DetContainer & detsPXB() const
std::vector< DetGroupSpanContainer > inactiveSpans_
std::set< uint32_t > DetectorSet
DetGroupContainer badDetGroupsBarrel()
void createPlottingFiles()
DetGroup badAdjecentDetsBarrel(const det_t &det)
InactiveAreas inactiveAreas(const edm::Event &iEvent, const edm::EventSetup &iSetup)
const std::vector< disabledModuleType > getBadComponentList() const
const TrackerGeometry * trackerGeometry_
ParameterDescriptionBase * add(U const &iLabel, T const &value)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
void getBadPixelDets(const edm::Event &iEvent, const edm::EventSetup &iSetup)
std::vector< DetGroup > DetGroupContainer
def elem(elemtype, innerHTML='', html_class='', kwargs)
std::vector< edm::EDGetTokenT< PixelFEDChannelCollection > > badPixelFEDChannelsTokens_
unsigned int pxbLayer(const DetId &id) const
double deltaPhi(double phi1, double phi2)
DetContainer badPixelDetsBarrel_
PixelInactiveAreaFinder(const edm::ParameterSet &iConfig, const std::vector< SeedingLayerId > &seedingLayers, const SeedingLayerSetsLooper &seedingLayerSetsLooper, edm::ConsumesCollector &&iC)
const TrackerTopology * trackerTopology_
std::vector< DetGroupSpan > DetGroupSpanContainer
DetContainer pixelDetsEndcap_
void getSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
bool check(const edm::EventSetup &iSetup)
DetContainer pixelDetsBarrel_
unsigned int layer(const DetId &id) const
unsigned short nModulesPerLadder
static std::atomic< unsigned int > counter
const DetContainer & detsPXF() const
const TrackerGeomDet * idToDet(DetId) const override
void getPhiSpanEndcap(const DetGroup &detGroup, DetGroupSpan &cspan)
DetGroupSpanContainerPair detGroupSpans()
DetGroup badAdjecentDetsEndcap(const det_t &det)
DetId pxbDetId(uint32_t layer, uint32_t ladder, uint32_t module) const
std::pair< float, float > phiSpan
T const * product() const
unsigned int pxfPanel(const DetId &id) const
unsigned int pxfBlade(const DetId &id) const
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_
std::vector< std::pair< VecArray2< DetGroupSpan >, std::vector< LayerSetIndex > > > spansAndLayerSets(const GlobalPoint &point, float zwidth) const
const bool createPlottingFiles_
SeedingLayerSetsHits::LayerSetIndex LayerSetIndex
void getZSpan(const DetGroup &detGroup, DetGroupSpan &cspan)
edm::ESWatcher< TrackerDigiGeometryRecord > geometryWatcher_