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