Loading [MathJax]/extensions/tex2jax.js
ATLAS Offline Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
BPhysHypoHelper.cxx
Go to the documentation of this file.
1 /*
2  Copyright (C) 2002-2024 CERN for the benefit of the ATLAS collaboration
3 */
4 
11 #include "xAODTracking/Vertex.h"
13 
14 /*****************************************************************************/
15 
20 /*****************************************************************************/
21 float xAOD::BPhysHypoHelper::get_float( const std::string& name ) const
22 {
24  if(!floatAcc.isAvailable(*m_b)) return -9999999.;
25  return floatAcc(*m_b);
26 }
27 /*****************************************************************************/
28 bool xAOD::BPhysHypoHelper::set_float( const std::string& name, float val )
29 {
30  SG::Decorator<float> floatDec(name);
31  floatDec(*m_b) = val;
32  if (m_decors) {
33  m_decors->insert (floatDec.auxid());
34  }
35  return true;
36 }
37 /*****************************************************************************/
38 
41 /*****************************************************************************/
43 {
44  return get_float( m_hypo+"_mass" );
45 }
46 /*****************************************************************************/
48 {
49  return get_float( m_hypo+"_massErr" );
50 }
51 /*****************************************************************************/
53 {
54  return set_float( m_hypo+"_mass", val );
55 }
56 /*****************************************************************************/
58 {
59  return set_float( m_hypo+"_massErr", val );
60 }
61 /*****************************************************************************/
62 bool xAOD::BPhysHypoHelper::setMass(std::span<const double> trkMasses)
63 {
64  // get 4-vector
65  TLorentzVector P = totalP(trkMasses);
66  if( P == TLorentzVector(0,0,0,0) )
67  return false;
68 
69  // set mass:
70  return setMass(P.M());
71 }
72 /*****************************************************************************/
74 {
75  switch(vertexType) {
76  case PV_MAX_SUM_PT2: {
77  switch(tauType) {
78  case TAU_CONST_MASS : return get_float(m_hypo+"_TauConstMassPVMaxSumPt2");
79  case TAU_INV_MASS : return get_float(m_hypo+"_TauInvMassPVMaxSumPt2");
80  default: return -9999999.;
81  }
82  }
83  case PV_MIN_A0: {
84  switch(tauType) {
85  case TAU_CONST_MASS : return get_float(m_hypo+"_TauConstMassPVMinA0");
86  case TAU_INV_MASS : return get_float(m_hypo+"_TauInvMassPVMinA0");
87  default: return -9999999.;
88  }
89  }
90  case PV_MIN_Z0: {
91  switch(tauType) {
92  case TAU_CONST_MASS : return get_float(m_hypo+"_TauConstMassPVMinZ0");
93  case TAU_INV_MASS : return get_float(m_hypo+"_TauInvMassPVMinZ0");
94  default: return -9999999.;
95  }
96  }
97  case PV_MIN_Z0_BA: {
98  switch(tauType) {
99  case TAU_CONST_MASS : return get_float(m_hypo+"_TauConstMassPVMinZ0BA");
100  case TAU_INV_MASS : return get_float(m_hypo+"_TauInvMassPVMinZ0BA");
101  default: return -9999999.;
102  }
103  }
104  default: return -9999999.;
105  }
106 }
107 /*****************************************************************************/
109 {
110  switch(vertexType) {
111  case PV_MAX_SUM_PT2: {
112  switch(tauType) {
113  case TAU_CONST_MASS : return get_float(m_hypo+"_TauErrConstMassPVMaxSumPt2");
114  case TAU_INV_MASS : return get_float(m_hypo+"_TauErrInvMassPVMaxSumPt2");
115  default: return -9999999.;
116  }
117  }
118  case PV_MIN_A0: {
119  switch(tauType) {
120  case TAU_CONST_MASS : return get_float(m_hypo+"_TauErrConstMassPVMinA0");
121  case TAU_INV_MASS : return get_float(m_hypo+"_TauErrInvMassPVMinA0");
122  default: return -9999999.;
123  }
124  }
125  case PV_MIN_Z0: {
126  switch(tauType) {
127  case TAU_CONST_MASS : return get_float(m_hypo+"_TauErrConstMassPVMinZ0");
128  case TAU_INV_MASS : return get_float(m_hypo+"_TauErrInvMassPVMinZ0");
129  default: return -9999999.;
130  }
131  }
132  case PV_MIN_Z0_BA: {
133  switch(tauType) {
134  case TAU_CONST_MASS : return get_float(m_hypo+"_TauErrConstMassPVMinZ0BA");
135  case TAU_INV_MASS : return get_float(m_hypo+"_TauErrInvMassPVMinZ0BA");
136  default: return -9999999.;
137  }
138  }
139  default: return -9999999.;
140  }
141 }
142 /*****************************************************************************/
143 bool xAOD::BPhysHypoHelper::setTau(const float val, const pv_type vertexType, const tau_type tauType)
144 {
145  switch(vertexType) {
146  case PV_MAX_SUM_PT2: {
147  switch(tauType) {
148  case TAU_CONST_MASS : return set_float(m_hypo+"_TauConstMassPVMaxSumPt2", val);
149  case TAU_INV_MASS : return set_float(m_hypo+"_TauInvMassPVMaxSumPt2", val);
150  default: return false;
151  }
152  }
153  case PV_MIN_A0: {
154  switch(tauType) {
155  case TAU_CONST_MASS : return set_float(m_hypo+"_TauConstMassPVMinA0", val);
156  case TAU_INV_MASS : return set_float(m_hypo+"_TauInvMassPVMinA0", val);
157  default: return false;
158  }
159  }
160  case PV_MIN_Z0: {
161  switch(tauType) {
162  case TAU_CONST_MASS : return set_float(m_hypo+"_TauConstMassPVMinZ0", val);
163  case TAU_INV_MASS : return set_float(m_hypo+"_TauInvMassPVMinZ0", val);
164  default: return false;
165  }
166  }
167  case PV_MIN_Z0_BA: {
168  switch(tauType) {
169  case TAU_CONST_MASS : return set_float(m_hypo+"_TauConstMassPVMinZ0BA", val);
170  case TAU_INV_MASS : return set_float(m_hypo+"_TauInvMassPVMinZ0BA", val);
171  default: return false;
172  }
173  }
174  default: return false;
175  }
176 
177 }
178 /*****************************************************************************/
179 bool xAOD::BPhysHypoHelper::setTauErr(const float val, const pv_type vertexType, const tau_type tauType)
180 {
181  switch(vertexType) {
182  case PV_MAX_SUM_PT2: {
183  switch(tauType) {
184  case TAU_CONST_MASS : return set_float(m_hypo+"_TauErrConstMassPVMaxSumPt2", val);
185  case TAU_INV_MASS : return set_float(m_hypo+"_TauErrInvMassPVMaxSumPt2", val);
186  default: return false;
187  }
188  }
189  case PV_MIN_A0: {
190  switch(tauType) {
191  case TAU_CONST_MASS : return set_float(m_hypo+"_TauErrConstMassPVMinA0", val);
192  case TAU_INV_MASS : return set_float(m_hypo+"_TauErrInvMassPVMinA0", val);
193  default: return false;
194  }
195  }
196  case PV_MIN_Z0: {
197  switch(tauType) {
198  case TAU_CONST_MASS : return set_float(m_hypo+"_TauErrConstMassPVMinZ0", val);
199  case TAU_INV_MASS : return set_float(m_hypo+"_TauErrInvMassPVMinZ0", val);
200  default: return false;
201  }
202  }
203  case PV_MIN_Z0_BA: {
204  switch(tauType) {
205  case TAU_CONST_MASS : return set_float(m_hypo+"_TauErrConstMassPVMinZ0BA", val);
206  case TAU_INV_MASS : return set_float(m_hypo+"_TauErrInvMassPVMinZ0BA", val);
207  default: return false;
208  }
209  }
210  default: return false;
211  }
212 }
213 
214 //3dTauValues
215 /*****************************************************************************/
217 {
218  switch(vertexType) {
219  case PV_MAX_SUM_PT2: {
220  switch(tauType) {
221  case TAU_CONST_MASS : return get_float(m_hypo+"_Tau3dConstMassPVMaxSumPt2");
222  case TAU_INV_MASS : return get_float(m_hypo+"_Tau3dInvMassPVMaxSumPt2");
223  default: return -9999999.;
224  }
225  }
226  case PV_MIN_A0: {
227  switch(tauType) {
228  case TAU_CONST_MASS : return get_float(m_hypo+"_Tau3dConstMassPVMinA0");
229  case TAU_INV_MASS : return get_float(m_hypo+"_Tau3dInvMassPVMinA0");
230  default: return -9999999.;
231  }
232  }
233  case PV_MIN_Z0: {
234  switch(tauType) {
235  case TAU_CONST_MASS : return get_float(m_hypo+"_Tau3dConstMassPVMinZ0");
236  case TAU_INV_MASS : return get_float(m_hypo+"_Tau3dInvMassPVMinZ0");
237  default: return -9999999.;
238  }
239  }
240  case PV_MIN_Z0_BA: {
241  switch(tauType) {
242  case TAU_CONST_MASS : return get_float(m_hypo+"_Tau3dConstMassPVMinZ0BA");
243  case TAU_INV_MASS : return get_float(m_hypo+"_Tau3dInvMassPVMinZ0BA");
244  default: return -9999999.;
245  }
246  }
247  default: return -9999999.;
248  }
249 }
250 /*****************************************************************************/
252 {
253  switch(vertexType) {
254  case PV_MAX_SUM_PT2: {
255  switch(tauType) {
256  case TAU_CONST_MASS : return get_float(m_hypo+"_Tau3dErrConstMassPVMaxSumPt2");
257  case TAU_INV_MASS : return get_float(m_hypo+"_Tau3dErrInvMassPVMaxSumPt2");
258  default: return -9999999.;
259  }
260  }
261  case PV_MIN_A0: {
262  switch(tauType) {
263  case TAU_CONST_MASS : return get_float(m_hypo+"_Tau3dErrConstMassPVMinA0");
264  case TAU_INV_MASS : return get_float(m_hypo+"_Tau3dErrInvMassPVMinA0");
265  default: return -9999999.;
266  }
267  }
268  case PV_MIN_Z0: {
269  switch(tauType) {
270  case TAU_CONST_MASS : return get_float(m_hypo+"_Tau3dErrConstMassPVMinZ0");
271  case TAU_INV_MASS : return get_float(m_hypo+"_Tau3dErrInvMassPVMinZ0");
272  default: return -9999999.;
273  }
274  }
275  case PV_MIN_Z0_BA: {
276  switch(tauType) {
277  case TAU_CONST_MASS : return get_float(m_hypo+"_Tau3dErrConstMassPVMinZ0BA");
278  case TAU_INV_MASS : return get_float(m_hypo+"_Tau3dErrInvMassPVMinZ0BA");
279  default: return -9999999.;
280  }
281  }
282  default: return -9999999.;
283  }
284 }
285 /*****************************************************************************/
286 bool xAOD::BPhysHypoHelper::setTau3d(const float val, const pv_type vertexType, const tau_type tauType)
287 {
288  switch(vertexType) {
289  case PV_MAX_SUM_PT2: {
290  switch(tauType) {
291  case TAU_CONST_MASS : return set_float(m_hypo+"_Tau3dConstMassPVMaxSumPt2", val);
292  case TAU_INV_MASS : return set_float(m_hypo+"_Tau3dInvMassPVMaxSumPt2", val);
293  default: return false;
294  }
295  }
296  case PV_MIN_A0: {
297  switch(tauType) {
298  case TAU_CONST_MASS : return set_float(m_hypo+"_Tau3dConstMassPVMinA0", val);
299  case TAU_INV_MASS : return set_float(m_hypo+"_Tau3dInvMassPVMinA0", val);
300  default: return false;
301  }
302  }
303  case PV_MIN_Z0: {
304  switch(tauType) {
305  case TAU_CONST_MASS : return set_float(m_hypo+"_Tau3dConstMassPVMinZ0", val);
306  case TAU_INV_MASS : return set_float(m_hypo+"_Tau3dInvMassPVMinZ0", val);
307  default: return false;
308  }
309  }
310  case PV_MIN_Z0_BA: {
311  switch(tauType) {
312  case TAU_CONST_MASS : return set_float(m_hypo+"_Tau3dConstMassPVMinZ0BA", val);
313  case TAU_INV_MASS : return set_float(m_hypo+"_Tau3dInvMassPVMinZ0BA", val);
314  default: return false;
315  }
316  }
317  default: return false;
318  }
319 
320 }
321 /*****************************************************************************/
322 bool xAOD::BPhysHypoHelper::setTau3dErr(const float val, const pv_type vertexType, const tau_type tauType)
323 {
324  switch(vertexType) {
325  case PV_MAX_SUM_PT2: {
326  switch(tauType) {
327  case TAU_CONST_MASS : return set_float(m_hypo+"_Tau3dErrConstMassPVMaxSumPt2", val);
328  case TAU_INV_MASS : return set_float(m_hypo+"_Tau3dErrInvMassPVMaxSumPt2", val);
329  default: return false;
330  }
331  }
332  case PV_MIN_A0: {
333  switch(tauType) {
334  case TAU_CONST_MASS : return set_float(m_hypo+"_Tau3dErrConstMassPVMinA0", val);
335  case TAU_INV_MASS : return set_float(m_hypo+"_Tau3dErrInvMassPVMinA0", val);
336  default: return false;
337  }
338  }
339  case PV_MIN_Z0: {
340  switch(tauType) {
341  case TAU_CONST_MASS : return set_float(m_hypo+"_Tau3dErrConstMassPVMinZ0", val);
342  case TAU_INV_MASS : return set_float(m_hypo+"_Tau3dErrInvMassPVMinZ0", val);
343  default: return false;
344  }
345  }
346  case PV_MIN_Z0_BA: {
347  switch(tauType) {
348  case TAU_CONST_MASS : return set_float(m_hypo+"_Tau3dErrConstMassPVMinZ0BA", val);
349  case TAU_INV_MASS : return set_float(m_hypo+"_Tau3dErrInvMassPVMinZ0BA", val);
350  default: return false;
351  }
352  }
353  default: return false;
354  }
355 }
356 //End of 3dTau
357 
358 
359 
360 /*****************************************************************************/
362 {
363  SG::ConstAccessor<Char_t> flagAcc("passed_"+m_hypo);
364  return flagAcc.isAvailable(*m_b) && flagAcc(*m_b) != 0;
365 }
366 /*****************************************************************************/
368 {
369  SG::Decorator<Char_t> flagDec("passed_"+m_hypo);
370  flagDec(*m_b) = passVal;
371  if (m_decors) {
372  m_decors->insert(flagDec.auxid());
373  }
374  return true;
375 }
376 /*****************************************************************************/
xAOD::BPhysHypoHelper::setMass
bool setMass(const float val)
Set given invariant mass and its error.
Definition: BPhysHypoHelper.cxx:52
xAOD::name
name
Definition: TriggerMenuJson_v1.cxx:29
xAOD::BPhysHypoHelper::setTau3dErr
bool setTau3dErr(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:322
xAOD::BPhysHypoHelper::tauErr
float tauErr(const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
proper decay time error
Definition: BPhysHypoHelper.cxx:108
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
DMTest::P
P_v1 P
Definition: P.h:23
xAOD::BPhysHypoHelper::tau
float tau(const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
: Get the proper decay time and error.
Definition: BPhysHypoHelper.cxx:73
xAOD::BPhysHypoHelper::pass
bool pass() const
get the pass flag for this hypothesis
Definition: BPhysHypoHelper.cxx:361
SG::ConstAccessor< float >
SG::Decorator::auxid
SG::auxid_t auxid() const
Return the aux id for this variable.
xAOD::BPhysHypoHelper::massErr
float massErr() const
invariant mass error
Definition: BPhysHypoHelper.cxx:47
xAOD::BPhysHypoHelper::tau3dErr
float tau3dErr(const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
proper decay time error
Definition: BPhysHypoHelper.cxx:251
xAOD::BPhysHypoHelper::mass
float mass() const
Get invariant mass and its error.
Definition: BPhysHypoHelper.cxx:42
xAOD::BPhysHelper::pv_type
pv_type
: Enum type of the PV
Definition: BPhysHelper.h:475
SG::Decorator< float >
xAOD::BPhysHypoHelper::setPass
bool setPass(bool passVal)
get the pass flag for this hypothesis
Definition: BPhysHypoHelper.cxx:367
xAOD::BPhysHelper::m_b
const xAOD::Vertex * m_b
Cached B decay xAOD vertex.
Definition: BPhysHelper.h:674
BPhysHypoHelper.h
: B-physics xAOD helpers.
Vertex.h
xAOD::BPhysHypoHelper::set_float
bool set_float(const std::string &name, float val)
Definition: BPhysHypoHelper.cxx:28
xAOD::BPhysHypoHelper::setTau3d
bool setTau3d(const float val, const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
proper decay time
Definition: BPhysHypoHelper.cxx:286
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:228
xAOD::vertexType
vertexType
Definition: Vertex_v1.cxx:166
TrackParticle.h
VertexContainer.h
xAOD::BPhysHypoHelper::get_float
float get_float(const std::string &name) const
Definition: BPhysHypoHelper.cxx:21
xAOD::BPhysHypoHelper::tau3d
float tau3d(const pv_type vertexType=BPhysHelper::PV_MIN_A0, const tau_type tauType=BPhysHypoHelper::TAU_CONST_MASS)
proper decay time
Definition: BPhysHypoHelper.cxx:216
Pythia8_RapidityOrderMPI.val
val
Definition: Pythia8_RapidityOrderMPI.py:14
xAOD::BPhysHypoHelper::tau_type
tau_type
: Enum type the proper decay time calculation
Definition: BPhysHypoHelper.h:140
SG::ConstAccessor::isAvailable
bool isAvailable(const ELT &e) const
Test to see if this variable exists in the store.
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::BPhysHypoHelper::setMassErr
bool setMassErr(const float val)
invariant mass error
Definition: BPhysHypoHelper.cxx:57