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)
 
StatusCode initialize ()
 
StatusCode finalize ()
 
virtual StatusCode addBranches () const
 

Private Member Functions

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

Private Attributes

ToolHandle< Trk::V0Toolsm_v0Tools
 
ToolHandle< DerivationFramework::FourMuonToolm_fourMuonTool
 
ToolHandle< Analysis::PrimaryVertexRefitterm_pvRefitter
 
std::string m_pairName
 job options More...
 
std::string m_quadName
 
std::string m_pvContainerName
 
std::string m_refPVContainerName
 
bool m_refitPV
 
int m_PV_max
 
int m_DoVertexType
 

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  m_v0Tools("Trk::V0Tools"),
26  m_fourMuonTool("DerivationFramework::FourMuonTool",this),
27  m_pvRefitter("Analysis::PrimaryVertexRefitter",this)
28  {
29 
30  // Declare tools
31  declareProperty("V0Tools" , m_v0Tools);
32  declareProperty("FourMuonTool", m_fourMuonTool);
33  declareProperty("PVRefitter", m_pvRefitter);
34 
35  // Declare user-defined properties
36  declareProperty("PairContainerName" , m_pairName = "Pairs");
37  declareProperty("QuadrupletContainerName", m_quadName = "Quadruplets");
38  declareProperty("PVContainerName" , m_pvContainerName = "PrimaryVertices");
39  declareProperty("RefPVContainerName" , m_refPVContainerName = "RefittedPrimaryVertices");
40  declareProperty("RefitPV" , m_refitPV = false);
41  declareProperty("MaxPVrefit" , m_PV_max = 1);
42  declareProperty("DoVertexType" , m_DoVertexType = 1);
43  }

Member Function Documentation

◆ addBranches()

StatusCode DerivationFramework::Reco_4mu::addBranches ( ) const
virtual

Definition at line 75 of file Reco_4mu.cxx.

76  {
77  // Output containers and its auxilliary store
78  xAOD::VertexContainer* pairContainer = NULL;
79  xAOD::VertexAuxContainer* pairAuxContainer = NULL;
80  xAOD::VertexContainer* quadContainer = NULL;
81  xAOD::VertexAuxContainer* quadAuxContainer = NULL;
82  bool acceptEvent = false; // this is a dummy
83  //----------------------------------------------------
84  // call finder
85  //----------------------------------------------------
86  if( !m_fourMuonTool->performSearch(pairContainer, pairAuxContainer, quadContainer, quadAuxContainer, acceptEvent).isSuccess() ) {
87  ATH_MSG_FATAL("4mu tool (" << m_fourMuonTool << ") failed.");
88  return StatusCode::FAILURE;
89  }
90 
91  //----------------------------------------------------
92  // event selection
93  //----------------------------------------------------
94  /*if (quadContainer->size()==0) {
95  if (pairContainer!=NULL) delete pairContainer;
96  if (pairAuxContainer!=NULL) delete pairAuxContainer;
97  if (quadContainer!=NULL) delete quadContainer;
98  if (quadAuxContainer!=NULL) delete quadAuxContainer;
99  return(acceptEvent);
100  // acceptEvent based on muon selection only, not quads
101  }*/
102 
103  //----------------------------------------------------
104  // retrieve primary vertices
105  //----------------------------------------------------
106  const xAOD::VertexContainer* pvContainer = NULL;
107  auto sc = evtStore()->retrieve(pvContainer, m_pvContainerName);
108  if(sc.isFailure()){
109  ATH_MSG_FATAL("Cannot find PV Container");
110  return StatusCode::FAILURE;
111  }
112  //----------------------------------------------------
113  // Refit primary vertices
114  //----------------------------------------------------
115  xAOD::VertexContainer* refPvContainer = NULL;
116  xAOD::VertexAuxContainer* refPvAuxContainer = NULL;
117 
118  if(m_refitPV) {
119  refPvContainer = new xAOD::VertexContainer;
120  refPvAuxContainer = new xAOD::VertexAuxContainer;
121  refPvContainer->setStore(refPvAuxContainer);
122  }
123 
124  BPhysPVTools helper(&(*m_v0Tools));//Give the helper class the ptr to v0tools to use
125 
126  if(m_refitPV){
127  if(quadContainer->size() >0){
128  StatusCode SC = helper.FillCandwithRefittedVertices(quadContainer, pvContainer, refPvContainer, &(*m_pvRefitter) , m_PV_max, m_DoVertexType);
129  if(SC.isFailure()){
130  ATH_MSG_FATAL("refitting failed - check the vertices you passed");
131  return StatusCode::FAILURE;
132  }
133  }
134  if(pairContainer->size()>0) {
135  StatusCode SC = helper.FillCandwithRefittedVertices(pairContainer, pvContainer, refPvContainer, &(*m_pvRefitter) , m_PV_max, m_DoVertexType);
136  if(SC.isFailure()){
137  ATH_MSG_FATAL("refitting failed - check the vertices you passed");
138  return StatusCode::FAILURE;
139  }
140  }
141  }else{
142  if(quadContainer->size() >0){
143  auto sc = helper.FillCandExistingVertices(quadContainer, pvContainer, m_DoVertexType);
144  sc.ignore();
145  }
146  if(pairContainer->size() >0)
147  {
148  auto sc = helper.FillCandExistingVertices(pairContainer, pvContainer, m_DoVertexType);
149  sc.ignore();
150  }
151  }
152 
153  //----------------------------------------------------
154  // Mass-hypothesis dependent quantities
155  //----------------------------------------------------
156 
157  std::vector<double> muonPairMasses = std::vector<double>(2, ParticleConstants::muonMassInMeV);
158  std::vector<double> muonQuadMasses = std::vector<double>(4, ParticleConstants::muonMassInMeV);
159 
160  bool doPt = (m_DoVertexType & 1) != 0;
161  bool doA0 = (m_DoVertexType & 2) != 0;
162  bool doZ0 = (m_DoVertexType & 4) != 0;
163  bool doZ0BA = (m_DoVertexType & 8) != 0;
164 
165  // loop over pairs
166  xAOD::VertexContainer::iterator pairItr = pairContainer->begin();
167  ATH_MSG_DEBUG("Indices/masses of pairs follows....");
168  for(; pairItr!=pairContainer->end(); ++pairItr) {
169  // create BPhysHypoHelper
170  xAOD::BPhysHypoHelper pairHelper("PAIR", *pairItr);
171 
172  //----------------------------------------------------
173  // decorate the vertex
174  //----------------------------------------------------
175  // a) invariant mass and error
176  if( !pairHelper.setMass(muonPairMasses) ) ATH_MSG_WARNING("Decoration pair.setMass failed");
177 
178  double massErr = m_v0Tools->invariantMassError(pairHelper.vtx(), muonPairMasses);
179  if( !pairHelper.setMassErr(massErr) ) ATH_MSG_WARNING("Decoration pair.setMassErr failed");
180 
181  // b) proper decay time and error:
182  // retrieve the refitted PV (or the original one, if the PV refitting was turned off)
183  if(doPt) ProcessVertex(pairHelper, xAOD::BPhysHelper::PV_MAX_SUM_PT2, muonPairMasses);
184  if(doA0) ProcessVertex(pairHelper, xAOD::BPhysHelper::PV_MIN_A0, muonPairMasses);
185  if(doZ0) ProcessVertex(pairHelper, xAOD::BPhysHelper::PV_MIN_Z0, muonPairMasses);
186  if(doZ0BA) ProcessVertex(pairHelper, xAOD::BPhysHelper::PV_MIN_Z0_BA, muonPairMasses);
187  static const SG::ConstAccessor<std::string> CombinationCodeAcc("CombinationCode");
188  ATH_MSG_DEBUG(CombinationCodeAcc(**pairItr) << " : " << pairHelper.mass() << " +/- " << pairHelper.massErr());
189  }
190 
191  // loop over quadruplets
192  xAOD::VertexContainer::iterator quadItr = quadContainer->begin();
193  ATH_MSG_DEBUG("Indices/masses of quadruplets follows....");
194  for(; quadItr!=quadContainer->end(); ++quadItr) {
195  // create BPhysHypoHelper
196  xAOD::BPhysHypoHelper quadHelper("QUAD", *quadItr);
197 
198  //----------------------------------------------------
199  // decorate the vertex
200  //----------------------------------------------------
201  // a) invariant mass and error
202  if( !quadHelper.setMass(muonQuadMasses) ) ATH_MSG_WARNING("Decoration quad.setMass failed");
203 
204  double massErr = m_v0Tools->invariantMassError(quadHelper.vtx(), muonQuadMasses);
205  if( !quadHelper.setMassErr(massErr) ) ATH_MSG_WARNING("Decoration quad.setMassErr failed");
206 
207  // b) proper decay time and error:
208  // retrieve the refitted PV (or the original one, if the PV refitting was turned off)
209  if(doPt) ProcessVertex(quadHelper, xAOD::BPhysHelper::PV_MAX_SUM_PT2, muonQuadMasses);
210  if(doA0) ProcessVertex(quadHelper, xAOD::BPhysHelper::PV_MIN_A0, muonQuadMasses);
211  if(doZ0) ProcessVertex(quadHelper, xAOD::BPhysHelper::PV_MIN_Z0, muonQuadMasses);
212  if(doZ0BA) ProcessVertex(quadHelper, xAOD::BPhysHelper::PV_MIN_Z0_BA, muonQuadMasses);
213  static const SG::ConstAccessor<std::string> CombinationCodeAcc("CombinationCode");
214  ATH_MSG_DEBUG(CombinationCodeAcc(**quadItr) << " : " << quadHelper.mass() << " +/- " << quadHelper.massErr());
215  }
216 
217  //----------------------------------------------------
218  // save in the StoreGate
219  //----------------------------------------------------
220  // Pairs
221  if (!evtStore()->contains<xAOD::VertexContainer>(m_pairName))
222  evtStore()->record(pairContainer, m_pairName).ignore();
223  if (!evtStore()->contains<xAOD::VertexAuxContainer>(m_pairName+"Aux."))
224  evtStore()->record(pairAuxContainer, m_pairName+"Aux.").ignore();
225 
226  // Quads
227  if (!evtStore()->contains<xAOD::VertexContainer>(m_quadName))
228  evtStore()->record(quadContainer, m_quadName).ignore();
229  if (!evtStore()->contains<xAOD::VertexAuxContainer>(m_quadName+"Aux."))
230  evtStore()->record(quadAuxContainer, m_quadName+"Aux.").ignore();
231 
232  // Refitted PVs
233  if(m_refitPV) {
234  evtStore()->record(refPvContainer , m_refPVContainerName).ignore();
235  evtStore()->record(refPvAuxContainer, m_refPVContainerName+"Aux.").ignore();
236  }
237 
238  return StatusCode::SUCCESS;
239  }

◆ finalize()

StatusCode DerivationFramework::Reco_4mu::finalize ( )

Definition at line 67 of file Reco_4mu.cxx.

68  {
69  // everything all right
70  return StatusCode::SUCCESS;
71  }

◆ initialize()

StatusCode DerivationFramework::Reco_4mu::initialize ( )

Definition at line 47 of file Reco_4mu.cxx.

48  {
49 
50  ATH_MSG_DEBUG("in initialize()");
51 
52  // retrieve V0 tools
53  CHECK( m_v0Tools.retrieve() );
54 
55  // get the JpsiFinder tool
56  CHECK( m_fourMuonTool.retrieve() );
57 
58  // get the PrimaryVertexRefitter tool
59  CHECK( m_pvRefitter.retrieve() );
60 
61  return StatusCode::SUCCESS;
62 
63  }

◆ 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 242 of file Reco_4mu.cxx.

242  {
243 
244  const xAOD::Vertex* pv = hypoHelper.pv(pv_t);
245  if(pv) {
246  // decorate the vertex.
247 
248  BPHYS_CHECK( hypoHelper.setTau( m_v0Tools->tau(hypoHelper.vtx(), pv, trackMasses),
249  pv_t,
251 
252  BPHYS_CHECK( hypoHelper.setTauErr( m_v0Tools->tauError(hypoHelper.vtx(), pv, trackMasses),
253  pv_t,
255 
256  //enum pv_type {PV_MAX_SUM_PT2, PV_MIN_A0, PV_MIN_Z0, PV_MIN_Z0BA};
257  }else{
258 
259  const float errConst = -9999999;
260  BPHYS_CHECK( hypoHelper.setTau( errConst,
261  pv_t,
263 
264  BPHYS_CHECK( hypoHelper.setTauErr( errConst,
265  pv_t,
267  }
268 
269  return;
270  }

Member Data Documentation

◆ m_DoVertexType

int DerivationFramework::Reco_4mu::m_DoVertexType
private

Definition at line 59 of file Reco_4mu.h.

◆ m_fourMuonTool

ToolHandle<DerivationFramework::FourMuonTool> DerivationFramework::Reco_4mu::m_fourMuonTool
private

Definition at line 48 of file Reco_4mu.h.

◆ m_pairName

std::string DerivationFramework::Reco_4mu::m_pairName
private

job options

Definition at line 53 of file Reco_4mu.h.

◆ m_PV_max

int DerivationFramework::Reco_4mu::m_PV_max
private

Definition at line 58 of file Reco_4mu.h.

◆ m_pvContainerName

std::string DerivationFramework::Reco_4mu::m_pvContainerName
private

Definition at line 55 of file Reco_4mu.h.

◆ m_pvRefitter

ToolHandle<Analysis::PrimaryVertexRefitter> DerivationFramework::Reco_4mu::m_pvRefitter
private

Definition at line 49 of file Reco_4mu.h.

◆ m_quadName

std::string DerivationFramework::Reco_4mu::m_quadName
private

Definition at line 54 of file Reco_4mu.h.

◆ m_refitPV

bool DerivationFramework::Reco_4mu::m_refitPV
private

Definition at line 57 of file Reco_4mu.h.

◆ m_refPVContainerName

std::string DerivationFramework::Reco_4mu::m_refPVContainerName
private

Definition at line 56 of file Reco_4mu.h.

◆ m_v0Tools

ToolHandle<Trk::V0Tools> DerivationFramework::Reco_4mu::m_v0Tools
private

Definition at line 47 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
DerivationFramework::Reco_4mu::m_DoVertexType
int m_DoVertexType
Definition: Reco_4mu.h:59
xAOD::VertexAuxContainer_v1
Temporary container used until we have I/O for AuxStoreInternal.
Definition: VertexAuxContainer_v1.h:32
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
DerivationFramework::Reco_4mu::m_pvContainerName
std::string m_pvContainerName
Definition: Reco_4mu.h:55
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:242
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
xAOD::VertexContainer
VertexContainer_v1 VertexContainer
Definition of the current "Vertex container version".
Definition: VertexContainer.h:14
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
DerivationFramework::Reco_4mu::m_pvRefitter
ToolHandle< Analysis::PrimaryVertexRefitter > m_pvRefitter
Definition: Reco_4mu.h:49
DerivationFramework::Reco_4mu::m_PV_max
int m_PV_max
Definition: Reco_4mu.h:58
xAOD::BPhysHypoHelper
Definition: BPhysHypoHelper.h:73
BPHYS_CHECK
#define BPHYS_CHECK(EXP)
Useful CHECK macro.
Definition: BPhysHelper.h:738
DerivationFramework::Reco_4mu::m_pairName
std::string m_pairName
job options
Definition: Reco_4mu.h:53
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:209
DerivationFramework::Reco_4mu::m_v0Tools
ToolHandle< Trk::V0Tools > m_v0Tools
Definition: Reco_4mu.h:47
DerivationFramework::Reco_4mu::m_quadName
std::string m_quadName
Definition: Reco_4mu.h:54
DataModel_detail::iterator
(Non-const) Iterator class for DataVector/DataList.
Definition: DVLIterator.h:184
xAOD::VertexAuxContainer
VertexAuxContainer_v1 VertexAuxContainer
Definition of the current jet auxiliary container.
Definition: VertexAuxContainer.h:19
beamspotman.n
n
Definition: beamspotman.py:727
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
xAOD::BPhysHelper::PV_MIN_A0
@ PV_MIN_A0
Definition: BPhysHelper.h:475
TRT_PAI_gasdata::SC
const float SC[NC]
Cross sections for Carbon.
Definition: TRT_PAI_gasdata.h:255
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
DerivationFramework::Reco_4mu::m_refPVContainerName
std::string m_refPVContainerName
Definition: Reco_4mu.h:56
DataVector
Derived DataVector<T>.
Definition: DataVector.h:794
DerivationFramework::Reco_4mu::m_fourMuonTool
ToolHandle< DerivationFramework::FourMuonTool > m_fourMuonTool
Definition: Reco_4mu.h:48
xAOD::BPhysHelper::vtx
const xAOD::Vertex * vtx() const
Getter method for the cached xAOD::Vertex.
Definition: BPhysHelper.h:108
xAOD::BPhysHelper::PV_MAX_SUM_PT2
@ PV_MAX_SUM_PT2
Definition: BPhysHelper.h:475
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
xAOD::Vertex_v1
Class describing a Vertex.
Definition: Vertex_v1.h:42
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
DerivationFramework::Reco_4mu::m_refitPV
bool m_refitPV
Definition: Reco_4mu.h:57
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
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
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
xAOD::BPhysHelper::PV_MIN_Z0_BA
@ PV_MIN_Z0_BA
Definition: BPhysHelper.h:475
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.