CMS 3D CMS Logo

List of all members | Public Member Functions
BackToBackKinematicConstraint Class Reference

#include <BackToBackKinematicConstraint.h>

Inheritance diagram for BackToBackKinematicConstraint:
KinematicConstraint

Public Member Functions

 BackToBackKinematicConstraint ()
 
KinematicConstraintclone () const override
 
std::pair< AlgebraicMatrix, AlgebraicVectorderivative (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicMatrix, AlgebraicVectorderivative (const std::vector< RefCountedKinematicParticle > &par) const override
 
AlgebraicVector deviations (int nStates) const override
 
int numberOfEquations () const override
 
std::pair< AlgebraicVector, AlgebraicVectorvalue (const AlgebraicVector &exPoint) const override
 
std::pair< AlgebraicVector, AlgebraicVectorvalue (const std::vector< RefCountedKinematicParticle > &par) const override
 
 ~BackToBackKinematicConstraint () override
 
- Public Member Functions inherited from KinematicConstraint
 KinematicConstraint ()
 
virtual ~KinematicConstraint ()
 

Detailed Description

Class implementing the back-to-back geometry constraints for 2 KinematicParticles. Current version does not implement an actual back-to-back. Current class forces 2 tracks to have the opposite direction, bud does not force them to emerge from the single point. Coorect version to be implemented later.

This is just an illustrative piece of code, showing possible approach to constraint application on multiple tracks.

Kirill Prokofiev, July 2004

Definition at line 21 of file BackToBackKinematicConstraint.h.

Constructor & Destructor Documentation

◆ BackToBackKinematicConstraint()

BackToBackKinematicConstraint::BackToBackKinematicConstraint ( )
inline

Definition at line 23 of file BackToBackKinematicConstraint.h.

Referenced by clone().

23 {}

◆ ~BackToBackKinematicConstraint()

BackToBackKinematicConstraint::~BackToBackKinematicConstraint ( )
inlineoverride

Definition at line 25 of file BackToBackKinematicConstraint.h.

25 {}

Member Function Documentation

◆ clone()

KinematicConstraint * BackToBackKinematicConstraint::clone ( ) const
overridevirtual

Clone method

Implements KinematicConstraint.

Definition at line 89 of file BackToBackKinematicConstraint.cc.

References BackToBackKinematicConstraint().

◆ derivative() [1/2]

std::pair< AlgebraicMatrix, AlgebraicVector > BackToBackKinematicConstraint::derivative ( const AlgebraicVector exPoint) const
overridevirtual

Implements KinematicConstraint.

Definition at line 20 of file BackToBackKinematicConstraint.cc.

References l1ctLayer1_cff::dr.

21  {
22  //security check for extended cartesian parametrization
23  int inSize = exPoint.num_row();
24  if (inSize != 14)
25  throw VertexException("BackToBackKinematicConstraint::linearization point has a wrong dimension");
26  AlgebraicVector pr = exPoint;
27 
28  //number of states should be always equal to 2 for such a constraint
29  AlgebraicMatrix dr(3, 14, 0);
30  dr(1, 4) = 1.;
31  dr(1, 11) = 1.;
32  dr(2, 5) = 1;
33  dr(2, 12) = 1;
34  dr(3, 6) = 1;
35  dr(3, 13) = 1;
36  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, pr);
37 }
Common base class.
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector

◆ derivative() [2/2]

std::pair< AlgebraicMatrix, AlgebraicVector > BackToBackKinematicConstraint::derivative ( const std::vector< RefCountedKinematicParticle > &  par) const
overridevirtual

Implements KinematicConstraint.

Definition at line 63 of file BackToBackKinematicConstraint.cc.

References cms::cuda::co, l1ctLayer1_cff::dr, mps_fire::i, dqmiolumiharvest::j, and point.

64  {
65  int nStates = par.size();
66  if (nStates != 2)
67  throw VertexException("BackToBackKinematicConstraint::number of tracks is not equal to 2");
68  AlgebraicVector point(14, 0);
69  int co = 0;
70  for (std::vector<RefCountedKinematicParticle>::const_iterator i = par.begin(); i != par.end(); i++) {
71  AlgebraicVector7 cPar = (*i)->currentState().kinematicParameters().vector();
72  for (int j = 1; j < 8; j++) {
73  point((co - 1) * 7 + j) = cPar(j - 1);
74  }
75  co++;
76  }
77  AlgebraicMatrix dr(3, 14, 0);
78 
79  return std::pair<AlgebraicMatrix, AlgebraicVector>(dr, point);
80 }
Common base class.
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:8
__host__ __device__ VT * co
Definition: prefixScan.h:47
CLHEP::HepMatrix AlgebraicMatrix
CLHEP::HepVector AlgebraicVector
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5

◆ deviations()

AlgebraicVector BackToBackKinematicConstraint::deviations ( int  nStates) const
overridevirtual

Returns vector of sigma squared associated to the KinematicParameters of refitted particles Initial deviations are given by user for the constraining parameters (mass, momentum components etc). In case of multiple states exactly the same values are added to every particle parameters

Implements KinematicConstraint.

Definition at line 82 of file BackToBackKinematicConstraint.cc.

References createTree::dd.

82  {
83  AlgebraicVector dd(7 * nStates, 0);
84  return dd;
85 }
string dd
Definition: createTree.py:154
CLHEP::HepVector AlgebraicVector

◆ numberOfEquations()

int BackToBackKinematicConstraint::numberOfEquations ( ) const
overridevirtual

Returns an actual number of equations in particular constraint (corresponds to the number of strings in constraint derivative matrix, for example)

Implements KinematicConstraint.

Definition at line 87 of file BackToBackKinematicConstraint.cc.

87 { return 3; }

◆ value() [1/2]

std::pair< AlgebraicVector, AlgebraicVector > BackToBackKinematicConstraint::value ( const AlgebraicVector exPoint) const
overridevirtual

Derivatives and value calculated at given expansion point Vector should always be of size 14 (2 particles)

Implements KinematicConstraint.

Definition at line 5 of file BackToBackKinematicConstraint.cc.

5  {
6  //security check for extended cartesian parametrization
7  int inSize = exPoint.num_row();
8  if (inSize != 14)
9  throw VertexException("BackToBackKinematicConstraint::linearization point has a wrong dimension");
10  AlgebraicVector pr = exPoint;
11 
12  //number of states should be always equal to 2 for such a constraint
13  AlgebraicVector vl(3, 0);
14  vl(1) = pr(4) + pr(11);
15  vl(2) = pr(5) + pr(12);
16  vl(3) = pr(6) + pr(13);
17  return std::pair<AlgebraicVector, AlgebraicVector>(vl, pr);
18 }
Common base class.
CLHEP::HepVector AlgebraicVector

◆ value() [2/2]

std::pair< AlgebraicVector, AlgebraicVector > BackToBackKinematicConstraint::value ( const std::vector< RefCountedKinematicParticle > &  par) const
overridevirtual

Derivatives and values calculated at expansion point, taken at current state of input particles. Number of input particles should be always equal to 2

Implements KinematicConstraint.

Definition at line 39 of file BackToBackKinematicConstraint.cc.

References cms::cuda::co, mps_fire::i, dqmiolumiharvest::j, and point.

40  {
41  int nStates = par.size();
42  if (nStates != 2)
43  throw VertexException("BackToBackKinematicConstraint::number of tracks is not equal to 2");
44  AlgebraicVector point(14, 0);
45  int co = 0;
46  for (std::vector<RefCountedKinematicParticle>::const_iterator i = par.begin(); i != par.end(); i++) {
47  AlgebraicVector7 cPar = (*i)->currentState().kinematicParameters().vector();
48  for (int j = 1; j < 8; j++) {
49  point((co - 1) * 7 + j) = cPar(j - 1);
50  }
51  co++;
52  }
53  AlgebraicVector vl(3, 0);
54  AlgebraicVector st1 = asHepVector<7>(par[0]->currentState().kinematicParameters().vector());
55  AlgebraicVector st2 = asHepVector<7>(par[1]->currentState().kinematicParameters().vector());
56  vl(1) = st1(4) + st2(4);
57  vl(2) = st1(5) + st2(5);
58  vl(3) = st1(6) + st2(6);
59 
60  return std::pair<AlgebraicVector, AlgebraicVector>(vl, point);
61 }
Common base class.
ROOT::Math::SVector< double, 7 > AlgebraicVector7
Definition: Matrices.h:8
__host__ __device__ VT * co
Definition: prefixScan.h:47
CLHEP::HepVector AlgebraicVector
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
Definition: invegas.h:5