ATLAS Offline Software
Public Member Functions | Protected Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
JetVertexTaggerTool Class Reference

James Frost
November 2014. More...

#include <JetVertexTaggerTool.h>

Inheritance diagram for JetVertexTaggerTool:
Collaboration diagram for JetVertexTaggerTool:

Public Member Functions

 JetVertexTaggerTool (const std::string &name)
 
virtual ~JetVertexTaggerTool ()
 
StatusCode initialize () override
 Dummy implementation of the initialisation function. More...
 
virtual StatusCode decorate (const xAOD::JetContainer &jetCont) const override
 Decorate a jet collection without otherwise modifying it. More...
 
float evaluateJvt (float rpt, float jvfcorr) const
 
float updateJvt (const xAOD::Jet &jet) const override
 Calculate the updated JVT. More...
 
const xAOD::VertexfindHSVertex () const
 
virtual void print () const
 Print the state of the tool. 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
 
virtual StatusCode modify (xAOD::JetContainer &jets) const override final
 Concrete implementation of the function inherited from IJetModifier. 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

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...
 

Private Attributes

Gaudi::Property< std::string > m_jetContainerName {this,"JetContainer", "", "SG key for the input jet container"}
 
Gaudi::Property< std::string > m_jvtlikelihoodHistName {this, "JVTLikelihoodHistName", "JVTRootCore_kNN100trim_pt20to50_Likelihood", "JVT likelihood histogram name"}
 
Gaudi::Property< std::string > m_jvtfileName {this, "JVTFileName", "JetMomentTools/JVTlikelihood_20140805.root", "JVT likelihood file name"}
 
Gaudi::Property< bool > m_suppressInputDeps {this, "SuppressInputDependence", false, "Will JVFCorr and SumPtTrk be created in the same algorithm that uses this tool?"}
 
SG::ReadHandleKey< xAOD::VertexContainerm_vertexContainer_key {this, "VertexContainer", "PrimaryVertices", "SG key for input vertex container"}
 
SG::ReadDecorHandleKey< xAOD::JetContainerm_jvfCorrKey {this, "JVFCorrName", "JVFCorr", "SG key for input JVFCorr decoration"}
 
SG::ReadDecorHandleKey< xAOD::JetContainerm_jvfCorrVtxKey
 
SG::ReadDecorHandleKey< xAOD::JetContainerm_sumPtTrkKey {this, "SumPtTrkName", "SumPtTrkPt500", "SG key for input SumPtTrk decoration"}
 
SG::WriteDecorHandleKey< xAOD::JetContainerm_jvtKey {this, "JVTName", "Jvt", "SG key for output JVT decoration"}
 
SG::WriteDecorHandleKey< xAOD::JetContainerm_jvtVecKey
 
SG::WriteDecorHandleKey< xAOD::JetContainerm_rptKey {this, "RpTName", "JvtRpt", "SG key for output RpT decoration"}
 
SG::WriteDecorHandleKey< xAOD::JetContainerm_rptVecKey
 
Gaudi::Property< bool > m_useOriginVertex = {this, "UseOriginVertex", false, "use origin vertex for each jet"}
 
TString m_fn
 
TH2F * m_jvthisto
 
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

James Frost
November 2014.

Updated for Run 3 by Bill Balunas March 2020

Tool to calculate the jet vertex tag (JVT) JVT is a float per jet

The JVT likelihood is parameterised in terms of: RPT: ratio of the primary vertex track sum to the jet pT JVFCorr: a corrected JVF calculation accounting for the number of PU tracks in the event.

Calculation requires three main types of information

  1. Vertex container for the event (from evtStore), with respect to which the JVT track sums
  2. Tracks associated to each of the input jet (in the jet aux store)
  3. Track vertex association object (from evtStore)
  4. The track container needed for PU track counting
  5. The ID track selector tool to provide an input track selection.
  6. An input file with the JVT likelihood stored as a 2D histogram.

Using this information, the procedure can be broken into three main steps:

  1. Count the total number of pileup tracks
  2. Per jet: Get track pT sums needed for JVFCorr and RpT
  3. Use JVT likelihood to get JVT value

Attributes added (each is a float per jet):

  1. Jvt - the JVTLikelihood value for the jet. This is parameterised in terms of:
  2. JvtRpt - the ratio of the PV track pT sum to the jet pT
  3. JvtJvfcorr - a corrected Jvf quantity that corrects for the number of pileup tracks in an event.

Properties: JetContainer - name of the jet container VertexContainer - name of the vertex container TrackParticleContainer - name of the track container AssociatedTracks - name for attribute holding the list of associated tracks TrackVertexAssociation - name for the container holding the track-vertex associations TrackSelector - tool to select tracks (none ==> no selection) JVTFileName - ROOT Filename containing JVT likelihood histogram JVTLikelihoodHistName - JVT Likelihood histogram name JVTName - name for the 3 JVT attributes (default is "JVT") K_JVFCorrScale - the scale factor for pileup tracks in the JVFCorr calculation (default is 0.01) Z0Cut - Z0 value (in mm) within which tracks associated to no vertex may be assigned to the primary vertex (default is 3.) PUTrkPtCut - the track pT (in MeV) below which tracks associated to no vertex may be assigned to the primary vertex (default is 30000.)

Definition at line 78 of file JetVertexTaggerTool.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

◆ JetVertexTaggerTool()

JetVertexTaggerTool::JetVertexTaggerTool ( const std::string &  name)

Definition at line 23 of file JetVertexTaggerTool.cxx.

25  m_jvthisto(nullptr)
26 {
27 }

◆ ~JetVertexTaggerTool()

JetVertexTaggerTool::~JetVertexTaggerTool ( )
virtual

Definition at line 31 of file JetVertexTaggerTool.cxx.

31  {
32  if(m_jvthisto) delete m_jvthisto;
33 }

Member Function Documentation

◆ 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  }

◆ decorate()

StatusCode JetVertexTaggerTool::decorate ( const xAOD::JetContainer jets) const
overridevirtual

Decorate a jet collection without otherwise modifying it.

Implements IJetDecorator.

Definition at line 99 of file JetVertexTaggerTool.cxx.

99  {
100 
101  // Get the vertex to calculate with respect to
102  // Only appropriate if we are using a single vertex interpretation, not if using OriginVertex
103  const xAOD::Vertex* HSvertex = nullptr;
104  if (!m_useOriginVertex)
105  {
106  HSvertex = findHSVertex();
107  if(!HSvertex) return StatusCode::FAILURE;
108  }
109 
110  // Grab vertices for index bookkeeping
112  const xAOD::VertexContainer* vertices = vertexHandle.cptr();
113 
118 
119 
120 
121  for(const xAOD::Jet * jet : jetCont) {
122  // Get origin-vertex-specific information if relevant
123  if (m_useOriginVertex)
124  {
125  HSvertex = jet->getAssociatedObject<xAOD::Vertex>("OriginVertex");
126  if (!HSvertex) // nullptr if the attribute doesn't exist
127  {
128  ATH_MSG_ERROR("OriginVertex was requested, but the jet does not contain an OriginVertex");
129  return StatusCode::FAILURE;
130  }
131  else
132  {
133  ATH_MSG_VERBOSE("JetVertexTaggerTool " << name() << " is using OriginVertex at index: " << HSvertex->index());
134  }
135  }
136 
137  // Calculate RpT and JVFCorr
138  // Default JVFcorr to -1 when no tracks are associated.
139  float jvfcorr = jvfCorrHandle(*jet);
140  std::vector<float> sumpttrk = sumPtTrkHandle(*jet);
141  const float rpt = sumpttrk[HSvertex->index() - (*vertices)[0]->index()]/jet->pt();
142  float jvt = evaluateJvt(rpt, jvfcorr);
143 
144  rptHandle(*jet) = rpt;
145  jvtHandle(*jet) = jvt;
146  ATH_MSG_VERBOSE("JetVertexTaggerTool " << name() << ": JVT=" << jvt << ", RpT=" << rpt << ", JVFCorr=" << jvfcorr);
147  }
148 
149  if (m_useOriginVertex) { // Compute JVT for jets assuming other vertices as origin
150 
154 
155  std::vector<float> jvtVtx;
156  std::vector<float> rptVtx;
157 
158  for(const xAOD::Jet * jet : jetCont) {
159  jvtVtx.clear();
160  rptVtx.clear();
161  std::vector<float> sumpttrk = sumPtTrkHandle(*jet);
162  std::vector<float> jvfcorrVtx = jvfCorrVtxHandle(*jet);
163 
164  // Loop over vertices
165  for(size_t vtxi=0; vtxi<vertices->size(); ++vtxi) {
166 
167  float jvfcorr = jvfcorrVtx.at(vtxi);
168  const float rpt = sumpttrk[vtxi]/jet->pt();
169  float jvt = evaluateJvt(rpt, jvfcorr);
170  jvtVtx.push_back(jvt);
171  rptVtx.push_back(rpt);
172  }
173 
174  jvtVecHandle(*jet) = jvtVtx;
175  rptVecHandle(*jet) = rptVtx;
176  // Done
177 
178  }
179  }
180  return StatusCode::SUCCESS;
181 }

◆ 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; }

◆ evaluateJvt()

float JetVertexTaggerTool::evaluateJvt ( float  rpt,
float  jvfcorr 
) const

Definition at line 184 of file JetVertexTaggerTool.cxx.

184  {
185  // Look up JVT value
186  float jvt = -999.;
187  if ( jvfcorr == -1.0 ) {
188  jvt = -0.1;
189  } else {
190  float rpt_inputtojvt = std::min(rpt, (float) 1. );
191  int bin = std::as_const(m_jvthisto)->FindBin(jvfcorr, rpt_inputtojvt);
192  jvt = m_jvthisto->GetBinContent(bin);
193  jvt = m_jvthisto->Interpolate(jvfcorr, rpt_inputtojvt);
194  }
195  return jvt;
196 }

◆ 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

◆ findHSVertex()

const xAOD::Vertex * JetVertexTaggerTool::findHSVertex ( ) const

Definition at line 234 of file JetVertexTaggerTool.cxx.

235 {
236  // Get input vertex collection
238  if (!vertexHandle.isValid()){
239  ATH_MSG_ERROR("Invalid VertexContainer datahandle: " << m_vertexContainer_key.key());
240  return nullptr;
241  }
242  const xAOD::VertexContainer* vertices = vertexHandle.cptr();
243  ATH_MSG_DEBUG("Successfully retrieved VertexContainer: " << m_vertexContainer_key.key());
244 
245  if (vertices->empty() ) {
246  ATH_MSG_WARNING("There are no vertices in the container. Exiting");
247  return nullptr;
248  }
249 
250  for ( size_t iVertex = 0; iVertex < vertices->size(); ++iVertex ) {
251  if(vertices->at(iVertex)->vertexType() == xAOD::VxType::PriVtx) {
252 
253  ATH_MSG_VERBOSE("JetVertexTaggerTool " << name() << " Found HS vertex at index: "<< iVertex);
254  return vertices->at(iVertex);
255  }
256  }
257  ATH_MSG_VERBOSE("There is no vertex of type PriVx. Taking default vertex.");
258  return vertices->at(0);
259 }

◆ getKey()

SG::sgkey_t asg::AsgTool::getKey ( const void *  ptr) const
inherited

Get the (hashed) key of an object that is in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the SG::sgkey_t key for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getName
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The hashed key of the object in the store. If not found, an invalid (zero) key.

Definition at line 119 of file AsgTool.cxx.

119  {
120 
121 #ifdef XAOD_STANDALONE
122  // In case we use @c xAOD::TEvent, we have a direct function call
123  // for this.
124  return evtStore()->event()->getKey( ptr );
125 #else
126  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
127  return ( proxy == nullptr ? 0 : proxy->sgkey() );
128 #endif // XAOD_STANDALONE
129  }

◆ getName()

const std::string & asg::AsgTool::getName ( const void *  ptr) const
inherited

Get the name of an object that is / should be in the event store.

This is a bit of a special one. StoreGateSvc and xAOD::TEvent both provide ways for getting the std::string name for an object that is in the store, based on a bare pointer. But they provide different interfaces for doing so.

In order to allow tools to efficiently perform this operation, they can use this helper function.

See also
asg::AsgTool::getKey
Parameters
ptrThe bare pointer to the object that the event store should know about
Returns
The string name of the object in the store. If not found, an empty string.

Definition at line 106 of file AsgTool.cxx.

106  {
107 
108 #ifdef XAOD_STANDALONE
109  // In case we use @c xAOD::TEvent, we have a direct function call
110  // for this.
111  return evtStore()->event()->getName( ptr );
112 #else
113  const SG::DataProxy* proxy = evtStore()->proxy( ptr );
114  static const std::string dummy = "";
115  return ( proxy == nullptr ? dummy : proxy->name() );
116 #endif // XAOD_STANDALONE
117  }

◆ getProperty()

template<class T >
const T* asg::AsgTool::getProperty ( const std::string &  name) const
inherited

Get one of the tool's properties.

◆ initialize()

StatusCode JetVertexTaggerTool::initialize ( )
overridevirtual

Dummy implementation of the initialisation function.

It's here to allow the dual-use tools to skip defining an initialisation function. Since many are doing so...

Reimplemented from asg::AsgTool.

Definition at line 37 of file JetVertexTaggerTool.cxx.

37  {
38  ATH_MSG_INFO("Initializing JetVertexTaggerTool " << name());
39  ATH_MSG_INFO("Using origin vertex: " << m_useOriginVertex);
40 
41  if(m_jetContainerName.empty()){
42  ATH_MSG_ERROR("JetVertexTaggerTool needs to have its input jet container configured!");
43  return StatusCode::FAILURE;
44  }
45 
46  // Use the Path Resolver to find the jvt file and retrieve the likelihood histogram
48  ATH_MSG_INFO(" Reading JVT file from:\n " << m_jvtfileName << "\n");
49  ATH_MSG_INFO(" resolved in :\n " << m_fn << "\n\n");
50 
51  std::unique_ptr<TFile> jvtfile {TFile::Open(m_fn)};
52  if(!jvtfile){
53  ATH_MSG_FATAL("Cannot open JVTLikelihoodFile: " << m_fn);
54  return StatusCode::FAILURE;
55  }
56 
57  ATH_MSG_VERBOSE("\n Reading JVT likelihood histogram from:\n " << m_fn << "\n\n");
58 
59  m_jvthisto = (TH2F*)jvtfile->Get(std::string(m_jvtlikelihoodHistName).c_str() );
60  if(!m_jvthisto){
61  ATH_MSG_FATAL( "\n Found JVT file, but JVT histogram missing. Aborting..." );
62  return StatusCode::FAILURE;
63  }
64  m_jvthisto->SetDirectory (nullptr);
65 
67  m_jvfCorrVtxKey = m_jvfCorrKey.key()+"Vec";
69  m_jvtKey = m_jetContainerName + "." + m_jvtKey.key();
70  m_jvtVecKey = m_jvtKey.key()+"Vec";
71  m_rptKey = m_jetContainerName + "." + m_rptKey.key();
72  m_rptVecKey = m_rptKey.key()+"Vec";
73 
74 #ifndef XAOD_STANDALONE
76  // The user has promised that these will be produced by the same alg running JVT.
77  // Tell the scheduler to ignore them to avoid circular dependencies.
80  }
81 #endif
82 
83  ATH_CHECK(m_vertexContainer_key.initialize());
84  ATH_CHECK(m_jvfCorrKey.initialize());
85  ATH_CHECK(m_sumPtTrkKey.initialize());
86  ATH_CHECK(m_jvtKey.initialize());
87  ATH_CHECK(m_rptKey.initialize());
88 
92 
93 
94  return StatusCode::SUCCESS;
95 }

◆ 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.

◆ modify()

virtual StatusCode IJetDecorator::modify ( xAOD::JetContainer jets) const
inlinefinaloverridevirtualinherited

Concrete implementation of the function inherited from IJetModifier.

Implements IJetModifier.

Definition at line 32 of file IJetDecorator.h.

32 {return decorate(jets);};

◆ 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  }

◆ msg_level_name()

const std::string & asg::AsgTool::msg_level_name ( ) const
inherited

A deprecated function for getting the message level's name.

Instead of using this, weirdly named function, user code should get the string name of the current minimum message level (in case they really need it...), with:

MSG::name( msg().level() )

This function's name doesn't follow the ATLAS coding rules, and as such will be removed in the not too distant future.

Returns
The string name of the current minimum message level that's printed

Definition at line 101 of file AsgTool.cxx.

101  {
102 
103  return MSG::name( msg().level() );
104  }

◆ 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.

◆ print()

void asg::AsgTool::print ( ) const
virtualinherited

◆ 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.

◆ updateJvt()

float JetVertexTaggerTool::updateJvt ( const xAOD::Jet jet) const
overridevirtual

Calculate the updated JVT.

jet - jet for which JVT is updated The new value for JVT is returned.

Implements IJetUpdateJvt.

Definition at line 200 of file JetVertexTaggerTool.cxx.

200  {
203 
204  float jvfcorr = jvfCorrHandle(jet);
205  std::vector<float> sumpttrk = sumPtTrkHandle(jet);
206 
207  // Get the vertex to calculate with respect to
208  const xAOD::Vertex* HSvertex = nullptr;
209  if (!m_useOriginVertex)
210  HSvertex = findHSVertex();
211  else
212  {
213  HSvertex = jet.getAssociatedObject<xAOD::Vertex>("OriginVertex");
214  if (HSvertex) // nullptr if the attribute doesn't exist, nothing to do as behaviour is same as other method, checked below and return -1
215  ATH_MSG_VERBOSE("JetVertexTaggerTool " << name() << " is using OriginVertex at index: " << HSvertex->index());
216  }
217 
218  if(!HSvertex) {
219  ATH_MSG_ERROR("No hard scatter vertex found. Returning JVT=-1");
220  return -1.;
221  }
222 
223  // Grab vertices for index bookkeeping
225  const xAOD::VertexContainer* vertices = vertexHandle.cptr();
226 
227  const float rptnew = sumpttrk[HSvertex->index() - (*vertices)[0]->index()]/jet.pt();
228 
229  return evaluateJvt(rptnew, jvfcorr);
230 }

◆ 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_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_fn

TString JetVertexTaggerTool::m_fn
private

Definition at line 126 of file JetVertexTaggerTool.h.

◆ m_jetContainerName

Gaudi::Property<std::string> JetVertexTaggerTool::m_jetContainerName {this,"JetContainer", "", "SG key for the input jet container"}
private

Definition at line 109 of file JetVertexTaggerTool.h.

◆ m_jvfCorrKey

SG::ReadDecorHandleKey<xAOD::JetContainer> JetVertexTaggerTool::m_jvfCorrKey {this, "JVFCorrName", "JVFCorr", "SG key for input JVFCorr decoration"}
private

Definition at line 115 of file JetVertexTaggerTool.h.

◆ m_jvfCorrVtxKey

SG::ReadDecorHandleKey<xAOD::JetContainer> JetVertexTaggerTool::m_jvfCorrVtxKey
private

Definition at line 116 of file JetVertexTaggerTool.h.

◆ m_jvtfileName

Gaudi::Property<std::string> JetVertexTaggerTool::m_jvtfileName {this, "JVTFileName", "JetMomentTools/JVTlikelihood_20140805.root", "JVT likelihood file name"}
private

Definition at line 111 of file JetVertexTaggerTool.h.

◆ m_jvthisto

TH2F* JetVertexTaggerTool::m_jvthisto
private

Definition at line 127 of file JetVertexTaggerTool.h.

◆ m_jvtKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetVertexTaggerTool::m_jvtKey {this, "JVTName", "Jvt", "SG key for output JVT decoration"}
private

Definition at line 118 of file JetVertexTaggerTool.h.

◆ m_jvtlikelihoodHistName

Gaudi::Property<std::string> JetVertexTaggerTool::m_jvtlikelihoodHistName {this, "JVTLikelihoodHistName", "JVTRootCore_kNN100trim_pt20to50_Likelihood", "JVT likelihood histogram name"}
private

Definition at line 110 of file JetVertexTaggerTool.h.

◆ m_jvtVecKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetVertexTaggerTool::m_jvtVecKey
private

Definition at line 119 of file JetVertexTaggerTool.h.

◆ m_rptKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetVertexTaggerTool::m_rptKey {this, "RpTName", "JvtRpt", "SG key for output RpT decoration"}
private

Definition at line 120 of file JetVertexTaggerTool.h.

◆ m_rptVecKey

SG::WriteDecorHandleKey<xAOD::JetContainer> JetVertexTaggerTool::m_rptVecKey
private

Definition at line 121 of file JetVertexTaggerTool.h.

◆ m_sumPtTrkKey

SG::ReadDecorHandleKey<xAOD::JetContainer> JetVertexTaggerTool::m_sumPtTrkKey {this, "SumPtTrkName", "SumPtTrkPt500", "SG key for input SumPtTrk decoration"}
private

Definition at line 117 of file JetVertexTaggerTool.h.

◆ m_suppressInputDeps

Gaudi::Property<bool> JetVertexTaggerTool::m_suppressInputDeps {this, "SuppressInputDependence", false, "Will JVFCorr and SumPtTrk be created in the same algorithm that uses this tool?"}
private

Definition at line 112 of file JetVertexTaggerTool.h.

◆ m_useOriginVertex

Gaudi::Property<bool> JetVertexTaggerTool::m_useOriginVertex = {this, "UseOriginVertex", false, "use origin vertex for each jet"}
private

Definition at line 123 of file JetVertexTaggerTool.h.

◆ m_varHandleArraysDeclared

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

Definition at line 399 of file AthCommonDataStore.h.

◆ m_vertexContainer_key

SG::ReadHandleKey<xAOD::VertexContainer> JetVertexTaggerTool::m_vertexContainer_key {this, "VertexContainer", "PrimaryVertices", "SG key for input vertex container"}
private

Definition at line 114 of file JetVertexTaggerTool.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:
JetVertexTaggerTool::m_jvfCorrKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jvfCorrKey
Definition: JetVertexTaggerTool.h:115
JetVertexTaggerTool::m_jvfCorrVtxKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_jvfCorrVtxKey
Definition: JetVertexTaggerTool.h:116
asg::AsgTool
Base class for the dual-use tool implementation classes.
Definition: AsgTool.h:47
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
JetVertexTaggerTool::m_jetContainerName
Gaudi::Property< std::string > m_jetContainerName
Definition: JetVertexTaggerTool.h:109
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::ReadHandle::cptr
const_pointer_type cptr()
Dereference the pointer.
JetVertexTaggerTool::m_jvtlikelihoodHistName
Gaudi::Property< std::string > m_jvtlikelihoodHistName
Definition: JetVertexTaggerTool.h:110
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JetVertexTaggerTool::m_sumPtTrkKey
SG::ReadDecorHandleKey< xAOD::JetContainer > m_sumPtTrkKey
Definition: JetVertexTaggerTool.h:117
min
constexpr double min()
Definition: ap_fixedTest.cxx:26
AthCommonDataStore< AthCommonMsg< AlgTool > >::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 > renounce(T &h)
Definition: AthCommonDataStore.h:380
bin
Definition: BinsDiffFromStripMedian.h:43
JetVertexTaggerTool::m_useOriginVertex
Gaudi::Property< bool > m_useOriginVertex
Definition: JetVertexTaggerTool.h:123
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
JetVertexTaggerTool::m_rptKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_rptKey
Definition: JetVertexTaggerTool.h:120
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
ATH_MSG_VERBOSE
#define ATH_MSG_VERBOSE(x)
Definition: AthMsgStreamMacros.h:28
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
python.TrigEgammaMonitorHelper.TH2F
def TH2F(name, title, nxbins, bins_par2, bins_par3, bins_par4, bins_par5=None, bins_par6=None, path='', **kwargs)
Definition: TrigEgammaMonitorHelper.py:45
JetVertexTaggerTool::m_rptVecKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_rptVecKey
Definition: JetVertexTaggerTool.h:121
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:270
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
jet
Definition: JetCalibTools_PlotJESFactors.cxx:23
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
SG::ReadDecorHandle
Handle class for reading a decoration on an object.
Definition: StoreGate/StoreGate/ReadDecorHandle.h:94
JetVertexTaggerTool::m_jvtVecKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jvtVecKey
Definition: JetVertexTaggerTool.h:119
JetVertexTaggerTool::m_jvtKey
SG::WriteDecorHandleKey< xAOD::JetContainer > m_jvtKey
Definition: JetVertexTaggerTool.h:118
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
SG::WriteDecorHandle
Handle class for adding a decoration to an object.
Definition: StoreGate/StoreGate/WriteDecorHandle.h:100
xAOD::VxType::PriVtx
@ PriVtx
Primary vertex.
Definition: TrackingPrimitives.h:571
python.xAODType.dummy
dummy
Definition: xAODType.py:4
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
MSG::name
const std::string & name(Level lvl)
Convenience function for translating message levels to strings.
Definition: MsgLevel.cxx:19
JetVertexTaggerTool::m_jvtfileName
Gaudi::Property< std::string > m_jvtfileName
Definition: JetVertexTaggerTool.h:111
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
SG::AuxElement::index
size_t index() const
Return the index of this element within its container.
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
SG::ReadHandle::isValid
virtual bool isValid() override final
Can the handle be successfully dereferenced?
JetVertexTaggerTool::m_fn
TString m_fn
Definition: JetVertexTaggerTool.h:126
JetVertexTaggerTool::evaluateJvt
float evaluateJvt(float rpt, float jvfcorr) const
Definition: JetVertexTaggerTool.cxx:184
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
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
JetVertexTaggerTool::m_jvthisto
TH2F * m_jvthisto
Definition: JetVertexTaggerTool.h:127
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
JetVertexTaggerTool::m_suppressInputDeps
Gaudi::Property< bool > m_suppressInputDeps
Definition: JetVertexTaggerTool.h:112
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
a
TList * a
Definition: liststreamerinfos.cxx:10
h
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
IJetDecorator::decorate
virtual StatusCode decorate(const xAOD::JetContainer &jets) const =0
Decorate a jet collection without otherwise modifying it.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
JetVertexTaggerTool::findHSVertex
const xAOD::Vertex * findHSVertex() const
Definition: JetVertexTaggerTool.cxx:234
defineDB.jets
list jets
Definition: JetTagCalibration/share/defineDB.py:24
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
JetVertexTaggerTool::m_vertexContainer_key
SG::ReadHandleKey< xAOD::VertexContainer > m_vertexContainer_key
Definition: JetVertexTaggerTool.h:114
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
SG::DataProxy
Definition: DataProxy.h:45
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
DataVector::empty
bool empty() const noexcept
Returns true if the collection is empty.
fitman.k
k
Definition: fitman.py:528