ATLAS Offline Software
Bmumu_reco_mumu.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
3 */
4 
6 // Bmumu_reco_mumu.cxx
8 //
9 // Author : Wolfgang Walkowiak <Wolfgang.Walkowiak@cern.ch.>
10 // Original author (Reco_mumu):
11 // Daniel Scheirich <daniel.scheirich@cern.ch>
12 //
13 // Changes:
14 // Basic dimuon reconstruction for the derivation framework.
15 // This class inherits from CfAthAlgTool instead of AthAlgTool in order
16 // to have access to the CutFlowSvc instance.
17 //
18 //============================================================================
19 //
20 
22 
28 
29 
30 namespace DerivationFramework {
31 
32  Bmumu_reco_mumu::Bmumu_reco_mumu(const std::string& t,
33  const std::string& n,
34  const IInterface* p) :
35  CfAthAlgTool(t,n,p){
36  declareInterface<DerivationFramework::IAugmentationTool>(this);
37 
38  }
39 
40  // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
41 
43  {
44 
45  ATH_MSG_DEBUG("in initialize()");
46 
47  // retrieve V0 tools
48  CHECK( m_v0Tools.retrieve() );
49 
50  // get the JpsiFinder tool
51  CHECK( m_jpsiFinder.retrieve() );
52 
53  // get the PrimaryVertexRefitter tool
54  CHECK( m_pvRefitter.retrieve() );
55 
56  // Get the beam spot service
58  ATH_CHECK(m_pvContainerKey.initialize());
60  ATH_CHECK(m_outVtxContainerKey.initialize());
61 
62  return StatusCode::SUCCESS;
63 
64  }
65 
67 
68  const EventContext& ctx = Gaudi::Hive::currentContext();
69  // Jpsi container and its auxilliary store
70  std::unique_ptr<xAOD::VertexContainer> vtxContainer = std::make_unique<xAOD::VertexContainer>();
71  std::unique_ptr<xAOD::VertexAuxContainer> vtxAuxContainer = std::make_unique<xAOD::VertexAuxContainer>();
72  vtxContainer->setStore(vtxAuxContainer.get());
73 
74  //----------------------------------------------------
75  // call Jpsi finder
76  //----------------------------------------------------
77  if( !m_jpsiFinder->performSearch(ctx, *vtxContainer).isSuccess() ) {
78  ATH_MSG_FATAL("Jpsi finder (" << m_jpsiFinder << ") failed.");
79  return StatusCode::FAILURE;
80  }
81 
82  //----------------------------------------------------
83  // retrieve primary vertices
84  //----------------------------------------------------
86  if (!pvContainer.isValid()){
87  ATH_MSG_FATAL("Failed to retrieve "<<m_pvContainerKey);
88  return StatusCode::FAILURE;
89  }
90 
91 
92  //----------------------------------------------------
93  // Try to retrieve refitted primary vertices
94  //----------------------------------------------------
95  std::unique_ptr<xAOD::VertexContainer> refPvContainer = std::make_unique<xAOD::VertexContainer>();
96  std::unique_ptr<xAOD::VertexAuxContainer> refPvAuxContainer = std::make_unique<xAOD::VertexAuxContainer>();
97  refPvContainer->setStore(refPvAuxContainer.get());
98 
99  //m_refContainerKey
100 
101  // Give the helper class the ptr to v0tools and beamSpotsSvc to use
103  if(!evt.isValid()) {
104  ATH_MSG_ERROR("Cannot Retrieve " << m_eventInfo_key.key() );
105  return StatusCode::FAILURE;
106  }
107  BPhysPVTools helper(&(*m_v0Tools), evt.cptr());
108  helper.SetMinNTracksInPV(m_PV_minNTracks);
109  helper.SetSave3d(m_do3d);
110 
111  if(m_refitPV && vtxContainer->size()){
112  ATH_CHECK(helper.FillCandwithRefittedVertices(vtxContainer.get(), pvContainer.cptr(), refPvContainer.get(), &(*m_pvRefitter) , m_PV_max, m_DoVertexType));
113  }else if (!m_refitPV && vtxContainer->size() >0){
114  ATH_CHECK(helper.FillCandExistingVertices(vtxContainer.get(), pvContainer.cptr(), m_DoVertexType));
115  }
116 
117 
118  //----------------------------------------------------
119  // save in the StoreGate
120  //----------------------------------------------------
122  ATH_CHECK(outputVertices.record(std::move(vtxContainer), std::move(vtxAuxContainer)));
123 
124  if(m_refitPV) {
126  ATH_CHECK(refitVertices.record(std::move(refPvContainer), std::move(refPvAuxContainer)));
127  }
128 
129  // add counter for number of events seen
130  addEvent("dimuEvents");
131  // add counter for the number of events with >= 1 reco'd vertices
132  if ( vtxContainer->size() > 0 ) {
133  addEvent("dimuWithVertexCand");
134  }
135  // add counter for the number of vertices
136  addToCounter("dimuNumVertices", vtxContainer->size());
137 
138  return StatusCode::SUCCESS;
139  }
140 }
BPhysPVTools.h
DerivationFramework::Bmumu_reco_mumu::m_refitPV
Gaudi::Property< bool > m_refitPV
Definition: Bmumu_reco_mumu.h:68
V0Tools.h
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DerivationFramework::CfAthAlgTool::addToCounter
virtual bool addToCounter(const std::string &name, uint64_t counts=1, double weight=1.) const
Definition: CfAthAlgTool.cxx:115
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
DerivationFramework::Bmumu_reco_mumu::m_DoVertexType
Gaudi::Property< int > m_DoVertexType
Definition: Bmumu_reco_mumu.h:70
Bmumu_reco_mumu.h
DerivationFramework::Bmumu_reco_mumu::m_jpsiFinder
ToolHandle< Analysis::ICandidateSearch > m_jpsiFinder
Definition: Bmumu_reco_mumu.h:55
DerivationFramework::BPhysPVTools
Definition: BPhysPVTools.h:25
DerivationFramework::CfAthAlgTool::addEvent
virtual bool addEvent(const std::string &name, double weight=1.) const
Definition: CfAthAlgTool.cxx:104
LArG4FSStartPointFilter.evt
evt
Definition: LArG4FSStartPointFilter.py:42
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
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:112
DerivationFramework::Bmumu_reco_mumu::m_PV_minNTracks
Gaudi::Property< unsigned int > m_PV_minNTracks
Definition: Bmumu_reco_mumu.h:72
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
DerivationFramework::Bmumu_reco_mumu::m_do3d
Gaudi::Property< bool > m_do3d
Definition: Bmumu_reco_mumu.h:73
beamspotman.n
n
Definition: beamspotman.py:731
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
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DerivationFramework
THE reconstruction tool.
Definition: ParticleSortingAlg.h:24
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
DerivationFramework::Bmumu_reco_mumu::m_pvContainerKey
SG::ReadHandleKey< xAOD::VertexContainer > m_pvContainerKey
job options
Definition: Bmumu_reco_mumu.h:62
DerivationFramework::Bmumu_reco_mumu::m_PV_max
Gaudi::Property< int > m_PV_max
Definition: Bmumu_reco_mumu.h:69
DerivationFramework::Bmumu_reco_mumu::addBranches
virtual StatusCode addBranches() const override
Pass the thinning service
Definition: Bmumu_reco_mumu.cxx:66
EventInfo.h
DerivationFramework::Bmumu_reco_mumu::m_eventInfo_key
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfo_key
Definition: Bmumu_reco_mumu.h:57
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
VertexContainer.h
DerivationFramework::Bmumu_reco_mumu::m_v0Tools
ToolHandle< Trk::V0Tools > m_v0Tools
tools
Definition: Bmumu_reco_mumu.h:54
DerivationFramework::Bmumu_reco_mumu::Bmumu_reco_mumu
Bmumu_reco_mumu(const std::string &t, const std::string &n, const IInterface *p)
Definition: Bmumu_reco_mumu.cxx:32
DerivationFramework::Bmumu_reco_mumu::m_refContainerKey
SG::WriteHandleKey< xAOD::VertexContainer > m_refContainerKey
Definition: Bmumu_reco_mumu.h:64
DerivationFramework::Bmumu_reco_mumu::m_outVtxContainerKey
SG::WriteHandleKey< xAOD::VertexContainer > m_outVtxContainerKey
Definition: Bmumu_reco_mumu.h:66
DerivationFramework::Bmumu_reco_mumu::m_pvRefitter
ToolHandle< Analysis::PrimaryVertexRefitter > m_pvRefitter
Definition: Bmumu_reco_mumu.h:56
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
DerivationFramework::Bmumu_reco_mumu::initialize
StatusCode initialize() override
Definition: Bmumu_reco_mumu.cxx:42
DerivationFramework::CfAthAlgTool
Definition: CfAthAlgTool.h:35
VertexAuxContainer.h