ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
DerivationFramework::DiphotonVertexDecorator Class Reference

#include <DiphotonVertexDecorator.h>

Inheritance diagram for DerivationFramework::DiphotonVertexDecorator:
Collaboration diagram for DerivationFramework::DiphotonVertexDecorator:

Public Member Functions

 DiphotonVertexDecorator (const std::string &t, const std::string &n, const IInterface *p)
 Constructor with parameters. More...
 
 ~DiphotonVertexDecorator ()
 Destructor. More...
 
StatusCode initialize ()
 
StatusCode finalize ()
 
virtual StatusCode addBranches () const
 Pass the thinning service
More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface methods. More...
 

Protected Member Functions

void renounceArray (SG::VarHandleKeyArray &handlesArray)
 remove all handles from I/O resolution More...
 
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)
 
void extraDeps_update_handler (Gaudi::Details::PropertyBase &ExtraDeps)
 Add StoreName to extra input/output deps as needed. More...
 

Private Types

typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

bool PhotonPreselect (const xAOD::Photon *ph) const
 
StatusCode matchFlowElement (const xAOD::Photon *eg, const xAOD::FlowElementContainer *pfoCont) const
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
 specialization for handling Gaudi::Property<SG::VarHandleKey> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleKeyArrayType &)
 specialization for handling Gaudi::Property<SG::VarHandleKeyArray> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &hndl, const SG::VarHandleType &)
 specialization for handling Gaudi::Property<SG::VarHandleBase> More...
 
Gaudi::Details::PropertyBase & declareGaudiProperty (Gaudi::Property< T > &t, const SG::NotHandleType &)
 specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray> More...
 

Static Private Member Functions

static bool greaterPtFlowElement (const xAOD::FlowElement *part1, const xAOD::FlowElement *part2)
 

Private Attributes

ToolHandle< CP::IPhotonVertexSelectionToolm_photonVertexSelectionTool {this, "PhotonVertexSelectionTool", "", ""}
 
SG::ReadHandleKey< xAOD::VertexContainerm_primaryVertexKey {this, "PrimaryVertexName", "PrimaryVertices", "" }
 
SG::ReadHandleKey< xAOD::PhotonContainerm_photonKey { this, "PhotonKey", "Photons", "" }
 
SG::WriteHandleKey< xAOD::VertexContainerm_diphotonVertexKey {this, "DiphotonVertexName", "HggPrimaryVertices", "" }
 
SG::ReadHandleKey< xAOD::FlowElementContainerm_FEContainerHandleKey {this,"PFOContainerName","JetETMissChargedParticleFlowObjects","ReadHandleKey for the PFO container"}
 
double m_minPhotonPt
 
bool m_removeCrack
 
double m_maxEta
 
bool m_ignoreConv
 
std::string m_pfoToolName
 
double m_tcMatch_dR
 
double m_tcMatch_maxRat
 
StoreGateSvc_t m_evtStore
 Pointer to StoreGate (event store by default) More...
 
StoreGateSvc_t m_detStore
 Pointer to StoreGate (detector store by default) More...
 
std::vector< SG::VarHandleKeyArray * > m_vhka
 
bool m_varHandleArraysDeclared
 

Detailed Description

Author
Bruno Lenzi
Leo Cerda
magda.nosp@m.c@ce.nosp@m.rn.ch

Definition at line 37 of file DiphotonVertexDecorator.h.

Member Typedef Documentation

◆ StoreGateSvc_t

typedef ServiceHandle<StoreGateSvc> AthCommonDataStore< AthCommonMsg< AlgTool > >::StoreGateSvc_t
privateinherited

Definition at line 388 of file AthCommonDataStore.h.

Constructor & Destructor Documentation

◆ DiphotonVertexDecorator()

DerivationFramework::DiphotonVertexDecorator::DiphotonVertexDecorator ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Constructor with parameters.

Definition at line 29 of file DiphotonVertexDecorator.cxx.

31  :
32  AthAlgTool(t, n, p)
33 {
34 
35  declareInterface<DerivationFramework::IAugmentationTool>(this);
36 
37  declareProperty("RemoveCrack", m_removeCrack = true);
38  declareProperty("MaxEta", m_maxEta = 2.37);
39  declareProperty("MinimumPhotonPt", m_minPhotonPt = 20*CLHEP::GeV);
40  declareProperty("IgnoreConvPointing", m_ignoreConv = false);
41  declareProperty("TCMatchMaxRat", m_tcMatch_maxRat = 1.5 );
42  declareProperty("TCMatchDeltaR", m_tcMatch_dR = 0.1 );
43 
44 }

◆ ~DiphotonVertexDecorator()

DerivationFramework::DiphotonVertexDecorator::~DiphotonVertexDecorator ( )

Destructor.

Definition at line 47 of file DiphotonVertexDecorator.cxx.

47  {
48 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::DiphotonVertexDecorator::addBranches ( ) const
virtual

Pass the thinning service

Implements DerivationFramework::IAugmentationTool.

Definition at line 66 of file DiphotonVertexDecorator.cxx.

67 {
68 
69  ATH_MSG_DEBUG( "DiphotonVertexDecorator::AddingBranches" );
70 
72 
73  if (!PV->empty() && PV->at(0)) {
74  ATH_MSG_DEBUG( "Default PV " << PV->at(0) << ", type = " << PV->at(0)->vertexType() << " , z = " << PV->at(0)->z() );
75  }
76 
77  // Select the two highest pt photons that pass a preselection
78 
80  const xAOD::Photon *ph1 = nullptr, *ph2 = nullptr;
81 
82  for (const xAOD::Photon* ph: *photons)
83  {
84  if (!PhotonPreselect(ph)) continue;
85  if (not ph1 or ph->pt() > ph1->pt()) // new leading photon
86  {
87  ph2 = ph1;
88  ph1 = ph;
89  }
90  else if (not ph2 or ph->pt() > ph2->pt()) ph2 = ph; // new subleading photon
91  }
92 
93  const ConstDataVector< xAOD::PhotonContainer > vertexPhotons = {ph1, ph2};
94 
97 
98  ATH_CHECK( m_photonVertexSelectionTool->decorateInputs(*(vertexPhotons.asDataVector()), &vertexFailType) );
99 
100  // Get the photon vertex if possible
101  std::vector<std::pair<const xAOD::Vertex*, float> > vxResult;
102  const xAOD::Vertex *newPV = nullptr;
103 
105  SG::Decorator<char> passORDec("passOR");
106  for(const auto *const fe : *FEHandle) passORDec(*fe) = true;
107 
108  if (ph1 and ph2)
109  {
110  vxResult = m_photonVertexSelectionTool->getVertex( *( vertexPhotons.asDataVector()) , m_ignoreConv, true, &yyvertexVtxType, &vertexFailType );
111  if(!vxResult.empty()) {
112  newPV = vxResult[0].first; //output of photon vertex selection tool must be sorted according to score
113  }
114  ATH_CHECK(matchFlowElement(ph1,&*FEHandle));
115  ATH_CHECK(matchFlowElement(ph2,&*FEHandle));
116  }
117 
118  // Decorate the vertices with the NN score
119  ATH_MSG_DEBUG("PhotonVertexSelection returns vertex " << newPV << " " << (newPV? Form(" with z = %g", newPV->z()) : "") );
120  // Create shallow copy of the PrimaryVertices container
121  std::pair< xAOD::VertexContainer*, xAOD::ShallowAuxContainer* > HggPV = xAOD::shallowCopyContainer( *PV );
122  HggPV.second->setShallowIO(false);
123 
125  ATH_CHECK(vertexContainer.recordNonConst(std::unique_ptr< xAOD::VertexContainer >(HggPV.first),
126  std::unique_ptr< xAOD::ShallowAuxContainer >(HggPV.second)));
127 
128 
129  static const SG::Accessor<float> vertexScoreAcc("vertexScore");
130  static const SG::Accessor<int> vertexFailTypeAcc("vertexFailType");
131  static const SG::Accessor<int> vertexCaseAcc("vertexCase");
132  static const SG::Accessor<phlink_t> leadingPhotonLinkAcc("leadingPhotonLink");
133  static const SG::Accessor<phlink_t> subleadingPhotonLinkAcc("subleadingPhotonLink");
134 
135  if (newPV) {
136  //loop over vertex container; shallow copy has the same order
137  for (unsigned int iPV=0; iPV<PV->size(); iPV++) {
138  const auto *vx = PV->at(iPV);
139  auto yyvx = (HggPV.first)->at(iPV);
140  //reset vertex type
141  if (vx == newPV) {
142  //is this the diphoton primary vertex returned from the tool?
143  yyvx->setVertexType( xAOD::VxType::PriVtx );
144  } else if ( vx->vertexType()==xAOD::VxType::PriVtx || vx->vertexType()==xAOD::VxType::PileUp ) {
145  //not overriding the type of dummy vertices of type 0 (NoVtx)
146  yyvx->setVertexType( xAOD::VxType::PileUp );
147  }
148  //decorate score
149  for (const auto& vxR: vxResult) {
150  //find vertex in output from photonVertexSelectionTool
151  if ( vx == vxR.first ) {
152  vertexScoreAcc(*yyvx) = vxR.second;
153  vertexFailTypeAcc(*yyvx) = vertexFailType;
154  vertexCaseAcc(*yyvx) = yyvertexVtxType;
155  leadingPhotonLinkAcc(*yyvx) = phlink_t(*photons, ph1->index());
156  subleadingPhotonLinkAcc(*yyvx) = phlink_t(*photons, ph2->index());
157  break;
158  }
159  }
160  }
161  }
162  else {
163  //no vertex returned by photonVertexSelectionTool, decorate default PV with fit information
165  xAOD::VertexContainer::iterator yyvx_end = (HggPV.first)->end();
166  for(yyvx_itr = (HggPV.first)->begin(); yyvx_itr != yyvx_end; ++yyvx_itr ) {
167  if ( (*yyvx_itr)->vertexType()==xAOD::VxType::PriVtx ) {
168  vertexScoreAcc(**yyvx_itr) = -9999;
169  vertexFailTypeAcc(**yyvx_itr) = vertexFailType;
170  vertexCaseAcc(**yyvx_itr) = yyvertexVtxType;
171  leadingPhotonLinkAcc(**yyvx_itr) = (phlink_t()) ;
172  subleadingPhotonLinkAcc(**yyvx_itr) = (phlink_t());
173  }
174  }
175  }
176 
177 
178  if( !evtStore()->transientContains< xAOD::VertexContainer >( m_diphotonVertexKey.key() ) ){
179  ATH_MSG_WARNING("Unable to find transient xAOD::VertexContainer, \"" << m_diphotonVertexKey.key() << "\"");
180  }
181 
182  return StatusCode::SUCCESS;
183 }

◆ declareGaudiProperty() [1/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyArrayType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKeyArray>

Definition at line 170 of file AthCommonDataStore.h.

172  {
173  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
174  hndl.value(),
175  hndl.documentation());
176 
177  }

◆ declareGaudiProperty() [2/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleKeyType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleKey>

Definition at line 156 of file AthCommonDataStore.h.

158  {
159  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
160  hndl.value(),
161  hndl.documentation());
162 
163  }

◆ declareGaudiProperty() [3/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  hndl,
const SG::VarHandleType  
)
inlineprivateinherited

specialization for handling Gaudi::Property<SG::VarHandleBase>

Definition at line 184 of file AthCommonDataStore.h.

186  {
187  return *AthCommonDataStore<PBASE>::declareProperty(hndl.name(),
188  hndl.value(),
189  hndl.documentation());
190  }

◆ declareGaudiProperty() [4/4]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareGaudiProperty ( Gaudi::Property< T > &  t,
const SG::NotHandleType  
)
inlineprivateinherited

specialization for handling everything that's not a Gaudi::Property<SG::VarHandleKey> or a <SG::VarHandleKeyArray>

Definition at line 199 of file AthCommonDataStore.h.

200  {
201  return PBASE::declareProperty(t);
202  }

◆ declareProperty() [1/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleBase hndl,
const std::string &  doc,
const SG::VarHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleBase. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 245 of file AthCommonDataStore.h.

249  {
250  this->declare(hndl.vhKey());
251  hndl.vhKey().setOwner(this);
252 
253  return PBASE::declareProperty(name,hndl,doc);
254  }

◆ declareProperty() [2/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKey hndl,
const std::string &  doc,
const SG::VarHandleKeyType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
hndlObject holding the property value.
docDocumentation string for the property.

This is the version for types that derive from SG::VarHandleKey. The property value object is put on the input and output lists as appropriate; then we forward to the base class.

Definition at line 221 of file AthCommonDataStore.h.

225  {
226  this->declare(hndl);
227  hndl.setOwner(this);
228 
229  return PBASE::declareProperty(name,hndl,doc);
230  }

◆ declareProperty() [3/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
SG::VarHandleKeyArray hndArr,
const std::string &  doc,
const SG::VarHandleKeyArrayType  
)
inlineinherited

Definition at line 259 of file AthCommonDataStore.h.

263  {
264 
265  // std::ostringstream ost;
266  // ost << Algorithm::name() << " VHKA declareProp: " << name
267  // << " size: " << hndArr.keys().size()
268  // << " mode: " << hndArr.mode()
269  // << " vhka size: " << m_vhka.size()
270  // << "\n";
271  // debug() << ost.str() << endmsg;
272 
273  hndArr.setOwner(this);
274  m_vhka.push_back(&hndArr);
275 
276  Gaudi::Details::PropertyBase* p = PBASE::declareProperty(name, hndArr, doc);
277  if (p != 0) {
278  p->declareUpdateHandler(&AthCommonDataStore<PBASE>::updateVHKA, this);
279  } else {
280  ATH_MSG_ERROR("unable to call declareProperty on VarHandleKeyArray "
281  << name);
282  }
283 
284  return p;
285 
286  }

◆ declareProperty() [4/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc,
const SG::NotHandleType  
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This is the generic version, for types that do not derive from SG::VarHandleKey. It just forwards to the base class version of declareProperty.

Definition at line 333 of file AthCommonDataStore.h.

337  {
338  return PBASE::declareProperty(name, property, doc);
339  }

◆ declareProperty() [5/6]

Gaudi::Details::PropertyBase* AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( const std::string &  name,
T &  property,
const std::string &  doc = "none" 
)
inlineinherited

Declare a new Gaudi property.

Parameters
nameName of the property.
propertyObject holding the property value.
docDocumentation string for the property.

This dispatches to either the generic declareProperty or the one for VarHandle/Key/KeyArray.

Definition at line 352 of file AthCommonDataStore.h.

355  {
356  typedef typename SG::HandleClassifier<T>::type htype;
357  return declareProperty (name, property, doc, htype());
358  }

◆ declareProperty() [6/6]

Gaudi::Details::PropertyBase& AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty ( Gaudi::Property< T > &  t)
inlineinherited

Definition at line 145 of file AthCommonDataStore.h.

145  {
146  typedef typename SG::HandleClassifier<T>::type htype;
148  }

◆ detStore()

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::detStore ( ) const
inlineinherited

The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 95 of file AthCommonDataStore.h.

95 { return m_detStore; }

◆ evtStore() [1/2]

ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( )
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 85 of file AthCommonDataStore.h.

85 { return m_evtStore; }

◆ evtStore() [2/2]

const ServiceHandle<StoreGateSvc>& AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore ( ) const
inlineinherited

The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.

Definition at line 90 of file AthCommonDataStore.h.

90 { return m_evtStore; }

◆ extraDeps_update_handler()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::extraDeps_update_handler ( Gaudi::Details::PropertyBase &  ExtraDeps)
protectedinherited

Add StoreName to extra input/output deps as needed.

use the logic of the VarHandleKey to parse the DataObjID keys supplied via the ExtraInputs and ExtraOuputs Properties to add the StoreName if it's not explicitly given

◆ finalize()

StatusCode DerivationFramework::DiphotonVertexDecorator::finalize ( )

Definition at line 61 of file DiphotonVertexDecorator.cxx.

62 {
63  return StatusCode::SUCCESS;
64 }

◆ greaterPtFlowElement()

static bool DerivationFramework::DiphotonVertexDecorator::greaterPtFlowElement ( const xAOD::FlowElement part1,
const xAOD::FlowElement part2 
)
inlinestaticprivate

Definition at line 75 of file DiphotonVertexDecorator.h.

75  {
76  if (part1->charge()==0 && part2->charge()!=0) return false;
77  if (part1->charge()!=0 && part2->charge()==0) return true;
78  return part1->pt()>part2->pt();
79  }

◆ initialize()

StatusCode DerivationFramework::DiphotonVertexDecorator::initialize ( )

Definition at line 51 of file DiphotonVertexDecorator.cxx.

52 {
54  ATH_CHECK( m_primaryVertexKey.initialize() );
55  ATH_CHECK( m_photonKey.initialize() );
56  ATH_CHECK( m_diphotonVertexKey.initialize() );
57  ATH_CHECK( m_FEContainerHandleKey.initialize() );
58  return StatusCode::SUCCESS;
59 }

◆ inputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::inputHandles ( ) const
overridevirtualinherited

Return this algorithm's input handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ interfaceID()

static const InterfaceID& DerivationFramework::IAugmentationTool::interfaceID ( )
inlinestaticinherited

AlgTool interface methods.

Definition at line 31 of file IAugmentationTool.h.

31 { return IID_IAugmentationTool; }

◆ matchFlowElement()

StatusCode DerivationFramework::DiphotonVertexDecorator::matchFlowElement ( const xAOD::Photon eg,
const xAOD::FlowElementContainer pfoCont 
) const
private

Definition at line 222 of file DiphotonVertexDecorator.cxx.

222  {
223  const xAOD::IParticle* swclus = eg->caloCluster();
224 
225  // Preselect FEs based on proximity: dR<0.4
226  std::vector<const xAOD::FlowElement*> nearbyFE;
227  nearbyFE.reserve(20);
228  for(const auto *const fe : *feCont) {
229  if(xAOD::P4Helpers::isInDeltaR(*fe, *swclus, 0.4, true)) {
230  if( ( !fe->isCharged() && fe->e() > FLT_MIN )) nearbyFE.push_back(fe);
231  } // DeltaR check
232  } // FE loop
233 
234  SG::Decorator<char> passORDec("passOR");
235 
236  double eg_cl_e = swclus->e();
237  bool doSum = true;
238  double sumE_fe = 0.;
239  const xAOD::IParticle* bestbadmatch = nullptr;
240  std::sort(nearbyFE.begin(),nearbyFE.end(),greaterPtFlowElement);
241  for(const auto& fe : nearbyFE) {
242  if(!xAOD::P4Helpers::isInDeltaR(*fe, *swclus, m_tcMatch_dR, true)) {continue;}
243  // Handle neutral FEs like topoclusters
244  double fe_e = fe->e();
245  // skip cluster if it's above our bad match threshold or outside the matching radius
246  if(fe_e>m_tcMatch_maxRat*eg_cl_e) {
247  ATH_MSG_VERBOSE("Reject topocluster in sum. Ratio vs eg cluster: " << (fe_e/eg_cl_e));
248  if( !bestbadmatch || (std::abs(fe_e/eg_cl_e-1.) < std::abs(bestbadmatch->e()/eg_cl_e-1.)) ) bestbadmatch = fe;
249  continue;
250  }
251 
252  ATH_MSG_VERBOSE("E match with new nFE: " << std::abs(sumE_fe+fe_e - eg_cl_e) / eg_cl_e);
253  if( (doSum = std::abs(sumE_fe+fe_e-eg_cl_e) < std::abs(sumE_fe - eg_cl_e)) ) {
254  passORDec(*fe) = false;
255  sumE_fe += fe_e;
256  } // if we will retain the topocluster
257  else {break;}
258  } // loop over nearby clusters
259  if(sumE_fe<FLT_MIN && bestbadmatch) {
260  passORDec(*bestbadmatch) = false;
261  }
262 
263  return StatusCode::SUCCESS;
264 }

◆ msg() [1/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( ) const
inlineinherited

Definition at line 24 of file AthCommonMsg.h.

24  {
25  return this->msgStream();
26  }

◆ msg() [2/2]

MsgStream& AthCommonMsg< AlgTool >::msg ( const MSG::Level  lvl) const
inlineinherited

Definition at line 27 of file AthCommonMsg.h.

27  {
28  return this->msgStream(lvl);
29  }

◆ msgLvl()

bool AthCommonMsg< AlgTool >::msgLvl ( const MSG::Level  lvl) const
inlineinherited

Definition at line 30 of file AthCommonMsg.h.

30  {
31  return this->msgLevel(lvl);
32  }

◆ outputHandles()

virtual std::vector<Gaudi::DataHandle*> AthCommonDataStore< AthCommonMsg< AlgTool > >::outputHandles ( ) const
overridevirtualinherited

Return this algorithm's output handles.

We override this to include handle instances from key arrays if they have not yet been declared. See comments on updateVHKA.

◆ PhotonPreselect()

bool DerivationFramework::DiphotonVertexDecorator::PhotonPreselect ( const xAOD::Photon ph) const
private

Definition at line 185 of file DiphotonVertexDecorator.cxx.

186 {
187 
188  if (!ph) return false;
189 
190  if (!ph->isGoodOQ(34214)) return false;
191 
192  bool val(false);
193  bool defined(false);
194 
195  static const SG::ConstAccessor<char> DFCommonPhotonsIsEMLooseAcc("DFCommonPhotonsIsEMLoose");
196  if(DFCommonPhotonsIsEMLooseAcc.isAvailable(*ph)){
197  defined = true;
198  val = static_cast<bool>(DFCommonPhotonsIsEMLooseAcc(*ph));
199  }
200  else{
201  defined = ph->passSelection(val, "Loose");
202  }
203 
204  if(!defined || !val) return false;
205 
206  // veto topo-seeded clusters
207  if (ph->author(xAOD::EgammaParameters::AuthorCaloTopo35)) return false;
208 
209  // Check which variable versions are best...
210  const xAOD::CaloCluster *caloCluster(ph->caloCluster());
211  double eta = std::abs(caloCluster->etaBE(2));
212 
213  if (eta > m_maxEta) return false;
214  if (m_removeCrack && 1.37 <= eta && eta <= 1.52) return false;
215 
216  if (ph->pt() < m_minPhotonPt) return false;
217 
218  return true;
219 
220 }

◆ renounce()

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> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

381  {
382  h.renounce();
383  PBASE::renounce (h);
384  }

◆ renounceArray()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::renounceArray ( SG::VarHandleKeyArray handlesArray)
inlineprotectedinherited

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysInitialize ( )
overridevirtualinherited

Perform system initialization for an algorithm.

We override this to declare all the elements of handle key arrays at the end of initialization. See comments on updateVHKA.

Reimplemented in DerivationFramework::CfAthAlgTool, AthCheckedComponent< AthAlgTool >, AthCheckedComponent<::AthAlgTool >, and asg::AsgMetadataTool.

◆ sysStart()

virtual StatusCode AthCommonDataStore< AthCommonMsg< AlgTool > >::sysStart ( )
overridevirtualinherited

Handle START transition.

We override this in order to make sure that conditions handle keys can cache a pointer to the conditions container.

◆ updateVHKA()

void AthCommonDataStore< AthCommonMsg< AlgTool > >::updateVHKA ( Gaudi::Details::PropertyBase &  )
inlineinherited

Definition at line 308 of file AthCommonDataStore.h.

308  {
309  // debug() << "updateVHKA for property " << p.name() << " " << p.toString()
310  // << " size: " << m_vhka.size() << endmsg;
311  for (auto &a : m_vhka) {
312  std::vector<SG::VarHandleKey*> keys = a->keys();
313  for (auto k : keys) {
314  k->setOwner(this);
315  }
316  }
317  }

Member Data Documentation

◆ m_detStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
privateinherited

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_diphotonVertexKey

SG::WriteHandleKey<xAOD::VertexContainer> DerivationFramework::DiphotonVertexDecorator::m_diphotonVertexKey {this, "DiphotonVertexName", "HggPrimaryVertices", "" }
private

Definition at line 60 of file DiphotonVertexDecorator.h.

◆ m_evtStore

StoreGateSvc_t AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
privateinherited

Pointer to StoreGate (event store by default)

Definition at line 390 of file AthCommonDataStore.h.

◆ m_FEContainerHandleKey

SG::ReadHandleKey<xAOD::FlowElementContainer> DerivationFramework::DiphotonVertexDecorator::m_FEContainerHandleKey {this,"PFOContainerName","JetETMissChargedParticleFlowObjects","ReadHandleKey for the PFO container"}
private

Definition at line 61 of file DiphotonVertexDecorator.h.

◆ m_ignoreConv

bool DerivationFramework::DiphotonVertexDecorator::m_ignoreConv
private

Definition at line 68 of file DiphotonVertexDecorator.h.

◆ m_maxEta

double DerivationFramework::DiphotonVertexDecorator::m_maxEta
private

Definition at line 67 of file DiphotonVertexDecorator.h.

◆ m_minPhotonPt

double DerivationFramework::DiphotonVertexDecorator::m_minPhotonPt
private

Definition at line 65 of file DiphotonVertexDecorator.h.

◆ m_pfoToolName

std::string DerivationFramework::DiphotonVertexDecorator::m_pfoToolName
private

Definition at line 69 of file DiphotonVertexDecorator.h.

◆ m_photonKey

SG::ReadHandleKey<xAOD::PhotonContainer> DerivationFramework::DiphotonVertexDecorator::m_photonKey { this, "PhotonKey", "Photons", "" }
private

Definition at line 59 of file DiphotonVertexDecorator.h.

◆ m_photonVertexSelectionTool

ToolHandle<CP::IPhotonVertexSelectionTool> DerivationFramework::DiphotonVertexDecorator::m_photonVertexSelectionTool {this, "PhotonVertexSelectionTool", "", ""}
private

Definition at line 56 of file DiphotonVertexDecorator.h.

◆ m_primaryVertexKey

SG::ReadHandleKey<xAOD::VertexContainer> DerivationFramework::DiphotonVertexDecorator::m_primaryVertexKey {this, "PrimaryVertexName", "PrimaryVertices", "" }
private

Definition at line 58 of file DiphotonVertexDecorator.h.

◆ m_removeCrack

bool DerivationFramework::DiphotonVertexDecorator::m_removeCrack
private

Definition at line 66 of file DiphotonVertexDecorator.h.

◆ m_tcMatch_dR

double DerivationFramework::DiphotonVertexDecorator::m_tcMatch_dR
private

Definition at line 70 of file DiphotonVertexDecorator.h.

◆ m_tcMatch_maxRat

double DerivationFramework::DiphotonVertexDecorator::m_tcMatch_maxRat
private

Definition at line 71 of file DiphotonVertexDecorator.h.

◆ m_varHandleArraysDeclared

bool AthCommonDataStore< AthCommonMsg< AlgTool > >::m_varHandleArraysDeclared
privateinherited

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vhka

std::vector<SG::VarHandleKeyArray*> AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
privateinherited

Definition at line 398 of file AthCommonDataStore.h.


The documentation for this class was generated from the following files:
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ParticleTest.eg
eg
Definition: ParticleTest.py:29
SG::Accessor< float >
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:79
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
CP::IPhotonVertexSelectionTool::Unknown
@ Unknown
Definition: IPhotonVertexSelectionTool.h:45
DerivationFramework::DiphotonVertexDecorator::m_minPhotonPt
double m_minPhotonPt
Definition: DiphotonVertexDecorator.h:65
DerivationFramework::DiphotonVertexDecorator::m_removeCrack
bool m_removeCrack
Definition: DiphotonVertexDecorator.h:66
xAOD::Egamma_v1::author
uint16_t author(uint16_t bitmask=EgammaParameters::AuthorALL) const
Get author.
Definition: Egamma_v1.cxx:166
DerivationFramework::DiphotonVertexDecorator::m_maxEta
double m_maxEta
Definition: DiphotonVertexDecorator.h:67
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_evtStore
StoreGateSvc_t m_evtStore
Pointer to StoreGate (event store by default)
Definition: AthCommonDataStore.h:390
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_vhka
std::vector< SG::VarHandleKeyArray * > m_vhka
Definition: AthCommonDataStore.h:398
SG::ConstAccessor< char >
DerivationFramework::DiphotonVertexDecorator::PhotonPreselect
bool PhotonPreselect(const xAOD::Photon *ph) const
Definition: DiphotonVertexDecorator.cxx:185
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::DiphotonVertexDecorator::m_tcMatch_maxRat
double m_tcMatch_maxRat
Definition: DiphotonVertexDecorator.h:71
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
xAOD::IParticle
Class providing the definition of the 4-vector interface.
Definition: Event/xAOD/xAODBase/xAODBase/IParticle.h:40
ConstDataVector::asDataVector
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
mergePhysValFiles.end
end
Definition: DataQuality/DataQualityUtils/scripts/mergePhysValFiles.py:93
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
part1
Definition: part1.py:1
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
xAOD::CaloCluster_v1
Description of a calorimeter cluster.
Definition: CaloCluster_v1.h:59
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::Decorator< char >
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
CP::IPhotonVertexSelectionTool::yyVtxType
yyVtxType
Definition: IPhotonVertexSelectionTool.h:44
xAOD::EgammaParameters::AuthorCaloTopo35
const uint16_t AuthorCaloTopo35
Photon reconstructed by SW CaloTopo35 seeded clusters.
Definition: EgammaDefs.h:38
beamspotman.n
n
Definition: beamspotman.py:731
DerivationFramework::DiphotonVertexDecorator::greaterPtFlowElement
static bool greaterPtFlowElement(const xAOD::FlowElement *part1, const xAOD::FlowElement *part2)
Definition: DiphotonVertexDecorator.h:75
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
DerivationFramework::DiphotonVertexDecorator::matchFlowElement
StatusCode matchFlowElement(const xAOD::Photon *eg, const xAOD::FlowElementContainer *pfoCont) const
Definition: DiphotonVertexDecorator.cxx:222
DerivationFramework::DiphotonVertexDecorator::m_photonVertexSelectionTool
ToolHandle< CP::IPhotonVertexSelectionTool > m_photonVertexSelectionTool
Definition: DiphotonVertexDecorator.h:56
xAOD::Egamma_v1::caloCluster
const xAOD::CaloCluster * caloCluster(size_t index=0) const
Pointer to the xAOD::CaloCluster/s that define the electron candidate.
Definition: Egamma_v1.cxx:388
CP::IPhotonVertexSelectionTool::FailType
FailType
Declare the interface that the class provides.
Definition: IPhotonVertexSelectionTool.h:33
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
DerivationFramework::DiphotonVertexDecorator::m_FEContainerHandleKey
SG::ReadHandleKey< xAOD::FlowElementContainer > m_FEContainerHandleKey
Definition: DiphotonVertexDecorator.h:61
DerivationFramework::DiphotonVertexDecorator::m_primaryVertexKey
SG::ReadHandleKey< xAOD::VertexContainer > m_primaryVertexKey
Definition: DiphotonVertexDecorator.h:58
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAOD::Vertex_v1::z
float z() const
Returns the z position.
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
part2
Definition: part2.py:1
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
xAOD::VxType::PileUp
@ PileUp
Pile-up vertex.
Definition: TrackingPrimitives.h:573
phlink_t
ElementLink< xAOD::PhotonContainer > phlink_t
Definition: DiphotonVertexDecorator.cxx:26
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
DerivationFramework::DiphotonVertexDecorator::m_diphotonVertexKey
SG::WriteHandleKey< xAOD::VertexContainer > m_diphotonVertexKey
Definition: DiphotonVertexDecorator.h:60
xAOD::shallowCopyContainer
std::pair< std::unique_ptr< T >, std::unique_ptr< ShallowAuxContainer > > shallowCopyContainer(const T &cont, [[maybe_unused]] const EventContext &ctx)
Function making a shallow copy of a constant container.
Definition: ShallowCopy.h:110
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
a
TList * a
Definition: liststreamerinfos.cxx:10
h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
xAOD::Photon_v1
Definition: Photon_v1.h:37
std::sort
void sort(typename std::reverse_iterator< DataModel_detail::iterator< DVL > > beg, typename std::reverse_iterator< DataModel_detail::iterator< DVL > > end, const Compare &comp)
Specialization of sort for DataVector/List.
Definition: DVL_algorithms.h:623
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:616
xAOD::Egamma_v1::pt
virtual double pt() const override final
The transverse momentum ( ) of the particle.
Definition: Egamma_v1.cxx:65
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
DerivationFramework::DiphotonVertexDecorator::m_photonKey
SG::ReadHandleKey< xAOD::PhotonContainer > m_photonKey
Definition: DiphotonVertexDecorator.h:59
DerivationFramework::DiphotonVertexDecorator::m_ignoreConv
bool m_ignoreConv
Definition: DiphotonVertexDecorator.h:68
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
DerivationFramework::DiphotonVertexDecorator::m_tcMatch_dR
double m_tcMatch_dR
Definition: DiphotonVertexDecorator.h:70
xAOD::P4Helpers::isInDeltaR
bool isInDeltaR(const xAOD::IParticle &p1, const xAOD::IParticle &p2, double dR, bool useRapidity=true)
Check if 2 xAOD::IParticle are in a cone.
Definition: xAODP4Helpers.h:174
GeV
#define GeV
Definition: CaloTransverseBalanceVecMon.cxx:30
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
xAOD::IParticle::e
virtual double e() const =0
The total energy of the particle.
xAOD::Egamma_v1::passSelection
bool passSelection(bool &value, const std::string &menu) const
Check if the egamma object pass a selection menu (using the name) If the menu decision is stored in t...
fitman.k
k
Definition: fitman.py:528
xAOD::Egamma_v1::isGoodOQ
bool isGoodOQ(uint32_t mask) const
Check object quality. Return True is it is Good Object Quality.
Definition: Egamma_v1.cxx:236