@@ -1495,6 +1495,8 @@ class VarManager : public TObject
14951495 static void FillPair (T1 const & t1, T2 const & t2, float * values = nullptr );
14961496 template <int pairType, uint32_t fillMap, typename T1 , typename T2 >
14971497 static void FillPairRotation (T1 const & t1, T2 const & t2, int rotation, float * values = nullptr );
1498+ template <typename T>
1499+ static void FillPairRotation_ME (T const & t1, T const & t2, int rotation, float * values = nullptr );
14981500 template <int pairType, uint32_t fillMap, typename C, typename T1 , typename T2 >
14991501 static void FillPairCollision (C const & collision, T1 const & t1, T2 const & t2, float * values = nullptr );
15001502 template <int pairType, uint32_t fillMap, typename C, typename T1 , typename T2 , typename M, typename P>
@@ -4084,7 +4086,11 @@ void VarManager::FillPairRotation(T1 const& t1, T2 const& t2, int rotation, floa
40844086 rotationphi2 = 2 * values[kPsi2A ] - t2.phi () + o2::constants::math::PI ;
40854087 }
40864088
4087- rotationphi2 = RecoDecay::constrainAngle (rotationphi2);
4089+ if (rotationphi2 >= o2::constants::math::TwoPI) {
4090+ rotationphi2 -= o2::constants::math::TwoPI;
4091+ } else if (rotationphi2 < 0 ) {
4092+ rotationphi2 += o2::constants::math::TwoPI;
4093+ }
40884094
40894095 values[kCharge ] = t1.sign () + t2.sign ();
40904096 values[kCharge1 ] = t1.sign ();
@@ -4547,6 +4553,51 @@ void VarManager::FillPairME(T1 const& t1, T2 const& t2, float* values)
45474553 }
45484554}
45494555
4556+ template <typename T>
4557+ void VarManager::FillPairRotation_ME (T const & t1, T const & t2, int rotation, float * values)
4558+ {
4559+ if (!values) {
4560+ values = fgValues;
4561+ }
4562+
4563+ float m1 = o2::constants::physics::MassElectron;
4564+ double rotationphi2 = t2.phi ;
4565+
4566+ if (rotation == 1 ) {
4567+ rotationphi2 = t2.phi + o2::constants::math::PI ;
4568+ } else if (rotation == 2 ) {
4569+ rotationphi2 = 2 * values[kPsi2A ] - t2.phi ;
4570+ } else if (rotation == 3 ) {
4571+ rotationphi2 = 2 * values[kPsi2A ] - t2.phi + o2::constants::math::PI ;
4572+ }
4573+
4574+ if (rotationphi2 >= o2::constants::math::TwoPI) {
4575+ rotationphi2 -= o2::constants::math::TwoPI;
4576+ } else if (rotationphi2 < 0 ) {
4577+ rotationphi2 += o2::constants::math::TwoPI;
4578+ }
4579+
4580+ ROOT ::Math::PtEtaPhiMVector v1 (t1.pt , t1.eta , t1.phi , m1);
4581+ ROOT ::Math::PtEtaPhiMVector v2 (t2.pt , t2.eta , rotationphi2, m1);
4582+ ROOT ::Math::PtEtaPhiMVector v12 = v1 + v2;
4583+ values[kMass ] = v12.M ();
4584+ values[kPt ] = v12.Pt ();
4585+ values[kEta ] = v12.Eta ();
4586+ // values[kPhi] = v12.Phi();
4587+ values[kPhi ] = RecoDecay::constrainAngle (v12.Phi ());
4588+ values[kRap ] = -v12.Rapidity ();
4589+ double Ptot1 = TMath::Sqrt (v1.Px () * v1.Px () + v1.Py () * v1.Py () + v1.Pz () * v1.Pz ());
4590+ double Ptot2 = TMath::Sqrt (v2.Px () * v2.Px () + v2.Py () * v2.Py () + v2.Pz () * v2.Pz ());
4591+ values[kDeltaPtotTracks ] = Ptot1 - Ptot2;
4592+
4593+ values[kPt1 ] = t1.pt ;
4594+ values[kEta1 ] = t1.eta ;
4595+ values[kPhi1 ] = t1.phi ;
4596+ values[kPt2 ] = t2.pt ;
4597+ values[kEta2 ] = t2.eta ;
4598+ values[kPhi2 ] = rotationphi2;
4599+ }
4600+
45504601template <typename T>
45514602void VarManager::FillPairMEAcrossTFs (T const & t1, T const & t2, float * values)
45524603{
0 commit comments