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

Electron isEM selector. More...

#include <AsgForwardElectronIsEMSelector.h>

Inheritance diagram for AsgForwardElectronIsEMSelector:
Collaboration diagram for AsgForwardElectronIsEMSelector:

Public Member Functions

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
 

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

virtual ASG_TOOL_CLASS3(AsgForwardElectronIsEMSelector, IAsgForwardElectronIsEMSelector, IAsgEGammaIsEMSelector, IAsgSelectionTool) public ~AsgForwardElectronIsEMSelector ()
 Standard constructor. More...
 
virtual StatusCode initialize () override final
 Gaudi Service Interface method implementations. More...
 
virtual const asg::AcceptInfogetAcceptInfo () const override final
 Method to get the plain AcceptInfo. More...
 
virtual asg::AcceptData accept (const xAOD::IParticle *part) const override final
 Accept with generic interface. More...
 
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::IParticle *part) const override final
 
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::Egamma *part) const override final
 Accept with Egamma objects. More...
 
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::Photon *part) const override final
 Accept with Photon objects. More...
 
virtual asg::AcceptData accept (const EventContext &ctx, const xAOD::Electron *part) const override final
 Accept with Electron objects. More...
 
virtual std::string getOperatingPointName () const override final
 Method to get the operating point. More...
 
virtual StatusCode execute (const EventContext &ctx, const xAOD::Egamma *eg, unsigned int &isEM) const override final
 ==========================================================================================// More...
 
unsigned int getNPrimVertices (const EventContext &ctx) const
 ( This is horrible! We don't want to iterate over all vertices in the event for each electron!!! / This is slow!) More...
 
unsigned int calocuts_electrons (const xAOD::Egamma *eg, float eta2, float nvtx, unsigned int iflag) 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...
 

Private Attributes

std::string m_WorkingPoint
 Working Point. More...
 
std::string m_configFile
 Config File. More...
 
Root::TForwardElectronIsEMSelectorm_rootForwardTool
 Pointer to the underlying ROOT based tool. More...
 
bool m_usePVCont
 Whether to use the PV (not available for trigger) More...
 
unsigned int m_nPVdefault
 
SG::ReadHandleKey< xAOD::VertexContainerm_primVtxContKey
 read handle key to primary vertex container More...
 
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

Electron isEM selector.

Author
Jovan Mitrevski (UCSC) Karsten Koeneke (CERN)
Date
Dec 2011 - Fab 2012

11-MAR-2014 convert to ASG tool (Jovan Mitrevski)

Definition at line 40 of file AsgForwardElectronIsEMSelector.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

◆ ~AsgForwardElectronIsEMSelector()

AsgForwardElectronIsEMSelector::~AsgForwardElectronIsEMSelector ( )
privatevirtual

Standard constructor.

Standard destructor

Definition at line 93 of file AsgForwardElectronIsEMSelector.cxx.

94 {
95  delete m_rootForwardTool;
96 }

Member Function Documentation

◆ accept() [1/5]

asg::AcceptData AsgForwardElectronIsEMSelector::accept ( const EventContext &  ctx,
const xAOD::Egamma part 
) const
finaloverrideprivatevirtual

Accept with Egamma objects.

Implements IAsgForwardElectronIsEMSelector.

Definition at line 207 of file AsgForwardElectronIsEMSelector.cxx.

209 {
210 
211  ATH_MSG_DEBUG("Entering accept( const Egamma* part )");
212  if (eg) {
213  unsigned int isEM = ~0;
214  StatusCode sc = execute(ctx, eg, isEM);
215  if (sc.isFailure()) {
216  ATH_MSG_ERROR("could not calculate isEM");
217  return m_rootForwardTool->accept();
218  }
219  return m_rootForwardTool->fillAccept(isEM);
220  }
221 
223  "AsgForwardElectronIsEMSelector::accept was given a bad argument");
224  return m_rootForwardTool->accept();
225 }

◆ accept() [2/5]

asg::AcceptData AsgForwardElectronIsEMSelector::accept ( const EventContext &  ctx,
const xAOD::Electron part 
) const
finaloverrideprivatevirtual

Accept with Electron objects.

Implements IAsgForwardElectronIsEMSelector.

Definition at line 228 of file AsgForwardElectronIsEMSelector.cxx.

230 {
232  "Entering accept( const EventContext& ctx, const Electron* part )");
233  return accept(ctx, static_cast<const xAOD::Egamma*>(el));
234 }

◆ accept() [3/5]

asg::AcceptData AsgForwardElectronIsEMSelector::accept ( const EventContext &  ctx,
const xAOD::IParticle part 
) const
finaloverrideprivatevirtual

Implements IAsgForwardElectronIsEMSelector.

Definition at line 191 of file AsgForwardElectronIsEMSelector.cxx.

193 {
194 
195  ATH_MSG_DEBUG("Entering accept( const IParticle* part )");
196  if (part->type() == xAOD::Type::Electron ||
197  part->type() == xAOD::Type::Photon) {
198  return accept(ctx, static_cast<const xAOD::Egamma*>(part));
199  }
200 
201  ATH_MSG_ERROR("AsgForwardElectronIsEMSelector::could not convert argument to "
202  "Electron/Photon");
203  return m_rootForwardTool->accept();
204 }

◆ accept() [4/5]

asg::AcceptData AsgForwardElectronIsEMSelector::accept ( const EventContext &  ctx,
const xAOD::Photon part 
) const
finaloverrideprivatevirtual

Accept with Photon objects.

Implements IAsgForwardElectronIsEMSelector.

Definition at line 237 of file AsgForwardElectronIsEMSelector.cxx.

239 {
241  "Entering accept( const EventContext& ctx, const Photon* part )");
242  return accept(ctx, static_cast<const xAOD::Egamma*>(ph));
243 }

◆ accept() [5/5]

asg::AcceptData AsgForwardElectronIsEMSelector::accept ( const xAOD::IParticle part) const
finaloverrideprivatevirtual

Accept with generic interface.

Implements IAsgForwardElectronIsEMSelector.

Definition at line 185 of file AsgForwardElectronIsEMSelector.cxx.

186 {
187  return accept(Gaudi::Hive::currentContext(), part);
188 }

◆ calocuts_electrons()

unsigned int AsgForwardElectronIsEMSelector::calocuts_electrons ( const xAOD::Egamma eg,
float  eta2,
float  nvtx,
unsigned int  iflag 
) const
private

Definition at line 318 of file AsgForwardElectronIsEMSelector.cxx.

322 {
323 
324  // apply cut-based selection based on calo information
325  // eg : xAOD::Electron object
326  // trigETthr : threshold in ET to apply the cuts at trigger level
327  // iflag: the starting isEM
328  //
329  const xAOD::CaloCluster* cluster2 = eg->caloCluster();
330  double secondLambda(0);
331  double lateral(0);
332  double longitudinal(0);
333  double fracMax(0);
334  double centerLambda(0);
335  double secondR(0);
336 
337  bool allFound = true;
338 
339  // secondLambda
340  allFound = allFound && cluster2->retrieveMoment(
341  xAOD::CaloCluster::SECOND_LAMBDA, secondLambda);
342  // lateral
343  allFound =
344  allFound && cluster2->retrieveMoment(xAOD::CaloCluster::LATERAL, lateral);
345  // longitudinal
346  allFound = allFound && cluster2->retrieveMoment(
347  xAOD::CaloCluster::LONGITUDINAL, longitudinal);
348  // fracMax
349  allFound = allFound &&
351  // secondR
352  allFound =
353  allFound && cluster2->retrieveMoment(xAOD::CaloCluster::SECOND_R, secondR);
354  // centerlambda
355  allFound = allFound && cluster2->retrieveMoment(
356  xAOD::CaloCluster::CENTER_LAMBDA, centerLambda);
357 
358  if (!allFound) {
359  // if object is bad then use the bit for "bad eta"
360  ATH_MSG_WARNING("Have some variables missing.");
361  iflag = (0x1 << egammaPID::BinEta_ForwardElectron);
362  return iflag;
363  }
364 
366  nvtx,
367  secondLambda,
368  lateral,
369  longitudinal,
370  fracMax,
371  centerLambda,
372  secondR,
373  iflag);
374 }

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

◆ execute()

StatusCode AsgForwardElectronIsEMSelector::execute ( const EventContext &  ctx,
const xAOD::Egamma eg,
unsigned int &  isEM 
) const
finaloverrideprivatevirtual

==========================================================================================//

Implements IAsgForwardElectronIsEMSelector.

Definition at line 263 of file AsgForwardElectronIsEMSelector.cxx.

266 {
267  //
268  // Particle identification for electrons based on cuts
269  //
270  ATH_MSG_DEBUG("entering execute(const Egamma* eg...)");
271  // initialisation
272  isEM = 0;
273  // protection against null pointer
274  if (eg == nullptr) {
275  // if object is bad then use the bit for "bad eta"
276  ATH_MSG_DEBUG("exiting because el is NULL");
277  isEM = (0x1 << egammaPID::BinEta_ForwardElectron);
278  return StatusCode::SUCCESS;
279  }
280 
281  // retrieve associated cluster
282  const xAOD::CaloCluster* cluster = eg->caloCluster();
283  if (cluster == nullptr) {
284  // if object is bad then use the bit for "bad eta"
285  ATH_MSG_DEBUG("exiting because cluster is NULL");
286  isEM = (0x1 << egammaPID::BinEta_ForwardElectron);
287  return StatusCode::SUCCESS;
288  }
289 
290  float nvtx =
291  static_cast<int>(m_usePVCont ? this->getNPrimVertices(ctx) : m_nPVdefault);
292  // This default value is only useful for candidates in EMEC inner wheel
293  // but is useless anyway
294  float eta = std::abs(cluster->etaBE(2));
295 
296  // see if we have an electron, with track, for eta
297  const xAOD::Electron* el = nullptr;
298  if (eg->type() == xAOD::Type::Electron) {
299  el = static_cast<const xAOD::Electron*>(eg);
300  }
301 
302  // el should always be there. So this is always OK
303  // but in Run4, this can be track eta if there is a match.
304  // So for the time being, use cluster eta since fwd isEM (very very old from 2015)
305  // is determined from cluster eta and |eta| > 2.5
306  if (el) {
307  eta = std::max(2.5,std::abs(cluster->eta()));
308  }
309  // Call the calocuts using the egamma object
310  isEM = calocuts_electrons(eg, eta, nvtx, 0);
311 
312  return StatusCode::SUCCESS;
313 }

◆ 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

◆ getAcceptInfo()

const asg::AcceptInfo & AsgForwardElectronIsEMSelector::getAcceptInfo ( ) const
finaloverrideprivatevirtual

Method to get the plain AcceptInfo.

This is needed so that one can already get the AcceptInfo and query what cuts are defined before the first object is passed to the tool.

Implements IAsgSelectionTool.

Definition at line 176 of file AsgForwardElectronIsEMSelector.cxx.

177 {
179 }

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

◆ getNPrimVertices()

unsigned int AsgForwardElectronIsEMSelector::getNPrimVertices ( const EventContext &  ctx) const
private

( This is horrible! We don't want to iterate over all vertices in the event for each electron!!! / This is slow!)

Definition at line 382 of file AsgForwardElectronIsEMSelector.cxx.

383 {
384  unsigned int nVtx(0);
386  if (!vtxCont.isValid()) {
387  return nVtx;
388  }
389  for (const auto *vtxcand : *vtxCont) {
390  if (vtxcand->nTrackParticles() >= 3)
391  nVtx++;
392  }
393  return nVtx;
394 }

◆ getOperatingPointName()

std::string AsgForwardElectronIsEMSelector::getOperatingPointName ( ) const
finaloverrideprivatevirtual

Method to get the operating point.

Get the name of the current operating point.

Implements IAsgForwardElectronIsEMSelector.

Definition at line 249 of file AsgForwardElectronIsEMSelector.cxx.

250 {
251 
253  return "Forw Id";
254  }
255 
256  ATH_MSG_INFO("Didn't recognize the given operating point with mask: "
258  return "";
259 }

◆ getProperty()

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

Get one of the tool's properties.

◆ initialize()

StatusCode AsgForwardElectronIsEMSelector::initialize ( )
finaloverrideprivatevirtual

Gaudi Service Interface method implementations.

----— Read in the TEnv config ---—///

----— Use helpers to read in the cut arrays ---—///

Reimplemented from asg::AsgTool.

Definition at line 99 of file AsgForwardElectronIsEMSelector.cxx.

100 {
101  // The standard status code
102  StatusCode sc = StatusCode::SUCCESS;
103 
104  if (!m_WorkingPoint.empty()) {
107  }
108 
109  if (!m_configFile.empty()) {
110  // find the file and read it in
112  if (filename.empty()) {
113  ATH_MSG_ERROR("Could not locate " << m_configFile);
114  sc = StatusCode::FAILURE;
115  return sc;
116  }
117  ATH_MSG_DEBUG("Configfile to use " << m_configFile);
118  TEnv env;
119  env.ReadFile(filename.c_str(), kEnvLocal);
120 
122 
123  // Override the mask via the config only if it is not set
125  unsigned int mask(
126  env.GetValue("isEMMask", static_cast<int>(egammaPID::EgPidUndefined)));
128  }
129  //
130  ATH_MSG_DEBUG("Read in the TEnv config ");
133  AsgConfigHelper::HelperFloat("CutBinEta_ForwardElectron", env);
135  AsgConfigHelper::HelperFloat("CutVxp_ForwardElectron", env);
137  AsgConfigHelper::HelperFloat("CutSECONDLAMBDA_ForwardElectron", env);
139  AsgConfigHelper::HelperFloat("CutLATERAL_ForwardElectron", env);
141  AsgConfigHelper::HelperFloat("CutLONGITUDINAL_ForwardElectron", env);
143  AsgConfigHelper::HelperFloat("CutCELLMAXFRAC_ForwardElectron", env);
145  AsgConfigHelper::HelperFloat("CutCENTERLAMBDA_ForwardElectron", env);
147  AsgConfigHelper::HelperFloat("CutSECONDR_ForwardElectron", env);
148  } else {
149  ATH_MSG_INFO("Conf file empty. Just user Input");
150  }
151 
153 
154  ATH_MSG_INFO("operating point : " << this->getOperatingPointName()
155  << " with mask: "
157 
158  // Get the message level and set the underlying ROOT tool message level
159  // accordingly
160  m_rootForwardTool->msg().setLevel(this->msg().level());
161  // We need to initialize the underlying ROOT TSelectorTool
162  if (m_rootForwardTool->initialize().isFailure()) {
163  ATH_MSG_ERROR("Could not initialize the TForwardElectronIsEMSelector!");
164  sc = StatusCode::FAILURE;
165  return sc;
166  }
167 
168  return sc;
169 }

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

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

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

std::string AsgForwardElectronIsEMSelector::m_configFile
private

Config File.

Definition at line 107 of file AsgForwardElectronIsEMSelector.h.

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

unsigned int AsgForwardElectronIsEMSelector::m_nPVdefault
private

Definition at line 116 of file AsgForwardElectronIsEMSelector.h.

◆ m_primVtxContKey

SG::ReadHandleKey<xAOD::VertexContainer> AsgForwardElectronIsEMSelector::m_primVtxContKey
private
Initial value:
{
this,
"primaryVertexContainer",
"PrimaryVertices",
"The primary vertex container name"
}

read handle key to primary vertex container

Definition at line 119 of file AsgForwardElectronIsEMSelector.h.

◆ m_rootForwardTool

Root::TForwardElectronIsEMSelector* AsgForwardElectronIsEMSelector::m_rootForwardTool
private

Pointer to the underlying ROOT based tool.

Definition at line 110 of file AsgForwardElectronIsEMSelector.h.

◆ m_usePVCont

bool AsgForwardElectronIsEMSelector::m_usePVCont
private

Whether to use the PV (not available for trigger)

Definition at line 113 of file AsgForwardElectronIsEMSelector.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.

◆ m_WorkingPoint

std::string AsgForwardElectronIsEMSelector::m_WorkingPoint
private

Working Point.

Definition at line 104 of file AsgForwardElectronIsEMSelector.h.


The documentation for this class was generated from the following files:
xAOD::CaloCluster_v1::SECOND_R
@ SECOND_R
Second Moment in .
Definition: CaloCluster_v1.h:123
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
Root::TForwardElectronIsEMSelector::m_cutCELLMAXFRAC_ForwardElectron
std::vector< float > m_cutCELLMAXFRAC_ForwardElectron
cut on maxFrac
Definition: TForwardElectronIsEMSelector.h:100
AsgForwardElectronIsEMSelector::execute
virtual StatusCode execute(const EventContext &ctx, const xAOD::Egamma *eg, unsigned int &isEM) const override final
==========================================================================================//
Definition: AsgForwardElectronIsEMSelector.cxx:263
xAOD::Electron
Electron_v1 Electron
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Electron.h:17
Root::TForwardElectronIsEMSelector::fillAccept
asg::AcceptData fillAccept(unsigned int isEM) const
Definition: TForwardElectronIsEMSelector.cxx:150
AsgForwardElectronIsEMSelector::m_rootForwardTool
Root::TForwardElectronIsEMSelector * m_rootForwardTool
Pointer to the underlying ROOT based tool.
Definition: AsgForwardElectronIsEMSelector.h:110
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
AsgForwardElectronIsEMSelector::m_primVtxContKey
SG::ReadHandleKey< xAOD::VertexContainer > m_primVtxContKey
read handle key to primary vertex container
Definition: AsgForwardElectronIsEMSelector.h:119
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
Root::TForwardElectronIsEMSelector::m_cutSECONDR_ForwardElectron
std::vector< float > m_cutSECONDR_ForwardElectron
cut values for cut on secondR
Definition: TForwardElectronIsEMSelector.h:102
Root::TForwardElectronIsEMSelector::m_cutVxp_ForwardElectron
std::vector< float > m_cutVxp_ForwardElectron
range of NPV bins for e-ID
Definition: TForwardElectronIsEMSelector.h:92
ParticleTest.eg
eg
Definition: ParticleTest.py:29
egammaPID::BinEta_ForwardElectron
@ BinEta_ForwardElectron
cluster eta range
Definition: egammaPIDdefs.h:618
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
AthCommonDataStore::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
max
constexpr double max()
Definition: ap_fixedTest.cxx:33
AsgForwardElectronIsEMSelector::m_configFile
std::string m_configFile
Config File.
Definition: AsgForwardElectronIsEMSelector.h:107
AsgForwardElectronIsEMSelector::m_WorkingPoint
std::string m_WorkingPoint
Working Point.
Definition: AsgForwardElectronIsEMSelector.h:104
Root::TForwardElectronIsEMSelector::m_cutCENTERLAMBDA_ForwardElectron
std::vector< float > m_cutCENTERLAMBDA_ForwardElectron
cut on centerlambda
Definition: TForwardElectronIsEMSelector.h:104
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
xAOD::CaloCluster_v1::CENTER_LAMBDA
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
Definition: CaloCluster_v1.h:136
xAOD::Egamma_v1
Definition: Egamma_v1.h:56
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
Root::TForwardElectronIsEMSelector::calocuts_electrons
unsigned int calocuts_electrons(float eta, float nvtx, float secondLambda, float lateral, float longitudinal, float fracMax, float centerLambda, float secondR, unsigned int iflag) const
Definition: TForwardElectronIsEMSelector.cxx:163
dbg::ptr
void * ptr(T *p)
Definition: SGImplSvc.cxx:74
xAOD::CaloCluster_v1::ENG_FRAC_MAX
@ ENG_FRAC_MAX
Energy fraction of hottest cell.
Definition: CaloCluster_v1.h:140
Root::TForwardElectronIsEMSelector::getAcceptInfo
const asg::AcceptInfo & getAcceptInfo() const
accesss to the accept info object
Definition: TForwardElectronIsEMSelector.h:107
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
egammaPID::EgPidUndefined
const unsigned int EgPidUndefined
Definition: egammaPIDdefs.h:90
xAOD::CaloCluster_v1::SECOND_LAMBDA
@ SECOND_LAMBDA
Second Moment in .
Definition: CaloCluster_v1.h:124
IDTPMcnv.htype
htype
Definition: IDTPMcnv.py:29
xAOD::CaloCluster_v1::etaBE
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
Definition: CaloCluster_v1.cxx:644
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
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
AthCommonDataStore
Definition: AthCommonDataStore.h:52
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
xAOD::CaloCluster_v1::eta
virtual double eta() const
The pseudorapidity ( ) of the particle.
Definition: CaloCluster_v1.cxx:251
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
Root::TForwardElectronIsEMSelector::accept
asg::AcceptData accept() const
Return dummy accept with only info.
Definition: TForwardElectronIsEMSelector.h:51
asg::AsgMessaging::msg
MsgStream & msg() const
The standard message stream.
Definition: AsgMessaging.cxx:49
plotIsoValidation.el
el
Definition: plotIsoValidation.py:197
Root::TForwardElectronIsEMSelector::m_cutSECONDLAMBDA_ForwardElectron
std::vector< float > m_cutSECONDLAMBDA_ForwardElectron
cut on secondlambda
Definition: TForwardElectronIsEMSelector.h:94
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
xAOD::CaloCluster_v1::retrieveMoment
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
Definition: CaloCluster_v1.cxx:738
Root::TForwardElectronIsEMSelector::m_cutBinEta_ForwardElectron
std::vector< float > m_cutBinEta_ForwardElectron
range of eta bins for e-ID
Definition: TForwardElectronIsEMSelector.h:90
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
AsgForwardElectronIsEMSelector::getNPrimVertices
unsigned int getNPrimVertices(const EventContext &ctx) const
( This is horrible! We don't want to iterate over all vertices in the event for each electron!...
Definition: AsgForwardElectronIsEMSelector.cxx:382
Root::TForwardElectronIsEMSelector::initialize
StatusCode initialize()
Initialize this class.
Definition: TForwardElectronIsEMSelector.cxx:83
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
Root::TForwardElectronIsEMSelector::m_isEMMask
unsigned int m_isEMMask
which subset of cuts to apply
Definition: TForwardElectronIsEMSelector.h:87
Root::TForwardElectronIsEMSelector::m_cutLATERAL_ForwardElectron
std::vector< float > m_cutLATERAL_ForwardElectron
cut on lateral
Definition: TForwardElectronIsEMSelector.h:96
AsgForwardElectronIsEMSelector::getOperatingPointName
virtual std::string getOperatingPointName() const override final
Method to get the operating point.
Definition: AsgForwardElectronIsEMSelector.cxx:249
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
AsgForwardElectronIsEMSelector::m_usePVCont
bool m_usePVCont
Whether to use the PV (not available for trigger)
Definition: AsgForwardElectronIsEMSelector.h:113
xAOD::Electron_v1
Definition: Electron_v1.h:34
xAOD::Photon
Photon_v1 Photon
Definition of the current "egamma version".
Definition: Event/xAOD/xAODEgamma/xAODEgamma/Photon.h:17
PathResolverFindCalibFile
std::string PathResolverFindCalibFile(const std::string &logical_file_name)
Definition: PathResolver.cxx:431
AsgForwardElectronIsEMSelector::m_nPVdefault
unsigned int m_nPVdefault
Definition: AsgForwardElectronIsEMSelector.h:116
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
egammaPID::ID_ForwardElectron
const unsigned int ID_ForwardElectron
cuts on all variables
Definition: egammaPIDdefs.h:638
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
CaloCellTimeCorrFiller.filename
filename
Definition: CaloCellTimeCorrFiller.py:24
SG::VarHandleBase::vhKey
SG::VarHandleKey & vhKey()
Return a non-const reference to the HandleKey.
Definition: StoreGate/src/VarHandleBase.cxx:623
xAOD::CaloCluster_v1::LATERAL
@ LATERAL
Normalized lateral moment.
Definition: CaloCluster_v1.h:137
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:798
AsgConfigHelper::HelperFloat
std::vector< float > HelperFloat(const std::string &input, TEnv &env)
Definition: AsgEGammaConfigHelper.cxx:110
python.DataFormatRates.env
env
Definition: DataFormatRates.py:32
xAOD::CaloCluster_v1::LONGITUDINAL
@ LONGITUDINAL
Normalized longitudinal moment.
Definition: CaloCluster_v1.h:138
SG::DataProxy
Definition: DataProxy.h:45
Root::TForwardElectronIsEMSelector::m_cutLONGITUDINAL_ForwardElectron
std::vector< float > m_cutLONGITUDINAL_ForwardElectron
cut on longitudinal
Definition: TForwardElectronIsEMSelector.h:98
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
fitman.k
k
Definition: fitman.py:528
AsgForwardElectronIsEMSelector::calocuts_electrons
unsigned int calocuts_electrons(const xAOD::Egamma *eg, float eta2, float nvtx, unsigned int iflag) const
Definition: AsgForwardElectronIsEMSelector.cxx:318
AsgForwardElectronIsEMSelector::accept
virtual asg::AcceptData accept(const xAOD::IParticle *part) const override final
Accept with generic interface.
Definition: AsgForwardElectronIsEMSelector.cxx:185
EgammaSelectors::ForwardElectronCutPointToConfFile
const std::map< std::string, std::string > ForwardElectronCutPointToConfFile
Definition: EGSelectorConfigurationMapping.h:97
AsgConfigHelper::findConfigFile
std::string findConfigFile(const std::string &input, const std::map< std::string, std::string > &configmap)
Definition: AsgEGammaConfigHelper.cxx:14