19 const double padTimingEfficiency = 0.95;
34 if (iEta1 >= iEta0 + 2 || iEta1 <= iEta0 - 2)
36 if (iPhi1 >= iPhi0 + 2 || iPhi1 <= iPhi0 - 2)
39 if (iEta1 == iEta0 - 1)
41 else if (iEta1 == iEta0)
43 else if (iEta1 == iEta0 + 1)
46 if (iPhi1 == iPhi0 - 1)
48 else if (iPhi1 == iPhi0)
50 else if (iPhi1 == iPhi0 + 1)
58 const std::vector< std::shared_ptr<PadOfflineData> > &pads,
const std::vector< size_t > &padIndicesLayer0,
59 const std::vector< size_t > &padIndicesLayer1,
const std::vector< size_t > &padIndicesLayer2,
60 const std::vector< size_t > &padIndicesLayer3,
bool isLayer1,
bool isLayer2,
61 bool isLayer3,
bool isLayer4)
const {
63 std::vector< SingleWedgePadTrigger >
triggers;
64 size_t nHL1 = (isLayer1 ? padIndicesLayer0.size() : 1);
65 size_t nHL2 = (isLayer2 ? padIndicesLayer1.size() : 1);
66 size_t nHL3 = (isLayer3 ? padIndicesLayer2.size() : 1);
67 size_t nHL4 = (isLayer4 ? padIndicesLayer3.size() : 1);
69 if (isLayer1 && nHL1 == 0)
71 if (isLayer2 && nHL2 == 0)
73 if (isLayer3 && nHL3 == 0)
75 if (isLayer4 && nHL4 == 0)
86 for (
size_t il1 = 0; il1 < nHL1; il1++) {
88 std::string sl1(
"33");
90 l1Idx = padIndicesLayer0.at(il1);
94 for (
size_t il2 = 0; il2 < nHL2; il2++) {
96 std::string sl2(
"33");
98 l2Idx = padIndicesLayer1.at(il2);
103 else if (!
hitPattern(pads.at(iL1st), pads.at(l2Idx), sl2))
107 for (
size_t il3 = 0; il3 < nHL3; il3++) {
109 std::string sl3(
"33");
111 l3Idx = padIndicesLayer2.at(il3);
112 if (!
hitPattern(pads.at(iL1st), pads.at(l3Idx), sl3))
115 for (
size_t il4 = 0; il4 < nHL4; il4++) {
117 std::string sl4(
"33");
119 l4Idx = padIndicesLayer3.at(il4);
120 if (!
hitPattern(pads.at(iL1st), pads.at(l4Idx), sl4))
124 std::string
pattern(sl4 + sl3 + sl2 + sl1);
131 std::string patternPhi;
132 patternPhi.push_back(sl1.at(1));
133 patternPhi.push_back(sl2.at(1));
134 patternPhi.push_back(sl3.at(1));
135 patternPhi.push_back(sl4.at(1));
137 std::string patternEta;
138 patternEta.push_back(sl1.at(0));
139 patternEta.push_back(sl2.at(0));
140 patternEta.push_back(sl3.at(0));
141 patternEta.push_back(sl4.at(0));
143 int multipletid=-999;
148 multipletid = pads.at(l1Idx)->multipletId() ;
149 moduleid = pads.at(l1Idx)->moduleId();
150 sectortype = pads.at(l1Idx)->sectorType();
152 else if (sl2 ==
"11") {
153 multipletid = pads.at(l2Idx)->multipletId() ;
154 moduleid = pads.at(l2Idx)->moduleId();
155 sectortype = pads.at(l2Idx)->sectorType();
158 std::string etamove, phimove;
159 if (sectortype == 1) {
160 if (multipletid == 1) {
174 if (sectortype == 0) {
175 if (multipletid == 1) {
201 if (etamove ==
"D") {
202 if (
find(PatternsEtaDown.begin(), PatternsEtaDown.end(),
203 patternEta) == PatternsEtaDown.end()) {
208 if (etamove ==
"U") {
209 if (
find(PatternsEtaUp.begin(), PatternsEtaUp.end(),
210 patternEta) == PatternsEtaUp.end()) {
215 if (phimove ==
"U") {
216 if (
find(PatternsPhiUp.begin(), PatternsPhiUp.end(),
217 patternPhi) == PatternsPhiUp.end()) {
222 if (phimove ==
"D") {
223 if (
find(PatternsPhiDown.begin(), PatternsPhiDown.end(),
224 patternPhi) == PatternsPhiDown.end()) {
229 if (phimove ==
"UD") {
230 if (
find(PatternsPhiUpDown.begin(), PatternsPhiUpDown.end(),
231 patternPhi) == PatternsPhiUpDown.end()) {
236 if (phimove ==
"DU") {
237 if (
find(PatternsPhiDownUp.begin(), PatternsPhiDownUp.end(),
238 patternPhi) == PatternsPhiDownUp.end()) {
243 std::vector< size_t > padIndices;
247 padIndices.push_back(l1Idx);
251 padIndices.push_back(l2Idx);
256 padIndices.push_back(l3Idx);
261 padIndices.push_back(l4Idx);
279 std::vector< size_t >
out;
281 out.reserve(padIndices.size());
282 for (
size_t i = 0;
i < padIndices.size(); ++
i) {
283 if (
rand.Uniform(1) < padTimingEfficiency)
284 out.push_back(padIndices.at(
i));
290 const std::vector< size_t > &iL0,
291 const std::vector< size_t > &iL1,
292 const std::vector< size_t > &iL2,
293 const std::vector< size_t > &iL3)
const {
295 std::vector< SingleWedgePadTrigger > trigNoL0(
buildSingleWedgeTriggers(pads, iL0, iL1, iL2, iL3,
false,
true,
true,
true));
296 std::vector< SingleWedgePadTrigger > trigNoL1(
buildSingleWedgeTriggers(pads, iL0, iL1, iL2, iL3,
true,
false,
true,
true));
297 std::vector< SingleWedgePadTrigger > trigNoL2(
buildSingleWedgeTriggers(pads, iL0, iL1, iL2, iL3,
true,
true,
false,
true));
298 std::vector< SingleWedgePadTrigger > trigNoL3(
buildSingleWedgeTriggers(pads, iL0, iL1, iL2, iL3,
true,
true,
true,
false));
299 std::vector< SingleWedgePadTrigger >
triggers;
307 const std::vector< size_t > &iL0,
308 const std::vector< size_t > &iL1,
309 const std::vector< size_t > &iL2,
310 const std::vector< size_t > &iL3)
const {
327 sort(idxes.begin(),idxes.end());
328 std::vector< size_t > commonIndices(
indices.size() > idxes.size() ?
indices.size(): idxes.size());
332 return allIdsPresent;
336 void remove3of4Redundant4of4(
const std::vector< SingleWedgePadTrigger > &trigs4of4,std::vector< SingleWedgePadTrigger > &trigs3of4){
337 for (std::vector< SingleWedgePadTrigger >::const_iterator
t4 = trigs4of4.begin();
t4 != trigs4of4.end();++
t4) {
338 trigs3of4.erase(std::remove_if(trigs3of4.begin(), trigs3of4.end(),
TrigIsSubsetOf(*
t4)),trigs3of4.end());
344 std::vector<SectorTriggerCandidate> secTrigCand;
346 std::vector< size_t > indicesSecN(pads.size());
347 std::iota(indicesSecN.begin(),indicesSecN.end(),0);
348 const int innerMultiplet(1), outerMultiplet(2);
349 std::vector< size_t > indicesInner =
filterByMultiplet(pads, indicesSecN, innerMultiplet);
350 std::vector< size_t > indicesOuter =
filterByMultiplet(pads, indicesSecN, outerMultiplet);
359 std::vector< SingleWedgePadTrigger > i4of4trig(
build44swt(pads, idxesI1, idxesI2, idxesI3, idxesI4));
360 std::vector< SingleWedgePadTrigger > i3of4trig(
build34swt(pads, idxesI1, idxesI2, idxesI3, idxesI4));
361 std::vector< SingleWedgePadTrigger > o4of4trig(
build44swt(pads, idxesO1, idxesO2, idxesO3, idxesO4));
362 std::vector< SingleWedgePadTrigger > o3of4trig(
build34swt(pads, idxesO1, idxesO2, idxesO3, idxesO4));
368 <<
" inner : " << i3of4trig.size() <<
"(3/4) " << i4of4trig.size()
370 <<
" outer : " << o3of4trig.size() <<
"(3/4) " << o4of4trig.size()
373 std::vector< SingleWedgePadTrigger > innerTrigs, outerTrigs;
374 innerTrigs.insert(innerTrigs.end(), i3of4trig.begin(), i3of4trig.end());
375 innerTrigs.insert(innerTrigs.end(), i4of4trig.begin(), i4of4trig.end());
376 outerTrigs.insert(outerTrigs.end(), o3of4trig.begin(), o3of4trig.end());
377 outerTrigs.insert(outerTrigs.end(), o4of4trig.begin(), o4of4trig.end());
378 bool acceptSingleWedgeInTransition =
true;
380 for (
auto&
it : innerTrigs) {
381 for (
auto&
ot: outerTrigs) {
386 float Z1=
ot.pads().at(0)->m_cornerXyz[1][2];
387 float Z0=
it.pads().at(0)->m_cornerXyz[1][2];
391 float overlap=
area(inoutovl);
395 secTrigCand.emplace_back(
it.setCombined(),
ot.setCombined());
401 if (acceptSingleWedgeInTransition) {
402 for (
auto&
it : innerTrigs){
403 if (
it.alreadyCombined()){
404 ATH_MSG_DEBUG(
"Inner SingleWedge trigger already combined, skipping");
407 else if ((
it.is4outOf4Layers()||
it.is3outOf4Layers()) &&
it.isInTransitionRegion(Zratio)){
408 secTrigCand.emplace_back(
it.setCombined());
411 for (
auto&
ot : outerTrigs) {
412 if (
ot.alreadyCombined()){
413 ATH_MSG_DEBUG(
"Outer SingleWedge trigger already combined, skipping");
416 else if ((
ot.is4outOf4Layers()||
ot.is3outOf4Layers()) &&
ot.isInTransitionRegion(Zratio)){
417 secTrigCand.emplace_back(
ot.setCombined());
423 ATH_MSG_DEBUG(
"found " << secTrigCand.size() <<
" triggerCandidates from "<< pads.size() <<
" pads");
424 for (
const auto& tc : secTrigCand)
ATH_MSG_DEBUG(
"trigger region area : " <<
area(tc.triggerRegion3()));
437 constexpr
static std::array<std::string_view, 10>
patterns = {
"1111",
"1122",
"3111",
"3122",
"1311",
"1322",
"1131",
"1132",
"1113",
"1123"};
442 constexpr
static std::array<std::string_view, 10>
patterns = {
"1111",
"1100",
"3111",
"3100",
"1311",
"1300",
"1131",
"1130",
"1113",
"1103"};
447 constexpr
static std::array<std::string_view, 16>
patterns = {
"1111",
"1112",
"1122",
"1222",
"1113",
"1123",
"1223",
"1131",
"1132",
"1232",
448 "1311",
"1312",
"1322",
"3111",
"3112",
"3122"};
453 constexpr
static std::array<std::string_view, 16>
patterns = {
"1111",
"1110",
"1100",
"1000",
"1113",
"1103",
"1003",
"1131",
"1130",
"1230",
454 "1311",
"1310",
"1300",
"3111",
"3110",
"3100"};
459 constexpr
static std::array<std::string_view, 10>
patterns = {
"1111",
"1212",
"1113",
"1213",
"1131",
"1232",
"1311",
"1312",
"3111",
"3101"};
464 constexpr
static std::array<std::string_view, 10>
patterns = {
"1111",
"1010",
"1113",
"1013",
"1131",
"1030",
"1311",
"1310",
"3111",
"3121"};
471 const std::vector<size_t> &padSelectedIndices,
475 for(
size_t i=0;
i<padSelectedIndices.size();
i++){
476 const size_t idx=padSelectedIndices[
i];
483 const std::vector<size_t> &padSelectedIndices,
487 for(
size_t i=0;
i<padSelectedIndices.size();
i++){
488 const size_t idx=padSelectedIndices[
i];
489 if(multiplet==pads[
idx]->multipletId())
indices.push_back(
idx);