test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
BasicMultiTrajectoryState Class Reference

#include <BasicMultiTrajectoryState.h>

Inheritance diagram for BasicMultiTrajectoryState:
BasicTrajectoryState

Public Member Functions

 BasicMultiTrajectoryState (const std::vector< TSOS > &tsvec)
 
 BasicMultiTrajectoryState ()
 
virtual bool canUpdateLocalParameters () const
 
pointer clone () const override
 
virtual std::vector
< TrajectoryStateOnSurface
components () const
 
void rescaleError (double factor)
 
virtual void update (const LocalTrajectoryParameters &p, const Surface &aSurface, const MagneticField *field, const SurfaceSide side) override
 
virtual void update (double weight, const LocalTrajectoryParameters &p, const LocalTrajectoryError &err, const Surface &aSurface, const MagneticField *field, const SurfaceSide side) override
 
- Public Member Functions inherited from BasicTrajectoryState
 BasicTrajectoryState ()
 
 BasicTrajectoryState (const SurfaceType &aSurface)
 construct invalid trajectory state (without parameters) More...
 
const CartesianTrajectoryError cartesianError () const
 
TrackCharge charge () const
 
const CurvilinearTrajectoryErrorcurvilinearError () const
 
FreeTrajectoryState const * freeTrajectoryState (bool withErrors=true) const
 
GlobalVector globalDirection () const
 
GlobalVector globalMomentum () const
 
const GlobalTrajectoryParametersglobalParameters () const
 
GlobalPoint globalPosition () const
 
bool hasError () const
 
bool isValid () const
 
LocalVector localDirection () const
 
const LocalTrajectoryErrorlocalError () const
 
LocalVector localMomentum () const
 
const LocalTrajectoryParameterslocalParameters () const
 
LocalPoint localPosition () const
 
const MagneticFieldmagneticField () const
 
void rescaleError (double factor)
 
CurvilinearTrajectoryErrorsetCurvilinearError ()
 
double signedInverseMomentum () const
 
const SurfaceTypesurface () const
 
SurfaceSide surfaceSide () const
 Position relative to material, defined relative to momentum vector. More...
 
double transverseCurvature () const
 
virtual void update (const LocalTrajectoryParameters &p, const SurfaceSide side)
 
virtual void update (const LocalTrajectoryParameters &p, const LocalTrajectoryError &err, const SurfaceSide side)
 
double weight () const
 
virtual ~BasicTrajectoryState ()
 

Private Types

typedef TrajectoryStateOnSurface TSOS
 

Private Member Functions

void combine ()
 

Private Attributes

std::vector< TSOStheStates
 

Additional Inherited Members

- Public Types inherited from BasicTrajectoryState
typedef BasicTrajectoryState BTSOS
 
typedef Proxy::pointer pointer
 
typedef ProxyBase11< BTSOSProxy
 
typedef
SurfaceSideDefinition::SurfaceSide 
SurfaceSide
 
typedef Surface SurfaceType
 

Detailed Description

Class which combines a set of components of a Gaussian mixture into a single component. Given all the components of a mixture, it calculates the mean and covariance matrix of the entire mixture. This combiner class can also be used in the process of transforming a Gaussian mixture into another Gaussian mixture with a smaller number of components. The relevant formulas can be found in R. Fruhwirth, Computer Physics Communications 100 (1997), 1.

Definition at line 17 of file BasicMultiTrajectoryState.h.

Member Typedef Documentation

Definition at line 19 of file BasicMultiTrajectoryState.h.

Constructor & Destructor Documentation

BasicMultiTrajectoryState::BasicMultiTrajectoryState ( const std::vector< TSOS > &  tsvec)
explicit

Definition at line 8 of file BasicMultiTrajectoryState.cc.

References combine(), edm::hlt::Exception, i, and unlikely.

8  :
9  BasicTrajectoryState(tsvec.front().surface()), theStates(tsvec) {
10 
11  // only accept planes!!
12  const BoundPlane* bp = dynamic_cast<const BoundPlane*>(&tsvec.begin()->surface());
13  if unlikely( bp==0 )
14  throw cms::Exception("LogicError") << "MultiTrajectoryState constructed on cylinder";
15 
16  for (auto i=tsvec.begin(); i!=tsvec.end(); i++) {
17  if unlikely(!i->isValid()) {
18  throw cms::Exception("LogicError") << "MultiTrajectoryState constructed with invalid state";
19  }
20  if unlikely(i->hasError() != tsvec.front().hasError()) {
21  throw cms::Exception("LogicError") << "MultiTrajectoryState mixes states with and without errors";
22  }
23  if unlikely( &i->surface() != &tsvec.front().surface()) {
24  throw cms::Exception("LogicError") << "MultiTrajectoryState mixes states with different surfaces";
25  }
26  if unlikely( i->surfaceSide() != tsvec.front().surfaceSide()) {
27  throw cms::Exception("LogicError")
28  << "MultiTrajectoryState mixes states defined before and after material";
29  }
30  if unlikely( i->localParameters().pzSign()*tsvec.front().localParameters().pzSign()<0. ) {
31  throw cms::Exception("LogicError")
32  << "MultiTrajectoryState mixes states with different signs of local p_z";
33  }
34 
35  }
36  //
37  combine();
38 }
int i
Definition: DBlmapReader.cc:9
#define unlikely(x)
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
for(const auto &isodef:isoDefs)
BasicMultiTrajectoryState::BasicMultiTrajectoryState ( )
inline

Definition at line 25 of file BasicMultiTrajectoryState.h.

25 {}

Member Function Documentation

virtual bool BasicMultiTrajectoryState::canUpdateLocalParameters ( ) const
inlinevirtual

Reimplemented from BasicTrajectoryState.

Definition at line 45 of file BasicMultiTrajectoryState.h.

45 { return false; }
pointer BasicMultiTrajectoryState::clone ( void  ) const
inlineoverridevirtual

Implements BasicTrajectoryState.

Definition at line 36 of file BasicMultiTrajectoryState.h.

36  {
37  return build<BasicMultiTrajectoryState>(*this);
38  }
void BasicMultiTrajectoryState::combine ( )
private

Definition at line 56 of file BasicMultiTrajectoryState.cc.

References diffTreeTool::diff, timingPdfMaker::mean, theStates, unlikely, BasicTrajectoryState::update(), and BasicTrajectoryState::weight().

Referenced by BasicMultiTrajectoryState(), and rescaleError().

56  {
57  const std::vector<TrajectoryStateOnSurface>& tsos = theStates;
58 
59  if unlikely(tsos.empty()) {
60  edm::LogError("MultiTrajectoryStateCombiner")
61  << "Trying to collapse empty set of trajectory states!";
62  return;
63  }
64 
65  double pzSign = tsos.front().localParameters().pzSign();
66  for (std::vector<TrajectoryStateOnSurface>::const_iterator it = tsos.begin();
67  it != tsos.end(); it++) {
68  if unlikely(it->localParameters().pzSign() != pzSign) {
69  edm::LogError("MultiTrajectoryStateCombiner")
70  << "Trying to collapse trajectory states with different signs on p_z!";
71  return;
72  }
73  }
74 
75  if unlikely(tsos.size() == 1) {
76  BasicTrajectoryState::update(tsos.front().weight(),
77  tsos.front().localParameters(),
78  tsos.front().localError(),
79  tsos.front().surface(),
80  tsos.front().magneticField(),
81  tsos.front().surfaceSide()
82  );
83  return;
84  }
85 
86  double sumw = 0.;
87  //int dim = tsos.front().localParameters().vector().num_row();
89  AlgebraicSymMatrix55 covarPart1, covarPart2, covtmp;
90  for (auto it1 = tsos.begin(); it1 != tsos.end(); it1++) {
91  double weight = it1->weight();
92  AlgebraicVector5 param = it1->localParameters().vector();
93  sumw += weight;
94  mean += weight * param;
95  covarPart1 += weight * it1->localError().matrix();
96  for (auto it2 = it1 + 1; it2 != tsos.end(); it2++) {
97  AlgebraicVector5 diff = param - it2->localParameters().vector();
98  ROOT::Math::AssignSym::Evaluate(covtmp,ROOT::Math::TensorProd(diff,diff));
99  covarPart2 += (weight * it2->weight()) * covtmp;
100  }
101  }
102  double sumwI = 1.0/sumw;
103  mean *= sumwI;
104  covarPart1 *= sumwI; covarPart2 *= (sumwI*sumwI);
105  AlgebraicSymMatrix55 covar = covarPart1 + covarPart2;
106 
108  LocalTrajectoryParameters(mean, pzSign),
109  LocalTrajectoryError(covar),
110  tsos.front().surface(),
111  tsos.front().magneticField(),
112  tsos.front().surfaceSide()
113  );
114 }
virtual void update(const LocalTrajectoryParameters &p, const SurfaceType &aSurface, const MagneticField *field, const SurfaceSide side)
ROOT::Math::SMatrix< double, 5, 5, ROOT::Math::MatRepSym< double, 5 > > AlgebraicSymMatrix55
#define unlikely(x)
ROOT::Math::SVector< double, 5 > AlgebraicVector5
virtual std::vector<TrajectoryStateOnSurface> BasicMultiTrajectoryState::components ( ) const
inlinevirtual

Implements BasicTrajectoryState.

Definition at line 40 of file BasicMultiTrajectoryState.h.

References theStates.

40  {
41  return theStates;
42  }
void BasicMultiTrajectoryState::rescaleError ( double  factor)

Rescaling the error of the mixture with a given factor. Please note that this rescaling is imposed on each of the components of the mixture and does therefore not exactly correspond to rescaling theCombinedState with the same factor.

Definition at line 42 of file BasicMultiTrajectoryState.cc.

References combine(), theStates, and unlikely.

42  {
43 
44  if unlikely(theStates.empty()) {
45  edm::LogError("BasicMultiTrajectoryState") << "Trying to rescale errors of empty MultiTrajectoryState!";
46  return;
47  }
48 
49  for (std::vector<TSOS>::iterator it = theStates.begin(); it != theStates.end(); it++) {
50  it->rescaleError(factor);
51  }
52  combine();
53 }
#define unlikely(x)
void BasicMultiTrajectoryState::update ( const LocalTrajectoryParameters p,
const Surface aSurface,
const MagneticField field,
const SurfaceSide  side 
)
overridevirtual

Reimplemented from BasicTrajectoryState.

Definition at line 118 of file BasicMultiTrajectoryState.cc.

References edm::hlt::Exception.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

122 {
123  throw cms::Exception("LogicError",
124  "BasicMultiTrajectoryState::update(LocalTrajectoryParameters, Surface, ...) called even if canUpdateLocalParameters() is false");
125 }
void BasicMultiTrajectoryState::update ( double  weight,
const LocalTrajectoryParameters p,
const LocalTrajectoryError err,
const Surface aSurface,
const MagneticField field,
const SurfaceSide  side 
)
overridevirtual

Reimplemented from BasicTrajectoryState.

Definition at line 129 of file BasicMultiTrajectoryState.cc.

References edm::hlt::Exception.

Referenced by progressbar.ProgressBar::__next__(), relval_steps.Matrix::__setitem__(), relval_steps.Steps::__setitem__(), Vispa.Gui.VispaWidget.VispaWidget::autosize(), Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Views.LineDecayView.LineDecayContainer::deselectAllObjects(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::deselectAllWidgets(), Vispa.Gui.VispaWidget.VispaWidget::enableAutosizing(), progressbar.ProgressBar::finish(), Vispa.Gui.MenuWidget.MenuWidget::leaveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseMoveEvent(), Vispa.Gui.MenuWidget.MenuWidget::mouseMoveEvent(), Vispa.Views.LineDecayView.LineDecayContainer::mouseMoveEvent(), Vispa.Gui.VispaWidgetOwner.VispaWidgetOwner::mouseReleaseEvent(), Vispa.Views.LineDecayView.LineDecayContainer::objectMoved(), relval_steps.Steps::overwrite(), Vispa.Views.LineDecayView.LineDecayContainer::removeObject(), Vispa.Gui.ConnectableWidget.ConnectableWidget::removePorts(), Vispa.Gui.FindDialog.FindDialog::reset(), Vispa.Gui.PortConnection.PointToPointConnection::select(), Vispa.Gui.VispaWidget.VispaWidget::select(), Vispa.Views.LineDecayView.LineDecayContainer::select(), Vispa.Gui.VispaWidget.VispaWidget::setText(), Vispa.Gui.VispaWidget.VispaWidget::setTitle(), Vispa.Gui.ZoomableWidget.ZoomableWidget::setZoom(), Vispa.Views.LineDecayView.LineDecayContainer::setZoom(), and Vispa.Gui.PortConnection.PointToPointConnection::updateConnection().

135 {
136  throw cms::Exception("LogicError",
137  "BasicMultiTrajectoryState::update(LocalTrajectoryParameters, LocalTrajectoryError, ...) called even if canUpdateLocalParameters() is false");
138 }

Member Data Documentation

std::vector<TSOS> BasicMultiTrajectoryState::theStates
private

Definition at line 59 of file BasicMultiTrajectoryState.h.

Referenced by combine(), components(), and rescaleError().