11 using namespace tauImpactParameter;
18 TLorentzVector
Tau(0,0,0,0);
25 TVectorT<double> inpar(size);
26 TMatrixTSym<double> incov(size);
52 TVectorT<double> PAR_0(
npar);
76 if(ambiguity==
zero)scale=-1.0;
78 TLorentzVector Tau_plus,Tau_minus,nu_plus,nu_minus;
79 TVector3 TauDir; TauDir.SetMagThetaPhi(1.0,theta,
phi);
94 par_(
nu_px)=(nu_minus.Px()+nu_plus.Px())/2;
95 par_(
nu_py)=(nu_minus.Py()+nu_plus.Py())/2;
96 par_(
nu_pz)=(nu_minus.Pz()+nu_plus.Pz())/2;
108 TVector3 TauDir=sv-pv;
126 TVectorT<double> outpar(
npar,1);
127 for(
int i=0;
i<
npar;
i++){outpar(
i)=inpar(
i);}
163 else{outpar(
i)=nupar(
i)+a1par(
i);}
168 double Enu2 = nu_px*nu_px + nu_py*nu_py + nu_pz*
nu_pz;
172 double Ea12 = a1_px*a1_px + a1_py*a1_py + a1_pz*
a1_pz;
176 double P2=outpar_px*outpar_px + outpar_py*outpar_py + outpar_pz*outpar_pz;
191 std::vector<LorentzVectorParticle> refitParticles;
201 return refitParticles;
214 TLorentzVector a1,nu;
218 TLorentzVector a1_d=a1;
219 TLorentzVector nu_d=nu;
220 TLorentzVector Tau_plus,Tau_minus,nu_plus,nu_minus;
221 solveByRotation(TauDir,a1_d,Tau_plus,Tau_minus,nu_plus,nu_minus,
false);
226 TLorentzVector nufixed(-a1.Px(),-a1.Py(),nu.Pz(),
sqrt(a1.Pt()*a1.Pt()+nu.Pz()*nu.Pz()));
227 TLorentzVector
tau=a1+nufixed;
232 d(1) = a1.Px()+nu.Px();
233 d(2) = a1.Py()+nu.Py();
242 TauDir.SetMagThetaPhi(1.0,theta,phi);
249 TLorentzVector a1,nu;
253 TLorentzVector Tau_plus,Tau_minus,nu_plus,nu_minus,nu_correct,nu_incorrect;
258 if(fabs(nu_incorrect.Pz()-nu.Pz())<fabs(nu_correct.Pz()-nu.Pz())){
259 double pzkicked=nu_correct.Pz()-(nu_incorrect.Pz()-nu.Pz());
260 TLorentzVector nuKicked(nu.Px(),nu.Py(),pzkicked,
sqrt(nu.Px()*nu.Px()+nu.Py()*nu.Py()+pzkicked*pzkicked));
261 nuKicked.RotateY(-theta);
262 nuKicked.RotateZ(-
phi);
275 TVectorT<double> thelpar(
par_0_.GetNrows()+2,1);
276 TMatrixTSym<double> thelcov(
par_0_.GetNrows()+2);
281 thelpar(thelpar.GetNrows()-2)=anglescov(0,0);
282 thelpar(thelpar.GetNrows()-1)=anglescov(1,1);
289 TVectorT<double> outpar(2);
290 TLorentzVector a1,nu;
295 outpar(1)=TauDir.Dot(a1.Vect());
300 TVectorT<double> outpar(inpar.GetNrows()-2);
301 TLorentzVector a1,nu;
304 double ErrthetaTau=inpar(inpar.GetNrows()-2);
305 double ErrthetaA1=inpar(inpar.GetNrows()-1);
308 double delta=1;
if(angles(1)!=0)delta=fabs(angles(0)/angles(1));
309 double dtheta=(theta-a1.Theta());
310 double dphi=fmod(fabs(phi-a1.Phi()),2*
TMath::Pi());
if(phi<a1.Phi())dphi*=-1.0;
311 double scale=dtheta*ErrthetaTau/(ErrthetaTau+ErrthetaA1);
314 scale=dtheta*ErrthetaA1/(ErrthetaTau+ErrthetaA1);
315 double a1theta=a1.Theta()-dtheta*delta*
scale;
316 double a1phi=a1.Phi()-dphi*delta*
scale;
317 a1.SetTheta(a1theta);
319 outpar(
a1_px)=a1.Px();
320 outpar(
a1_py)=a1.Py();
321 outpar(
a1_pz)=a1.Pz();
322 TLorentzVector Tau_plus,Tau_minus,nu_plus,nu_minus;
324 outpar(
nu_px)=nu_plus.Px();
325 outpar(
nu_py)=nu_plus.Py();
326 outpar(
nu_pz)=nu_plus.Pz();
virtual double covariance(int i, int j) const
TMatrixTSym< double > cov_0_
static const std::string Nu
Geom::Theta< T > theta() const
static TVectorT< double > setThetaGJMax(const TVectorT< double > &inpar)
void solveAmbiguityAnalytically()
virtual TVectorD value(const TVectorD &v)
static bool setTauDirectionatThetaGJMax(const TLorentzVector &a1, double &theta, double &phi, double scale=1.0)
static double thetaGJMax(const TLorentzVector &a1)
static TVectorT< double > computeInitalExpPar(const TVectorT< double > &inpar)
static TVectorT< double > computeExpParToPar(const TVectorT< double > &inpar)
std::vector< LorentzVectorParticle > getRefitDaughters()
LorentzVectorParticle getMother()
static LorentzVectorParticle estimateNu(const LorentzVectorParticle &a1, const TVector3 &pv, int ambiguity, TLorentzVector &tau)
TauA1NuConstrainedFitter(unsigned int ambiguity, const LorentzVectorParticle &A1, const TVector3 &PVertex, const TMatrixTSym< double > &VertexCov)
static TMatrixTSym< double > propagateError(TVectorT< double >(*f)(const TVectorT< double > &par), const TVectorT< double > &inPar, TMatrixTSym< double > &inCov, double epsilon=0.001, double errorEpsilonRatio=1000)
unsigned int offset(bool)
virtual double parameter(int i) const
TMatrixTSym< double > expcov_
TMatrixTSym< double > cov_
static TVectorT< double > computeMotherLorentzVectorPar(const TVectorT< double > &inpar)
static void solveByRotation(const TVector3 &TauDir, const TLorentzVector &A1, TLorentzVector &Tau_plus, TLorentzVector &Tau_minus, TLorentzVector &nu_plus, TLorentzVector &nu_minus, bool rotateback=true)
std::vector< LorentzVectorParticle > particles_
static void covertParToObjects(const TVectorD &v, TLorentzVector &a1, TLorentzVector &nu, double &phi, double &theta, TVector3 &TauDir)
static TVectorT< double > computeNuLorentzVectorPar(const TVectorT< double > &inpar)
static TVectorT< double > findThetaGJMax(const TVectorT< double > &inpar)
TVectorT< double > exppar_
static TVectorT< double > computeA1LorentzVectorPar(const TVectorT< double > &inpar)
tuple size
Write out results.
Power< A, B >::type pow(const A &a, const B &b)