23 std::unique_ptr<double[]> DerivC(
new double[NPar] );
24 std::unique_ptr<double[]> DerivP(
new double[NPar] );
25 std::unique_ptr<double[]> DerivT(
new double[NPar] );
27 std::vector<double> vMagFld;
double vBx,vBy,vBz;
28 for( iv=0; iv<cascadeEvent_.
cascadeNV; iv++){
31 vMagFld.push_back(vBz);
34 for( iv=0; iv<cascadeEvent_.
cascadeNV; iv++){
42 if(ivnext<0){
return -1;};
52 posCombTrk =cascadeEvent_.
matrixPnt[ivnext]+3+3*indCombTrk;
54 if(posCombTrk==0 || iniPosTrk==0) {
return -1;}
57 for(
int ivt=0; ivt<NPar; ivt++)DerivC[ivt]=DerivP[ivt]=DerivT[ivt]=0.;
58 DerivC[posCombTrk+2]=-1.;
59 DerivT[posCombTrk+0]=-1.;
60 DerivP[posCombTrk+1]=-1.;
63 double ptsum=sqrt(ppsum[0]*ppsum[0] + ppsum[1]*ppsum[1]);
64 double sinth2sum=(ppsum[0]*ppsum[0] + ppsum[1]*ppsum[1])/(ppsum[0]*ppsum[0] + ppsum[1]*ppsum[1] + ppsum[2]*ppsum[2]);
71 double pt=sqrt(pp[0]*pp[0] + pp[1]*pp[1]);
73 double sinth2=(pp[0]*pp[0] + pp[1]*pp[1])/(pp[0]*pp[0] + pp[1]*pp[1] + pp[2]*pp[2]);
74 DerivC[iniPosTrk+
it*3+1] = csum/ptsum/ptsum*(ppsum[0]*pp[1]-ppsum[1]*pp[0]);
75 DerivC[iniPosTrk+
it*3+2] = csum/ptsum/ptsum*(ppsum[0]*pp[0]+ppsum[1]*pp[1])/curv;
76 DerivP[iniPosTrk+
it*3+1] = (ppsum[0]*pp[0]+ppsum[1]*pp[1])/ptsum/ptsum;
77 DerivP[iniPosTrk+
it*3+2] = (ppsum[1]*pp[0]-ppsum[0]*pp[1])/ptsum/ptsum/curv;
78 DerivT[iniPosTrk+
it*3+0] = (sinth2sum*
pt)/(sinth2*ptsum);
79 DerivT[iniPosTrk+
it*3+2] = (sinth2sum*
pt*cth)/(curv*ptsum);
92 for(
it=0;
it<NPar;
it++) fullMtx[ (NPar-3*(cascadeEvent_.
cascadeNV-1)+3*iv )*NPar +
it] = DerivT[
it];
93 for(
it=0;
it<NPar;
it++) fullMtx[ (NPar-3*(cascadeEvent_.
cascadeNV-1)+3*iv+1)*NPar +
it] = DerivP[
it];
94 for(
it=0;
it<NPar;
it++) fullMtx[ (NPar-3*(cascadeEvent_.
cascadeNV-1)+3*iv+2)*NPar +
it] = DerivC[
it];
95 for(
it=0;
it<NPar;
it++) fullMtx[ (NPar-3*(cascadeEvent_.
cascadeNV-1)+3*iv ) +
it*NPar] = DerivT[
it];
96 for(
it=0;
it<NPar;
it++) fullMtx[ (NPar-3*(cascadeEvent_.
cascadeNV-1)+3*iv+1) +
it*NPar] = DerivP[
it];
97 for(
it=0;
it<NPar;
it++) fullMtx[ (NPar-3*(cascadeEvent_.
cascadeNV-1)+3*iv+2) +
it*NPar] = DerivC[
it];
114 if(NV==0)
return nullptr;
118 if(itv<0)
return nullptr;
138 for(
int iv=0; iv<cascadeEvent_.
cascadeNV; iv++){
143 if(
Type==1)
return 3*(NV+NTrk);
144 return 3*(NV+NTrk)+NCnst + 3*(cascadeEvent_.
cascadeNV-1);
154 for( iv=0; iv<cascadeEvent_.
cascadeNV; iv++){
169 std::vector<int> & matrixPnt,
170 std::vector< std::vector<double> > & covarCascade,
174 for( iv=0; iv<cascadeEvent_.
cascadeNV; iv++){
178 std::vector<double> Res(vrtMtxSize*(vrtMtxSize+1)/2);
186 covarCascade.emplace_back(std::move(Res));
191 std::vector<double>
transformCovar(
int NPar,
double **Deriv,
const std::vector<double> &covarI )
193 std::vector<double> covarO(NPar*(NPar+1)/2, 0.);
194 int ii,ij,oi,oj, indexO, indexI;
195 for(oi=0; oi<NPar; oi++){
196 for(oj=0; oj<=oi; oj++){
197 indexO = oi*(oi+1)/2+oj;
198 for(ii=0; ii<NPar; ii++){
199 for(ij=0; ij<NPar; ij++){
200 indexI = ii>=ij ? ii*(ii+1)/2+ij : ij*(ij+1)/2+ii;
201 covarO[indexO] += Deriv[oi][ii]*covarI[indexI]*Deriv[oj][ij];
212 for( iv=0; iv<cascadeEvent_.
cascadeNV; iv++){
215 for( ivn=iv; ivn<cascadeEvent_.
cascadeNV; ivn++){
218 if( ivn == cascadeEvent_.
cascadeNV )
continue;
221 int From=matrixPnt[iv];
222 int Next=matrixPnt[iv+1];
223 int Into=matrixPnt[ivn];
226 ader[(0+Into) + (Next-1)*MATRIXSIZE] = - ader[(0+From) + (Next-1)*MATRIXSIZE];
227 ader[(1+Into) + (Next-1)*MATRIXSIZE] = - ader[(1+From) + (Next-1)*MATRIXSIZE];
228 ader[(2+Into) + (Next-1)*MATRIXSIZE] = - ader[(2+From) + (Next-1)*MATRIXSIZE];
229 ader[(0+Into) + (Next-2)*MATRIXSIZE] = - ader[(0+From) + (Next-2)*MATRIXSIZE];
230 ader[(1+Into) + (Next-2)*MATRIXSIZE] = - ader[(1+From) + (Next-2)*MATRIXSIZE];
231 ader[(2+Into) + (Next-2)*MATRIXSIZE] = - ader[(2+From) + (Next-2)*MATRIXSIZE];
232 ader[(0+Into)*MATRIXSIZE + (Next-1)] = - ader[(0+From) + (Next-1)*MATRIXSIZE];
233 ader[(1+Into)*MATRIXSIZE + (Next-1)] = - ader[(1+From) + (Next-1)*MATRIXSIZE];
234 ader[(2+Into)*MATRIXSIZE + (Next-1)] = - ader[(2+From) + (Next-1)*MATRIXSIZE];
235 ader[(0+Into)*MATRIXSIZE + (Next-2)] = - ader[(0+From) + (Next-2)*MATRIXSIZE];
236 ader[(1+Into)*MATRIXSIZE + (Next-2)] = - ader[(1+From) + (Next-2)*MATRIXSIZE];
237 ader[(2+Into)*MATRIXSIZE + (Next-2)] = - ader[(2+From) + (Next-2)*MATRIXSIZE];
247 double *
Target,
long int TStart,
long int TDIM)
250 for(
i=0;
i<IPar;
i++){
251 for( j=0; j<IPar; j++){
252 it=
i+TStart; jt=j+TStart;
261 void getNewCov(
const double *OldCov,
const double* Der,
double* Cov,
long int DIM) noexcept
264 for(
i=0;
i<DIM;
i++){
265 for( j=0; j<DIM; j++){
268 for( jt=0; jt<DIM; jt++){
269 Cov[
i*DIM+j] += Der[
i*DIM+
it]*OldCov[
it*DIM+jt]*Der[j*DIM+jt];