120 G4ParticleDefinition* particleDefinition = track->GetDefinition();
121 G4int pdgCode = particleDefinition->GetPDGEncoding();
124 TGeoManager *geomanager = geo->ROOTGeoManager();
130 size_t mcTruthIndex = 0;
139 const G4DynamicParticle* dynamicParticle = track->GetDynamicParticle();
140 const G4PrimaryParticle* primaryParticle = dynamicParticle->GetPrimaryParticle();
141 if ( primaryParticle ){
142 const G4VUserPrimaryParticleInformation* gppi = primaryParticle->GetUserInformation();
143 const g4b::PrimaryParticleInformation* ppi =
dynamic_cast<const g4b::PrimaryParticleInformation*
>(gppi);
148 process_name =
"primary";
154 mcTruthIndex = ppi->MCTruthIndex();
169 process_name = track->GetCreatorProcess()->GetProcessName();
170 bool is_em_shower_daughter = ( process_name.find(
"conv") != std::string::npos ||
171 process_name.find(
"LowEnConversion") != std::string::npos ||
172 process_name.find(
"Pair") != std::string::npos ||
173 process_name.find(
"compt") != std::string::npos ||
174 process_name.find(
"Compt") != std::string::npos ||
175 process_name.find(
"Brem") != std::string::npos ||
176 process_name.find(
"phot") != std::string::npos ||
177 process_name.find(
"Photo") != std::string::npos ||
178 process_name.find(
"hIoni") != std::string::npos ||
179 process_name.find(
"eIoni") != std::string::npos ||
180 process_name.find(
"ionIoni") != std::string::npos ||
181 (process_name.find(
"Ion") != std::string::npos &&
182 process_name.find(
"mu") != std::string::npos) ||
183 process_name.find(
"annihil") != std::string::npos );
184 const G4ThreeVector& trackpos = track->GetPosition();
186 auto geonode = geomanager->FindNode(trackpos[0]/
CLHEP::cm,
191 matname = geonode->GetMedium()->GetMaterial()->GetName();
196 if( is_em_shower_daughter &&
198 ! std::regex_match(matname, re_material)))
226 G4double
energy = track->GetKineticEnergy();
258 <<
"can't find parent id: " 260 <<
" in the particle list, or fParentIDMap." 263 <<
" the mother ID for" 266 <<
" in the hope that it will aid debugging.";
282 <<
"Cannot find MCTruth index for track id " 304 const G4ThreeVector& polarization = track->GetPolarization();
315 <<
" particles in the list";
319 <<
"attempting to put " 321 <<
" into fTrackIDToMCTruthIndex map " static constexpr double cm
int GetParentage(int trackid) const
std::map< int, int > fParentIDMap
key is current track ID, value is parent ID
std::unique_ptr< PositionInVolumeFilter > fFilter
filter for particles to be kept
static constexpr double MeV
ParticleInfo_t fCurrentParticle
static const int NoParticleId
std::string fEMShowerDaughterMatRegex
if keeping EM shower daughters, save only in media matching this
void SetPolarization(const TVector3 &p)
static constexpr double GeV
std::map< int, size_t > fTrackIDToMCTruthIndex
map track ID to index of MCTruth in input list
void clear()
Resets the information (does not release memory it does not own)
static int fTrackIDOffset
sim::ParticleList * fParticleList
bool keep
if there was decision to keep
bool fKeepEMShowerDaughters
whether to keep EM shower secondaries, tertiaries, etc
simb::MCParticle * particle
simple structure representing particle
#define MF_LOG_WARNING(category)
static int fCurrentTrackID
LArSoft geometry interface.
cet::coded_exception< error, detail::translate > exception