Skip to content

Commit

Permalink
Tack track curvature directly from Delphes and don't recompute it fro…
Browse files Browse the repository at this point in the history
…m pT (#112)

Remove some code that has become obsolete with these changes.

---------

Co-authored-by: tmadlener <thomas.madlener@desy.de>
  • Loading branch information
EmanuelPerez and tmadlener authored Nov 2, 2023
1 parent b3e12de commit 826c5ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 16 deletions.
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

0 comments on commit 826c5ee

Please sign in to comment.