Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-12-20 03:14:15

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