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

#include <TrkPriVxPurityTool.h>

Inheritance diagram for Trk::TrkPriVxPurityTool:
Collaboration diagram for Trk::TrkPriVxPurityTool:

Public Member Functions

StatusCode initialize ()
 AlgTool method. More...
 
StatusCode finalize ()
 AlgTool method. More...
 
 TrkPriVxPurityTool (const std::string &t, const std::string &n, const IInterface *p)
 AlgTool constructor. More...
 
virtual ~TrkPriVxPurityTool ()
 AlgTool destructor. More...
 
const TrkPriVxPuritypurity (const Trk::VxCandidate *vertex) const
 Actual analysis method, returning a Trk::TrkPriVxPurity object for a given TrkVxCandidate. More...
 
ServiceHandle< StoreGateSvc > & evtStore ()
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & evtStore () const
 The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc. More...
 
const ServiceHandle< StoreGateSvc > & detStore () const
 The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc. More...
 
virtual StatusCode sysInitialize () override
 Perform system initialization for an algorithm. More...
 
virtual StatusCode sysStart () override
 Handle START transition. More...
 
virtual std::vector< Gaudi::DataHandle * > inputHandles () const override
 Return this algorithm's input handles. More...
 
virtual std::vector< Gaudi::DataHandle * > outputHandles () const override
 Return this algorithm's output handles. More...
 
Gaudi::Details::PropertyBase & declareProperty (Gaudi::Property< T > &t)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKey &hndl, const std::string &doc, const SG::VarHandleKeyType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleBase &hndl, const std::string &doc, const SG::VarHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, SG::VarHandleKeyArray &hndArr, const std::string &doc, const SG::VarHandleKeyArrayType &)
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc, const SG::NotHandleType &)
 Declare a new Gaudi property. More...
 
Gaudi::Details::PropertyBase * declareProperty (const std::string &name, T &property, const std::string &doc="none")
 Declare a new Gaudi property. More...
 
void updateVHKA (Gaudi::Details::PropertyBase &)
 
MsgStream & msg () const
 
MsgStream & msg (const MSG::Level lvl) const
 
bool msgLvl (const MSG::Level lvl) const
 

Static Public Member Functions

static const InterfaceID & interfaceID ()
 AlgTool interface method. 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

double m_r_tol
 Primary vertex definition for MC: tolerances taken in r (mm) around the simulated point of proton-proton interaction. More...
 
double m_z_tol
 Primary vertex definition for MC: tolerances taken in z (mm) around the simulated point of proton-proton interaction. More...
 
std::string m_trackParticleTruthCollName
 Name of the track true <-> rec map to be read from the storegate. More...
 
std::string m_mc_collection_name
 Name of the MC event collection to read. 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

A tool estimating the purity of the reconstructed primary vertex. The Generator level tracks, corresponding to those fitted to the primary vertex candidate are examined. The fraction of outliers fitted to the vertex and tracks originating from the pileup is determined.

Author
Kirill Prokofiev, September 2006

Definition at line 30 of file TrkPriVxPurityTool.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

◆ TrkPriVxPurityTool()

Trk::TrkPriVxPurityTool::TrkPriVxPurityTool ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

AlgTool constructor.

Definition at line 39 of file TrkPriVxPurityTool.cxx.

39  : AthAlgTool ( t,n,p ) {
40 //tolerances around the signal pp interaction to create a primary vertex candidate:
41 //defaul values are: sigma z = 1um (0.001 mm), sigma r = 1um (0.001 mm)
42  declareProperty ( "VertexRTolerance", m_r_tol = 0.001 );
43 
44  declareProperty ( "VertexZTolerance", m_z_tol = 0.001 );
45 
46 //name of the rec <-> sim truth map to be read from the storegate
47 //default one is the output of the InDetTrackTruthMaker (see InDetTruthAlgs in InnerDetector packasge)
48  declareProperty ( "SimTrackMapName", m_trackParticleTruthCollName = "TrackParticleTruthCollection" );
49 
50 //name of the Mc event collection. Required to get the signal event.
51  declareProperty ( "MonteCarloCollection", m_mc_collection_name = "TruthEvent" );
52 
53 // declaring the interface fo the tool itself
54  declareInterface<TrkPriVxPurityTool> ( this );
55 
56  }//end of constructor

◆ ~TrkPriVxPurityTool()

Trk::TrkPriVxPurityTool::~TrkPriVxPurityTool ( )
virtualdefault

AlgTool destructor.

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

◆ extraDeps_update_handler()

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

Add StoreName to extra input/output deps as needed.

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

◆ finalize()

StatusCode Trk::TrkPriVxPurityTool::finalize ( )

AlgTool method.

Definition at line 34 of file TrkPriVxPurityTool.cxx.

34  {
35  msg(MSG::INFO) << "Finalize successful" << endmsg;
36  return StatusCode::SUCCESS;
37  }

◆ initialize()

StatusCode Trk::TrkPriVxPurityTool::initialize ( )

AlgTool method.

Definition at line 30 of file TrkPriVxPurityTool.cxx.

30  {
31  return StatusCode::SUCCESS;
32  }//end of initialize method

◆ inputHandles()

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

Return this algorithm's input handles.

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

◆ interfaceID()

static const InterfaceID& Trk::TrkPriVxPurityTool::interfaceID ( )
inlinestatic

AlgTool interface method.

Definition at line 57 of file TrkPriVxPurityTool.h.

57 { return IID_TrkPriVxPurityTool; }

◆ msg() [1/2]

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

Definition at line 24 of file AthCommonMsg.h.

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

◆ msg() [2/2]

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

Definition at line 27 of file AthCommonMsg.h.

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

◆ msgLvl()

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

Definition at line 30 of file AthCommonMsg.h.

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

◆ outputHandles()

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

Return this algorithm's output handles.

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

◆ purity()

const TrkPriVxPurity * Trk::TrkPriVxPurityTool::purity ( const Trk::VxCandidate vertex) const

Actual analysis method, returning a Trk::TrkPriVxPurity object for a given TrkVxCandidate.

Definition at line 62 of file TrkPriVxPurityTool.cxx.

62  {
63 //protection and related
64  if ( vertex != nullptr ) {
65  const std::vector<Trk::VxTrackAtVertex *> * tracks = vertex->vxTrackAtVertex();
66  if ( tracks !=nullptr ) {
67 
68 // first getting the Mc Event collection
69  const McEventCollection * mcCollection ( nullptr );
70  StatusCode sc = evtStore()->retrieve ( mcCollection, m_mc_collection_name );
71  if ( sc.isFailure() ) {
72  if (msgLvl(MSG::DEBUG)) {
73  msg() << "Unable to retrieve MC collection: " << m_mc_collection_name << endmsg;
74  msg() << "Zero pointer returned." << endmsg;
75  }
76  return nullptr;
77  }
78 
79 //getting the signal event itself
80  McEventCollection::const_iterator it = mcCollection->begin();
81  const HepMC::GenEvent* genEvent= ( *it );
82 
83  if( genEvent->vertices_empty() ) {
84  ATH_MSG_DEBUG( "No vertices found in first GenEvent" );
85  return nullptr;
86  }
87 #ifdef HEPMC3
88  auto pv = genEvent->vertices()[0];
89 #else
90  auto pv = *(genEvent->vertices_begin());
91 #endif
92 
93 //analysing the MC event to create PV candidate
94 //first finding the vertex of primary pp interaction
95 
96 //and storing its position
97  const auto& pv_pos = pv ->position();
98  double pv_r = pv_pos.perp();
99  double pv_z = pv_pos.z();
100 
101 // storing all the ids of vertices reasonably close to the primary one.
102 // here the region of interest is selected.
103  std::map<int,HepMC::ConstGenVertexPtr> vertex_ids;
104 #ifdef HEPMC3
105  for (const auto& vtx: genEvent->vertices()){
106  const auto& lv_pos = vtx->position();
107  if ( std::abs ( lv_pos.perp() - pv_r ) <m_r_tol && std::abs ( lv_pos.z() - pv_z ) <m_z_tol ) {vertex_ids[vtx->id()] = vtx;}
108  }//end of loop over all the vertices
109 #else
110  for ( HepMC::GenEvent::vertex_const_iterator i = genEvent->vertices_begin(); i != genEvent->vertices_end() ;++i ) {
111  auto vtx=*i;
112  const auto& lv_pos = vtx->position();
113  if ( std::abs ( lv_pos.perp() - pv_r ) <m_r_tol && std::abs ( lv_pos.z() - pv_z ) <m_z_tol ) {vertex_ids[ HepMC::barcode(vtx) ]= vtx;}
114  }//end of loop over all the vertices
115 #endif
116 
117 
118 //getting the track truth collection
119  const TrackParticleTruthCollection * trackParticleTruthCollection ( nullptr );
120  sc = evtStore()->retrieve ( trackParticleTruthCollection, m_trackParticleTruthCollName );
121 
122  if ( sc.isFailure() ) {
123  if (msgLvl(MSG::DEBUG)) {
124  msg() << "Cannot retrieve " << m_trackParticleTruthCollName << endmsg;
125  msg() << "Zero pointer returned" << endmsg;
126  }
127  return nullptr;
128  }
129 
130 //looping over the tracks to find those matched to the GenParticle originating from signal PV
131  std::vector<Trk::VxTrackAtVertex *>::const_iterator vt = tracks->begin();
132  std::vector<Trk::VxTrackAtVertex *>::const_iterator ve = tracks->end();
133  unsigned int n_failed = 0;
134  std::vector<double> in_weights ( 0 );
135  std::vector<double> out_weights ( 0 );
136  std::vector<double> pu_weights ( 0 );
137  std::vector<double> no_correspondance ( 0 );
138 
139 
140  for ( ;vt!=ve;++vt ) {
141 //original element link
142 //ugly so far, we'll correct the EDM later
143  if ( ( *vt ) !=nullptr ) {
144 
145  ITrackLink * origLink = ( **vt ).trackOrParticleLink();
146 
147  if ( origLink !=nullptr ) {
148  // get to the original track particle
149  LinkToTrackParticleBase * tr_part = dynamic_cast< LinkToTrackParticleBase * > ( origLink );
150  if ( tr_part !=nullptr && tr_part->isValid()) {
151 
152 
153  std::map< Rec::TrackParticleTruthKey, TrackParticleTruth>::const_iterator ttItr = trackParticleTruthCollection->end();
154 
155  const Rec::TrackParticle* tp = dynamic_cast<const Rec::TrackParticle*>(**tr_part);
156  if(tp) {
157  const Rec::TrackParticleContainer* tpCont = dynamic_cast<const Rec::TrackParticleContainer*>(tr_part->getStorableObjectPointer());
158  if (tpCont) {
160  linkTruth.setElement(tp);
161  linkTruth.setStorableObject(*tpCont);
162  ttItr = trackParticleTruthCollection->find(Rec::TrackParticleTruthKey(linkTruth));
163  }
164  }
165 
166 
167  if (ttItr != trackParticleTruthCollection->end() ) {
168  const HepMcParticleLink& particleLink = ttItr->second.particleLink();
169 #ifdef HEPMC3
170  HepMC::ConstGenParticlePtr genParticle = particleLink.scptr();
171 #else
172  HepMC::ConstGenParticlePtr genParticle = particleLink.cptr();
173 #endif
174 
175  if(genParticle) {
176  const auto *tpEvent = genParticle->parent_event();
177  if(tpEvent==genEvent) {
178  HepMC::ConstGenVertexPtr pVertex{nullptr};
179  if (genParticle) pVertex = genParticle->production_vertex();
180  if ( pVertex) {
181  int link_pid = genParticle->pdg_id();
182  bool primary_track = false;
183  bool secondary_track = false;
184 
185 //loop over the particles until decision is really taken
186  do {
187 #ifdef HEPMC3
188  auto idf_res = vertex_ids.find ( pVertex->id() );
189 #else
190  auto idf_res = vertex_ids.find ( HepMC::barcode(pVertex) );
191 #endif
192 
193 //for the HepMcParticle Link, the signal event has an index 0.
194 // tagging on it
195  if ( idf_res != vertex_ids.end() ) {
196 //this is a primary track, storing its weight
197  primary_track = true;
198  in_weights.push_back ( ( *vt )->weight() );
199  }else {
200 //this vertex is not from the central region.
201 //checking whether it is a bremsstrahlung
202 //if so, propagating track to its origin, otherwise rejecting it completely.
203  if ( pVertex->particles_in_size() == 1 ) {
204 // one mother particle: is it a brem of some kind?
205 #ifdef HEPMC3
206  auto inp = pVertex->particles_in()[0] ;
207 #else
208  auto inp =*(pVertex->particles_in_const_begin()) ;
209 #endif
210  auto tmpVertex_loc = inp ->production_vertex();
211  if ( inp ->pdg_id() == link_pid && tmpVertex_loc) {
212 // seems like a brem (this can be generator/simulation dependent unfortunately)
213 // continue iterating
214  pVertex = tmpVertex_loc;
215  }else {
216  secondary_track = true;
217  out_weights.push_back ( ( *vt )->weight() );
218  }//end of "no id change" check
219  }else {
220 
221 //has more than one mother particle; comes from reaction, not from central region
222 // it is an outlier
223  secondary_track = true;
224  out_weights.push_back ( ( *vt )->weight() );
225  }//end of reaction check
226  }//end of central region check
227  }while ( !primary_track && !secondary_track );//end of loop over gen particles
228  }else {
229 
230 // this track has no production vertex. Whatever it is, it does not
231 // come from the primary interaction, consider as pileup
232  if (msgLvl(MSG::INFO)) {
233  msg() <<"A truth particle with no production vertex found."<<endmsg;
234  msg() <<"Since it does not come from PV, consider as PileUp"<<endmsg;
235  }
236  pu_weights.push_back ( ( *vt )->weight() );
237  } //end of particle link without production vertex check.
238  }else {
239 
240 // std::cout<<"Not equal events "<< std::endl;
241  pu_weights.push_back ( ( *vt )->weight() );
242  }//end of event pointers comparison
243  }else{
244 
245 //the corresponding link to the track particles is zero.
246 //This seems to be a fake (broken link in any case).
247  no_correspondance.push_back ( ( *vt )->weight() );
248  }//end of genParticle check
249  }//end of search for correspondance in the trurth collection
250  }else{
251  if (msgLvl(MSG::DEBUG)) msg() <<"This track at vertex has no valid link to its original trackparticle "<<endmsg;
252  ++ n_failed;
253  }//end of search for the truth link
254  }else{
255  if (msgLvl(MSG::DEBUG)) msg() <<"There is an empty pointer in the vector<VxTrackAtVertex *> for this vertex"<<endmsg;
256  ++n_failed;
257  }
258  }//end of valid link check
259  } //end of check of the empty pointer in the vector
260 
261 //debug
262 // std::cout<<"Total number of tracks fitted to the vertex: "<<tracks->size() <<std::endl;
263 // std::cout<<"Number of tracks w/o truth correspondance: "<<no_correspondance.size() <<std::endl;
264 // std::cout<<"Number of correct tracks: "<<total_size<<std::endl;
265 // std::cout<<"Number of tracks with broken origin links "<<n_failed<<std::endl;
266 // std::cout<<"Number of fitted outliers "<<out_weights.size() <<std::endl;
267 // std::cout<<"Number of fitted intliers "<<in_weights.size() <<std::endl;
268 
269  return new Trk::TrkPriVxPurity ( tracks->size(), pu_weights, no_correspondance,
270  n_failed, in_weights, out_weights );
271  } // end of if tracks != 0
272  }else{
273  if (msgLvl(MSG::ERROR)) {
274  msg()<<"Empty vertex pointer received"<<endmsg;
275  msg()<<"Empty pointer returned."<<endmsg;
276  }
277  return nullptr;
278  }//end of empty vertex check
279  return nullptr;
280  }//end of purity method

◆ renounce()

std::enable_if_t<std::is_void_v<std::result_of_t<decltype(&T::renounce)(T)> > && !std::is_base_of_v<SG::VarHandleKeyArray, T> && std::is_base_of_v<Gaudi::DataHandle, T>, void> AthCommonDataStore< AthCommonMsg< AlgTool > >::renounce ( T &  h)
inlineprotectedinherited

Definition at line 380 of file AthCommonDataStore.h.

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

◆ renounceArray()

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

remove all handles from I/O resolution

Definition at line 364 of file AthCommonDataStore.h.

364  {
365  handlesArray.renounce();
366  }

◆ sysInitialize()

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

Perform system initialization for an algorithm.

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

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

◆ sysStart()

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

Handle START transition.

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

◆ updateVHKA()

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

Definition at line 308 of file AthCommonDataStore.h.

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

Member Data Documentation

◆ m_detStore

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

Pointer to StoreGate (detector store by default)

Definition at line 393 of file AthCommonDataStore.h.

◆ m_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_mc_collection_name

std::string Trk::TrkPriVxPurityTool::m_mc_collection_name
private

Name of the MC event collection to read.

Definition at line 91 of file TrkPriVxPurityTool.h.

◆ m_r_tol

double Trk::TrkPriVxPurityTool::m_r_tol
private

Primary vertex definition for MC: tolerances taken in r (mm) around the simulated point of proton-proton interaction.

All the vertices in this region will be merged to form a single simulated PV with associated charged tracks.

Definition at line 73 of file TrkPriVxPurityTool.h.

◆ m_trackParticleTruthCollName

std::string Trk::TrkPriVxPurityTool::m_trackParticleTruthCollName
private

Name of the track true <-> rec map to be read from the storegate.

Definition at line 86 of file TrkPriVxPurityTool.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_z_tol

double Trk::TrkPriVxPurityTool::m_z_tol
private

Primary vertex definition for MC: tolerances taken in z (mm) around the simulated point of proton-proton interaction.

All the vertices in this region will be merged to form a single simulated PV with associated charged tracks.

Definition at line 81 of file TrkPriVxPurityTool.h.


The documentation for this class was generated from the following files:
Rec::TrackParticleTruthKey
Definition: TrackParticleTruthKey.h:20
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
python.PerfMonSerializer.p
def p
Definition: PerfMonSerializer.py:743
AthCommonDataStore< AthCommonMsg< AlgTool > >::declareProperty
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T > &t)
Definition: AthCommonDataStore.h:145
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
ParticleTest.tp
tp
Definition: ParticleTest.py:25
AthCommonMsg< AlgTool >::msgLvl
bool msgLvl(const MSG::Level lvl) const
Definition: AthCommonMsg.h:30
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
SG::VarHandleKeyArray::setOwner
virtual void setOwner(IDataHandleHolder *o)=0
AthCommonDataStore< AthCommonMsg< AlgTool > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
AthCommonDataStore
Definition: AthCommonDataStore.h:52
Trk::TrkPriVxPurityTool::m_trackParticleTruthCollName
std::string m_trackParticleTruthCollName
Name of the track true <-> rec map to be read from the storegate.
Definition: TrkPriVxPurityTool.h:86
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
lumiFormat.i
int i
Definition: lumiFormat.py:92
beamspotman.n
n
Definition: beamspotman.py:731
endmsg
#define endmsg
Definition: AnalysisConfig_Ntuple.cxx:63
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
HepMC::barcode
int barcode(const T *p)
Definition: Barcode.h:16
Trk::TrkPriVxPurity
Definition: TrkPriVxPurity.h:41
AthCommonDataStore< AthCommonMsg< AlgTool > >::m_detStore
StoreGateSvc_t m_detStore
Pointer to StoreGate (detector store by default)
Definition: AthCommonDataStore.h:393
McEventCollection
This defines the McEventCollection, which is really just an ObjectVector of McEvent objects.
Definition: McEventCollection.h:33
AthAlgTool::AthAlgTool
AthAlgTool()
Default constructor:
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
HepMC::ConstGenParticlePtr
const GenParticle * ConstGenParticlePtr
Definition: GenParticle.h:38
merge_scale_histograms.doc
string doc
Definition: merge_scale_histograms.py:9
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:192
Trk::TrkPriVxPurityTool::m_mc_collection_name
std::string m_mc_collection_name
Name of the MC event collection to read.
Definition: TrkPriVxPurityTool.h:91
Trk::TrkPriVxPurityTool::m_r_tol
double m_r_tol
Primary vertex definition for MC: tolerances taken in r (mm) around the simulated point of proton-pro...
Definition: TrkPriVxPurityTool.h:73
Rec::TrackParticleContainer
Definition: Reconstruction/Particle/Particle/TrackParticleContainer.h:33
validateBDTTau.vt
vt
Definition: validateBDTTau.py:43
Rec::TrackParticle
Definition: Reconstruction/Particle/Particle/TrackParticle.h:47
Trk::vertex
@ vertex
Definition: MeasurementType.h:21
a
TList * a
Definition: liststreamerinfos.cxx:10
h
TrackParticleTruthCollection
Definition: TrackParticleTruthCollection.h:18
DEBUG
#define DEBUG
Definition: page_access.h:11
AthCommonMsg< AlgTool >::msg
MsgStream & msg() const
Definition: AthCommonMsg.h:24
python.changerun.pv
pv
Definition: changerun.py:81
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
python.Bindings.keys
keys
Definition: Control/AthenaPython/python/Bindings.py:790
HepMC::ConstGenVertexPtr
const HepMC::GenVertex * ConstGenVertexPtr
Definition: GenVertex.h:60
AthCommonDataStore::declareGaudiProperty
Gaudi::Details::PropertyBase & declareGaudiProperty(Gaudi::Property< T > &hndl, const SG::VarHandleKeyType &)
specialization for handling Gaudi::Property<SG::VarHandleKey>
Definition: AthCommonDataStore.h:156
Trk::TrkPriVxPurityTool::m_z_tol
double m_z_tol
Primary vertex definition for MC: tolerances taken in z (mm) around the simulated point of proton-pro...
Definition: TrkPriVxPurityTool.h:81
fitman.k
k
Definition: fitman.py:528