Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:49:54

0001 #include "CommonTools/BaseParticlePropagator/interface/makeMuon.h"
0002 #include "CommonTools/BaseParticlePropagator/interface/RawParticle.h"
0003 
0004 #define CATCH_CONFIG_MAIN
0005 #include "catch.hpp"
0006 
0007 static constexpr const double kMuonMass = 0.10566;
0008 
0009 TEST_CASE("makeMuon tests", "[makeMuon]") {
0010   SECTION("muon at rest") {
0011     auto m1 = rawparticle::makeMuon(true, math::XYZTLorentzVector{}, math::XYZTLorentzVector{});
0012 
0013     REQUIRE(m1.charge() == -1.);
0014     REQUIRE(m1.mass() == kMuonMass);
0015     REQUIRE(m1.px() == 0.);
0016     REQUIRE(m1.py() == 0.);
0017     REQUIRE(m1.pz() == 0.);
0018     REQUIRE(m1.x() == 0.);
0019     REQUIRE(m1.y() == 0.);
0020     REQUIRE(m1.z() == 0.);
0021     REQUIRE(m1.t() == 0.);
0022 
0023     //NOTE: energy is incorrectly calculated!
0024     //REQUIRE(m1.e() == kMuonMass);
0025     REQUIRE(m1.e() == 0.);
0026   }
0027 
0028   SECTION("anti-muon at rest") {
0029     auto m1 = rawparticle::makeMuon(false, math::XYZTLorentzVector{}, math::XYZTLorentzVector{});
0030 
0031     REQUIRE(m1.charge() == 1.);
0032     REQUIRE(m1.mass() == kMuonMass);
0033     REQUIRE(m1.px() == 0.);
0034     REQUIRE(m1.py() == 0.);
0035     REQUIRE(m1.pz() == 0.);
0036     REQUIRE(m1.x() == 0.);
0037     REQUIRE(m1.y() == 0.);
0038     REQUIRE(m1.z() == 0.);
0039     REQUIRE(m1.t() == 0.);
0040 
0041     //NOTE: energy is incorrectly calculated!
0042     //REQUIRE(m1.e() == kMuonMass);
0043     REQUIRE(m1.e() == 0.);
0044   }
0045 
0046   SECTION("muon at rest, transposed") {
0047     auto m1 = rawparticle::makeMuon(true, math::XYZTLorentzVector{}, math::XYZTLorentzVector{1., 2., 3., 4.});
0048 
0049     REQUIRE(m1.charge() == -1.);
0050     REQUIRE(m1.mass() == kMuonMass);
0051     REQUIRE(m1.px() == 0.);
0052     REQUIRE(m1.py() == 0.);
0053     REQUIRE(m1.pz() == 0.);
0054     REQUIRE(m1.x() == 1.);
0055     REQUIRE(m1.y() == 2.);
0056     REQUIRE(m1.z() == 3.);
0057     REQUIRE(m1.t() == 4.);
0058 
0059     //NOTE: energy is incorrectly calculated!
0060     //REQUIRE(m1.e() == kMuonMass);
0061     REQUIRE(m1.e() == 0.);
0062   }
0063 
0064   SECTION("muon in motion") {
0065     auto m1 = rawparticle::makeMuon(true, math::XYZTLorentzVector{1., 2., 3., 8.}, math::XYZTLorentzVector{});
0066 
0067     REQUIRE(m1.charge() == -1.);
0068     REQUIRE(m1.mass() == kMuonMass);
0069     REQUIRE(m1.px() == 1.);
0070     REQUIRE(m1.py() == 2.);
0071     REQUIRE(m1.pz() == 3.);
0072     REQUIRE(m1.x() == 0.);
0073     REQUIRE(m1.y() == 0.);
0074     REQUIRE(m1.z() == 0.);
0075     REQUIRE(m1.t() == 0.);
0076 
0077     //NOTE: energy is incorrectly calculated!
0078     //REQUIRE(m1.e() == sqrt(kMuonMass*kMuonMass+m1.px()*m1.px()+m1.py()*m1.py()+m1.pz()*m1.pz()));
0079     REQUIRE(m1.e() == 8.);
0080   }
0081 }