|
ATLAS Offline Software
|
#include <TruthSvc.h>
|
ServiceHandle< Barcode::IBarcodeSvc > | m_barcodeSvc {this, "BarcodeSvc", "BarcodeSvc", ""} |
| The Barcode service. More...
|
|
ToolHandleArray< ITruthStrategy > | m_truthStrategies {this, "TruthStrategies", {}, ""} |
| the truth strategies applied (as AthenaToolHandle Array) More...
|
|
ITruthStrategy ** | m_geoStrategies [AtlasDetDescr::fNumAtlasRegions] |
| for faster access: using an internal pointer to the actual ITruthStrategy instances More...
|
|
unsigned short | m_numStrategies [AtlasDetDescr::fNumAtlasRegions] |
|
Gaudi::Property< bool > | m_skipIfNoChildren {this, "SkipIfNoChildren", true, ""} |
| MCTruth steering. More...
|
|
Gaudi::Property< bool > | m_skipIfNoParentId {this, "SkipIfNoParentId", true, ""} |
| do not record if parentId == HepMC::UNDEFINED_ID More...
|
|
Gaudi::Property< bool > | m_ignoreUndefinedBarcodes {this, "IgnoreUndefinedBarcodes", false, ""} |
| do/don't abort if retrieve an undefined barcode More...
|
|
Gaudi::Property< bool > | m_passWholeVertex {this, "PassWholeVertices", true, ""} |
|
Gaudi::Property< std::vector< unsigned int > > | m_forceEndVtxRegionsVec {this, "ForceEndVtxInRegions", {}, ""} |
| property containing AtlasRegions for which More...
|
|
std::array< bool, AtlasDetDescr::fNumAtlasRegions > | m_forceEndVtx |
| attach end vertex to More...
|
|
Gaudi::Property< bool > | m_quasiStableParticlesIncluded {this, "QuasiStableParticlesIncluded", false, ""} |
| does this job simulate quasi-stable particles. More...
|
|
Gaudi::Property< bool > | m_quasiStableParticleOverwrite {this, "QuasiStableParticleOverwrite", true, ""} |
| should the job be overwriting QS particles More...
|
|
HepMC based version of the ISF::ITruthSvc, currently it takes an ITruthIncident base class
- Author
- Andreas.Salzburger -at- cern.ch , Elmar.Ritsch -at- cern.ch
Definition at line 50 of file TruthSvc.h.
◆ TruthSvc()
ISF::TruthSvc::TruthSvc |
( |
const std::string & |
name, |
|
|
ISvcLocator * |
pSvcLocator |
|
) |
| |
◆ ~TruthSvc()
virtual ISF::TruthSvc::~TruthSvc |
( |
| ) |
|
|
virtualdefault |
◆ createGenVertexFromTruthIncident()
Record and end vertex to the MC Truth for the parent particle.
Record the given truth incident to the MC Truth.
Definition at line 300 of file TruthSvc.cxx.
305 std::vector<double>
weights(1);
307 weights[0] =
static_cast<double>( primaryBC );
315 ATH_MSG_ERROR(
"Unable to write particle interaction to MC truth due to missing parent HepMC::GenParticle instance");
318 HepMC::GenEvent *mcEvent =
parent->parent_event();
320 ATH_MSG_ERROR(
"Unable to write particle interaction to MC truth due to missing parent HepMC::GenEvent instance");
328 ATH_MSG_WARNING(
"Unable to generate new Truth Vertex Barcode. Continuing due to 'IgnoreUndefinedBarcodes'==True");
330 ATH_MSG_ERROR(
"Unable to generate new Truth Vertex Barcode. Aborting");
339 std::unique_ptr<HepMC::GenVertex> newVtx = std::make_unique<HepMC::GenVertex>( ti.
position(), vtxStatus,
weights );
343 if (
parent->end_vertex()){
344 ATH_MSG_ERROR (
"createGVfromTI: Parent particle found with an end vertex attached. This should not happen!");
349 #ifdef DEBUG_TRUTHSVC
353 newVtx->add_particle_in(
parent );
354 #ifdef DEBUG_TRUTHSVC
355 ATH_MSG_VERBOSE (
"createGVfromTI End Vertex representing process: " << processCode <<
", for parent with barcode "<<parentBC<<
". Creating." );
359 mcEvent->add_vertex(newVtx);
361 newVtx->add_attribute(
"weights",std::make_shared<HepMC3::VectorDoubleAttribute>(
weights));
363 mcEvent->add_vertex( newVtx.release() );
367 return parent->end_vertex();
◆ finalize()
StatusCode ISF::TruthSvc::finalize |
( |
| ) |
|
|
override |
◆ initialize()
StatusCode ISF::TruthSvc::initialize |
( |
| ) |
|
|
override |
Athena algorithm's interface method initialize()
framework methods
Definition at line 57 of file TruthSvc.cxx.
62 ATH_MSG_DEBUG(
"--------------------------------------------------------");
67 return StatusCode::FAILURE;
77 if(truthStrategy->appliesToRegion(geoID)) {
85 unsigned short nStrat(0);
86 for (
unsigned short i = 0;
i < curNumStrategies; ++
i) {
100 return StatusCode::SUCCESS;
◆ initializeTruthCollection()
StatusCode ISF::TruthSvc::initializeTruthCollection |
( |
int |
largestGeneratedParticleBC = 0 , |
|
|
int |
largestGeneratedVertexBC = 0 |
|
) |
| |
|
override |
Initialize the Truth Svc at the beginning of each event.
Initialize the TruthSvc and the truthSvc.
Definition at line 113 of file TruthSvc.cxx.
116 return StatusCode::SUCCESS;
◆ recordIncidentToMCTruth()
void ISF::TruthSvc::recordIncidentToMCTruth |
( |
ISF::ITruthIncident & |
ti, |
|
|
bool |
passWholeVertex |
|
) |
| const |
|
private |
Record the given truth incident to the MC Truth.
Definition at line 199 of file TruthSvc.cxx.
200 #ifdef DEBUG_TRUTHSVC
206 ATH_MSG_WARNING (
"Attempting to record a TruthIncident for a particle which has already decayed!");
214 #ifdef DEBUG_TRUTHSVC
217 ATH_MSG_INFO(
"TruthSvc: " << vtxType <<
" vertex + " << survival
231 newPrimaryBC =
m_barcodeSvc->newGeneratedParticle(parentBC);
238 if(parentAfterIncident) {
246 ATH_MSG_WARNING (
"recordIncidentToMCTruth - check parentAfterIncident: " << parentAfterIncident );
249 vtxFromTI->add_particle_out( parentAfterIncident );
262 for (
unsigned short i=0;
i<numSec; ++
i) {
267 int secondaryParticleBC = (isQuasiStableVertex) ?
271 ATH_MSG_WARNING(
"Unable to generate new Secondary Particle Barcode. Continuing due to 'IgnoreUndefinedBarcodes'==True");
273 ATH_MSG_ERROR(
"Unable to generate new Secondary Particle Barcode. Aborting");
280 vtxFromTI->add_particle_out(
p);
296 ATH_MSG_VERBOSE(
"--------------------------------------------------------");
◆ registerTruthIncident()
void ISF::TruthSvc::registerTruthIncident |
( |
ISF::ITruthIncident & |
ti, |
|
|
bool |
saveAllChildren = false |
|
) |
| const |
|
override |
Register a truth incident.
Definition at line 125 of file TruthSvc.cxx.
136 const auto& position = ti.
position();
137 ATH_MSG_ERROR(
"Unable to register truth incident with unknown SimGeoID="<< geoID
138 <<
" at position z=" << position.z() <<
" r=" << position.perp());
149 <<
" will not record this TruthIncident.");
156 ATH_MSG_VERBOSE(
"Parent particle in TruthIncident does not have an id,"
157 <<
" will not record this TruthIncident.");
163 for (
unsigned short stratID=0; (!pass) && (stratID<
m_numStrategies[geoID]); stratID++) {
179 ATH_MSG_VERBOSE(
"No TruthStrategies passed and parent destroyed - create end vertex.");
182 #ifdef DEBUG_TRUTHSVC
185 ATH_MSG_INFO(
"TruthSvc: " << vtxType <<
" vertex + " << survival
◆ releaseEvent()
StatusCode ISF::TruthSvc::releaseEvent |
( |
| ) |
|
|
override |
Finalize the Truth Svc at the end of each event.
Definition at line 119 of file TruthSvc.cxx.
120 return StatusCode::SUCCESS;
◆ m_barcodeSvc
◆ m_forceEndVtx
◆ m_forceEndVtxRegionsVec
Gaudi::Property<std::vector<unsigned int> > ISF::TruthSvc::m_forceEndVtxRegionsVec {this, "ForceEndVtxInRegions", {}, ""} |
|
private |
property containing AtlasRegions for which
Definition at line 98 of file TruthSvc.h.
◆ m_geoStrategies
◆ m_ignoreUndefinedBarcodes
Gaudi::Property<bool> ISF::TruthSvc::m_ignoreUndefinedBarcodes {this, "IgnoreUndefinedBarcodes", false, ""} |
|
private |
do/don't abort if retrieve an undefined barcode
Definition at line 94 of file TruthSvc.h.
◆ m_numStrategies
◆ m_passWholeVertex
Gaudi::Property<bool> ISF::TruthSvc::m_passWholeVertex {this, "PassWholeVertices", true, ""} |
|
private |
◆ m_quasiStableParticleOverwrite
Gaudi::Property<bool> ISF::TruthSvc::m_quasiStableParticleOverwrite {this, "QuasiStableParticleOverwrite", true, ""} |
|
private |
should the job be overwriting QS particles
Definition at line 104 of file TruthSvc.h.
◆ m_quasiStableParticlesIncluded
Gaudi::Property<bool> ISF::TruthSvc::m_quasiStableParticlesIncluded {this, "QuasiStableParticlesIncluded", false, ""} |
|
private |
does this job simulate quasi-stable particles.
Definition at line 103 of file TruthSvc.h.
◆ m_skipIfNoChildren
Gaudi::Property<bool> ISF::TruthSvc::m_skipIfNoChildren {this, "SkipIfNoChildren", true, ""} |
|
private |
MCTruth steering.
do not record incident if numChildren==0
Definition at line 92 of file TruthSvc.h.
◆ m_skipIfNoParentId
Gaudi::Property<bool> ISF::TruthSvc::m_skipIfNoParentId {this, "SkipIfNoParentId", true, ""} |
|
private |
◆ m_truthStrategies
ToolHandleArray<ITruthStrategy> ISF::TruthSvc::m_truthStrategies {this, "TruthStrategies", {}, ""} |
|
private |
the truth strategies applied (as AthenaToolHandle Array)
Definition at line 86 of file TruthSvc.h.
The documentation for this class was generated from the following files:
HepMC::GenVertex * GenVertexPtr
virtual const HepMC::FourVector & position() const =0
Return HepMC position of the truth vertex.
bool suggest_barcode(T &p, int i)
virtual HepMC::GenParticlePtr childParticle(unsigned short index, int bc=HepMC::UNDEFINED_ID)=0
Return the i-th child as a HepMC particle type and assign the given Barcode to the simulator particle...
Gaudi::Property< bool > m_passWholeVertex
std::string find(const std::string &s)
return a remapped string
virtual int physicsProcessCode() const =0
Return specific physics process code of the truth incident (eg ionisation, bremsstrahlung,...
GenParticle * GenParticlePtr
Gaudi::Property< std::vector< unsigned int > > m_forceEndVtxRegionsVec
property containing AtlasRegions for which
virtual int childBarcode(unsigned short index) const =0
Return the barcode of the i-th child particle (if defined as part of the TruthIncident) otherwise ret...
virtual ISF::InteractionClass_t interactionClassification() const
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...
#define ATH_MSG_VERBOSE(x)
static const char * getName(int region)
ServiceHandle< Barcode::IBarcodeSvc > m_barcodeSvc
The Barcode service.
virtual HepMC::GenParticlePtr parentParticleAfterIncident(int newBC)=0
Return the parent particle after the TruthIncident vertex (and assign a new barcode to it)
ITruthStrategy ** m_geoStrategies[AtlasDetDescr::fNumAtlasRegions]
for faster access: using an internal pointer to the actual ITruthStrategy instances
virtual HepMC::GenParticlePtr parentParticle()=0
Return the parent particle as a HepMC particle type (only called for particles that will enter the He...
unsigned short numberOfChildren() const
Return total number of child particles.
virtual bool pass(ITruthIncident &incident) const =0
true if the ITruthStrategy implementation applies to the given ITruthIncident
GenVertexPtr newGenVertexPtr(const HepMC::FourVector &pos=HepMC::FourVector(0.0, 0.0, 0.0, 0.0), const int i=0)
HepMC::GenVertexPtr createGenVertexFromTruthIncident(ITruthIncident &truthincident) const
Record and end vertex to the MC Truth for the parent particle.
AthROOTErrorHandlerSvc * svc
virtual bool parentSurvivesIncident() const =0
Return a boolean whether or not the parent particle survives the incident.
Gaudi::Property< bool > m_skipIfNoParentId
do not record if parentId == HepMC::UNDEFINED_ID
constexpr int UNDEFINED_ID
constexpr int SIM_REGENERATION_INCREMENT
Constant defining the barcode threshold for regenerated particles, i.e. particles surviving an intera...
void recordIncidentToMCTruth(ITruthIncident &truthincident, bool passWholeVertex) const
Record the given truth incident to the MC Truth.
constexpr int SIM_STATUS_THRESHOLD
Constant definiting the status threshold for simulated particles, eg. can be used to separate generat...
InteractionClass_t
The interaction classifications are described as follows: STD_VTX: interaction of a particle without ...
Gaudi::Property< bool > m_skipIfNoChildren
MCTruth steering.
bool childPassedFilters(unsigned short index) const
Should a particular child be written out to the GenEvent.
ToolHandleArray< ITruthStrategy > m_truthStrategies
the truth strategies applied (as AthenaToolHandle Array)
std::array< bool, AtlasDetDescr::fNumAtlasRegions > m_forceEndVtx
attach end vertex to
virtual int parentBarcode()=0
Return the barcode of the parent particle.
#define ATH_MSG_WARNING(x)
bool isDecayed(const T &p)
Identify if the particle decayed.
void setPassWholeVertices(bool passWholeVertex)
Set whether this TruthIncident should pass the vertex as a whole or individual children.
unsigned short m_numStrategies[AtlasDetDescr::fNumAtlasRegions]
virtual int physicsProcessCategory() const =0
Return category of the physics process represented by the truth incident (eg hadronic,...
#define validAtlasRegion(region)
Gaudi::Property< bool > m_ignoreUndefinedBarcodes
do/don't abort if retrieve an undefined barcode
virtual int parentUniqueID()=0
Return the unique ID of the parent particle.
AtlasDetDescr::AtlasRegion geoID()
Return the SimGeoID corresponding to the vertex of the truth incident.