Skip to content

Commit

Permalink
fixed constant shadowing
Browse files Browse the repository at this point in the history
  • Loading branch information
civanch committed Mar 24, 2023
1 parent da69d4f commit 0ce793a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
15 changes: 1 addition & 14 deletions SimG4Core/Notification/interface/TrackInformation.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@
#include "DataFormats/Math/interface/Vector3D.h"
#include "DataFormats/Math/interface/LorentzVector.h"

constexpr double invcm = 1.0 / CLHEP::cm;
constexpr double invgev = 1.0 / CLHEP::GeV;

class TrackInformation : public G4VUserTrackInformation {
public:
~TrackInformation() override = default;
Expand Down Expand Up @@ -57,17 +54,7 @@ class TrackInformation : public G4VUserTrackInformation {
void setCaloSurfaceParticleP(double p) { caloSurfaceParticleP_ = p; }

// Boundary crossing variables
void setCrossedBoundary(const G4Track *track) {
crossedBoundary_ = true;
positionAtBoundary_ = math::XYZTLorentzVectorF(track->GetPosition().x() * invcm,
track->GetPosition().y() * invcm,
track->GetPosition().z() * invcm,
track->GetGlobalTime());
momentumAtBoundary_ = math::XYZTLorentzVectorF(track->GetMomentum().x() * invgev,
track->GetMomentum().y() * invgev,
track->GetMomentum().z() * invgev,
track->GetTotalEnergy() * invgev);
}
void setCrossedBoundary(const G4Track *track);
bool crossedBoundary() const { return crossedBoundary_; }
const math::XYZTLorentzVectorF &getPositionAtBoundary() const { return positionAtBoundary_; }
const math::XYZTLorentzVectorF &getMomentumAtBoundary() const { return momentumAtBoundary_; }
Expand Down
18 changes: 17 additions & 1 deletion SimG4Core/Notification/src/TrackInformation.cc
Original file line number Diff line number Diff line change
@@ -1,9 +1,25 @@
#include "SimG4Core/Notification/interface/TrackInformation.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"

#include "G4ThreeVector.hh"
#include "G4SystemOfUnits.hh"

#include <iostream>

G4ThreadLocal G4Allocator<TrackInformation> *fpTrackInformationAllocator = nullptr;
G4ThreadLocal G4Allocator<TrackInformation>* fpTrackInformationAllocator = nullptr;

void TrackInformation::setCrossedBoundary(const G4Track* track) {
const double invcm = 1.0 / CLHEP::cm;
const double invgev = 1.0 / CLHEP::GeV;
const double invsec = 1.0 / CLHEP::second;
crossedBoundary_ = true;
const G4ThreeVector& v = track->GetPosition();
positionAtBoundary_ =
math::XYZTLorentzVectorF(v.x() * invcm, v.y() * invcm, v.z() * invcm, track->GetGlobalTime() * invsec);
const G4ThreeVector& p = track->GetMomentum();
momentumAtBoundary_ =
math::XYZTLorentzVectorF(p.x() * invgev, p.y() * invgev, p.z() * invgev, track->GetTotalEnergy() * invgev);
}

void TrackInformation::Print() const {
LogDebug("TrackInformation") << " TrackInformation : storeTrack = " << storeTrack_ << "\n"
Expand Down

0 comments on commit 0ce793a

Please sign in to comment.