ATLAS Offline Software
Public Member Functions | Private Member Functions | Private Attributes | List of all members
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 More...
 

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 More...
 
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
57  ATH_CHECK(pairContainer.record(std::make_unique<xAOD::VertexContainer>(), std::make_unique<xAOD::VertexAuxContainer>()));
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  //----------------------------------------------------
73  ATH_CHECK(!pvContainer.isValid());
74  //----------------------------------------------------
75  // Refit primary vertices
76  //----------------------------------------------------
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  }

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

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.

◆ m_fourMuonTool

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

Definition at line 47 of file Reco_4mu.h.

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

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

◆ m_pvContainerName

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

Definition at line 54 of file Reco_4mu.h.

◆ m_pvRefitter

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

Definition at line 48 of file Reco_4mu.h.

◆ m_quadName

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

Definition at line 53 of file Reco_4mu.h.

◆ m_refitPV

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

Definition at line 56 of file Reco_4mu.h.

◆ m_refPVContainerName

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

Definition at line 55 of file Reco_4mu.h.

◆ m_v0Tools

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

Definition at line 46 of file Reco_4mu.h.


The documentation for this class was generated from the following files:
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
xAOD::BPhysHypoHelper::setTauErr
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
Definition: BPhysHypoHelper.cxx:179
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:67
ParticleConstants::PDG2011::muonMassInMeV
constexpr double muonMassInMeV
the mass of the muon (in MeV)
Definition: ParticleConstants.h:29
DerivationFramework::Reco_4mu::ProcessVertex
void ProcessVertex(xAOD::BPhysHypoHelper &, xAOD::BPhysHelper::pv_type, std::vector< double > trackMasses) const
tools
Definition: Reco_4mu.cxx:176
xAOD::BPhysHelper::PV_MIN_Z0
@ PV_MIN_Z0
Definition: BPhysHelper.h:475
SG::ConstAccessor
Helper class to provide constant type-safe access to aux data.
Definition: ConstAccessor.h:55
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
DerivationFramework::Reco_4mu::m_DoVertexType
Gaudi::Property< int > m_DoVertexType
Definition: Reco_4mu.h:58
xAOD::BPhysHypoHelper::TAU_INV_MASS
@ TAU_INV_MASS
Definition: BPhysHypoHelper.h:140
AthenaPoolTestRead.sc
sc
Definition: AthenaPoolTestRead.py:27
runBeamSpotCalibration.helper
helper
Definition: runBeamSpotCalibration.py:115
SG::makeHandle
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
Definition: ReadCondHandle.h:274
DerivationFramework::Reco_4mu::m_pvRefitter
ToolHandle< Analysis::PrimaryVertexRefitter > m_pvRefitter
Definition: Reco_4mu.h:48
DerivationFramework::Reco_4mu::m_refPVContainerName
SG::WriteHandleKey< xAOD::VertexContainer > m_refPVContainerName
Definition: Reco_4mu.h:55
xAOD::BPhysHypoHelper
Definition: BPhysHypoHelper.h:73
BPHYS_CHECK
#define BPHYS_CHECK(EXP)
Useful CHECK macro.
Definition: BPhysHelper.h:738
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
beamspotman.n
n
Definition: beamspotman.py:727
SG::WriteHandle::ptr
pointer_type ptr()
Dereference the pointer.
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
xAOD::BPhysHelper::PV_MIN_A0
@ PV_MIN_A0
Definition: BPhysHelper.h:475
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
DerivationFramework::Reco_4mu::m_PV_max
Gaudi::Property< int > m_PV_max
Definition: Reco_4mu.h:57
DerivationFramework::Reco_4mu::m_v0Tools
PublicToolHandle< Trk::V0Tools > m_v0Tools
Definition: Reco_4mu.h:46
DerivationFramework::Reco_4mu::m_fourMuonTool
ToolHandle< DerivationFramework::FourMuonTool > m_fourMuonTool
Definition: Reco_4mu.h:47
xAOD::BPhysHelper::vtx
const xAOD::Vertex * vtx() const
Getter method for the cached xAOD::Vertex.
Definition: BPhysHelper.h:108
DerivationFramework::Reco_4mu::m_quadName
SG::WriteHandleKey< xAOD::VertexContainer > m_quadName
Definition: Reco_4mu.h:53
xAOD::BPhysHelper::PV_MAX_SUM_PT2
@ PV_MAX_SUM_PT2
Definition: BPhysHelper.h:475
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:73
DerivationFramework::Reco_4mu::m_refitPV
Gaudi::Property< bool > m_refitPV
Definition: Reco_4mu.h:56
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
SG::WriteHandle::record
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DerivationFramework::Reco_4mu::m_pvContainerName
SG::ReadHandleKey< xAOD::VertexContainer > m_pvContainerName
Definition: Reco_4mu.h:54
python.changerun.pv
pv
Definition: changerun.py:79
xAOD::BPhysHelper::pv
const xAOD::Vertex * pv(const pv_type vertexType=BPhysHelper::PV_MIN_A0)
Get the refitted collision vertex of type pv_type.
Definition: BPhysHelper.cxx:796
DerivationFramework::Reco_4mu::m_pairName
SG::WriteHandleKey< xAOD::VertexContainer > m_pairName
job options
Definition: Reco_4mu.h:52
xAOD::BPhysHypoHelper::setTau
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.
Definition: BPhysHypoHelper.cxx:143
xAOD::BPhysHelper::PV_MIN_Z0_BA
@ PV_MIN_Z0_BA
Definition: BPhysHelper.h:475