240 G4ParticleDefinition* particleDefinition = track->GetDefinition();
241 G4int pdgCode = particleDefinition->GetPDGEncoding();
255 bool isFromMCTProcessPrimary =
false;
259 const G4DynamicParticle* dynamicParticle = track->GetDynamicParticle();
260 const G4PrimaryParticle* primaryParticle = dynamicParticle->GetPrimaryParticle();
262 size_t primarymctIndex = 0;
263 if (primaryParticle !=
nullptr) {
264 const G4VUserPrimaryParticleInformation* gppi = primaryParticle->GetUserInformation();
265 const g4b::PrimaryParticleInformation* ppi =
266 dynamic_cast<const g4b::PrimaryParticleInformation*
>(gppi);
267 if (ppi !=
nullptr) {
268 primaryIndex = ppi->MCParticleIndex();
269 primarymctIndex = ppi->MCTruthIndex();
271 mct_primary_process = ppi->GetMCParticle()->Process();
285 if (mct_primary_process.compare(
"primary") == 0) {
286 process_name =
"primary";
287 isFromMCTProcessPrimary =
true;
289 else if (mct_primary_process.find(
"primary") == 0) {
290 process_name = mct_primary_process;
291 isFromMCTProcessPrimary =
false;
292 mf::LogDebug(
"PrimaryParticle") <<
"MCTruth primary process name contains \"primary\" " 293 <<
" but is not solely \"primary\" : " << process_name
294 <<
".\nWill not store full set of trajectory points.";
297 process_name =
"primary";
298 isFromMCTProcessPrimary =
true;
300 <<
"MCTruth primary process does not beging with string" 301 <<
" literal \"primary\" : " << process_name <<
"\nOVERRIDING it to \"primary\"";
320 process_name = track->GetCreatorProcess()->GetProcessName();
322 bool notstore =
false;
324 if (process_name.find(
p) != std::string::npos) {
326 mf::LogDebug(
"NotStoredPhysics") <<
"Found process : " << process_name;
362 G4double
energy = track->GetKineticEnergy();
388 <<
"can't find parent id: " << parentID <<
" in the particle list, or fParentIDMap." 389 <<
" Make " << parentID <<
" the mother ID for" 390 <<
" track ID " <<
fCurrentTrackID <<
" in the hope that it will aid debugging.";
399 primarymctIndex = it->second;
403 <<
"Could not locate MCT Index for parent trackID of " << parentID;
411 double mass = dynamicParticle->GetMass() /
CLHEP::GeV;
431 (isFromMCTProcessPrimary) ?
436 const G4ThreeVector& polarization = track->GetPolarization();
438 TVector3{polarization.x(), polarization.y(), polarization.z()});
simb::MCParticle * particle
simple structure representing particle
decltype(auto) constexpr cend(T &&obj)
ADL-aware version of std::cend.
bool fKeepEMShowerDaughters
whether to keep EM shower secondaries, tertiaries, etc
bool keepFullTrajectory
if there was decision to keep
int GetParentage(int trackid) const
std::map< int, size_t > fMCTIndexMap
Map: particle track ID -> index of primary parent in std::vector<simb::MCTruth> object.
constexpr GeneratedParticleIndex_t NoGeneratedParticleIndex
Constant representing the absence of generator truth information.
void SetPolarization(const TVector3 &p)
static constexpr double GeV
static const int NoParticleId
std::map< size_t, std::pair< std::string, G4bool > > fMCTIndexToGeneratorMap
Map: MCTruthIndex -> generator, input label of generator and keepGenerator decision.
std::unordered_map< std::string, int > fNotStoredCounterUMap
Map: not stored process and counter.
std::vector< std::string > fNotStoredPhysics
Physics processes that will not be stored.
cet::coded_exception< errors::ErrorCodes, ExceptionDetail::translate > Exception
std::map< int, int > fParentIDMap
key is current track ID, value is parent ID
void clear()
Resets the information (does not release memory it does not own)
std::map< int, bool > fMCTPrimProcessKeepMap
Map: particle trakc ID -> boolean decision to keep or not full trajectory points. ...
simb::GeneratedParticleIndex_t truthIndex
Index of the particle in the original generator truth record.
sim::ParticleList fParticleList
MaybeLogger_< ELseverityLevel::ELsev_success, false > LogDebug
G4bool fstoreTrajectories
Whether to store particle trajectories with each particle.
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
bool fkeepOnlyPrimaryFullTraj
ParticleInfo_t fCurrentParticle
#define MF_LOG_WARNING(category)
second_as<> second
Type of time stored in seconds, in double precision.
std::size_t GeneratedParticleIndex_t
Type of particle index in the generator truth record (simb::MCTruth).