38#include "GaudiKernel/SystemOfUnits.h"
75 ATH_MSG_ERROR(
"Configured to use modified topocluster collection but \"CaloCalTopoClusters\" collection specified!");
76 return StatusCode::FAILURE;
78 ATH_MSG_INFO(
"Configured to use standard topocluster collection.");
84 ATH_MSG_ERROR(
"Configured to use topocluster collection \"" <<
m_clcollKey.key() <<
"\", but modified clusters flag not set!");
85 return StatusCode::FAILURE;
100 if(
m_pfcollKey.key() ==
"JetETMissParticleFlowObjects") {
102 ATH_MSG_ERROR(
"This is no longer supported -- please use the CHSParticleFlowObjects collection, which has the four-vector corrections built in.");
103 return StatusCode::FAILURE;
110 std::string hybridname =
"Etmiss";
121 return StatusCode::SUCCESS;
128 ATH_MSG_WARNING(
"Invalid pointer to MissingETContainer supplied! Abort.");
129 return StatusCode::FAILURE;
133 ATH_MSG_WARNING(
"Invalid pointer to MissingETAssociationMap supplied! Abort.");
134 return StatusCode::FAILURE;
137 ATH_MSG_WARNING(
"Attempting to build PFlow MET without a track collection.");
138 return StatusCode::FAILURE;
150 if (!topoclusterCont.
isValid()) {
152 return StatusCode::FAILURE;
155 ATH_MSG_DEBUG(
"Successfully retrieved topocluster collection");
157 std::string hybridname =
"Etmiss";
166 ATH_MSG_WARNING(
"Trying to do something currently unsupported- lets abort");
167 return StatusCode::FAILURE;
221 return StatusCode::FAILURE;
224 ATH_MSG_DEBUG(
"Successfully retrieved primary vertex container");
225 ATH_MSG_DEBUG(
"Container holds " << vxCont->size() <<
" vertices");
227 for(
const auto *
const vx : *vxCont) {
230 {constits.
pv = vx;
break;}
233 ATH_MSG_DEBUG(
"Failed to find primary vertex! Reject all tracks.");
243 return StatusCode::FAILURE;
250 constits.
feCont =
nullptr;
254 return StatusCode::FAILURE;
264 return StatusCode::FAILURE;
271 return StatusCode::SUCCESS;
285 return StatusCode::FAILURE;
289 std::vector<const IParticle*> constlist;
290 constlist.reserve(20);
291 std::vector<const IParticle*> hardObjs_tmp;
292 for(
const auto *
const obj : *hardObjs) {
293 hardObjs_tmp.push_back(obj);
297 for(
const auto& obj : hardObjs_tmp) {
303 ATH_MSG_VERBOSE(
"Object type, pt, eta, phi = " << obj->type() <<
", " << obj->pt() <<
", " << obj->eta() <<
"," << obj->phi() );
307 ATH_MSG_ERROR(
"Attempting to build FlowElement MET without a track collection.");
308 return StatusCode::FAILURE;
310 std::map<const IParticle*, MissingETBase::Types::constvec_t> momentumOverride;
312 float UEcorr_Pt = 0.;
315 dec_UEcorr(*obj) = UEcorr_Pt;
325 ATH_MSG_DEBUG(
"Attempting to build PFlow without a track collection.");
326 return StatusCode::FAILURE;
328 std::map<const IParticle*,MissingETBase::Types::constvec_t> momentumOverride;
334 std::vector<const IParticle*> tclist;
338 for(
const auto& cl : tclist) {
340 constlist.push_back((*constits.
tcCont)[cl->index()]);
349 return StatusCode::SUCCESS;
357 if (!vx)
return false;
358 return static_cast<bool> (
m_trkseltool->accept( *trk, vx ));
373 float ptcone20 = 0., isolfrac = 0., etcone10 = 0., EoverP = 0.;
376 std::vector<Iso::IsolationType> trkIsoCones;
384 ptcone20 = !trkIsoResult.
ptcones.empty() ? trkIsoResult.
ptcones[0] : 0;
385 isolfrac = ptcone20/trk->
pt();
388 std::vector<Iso::IsolationType> caloIsoCones;
398 caloIsoCorr_coreCone);
399 if(!caloIsoResult.
etcones.empty()) {
403 ATH_MSG_WARNING(
"isGoodEoverP: Failed to retrieve the isolation core correction (etcone10)! Setting etcone10=0");
406 EoverP = etcone10/trk->
pt();
413 if(Rerr>0.4)
return false;
414 else if (EoverP<0.65 && ((EoverP>0.1 && Rerr>0.05) || Rerr>0.1))
return false;
417 float trkptsum = ptcone20+trk->
pt();
418 if(etcone10/trkptsum<0.6 && trk->
pt()/trkptsum>0.6)
return false;
425 std::vector<TLorentzVector>& v_clus,
426 TLorentzVector& clus,
429 const float MinDistCone,
433 unsigned int seed = floor( clus.Pt() * Gaudi::Units::GeV );
437 bool isNextToPart(
true);
438 bool isNextToHR(
true);
441 int numOfRndTrials = 0;
442 const int maxNumOfRndTrials = 100;
444 while(isNextToPart || isNextToHR ){
445 isNextToPart =
false;
448 phiRnd = hole.Uniform( -std::numbers::pi, std::numbers::pi);
450 if(dR > MinDistCone){
454 for(
const auto& clus_j : v_clus) {
456 if(dR < MinDistCone){
463 if(numOfRndTrials == maxNumOfRndTrials){
465 return StatusCode::SUCCESS;
473 TLorentzVector tv_UEcorr;
474 std::pair <double, double> eta_rndphi = std::make_pair(clus.Eta(), phiRnd);
480 for(
const auto fe_itr : *constits.feCont){
481 if(fe_itr->pt() < 0 || fe_itr->e() < 0){
491 double dR =
P4Helpers::deltaR( fe_itr->eta(), fe_itr->phi(), eta_rndphi.first, eta_rndphi.second );
494 TLorentzVector tv_fe = fe_itr->p4();
495 tv_fe.RotateZ(dphi_angle);
500 UEcorr = tv_UEcorr.Pt();
502 return StatusCode::SUCCESS;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
DataVector adapter that acts like it holds const pointers.
std::enable_if_t< std::is_void_v< std::result_of_t< decltype(&T::renounce)(T)> > &&!std::is_base_of_v< SG::VarHandleKeyArray, T > &&std::is_base_of_v< Gaudi::DataHandle, T >, void > renounce(T &h)
Helper class to provide constant type-safe access to aux data.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
Handle class for adding a decoration to an object.
const ParametersCovMatrix_t definingParametersCovMatrix() const
Returns the 5x5 symmetric matrix containing the defining parameters covariance matrix.
float qOverP() const
Returns the parameter.
virtual double pt() const override final
The transverse momentum ( ) of the particle.
virtual double eta() const override final
The pseudorapidity ( ) of the particle.
float z() const
Returns the z position.
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
static const SG::ConstAccessor< char > PVMatchedAcc("matchedToPV")
void sort(typename DataModel_detail::iterator< DVL > beg, typename DataModel_detail::iterator< DVL > end)
Specialization of sort for DataVector/List.
@ Muon
The object is a muon.
@ etcone20
Calorimeter isolation.
@ ptcone20
Track isolation.
@ coreTrackPtr
tracks pointer
@ coreEnergy
energy stored for this correction
@ coreCone
core energy (in dR<0.1).
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
double deltaR(double rapidity1, double phi1, double rapidity2, double phi2)
from bare bare rapidity,phi
setRcore setEtHad setFside pt
TrackParticle_v1 TrackParticle
Reference the current persistent version:
Vertex_v1 Vertex
Define the latest version of the vertex class.
MissingETContainer_v1 MissingETContainer
MissingETAssociationMap_v1 MissingETAssociationMap
Version control by type defintion.
DataVector< IParticle > IParticleContainer
Simple convenience declaration of IParticleContainer.
static bool insert(MissingETComponentMap *pMap, const MissingET *pMET, const IParticle *pPart, MissingETBase::Types::weight_t weight=MissingETBase::Types::weight_t())
Insert contributing signal or physics object by pointer, with optional kinematic weight object.
Iso::IsolationCaloCorrectionBitset calobitset
std::vector< float > etcones
std::map< Iso::IsolationCaloCorrection, std::map< Iso::IsolationCorrectionParameter, float > > coreCorrections
Iso::IsolationTrackCorrectionBitset trackbitset
std::vector< float > ptcones