Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tack track curvature directly from Delphes and don't recompute it from pT #112

Merged
merged 5 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions converter/src/DelphesEDM4HepConverter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace k4SimDelphes {
void sortBranchesProcessingOrder(std::vector<BranchSettings>& branches,
std::array<std::string_view, N> const& processingOrder);

edm4hep::MutableTrack convertTrack(Track const* cand, const double magFieldBz);
edm4hep::MutableTrack convertTrack(Track const* cand);

void setMotherDaughterRelations(GenParticle const* delphesCand, edm4hep::MutableMCParticle particle,
edm4hep::MCParticleCollection& mcParticles);
Expand Down Expand Up @@ -224,7 +224,7 @@ namespace k4SimDelphes {
for (auto iCand = 0; iCand < delphesCollection->GetEntries(); ++iCand) {
auto* delphesCand = static_cast<Track*>(delphesCollection->At(iCand));

auto track = convertTrack(delphesCand, m_magneticFieldBz);
auto track = convertTrack(delphesCand);

// this is the position/time at the IP
auto trackerHit0 = trackerHitColl->create();
Expand Down Expand Up @@ -540,7 +540,7 @@ namespace k4SimDelphes {
});
}

edm4hep::MutableTrack convertTrack(Track const* cand, const double magFieldBz) {
edm4hep::MutableTrack convertTrack(Track const* cand) {
edm4hep::MutableTrack track;
// Delphes does not really provide any information that would go into the
// track itself. But some information can be used to at least partially
Expand All @@ -556,17 +556,6 @@ namespace k4SimDelphes {
trackState.phi = cand->Phi;
// Same thing under different name in Delphes
trackState.tanLambda = cand->CtgTheta;
// Only do omega when there is actually a magnetic field.
double varOmega = 0;
if (magFieldBz) {
// conversion to have omega in [1/mm]
constexpr double a = c_light * 1e3 * 1e-15;

trackState.omega = a * magFieldBz / cand->PT * std::copysign(1.0, cand->Charge);
// calculate variation using simple error propagation, assuming
// constant B-field -> relative error on pT is relative error on omega
varOmega = cand->ErrorPT * cand->ErrorPT / cand->PT / cand->PT * trackState.omega * trackState.omega;
}

// fill the covariance matrix. There is a conversion of units
// because the covariance matrix in delphes is with the original units
Expand All @@ -579,6 +568,8 @@ namespace k4SimDelphes {
// relating to curvature (index 2)
double scale2 = -2.; // CAREFUL: DELPHES USES THE HALF-CURVATURE

trackState.omega = cand->C * scale2;

covMatrix[0] = covaFB(0, 0);

covMatrix[1] = covaFB(1, 0);
Expand Down
2 changes: 0 additions & 2 deletions converter/src/delphesHelpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
#include <vector>

namespace k4SimDelphes {
// TODO: If CLHEP ever gets part of edm4hep, take this from there.
static constexpr double c_light = 2.99792458e+8;

using LorentzVectorT = ROOT::Math::PxPyPzEVector;

Expand Down
Loading