CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes | Friends
hitfit::Fourvec_Event Class Reference

Represent an event for kinematic fitting as a collection of four-momenta. Each object is represented as an instance of FE_Obj. There may be an object for a neutrino. If that is the case, it is always at the end of the object list. It is not included in the count returned by nobjs(). But is is included in nobjs_all(). More...

#include <Fourvec_Event.h>

Public Member Functions

void add (const FE_Obj &obj)
 Add an object to the event. The object should not be a neutrino, use the method set_nu_p for that. More...
 
 Fourvec_Event ()
 Default constructor. More...
 
bool has_neutrino () const
 Return TRUE is this event contains a neutrino, otherwise returns FALSE. More...
 
const Fourveckt () const
 Access the $k_{T}$ four-momentum. More...
 
double kt_x_error () const
 Return the x uncertainty in $k_{T}$. More...
 
double kt_xy_covar () const
 Return the xy covariance in $k_{T}$. More...
 
double kt_y_error () const
 Return the y uncertainty in $k_{T}$. More...
 
int nobjs () const
 Return the number of objects in the event not including any neutrinos. More...
 
int nobjs_all () const
 Return the number of objects in the event including any neutrinos. More...
 
const Fourvecnu () const
 Access the neutrino four-momentum. More...
 
const FE_Objobj (std::vector< FE_Obj >::size_type i) const
 Access object at index i, with the convention that the index starts at 0. More...
 
void set_kt_error (double kt_x_error, double kt_y_error, double kt_xy_covar)
 Set the uncertainties on $k_{T}$. More...
 
void set_nu_p (const Fourvec &p)
 Set the neutrino four-momentum to $p$. This method adds a neutrino if there wasn't already one. More...
 
void set_obj_p (std::vector< FE_Obj >::size_type i, const Fourvec &p)
 Set the four-momentum of object at index i to $p$. More...
 
void set_x_p (const Fourvec &p)
 Set the four-momentum of the $x$ object. More...
 
const Fourvecx () const
 Access the $x$ four-momentum. More...
 

Private Attributes

bool _has_neutrino
 
Fourvec _kt
 
double _kt_x_error
 
double _kt_xy_covar
 
double _kt_y_error
 
std::vector< FE_Obj_objs
 
Fourvec _x
 

Friends

std::ostream & operator<< (std::ostream &s, const Fourvec_Event &fe)
 Output stream operator, print the content of this Fourvec_Event object to an output stream. More...
 

Detailed Description

Represent an event for kinematic fitting as a collection of four-momenta. Each object is represented as an instance of FE_Obj. There may be an object for a neutrino. If that is the case, it is always at the end of the object list. It is not included in the count returned by nobjs(). But is is included in nobjs_all().

We can also record the other $x$ momentum, that will be added into the $k_{T}$ sum. This can be used to store a missing transverse energy that is not attributed to a neutrino but is instead due to mismeasurement. Typically this will be set to zero in events that have a neutrino, and to the measured missing transverse energy in events that do not.

Definition at line 193 of file Fourvec_Event.h.

Constructor & Destructor Documentation

◆ Fourvec_Event()

hitfit::Fourvec_Event::Fourvec_Event ( )

Default constructor.

Definition at line 102 of file Fourvec_Event.cc.

106  : _kt_x_error(0), _kt_y_error(0), _kt_xy_covar(0), _has_neutrino(false) {}

Member Function Documentation

◆ add()

void hitfit::Fourvec_Event::add ( const FE_Obj obj)

Add an object to the event. The object should not be a neutrino, use the method set_nu_p for that.

Parameters
objThe FE_Obj to add.

Definition at line 240 of file Fourvec_Event.cc.

248  {
249  assert(obj.label != nu_label);
250 
251  // Add to the end of the list, but before any neutrino.
252  if (_has_neutrino) {
253  assert(!_objs.empty());
254  _objs.insert(_objs.begin() + _objs.size() - 1, obj);
255  } else
256  _objs.push_back(obj);
257 
258  // Maintain kt.
259  _kt += obj.p;
260  }

References _has_neutrino, _kt, _objs, cms::cuda::assert(), hitfit::FE_Obj::label, hitfit::nu_label, obj(), and hitfit::FE_Obj::p.

Referenced by counter.Counter::register().

◆ has_neutrino()

bool hitfit::Fourvec_Event::has_neutrino ( ) const

Return TRUE is this event contains a neutrino, otherwise returns FALSE.

Definition at line 108 of file Fourvec_Event.cc.

115  {
116  return _has_neutrino;
117  }

References _has_neutrino.

Referenced by hitfit::Fourvec_Constraint_Calculator::eval().

◆ kt()

const Fourvec & hitfit::Fourvec_Event::kt ( ) const

Access the $k_{T}$ four-momentum.

Definition at line 163 of file Fourvec_Event.cc.

167  {
168  return _kt;
169  }

References _kt.

◆ kt_x_error()

double hitfit::Fourvec_Event::kt_x_error ( ) const

Return the x uncertainty in $k_{T}$.

Definition at line 179 of file Fourvec_Event.cc.

186  {
187  return _kt_x_error;
188  }

References _kt_x_error.

Referenced by set_kt_error().

◆ kt_xy_covar()

double hitfit::Fourvec_Event::kt_xy_covar ( ) const

Return the xy covariance in $k_{T}$.

Definition at line 201 of file Fourvec_Event.cc.

208  {
209  return _kt_xy_covar;
210  }

References _kt_xy_covar.

Referenced by set_kt_error().

◆ kt_y_error()

double hitfit::Fourvec_Event::kt_y_error ( ) const

Return the y uncertainty in $k_{T}$.

Definition at line 190 of file Fourvec_Event.cc.

197  {
198  return _kt_y_error;
199  }

References _kt_y_error.

Referenced by set_kt_error().

◆ nobjs()

int hitfit::Fourvec_Event::nobjs ( ) const

Return the number of objects in the event not including any neutrinos.

Definition at line 119 of file Fourvec_Event.cc.

127  {
128  return _objs.size() - (_has_neutrino ? 1 : 0);
129  }

References _has_neutrino, and _objs.

Referenced by hitfit::Fourvec_Constraint_Calculator::eval().

◆ nobjs_all()

int hitfit::Fourvec_Event::nobjs_all ( ) const

Return the number of objects in the event including any neutrinos.

Definition at line 131 of file Fourvec_Event.cc.

138  {
139  return _objs.size();
140  }

References _objs.

◆ nu()

const Fourvec & hitfit::Fourvec_Event::nu ( ) const

Access the neutrino four-momentum.

Definition at line 154 of file Fourvec_Event.cc.

158  {
160  return _objs.back().p;
161  }

References _has_neutrino, _objs, and cms::cuda::assert().

◆ obj()

const FE_Obj & hitfit::Fourvec_Event::obj ( std::vector< FE_Obj >::size_type  i) const

Access object at index i, with the convention that the index starts at 0.

Parameters
iThe index of the desired object.

Definition at line 142 of file Fourvec_Event.cc.

149  {
150  assert(i < _objs.size());
151  return _objs[i];
152  }

References cms::cuda::assert(), and mps_fire::i.

Referenced by add().

◆ set_kt_error()

void hitfit::Fourvec_Event::set_kt_error ( double  kt_x_error,
double  kt_y_error,
double  kt_xy_covar 
)

Set the uncertainties on $k_{T}$.

Parameters
kt_x_errorThe uncertainty in the $x-$component of $k_{T}$.
kt_y_errorThe uncertainty in the $y-$component of $k_{T}$.
kt_xy_covarThe covariance between the $x-$ and $y-$component of $k_{T}$.

Definition at line 310 of file Fourvec_Event.cc.

319  {
323  }

References _kt_x_error, _kt_xy_covar, _kt_y_error, kt_x_error(), kt_xy_covar(), and kt_y_error().

◆ set_nu_p()

void hitfit::Fourvec_Event::set_nu_p ( const Fourvec p)

Set the neutrino four-momentum to $p$. This method adds a neutrino if there wasn't already one.

Parameters
pThe new four-momentum of the neutrino.

Definition at line 262 of file Fourvec_Event.cc.

270  {
271  if (_has_neutrino) {
272  _kt -= _objs.back().p;
273  _objs.back().p = p;
274  } else {
275  _has_neutrino = true;
276  _objs.push_back(FE_Obj(p, 0, nu_label, 0, 0, 0, false));
277  }
278 
279  _kt += p;
280  }

References _has_neutrino, _kt, _objs, hitfit::nu_label, and AlCaHLTBitMon_ParallelJobs::p.

◆ set_obj_p()

void hitfit::Fourvec_Event::set_obj_p ( std::vector< FE_Obj >::size_type  i,
const Fourvec p 
)

Set the four-momentum of object at index i to $p$.

Parameters
iThe position index of the object to change.
pThe new four-momentum of object at index i.

Definition at line 282 of file Fourvec_Event.cc.

290  {
291  assert(i < _objs.size());
292  _kt -= _objs[i].p;
293  _objs[i].p = p;
294  _kt += p;
295  }

References _kt, _objs, cms::cuda::assert(), mps_fire::i, and AlCaHLTBitMon_ParallelJobs::p.

◆ set_x_p()

void hitfit::Fourvec_Event::set_x_p ( const Fourvec p)

Set the four-momentum of the $x$ object.

Parameters
pThe new four-momentum of the $x$ object.

Definition at line 297 of file Fourvec_Event.cc.

304  {
305  _kt -= _x;
306  _x = p;
307  _kt += p;
308  }

References _kt, _x, and AlCaHLTBitMon_ParallelJobs::p.

◆ x()

const Fourvec & hitfit::Fourvec_Event::x ( ) const

Access the $x$ four-momentum.

Definition at line 171 of file Fourvec_Event.cc.

175  {
176  return _x;
177  }

References _x.

Referenced by svgfig.Curve.Sample::__repr__(), svgfig.Ellipse::__repr__(), geometryXMLparser.Alignable::pos(), ntupleDataFormat._HitObject::r(), and ntupleDataFormat._HitObject::r3D().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  s,
const Fourvec_Event fe 
)
friend

Output stream operator, print the content of this Fourvec_Event object to an output stream.

Parameters
sThe stream to which to write.
feThe instance of Fourvec_Event to be printed.

Definition at line 220 of file Fourvec_Event.cc.

231  {
232  s << "kt: (" << fe._kt.x() << ", " << fe._kt.y() << "); "
233  << " error: " << fe._kt_x_error << " " << fe._kt_y_error << " " << fe._kt_xy_covar << "\n";
234  s << "x: " << fe._x << "\n";
235  for (unsigned i = 0; i < fe._objs.size(); i++)
236  s << i + 1 << ": " << fe._objs[i];
237  return s;
238  }

Member Data Documentation

◆ _has_neutrino

bool hitfit::Fourvec_Event::_has_neutrino
private

Flag that a neutrino has been added to the event.

Definition at line 372 of file Fourvec_Event.h.

Referenced by add(), has_neutrino(), nobjs(), nu(), and set_nu_p().

◆ _kt

Fourvec hitfit::Fourvec_Event::_kt
private

Cached $k_{T}$, this should always be equal to the sum of all the object momenta, including $x$.

Definition at line 345 of file Fourvec_Event.h.

Referenced by add(), kt(), hitfit::operator<<(), set_nu_p(), set_obj_p(), and set_x_p().

◆ _kt_x_error

double hitfit::Fourvec_Event::_kt_x_error
private

The uncertainty in the $x-$component of $k_{T}$.

Definition at line 356 of file Fourvec_Event.h.

Referenced by kt_x_error(), hitfit::operator<<(), and set_kt_error().

◆ _kt_xy_covar

double hitfit::Fourvec_Event::_kt_xy_covar
private

The covariance between the $x-$ and $y-$component of $k_{T}$.

Definition at line 366 of file Fourvec_Event.h.

Referenced by kt_xy_covar(), hitfit::operator<<(), and set_kt_error().

◆ _kt_y_error

double hitfit::Fourvec_Event::_kt_y_error
private

The uncertainty in the $y-$component of $k_{T}$.

Definition at line 360 of file Fourvec_Event.h.

Referenced by kt_y_error(), hitfit::operator<<(), and set_kt_error().

◆ _objs

std::vector<FE_Obj> hitfit::Fourvec_Event::_objs
private

The list of contained objects in the event.

Definition at line 337 of file Fourvec_Event.h.

Referenced by add(), nobjs(), nobjs_all(), nu(), hitfit::operator<<(), set_nu_p(), and set_obj_p().

◆ _x

Fourvec hitfit::Fourvec_Event::_x
private

Four-momentum of the $x$ object.

Definition at line 351 of file Fourvec_Event.h.

Referenced by plotting.PlotText::Draw(), hitfit::operator<<(), set_x_p(), and x().

mps_fire.i
i
Definition: mps_fire.py:428
cms::cuda::assert
assert(be >=bs)
hitfit::Fourvec_Event::obj
const FE_Obj & obj(std::vector< FE_Obj >::size_type i) const
Access object at index i, with the convention that the index starts at 0.
Definition: Fourvec_Event.cc:142
hitfit::Fourvec_Event::_kt
Fourvec _kt
Definition: Fourvec_Event.h:345
alignCSCRings.s
s
Definition: alignCSCRings.py:92
hitfit::Fourvec_Event::kt_y_error
double kt_y_error() const
Return the y uncertainty in .
Definition: Fourvec_Event.cc:190
hitfit::Fourvec_Event::_objs
std::vector< FE_Obj > _objs
Definition: Fourvec_Event.h:337
hitfit::Fourvec_Event::kt_x_error
double kt_x_error() const
Return the x uncertainty in .
Definition: Fourvec_Event.cc:179
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
hitfit::FE_Obj::label
int label
Definition: Fourvec_Event.h:114
hitfit::Fourvec_Event::_kt_xy_covar
double _kt_xy_covar
Definition: Fourvec_Event.h:366
hitfit::Fourvec_Event::_kt_x_error
double _kt_x_error
Definition: Fourvec_Event.h:356
hitfit::nu_label
const int nu_label
Definition: Fourvec_Event.h:178
hitfit::FE_Obj::p
Fourvec p
Definition: Fourvec_Event.h:100
hitfit::Fourvec_Event::kt_xy_covar
double kt_xy_covar() const
Return the xy covariance in .
Definition: Fourvec_Event.cc:201
hitfit::Fourvec_Event::_kt_y_error
double _kt_y_error
Definition: Fourvec_Event.h:360
hitfit::Fourvec_Event::_x
Fourvec _x
Definition: Fourvec_Event.h:351
hitfit::Fourvec_Event::_has_neutrino
bool _has_neutrino
Definition: Fourvec_Event.h:372