22 ATH_MSG_ERROR(
"Configuration seems to be wrong. The size of \"Plateaus\" should be same as \"MonitoredChainds\".");
23 return StatusCode::FAILURE;
25 for(
unsigned int ichain=0; ichain<nchains; ++ichain){
29 return StatusCode::SUCCESS;
38 if(
chain.find(
"probe") != std::string::npos )
return StatusCode::SUCCESS;
45 std::vector< const xAOD::L2CombinedMuon* > Trig_L2IOobjects;
49 ATH_MSG_DEBUG(
" Trig_L2IOobjects.size(): " << Trig_L2IOobjects.size() );
52 for(
const auto& Trig_L2IOobject : Trig_L2IOobjects){
53 ATH_MSG_DEBUG(
" Trig_L2IOobject->muSATrack()->roiWord()/Trig_L2IOobject->pt(): " << Trig_L2IOobject->muSATrack()->roiWord() <<
"/" << Trig_L2IOobject->pt() );
55 bool mf_failure =
false;
59 cbioPt = Trig_L2IOobject->pt()/1
e3 * Trig_L2IOobject->charge();
60 cbioEta = Trig_L2IOobject->eta();
61 cbioPhi = Trig_L2IOobject->phi();
62 ATH_MSG_DEBUG(
"cbioPt = " << cbioPt <<
", cbioEta =" << cbioEta <<
", cbioPhi = " << cbioPhi);
63 if(std::abs(cbioPt) <
ZERO_LIMIT || std::abs(Trig_L2IOobject->muSATrack()->pt()) <
ZERO_LIMIT) mf_failure =
true;
65 if( mf_failure )
continue;
72 int saddr = Trig_L2IOobject->muSATrack()->sAddress();
73 if(saddr == -1) isEndcap =
true;
83 return StatusCode::SUCCESS;
100 offPt =
mu->pt()/1
e3 *
mu->charge();
103 float offCharge =
mu->charge();
106 if(
chain.find(
"probe") != std::string::npos ){
107 if(
chain.find(
"L1MU14FCH") != std::string::npos){
108 if ( !
getTrigDecisionTool()->isPassed(
"HLT_mu24_ivarmedium_L1MU14FCH") )
return StatusCode::SUCCESS;
110 else if(
chain.find(
"L1MU18VFCH") != std::string::npos){
111 if ( !
getTrigDecisionTool()->isPassed(
"HLT_mu24_ivarmedium_L1MU18VFCH") )
return StatusCode::SUCCESS;
115 return StatusCode::SUCCESS;
120 if(
tag ==
nullptr )
return StatusCode::SUCCESS;
128 if( !tag_ms_track.
isValid() )
return StatusCode::SUCCESS;
130 if( !probe_ms_track.
isValid() )
return StatusCode::SUCCESS;
131 float tpext_deta = (*tag_ms_track)->eta() - (*probe_ms_track)->eta();
133 offdR = std::sqrt(tpext_deta*tpext_deta + tpext_dphi*tpext_dphi);
135 passL2InsideOut =
false;
139 int legIndex_probe = 1;
141 TrigDefs::includeFailedDecisions,
143 TrigDefs::lastFeatureOfType,
148 ATH_CHECK( probe_L2SALinkInfo.isValid() );
155 if(passL2SA ==
true){
160 passL2InsideOut = isPass;
164 return StatusCode::SUCCESS;
175 if( Trig_L2IOobject ==
nullptr )
return StatusCode::SUCCESS;
176 if( !
m_matchTool->isMatchedL2InsideOut(Trig_L2IOobject,
mu) )
return StatusCode::SUCCESS;
188 std::vector< int > L2Muon_chamberID_index;
190 for(
int i = 0;
i < 6;
i++){
191 L2Muon_chamberID_index.push_back(
i);
199 const float ETA_OF_BARREL = 1.05;
214 if( std::abs(offEta) < ETA_OF_BARREL ) {
217 if( offEta > 0. ) isBarrelA =
true;
218 else isBarrelC =
true;
223 if( offEta > 0. ) isEndcapA =
true;
224 else isEndcapC =
true;
227 if( std::abs(offPt) > 4 ){
228 if( std::abs(offPt) < 6 ) pt4to6 =
true;
229 else if( std::abs(offPt) < 8 ) pt6to8 =
true;
237 cbioPt = Trig_L2IOobject->
pt()/1
e3 * Trig_L2IOobject->
charge();
238 cbioEta = Trig_L2IOobject->
eta();
239 cbioPhi = Trig_L2IOobject->
phi();
243 L2InsideOut_multiplicity = 0;
244 std::vector< const xAOD::L2CombinedMuon* > Trig_L2IOobjects_tmp;
246 for(
const auto& Trig_L2IOobject_tmp : Trig_L2IOobjects_tmp){
247 if( Trig_L2IOobject_tmp->muSATrack()->roiWord() == Trig_L2IOobject->
muSATrack()->
roiWord() ) L2InsideOut_multiplicity++;
253 ptresol = std::abs(cbioPt)/std::abs(offPt) - 1.;
256 std::vector< float > ptresol_pos, ptresol_neg;
259 if( offCharge > 0. ) ptresol_pos.push_back(ptresol);
260 else ptresol_neg.push_back(ptresol);
263 std::vector< float > distance_bw_FTFroad_and_offlinesegment_Inn_Barrel;
264 std::vector< float > distance_bw_FTFroad_and_offlinesegment_Mid_Barrel;
265 std::vector< float > distance_bw_FTFroad_and_offlinesegment_Out_Barrel;
266 std::vector< float > distance_bw_FTFroad_and_offlinesegment_Inn_Endcap;
267 std::vector< float > distance_bw_FTFroad_and_offlinesegment_Mid_Endcap;
268 std::vector< float > distance_bw_FTFroad_and_offlinesegment_Out_Endcap;
269 auto mon_distance_bw_FTFroad_and_offlinesegment_Inn_Barrel =
Monitored::Collection(
chain+
"_distance_bw_FTFroad_and_offlinesegment_Inn_Barrel",distance_bw_FTFroad_and_offlinesegment_Inn_Barrel);
270 auto mon_distance_bw_FTFroad_and_offlinesegment_Mid_Barrel =
Monitored::Collection(
chain+
"_distance_bw_FTFroad_and_offlinesegment_Mid_Barrel",distance_bw_FTFroad_and_offlinesegment_Mid_Barrel);
271 auto mon_distance_bw_FTFroad_and_offlinesegment_Out_Barrel =
Monitored::Collection(
chain+
"_distance_bw_FTFroad_and_offlinesegment_Out_Barrel",distance_bw_FTFroad_and_offlinesegment_Out_Barrel);
272 auto mon_distance_bw_FTFroad_and_offlinesegment_Inn_Endcap =
Monitored::Collection(
chain+
"_distance_bw_FTFroad_and_offlinesegment_Inn_Endcap",distance_bw_FTFroad_and_offlinesegment_Inn_Endcap);
273 auto mon_distance_bw_FTFroad_and_offlinesegment_Mid_Endcap =
Monitored::Collection(
chain+
"_distance_bw_FTFroad_and_offlinesegment_Mid_Endcap",distance_bw_FTFroad_and_offlinesegment_Mid_Endcap);
274 auto mon_distance_bw_FTFroad_and_offlinesegment_Out_Endcap =
Monitored::Collection(
chain+
"_distance_bw_FTFroad_and_offlinesegment_Out_Endcap",distance_bw_FTFroad_and_offlinesegment_Out_Endcap);
276 std::vector< float > distance_bw_FTFroad_and_offlinesegment_vec;
277 std::vector< float > FTFroad_Aw;
278 std::vector< float > FTFroad_Bw;
279 std::vector< bool > FTFroad_fill;
280 for(
int i=0;
i<6;
i++){
281 distance_bw_FTFroad_and_offlinesegment_vec.push_back(10000.);
284 FTFroad_fill.push_back(
false);
288 std::vector<float> res_Inn_Barrel, res_Mid_Barrel, res_Out_Barrel, res_Inn_Endcap, res_Mid_Endcap, res_Out_Endcap;
297 std::vector< float > distance_bw_MDT_and_offlinesegment_Inn_Barrel;
298 std::vector< float > distance_bw_MDT_and_offlinesegment_Mid_Barrel;
299 std::vector< float > distance_bw_MDT_and_offlinesegment_Out_Barrel;
300 std::vector< float > distance_bw_MDT_and_offlinesegment_Inn_Endcap;
301 std::vector< float > distance_bw_MDT_and_offlinesegment_Mid_Endcap;
302 std::vector< float > distance_bw_MDT_and_offlinesegment_Out_Endcap;
303 auto mon_distance_bw_MDT_and_offlinesegment_Inn_Barrel =
Monitored::Collection(
chain+
"_distance_bw_MDT_and_offlinesegment_Inn_Barrel",distance_bw_MDT_and_offlinesegment_Inn_Barrel);
304 auto mon_distance_bw_MDT_and_offlinesegment_Mid_Barrel =
Monitored::Collection(
chain+
"_distance_bw_MDT_and_offlinesegment_Mid_Barrel",distance_bw_MDT_and_offlinesegment_Mid_Barrel);
305 auto mon_distance_bw_MDT_and_offlinesegment_Out_Barrel =
Monitored::Collection(
chain+
"_distance_bw_MDT_and_offlinesegment_Out_Barrel",distance_bw_MDT_and_offlinesegment_Out_Barrel);
306 auto mon_distance_bw_MDT_and_offlinesegment_Inn_Endcap =
Monitored::Collection(
chain+
"_distance_bw_MDT_and_offlinesegment_Inn_Endcap",distance_bw_MDT_and_offlinesegment_Inn_Endcap);
307 auto mon_distance_bw_MDT_and_offlinesegment_Mid_Endcap =
Monitored::Collection(
chain+
"_distance_bw_MDT_and_offlinesegment_Mid_Endcap",distance_bw_MDT_and_offlinesegment_Mid_Endcap);
308 auto mon_distance_bw_MDT_and_offlinesegment_Out_Endcap =
Monitored::Collection(
chain+
"_distance_bw_MDT_and_offlinesegment_Out_Endcap",distance_bw_MDT_and_offlinesegment_Out_Endcap);
309 std::vector< float > distance_bw_MDT_and_offlinesegment_vec;
310 std::vector< int > MDTHitChamber_fill;
311 std::vector< int > MDTHitChamber;
312 std::vector< float > MDTHitR;
313 std::vector< float > MDTHitZ;
316 std::vector<int> MDT_N_Inn_Barrel, MDT_N_Mid_Barrel, MDT_N_Out_Barrel, MDT_N_Inn_Endcap, MDT_N_Mid_Endcap, MDT_N_Out_Endcap;
323 int n_mdthits_BI = 0;
324 int n_mdthits_BM = 0;
325 int n_mdthits_BO = 0;
326 int n_mdthits_EI = 0;
327 int n_mdthits_EM = 0;
328 int n_mdthits_EO = 0;
331 for(
int i_tube=0; i_tube<n_mdt_hits; i_tube++){
335 MDTHitChamber.push_back(imr);
339 if( imr == Inn_Barrel ){
341 res_Inn_Barrel.push_back(
res);
343 else if( imr == Mid_Barrel ){
345 res_Mid_Barrel.push_back(
res);
347 else if( imr == Out_Barrel ){
349 res_Out_Barrel.push_back(
res);
351 else if( imr == Inn_Endcap ){
353 res_Inn_Endcap.push_back(
res);
355 else if( imr == Mid_Endcap ){
357 res_Mid_Endcap.push_back(
res);
359 else if( imr == Out_Endcap ){
361 res_Out_Endcap.push_back(
res);
366 std::vector<bool> superpoint_exist_pt4to6, superpoint_exist_pt6to8, superpoint_exist_ptover8;
370 std::vector<bool> segment_superpoint_exist(6,
false);
371 std::vector<bool> offlinesegment_exist_pt4to6, offlinesegment_exist_pt6to8, offlinesegment_exist_ptover8;
378 std::vector< bool > superpoint_exist;
379 std::vector< float > superpointR;
380 int Num_L2Muon_chamberID = 12;
381 for(
int i_chamber = 0; i_chamber < Num_L2Muon_chamberID; i_chamber++){
383 superpoint_exist.push_back(
false);
386 superpoint_exist.push_back(
true);
387 superpoint_multiplicity++;
393 std::vector< bool > segment_exist(6,
false);
394 for(
unsigned int i_seg = 0; i_seg <
mu->nMuonSegments(); i_seg++){
400 float segmentR = std::sqrt(
std::pow(segmentX, 2.0) +
std::pow(segmentY, 2.0) );
401 float segmentPx =
segment->px();
402 float segmentPy =
segment->py();
403 float segmentPz =
segment->pz();
404 float segmentSector =
segment->sector();
405 int segmentChamberIndex =
segment->chamberIndex();
406 float distance_bw_FTFroad_and_offlinesegment = 99999.;
407 float distance_bw_MDT_and_offlinesegment = 99999.;
408 int roadChamberIndex = -1;
409 int MDTChamberIndex = -1;
410 if( segmentChamberIndex == 0 || segmentChamberIndex == 1 ){
411 segment_exist.at(Inn_Barrel) =
true;
412 roadChamberIndex = Inn_Barrel;
413 MDTChamberIndex = Inn_Barrel;
415 else if( segmentChamberIndex == 2 || segmentChamberIndex == 3 ){
416 segment_exist.at(Mid_Barrel) =
true;
417 roadChamberIndex = Mid_Barrel;
418 MDTChamberIndex = Mid_Barrel;
420 else if( segmentChamberIndex == 4 || segmentChamberIndex == 5 ){
421 segment_exist.at(Out_Barrel) =
true;
422 roadChamberIndex = Out_Barrel;
423 MDTChamberIndex = Out_Barrel;
425 else if( segmentChamberIndex == 7 || segmentChamberIndex == 8 ){
426 segment_exist.at(Inn_Endcap) =
true;
427 roadChamberIndex = Inn_Endcap;
428 MDTChamberIndex = Inn_Endcap;
430 else if( segmentChamberIndex == 9 || segmentChamberIndex == 10 ){
431 segment_exist.at(Mid_Endcap) =
true;
432 roadChamberIndex = Mid_Endcap;
433 MDTChamberIndex = Mid_Endcap;
435 else if( segmentChamberIndex == 11 || segmentChamberIndex == 12 ){
436 segment_exist.at(Out_Endcap) =
true;
437 roadChamberIndex = Out_Endcap;
438 MDTChamberIndex = Out_Endcap;
442 if( roadChamberIndex != -1 ){
443 if( FTFroad_Aw.at(roadChamberIndex) >
ZERO_LIMIT || FTFroad_Bw.at(roadChamberIndex) >
ZERO_LIMIT ){
444 FTFroad_fill.at(roadChamberIndex) =
true;
445 if( FTFroad_Aw.at(roadChamberIndex) <
ZERO_LIMIT) distance_bw_FTFroad_and_offlinesegment = segmentR - FTFroad_Bw.at(roadChamberIndex);
447 float ia = 1.0/FTFroad_Aw.at(roadChamberIndex);
449 distance_bw_FTFroad_and_offlinesegment = (segmentZ - ia * (segmentR - FTFroad_Bw.at(roadChamberIndex)))/std::sqrt(1.0 + iaq);
451 if( std::abs(distance_bw_FTFroad_and_offlinesegment) < std::abs(distance_bw_FTFroad_and_offlinesegment_vec.at(roadChamberIndex)) )
452 distance_bw_FTFroad_and_offlinesegment_vec.at(roadChamberIndex) = distance_bw_FTFroad_and_offlinesegment;
457 if( MDTChamberIndex != -1 ){
458 float sector_phi =
M_PI*(segmentSector - 1.0)/8.0;
459 float segmentR_projection = segmentX *
std::cos(sector_phi) + segmentY *
std::sin(sector_phi);
460 float segmentPr_projection = segmentPx *
std::cos(sector_phi) + segmentPy *
std::sin(sector_phi);
462 for(
unsigned int i_tube=0; i_tube<MDTHitChamber.size(); i_tube++){
463 if( MDTHitChamber.at(i_tube) != MDTChamberIndex )
continue;
464 if( MDTChamberIndex < 3 ){
465 if( std::abs(segmentPz) <
ZERO_LIMIT ) distance_bw_MDT_and_offlinesegment = MDTHitZ.at(i_tube) - segmentZ;
467 float denominator = segmentPr_projection/segmentPz;
469 distance_bw_MDT_and_offlinesegment = MDTHitZ.at(i_tube) - ((MDTHitR.at(i_tube) - segmentR_projection)/
denominator + segmentZ);
474 distance_bw_MDT_and_offlinesegment = MDTHitR.at(i_tube) - segmentR;
477 float coeffi = (MDTHitZ.at(i_tube) - segmentZ)/segmentPz;
478 float segmentR_extrapolated = std::sqrt(
std::pow(segmentX + coeffi * segmentPx, 2.0) +
std::pow(segmentY + coeffi * segmentPy, 2.0));
479 distance_bw_MDT_and_offlinesegment = MDTHitR.at(i_tube) - segmentR_extrapolated;
482 distance_bw_MDT_and_offlinesegment_vec.push_back(distance_bw_MDT_and_offlinesegment);
483 MDTHitChamber_fill.push_back(MDTHitChamber.at(i_tube));
488 if( FTFroad_fill.at(Inn_Barrel) ){
489 distance_bw_FTFroad_and_offlinesegment_Inn_Barrel.push_back(distance_bw_FTFroad_and_offlinesegment_vec.at(Inn_Barrel));
491 if( FTFroad_fill.at(Mid_Barrel) ){
492 distance_bw_FTFroad_and_offlinesegment_Mid_Barrel.push_back(distance_bw_FTFroad_and_offlinesegment_vec.at(Mid_Barrel));
494 if( FTFroad_fill.at(Out_Barrel) ){
495 distance_bw_FTFroad_and_offlinesegment_Out_Barrel.push_back(distance_bw_FTFroad_and_offlinesegment_vec.at(Out_Barrel));
497 if( FTFroad_fill.at(Inn_Endcap) ){
498 distance_bw_FTFroad_and_offlinesegment_Inn_Endcap.push_back(distance_bw_FTFroad_and_offlinesegment_vec.at(Inn_Endcap));
500 if( FTFroad_fill.at(Mid_Endcap) ){
501 distance_bw_FTFroad_and_offlinesegment_Mid_Endcap.push_back(distance_bw_FTFroad_and_offlinesegment_vec.at(Mid_Endcap));
503 if( FTFroad_fill.at(Out_Endcap) ){
504 distance_bw_FTFroad_and_offlinesegment_Out_Endcap.push_back(distance_bw_FTFroad_and_offlinesegment_vec.at(Out_Endcap));
507 for(
unsigned int i = 0;
i < distance_bw_MDT_and_offlinesegment_vec.size();
i++ ){
508 if( MDTHitChamber_fill.at(
i) == Inn_Barrel ){
509 distance_bw_MDT_and_offlinesegment_Inn_Barrel.push_back(distance_bw_MDT_and_offlinesegment_vec.at(
i));
511 else if( MDTHitChamber_fill.at(
i) == Mid_Barrel ){
512 distance_bw_MDT_and_offlinesegment_Mid_Barrel.push_back(distance_bw_MDT_and_offlinesegment_vec.at(
i));
514 else if( MDTHitChamber_fill.at(
i) == Out_Barrel ){
515 distance_bw_MDT_and_offlinesegment_Out_Barrel.push_back(distance_bw_MDT_and_offlinesegment_vec.at(
i));
517 else if( MDTHitChamber_fill.at(
i) == Inn_Endcap ){
518 distance_bw_MDT_and_offlinesegment_Inn_Endcap.push_back(distance_bw_MDT_and_offlinesegment_vec.at(
i));
520 else if( MDTHitChamber_fill.at(
i) == Mid_Endcap ){
521 distance_bw_MDT_and_offlinesegment_Mid_Endcap.push_back(distance_bw_MDT_and_offlinesegment_vec.at(
i));
523 else if( MDTHitChamber_fill.at(
i) == Out_Endcap ){
524 distance_bw_MDT_and_offlinesegment_Out_Endcap.push_back(distance_bw_MDT_and_offlinesegment_vec.at(
i));
527 ATH_MSG_WARNING(
"undefined chamberID is pushed back into MDTHitChamber_fill" );
531 if( segment_exist.at(Inn_Barrel) ){
532 MDT_N_Inn_Barrel.push_back(n_mdthits_BI);
533 segment_superpoint_exist.at(Inn_Barrel) = superpoint_exist.at(Inn_Barrel);
535 if( segment_exist.at(Mid_Barrel) ){
536 MDT_N_Mid_Barrel.push_back(n_mdthits_BM);
537 segment_superpoint_exist.at(Mid_Barrel) = superpoint_exist.at(Mid_Barrel);
539 if( segment_exist.at(Out_Barrel) ){
540 MDT_N_Out_Barrel.push_back(n_mdthits_BO);
541 segment_superpoint_exist.at(Out_Barrel) = superpoint_exist.at(Out_Barrel);
543 if( segment_exist.at(Inn_Endcap) ){
544 MDT_N_Inn_Endcap.push_back(n_mdthits_EI);
545 segment_superpoint_exist.at(Inn_Endcap) = superpoint_exist.at(Inn_Endcap);
547 if( segment_exist.at(Mid_Endcap) ){
548 MDT_N_Mid_Endcap.push_back(n_mdthits_EM);
549 segment_superpoint_exist.at(Mid_Endcap) = superpoint_exist.at(Mid_Endcap);
551 if( segment_exist.at(Out_Endcap) ){
552 MDT_N_Out_Endcap.push_back(n_mdthits_EO);
553 segment_superpoint_exist.at(Out_Endcap) = superpoint_exist.at(Out_Endcap);
557 offlinesegment_exist_pt4to6 = segment_exist;
558 superpoint_exist_pt4to6 = segment_superpoint_exist;
561 offlinesegment_exist_pt6to8 = segment_exist;
562 superpoint_exist_pt6to8 = segment_superpoint_exist;
565 offlinesegment_exist_ptover8 = segment_exist;
566 superpoint_exist_ptover8 = segment_superpoint_exist;
575 fill(
m_group+
"_"+
chain, ptresol, offPt, isBarrelA, isBarrelC, isEndcapA, isEndcapC);
576 fill(
m_group+
"_"+
chain, mon_ptresol_pos, mon_ptresol_neg, isBarrelA, isBarrelC, isEndcapA, isEndcapC);
577 fill(
m_group+
"_"+
chain, mon_distance_bw_FTFroad_and_offlinesegment_Inn_Barrel, pt4to6, pt6to8, ptover8);
578 fill(
m_group+
"_"+
chain, mon_distance_bw_FTFroad_and_offlinesegment_Mid_Barrel, pt4to6, pt6to8, ptover8);
579 fill(
m_group+
"_"+
chain, mon_distance_bw_FTFroad_and_offlinesegment_Out_Barrel, pt4to6, pt6to8, ptover8);
580 fill(
m_group+
"_"+
chain, mon_distance_bw_FTFroad_and_offlinesegment_Inn_Endcap, pt4to6, pt6to8, ptover8);
581 fill(
m_group+
"_"+
chain, mon_distance_bw_FTFroad_and_offlinesegment_Mid_Endcap, pt4to6, pt6to8, ptover8);
582 fill(
m_group+
"_"+
chain, mon_distance_bw_FTFroad_and_offlinesegment_Out_Endcap, pt4to6, pt6to8, ptover8);
601 fill(
m_group+
"_"+
chain, superpoint_multiplicity, regionBE, pt4to6, pt6to8, ptover8);
602 fill(
m_group+
"_"+
chain, mon_L2Muon_chamberID_index, mon_superpoint_exist_pt4to6, mon_offlinesegment_exist_pt4to6);
603 fill(
m_group+
"_"+
chain, mon_L2Muon_chamberID_index, mon_superpoint_exist_pt6to8, mon_offlinesegment_exist_pt6to8);
604 fill(
m_group+
"_"+
chain, mon_L2Muon_chamberID_index, mon_superpoint_exist_ptover8, mon_offlinesegment_exist_ptover8);
607 return StatusCode::SUCCESS;
619 std::vector< TrigCompositeUtils::LinkInfo<xAOD::L2StandAloneMuonContainer> > featureCont;
620 if(
chain.find(
"probe") != std::string::npos ){
621 int legIndex_probe = 1;
623 TrigDefs::includeFailedDecisions,
625 TrigDefs::lastFeatureOfType,
631 TrigDefs::includeFailedDecisions,
632 "HLT_MuonL2SAInfo" );
636 std::vector< const xAOD::L2CombinedMuon* > matchSA_L2IOobjects;
637 for(
const auto L2IOobject : *L2IOobjects){
638 ATH_MSG_DEBUG(
" L2IOobject->muSATrack()->roiWord()/L2IOobject->pt(): " << L2IOobject->muSATrack()->roiWord() <<
"/" << L2IOobject->pt() );
642 if( !L2SAobject.
isValid() )
continue;
643 ATH_MSG_DEBUG(
" L2SAobject->roiWord()/L2SALinkInfo.state: " << (*L2SAobject)->roiWord() <<
"/" << L2SALinkInfo.state );
645 if( L2IOobject->muSATrack()->roiWord() != (*L2SAobject)->roiWord() )
continue;
649 matchSA_L2IOobjects.push_back(L2IOobject);
650 ATH_MSG_DEBUG(
" matchSA_L2IOobject->muSATrack()->roiWord()/matchSA_L2IOobject->pt(): " << L2IOobject->muSATrack()->roiWord() <<
"/" << L2IOobject->pt() );
655 ATH_MSG_DEBUG(
" matchSA_L2IOobjects.size(): " << matchSA_L2IOobjects.size() );
657 const size_t num_matchSAMuon = matchSA_L2IOobjects.size();
658 if( num_matchSAMuon == 0 ){
660 return StatusCode::SUCCESS;
663 std::vector< bool > isoverlap( num_matchSAMuon,
false );
664 std::vector< bool >
passOR( num_matchSAMuon,
true );
668 for(
unsigned int i=0;
i<num_matchSAMuon;
i++) {
669 if( isoverlap[
i] && !
passOR[
i] )
continue;
670 Trig_L2IOobjects.push_back(matchSA_L2IOobjects.at(
i));
673 return StatusCode::SUCCESS;
681 const size_t numMuon = matchSA_L2IOobjects.size();
682 bool errorWhenIdentifyingOverlap =
false;
685 std::vector<unsigned int> mucombResult;
687 for(
unsigned int i=0;
i<numMuon;
i++) {mucombResult.emplace_back(
i); }
688 for(
unsigned int i=0;
i<numMuon-1;
i++){
689 for(
unsigned int j=
i+1; j<numMuon; j++){
691 bool overlapped =
isOverlap(matchSA_L2IOobjects.at(
i), matchSA_L2IOobjects.at(j));
692 ATH_MSG_DEBUG(
"matchSA_L2IOobjects: i/j/Overlap = " <<
i <<
"/" << j <<
"/" << overlapped );
695 if( mucombResult[
i] == mucombResult[j] ) {
696 ATH_MSG_DEBUG(
"inconsistentency in muComb overlap removal for more than two objects" );
697 ATH_MSG_DEBUG(
"two objects are judged as different but both were already marked as identical by someone else as: " );
698 ATH_MSG_DEBUG(
"i/j/result[i]/result[j]=" <<
i <<
" / " << j <<
" / " << mucombResult[
i] <<
" / " << mucombResult[j] );
699 errorWhenIdentifyingOverlap =
true;
703 if( (mucombResult[j] != j && mucombResult[
i] != mucombResult[j]) || (mucombResult[j] == j && mucombResult[
i] !=
i) ){
704 ATH_MSG_DEBUG(
"inconsistentency in muComb based overlap removal for more than two objects" );
705 ATH_MSG_DEBUG(
"two objects are judged as overlap but only either was already marked as overlap to someone else: " );
706 ATH_MSG_DEBUG(
"i/j/result[i]/result[j]=" <<
i <<
" / " << j <<
" / " << mucombResult[
i] <<
" / " << mucombResult[j] );
707 errorWhenIdentifyingOverlap =
true;
710 if( mucombResult[
i] ==
i ) {
711 ATH_MSG_DEBUG(
" i is not yet marked as overlap. so, it is a newly found overlap" );
717 ATH_MSG_DEBUG(
" both i/j already marked as overlap by: mucombResult[i]=" << mucombResult[
i] );
725 if( errorWhenIdentifyingOverlap ) {
726 ATH_MSG_WARNING(
"error when resolving overlap. exitting with all EVs active..." );
729 unsigned int n_uniqueMuon = 0;
730 for(
unsigned int i=0;
i<numMuon;
i++) {
732 if( mucombResult[
i] !=
i ) {
740 ATH_MSG_DEBUG(
"nr of unique Muons after muComb-based removal=" << n_uniqueMuon );
742 if( numMuon != n_uniqueMuon ){
745 ATH_MSG_DEBUG(
"no overlap identified. exitting with all EventViews active" );
750 return StatusCode::SUCCESS;
764 const double ZERO_LIMIT_FOR_ETAPHI = 1
e-4;
765 if( (std::abs(matchSA_L2IOobject1->
eta()) <ZERO_LIMIT_FOR_ETAPHI && std::abs(matchSA_L2IOobject1->
phi()) < ZERO_LIMIT_FOR_ETAPHI) ||
766 (std::abs(matchSA_L2IOobject2->
eta()) <ZERO_LIMIT_FOR_ETAPHI && std::abs(matchSA_L2IOobject2->
phi()) < ZERO_LIMIT_FOR_ETAPHI) ) {
767 ATH_MSG_DEBUG(
" ...-> (eta,phi) info not available (rec at (eta,phi)=(0,0))" );
769 ATH_MSG_DEBUG(
" ...-> but dR of invMass check is required. cannot judge overlap -> return with false" );
775 const double ZERO_LIMIT_FOR_PT = 1
e-4;
776 if( (std::abs(matchSA_L2IOobject1->
pt()) <ZERO_LIMIT_FOR_PT) || (std::abs(matchSA_L2IOobject2->
pt()) < ZERO_LIMIT_FOR_PT) ) {
777 ATH_MSG_DEBUG(
" ...-> pT info not available (rec at pT=0)" );
779 ATH_MSG_DEBUG(
" ...-> but same sign or invMass check is required. cannot judge overlap -> return with false" );
785 double absEta = (std::abs(mu1Pt) > std::abs(mu2Pt)) ? std::abs(mu1Eta) : std::abs(mu2Eta);
786 unsigned int iThres=0;
801 bool sameSign =
false;
803 sameSign = ((mu1Pt*mu2Pt) > 0);
808 bool dRisClose =
false;
809 float deta = mu1Eta - mu2Eta;
811 float dR = std::sqrt(deta*deta + dphi*dphi);
813 if( dR < dRThres ) dRisClose =
true;
814 ATH_MSG_DEBUG(
" ...-> dR=" << dR <<
" : dRisClose=" << dRisClose );
818 bool dRbySAisClose =
false;
826 float dRBySA = std::sqrt(deta*deta + dphi*dphi);
827 if( dRBySA < dRbySAThres ) dRbySAisClose =
true;
828 ATH_MSG_DEBUG(
" ...-> dR(by MF)=" << dRBySA <<
" : dRbySAisClose=" << dRbySAisClose );
832 const double TRACK_MASS = 0.;
833 bool massIsClose =
false;
834 TLorentzVector lvioobj1, lvioobj2;
835 lvioobj1.SetPtEtaPhiM(std::abs(mu1Pt), mu1Eta, mu1Phi, TRACK_MASS);
836 lvioobj2.SetPtEtaPhiM(std::abs(mu2Pt), mu2Eta, mu2Phi, TRACK_MASS);
837 TLorentzVector lvsum = lvioobj1 + lvioobj2;
840 if(
invMass < massThres ) massIsClose =
true;
846 bool overlap =
false;
864 ATH_MSG_DEBUG(
"--- choose best among overlaps & disable EVs (muComb based) ---" );
865 for(
i=0;
i<matchSA_L2IOobjects.size();
i++) {
867 if( mucombResult[
i] !=
i ) {
871 std::vector<unsigned int> others;
872 for(j=0; j<matchSA_L2IOobjects.size(); j++) {
873 if( mucombResult[j] == mucombResult[
i] ) others.emplace_back(j);
875 if( others.size() == 1 ) {
881 unsigned int bestMuon = 0;
882 float maxPtCombMf = 0.;
883 float mindRRoadRoI = 999.;
884 for(
k=0;
k<others.size();
k++) {
887 float ptCombMf = std::abs(matchSA_L2IOobjects.at(j)->pt()/1
e3);
889 const float roadPhiP = std::atan2(matchSA_L2IOobjects.at(j)->muSATrack()->dirPhiMS(),1.);
890 const float roadPhiM = std::atan2(-1*matchSA_L2IOobjects.at(j)->muSATrack()->dirPhiMS(),-1.);
894 if(std::abs(matchSA_L2IOobjects.at(j)->muSATrack()->roiEta()) < 1.05) {
895 if( std::abs(matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(1,0)) >
ZERO_LIMIT ) roadAw = matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(1,0);
896 else if( std::abs(matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(2,0)) >
ZERO_LIMIT ) roadAw = matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(2,0);
897 else if( std::abs(matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(0,0)) >
ZERO_LIMIT ) roadAw = matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(0,0);
900 if( std::abs(matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(4,0)) >
ZERO_LIMIT ) roadAw = matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(4,0);
901 else if( std::abs(matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(5,0)) >
ZERO_LIMIT ) roadAw = matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(5,0);
902 else if( std::abs(matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(3,0)) >
ZERO_LIMIT ) roadAw = matchSA_L2IOobjects.at(j)->muSATrack()->roadAw(3,0);
904 float roadEta = 999.;
906 if(roadAw < 0) roadEta *= -1.;
907 float detaRoadRoI = roadEta - matchSA_L2IOobjects.at(j)->muSATrack()->roiEta();
909 float dRRoadRoI = std::sqrt(detaRoadRoI*detaRoadRoI + dphiRoadRoI*dphiRoadRoI);
910 ATH_MSG_DEBUG(
" j="<< j <<
" , ptCombMf=" << ptCombMf <<
", dRRoadRoI=" << dRRoadRoI);
913 if( (ptCombMf > maxPtCombMf) ||
914 (std::abs(ptCombMf - maxPtCombMf) <
ZERO_LIMIT &&
915 dRRoadRoI < mindRRoadRoI) ) {
916 maxPtCombMf = ptCombMf;
917 mindRRoadRoI = dRRoadRoI;
921 ATH_MSG_DEBUG(
" best is: bestMuon/maxPtCombMf=" << bestMuon <<
" / " << maxPtCombMf );
923 for(
k=0;
k<others.size();
k++) {
925 if( j != bestMuon ) {
926 ATH_MSG_DEBUG(
" EventView( j=" << j <<
" ) is not active" );
938 return StatusCode::SUCCESS;
945 int requireMuonNum = 1;
947 int passHypo_MuonNum = 0;
948 for(
auto &Trig_L2IOobject : Trig_L2IOobjects){
949 bool isPass_muCombHypo =
false;
951 bool pass_muCombHypo_obj = isPass_muCombHypo;
952 pass_muCombHypo.push_back(pass_muCombHypo_obj);
953 if( pass_muCombHypo_obj ) passHypo_MuonNum++;
956 if( passHypo_MuonNum >= requireMuonNum ){
959 return StatusCode::SUCCESS;
964 pass_muCombHypo =
false;
967 std::vector< float > my_EtaBins = {0, 1.05, 1.5, 2.0, 9.9};
968 std::vector< float > my_muCombThres = {0., 0., 0., 0.};
969 bool my_pikCuts =
true;
970 float my_maxPtToApplyPik = 25.;
971 float my_chi2MaxID = 3.5;
976 auto ptValue = Trig_L2IOobject->
pt() * Trig_L2IOobject->
charge()/1
e3;
977 float fexPt = ptValue;
978 if(my_pikCuts && (std::abs(fexPt) < my_maxPtToApplyPik)){
985 float absEta = std::abs(Trig_L2IOobject->
eta());
986 unsigned int iThres = 0;
987 for(
unsigned int i=0;
i<(my_EtaBins.size()-1);
i++) {
990 const float muCombThres = my_muCombThres[iThres];
991 if(Trig_L2IOobject->
pt()/1
e3 < muCombThres){
992 ATH_MSG_DEBUG(
"this obj failed at std Pt cut:muCombThres = " << muCombThres);
996 if(stdCut && pikCut){
998 pass_muCombHypo =
true;
1000 return StatusCode::SUCCESS;
1005 bool &my_pikCuts,
float &my_maxPtToApplyPik,
float &my_chi2MaxID )
const{
1007 my_maxPtToApplyPik = 25.;
1010 if(
chain ==
"HLT_mu4_l2io_L1MU3V"){
1011 my_EtaBins = {0, 1.05, 1.5, 2.0, 9.9};
1012 my_muCombThres = {3.86, 3.77, 3.69, 3.70};
1014 }
else if(
chain ==
"HLT_mu24_ivarmedium_mu6_l2io_probe_L1MU14FCH"){
1015 my_EtaBins = {0, 1.05, 1.5, 2.0, 9.9};
1016 my_muCombThres = {5.87, 5.79, 5.70, 5.62};
1018 }
else if(
chain ==
"HLT_mu24_ivarmedium_mu6_l2io_probe_L1MU18VFCH"){
1019 my_EtaBins = {0, 1.05, 1.5, 2.0, 9.9};
1020 my_muCombThres = {5.87, 5.79, 5.70, 5.62};
1025 return StatusCode::SUCCESS;
1030 return std::forward_as_tuple(trig->
pt(), trig->
etaMS(), trig->
phiMS());
1035 return std::forward_as_tuple( (trig->
pt()/1
e3 * trig->
charge() ), trig->
eta(), trig->
phi());
1045 std::vector< const xAOD::L2CombinedMuon* > Trig_L2IOobjects;
1048 return offlinematched_L2IOobject;
1050 if( Trig_L2IOobjects.empty() ) {
1051 return offlinematched_L2IOobject;
1054 float reqdR = 1000.;
1056 double offlEta =
mu->eta();
1057 double offlPhi =
mu->phi();
1059 int loop_counter = 0;
1060 int match_index = 0;
1061 for(
auto Trig_L2IOobject : Trig_L2IOobjects){
1062 double trigEta = Trig_L2IOobject->eta();
1063 double trigPhi = Trig_L2IOobject->phi();
1064 double deta = offlEta - trigEta;
1066 double dR = std::sqrt(deta*deta + dphi*dphi);
1068 ATH_MSG_VERBOSE(
"Trigger muon candidate eta=" << trigEta <<
" phi=" << trigPhi <<
" pt=" << Trig_L2IOobject->pt() <<
" dR=" << dR);
1071 match_index = loop_counter;
1072 ATH_MSG_DEBUG(
"* Trigger muon eta=" << trigEta <<
" phi=" << trigPhi <<
" pt=" << Trig_L2IOobject->pt() <<
" dR=" << dR );
1077 offlinematched_L2IOobject = Trig_L2IOobjects.at(match_index);
1078 return offlinematched_L2IOobject;
1087 double Jpsimass = 3.0969;
1088 double Zmass = 91.1876;
1089 double my_Jpsimass_lowlim = 81.;
1090 double my_Jpsimass_highlim = 101.;
1091 double my_Zmass_lowlim = 2.7;
1092 double my_Zmass_highlim = 3.5;
1102 double mass_diff_min = 999.;
1103 double tpdR_min = 999.;
1104 bool tpfromZ =
false;
1108 if(
mu->charge()*probe->
charge() > 0 )
continue;
1110 if( !tag_ms_track.
isValid() )
continue;
1111 TLorentzVector lvmu =
mu->p4();
1112 TLorentzVector lvprobe = probe->
p4();
1113 double dimu_mass = (lvmu+lvprobe).M()/1.e3;
1114 double tpdR = lvmu.DeltaR(lvprobe);
1115 if( dimu_mass > my_Jpsimass_lowlim && dimu_mass < my_Jpsimass_highlim ){
1116 if( tpfromZ )
continue;
1117 double mass_diff = std::abs(dimu_mass - Jpsimass);
1118 if( mass_diff - mass_diff_min < -1.*
ZERO_LIMIT ){
1119 mass_diff_min = mass_diff;
1123 else if( std::abs(mass_diff - mass_diff_min) <
ZERO_LIMIT){
1124 if( tpdR - tpdR_min < 0. ){
1125 mass_diff_min = mass_diff;
1131 else if( dimu_mass > my_Zmass_lowlim && dimu_mass < my_Zmass_highlim ){
1133 double mass_diff = std::abs(dimu_mass - Zmass);
1134 if( mass_diff - mass_diff_min < -1.*
ZERO_LIMIT ){
1135 mass_diff_min = mass_diff;
1139 else if( std::abs(mass_diff - mass_diff_min) <
ZERO_LIMIT){
1140 if( tpdR - tpdR_min < 0. ){
1141 mass_diff_min = mass_diff;