File indexing completed on 2023-08-06 22:43:36
0001 #include "SimG4Core/Notification/interface/TrackInformation.h"
0002 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0003
0004 #include "G4ThreeVector.hh"
0005 #include "G4SystemOfUnits.hh"
0006
0007 #include <iostream>
0008
0009 G4ThreadLocal G4Allocator<TrackInformation>* fpTrackInformationAllocator = nullptr;
0010
0011 void TrackInformation::setCrossedBoundary(const G4Track* track) {
0012 const double invcm = 1.0 / CLHEP::cm;
0013 const double invgev = 1.0 / CLHEP::GeV;
0014 const double invsec = 1.0 / CLHEP::second;
0015 crossedBoundary_ = true;
0016 const G4ThreeVector& v = track->GetPosition();
0017 positionAtBoundary_ =
0018 math::XYZTLorentzVectorF(v.x() * invcm, v.y() * invcm, v.z() * invcm, track->GetGlobalTime() * invsec);
0019 const G4ThreeVector& p = track->GetMomentum();
0020 momentumAtBoundary_ =
0021 math::XYZTLorentzVectorF(p.x() * invgev, p.y() * invgev, p.z() * invgev, track->GetTotalEnergy() * invgev);
0022 }
0023
0024 void TrackInformation::Print() const {
0025 LogDebug("TrackInformation") << " TrackInformation : storeTrack = " << storeTrack_ << "\n"
0026 << " hasHits = " << hasHits_ << "\n"
0027 << " isPrimary = " << isPrimary_ << "\n"
0028 << " isGeneratedSecondary = " << isGeneratedSecondary_ << "\n"
0029 << " mcTruthID = " << mcTruthID_ << "\n"
0030 << " isInHistory = " << isInHistory_ << "\n"
0031 << " idOnCaloSurface = " << getIDonCaloSurface() << "\n"
0032 << " caloIDChecked = " << caloIDChecked() << "\n"
0033 << " idCaloVolume = " << idCaloVolume_ << "\n"
0034 << " idLastVolume = " << idLastVolume_ << "\n"
0035 << " isFromTtoBTL = " << isFromTtoBTL() << "\n"
0036 << " isFromBTLtoT = " << isFromBTLtoT() << "\n"
0037 << " isBTLlooper = " << isBTLlooper() << "\n"
0038 << " isInTrkFromBackscattering = " << isInTrkFromBackscattering()
0039 << "\n"
0040 << " isExtSecondary = " << isExtSecondary();
0041 }