29 return StatusCode::SUCCESS;
37 auto outputJets = std::make_unique<std::vector<TrigBtagEmulationJet>>();
38 auto sortedPreselJets = std::make_unique<std::vector<TrigBtagEmulationJet>>();
52 outputJets->reserve(theJetContainer->
size());
53 sortedPreselJets->reserve(theJetContainer->
size());
59 outputJets->push_back( toAdd );
68 if ( bjetContainerHandle.
isValid() ) {
74 for (
const xAOD::Jet *bjet : *theBJetContainer ) {
76 for (std::size_t ijet(0); ijet < outputJets->size(); ijet++) {
77 const auto &emuljet = outputJets->at(ijet);
81 if (bjet->pt() ==
jet->pt() && bjet->eta() ==
jet->eta() &&
82 bjet->phi() ==
jet->phi()) {
91 for (
const auto&
jet : *outputJets.get() ) {
98 sort(sortedPreselJets->begin(), sortedPreselJets->end(),
99 [] (
const auto& lhs,
const auto& rhs) ->
bool
100 { return lhs.pt() > rhs.pt(); }
104 for(
unsigned int i = 0; i < 10 and i < sortedPreselJets->size(); i++) {
105 ATH_MSG_DEBUG(
" - pt=" << (sortedPreselJets->at(i).pt() * 0.001) <<
" eta=" << sortedPreselJets->at(i).eta() );
113 outputJets->push_back( toAdd );
124 ATH_MSG_DEBUG(
"jet container size: " << theJetContainer->
size() <<
", btag container size: " << theBTagContainer->
size());
137 const auto &jetLink = btagToJetAccessor(*btag);
138 if (jetLink.size() > 0 && jetLink.at(0).isValid()) {
140 double mv2c20_score, mv2c10_score;
141 btag->MVx_discriminant(
"MV2c20", mv2c20_score);
142 btag->MVx_discriminant(
"MV2c10", mv2c10_score);
144 << jetLink.at(0).index() <<
" pt=" << (btaggedJet->
pt() * 0.001) <<
" eta=" << btaggedJet->
eta()
145 <<
", mv2c20=" << mv2c20_score <<
", mv2c10=" << mv2c10_score);
150 bool isJetPresent =
false;
151 for (
const xAOD::Jet *theJet : *theJetContainer) {
153 if ((!isGSCchain && btaggedJet == theJet) ||
160 if (matchedJet ==
nullptr) {
168 bool isJetUnique =
true;
170 if (matchedJet->
p4().Et() == j.et() &&
171 matchedJet->
eta() == j.eta() && matchedJet->
phi() == j.phi()) {
176 if (isJetPresent && isJetUnique) {
187 emulCtx.
store( storage_name, std::move(outputJets) );
189 emulCtx.
store( storage_name +
"_presel", std::move(sortedPreselJets) );
192 return StatusCode::SUCCESS;
201 return *emulCtx.
get<std::vector<TrigBtagEmulationJet>>(
m_jetcontainer.value() +
"_presel");
206 return splitJet->
p4().DeltaR( gscJet->
p4() ) < 0.05;
#define ATH_CHECK
Evaluate an expression and check for errors.
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
bool msgLvl(const MSG::Level lvl) const
size_type size() const noexcept
Returns the number of elements in the collection.
Helper class to provide constant type-safe access to aux data.
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
const T * get(const std::string &name) const
void store(const std::string &name, std::unique_ptr< T > &&object)
virtual double phi() const
The azimuthal angle ( ) of the particle.
virtual FourMom_t p4() const
The full 4-momentum of the particle.
virtual double pt() const
The transverse momentum ( ) of the particle.
virtual double eta() const
The pseudorapidity ( ) of the particle.
std::string find(const std::string &s)
return a remapped string
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
The common trigger namespace for trigger analysis tools.
Jet_v1 Jet
Definition of the current "jet version".
BTaggingContainer_v1 BTaggingContainer
Definition of the current "BTagging container version".
BTagging_v1 BTagging
Definition of the current "BTagging version".
JetContainer_v1 JetContainer
Definition of the current "jet container version".