22 const IInterface*
p ) :
28 m_particlesKey(
"TruthParticles"),
32 m_classifier(
"MCTruthClassifier/MCTruthClassifier"),
38 declareProperty(
"ParticleSelectionString",
m_partString);
51 if (m_runClassifier)
ATH_CHECK(m_classifier.retrieve());
53 if (m_particlesKey==
"" ) {
54 ATH_MSG_FATAL(
"No truth particle collection provided to use as a basis for new collections");
55 return StatusCode::FAILURE;
56 }
else {
ATH_MSG_INFO(
"Using " << m_particlesKey <<
" as the source collections for new truth collections");}
58 if (m_collectionName==
"") {
59 ATH_MSG_FATAL(
"No key provided for the new truth particle collection");
60 return StatusCode::FAILURE;
61 }
else {
ATH_MSG_INFO(
"New truth particle collection key: " << m_collectionName );}
63 if (m_partString==
"") {
65 return StatusCode::FAILURE;
66 }
else {
ATH_MSG_INFO(
"Truth particle selection string: " << m_partString );}
69 if ( !m_partString.empty() ) {
70 ATH_CHECK( initializeParser(m_partString) );
72 return StatusCode::SUCCESS;
79 ATH_MSG_INFO(
"Processed "<< m_ntotpart <<
" truth particles, "<< m_npasspart <<
" were retained ");
81 return StatusCode::SUCCESS;
90 if (evtStore()->
retrieve(importedTruthParticles,m_particlesKey).isFailure()) {
91 ATH_MSG_ERROR(
"No TruthParticle collection with name " << m_particlesKey <<
" found in StoreGate!");
92 return StatusCode::FAILURE;
97 CHECK( evtStore()->record( newParticleCollection, m_collectionName ) );
99 CHECK( evtStore()->record( newParticleAuxCollection, m_collectionName +
"Aux." ) );
100 newParticleCollection->setStore( newParticleAuxCollection );
101 ATH_MSG_DEBUG(
"Recorded new TruthParticleContainer with key: " << m_collectionName);
104 unsigned int nParticles = importedTruthParticles->
size();
105 m_ntotpart += nParticles;
118 if (!m_partString.empty()) {
119 entries = m_parser->evaluateAsVector();
121 if (nParticles !=
entries.size() ) {
122 ATH_MSG_ERROR(
"Sizes incompatible! Are you sure your selection string used TruthParticles?");
123 return StatusCode::FAILURE;
126 for (
unsigned int i=0;
i<nParticles; ++
i) {
141 if (
MC::isW(parentPDGID) && parentMass < 20){
158 if (mcount > 10 || !
MC::isW(mother_hold)){
177 newParticleCollection->
push_back( xTruthParticle );
181 float mothermass = 0.;
185 motherPDGid = mother_hold->
pdgId();
186 mothermass = mother_hold->
p4().M()/1000.;
187 xTruthParticle->
setUid(motherUniqueID);
197 motherPDGid = mother_hold->
pdgId();
198 mothermass = mother_hold->
p4().M()/1000.;
202 *xTruthParticle=*theParticle;
203 xTruthParticle->
setUid(motherUniqueID);
204 originDecorator(*xTruthParticle) = motherPDGid;
205 typeDecorator(*xTruthParticle) = motherUniqueID;
206 typeDecoratorMass(*xTruthParticle) = mothermass;
262 tauprongDecorator(*xTruthParticle) = nprong;
263 tautypeDecorator(*xTruthParticle) = islep;
270 for (
unsigned int i=0;
i<nParticles; ++
i){
274 return StatusCode::SUCCESS;