15#include "GaudiKernel/StatusCode.h"
42 const std::string& name,
43 const IInterface* parent) :
57 return StatusCode::FAILURE;
71 " to " <<
m_endLabelIndex <<
", the HypoTool's name must therefore start with legXXX_ rather than HLT_");
72 return StatusCode::FAILURE;
94 return StatusCode::SUCCESS;
99 return StatusCode::SUCCESS;
106 std::vector<JetDecision>& jetHypoInputs)
const {
111 previousDecisionIDs)) {
112 return StatusCode::SUCCESS;
115 std::unique_ptr<ITrigJetHypoInfoCollector> infocollector(
nullptr);
116 std::unique_ptr<ITrigJetHypoInfoCollector> jetdumper(
nullptr);
118 auto collectorName = name() +
"_" + std::to_string(
m_id++);
121 name()+
"_passingjets_" + std::to_string(
m_id++);
128 std::transform(jets -> begin(),
135 <<
" no of jets ... "
149 pass =
m_helper->pass(hypoJets, jetCollector, infocollector);
150 }
catch(std::exception& e){
151 ATH_MSG_ERROR(
"Exception raised by the TrigJetHypoToolHelper: "
153 return StatusCode::FAILURE;
162 "hypo testing done: no of input jets " + std::to_string(jets->size())
163 +
" no of participating jets " + std::to_string(jetCollector.
size())
166 infocollector->collect(
"TrigJetHypoTool",
msg);
169 return StatusCode::SUCCESS;
181 "hypo testing done: no of input jets " + std::to_string(jets->size())
182 +
" no of particlating jets " + std::to_string(jetCollector.
size())
186 infocollector->collect(
"TrigJetHypoTool",
msg);
187 infocollector->write();
189 std::stringstream
ss;
191 jetdumper->collect(
"passed",
ss.str());
197 mon_NOutputs = hjv.size();
198 for(
const auto& j : hjv) {
204 float this_negLogSigma2 = 999;
205 j->getAttribute(
"dipz20231122_z", this_z);
206 j->getAttribute(
"dipz20231122_negLogSigma2", this_negLogSigma2);
208 auto mon_dipz_negLogSigma2 =
Monitored::Scalar(
"dipz_negLogSigma2", this_negLogSigma2);
209 float this_GN2X_phbb{999.}, this_GN2X_phcc{999.}, this_GN2X_pqcd{999.}, this_GN2X_ptop{999.};
210 j->getAttribute(
"GN2Xv01_phbb", this_GN2X_phbb);
211 j->getAttribute(
"GN2Xv01_phcc", this_GN2X_phcc);
212 j->getAttribute(
"GN2Xv01_ptop", this_GN2X_ptop);
213 j->getAttribute(
"GN2Xv01_pqcd", this_GN2X_pqcd);
218 float this_GN2X_discriminant{999.};
219 if (this_GN2X_phbb > 0.){
220 float top_frac{0.25};
221 float denom = this_GN2X_pqcd*(1. - top_frac) + this_GN2X_ptop * top_frac;
223 this_GN2X_discriminant = log(this_GN2X_phbb/denom);
226 auto mon_GN2X_discriminant =
Monitored::Scalar(
"GN2Xv01_discriminant", this_GN2X_discriminant);
228 float this_GN2XTrig_phbb{999.}, this_GN2XTrig_pqcd{999.}, this_GN2XTrig_ptop{999.};
229 j->getAttribute(
"GN2XTrig_phbb", this_GN2XTrig_phbb);
230 j->getAttribute(
"GN2XTrig_ptop", this_GN2XTrig_ptop);
231 j->getAttribute(
"GN2XTrig_pqcd", this_GN2XTrig_pqcd);
235 float this_GN2XTrig_discriminant{999.};
236 if (this_GN2XTrig_phbb > 0.){
237 float top_frac{0.25};
238 float denom = this_GN2XTrig_pqcd*(1. - top_frac) + this_GN2XTrig_ptop * top_frac;
240 this_GN2XTrig_discriminant = log(this_GN2XTrig_phbb/denom);
243 auto mon_GN2XTrig_discriminant =
Monitored::Scalar(
"GN2XTrig_discriminant", this_GN2XTrig_discriminant);
245 auto monitor_group_passingjets =
Monitored::Group(
m_monTool, mon_jetEt, mon_jetEta, mon_jetPhi , mon_dipz_z, mon_dipz_negLogSigma2, mon_jetMass, mon_GN2X_phbb, mon_GN2X_phcc, mon_GN2X_ptop, mon_GN2X_pqcd, mon_GN2X_discriminant, mon_GN2XTrig_phbb, mon_GN2XTrig_ptop, mon_GN2XTrig_pqcd, mon_GN2XTrig_discriminant);
249 auto legInds = jetCollector.
legInds();
250 for (
const auto&
label : legInds) {
253 auto htsum =
Monitored::Scalar(
"HT", std::accumulate(theseJets.begin(), theseJets.end(),0.0,
254 [](
double sum,
const HypoJetVector::value_type jptr){return sum + jptr->et()*0.001;} ));
258 return StatusCode::SUCCESS;
274 const std::unique_ptr<ITrigJetHypoInfoCollector>& infocollector)
const {
276 if (jetCollector.
empty()) {
279 ", but did not specify which jets participated");
280 return StatusCode::FAILURE;
283 auto legIndices = jetCollector.
legInds();
286 return StatusCode::FAILURE;
290 ATH_MSG_DEBUG(
"There are some indices: " << legIndices.size());
291 for(
size_t i = 0; i < legIndices.size(); i ++){
292 ATH_MSG_DEBUG(
" -- leg " << i <<
" has index " << legIndices.at(i));
298 auto participating_jets = jetCollector.
xAODJets();
302 "no of xAODJets " + std::to_string(participating_jets.size()));
304 auto legInds = jetCollector.
legInds();
305 std::stringstream
ss;
307 for(
const auto&
label : legInds){
310 for(
const auto& j : jets){
315 infocollector->collect(name(),
ss.str());
318 return StatusCode::SUCCESS;
323 const std::vector<JetDecision>& jetHypoInputs)
const {
325 auto legIndices = jetCollector.
legInds();
326 for(
const auto& legInd : legIndices){
327 auto participating_jets = jetCollector.
xAODJets(legInd);
331 return StatusCode::SUCCESS;
339 const std::vector<JetDecision>& jetHypoInputs,
344 for (
auto&
pair : jetHypoInputs) {
354 passingIDs.insert(
getID(legInd).numeric());
361 return StatusCode::SUCCESS;
369 return std::find(jets.begin(), jets.end(),
pair.first) != jets.end();
#define ATH_CHECK
Evaluate an expression and check for errors.
#define CHECK(...)
Evaluate an expression and check for errors.
std::vector< pHypoJet > HypoJetVector
Header file to be included by clients of the Monitored infrastructure.
virtual std::string toString() const override
Group of local monitoring quantities and retain correlation when filling histograms
Declare a monitored scalar variable.
std::vector< const xAOD::Jet * > xAODJets() const
HypoJetVector hypoJets() const
std::vector< int > legInds() const
std::string label(const std::string &format, int i)
std::vector< std::string > lineSplitter(const std::string &s, char delimiter)
It used to be useful piece of code for replacing actual SG with other store of similar functionality ...
HLT::Identifier createLegName(const HLT::Identifier &chainIdentifier, size_t counter)
Generate the HLT::Identifier which corresponds to a specific leg of a given chain.
xAOD::TrigComposite Decision
void insertDecisionIDs(const Decision *src, Decision *dest)
Appends the decision IDs of src to the dest decision object.
HLT::Identifier getIDFromLeg(const HLT::Identifier &legIdentifier)
Generate the HLT::Identifier which corresponds to the chain name from the leg name.
bool passed(DecisionID id, const DecisionIDContainer &idSet)
checks if required decision ID is in the set of IDs in the container
std::set< DecisionID > DecisionIDContainer
xAOD::TrigCompositeContainer DecisionContainer
bool isLegId(const HLT::Identifier &legIdentifier)
Recognise whether the chain ID is a leg ID.
JetContainer_v1 JetContainer
Definition of the current "jet container version".