2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
6 StatusCode L2OverlapRemoverMon :: fillVariablesOverlapRemoverPlots(const std::string &chain, std::string &&trigstep) const
9 auto NInMuon = Monitored::Scalar<int>(trigstep+"_"+chain+"_NInMuon", -999.);
10 auto NOutMuon = Monitored::Scalar<int>(trigstep+"_"+chain+"_NOutMuon", -999.);
11 auto NRemovedMuon = Monitored::Scalar<int>(trigstep+"_"+chain+"_NRemovedMuon", -999.);
13 using CONTAINER = DataVector<T>;
14 std::vector< TrigCompositeUtils::LinkInfo<CONTAINER> > featureCont = getTrigDecisionTool()->features<CONTAINER>( chain, TrigDefs::includeFailedDecisions );
15 NInMuon = featureCont.size();
19 std::vector<int> vec_OverlapInsonsistent;
20 auto OverlapInsonsistent = Monitored::Collection(trigstep+"_"+chain+"_OverlapInsonsistent", vec_OverlapInsonsistent);
23 std::vector<unsigned int> muResult;
24 bool errorWhenIdentifyingOverlap = false;
27 for(i=0; i<featureCont.size(); i++) muResult.emplace_back(i);
28 for(i=0; i<featureCont.size(); i++){
29 ATH_CHECK( featureCont[i].isValid() );
30 for(j=i+1; j<featureCont.size(); j++){
31 ATH_CHECK( featureCont[j].isValid() );
32 bool overlapped = isOverlap(chain, featureCont[i].link, featureCont[j].link);
33 if( !overlapped ){ // judged as different
34 if( muResult[i] == muResult[j] ) { // but marked as same by someone
35 ATH_MSG_DEBUG( "inconsistentency in muFast overlap removal for more than two objects" );
36 ATH_MSG_DEBUG( "two objects are judged as different but both were already marked as identical by someone else as: " );
37 ATH_MSG_DEBUG( "i/j/result[i]/result[j]=" << i << " / " << j << " / " << muResult[i] << " / " << muResult[j] );
38 vec_OverlapInsonsistent.push_back(0);
39 errorWhenIdentifyingOverlap = true;
42 else{ // judged as overlap
43 if( (muResult[j] != j && muResult[i] != muResult[j]) || (muResult[j] == j && muResult[i] != i) ){
44 ATH_MSG_DEBUG( "inconsistentency in muFast overlap removal for more than two objects" );
45 ATH_MSG_DEBUG( "two objects are judged as overlap but only either was already marked as overlap to someone else: " );
46 ATH_MSG_DEBUG( "i/j/result[i]/result[j]=" << i << " / " << j << " / " << muResult[i] << " / " << muResult[j] );
47 vec_OverlapInsonsistent.push_back(1);
48 errorWhenIdentifyingOverlap = true;
50 if( muResult[i] == i ) {
51 ATH_MSG_DEBUG( " i is not yet marked as overlap. so, it is a newly found overlap" );
52 ATH_MSG_DEBUG( " -> marking muResult[j] as i..." );
55 ATH_MSG_DEBUG( " both i/j already marked as overlap by: muResult[i]=" << muResult[i] );
56 ATH_MSG_DEBUG( " -> do nothing..." );
63 // If there is inconsistency in the overlap judgment, input becomes output as it is.
64 if( errorWhenIdentifyingOverlap ) {
65 NOutMuon = featureCont.size();
67 fill(m_group+"_"+chain, NInMuon, NOutMuon, NRemovedMuon);
68 return StatusCode::SUCCESS;
71 // check number of unique muon
72 unsigned int NUniqueMuon = 0;
73 for(i=0; i<featureCont.size(); i++) {
74 if( muResult[i] == i ) NUniqueMuon++;
76 ATH_MSG_DEBUG( "number of unique Muons after overlap removal=" << NUniqueMuon );
79 if( featureCont.size() != NUniqueMuon ){
80 ATH_CHECK( chooseBestMuon(chain, featureCont, muResult) );
81 NOutMuon = NUniqueMuon;
83 NOutMuon = featureCont.size();
86 NRemovedMuon = featureCont.size() - NUniqueMuon;
88 fill(m_group+"_"+chain, NInMuon, NOutMuon, NRemovedMuon);
90 return StatusCode::SUCCESS;