Commit c7c1eb9d authored by Atlas-Software Librarian's avatar Atlas-Software Librarian Committed by Graeme Stewart
Browse files

'CMakeLists.txt' (InDetTruthAlgs-00-08-05)

parent f7f9553e
################################################################################
# Package: InDetTruthAlgs
################################################################################
# Declare the package name:
atlas_subdir( InDetTruthAlgs )
# Declare the package's dependencies:
atlas_depends_on_subdirs( PUBLIC
Control/AthenaBaseComps
GaudiKernel
InnerDetector/InDetTruth/InDetTruthInterfaces
Tracking/TrkEvent/TrkTruthData
Tracking/TrkTools/TrkToolInterfaces
PRIVATE
Control/DataModel
InnerDetector/InDetRawEvent/InDetSimData
InnerDetector/InDetRecEvent/InDetPrepRawData
Reconstruction/Particle
Reconstruction/ParticleTruth
Tracking/TrkEvent/TrkTrack )
# Component(s) in the package:
atlas_add_component( InDetTruthAlgs
src/*.cxx
src/components/*.cxx
LINK_LIBRARIES AthenaBaseComps GaudiKernel TrkTruthData TrkToolInterfaces DataModel InDetSimData InDetPrepRawData Particle ParticleTruth TrkTrack )
# Install files from the package:
atlas_install_headers( InDetTruthAlgs )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef INDETDETAILEDTRACKTRUTHMAKER_H
#define INDETDETAILEDTRACKTRUTHMAKER_H
#include <string>
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrkToolInterfaces/IDetailedTrackTruthBuilder.h"
namespace InDet {
/**
* This algorithm produces track truth data using InDet PRD truth collections.
* Calls a DetailedTrackTruthBuilder tool that does the actual job.
*
* @author Andrei Gaponenko <agaponenko@lbl.gov>
*/
class InDetDetailedTrackTruthMaker : public AthAlgorithm {
public:
InDetDetailedTrackTruthMaker(const std::string &name,ISvcLocator *pSvcLocator);
virtual StatusCode initialize();
virtual StatusCode execute();
virtual StatusCode finalize();
private:
// PRD inputs
std::string m_PRDTruthNamePixel;
std::string m_PRDTruthNameSCT;
std::string m_PRDTruthNameTRT;
// Track input
std::string m_trackCollectionName;
// DetailedTrackTruthCollection output
std::string m_detailedTrackTruthName;
// Tool Handle for truth tool
ToolHandle<Trk::IDetailedTrackTruthBuilder> m_truthTool;
};
} // namespace InDet
#endif/*INDETDETAILEDTRACKTRUTHMAKER_H*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Algorithm producing truth info for PrepRawData, keeping all MC particles contributed to a PRD.
// A. Gaponenko, 2006
#ifndef PRD_MULTITRUTHMAKER_H
#define PRD_MULTITRUTHMAKER_H
#include <string>
#include "AthenaBaseComps/AthAlgorithm.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrkTruthData/PRD_MultiTruthCollection.h"
#include "InDetTruthInterfaces/IPRD_MultiTruthBuilder.h"
namespace InDet {
class PRD_MultiTruthMaker : public AthAlgorithm {
public:
PRD_MultiTruthMaker(const std::string &name,ISvcLocator *pSvcLocator);
virtual StatusCode initialize();
virtual StatusCode execute();
virtual StatusCode finalize();
private:
std::string m_PixelClustersName;
std::string m_SCTClustersName;
std::string m_TRTDriftCircleContainerName;
std::string m_simDataMapNamePixel;
std::string m_simDataMapNameSCT;
std::string m_simDataMapNameTRT;
std::string m_PRDTruthNamePixel;
std::string m_PRDTruthNameSCT;
std::string m_PRDTruthNameTRT;
ToolHandle<InDet::IPRD_MultiTruthBuilder> m_PRDTruthTool;
//----------------------------------------------------------------
template<class PRD_Container_Iterator>
void addPRDCollections(PRD_MultiTruthCollection* prdTruth,
PRD_Container_Iterator collections_begin,
PRD_Container_Iterator collections_end,
const InDetSimDataCollection* simDataMap,
bool pixels);
template<class PRD_Collection_Iterator>
void addPRDRange (PRD_MultiTruthCollection* prdTruth,
PRD_Collection_Iterator range_begin,
PRD_Collection_Iterator range_end,
const InDetSimDataCollection* simDataMap,
bool pixels);
};
} // namespace InDet
#endif //PRD_MULTITRUTHMAKER_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// TrackParticleTruthMaker.h
// Header file for class TrackParticleTruthMaker
///////////////////////////////////////////////////////////////////
#ifndef TRUTHPARTICLEALGS_TRACKPARTICLETRUTHMAKER_H
#define TRUTHPARTICLEALGS_TRACKPARTICLETRUTHMAKER_H
#include "AthenaBaseComps/AthAlgorithm.h"
#include <string>
namespace InDet {
class TrackParticleTruthMaker : public AthAlgorithm {
public:
// Constructor with parameters:
TrackParticleTruthMaker(const std::string &name,ISvcLocator *pSvcLocator);
///////////////////////////////////////////////////////////////////
// Non-const methods:
///////////////////////////////////////////////////////////////////
// Basic algorithm methods:
virtual StatusCode initialize();
virtual StatusCode execute();
virtual StatusCode finalize();
///////////////////////////////////////////////////////////////////
// Private methods:
///////////////////////////////////////////////////////////////////
private:
TrackParticleTruthMaker();
TrackParticleTruthMaker(const TrackParticleTruthMaker&);
TrackParticleTruthMaker &operator=(const TrackParticleTruthMaker&);
///////////////////////////////////////////////////////////////////
// Private data:
///////////////////////////////////////////////////////////////////
private:
std::string m_trackParticlesName;
std::string m_trackParticleTruthCollection;
std::string m_tracksName;
std::string m_tracksTruthName;
};
} // namespace InDet
#endif //TRUTHPARTICLEALGS_TRACKPARTICLETRUTHMAKER_H
package InDetTruthAlgs
author Maria Jose Costa <Maria.Jose.Costa@cern.ch>
public
use AtlasPolicy AtlasPolicy-*
use AthenaBaseComps AthenaBaseComps-* Control
use GaudiInterface GaudiInterface-* External
use TrkTruthData TrkTruthData-* Tracking/TrkEvent
use TrkToolInterfaces TrkToolInterfaces-* Tracking/TrkTools
use InDetTruthInterfaces InDetTruthInterfaces-* InnerDetector/InDetTruth
apply_pattern component_library
library InDetTruthAlgs *.cxx components/*.cxx
private
use DataModel DataModel-* Control
use Particle Particle-* Reconstruction
use ParticleTruth ParticleTruth-* Reconstruction
use TrkTrack TrkTrack-* Tracking/TrkEvent
use InDetSimData InDetSimData-* InnerDetector/InDetRawEvent
use InDetPrepRawData InDetPrepRawData-* InnerDetector/InDetRecEvent
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
/**
@mainpage InDetTruthAlgs Package
@author Maria.Jose.Costa@cern.ch, Andreas.Wildauer@cern.ch
@section InDetTruthAlgsIntro Introduction
This package contains the algorithms to create the truth objects and the
maps objects that connect the truth and the reconstructed objects.
For each of the reconstructed objects (PrepRawData, SpacePoint, Track and
TrackParticle) there is a truth object associated with it. The truth object is
meant to point to the source that contributed the most to the creation of
that object, where source here stands for either noise or a generated
particle. It contains then a HepMcParticleLink object (dominant source)
and a probability to indicate what was the contribution of this source to
the creation of the reconstructed object.
Note that a decision is taken in the algorithms filling the truth since
the information of all the other sources that also contribute is lost.
@section InDetTruthAlgsOverview Algorithm Overview
The InDetTruthAlgs package contains the following algorithms:
- PRD_MultiTruthMaker: Creates multimaps of PrepRawData (PRD_MultiTruthCollection) to their MC particles.
- InDetDetailedTrackTruthMaker: For each reconstructed Track it
creates corresponding DetailedTrackTruth objects and fills
DetailedTrackTruthCollection. It is based on the truth of all the
PrepRawData objects contained in the Track.
- TrackParticleTruthMaker: For each TrackParticle it creates the
TrackParticleTruth and fills both objects in a map. It is based on
the truth of the Track contained in the TrackParticle.
@section InDetTruthAlgsReq Requirements
@include requirements
*/
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Algorithm producing truth info for PrepRawData, keeping all MC particles contributed to a PRD.
// A. Gaponenko, 2006
#include "InDetTruthAlgs/InDetDetailedTrackTruthMaker.h"
#include "TrkTruthData/PRD_MultiTruthCollection.h"
#include "TrkTruthData/DetailedTrackTruthCollection.h"
#include "TrkTrack/TrackCollection.h"
#include <iterator>
namespace InDet {
//================================================================
InDetDetailedTrackTruthMaker::InDetDetailedTrackTruthMaker(const std::string &name, ISvcLocator *pSvcLocator) :
AthAlgorithm(name,pSvcLocator),
m_truthTool("Trk::DetailedTrackTruthBuilder")
{
declareProperty("TruthNamePixel", m_PRDTruthNamePixel = "PRD_MultiTruthPixel");
declareProperty("TruthNameSCT", m_PRDTruthNameSCT = "PRD_MultiTruthSCT");
declareProperty("TruthNameTRT", m_PRDTruthNameTRT = "PRD_MultiTruthTRT");
declareProperty("TrackCollectionName", m_trackCollectionName = "Tracks");
declareProperty("DetailedTrackTruthName", m_detailedTrackTruthName = "DetailedTrackTruth");
declareProperty("TruthTool", m_truthTool);
}
// Initialize method
// -----------------------------------------------------------------------------------------------------
StatusCode InDetDetailedTrackTruthMaker::initialize()
{
ATH_MSG_DEBUG ("InDetDetailedTrackTruthMaker::initialize()");
//----------------
if ( m_truthTool.retrieve().isFailure() ) {
ATH_MSG_FATAL ("Failed to retrieve tool " << m_truthTool);
return StatusCode::FAILURE;
} else {
ATH_MSG_INFO ("Retrieved tool " << m_truthTool);
}
//----------------
return StatusCode::SUCCESS;
}
// -----------------------------------------------------------------------------------------------------
StatusCode InDetDetailedTrackTruthMaker::finalize()
{
ATH_MSG_DEBUG ("InDetDetailedTrackTruthMaker finalized");
return StatusCode::SUCCESS;
}
// -----------------------------------------------------------------------------------------------------
StatusCode InDetDetailedTrackTruthMaker::execute()
{
ATH_MSG_DEBUG ("InDetDetailedTrackTruthMaker::execute()");
StatusCode sc;
//----------------------------------------------------------------
// Retrieve track collection
const TrackCollection *tracks = 0;
sc = evtStore()->retrieve(tracks, m_trackCollectionName);
if (sc.isFailure()){
ATH_MSG_ERROR ("TrackCollection "<<m_trackCollectionName<<" NOT found");
return sc;
} else {
ATH_MSG_DEBUG ("Got TrackCollection "<<m_trackCollectionName);
}
//----------------------------------------------------------------
// Retrieve prep raw data truth
std::vector<const PRD_MultiTruthCollection*> prdCollectionVector(3);
if(!m_PRDTruthNamePixel.empty()) {
sc = evtStore()->retrieve(prdCollectionVector[0], m_PRDTruthNamePixel);
if (sc.isFailure()){
ATH_MSG_WARNING ("Pixel PRD_MultiTruthCollection "<<m_PRDTruthNamePixel<<" NOT found");
} else {
ATH_MSG_DEBUG ("Got Pixel PRD_MultiTruthCollection "<<m_PRDTruthNamePixel);
}
}
if(!m_PRDTruthNameSCT.empty()) {
sc = evtStore()->retrieve(prdCollectionVector[1], m_PRDTruthNameSCT);
if (sc.isFailure()){
ATH_MSG_WARNING ("SCT PRD_MultiTruthCollection "<<m_PRDTruthNameSCT<<" NOT found");
} else {
ATH_MSG_DEBUG ("Got SCT PRD_MultiTruthCollection "<<m_PRDTruthNameSCT);
}
}
if(!m_PRDTruthNameTRT.empty()) {
sc = evtStore()->retrieve(prdCollectionVector[2], m_PRDTruthNameTRT);
if (sc.isFailure()){
ATH_MSG_WARNING ("TRT PRD_MultiTruthCollection "<<m_PRDTruthNameTRT<<" NOT found");
} else {
ATH_MSG_DEBUG ("Got TRT PRD_MultiTruthCollection "<<m_PRDTruthNameTRT);
}
}
//----------------------------------------------------------------
// Produce and store the output.
DetailedTrackTruthCollection *dttc = new DetailedTrackTruthCollection(tracks);
m_truthTool->buildDetailedTrackTruth(dttc, *tracks, prdCollectionVector);
sc=evtStore()->record(dttc, m_detailedTrackTruthName, false);
if (sc.isFailure()) {
ATH_MSG_ERROR ("DetailedTrackTruthCollection '" << m_detailedTrackTruthName << "' could not be registered in StoreGate !");
return StatusCode::FAILURE;
} else {
ATH_MSG_DEBUG ("DetailedTrackTruthCollection '" << m_detailedTrackTruthName << "' is registered in StoreGate, size="<<dttc->size());
}
return StatusCode::SUCCESS;
}
//================================================================
} // namespace InDet
//================================================================
//EOF
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
// Algorithm producing truth info for PrepRawData, keeping all MC particles contributed to a PRD.
// A. Gaponenko, 2006
#include "InDetTruthAlgs/PRD_MultiTruthMaker.h"
#include "TrkTruthData/PRD_MultiTruthCollection.h"
#include "InDetPrepRawData/SiClusterContainer.h"
#include "InDetPrepRawData/TRT_DriftCircleContainer.h"
#include "InDetSimData/InDetSimDataCollection.h"
#include <iterator>
namespace InDet {
//================================================================
PRD_MultiTruthMaker::PRD_MultiTruthMaker(const std::string &name, ISvcLocator *pSvcLocator) :
AthAlgorithm(name,pSvcLocator),
m_PRDTruthTool("InDet::PRD_MultiTruthBuilder")
{
declareProperty("PixelClusterContainerName", m_PixelClustersName="PixelClusters");
declareProperty("SCTClusterContainerName", m_SCTClustersName="SCT_Clusters");
declareProperty("TRTDriftCircleContainerName",m_TRTDriftCircleContainerName="TRT_DriftCircles");
declareProperty("SimDataMapNamePixel", m_simDataMapNamePixel="PixelSDO_Map");
declareProperty("SimDataMapNameSCT", m_simDataMapNameSCT="SCT_SDO_Map");
declareProperty("SimDataMapNameTRT", m_simDataMapNameTRT="TRT_SDO_Map");
declareProperty("TruthNamePixel", m_PRDTruthNamePixel="PRD_MultiTruthPixel");
declareProperty("TruthNameSCT", m_PRDTruthNameSCT="PRD_MultiTruthSCT");
declareProperty("TruthNameTRT", m_PRDTruthNameTRT="PRD_MultiTruthTRT");
declareProperty("PRDTruthTool", m_PRDTruthTool);
}
// Initialize method
// -----------------------------------------------------------------------------------------------------
StatusCode PRD_MultiTruthMaker::initialize()
{
ATH_MSG_INFO ("PRD_MultiTruthMaker::initialize()");
if ( m_PRDTruthTool.retrieve().isFailure() ) {
ATH_MSG_ERROR ("Failed to retrieve tool " << m_PRDTruthTool);
return StatusCode::FAILURE;
} else {
ATH_MSG_INFO ("Retrieved tool " << m_PRDTruthTool);
}
return StatusCode::SUCCESS;
}
// -----------------------------------------------------------------------------------------------------
StatusCode PRD_MultiTruthMaker::finalize()
{
ATH_MSG_DEBUG ("PRD_MultiTruthMaker finalized");
return StatusCode::SUCCESS;
}
// -----------------------------------------------------------------------------------------------------
StatusCode PRD_MultiTruthMaker::execute() {
ATH_MSG_DEBUG ("PRD_MultiTruthMaker::execute()");
StatusCode sc;
// work on Pixels
if(!m_PixelClustersName.empty() && !m_simDataMapNamePixel.empty() && !m_PRDTruthNamePixel.empty()) {
const InDet::SiClusterContainer* prdContainer=0;
// retrieve Pixel cluster container
sc = evtStore()->retrieve(prdContainer, m_PixelClustersName);
if (sc.isFailure() || !prdContainer){
ATH_MSG_DEBUG ("Pixel Cluster Container NOT found");
} else {
ATH_MSG_DEBUG("Pixel Cluster Container found");
// Retrieve the Pixel SDO map for this event
const InDetSimDataCollection* simDataMap=0;
sc = evtStore()->retrieve(simDataMap, m_simDataMapNamePixel);
if (sc.isFailure() || !simDataMap ) {
ATH_MSG_DEBUG ("Could NOT find the InDetSimDataPixel map");
return StatusCode::SUCCESS;
} else {
ATH_MSG_DEBUG ("Found InDetSimDataPixel, do association");
// Create and fill the PRD truth structure
PRD_MultiTruthCollection *prdt_pixels = new PRD_MultiTruthCollection;
addPRDCollections(prdt_pixels, prdContainer->begin(), prdContainer->end(), simDataMap, true);
// And register it with the StoreGate
bool allow_modifications;
sc=evtStore()->record(prdt_pixels, m_PRDTruthNamePixel, allow_modifications=false);
if (sc.isFailure()) {
ATH_MSG_ERROR ("PRD truth structure '" << m_PRDTruthNamePixel << "' could not be registered in StoreGate !");
return StatusCode::FAILURE;
} else {
ATH_MSG_DEBUG ("PRD truth structure '" << m_PRDTruthNamePixel << "' is registered in StoreGate, size="<<prdt_pixels->size());
}
}
}
}
// work on SCT
if(!m_SCTClustersName.empty() && !m_simDataMapNameSCT.empty() && !m_PRDTruthNameSCT.empty()) {
const InDet::SiClusterContainer* prdContainer=0;
// retrieve SCT cluster container
sc = evtStore()->retrieve(prdContainer, m_SCTClustersName);
if (sc.isFailure() || !prdContainer){
ATH_MSG_DEBUG ("SCT Cluster Container NOT found");
} else{
ATH_MSG_DEBUG ("SCT Cluster Container found");
// Retrieve the SCT SDO map for this event
const InDetSimDataCollection* simDataMap=0;
sc = evtStore()->retrieve(simDataMap, m_simDataMapNameSCT);
if (sc.isFailure() || !simDataMap ) {
ATH_MSG_DEBUG ("Could NOT find the InDetSimDataSCT map");
} else {
ATH_MSG_DEBUG ("Found InDetSimDataSCT, do association");
// Create and fill the PRD truth structure
PRD_MultiTruthCollection *prdt_sct = new PRD_MultiTruthCollection;
addPRDCollections(prdt_sct, prdContainer->begin(), prdContainer->end(), simDataMap, false);
// And register it with the StoreGate
bool allow_modifications;
sc=evtStore()->record(prdt_sct, m_PRDTruthNameSCT, allow_modifications=false);
if (sc.isFailure()) {
ATH_MSG_ERROR ("PRD truth structure '" << m_PRDTruthNameSCT << "' could not be registered in StoreGate !");
return StatusCode::FAILURE;
} else {
ATH_MSG_DEBUG ("PRD truth structure '" << m_PRDTruthNameSCT << "' is registered in StoreGate, size="<<prdt_sct->size());
}
}
}
}
// work on TRT
if(!m_TRTDriftCircleContainerName.empty() && !m_simDataMapNameTRT.empty() && !m_PRDTruthNameTRT.empty()) {
const InDet::TRT_DriftCircleContainer* trtContainer;
// retrieve TRT DriftCircle container
sc = evtStore()->retrieve(trtContainer, m_TRTDriftCircleContainerName);
if (sc.isFailure() || !trtContainer){
ATH_MSG_DEBUG ("TRT DriftCircle Container NOT found");
} else{
ATH_MSG_DEBUG ("TRT DriftCirlce Container found");
// Retrieve the TRT SDO map for this event
const InDetSimDataCollection* simDataMap=0;
sc = evtStore()->retrieve(simDataMap, m_simDataMapNameTRT);
if (sc.isFailure() || !simDataMap ) {
ATH_MSG_DEBUG ("Could NOT find the InDetSimDataTRT map");
} else {
ATH_MSG_DEBUG ("Found InDetSimDataTRT, do association");
// Fill the PRD truth structure
PRD_MultiTruthCollection *prdt_trt = new PRD_MultiTruthCollection;
addPRDCollections(prdt_trt, trtContainer->begin(), trtContainer->end(), simDataMap, false);
// And register it with the StoreGate
bool allow_modifications;
sc=evtStore()->record(prdt_trt, m_PRDTruthNameTRT, allow_modifications=false);
if (sc.isFailure()) {
ATH_MSG_ERROR ("PRD truth structure '" << m_PRDTruthNameTRT << "' could not be registered in StoreGate !");
return StatusCode::FAILURE;
} else {
ATH_MSG_DEBUG ("PRD truth structure '" << m_PRDTruthNameTRT << "' is registered in StoreGate, size="<<prdt_trt->size());
}
}
}
}
return StatusCode::SUCCESS;
}
// -----------------------------------------------------------------------------------------------------
template<class PRD_Container_Iterator>
void PRD_MultiTruthMaker::addPRDCollections(PRD_MultiTruthCollection* prdTruth,
PRD_Container_Iterator collections_begin,
PRD_Container_Iterator collections_end,
const InDetSimDataCollection* simDataMap,