15#include "GaudiKernel/StatusCode.h"
38 const std::string& name,
39 const IInterface* parent) :
53 return StatusCode::FAILURE;
67 " to " <<
m_endLabelIndex <<
", the HypoTool's name must therefore start with legXXX_ rather than HLT_");
68 return StatusCode::FAILURE;
90 return StatusCode::SUCCESS;
95 return StatusCode::SUCCESS;
102 std::vector<JetDecision>& jetHypoInputs)
const {
107 previousDecisionIDs)) {
108 return StatusCode::SUCCESS;
111 std::unique_ptr<ITrigJetHypoInfoCollector> infocollector(
nullptr);
112 std::unique_ptr<ITrigJetHypoInfoCollector> jetdumper(
nullptr);
114 auto collectorName = name() +
"_" + std::to_string(
m_id++);
117 name()+
"_passingjets_" + std::to_string(
m_id++);
124 std::transform(jets -> begin(),
131 <<
" no of jets ... "
145 pass =
m_helper->pass(hypoJets, jetCollector, infocollector);
146 }
catch(std::exception& e){
147 ATH_MSG_ERROR(
"Exception raised by the TrigJetHypoToolHelper: "
149 return StatusCode::FAILURE;
158 "hypo testing done: no of input jets " + std::to_string(jets->size())
159 +
" no of participating jets " + std::to_string(jetCollector.
size())
162 infocollector->collect(
"TrigJetHypoTool",
msg);
165 return StatusCode::SUCCESS;
177 "hypo testing done: no of input jets " + std::to_string(jets->size())
178 +
" no of particlating jets " + std::to_string(jetCollector.
size())
182 infocollector->collect(
"TrigJetHypoTool",
msg);
183 infocollector->write();
185 std::stringstream
ss;
187 jetdumper->collect(
"passed",
ss.str());
193 mon_NOutputs = hjv.size();
194 for(
const auto& j : hjv) {
200 float this_negLogSigma2 = 999;
201 j->getAttribute(
"dipz20231122_z", this_z);
202 j->getAttribute(
"dipz20231122_negLogSigma2", this_negLogSigma2);
204 auto mon_dipz_negLogSigma2 =
Monitored::Scalar(
"dipz_negLogSigma2", this_negLogSigma2);
205 float this_GN2X_phbb{999.}, this_GN2X_phcc{999.}, this_GN2X_pqcd{999.}, this_GN2X_ptop{999.};
206 j->getAttribute(
"GN2Xv01_phbb", this_GN2X_phbb);
207 j->getAttribute(
"GN2Xv01_phcc", this_GN2X_phcc);
208 j->getAttribute(
"GN2Xv01_ptop", this_GN2X_ptop);
209 j->getAttribute(
"GN2Xv01_pqcd", this_GN2X_pqcd);
214 float this_GN2X_discriminant{999.};
215 if (this_GN2X_phbb > 0.){
216 float top_frac{0.25};
217 float denom = this_GN2X_pqcd*(1. - top_frac) + this_GN2X_ptop * top_frac;
219 this_GN2X_discriminant = log(this_GN2X_phbb/denom);
222 auto mon_GN2X_discriminant =
Monitored::Scalar(
"GN2Xv01_discriminant", this_GN2X_discriminant);
224 float this_GN2XTrig_phbb{999.}, this_GN2XTrig_pqcd{999.}, this_GN2XTrig_ptop{999.};
225 j->getAttribute(
"GN2XTrig_phbb", this_GN2XTrig_phbb);
226 j->getAttribute(
"GN2XTrig_ptop", this_GN2XTrig_ptop);
227 j->getAttribute(
"GN2XTrig_pqcd", this_GN2XTrig_pqcd);
231 float this_GN2XTrig_discriminant{999.};
232 if (this_GN2XTrig_phbb > 0.){
233 float top_frac{0.25};
234 float denom = this_GN2XTrig_pqcd*(1. - top_frac) + this_GN2XTrig_ptop * top_frac;
236 this_GN2XTrig_discriminant = log(this_GN2XTrig_phbb/denom);
239 auto mon_GN2XTrig_discriminant =
Monitored::Scalar(
"GN2XTrig_discriminant", this_GN2XTrig_discriminant);
241 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);
245 auto legInds = jetCollector.
legInds();
246 for (
const auto&
label : legInds) {
249 auto htsum =
Monitored::Scalar(
"HT", std::accumulate(jets.begin(), jets.end(),0.0,
250 [](
double sum,
const HypoJetVector::value_type jptr){return sum + jptr->et()*0.001;} ));
254 return StatusCode::SUCCESS;
270 const std::unique_ptr<ITrigJetHypoInfoCollector>& infocollector)
const {
272 if (jetCollector.
empty()) {
275 ", but did not specify which jets participated");
276 return StatusCode::FAILURE;
279 auto legIndices = jetCollector.
legInds();
282 return StatusCode::FAILURE;
286 ATH_MSG_DEBUG(
"There are some indices: " << legIndices.size());
287 for(
size_t i = 0; i < legIndices.size(); i ++){
288 ATH_MSG_DEBUG(
" -- leg " << i <<
" has index " << legIndices.at(i));
294 auto participating_jets = jetCollector.
xAODJets();
298 "no of xAODJets " + std::to_string(participating_jets.size()));
300 auto legInds = jetCollector.
legInds();
301 std::stringstream
ss;
303 for(
const auto&
label : legInds){
306 for(
const auto& j : jets){
311 infocollector->collect(name(),
ss.str());
314 return StatusCode::SUCCESS;
319 const std::vector<JetDecision>& jetHypoInputs)
const {
321 auto legIndices = jetCollector.
legInds();
322 for(
const auto& legInd : legIndices){
323 auto participating_jets = jetCollector.
xAODJets(legInd);
327 return StatusCode::SUCCESS;
335 const std::vector<JetDecision>& jetHypoInputs,
340 for (
auto&
pair : jetHypoInputs) {
350 passingIDs.insert(
getID(legInd).numeric());
357 return StatusCode::SUCCESS;
365 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".