16 m_trigDecTool(
"Trig::TrigDecisionTool/TrigDecisionTool"),
17 m_matchingThreshold(0)
22 #ifndef XAOD_STANDALONE
39 return StatusCode::SUCCESS;
43 std::map<xAOD::Type::ObjectType,std::vector<const xAOD::IParticle*> > typeSeparated;
45 for (
const auto&
obj : recoObjects){
46 if(typeSeparated.find(
obj->type()) == typeSeparated.end()){
47 std::vector<const xAOD::IParticle*> typevec;
48 typeSeparated[
obj->type()] = typevec;
50 typeSeparated[
obj->type()].push_back(
obj);
53 ATH_MSG_DEBUG(
"found: " << typeSeparated.size() <<
" unique objects types to match");
54 for(
auto& [objType, recoObjs_thistype] : typeSeparated){
55 ATH_MSG_DEBUG(
"type: " << objType <<
"(" << recoObjs_thistype.size() <<
" elements)");
58 bool overall_status =
true;
59 std::map<xAOD::Type::ObjectType,bool>
status;
60 for(
auto& [objType, recoObjs_thistype] : typeSeparated){
62 ATH_MSG_DEBUG(
"type: " << objType <<
" status: " << single_status);
63 status[objType] = single_status;
64 overall_status = overall_status && single_status;
67 return overall_status;
73 auto recoType = recoObjects.at(0)->type();
77 std::string container_typename(
"");
81 ATH_MSG_DEBUG(
"Electron offline and matching electron etcut chain. Try to match to cluster instead!: " );
89 clid = clid_container.first;
90 container_typename = clid_container.second;
91 ATH_MSG_DEBUG(
"getting trigger features (clid: " << clid <<
" and type: " << container_typename <<
")");
94 ATH_MSG_WARNING(
"could not find corresponding trigger type, can't match");
98 auto iparticle_feats = comb.
getIParticle(clid,container_typename);
100 ATH_MSG_DEBUG(
"found: " << iparticle_feats.size() <<
" xAOD::IParticle");
102 for(
auto& feat : iparticle_feats){
103 ATH_MSG_DEBUG(
" ==> pt: " << feat.cptr()->pt() <<
" and eta: " << feat.cptr()->eta() <<
" address: " << feat.cptr());
106 if(recoObjects.size() > iparticle_feats.size()){
107 ATH_MSG_WARNING(
"more reco objects (" << recoObjects.size() <<
") than trigger object (" << iparticle_feats.size() <<
"). no hope of matching!");
111 ATH_MSG_DEBUG(
"now matching: " << recoObjects.size() <<
" reco objects to " << iparticle_feats.size() <<
" trigger objects");
113 std::vector<const xAOD::IParticle*> trigObjects;
114 for(
auto& feat : iparticle_feats){trigObjects.push_back(feat.cptr());}
116 std::vector<std::vector<double>> scoreMatrix;
117 scoreMatrix.reserve(recoObjects.size());
120 scoreMatrix.emplace_back();
121 std::vector<double> &scores = scoreMatrix.back();
122 scores.reserve(trigObjects.size());
126 scores.push_back(
static_cast<double>(
m_scoreTool->score(*trig, *
reco)));
139 std::vector<const xAOD::IParticle*> recoObjects(1,&recoObject);
144 bool MatchingTool::match(
const std::vector<const xAOD::IParticle*>& recoObjects,
const std::string&
chain,
double matchThreshold,
bool rerun)
const {
145 ATH_MSG_DEBUG(
"matching " << recoObjects.size() <<
" reco objects to chain: " <<
chain );
152 decision = chainGroup->isPassed(TrigDefs::Physics | TrigDefs::allowResurrectedDecision);
154 if(!decision)
return false;
156 auto featureContainer = chainGroup->features();
165 ATH_MSG_DEBUG(
"matching result for this combination: " << combResult);