ATLAS Offline Software
BTagVertexAugmenter.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 #include "BTagVertexAugmenter.h"
6 #include "GaudiKernel/ServiceHandle.h"
7 
8 #include "xAODTracking/Vertex.h"
11 
12 
14  const std::string& name, ISvcLocator* loc):
15  AthAlgorithm(name, loc)
16 {
17 }
18 
20  return StatusCode::SUCCESS;
21 }
22 
24  return StatusCode::SUCCESS;
25 }
26 
28  const xAOD::VertexContainer *vertices = 0;
29  CHECK( evtStore()->retrieve(vertices, "PrimaryVertices") );
30  int npv = 0;
31  size_t indexPV_tmp = 0;
32  xAOD::VertexContainer::const_iterator vtx_itr = vertices->begin();
33  xAOD::VertexContainer::const_iterator vtx_end = vertices->end();
34  int count = -1;
35  for (; vtx_itr != vtx_end; ++vtx_itr) {
36  count++;
37  if ((*vtx_itr)->nTrackParticles() >= 2) {
38  npv++;
39  if ((*vtx_itr)->vertexType() == 1) {
40  indexPV_tmp = count;
41  }
42  }
43  }
44  std::unique_ptr<int> pv_index_ptr(new int(indexPV_tmp));
45  CHECK(evtStore()->record(std::move(pv_index_ptr), "BTaggingVertexIndex"));
46  std::unique_ptr<int> npv_ptr(new int(npv));
47  CHECK(evtStore()->record(std::move(npv_ptr),
48  "BTaggingNumberOfPrimaryVertices"));
49  return StatusCode::SUCCESS;
50 }
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
BTagVertexAugmenter::initialize
virtual StatusCode initialize()
Definition: BTagVertexAugmenter.cxx:19
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
BTagVertexAugmenter.h
XMLtoHeader.count
count
Definition: XMLtoHeader.py:85
AthCommonDataStore< AthCommonMsg< Algorithm > >::evtStore
ServiceHandle< StoreGateSvc > & evtStore()
The standard StoreGateSvc (event store) Returns (kind of) a pointer to the StoreGateSvc.
Definition: AthCommonDataStore.h:85
BTagVertexAugmenter::finalize
virtual StatusCode finalize()
Definition: BTagVertexAugmenter.cxx:23
EL::StatusCode
::StatusCode StatusCode
StatusCode definition for legacy code.
Definition: PhysicsAnalysis/D3PDTools/EventLoop/EventLoop/StatusCode.h:22
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DataVector
Derived DataVector<T>.
Definition: DataVector.h:581
Vertex.h
AthAlgorithm
Definition: AthAlgorithm.h:47
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:195
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
BTagVertexAugmenter::BTagVertexAugmenter
BTagVertexAugmenter(const std::string &name, ISvcLocator *pSvcLocator)
Definition: BTagVertexAugmenter.cxx:13
VertexContainer.h
BTagVertexAugmenter::execute
virtual StatusCode execute()
Definition: BTagVertexAugmenter.cxx:27
TrackParticleContainer.h
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.