/* * PndSpinObsTools.cxx * * Created on: Sep 29, 2016 * Author: walan603 */ #include "PndSpinObsTools.h" /* * Rotates a TLorentzvector p in the coordinate system initframe to the finalframe */ TLorentzVector TransformCoords(std::vector initframe, std::vector finalframe, TLorentzVector p){ TLorentzVector result; TVector3 p3 = p.Vect(); p.SetX(finalframe.at(0).Dot(initframe.at(0)) * p3.X() + finalframe.at(0).Dot(initframe.at(1)) * p3.Y() + finalframe.at(0).Dot(initframe.at(2)) * p3.Z() ); p.SetY(finalframe.at(1).Dot(initframe.at(0)) * p3.X() + finalframe.at(1).Dot(initframe.at(1)) * p3.Y() + finalframe.at(1).Dot(initframe.at(2)) * p3.Z() ); p.SetZ(finalframe.at(2).Dot(initframe.at(0)) * p3.X() + finalframe.at(2).Dot(initframe.at(1)) * p3.Y() + finalframe.at(2).Dot(initframe.at(2)) * p3.Z() ); return p; } Double_t SpinWeight(std::vector pdecayframe, std::vector pbardecayframe, TLorentzVector p, TLorentzVector pbar, Double_t Py, Double_t Pybar, Double_t Cxx, Double_t Cyy, Double_t Czz, Double_t Cxz, Double_t Czx){ Double_t result = 0.; return result; } Double_t SpinWeightGeneral(std::vector pdecayframe, std::vector pbardecayframe, TLorentzVector p, TLorentzVector pbar, Double_t Py, Double_t Pybar, TMatrixD Cij, Double_t alpha, Double_t alphabar){ Double_t result = 1 + alphabar*Pybar*TMath::Cos(pbardecayframe.at(1).Angle(pbar.Vect())) + alpha*Py*TMath::Cos(pdecayframe.at(1).Angle(p.Vect())); for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { //std::cout<<"cxx: "< GenerateUnitVectors(TLorentzVector p_beam, TLorentzVector p_out, TLorentzVector p_ref) { TVector3 DecayFrameAxisZ = p_out.Vect(); Double_t AxisZMag = DecayFrameAxisZ.Mag(); DecayFrameAxisZ.SetX(DecayFrameAxisZ.X()/AxisZMag); DecayFrameAxisZ.SetY(DecayFrameAxisZ.Y()/AxisZMag); DecayFrameAxisZ.SetZ(DecayFrameAxisZ.Z()/AxisZMag); TVector3 DecayFrameAxisY = p_beam.Vect().Cross(p_ref.Vect());//Note: Using lambar here Double_t AxisYMag = DecayFrameAxisY.Mag(); DecayFrameAxisY.SetX(DecayFrameAxisY.X()/AxisYMag); DecayFrameAxisY.SetY(DecayFrameAxisY.Y()/AxisYMag); DecayFrameAxisY.SetZ(DecayFrameAxisY.Z()/AxisYMag); TVector3 DecayFrameAxisX = DecayFrameAxisY.Cross(DecayFrameAxisZ); std::vector final; final.push_back(DecayFrameAxisX); final.push_back(DecayFrameAxisY); final.push_back(DecayFrameAxisZ); return final; }