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

Selec electrons and store a vector of cluster free of the electron ones. More...

#include <JetInputElRemovalTool.h>

Inheritance diagram for JetInputElRemovalTool:
Collaboration diagram for JetInputElRemovalTool:

Public Member Functions

 JetInputElRemovalTool (const std::string &t)
 
 ~JetInputElRemovalTool ()
 
StatusCode initialize ()
 Dummy implementation of the initialisation function. More...
 
int execute () const
 Method to be called for each event. More...
 
StatusCode finalize ()
 
int fillSelectedClusters (std::vector< const xAOD::Electron * > &selected_el, ConstDataVector< xAOD::CaloClusterContainer > &selected_cl) const
 : Select TopoClusters away of the electrons may select : More...
 
int fillSelectedClustersInJets (std::vector< const xAOD::Electron * > &selected_el, ConstDataVector< xAOD::CaloClusterContainer > &selected_cl) const
 
int fillSelectedTracks (std::vector< const xAOD::Electron * > &selected_el, ConstDataVector< xAOD::TrackParticleContainer > &selected_trk) 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 int inputContainerNames (std::vector< std::string > &connames)
 Method to return the list of input containers. More...
 
virtual int outputContainerNames (std::vector< std::string > &connames)
 Method to return the list of output containers. 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

using ClOutHandleKey = SG::WriteHandleKey< ConstDataVector< xAOD::CaloClusterContainer > >
 
using TrkOutHandleKey = SG::WriteHandleKey< ConstDataVector< xAOD::TrackParticleContainer > >
 
typedef ServiceHandle< StoreGateSvcStoreGateSvc_t
 

Private Member Functions

std::vector< const xAOD::Electron * > selectElectron () const
 Select the electron of the event My select : More...
 
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_elIDname = "DFCommonElectronsLHTight"
 
float m_elPt = 25000
 
bool m_useOnlyclInJets =false
 
float m_clRemovRadius =0.15
 
float m_clEMFrac = 0.8
 
SG::ReadHandleKey< xAOD::TrackParticleContainerm_trkInputContainer_key
 
SG::ReadHandleKey< xAOD::JetContainerm_jetInputContainer_key
 
SG::ReadHandleKey< xAOD::CaloClusterContainerm_clInputContainer_key
 
SG::ReadHandleKey< xAOD::EgammaContainerm_elInputContainer_key
 
ClOutHandleKey m_clOutputContainer_key
 
TrkOutHandleKey m_trkOutputContainer_key
 
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

Selec electrons and store a vector of cluster free of the electron ones.

Definition at line 41 of file JetInputElRemovalTool.h.

Member Typedef Documentation

◆ ClOutHandleKey

Definition at line 106 of file JetInputElRemovalTool.h.

◆ StoreGateSvc_t

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

Definition at line 388 of file AthCommonDataStore.h.

◆ TrkOutHandleKey

Definition at line 111 of file JetInputElRemovalTool.h.

Constructor & Destructor Documentation

◆ JetInputElRemovalTool()

JetInputElRemovalTool::JetInputElRemovalTool ( const std::string &  t)

Definition at line 20 of file JetInputElRemovalTool.cxx.

21  :AsgTool(t)
22 
23  ,m_elIDname("DFCommonElectronsLHTight")
24  ,m_elPt(25000)
25  ,m_useOnlyclInJets(false)
26  ,m_clRemovRadius(0.15)
27  ,m_clEMFrac(0.8)
28 {
29  declareProperty("ElectronQuality",m_elIDname);
30  declareProperty("ElectronMinpT",m_elPt);
31  declareProperty("ClusterRemovRadius",m_clRemovRadius);
32  declareProperty("ClusterEMFrac",m_clEMFrac);
33  declareProperty("UseOnlyclInJets",m_useOnlyclInJets);
34 
35  declareProperty("TrkInputContainer",
36  m_trkInputContainer_key="InDetTrackParticles");
37 
38  declareProperty("JetINputContainer",
39  m_jetInputContainer_key="AntiKt4EMTopoJets");
40 
41 
42  declareProperty("ClusterContainerName",
43  m_clInputContainer_key="CaloCalTopoClusters");
44 
45  declareProperty("ElectronContainerName",
46  m_elInputContainer_key="Electrons");
47 
48  declareProperty("ClusterNoElName",
49  m_clOutputContainer_key="CaloCalTopoClustersNoEl");
50 
51  declareProperty("TrkOutputContainer",
52  m_trkOutputContainer_key="InDetTrackParticlesNoEl");
53 
54 
55 }

◆ ~JetInputElRemovalTool()

JetInputElRemovalTool::~JetInputElRemovalTool ( )
default

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  }

◆ 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()

int JetInputElRemovalTool::execute ( ) const
virtual

Method to be called for each event.

Returns 0 for success.

Implements IJetExecuteTool.

Definition at line 75 of file JetInputElRemovalTool.cxx.

75  {
76 
77  using OutContTypeCl = ConstDataVector<xAOD::CaloClusterContainer>;
78  OutContTypeCl* filtered_clusters = new OutContTypeCl(SG::VIEW_ELEMENTS);
79 
80  //Select the electrons with given properties
81  std::vector<const xAOD::Electron*> el_vector=selectElectron();
82 
83  //Select the clusters away from electrons
84 
85  //Use all the clusters in the event
86  if(!m_useOnlyclInJets){
87  fillSelectedClusters(el_vector,*filtered_clusters);
88  }
89  //Use only the cluster from jets in the event
90  else{
91  fillSelectedClustersInJets(el_vector,*filtered_clusters);
92  }
93 
94  //Record clusters vector
95  {
97  if(!handle.record(std::unique_ptr<OutContTypeCl>(filtered_clusters))){
98  ATH_MSG_WARNING("Unable to record new clusters vector");
99  return 1;
100  }
101  }
102 
103  //Store vector only if data vector name not empty
104  if (!m_trkInputContainer_key.key().empty()){
105 
106  using OutContTypeTr = ConstDataVector<xAOD::TrackParticleContainer>;
107 
108  OutContTypeTr* filtered_tracks = new OutContTypeTr(SG::VIEW_ELEMENTS) ;
109 
110  fillSelectedTracks(el_vector,*filtered_tracks);
111 
112  auto handle_out = SG::makeHandle(m_trkOutputContainer_key);
113  if(!handle_out.record(std::unique_ptr<OutContTypeTr>(filtered_tracks))){
114  ATH_MSG_WARNING("Unable to record new tracks vector");
115  return 1;
116  }
117  }
118 
119  return 0;
120 }

◆ 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

◆ fillSelectedClusters()

int JetInputElRemovalTool::fillSelectedClusters ( std::vector< const xAOD::Electron * > &  selected_el,
ConstDataVector< xAOD::CaloClusterContainer > &  selected_cl 
) const

: Select TopoClusters away of the electrons may select :

  • Match radius
  • Min EM frac of cluster to be removed

Create vector of cluster

Returns
The number of removed clusters

Definition at line 172 of file JetInputElRemovalTool.cxx.

172  {
173 
174  //Initialize variables
175 
176  int countRemoved_clusters=0;
177  double propEM=0;
178 
179  //Get the Topo clusters of the event
180 
181  auto handle = SG::makeHandle(m_clInputContainer_key);
182  if(!handle.isValid()){
183  ATH_MSG_WARNING("Unable to retrieve clusters");
184  return 0;
185  }
186 
187  const auto *clusterContainer = handle.cptr();
188 
189  //Loop over all the clusters
190  for (const xAOD::CaloCluster* cluster_itr : *clusterContainer){
191 
192  //Compute the EMP proportion of the cluster
193  propEM=0;
194 
195  double EMB_Enegy=cluster_itr->eSample(CaloSampling::CaloSample::PreSamplerB)+cluster_itr->eSample(CaloSampling::CaloSample::EMB1)+cluster_itr->eSample(CaloSampling::CaloSample::EMB2)+cluster_itr->eSample(CaloSampling::CaloSample::EMB3);
196 
197  double EMEC_Energy=cluster_itr->eSample(CaloSampling::CaloSample::PreSamplerE)+cluster_itr->eSample(CaloSampling::CaloSample::EME1)+cluster_itr->eSample(CaloSampling::CaloSample::EME2)+cluster_itr->eSample(CaloSampling::CaloSample::EME3);
198 
199  //Remove clusters w/o energy
200  if (cluster_itr->rawE()==0) {
201  continue;
202  }
203  propEM=(EMB_Enegy+EMEC_Energy)/cluster_itr->rawE();
204 
205 
206 
207  //Check if close to electron
208  bool closetoel=false;
209 
212  //For each el in the vector
213  for ( ; it != itE ;++it){
214  ATH_MSG_DEBUG( "Deleta R electron cluster = "<<(*it)->p4().DeltaR(cluster_itr->p4()) );
215  //Check if electron close to cluster
216  //if ((*it)->p4().DeltaR(cluster_itr->p4())<m_clRemovRadius){
217  if ((*it)->caloCluster()->p4().DeltaR(cluster_itr->p4())<m_clRemovRadius){
218 
219  //if (TMath::Abs((*it)->caloCluster()->etaBE(2))<1.52 && TMath::Abs((*it)->caloCluster()->etaBE(2))>1.37){
220  if (TMath::Abs(cluster_itr->eta())<1.52 && TMath::Abs(cluster_itr->eta())>1.37){
221  closetoel=true;
222  }
223 
224  //Check if the proportion of EM enegy above threshold
225  else if(propEM>=m_clEMFrac){
226  closetoel=true;
227  }
228  }
229 
230  }
231  //If not close enough or not enough EM energy the cluster is kept
232  if (!closetoel){
233  selected_cl.push_back(dynamic_cast<const xAOD::CaloCluster*> (cluster_itr));
234  }
235  else{ //else it is removed
236  countRemoved_clusters+=1;
237  }
238  }//End loop over clusters
239 
240 
241  //ANA_CHECK(evtStore()->record( filtered_clusters , "CaloCalTopoClustersNoElec" ));
242 
243  return countRemoved_clusters;
244 }//End of SelectClusters()

◆ fillSelectedClustersInJets()

int JetInputElRemovalTool::fillSelectedClustersInJets ( std::vector< const xAOD::Electron * > &  selected_el,
ConstDataVector< xAOD::CaloClusterContainer > &  selected_cl 
) const

Definition at line 254 of file JetInputElRemovalTool.cxx.

254  {
255 
256  int countRemoved_clusters=0;
257  double propEM=0;
258 
260  if(!handle.isValid()){
261  ATH_MSG_WARNING("Unable to retrieve jets");
262  return 0;
263  }
264 
265  const auto *jetsContainer = handle.cptr();
266 
267  // const xAOD::JetContainer* jetsContainer;
268  // StatusCode sc=evtStore()->retrieve( jetsContainer, m_jetINputContainer );
269  // if (sc.isFailure()){
270  // ATH_MSG_WARNING("Unable to retrieve jets");
271  // return 0;
272  // }
273 
274  for (const xAOD::Jet* jet_itr : *jetsContainer){
275 
276 
277  const xAOD::JetConstituentVector jetcons = jet_itr->getConstituents();
278 
279 
280  if (!jetcons.isValid()) continue ;
281 
282  xAOD::JetConstituentVector::iterator jetcons_it = jetcons.begin();
283  xAOD::JetConstituentVector::iterator jetcons_itE = jetcons.end();
284 
285  for( ; jetcons_it != jetcons_itE; ++jetcons_it){
286 
287  propEM=0;
288  const xAOD::CaloCluster* cluster_itr= dynamic_cast<const xAOD::CaloCluster*> (jetcons_it->rawConstituent());
289 
290 
292 
294 
295 
296  //Remove Clusters w/o energy
297  if (cluster_itr->rawE()==0) {
298  continue;
299  };
300 
301  propEM=(EMB_Enegy+EMEC_Energy)/cluster_itr->rawE();
302 
303  bool closetoel=false;
306 
307  for ( ; it != itE ;++it){
308  ATH_MSG_DEBUG( "Deleta R electron cluster = "<<(*it)->p4().DeltaR(cluster_itr->p4()) );
309  if ((*it)->p4().DeltaR(cluster_itr->p4())<m_clRemovRadius){
310  if(propEM>=m_clEMFrac){
311  closetoel=true;
312  }
313  }
314 
315  }
316  if (!closetoel){
317  selected_cl.push_back(dynamic_cast<const xAOD::CaloCluster*> (cluster_itr));
318  }
319  else{
320  countRemoved_clusters+=1;
321  }
322  }//End loop over clusters
323 
324  }//End loop over jets
325 
326  //ANA_CHECK(evtStore()->record( filtered_clusters , "CaloCalTopoClustersNoElec" ));
327 
328  return countRemoved_clusters;
329 }

◆ fillSelectedTracks()

int JetInputElRemovalTool::fillSelectedTracks ( std::vector< const xAOD::Electron * > &  selected_el,
ConstDataVector< xAOD::TrackParticleContainer > &  selected_trk 
) const

Definition at line 332 of file JetInputElRemovalTool.cxx.

332  {
333 
334  int countRemoved_trk=0;
335 
337  if(!handle.isValid()){
338  ATH_MSG_WARNING("Unable to retrieve jets");
339  return 0;
340  }
341 
342  const auto *tkPrtclContainer = handle.cptr();
343 
344  // PS
345  // const xAOD::TrackParticleContainer* tkPrtclContainer;
346  // StatusCode sc=evtStore()->retrieve( tkPrtclContainer, m_trkInputContainer );
347  // if (sc.isFailure()){
348  // ATH_MSG_WARNING("Unable to retrieve jets");
349  // return 0;
350  // }
351 
352  //Loop over all the tracks
353  for (const xAOD::TrackParticle* trk_itr : *tkPrtclContainer){
354 
355  //Check if close to electron
356  bool is_eltrk=false;
357 
360  //For each el in the vector
361  for ( ; it != itE ;++it){
362 
363  const xAOD::TrackParticle* el_trk=(*it)->trackParticle();
364 
365  ATH_MSG_DEBUG( "Deleta R electron trkack = "<<(*it)->p4().DeltaR(trk_itr->p4()) );
366  //Check if electron close to cluster
367  if (el_trk==trk_itr){
368  is_eltrk=true;
369  }
370 
371  }
372  //If not close enough or not enough EM energy the cluster is kept
373  if (!is_eltrk){
374  selected_cl.push_back(dynamic_cast<const xAOD::TrackParticle*> (trk_itr));
375  }
376  else{ //else it is removed
377  countRemoved_trk+=1;
378  }
379  }//End loop over tracks
380 
381 
382  return countRemoved_trk;
383 }

◆ finalize()

StatusCode JetInputElRemovalTool::finalize ( )

Definition at line 122 of file JetInputElRemovalTool.cxx.

122  {
123  return StatusCode::SUCCESS;
124 }

◆ 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 JetInputElRemovalTool::initialize ( )
virtual

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 60 of file JetInputElRemovalTool.cxx.

60  {
61  ATH_MSG_INFO("Initializing tool " << name() << "...");
62  ATH_MSG_DEBUG("initializing version with data handles");
63 
65  ATH_CHECK(m_jetInputContainer_key.initialize());
67  ATH_CHECK(m_elInputContainer_key.initialize());
70 
71  return StatusCode::SUCCESS;
72 }

◆ inputContainerNames()

int IJetExecuteTool::inputContainerNames ( std::vector< std::string > &  connames)
virtualinherited

Method to return the list of input containers.

The names of required input containers are appended to connames. Returns nonzero for error. Default returns 0 and adds no names.

Reimplemented in JetRecTool.

Definition at line 11 of file IJetExecuteTool.cxx.

11  {
12  return 0;
13 }

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

◆ outputContainerNames()

int IJetExecuteTool::outputContainerNames ( std::vector< std::string > &  connames)
virtualinherited

Method to return the list of output containers.

The names of produced output containers are appended to connames. Returns nonzero for error. Default returns 0 and adds no names.

Reimplemented in JetRecTool.

Definition at line 17 of file IJetExecuteTool.cxx.

17  {
18  return 0;
19 }

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

◆ selectElectron()

std::vector< const xAOD::Electron * > JetInputElRemovalTool::selectElectron ( ) const
private

Select the electron of the event My select :

  • pt cut
  • electron quality
Returns
Load an electron Vector in SG

Definition at line 128 of file JetInputElRemovalTool.cxx.

128  {
129 
130  std::vector<const xAOD::Electron*> selected_electrons_v;
131 
132  auto handle = SG::makeHandle(m_elInputContainer_key);
133  if(!handle.isValid()){
134  ATH_MSG_WARNING("Unable to retrieve electrons");
135  return selected_electrons_v;
136  }
137 
138  const auto *electrons = handle.cptr();
139 
140  selected_electrons_v.clear();
141  bool isTight=false;
142 
143  SG::Decorator< char > idflagDec( m_elIDname );
144  for (const auto *electron_itr : *electrons){
145 
146  isTight=false;
147 
148  //Select only el with given quality
149  if (idflagDec (*electron_itr)==1){
150  isTight=true;
151  }
152 
153  if (! isTight) continue ;
154 
155 
156  //Select only el with pt>25GeV
157  if (electron_itr->pt()<m_elPt) continue;
158 
159  selected_electrons_v.push_back(dynamic_cast<const xAOD::Electron*>(electron_itr));
160 
161 
162  }
163 
164  return selected_electrons_v ;
165 }

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

float JetInputElRemovalTool::m_clEMFrac = 0.8
private

Definition at line 99 of file JetInputElRemovalTool.h.

◆ m_clInputContainer_key

SG::ReadHandleKey<xAOD::CaloClusterContainer> JetInputElRemovalTool::m_clInputContainer_key
private

Definition at line 103 of file JetInputElRemovalTool.h.

◆ m_clOutputContainer_key

ClOutHandleKey JetInputElRemovalTool::m_clOutputContainer_key
private

Definition at line 109 of file JetInputElRemovalTool.h.

◆ m_clRemovRadius

float JetInputElRemovalTool::m_clRemovRadius =0.15
private

Definition at line 98 of file JetInputElRemovalTool.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_elIDname

std::string JetInputElRemovalTool::m_elIDname = "DFCommonElectronsLHTight"
private

Definition at line 94 of file JetInputElRemovalTool.h.

◆ m_elInputContainer_key

SG::ReadHandleKey<xAOD::EgammaContainer> JetInputElRemovalTool::m_elInputContainer_key
private

Definition at line 104 of file JetInputElRemovalTool.h.

◆ m_elPt

float JetInputElRemovalTool::m_elPt = 25000
private

Definition at line 95 of file JetInputElRemovalTool.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_jetInputContainer_key

SG::ReadHandleKey<xAOD::JetContainer> JetInputElRemovalTool::m_jetInputContainer_key
private

Definition at line 102 of file JetInputElRemovalTool.h.

◆ m_trkInputContainer_key

SG::ReadHandleKey<xAOD::TrackParticleContainer> JetInputElRemovalTool::m_trkInputContainer_key
private

Definition at line 101 of file JetInputElRemovalTool.h.

◆ m_trkOutputContainer_key

TrkOutHandleKey JetInputElRemovalTool::m_trkOutputContainer_key
private

Definition at line 114 of file JetInputElRemovalTool.h.

◆ m_useOnlyclInJets

bool JetInputElRemovalTool::m_useOnlyclInJets =false
private

Definition at line 96 of file JetInputElRemovalTool.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:
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
xAOD::CaloCluster_v1::rawE
flt_t rawE() const
constants.EMB1
int EMB1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:53
StateLessPT_NewConfig.proxy
proxy
Definition: StateLessPT_NewConfig.py:392
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
SG::VIEW_ELEMENTS
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Definition: OwnershipPolicy.h:18
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
JetInputElRemovalTool::m_clEMFrac
float m_clEMFrac
Definition: JetInputElRemovalTool.h:99
xAOD::JetConstituentVector::end
iterator end() const
iterator after the last constituent
Definition: JetConstituentVector.cxx:104
skel.it
it
Definition: skel.GENtoEVGEN.py:423
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::JetConstituentVector::isValid
bool isValid() const
Check if element links are valid.
Definition: JetConstituentVector.cxx:92
JetInputElRemovalTool::m_elIDname
std::string m_elIDname
Definition: JetInputElRemovalTool.h:94
JetInputElRemovalTool::fillSelectedClustersInJets
int fillSelectedClustersInJets(std::vector< const xAOD::Electron * > &selected_el, ConstDataVector< xAOD::CaloClusterContainer > &selected_cl) const
Definition: JetInputElRemovalTool.cxx:254
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
SG::VarHandleKey::key
const std::string & key() const
Return the StoreGate ID for the referenced object.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:141
TruthTest.itE
itE
Definition: TruthTest.py:25
python.iconfTool.models.loaders.level
level
Definition: loaders.py:20
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:269
JetInputElRemovalTool::m_trkOutputContainer_key
TrkOutHandleKey m_trkOutputContainer_key
Definition: JetInputElRemovalTool.h:114
JetInputElRemovalTool::m_trkInputContainer_key
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trkInputContainer_key
Definition: JetInputElRemovalTool.h:101
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::JetConstituentVector::begin
iterator begin() const
iterator on the first constituent
Definition: JetConstituentVector.cxx:103
JetInputElRemovalTool::selectElectron
std::vector< const xAOD::Electron * > selectElectron() const
Select the electron of the event My select :
Definition: JetInputElRemovalTool.cxx:128
asg::AsgTool::AsgTool
AsgTool(const std::string &name)
Constructor specifying the tool instance's name.
Definition: AsgTool.cxx:58
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
constants.EMB2
int EMB2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:54
SG::Decorator< char >
JetInputElRemovalTool::m_clInputContainer_key
SG::ReadHandleKey< xAOD::CaloClusterContainer > m_clInputContainer_key
Definition: JetInputElRemovalTool.h:103
JetInputElRemovalTool::fillSelectedTracks
int fillSelectedTracks(std::vector< const xAOD::Electron * > &selected_el, ConstDataVector< xAOD::TrackParticleContainer > &selected_trk) const
Definition: JetInputElRemovalTool.cxx:332
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
JetInputElRemovalTool::m_clRemovRadius
float m_clRemovRadius
Definition: JetInputElRemovalTool.h:98
JetInputElRemovalTool::fillSelectedClusters
int fillSelectedClusters(std::vector< const xAOD::Electron * > &selected_el, ConstDataVector< xAOD::CaloClusterContainer > &selected_cl) const
: Select TopoClusters away of the electrons may select :
Definition: JetInputElRemovalTool.cxx:172
JetInputElRemovalTool::m_clOutputContainer_key
ClOutHandleKey m_clOutputContainer_key
Definition: JetInputElRemovalTool.h:109
constants.EME1
int EME1
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:55
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
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
xAOD::JetConstituent::rawConstituent
const IParticle * rawConstituent() const
Access the real underlying IParticle.
Definition: JetConstituentVector.h:102
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
SG::VarHandleKeyArray::renounce
virtual void renounce()=0
xAOD::CaloCluster_v1::p4
virtual FourMom_t p4() const
The full 4-momentum of the particle.
Definition: CaloCluster_v1.cxx:465
SG::HandleClassifier::type
std::conditional< std::is_base_of< SG::VarHandleKeyArray, T >::value, VarHandleKeyArrayType, type2 >::type type
Definition: HandleClassifier.h:54
JetInputElRemovalTool::m_useOnlyclInJets
bool m_useOnlyclInJets
Definition: JetInputElRemovalTool.h:96
JetInputElRemovalTool::m_jetInputContainer_key
SG::ReadHandleKey< xAOD::JetContainer > m_jetInputContainer_key
Definition: JetInputElRemovalTool.h:102
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
CaloCell_ID_FCS::EME3
@ EME3
Definition: FastCaloSim_CaloCell_ID.h:26
ConstDataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
JetInputElRemovalTool::m_elInputContainer_key
SG::ReadHandleKey< xAOD::EgammaContainer > m_elInputContainer_key
Definition: JetInputElRemovalTool.h:104
xAOD::Electron_v1
Definition: Electron_v1.h:34
plotIsoValidation.el_trk
el_trk
Definition: plotIsoValidation.py:166
xAOD::Jet_v1
Class describing a jet.
Definition: Jet_v1.h:57
JetInputElRemovalTool::m_elPt
float m_elPt
Definition: JetInputElRemovalTool.h:95
xAOD::CaloCluster_v1::eSample
float eSample(const CaloSample sampling) const
Definition: CaloCluster_v1.cxx:521
a
TList * a
Definition: liststreamerinfos.cxx:10
h
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
CaloCell_ID_FCS::PreSamplerE
@ PreSamplerE
Definition: FastCaloSim_CaloCell_ID.h:23
ConstDataVector
DataVector adapter that acts like it holds const pointers.
Definition: ConstDataVector.h:76
CaloCell_ID_FCS::PreSamplerB
@ PreSamplerB
Definition: FastCaloSim_CaloCell_ID.h:19
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:616
declareProperty
#define declareProperty(n, p, h)
Definition: BaseFakeBkgTool.cxx:15
xAOD::JetConstituentVector
A vector of jet constituents at the scale used during jet finding.
Definition: JetConstituentVector.h:117
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
xAOD::JetConstituentVector::iterator
Definition: JetConstituentVector.h:121
xAOD::TrackParticle_v1
Class describing a TrackParticle.
Definition: TrackParticle_v1.h:43
SG::DataProxy
Definition: DataProxy.h:44
CaloCell_ID_FCS::EMB3
@ EMB3
Definition: FastCaloSim_CaloCell_ID.h:22
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
InDetDD::electrons
@ electrons
Definition: InDetDD_Defs.h:17
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
fitman.k
k
Definition: fitman.py:528