26 #include "G4VProcess.hh" 28 #include "G4ThreeVector.hh" 29 #include "G4SystemOfUnits.hh" 33 const double invcm = 1.0 / CLHEP::cm;
34 const double r_limit2 = 1.e-6;
76 const auto&
v =
track->GetStep()->GetPostStepPoint()->GetPosition();
77 std::pair<int, math::XYZVectorD>
p(iTrack->
trackID(),
82 std::pair<int, int> thisPair(iTrack->
trackID(), 0);
90 if (trkH ==
nullptr) {
91 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::saveTrackAndItsBranch got 0 pointer ";
92 throw cms::Exception(
"SimTrackManager::saveTrackAndItsBranch") <<
" cannot handle hits for tracking";
133 int iParentID = trkH->parentID();
134 int ig = trkH->genParticleID();
140 if (trk->trackID() == iParentID) {
152 int id = trkH->trackID();
153 if (trkH->crossedBoundary()) {
154 spos = trkH->getPositionAtBoundary();
155 smom = trkH->getMomentumAtBoundary();
157 for (
int i = 0;
i <
nn; ++
i) {
166 new TmpSimTrack(
id, trkH->particleID(), trkH->momentum(), trkH->totalEnergy(), ivertex, ig, pm, spos, smom);
175 int id = trk->trackID();
176 if (
id == iParentID) {
201 unsigned int n =
idsave.size();
208 for (
j = 0;
j <= jmax; ++
j) {
211 if (0 ==
id1 ||
id1 == idMother) {
228 for (
j = jmax;
j >= 0; --
j) {
229 if ((
idsave[
j]).first == idMother) {
231 if (0 ==
id1 ||
id1 == idMother) {
243 for (
j = jmax;
j >= 0; --
j) {
260 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::fillMotherList track index corrupted";
265 for (
unsigned int i = 0;
i <
idsave.size(); ++
i) {
267 <<
" Mother ID = " << (
idsave[
i]).second;
289 LogDebug(
"SimTrackManager") <<
"SimTrackManager::cleanTracksWithHistory has " <<
idsave.size()
290 <<
" mother-daughter relationships stored with lastTrack = " <<
lastTrack;
295 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::cleanTracksWithHistory track index corrupted";
302 LogDebug(
"SimTrackManager") <<
" SimTrackManager::cleanTracksWithHistory knows " << m_trksForThisEvent->size()
303 <<
" tracks with history before branching";
305 LogDebug(
"SimTrackManager") <<
" 1 - Track in position " << it <<
" G4 track number " 326 if (
xx.first == g4ID) {
340 <<
" tracks to be saved persistently";
342 LogDebug(
"SimTrackManager") <<
" Track in position " << it <<
" G4 track number " <<
m_trackContainer[it]->trackID()
358 int genParticleID = trkH->genParticleID();
359 if (genParticleID == -1) {
363 if (
xx.afterHector() == genParticleID) {
364 trkH->setGenParticleID(
xx.beforeHector());
376 <<
"Fail to get track " <<
id <<
" from SimTrackManager, container size= " <<
m_trackContainer.size();
Log< level::Info, true > LogVerbatim
std::vector< TrackWithHistory * > m_trackContainer
SimTrackManager(TmpSimEvent *)
ROOT::Math::LorentzVector< ROOT::Math::PxPyPzE4D< double > > XYZTLorentzVectorD
Lorentz vector with cylindrical internal representation using pseudorapidity.
std::pair< int, math::XYZVectorD > VertexPosition
const math::XYZVectorD & vertexPosition() const
void copyCrossedBoundaryVars(const TrackWithHistory *track)
Log< level::Error, false > LogError
void swap(Association< C > &lhs, Association< C > &rhs)
U second(std::pair< T, U > const &p)
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > XYZVectorD
spatial vector with cartesian internal representation
void cleanTracksWithHistory()
void addTrack(TrackWithHistory *iTrack, const G4Track *track, bool inHistory, bool withAncestor)
std::vector< std::pair< int, int > > idsave
void saveTrackAndItsBranch(TrackWithHistory *)
this saves a track and all its parents looping over the non ordered vector
static const GlobalPoint notFound(0, 0, 0)
const edm::LHCTransportLinkContainer * theLHCTlink
int idSavedTrack(int) const
int getOrCreateVertex(TrackWithHistory *, int)
std::vector< std::pair< int, int > > ancestorList
void ReportException(unsigned int id) const
std::vector< std::pair< int, math::XYZVectorD > > m_endPoints