24 #include "G4VProcess.hh"
29 : m_trksForThisEvent(nullptr),
31 m_collapsePrimaryVertices(iCollapsePrimaryVertices),
34 theLHCTlink(nullptr) {}
49 delete (*m_trksForThisEvent)[
i];
56 std::vector<std::pair<int, int> >().
swap(
idsave);
64 delete (*m_trksForThisEvent)[
i];
74 if (trkH ==
nullptr) {
75 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::saveTrackAndItsBranch got 0 pointer ";
76 throw cms::Exception(
"SimTrackManager::saveTrackAndItsBranch") <<
" cannot handle hits for tracking";
112 LogDebug(
"SimTrackManager") <<
"Inside the reallyStoreTracks method object to be stored = "
124 unsigned int iParentID = trkH->
parentID();
127 pm = (*m_trksForThisEvent)[iit]->momentum();
133 std::map<uint32_t, std::pair<math::XYZVectorD, math::XYZTLorentzVectorD> >::const_iterator cit =
135 std::pair<math::XYZVectorD, math::XYZTLorentzVectorD> tcinfo;
137 tcinfo = cit->second;
155 for (std::vector<TrackWithHistory*>::const_iterator it = (*m_trksForThisEvent).begin();
156 it != (*m_trksForThisEvent).end();
158 if ((*it)->trackID() == uint32_t(
parent)) {
178 unsigned int ptype = 0;
181 ptype =
pr->GetProcessSubType();
203 unsigned int n =
idsave.size();
210 for (
j = 0;
j <= jmax; ++
j) {
213 if (0 ==
id1 ||
id1 == idMother) {
230 for (
j = jmax;
j >= 0; --
j) {
231 if ((
idsave[
j]).first == idMother) {
233 if (0 ==
id1 ||
id1 == idMother) {
245 for (
j = jmax;
j >= 0; --
j) {
262 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::fillMotherList track index corrupted";
292 if ((*m_trksForThisEvent).empty() &&
idsave.empty()) {
297 LogDebug(
"SimTrackManager") <<
"SimTrackManager::cleanTracksWithHistory has " <<
idsave.size()
298 <<
" mother-daughter relationships stored with lastTrack = " <<
lastTrack;
303 edm::LogError(
"SimTrackManager") <<
" SimTrackManager::cleanTracksWithHistory track index corrupted";
312 <<
" tracks with history before branching";
313 for (
unsigned int it = 0; it < (*m_trksForThisEvent).size(); it++) {
314 LogDebug(
"SimTrackManager") <<
" 1 - Track in position " << it <<
" G4 track number "
315 << (*m_trksForThisEvent)[it]->trackID() <<
" mother "
316 << (*m_trksForThisEvent)[it]->parentID() <<
" status "
317 << (*m_trksForThisEvent)[it]->saved();
330 int g4ID =
t->trackID();
331 if (
t->saved() ==
true) {
333 (*m_trksForThisEvent)[
num] =
t;
346 (*m_trksForThisEvent).resize(
num);
349 LogDebug(
"SimTrackManager") <<
" AFTER CLEANING, I GET " << (*m_trksForThisEvent).size()
350 <<
" tracks to be saved persistently";
351 for (
unsigned int it = 0; it < (*m_trksForThisEvent).size(); it++) {
352 LogDebug(
"SimTrackManager") <<
" Track in position " << it <<
" G4 track number "
353 << (*m_trksForThisEvent)[it]->trackID() <<
" mother "
354 << (*m_trksForThisEvent)[it]->parentID() <<
" Status "
355 << (*m_trksForThisEvent)[it]->saved() <<
" id "
356 << (*m_trksForThisEvent)[it]->particleID()
357 <<
" E(MeV)= " << (*m_trksForThisEvent)[it]->totalEnergy();
363 lastTrack = (*m_trksForThisEvent).size();
373 if (genParticleID_ == -1) {
376 for (
unsigned int itrlink = 0; itrlink < (*theLHCTlink).size(); itrlink++) {
377 if ((*
theLHCTlink)[itrlink].afterHector() == genParticleID_) {