Skip to content
Snippets Groups Projects
Commit 1f1af966 authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (MCTruthAlgs-00-03-12)

	* src/TrackRecordFilter.cxx: Fixing careless mistake in CHECK
	* tagging as MCTruthAlgs-00-03-12

2015-02-08  Zach Marshall <ZLMarshall@lbl.gov>
	* src/TrackRecordFilter.cxx: Attempting to fix resource leak, coverity
	defect 29064
	* tagging as MCTruthAlgs-00-03-11

2015-01-27  Peng Jiang
	* src/TrackRecordFilter.cxx - migrate to use AtlasHitsVector-based
	TrackRecordCollection. ATLASSIM-1784
	* tagging as MCTruthAlgs-00-03-10
parent d5e15b18
No related branches found
No related tags found
No related merge requests found
################################################################################
# Package: MCTruthAlgs
################################################################################
# Declare the package name:
atlas_subdir( MCTruthAlgs )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
GaudiKernel
PRIVATE
Simulation/G4Sim/TrackRecord )
# External dependencies:
find_package( CLHEP )
find_package( HepPDT )
# Component(s) in the package:
atlas_add_library( MCTruthAlgsLib
src/*.cxx
PUBLIC_HEADERS MCTruthAlgs
INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS}
PRIVATE_INCLUDE_DIRS ${CLHEP_INCLUDE_DIRS}
PRIVATE_DEFINITIONS ${CLHEP_DEFINITIONS}
LINK_LIBRARIES ${HEPPDT_LIBRARIES} AthenaBaseComps GaudiKernel
PRIVATE_LINK_LIBRARIES ${CLHEP_LIBRARIES} )
atlas_add_component( MCTruthAlgs
src/components/*.cxx
INCLUDE_DIRS ${HEPPDT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${HEPPDT_LIBRARIES} ${CLHEP_LIBRARIES} AthenaBaseComps GaudiKernel MCTruthAlgsLib )
# Install files from the package:
atlas_install_joboptions( share/*.py )
......@@ -24,8 +24,6 @@ TrackRecordFilter::TrackRecordFilter(const std::string& name,
declareProperty("threshold",m_cutOff=100.*CLHEP::MeV);
}
StatusCode TrackRecordFilter::initialize() {
//FIXME Old syntax
// Get the Particle Properties Service
......@@ -46,14 +44,10 @@ StatusCode TrackRecordFilter::execute() {
// Get message service
ATH_MSG_DEBUG ( "TrackRecordFilter::execute()" );
// retrieve the collection
const TrackRecordCollection* trackCollection(0);
if (evtStore()->contains<TrackRecordCollection>(m_inputName)) {
if (StatusCode::SUCCESS != evtStore()->retrieve(trackCollection, m_inputName) ) {
ATH_MSG_ERROR ( "Could not retrieve TrackRecord collection!" );
return StatusCode::SUCCESS;
}
CHECK( evtStore()->retrieve(trackCollection, m_inputName) );
}
else {
ATH_MSG_DEBUG ( "Could not find TrackRecord collection" );
......@@ -63,38 +57,31 @@ StatusCode TrackRecordFilter::execute() {
// create and record a new collection
TrackRecordCollection* filterCollection = new TrackRecordCollection();
if (StatusCode::SUCCESS != evtStore()->record(filterCollection, m_outputName) ) {
ATH_MSG_ERROR ( "can not record collection!" );
return StatusCode::SUCCESS;
}
CHECK( evtStore()->record(filterCollection, m_outputName) );
// iterate over the collection
for (TrackRecordCollection::const_iterator trkit=trackCollection->begin(); trkit != trackCollection->end() ; ++trkit) {
int pdgId((*trkit)->GetPDGCode());
ATH_MSG_VERBOSE ( "Track found with pdg id= " << (*trkit)->GetPDGCode() << " with energy "<< (*trkit)->GetEnergy() );
for (auto trkit : *trackCollection) {
int pdgId(trkit.GetPDGCode());
ATH_MSG_VERBOSE ( "Track found with pdg id= " << trkit.GetPDGCode() << " with energy "<< trkit.GetEnergy() );
if(pdgId) { //Geant makes particle with pdgid=0...
// get rid of neutral particles
const HepPDT::ParticleData* particle =
m_pParticleTable->particle(HepPDT::ParticleID(abs(pdgId)));
if(particle){
if(fabs(particle->charge() ) >0.5 && (*trkit)->GetEnergy() > m_cutOff)
filterCollection->push_back(new TrackRecord(**trkit));
if(fabs(particle->charge() ) >0.5 && trkit.GetEnergy() > m_cutOff)
filterCollection->push_back(TrackRecord(trkit));
}
}
}
//lock the collection
if (evtStore()->setConst(filterCollection).isFailure()) {
ATH_MSG_FATAL ( "Cannot set collection to const" );
return StatusCode::FAILURE;
}
CHECK( evtStore()->setConst(filterCollection) );
ATH_MSG_DEBUG ( "There are " << filterCollection->size() << "that satisfy the filter " );
return StatusCode::SUCCESS;
}
StatusCode TrackRecordFilter::finalize() {
return StatusCode::SUCCESS;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment