ATLAS Offline Software
TrigL2Bphys.cxx
Go to the documentation of this file.
1 // -*- C++ -*-
2 
3 /*
4  Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
5 */
6 
7 
26 
27 
28 // default constructor
30  m_roiID(-1), m_particleType(PHIKK), m_eta(0), m_phi(0),
31  m_mass(0), m_fitmass(-99.), m_fitchi2(-99.), m_fitndof(-99),
32  m_fitx(-99.), m_fity(-99.), m_fitz(-99),
33  m_secondaryDecay(), m_trackVector()
34 {}
35 
36 
38  float mass, const ElementLink<TrigL2BphysContainer>& sDecay):
39  m_roiID(roi),
40  m_particleType(particleType),
41  m_eta(eta), m_phi(phi), m_mass(mass),
42  m_fitmass(-99.), m_fitchi2(-99.), m_fitndof(-99),m_fitx(-99.), m_fity(-99.), m_fitz(-99.),
43  m_secondaryDecay(sDecay),
44  m_trackVector()
45 {}
46 
47 
48 TrigL2Bphys::TrigL2Bphys(int roi, float eta, float phi, pType particleType, float mass):
49  m_roiID(roi),
50  m_particleType(particleType),
51  m_eta(eta), m_phi(phi),
52  m_mass(mass), m_fitmass(-99.), m_fitchi2(-99.), m_fitndof(-99), m_fitx(-99.),
53  m_fity(-99.), m_fitz(-99.), m_secondaryDecay(), m_trackVector()
54 {}
55 
56 
57 
59 {
61 }
62 
64 {
65  m_secondaryDecay=p_secondaryDecay;
66 }
67 
69 {
70  return m_secondaryDecay;
71 }
72 
73 
74 void TrigL2Bphys::fitmass(float FitMass)
75 {
76  m_fitmass = FitMass;
77 }
78 
79 void TrigL2Bphys::fitchi2(float FitChi2)
80 {
81  m_fitchi2 = FitChi2;
82 }
83 
84 void TrigL2Bphys::fitndof(int FitNdof)
85 {
86  m_fitndof = FitNdof;
87 }
88 
89 void TrigL2Bphys::fitx(float FitX)
90 {
91  m_fitx = FitX;
92 }
93 void TrigL2Bphys::fity(float FitY)
94 {
95  m_fity = FitY;
96 }
97 void TrigL2Bphys::fitz(float FitZ)
98 {
99  m_fitz = FitZ;
100 }
101 
102 
103 std::string str( const TrigL2Bphys& p )
104 {
105  std::stringstream ss;
106 
107  ss << "RoI_ID: "<<p.roiId()
108  << "Particle type: "<<p.particleType()
109  << "eta: "<<p.eta()
110  << "phi: "<<p.phi()
111  << "mass: "<<p.mass()
112  << "mass after fit: "<<p.fitmass()
113  << "fit chi2: "<<p.fitchi2()
114  << "fit ndof: "<<p.fitndof()
115  << "x: "<<p.fitx()
116  << "y: "<<p.fity()
117  << "z: "<<p.fitz();
118  return ss.str();
119 }
120 
121 MsgStream& operator<< ( MsgStream& m, const TrigL2Bphys& p )
122 {
123  m << str(p);
124  return m;
125 }
126 
127 bool operator== ( const TrigL2Bphys& a, const TrigL2Bphys& b )
128 {
129  const double epsilon = 1e-8;
130 
131  int aHasSD = (a.pSecondDecay()!=NULL)?1:0;
132  int bHasSD = (b.pSecondDecay()!=NULL)?1:0;
133  if((aHasSD+bHasSD)==1)
134  return false;
135 
136  if(a.trackVector().size()!=b.trackVector().size())
137  return false;
138 
139  if(a.roiId() != b.roiId()) return false;
140  if(a.particleType() != b.particleType()) return false;
141  if(a.fitndof() != b.fitndof()) return false;
142 
143  if(fabs(a.eta()-b.eta())>epsilon) return false;
144  if(fabs(a.phi()-b.phi())>epsilon) return false;
145  if(fabs(a.mass()-b.mass())>epsilon) return false;
146  if(fabs(a.fitmass()-b.fitmass())>epsilon) return false;
147  if(fabs(a.fitchi2()-b.fitchi2())>epsilon) return false;
148  if(fabs(a.fitx()-b.fitx())>epsilon) return false;
149  if(fabs(a.fity()-b.fity())>epsilon) return false;
150  if(fabs(a.fitz()-b.fitz())>epsilon) return false;
151 
152  if((aHasSD+bHasSD)==2)
153  {
154  if (!((*a.pSecondDecay())==(*b.pSecondDecay())))
155  return false;
156  }
157  return true;
158 }
159 
160 void diff( const TrigL2Bphys& a, const TrigL2Bphys& b, std::map<std::string, double>& variableChange )
161 {
162  variableChange["eta"] = a.eta() - b.eta();
163  variableChange["phi"] = a.phi() - b.phi();
164  variableChange["mass"] = a.mass() - b.mass();
165  variableChange["fitmass"] = a.fitmass() - b.fitmass();
166  variableChange["fitchi2"] = a.fitchi2() - b.fitchi2();
167  variableChange["x"] = a.fitx() - b.fitx();
168  variableChange["y"] = a.fity() - b.fity();
169  variableChange["z"] = a.fitz() - b.fitz();
170 }
171 
172 
174 {
175  if (m_secondaryDecay.isValid()) {
176  return *m_secondaryDecay;
177  } else {
178  return NULL;
179  }
180 }
TrigL2Bphys::fitndof
int fitndof() const
accessor method: ndof from vertex fit
Definition: TrigL2Bphys.h:80
TrigL2Bphys::m_fity
float m_fity
Definition: TrigL2Bphys.h:125
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
python.SystemOfUnits.m
int m
Definition: SystemOfUnits.py:91
PowhegControl_ttHplus_NLO.ss
ss
Definition: PowhegControl_ttHplus_NLO.py:83
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
Base_Fragment.mass
mass
Definition: Sherpa_i/share/common/Base_Fragment.py:59
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
operator==
bool operator==(const TrigL2Bphys &a, const TrigL2Bphys &b)
Definition: TrigL2Bphys.cxx:127
diff
void diff(const TrigL2Bphys &a, const TrigL2Bphys &b, std::map< std::string, double > &variableChange)
comparison with feedback Function compares two objects and returns "semi verbose" output in the form ...
Definition: TrigL2Bphys.cxx:160
TrigL2Bphys::addTrack
void addTrack(const ElementLink< TrigInDetTrackCollection > &track)
set method: add track to particle
Definition: TrigL2Bphys.cxx:58
TrigL2Bphys::fitchi2
float fitchi2() const
accessor method: chi2 from vertex fit
Definition: TrigL2Bphys.h:78
TrigL2Bphys::m_fitx
float m_fitx
Definition: TrigL2Bphys.h:124
TrigL2Bphys
Definition: TrigL2Bphys.h:43
particleType
Definition: particleType.h:29
TrigL2Bphys::m_fitchi2
float m_fitchi2
Definition: TrigL2Bphys.h:122
TrigL2Bphys::fitz
float fitz() const
accessor method: z position of vertex
Definition: TrigL2Bphys.h:86
TrigL2BphysContainer.h
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
TrigL2Bphys::m_trackVector
ElementLinkVector< TrigInDetTrackCollection > m_trackVector
Definition: TrigL2Bphys.h:128
TrigL2Bphys::fity
float fity() const
accessor method: y position of vertex
Definition: TrigL2Bphys.h:84
TrigL2Bphys::m_fitmass
float m_fitmass
Definition: TrigL2Bphys.h:121
operator<<
MsgStream & operator<<(MsgStream &m, const TrigL2Bphys &p)
Definition: TrigL2Bphys.cxx:121
TrigL2Bphys::fitx
float fitx() const
accessor method: x position of vertex
Definition: TrigL2Bphys.h:82
ElementLinkVector::push_back
void push_back(const ElemLink &link)
Definition: AthLinks/ElementLinkVector.h:318
TrigL2Bphys::secondaryDecayLink
const ElementLink< TrigL2BphysContainer > & secondaryDecayLink() const
Definition: TrigL2Bphys.cxx:68
TrigL2Bphys::pType
pType
enum for different particle types
Definition: TrigL2Bphys.h:47
TrigL2Bphys::m_secondaryDecay
ElementLink< TrigL2BphysContainer > m_secondaryDecay
Definition: TrigL2Bphys.h:127
plotBeamSpotMon.b
b
Definition: plotBeamSpotMon.py:77
a
TList * a
Definition: liststreamerinfos.cxx:10
TrigL2Bphys.h
TrigL2Bphys::m_fitz
float m_fitz
Definition: TrigL2Bphys.h:126
TrigL2Bphys::fitmass
float fitmass() const
accessor method: mass from vertex fit
Definition: TrigL2Bphys.h:76
TrigL2Bphys::pSecondDecay
const TrigL2Bphys * pSecondDecay() const
accessor method: secondary decay particle
Definition: TrigL2Bphys.cxx:173
TrigL2Bphys::TrigL2Bphys
TrigL2Bphys()
constructors; note: default constructor needed by POOL
Definition: TrigL2Bphys.cxx:29
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
TrigL2Bphys::m_fitndof
int m_fitndof
Definition: TrigL2Bphys.h:123
str
std::string str(const TrigL2Bphys &p)
Definition: TrigL2Bphys.cxx:103