ATLAS Offline Software
Loading...
Searching...
No Matches
DerivationFramework::Reco_4mu Class Reference

#include <Reco_4mu.h>

Inheritance diagram for DerivationFramework::Reco_4mu:
Collaboration diagram for DerivationFramework::Reco_4mu:

Public Member Functions

 Reco_4mu (const std::string &t, const std::string &n, const IInterface *p)
virtual StatusCode initialize () override final
virtual StatusCode addBranches (const EventContext &ctx) const override final

Private Member Functions

void ProcessVertex (xAOD::BPhysHypoHelper &, xAOD::BPhysHelper::pv_type, std::vector< double > trackMasses) const
 tools

Private Attributes

PublicToolHandle< Trk::V0Toolsm_v0Tools {this, "V0Tools", "Trk::V0Tools"}
ToolHandle< DerivationFramework::FourMuonToolm_fourMuonTool {this, "FourMuonTool", "DerivationFramework::FourMuonTool"}
ToolHandle< Analysis::PrimaryVertexRefitterm_pvRefitter {this, "PVRefitter", "Analysis::PrimaryVertexRefitter"}
SG::WriteHandleKey< xAOD::VertexContainerm_pairName {this, "PairContainerName", "Pairs"}
 job options
SG::WriteHandleKey< xAOD::VertexContainerm_quadName {this, "QuadrupletContainerName", "Quadruplets"}
SG::ReadHandleKey< xAOD::VertexContainerm_pvContainerName {this, "PVContainerName", "PrimaryVertices"}
SG::WriteHandleKey< xAOD::VertexContainerm_refPVContainerName {this, "RefPVContainerName", "RefittedPrimaryVertices"}
Gaudi::Property< bool > m_refitPV {this, "RefitPV", false}
Gaudi::Property< int > m_PV_max {this, "MaxPVrefit", 1}
Gaudi::Property< int > m_DoVertexType {this, "DoVertexType", 1}

Detailed Description

Definition at line 34 of file Reco_4mu.h.

Constructor & Destructor Documentation

◆ Reco_4mu()

DerivationFramework::Reco_4mu::Reco_4mu ( const std::string & t,
const std::string & n,
const IInterface * p )

Definition at line 21 of file Reco_4mu.cxx.

23 :
24 base_class(t,n,p)
25 {
26 }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::Reco_4mu::addBranches ( const EventContext & ctx) const
finaloverridevirtual

Definition at line 53 of file Reco_4mu.cxx.

54 {
55 // Output containers and its auxilliary store
56 SG::WriteHandle<xAOD::VertexContainer> pairContainer{m_pairName, ctx};
57 ATH_CHECK(pairContainer.record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()));
58 SG::WriteHandle<xAOD::VertexContainer> quadContainer{m_quadName, ctx};
59 ATH_CHECK(quadContainer.record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()));
60 bool acceptEvent = false; // this is a dummy
61 //----------------------------------------------------
62 // call finder
63 //----------------------------------------------------
64 if( !m_fourMuonTool->performSearch(pairContainer.ptr(), quadContainer.ptr(), acceptEvent, ctx).isSuccess() ) {
65 ATH_MSG_FATAL("4mu tool (" << m_fourMuonTool << ") failed.");
66 return StatusCode::FAILURE;
67 }
68
69 //----------------------------------------------------
70 // retrieve primary vertices
71 //----------------------------------------------------
72 SG::ReadHandle<xAOD::VertexContainer> pvContainer{m_pvContainerName, ctx};
73 ATH_CHECK(pvContainer.isValid());
74 //----------------------------------------------------
75 // Refit primary vertices
76 //----------------------------------------------------
77 SG::WriteHandle<xAOD::VertexContainer> refPvContainer;
78 if (m_refitPV) {
79 // refitted PV container does not exist. Create a new one.
80 refPvContainer = SG::makeHandle(m_refPVContainerName, ctx);
81 ATH_CHECK(refPvContainer.record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()));
82 }
83
84 BPhysPVTools helper(&(*m_v0Tools));//Give the helper class the ptr to v0tools to use
85
86 if (m_refitPV) {
87 if (quadContainer->size() >0) {
88 if (helper.FillCandwithRefittedVertices(quadContainer.ptr(), pvContainer.cptr(), refPvContainer.ptr(), &(*m_pvRefitter) , m_PV_max, m_DoVertexType).isFailure()){
89 ATH_MSG_FATAL("refitting failed - check the vertices you passed");
90 return StatusCode::FAILURE;
91 }
92 }
93 if (pairContainer->size()>0) {
94 if (helper.FillCandwithRefittedVertices(pairContainer.ptr(), pvContainer.cptr(), refPvContainer.ptr(), &(*m_pvRefitter) , m_PV_max, m_DoVertexType).isFailure()){
95 ATH_MSG_FATAL("refitting failed - check the vertices you passed");
96 return StatusCode::FAILURE;
97 }
98 }
99 } else {
100 if (quadContainer->size() >0) {
101 auto sc = helper.FillCandExistingVertices(quadContainer.ptr(), pvContainer.cptr(), m_DoVertexType);
102 sc.ignore();
103 }
104 if (pairContainer->size() >0) {
105 auto sc = helper.FillCandExistingVertices(pairContainer.ptr(), pvContainer.cptr(), m_DoVertexType);
106 sc.ignore();
107 }
108 }
109
110 //----------------------------------------------------
111 // Mass-hypothesis dependent quantities
112 //----------------------------------------------------
113
114 std::vector<double> muonPairMasses = std::vector<double>(2, ParticleConstants::muonMassInMeV);
115 std::vector<double> muonQuadMasses = std::vector<double>(4, ParticleConstants::muonMassInMeV);
116
117 bool doPt = (m_DoVertexType & 1) != 0;
118 bool doA0 = (m_DoVertexType & 2) != 0;
119 bool doZ0 = (m_DoVertexType & 4) != 0;
120 bool doZ0BA = (m_DoVertexType & 8) != 0;
121
122 // loop over pairs
123 ATH_MSG_DEBUG("Indices/masses of pairs follows....");
124 for(xAOD::Vertex* pairVtx : *pairContainer) {
125 // create BPhysHypoHelper
126 xAOD::BPhysHypoHelper pairHelper("PAIR", pairVtx);
127
128 //----------------------------------------------------
129 // decorate the vertex
130 //----------------------------------------------------
131 // a) invariant mass and error
132 if( !pairHelper.setMass(muonPairMasses) ) ATH_MSG_WARNING("Decoration pair.setMass failed");
133
134 double massErr = m_v0Tools->invariantMassError(pairHelper.vtx(), muonPairMasses);
135 if( !pairHelper.setMassErr(massErr) ) ATH_MSG_WARNING("Decoration pair.setMassErr failed");
136
137 // b) proper decay time and error:
138 // retrieve the refitted PV (or the original one, if the PV refitting was turned off)
139 if(doPt) ProcessVertex(pairHelper, xAOD::BPhysHelper::PV_MAX_SUM_PT2, muonPairMasses);
140 if(doA0) ProcessVertex(pairHelper, xAOD::BPhysHelper::PV_MIN_A0, muonPairMasses);
141 if(doZ0) ProcessVertex(pairHelper, xAOD::BPhysHelper::PV_MIN_Z0, muonPairMasses);
142 if(doZ0BA) ProcessVertex(pairHelper, xAOD::BPhysHelper::PV_MIN_Z0_BA, muonPairMasses);
143 static const SG::ConstAccessor<std::string> CombinationCodeAcc("CombinationCode");
144 ATH_MSG_DEBUG(CombinationCodeAcc(*pairVtx) << " : " << pairHelper.mass() << " +/- " << pairHelper.massErr());
145 }
146
147 // loop over quadruplets
148 ATH_MSG_DEBUG("Indices/masses of quadruplets follows....");
149 for (xAOD::Vertex* quadVtx: *quadContainer) {
150 // create BPhysHypoHelper
151 xAOD::BPhysHypoHelper quadHelper("QUAD", quadVtx);
152
153 //----------------------------------------------------
154 // decorate the vertex
155 //----------------------------------------------------
156 // a) invariant mass and error
157 if( !quadHelper.setMass(muonQuadMasses) ) ATH_MSG_WARNING("Decoration quad.setMass failed");
158
159 double massErr = m_v0Tools->invariantMassError(quadHelper.vtx(), muonQuadMasses);
160 if( !quadHelper.setMassErr(massErr) ) ATH_MSG_WARNING("Decoration quad.setMassErr failed");
161
162 // b) proper decay time and error:
163 // retrieve the refitted PV (or the original one, if the PV refitting was turned off)
164 if(doPt) ProcessVertex(quadHelper, xAOD::BPhysHelper::PV_MAX_SUM_PT2, muonQuadMasses);
165 if(doA0) ProcessVertex(quadHelper, xAOD::BPhysHelper::PV_MIN_A0, muonQuadMasses);
166 if(doZ0) ProcessVertex(quadHelper, xAOD::BPhysHelper::PV_MIN_Z0, muonQuadMasses);
167 if(doZ0BA) ProcessVertex(quadHelper, xAOD::BPhysHelper::PV_MIN_Z0_BA, muonQuadMasses);
168 static const SG::ConstAccessor<std::string> CombinationCodeAcc("CombinationCode");
169 ATH_MSG_DEBUG(CombinationCodeAcc(*quadVtx) << " : " << quadHelper.mass() << " +/- " << quadHelper.massErr());
170 }
171
172 return StatusCode::SUCCESS;
173 }
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_FATAL(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
static Double_t sc
ToolHandle< DerivationFramework::FourMuonTool > m_fourMuonTool
Definition Reco_4mu.h:47
Gaudi::Property< bool > m_refitPV
Definition Reco_4mu.h:56
ToolHandle< Analysis::PrimaryVertexRefitter > m_pvRefitter
Definition Reco_4mu.h:48
SG::WriteHandleKey< xAOD::VertexContainer > m_pairName
job options
Definition Reco_4mu.h:52
PublicToolHandle< Trk::V0Tools > m_v0Tools
Definition Reco_4mu.h:46
SG::ReadHandleKey< xAOD::VertexContainer > m_pvContainerName
Definition Reco_4mu.h:54
Gaudi::Property< int > m_PV_max
Definition Reco_4mu.h:57
SG::WriteHandleKey< xAOD::VertexContainer > m_refPVContainerName
Definition Reco_4mu.h:55
Gaudi::Property< int > m_DoVertexType
Definition Reco_4mu.h:58
void ProcessVertex(xAOD::BPhysHypoHelper &, xAOD::BPhysHelper::pv_type, std::vector< double > trackMasses) const
tools
Definition Reco_4mu.cxx:176
SG::WriteHandleKey< xAOD::VertexContainer > m_quadName
Definition Reco_4mu.h:53
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
pointer_type ptr()
Dereference the pointer.
constexpr double muonMassInMeV
the mass of the muon (in MeV)
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Vertex_v1 Vertex
Define the latest version of the vertex class.

◆ initialize()

StatusCode DerivationFramework::Reco_4mu::initialize ( )
finaloverridevirtual

Definition at line 30 of file Reco_4mu.cxx.

31 {
32
33 ATH_MSG_DEBUG("in initialize()");
34 ATH_CHECK(m_pvContainerName.initialize());
35 ATH_CHECK(m_refPVContainerName.initialize());
36 ATH_CHECK(m_pairName.initialize());
37 ATH_CHECK(m_quadName.initialize());
38 // retrieve V0 tools
39 ATH_CHECK( m_v0Tools.retrieve() );
40
41 // get the JpsiFinder tool
42 ATH_CHECK( m_fourMuonTool.retrieve() );
43
44 // get the PrimaryVertexRefitter tool
45 ATH_CHECK( m_pvRefitter.retrieve() );
46
47 return StatusCode::SUCCESS;
48
49 }

◆ ProcessVertex()

void DerivationFramework::Reco_4mu::ProcessVertex ( xAOD::BPhysHypoHelper & hypoHelper,
xAOD::BPhysHelper::pv_type pv_t,
std::vector< double > trackMasses ) const
private

tools

Definition at line 176 of file Reco_4mu.cxx.

176 {
177
178 const xAOD::Vertex* pv = hypoHelper.pv(pv_t);
179 if(pv) {
180 // decorate the vertex.
181
182 BPHYS_CHECK( hypoHelper.setTau( m_v0Tools->tau(hypoHelper.vtx(), pv, trackMasses),
183 pv_t,
185
186 BPHYS_CHECK( hypoHelper.setTauErr( m_v0Tools->tauError(hypoHelper.vtx(), pv, trackMasses),
187 pv_t,
189
190 //enum pv_type {PV_MAX_SUM_PT2, PV_MIN_A0, PV_MIN_Z0, PV_MIN_Z0BA};
191 }else{
192
193 const float errConst = -9999999;
194 BPHYS_CHECK( hypoHelper.setTau( errConst,
195 pv_t,
197
198 BPHYS_CHECK( hypoHelper.setTauErr( errConst,
199 pv_t,
201 }
202
203 return;
204 }
#define BPHYS_CHECK(EXP)
Useful CHECK macro.
const xAOD::Vertex * vtx() const
Getter method for the cached xAOD::Vertex.
const xAOD::Vertex * pv(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Get the refitted collision vertex of type pv_type.
bool setTau(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
: Set the proper decay time and error.
bool setTauErr(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
proper decay time error

Member Data Documentation

◆ m_DoVertexType

Gaudi::Property<int> DerivationFramework::Reco_4mu::m_DoVertexType {this, "DoVertexType", 1}
private

Definition at line 58 of file Reco_4mu.h.

58{this, "DoVertexType", 1};

◆ m_fourMuonTool

ToolHandle<DerivationFramework::FourMuonTool> DerivationFramework::Reco_4mu::m_fourMuonTool {this, "FourMuonTool", "DerivationFramework::FourMuonTool"}
private

Definition at line 47 of file Reco_4mu.h.

47{this, "FourMuonTool", "DerivationFramework::FourMuonTool"};

◆ m_pairName

SG::WriteHandleKey<xAOD::VertexContainer> DerivationFramework::Reco_4mu::m_pairName {this, "PairContainerName", "Pairs"}
private

job options

Definition at line 52 of file Reco_4mu.h.

52{this, "PairContainerName", "Pairs"};

◆ m_PV_max

Gaudi::Property<int> DerivationFramework::Reco_4mu::m_PV_max {this, "MaxPVrefit", 1}
private

Definition at line 57 of file Reco_4mu.h.

57{this, "MaxPVrefit", 1};

◆ m_pvContainerName

SG::ReadHandleKey<xAOD::VertexContainer> DerivationFramework::Reco_4mu::m_pvContainerName {this, "PVContainerName", "PrimaryVertices"}
private

Definition at line 54 of file Reco_4mu.h.

54{this, "PVContainerName", "PrimaryVertices"};

◆ m_pvRefitter

ToolHandle<Analysis::PrimaryVertexRefitter> DerivationFramework::Reco_4mu::m_pvRefitter {this, "PVRefitter", "Analysis::PrimaryVertexRefitter"}
private

Definition at line 48 of file Reco_4mu.h.

48{this, "PVRefitter", "Analysis::PrimaryVertexRefitter"};

◆ m_quadName

SG::WriteHandleKey<xAOD::VertexContainer> DerivationFramework::Reco_4mu::m_quadName {this, "QuadrupletContainerName", "Quadruplets"}
private

Definition at line 53 of file Reco_4mu.h.

53{this, "QuadrupletContainerName", "Quadruplets"};

◆ m_refitPV

Gaudi::Property<bool> DerivationFramework::Reco_4mu::m_refitPV {this, "RefitPV", false}
private

Definition at line 56 of file Reco_4mu.h.

56{this, "RefitPV", false};

◆ m_refPVContainerName

SG::WriteHandleKey<xAOD::VertexContainer> DerivationFramework::Reco_4mu::m_refPVContainerName {this, "RefPVContainerName", "RefittedPrimaryVertices"}
private

Definition at line 55 of file Reco_4mu.h.

55{this, "RefPVContainerName", "RefittedPrimaryVertices"};

◆ m_v0Tools

PublicToolHandle<Trk::V0Tools> DerivationFramework::Reco_4mu::m_v0Tools {this, "V0Tools", "Trk::V0Tools"}
private

Definition at line 46 of file Reco_4mu.h.

46{this, "V0Tools", "Trk::V0Tools"};

The documentation for this class was generated from the following files: