22 const std::vector<RefCountedKinematicParticle> &
input)
const 34 std::vector<KinematicRefittedTrackState *> rStates;
35 std::vector<RefCountedVertexTrack> refTracks = vtx.
tracks();
36 for(std::vector<RefCountedVertexTrack>::const_iterator
i = refTracks.begin();
i !=refTracks.end();++
i)
43 en +=
sqrt(f_mom(1)*f_mom(1)+f_mom(2)*f_mom(2)+f_mom(3)*f_mom(3) + f_mom(0)*f_mom(0));
44 ch += (*i)->linearizedTrack()->charge();
45 rStates.push_back(rs);
49 double differ = en*en - (par(3)*par(3)+par(4)*par(4)+par(5)*par(5));
52 par(6) =
sqrt(differ);
55 <<
"Fit failed: Current precision does not allow to calculate the mass\n";
71 for(
int i = 1;
i<8;
i++)
73 for(
int j = 1; j<8; j++)
75 if(
i<=j) sCov(
i-1,j-1) = cov(
i,j);
101 resTree->addParticle(pVrt,dVrt,nPart);
104 std::vector<RefCountedKinematicParticle> rrP;
106 std::vector<RefCountedKinematicParticle>::const_iterator j;
107 std::vector<RefCountedVertexTrack>::const_iterator
i;
108 for(j=input.begin(), i=refTracks.begin(); j !=input.end() && i !=refTracks.end();++j, ++
i)
121 rrP.push_back(nPart);
122 if((*j)->correspondingTree() !=
nullptr)
130 resTree->addTree(cdVertex, tree);
135 resTree->addParticle(dVrt,nV,nPart);
146 std::vector<RefCountedVertexTrack> refTracks = vtx.
tracks();
147 int size = refTracks.size();
154 double energy_total =
sqrt(par(3)*par(3)+par(6)*par(6) + par(5)*par(5)+par(4)*par(4));
156 std::vector<RefCountedVertexTrack>::const_iterator rt_i;
158 for(rt_i = refTracks.begin(); rt_i != refTracks.end(); rt_i++)
162 double rho = param[0];
163 double theta = param[1];
164 double phi = param[2];
165 double mass = param[5];
167 if ((**rt_i).linearizedTrack()->charge()!=0) {
168 a = -(**rt_i).refittedState()->freeTrajectoryState().parameters().magneticFieldInInverseGeV(vtx.
position()).
z()
169 * (**rt_i).refittedState()->freeTrajectoryState().parameters ().charge();
170 if (a==0.)
throw cms::Exception(
"FinalTreeBuilder",
"Field is 0");
176 jc_el(1,1) = -a*
cos(phi)/(rho*
rho);
177 jc_el(2,1) = -a*
sin(phi)/(rho*
rho);
178 jc_el(3,1) = -a/(rho*rho*
tan(theta));
180 jc_el(3,2) = -a/(rho*
sin(theta)*
sin(theta));
182 jc_el(1,3) = -a*
sin(phi)/
rho;
183 jc_el(2,3) = a*
cos(phi)/
rho;
186 double energy_local =
sqrt(a*a/(rho*rho)*(1+1/(
tan(theta)*
tan(theta))) + mass*mass);
188 jc_el(4,4) = energy_total*mass/(par(6)*energy_local);
190 jc_el(4,1) = (-(energy_total/energy_local*a*a/(rho*rho*rho*
sin(theta)*
sin(theta)) )
191 + par(3)*a/(rho*
rho)*
cos(phi) + par(4)*a/(rho*
rho)*
sin(phi)
192 + par(5)*a/(rho*rho*
tan(theta)) )/par(6);
194 jc_el(4,2) = (-(energy_total/energy_local*a*a/(rho*rho*
sin(theta)*
sin(theta)*
tan(theta)) )
195 + par(5)*a/(rho*
sin(theta)*
sin(theta)) )/par(6);
197 jc_el(4,3) = ( par(3)*
sin(phi) - par(4)*
cos(phi) )*a/(rho*par(6));
199 jac.sub(4,i_int*4+4,jc_el);
203 cov.sub(1,1,asHepMatrix<7>((**rt_i).fullCovariance()));
206 AlgebraicMatrix fullCovMatrix(asHepMatrix<7>((**rt_i).fullCovariance()));
218 cov.sub(i_int*4 + 4, i_int*4 + 4,m_m_cov);
221 cov.sub(1,i_int*4 + 4,x_p_cov);
222 cov.sub(i_int*4 + 4,1,p_x_cov);
228 for(std::vector<RefCountedVertexTrack>::const_iterator rt_j = refTracks.begin(); rt_j != refTracks.end(); rt_j++)
234 cov.sub(i_int*4 + 4, j_int*4 + 4,i_k_cov_m);
235 cov.sub(j_int*4 + 4, i_int*4 + 4,i_k_cov_m.T());
245 return jac*cov*jac.T();
void replaceCurrentParticle(RefCountedKinematicParticle newPart) const
AlgebraicVector4 kinematicMomentumVector() const
std::vector< RefCountedVertexTrack > tracks() const
RefCountedKinematicParticle particle(const KinematicState &kineState, float &chiSquared, float °reesOfFr, ReferenceCountingPointer< KinematicParticle > previousParticle, KinematicConstraint *lastConstraint=0) const
RefCountedKinematicTree buildTree(const CachingVertex< 6 > &vtx, const std::vector< RefCountedKinematicParticle > &input) const
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
VirtualKinematicParticleFactory * pFactory
AlgebraicSymMatrix77 kinematicParametersCovariance() const
ROOT::Math::SVector< double, 6 > AlgebraicVector6
static std::string const input
ROOT::Math::SMatrix< double, 7, 7, ROOT::Math::MatRepSym< double, 7 > > AlgebraicSymMatrix77
ROOT::Math::SVector< double, 7 > AlgebraicVector7
CLHEP::HepMatrix AlgebraicMatrix
Cos< T >::type cos(const T &t)
void movePointerToTheTop() const
float totalChiSquared() const
Tan< T >::type tan(const T &t)
float degreesOfFreedom() const
KinematicVertexFactory * kvFactory
TString nPart(Int_t part, TString string, TString delimit=";", Bool_t removerest=true)
AlgebraicMatrixMM tkToTkCovariance(const RefCountedVertexTrack t1, const RefCountedVertexTrack t2) const
AlgebraicVector7 kinematicParameters() const
GlobalPoint position() const
static RefCountedKinematicVertex vertex(const VertexState &state, float totalChiSq, float degreesOfFr)
ROOT::Math::SVector< double, 4 > AlgebraicVector4
AlgebraicMatrix momentumPart(const CachingVertex< 6 > &vtx, const AlgebraicVector7 &par) const