From 23a2e20f29e687370319aca31052c86ff2bf7973 Mon Sep 17 00:00:00 2001 From: Alice Date: Tue, 21 Mar 2017 14:17:10 +0100 Subject: [PATCH 1/4] Edges remove bitshift, add swap --- papas/graphtools/Edge.h | 4 ---- papas/graphtools/src/Edge.cpp | 8 +++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/papas/graphtools/Edge.h b/papas/graphtools/Edge.h index bf311ee..7967d26 100644 --- a/papas/graphtools/Edge.h +++ b/papas/graphtools/Edge.h @@ -64,10 +64,6 @@ class Edge { bool m_isLinked; ///< boolean to day if there is a link between the two edges double m_distance; ///< distance between two ends EdgeKey m_key; /// id2) // ensure that the order of the ids does not matter - key = (((uint64_t)uid1) << 32 ) | ((uint64_t)uid2); - else - key = (((uint64_t)uid2) << 32 ) | ((uint64_t)uid1); - + if (id1 < id2) // ensure that the order of the ids does not matter + std::swap(uid1, uid2); + key = (((uint64_t)uid1) << 32 ) | ((uint64_t)uid2); return key; } From 2959dc019b19cc2183fa1db16e03671df5726e6e Mon Sep 17 00:00:00 2001 From: Alice Date: Tue, 21 Mar 2017 14:32:09 +0100 Subject: [PATCH 2/4] tidy track class --- papas/datatypes/Track.h | 5 ----- papas/datatypes/src/Track.cpp | 2 +- papas/detectors/Detector.h | 2 +- papas/detectors/src/CMSTracker.cpp | 6 +++--- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/papas/datatypes/Track.h b/papas/datatypes/Track.h index a6945ab..f45a9e8 100644 --- a/papas/datatypes/Track.h +++ b/papas/datatypes/Track.h @@ -24,21 +24,16 @@ class Track { @param[in] the subtype of the track used in creating the unique id */ Track(const TVector3& p3, double charge, const Path::Ptr path, unsigned int index, char subtype = 'u'); - double pt() const { return m_p3.Perp(); } /// 5. && fabs(track.p3().Eta()) < 2.5; } + double muonAcceptance(const Track& track) const { return track.p3().Perp() > 5. && fabs(track.p3().Eta()) < 2.5; } double muonPtResolution(const PFParticle& /*ptc*/) const { return 0.02; } diff --git a/papas/detectors/src/CMSTracker.cpp b/papas/detectors/src/CMSTracker.cpp index 003aabb..2bbd2e1 100644 --- a/papas/detectors/src/CMSTracker.cpp +++ b/papas/detectors/src/CMSTracker.cpp @@ -17,8 +17,8 @@ CMSTracker::CMSTracker(const VolumeCylinder& volume) : Tracker(Layer::kTracker, CMSTracker::CMSTracker(const VolumeCylinder&& volume) : Tracker(Layer::kTracker, volume, Material("void", 0, 0)) {} bool CMSTracker::acceptance(const Track& track) const { - double pt = track.pt(); - double eta = fabs(track.eta()); + double pt = track.p3().Perp(); + double eta = fabs(track.p3().Eta()); // randomgen::RandUniform rUniform{0, 1}; bool accept = false; if (eta < 1.35 && pt > 0.5) { @@ -30,7 +30,7 @@ bool CMSTracker::acceptance(const Track& track) const { } double CMSTracker::ptResolution(const Track& track) const { - double pt = track.pt(); // TODO inherited from Colin: depends on the field + double pt = track.p3().Perp(); // TODO inherited from Colin: depends on the field (void)pt; // suppress unused parameter warning return 1.1e-2; // updated on 9/16 from 5e-3; } From b89b5c51dd304e75682478def9b155a49b4a3938 Mon Sep 17 00:00:00 2001 From: Alice Date: Tue, 21 Mar 2017 14:43:02 +0100 Subject: [PATCH 3/4] vector to array in helix --- papas/datatypes/Helix.h | 2 +- papas/datatypes/src/Helix.cpp | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/papas/datatypes/Helix.h b/papas/datatypes/Helix.h index c7e2f37..ed803b4 100644 --- a/papas/datatypes/Helix.h +++ b/papas/datatypes/Helix.h @@ -29,7 +29,7 @@ class Helix : public Path { @param time the time @return the polar coordinates of the particle along the path at time */ - std::vector polarAtTime(double time) const; + std::array polarAtTime(double time) const; /** Returns the polar coordinates on the path at a given time @param time the time @return the polar coordinates of the particle along the path at time diff --git a/papas/datatypes/src/Helix.cpp b/papas/datatypes/src/Helix.cpp index 595c1ed..537c39c 100644 --- a/papas/datatypes/src/Helix.cpp +++ b/papas/datatypes/src/Helix.cpp @@ -9,6 +9,7 @@ #include "papas/datatypes/Helix.h" #include "papas/datatypes/Definitions.h" #include "papas/utility/DeltaR.h" +#include namespace papas { extern double gconstc; @@ -35,10 +36,10 @@ Helix::Helix(const TLorentzVector& p4, const TVector3& origin, double field, dou m_phiMax = m_phiMin + 360.; } -std::vector Helix::polarAtTime(double time) const { +std::array Helix::polarAtTime(double time) const { double z = vZ() * time + m_origin.Z(); double phi = -m_omega * time + m_phi0; - return std::vector{m_rho, z, phi}; + return std::array{m_rho, z, phi}; } double Helix::timeAtPhi(double phi) const { From 9d71dffd3dd96357f649e2263a8fab42a8bd47a6 Mon Sep 17 00:00:00 2001 From: Alice Date: Tue, 21 Mar 2017 14:56:37 +0100 Subject: [PATCH 4/4] fix warning on brackets --- papas/datatypes/src/Helix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/papas/datatypes/src/Helix.cpp b/papas/datatypes/src/Helix.cpp index 537c39c..bd26240 100644 --- a/papas/datatypes/src/Helix.cpp +++ b/papas/datatypes/src/Helix.cpp @@ -39,7 +39,7 @@ Helix::Helix(const TLorentzVector& p4, const TVector3& origin, double field, dou std::array Helix::polarAtTime(double time) const { double z = vZ() * time + m_origin.Z(); double phi = -m_omega * time + m_phi0; - return std::array{m_rho, z, phi}; + return std::array{{m_rho, z, phi}}; } double Helix::timeAtPhi(double phi) const {