Skip to content
Snippets Groups Projects
Commit 8533759d authored by Frank Winklmeier's avatar Frank Winklmeier
Browse files

TrkVertexFitterValidation[Tools,Interfaces]: delete unused packages

Delete unused `TrkVertexFitterValidationTools` and
`TrkVertexFitterValidationInterfaces` packages. The code has not seen any
relevant updates in a long time and packages are not referenced anywhere
in the release.
parent b542db09
No related branches found
No related tags found
No related merge requests found
Showing
with 0 additions and 1279 deletions
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( TrkVertexFitterValidationInterfaces )
atlas_add_library( TrkVertexFitterValidationInterfacesLib
TrkVertexFitterValidationInterfaces/*.h
INTERFACE
PUBLIC_HEADERS TrkVertexFitterValidationInterfaces
LINK_LIBRARIES AtlasHepMCLib GaudiKernel TrkTrack TrkTruthData VxVertex )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
////////////////////////////////////////////////////////////////////////////////
// IMcEventNtupleTool.h
// Header file for interface of McEventNtupleTools
//////////////////////////////////////////////////////////////////////////////
// (c) ATLAS Detector software
/////////////////////////////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
////////////////////////////////////////////////////////////////////////////
#ifndef TRK_IMCEVENTNTUPLETOOL_H
#define TRK_IMCEVENTNTUPLETOOL_H
#include "GaudiKernel/IAlgTool.h"
#include "AtlasHepMC/GenEvent.h"
namespace Trk {
static const InterfaceID IID_IMcEventNtupleTool("IMcEventNtupleTool",1,0);
/** @class IMcEventNtupleTool
provides the interface for validation tools which write special information
about MC particles & vertices into ntuples.
*/
class IMcEventNtupleTool : virtual public IAlgTool {
public:
/**Interface ID, declared here, and defined below*/
static const InterfaceID& interfaceID();
/** fill and write ntuple data of a given VxCandidate */
virtual StatusCode fillMcEventData(const HepMC::GenEvent&) const = 0;
};
inline const InterfaceID& Trk::IMcEventNtupleTool::interfaceID() {
return IID_IMcEventNtupleTool;
}
} // end of namespace
#endif // TRK_IMCEVENTNTUPLETOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
////////////////////////////////////////////////////////////////////////////////
// ITrueTracksValidationNtupleTool.h
// Header file for interface of TrueTracksValidationNtupleTools
//////////////////////////////////////////////////////////////////////////////
// (c) ATLAS Detector software
/////////////////////////////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
////////////////////////////////////////////////////////////////////////////
#ifndef TRK_ITRUETRACKSVALIDATIONNTUPLETOOL_H
#define TRK_ITRUETRACKSVALIDATIONNTUPLETOOL_H
#include "GaudiKernel/IAlgTool.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkTruthData/TrackTruthCollection.h"
namespace Trk {
static const InterfaceID IID_ITrueTracksValidationNtupleTool("ITrueTracksValidationNtupleTool",1,0);
/** @class ITrueTracksValidationNtupleTool
provides the interface for helper tool(s) which write true information
about track collection used for vertex finding into ntuples.
*/
class ITrueTracksValidationNtupleTool : virtual public IAlgTool {
public:
/**Interface ID, declared here, and defined below*/
static const InterfaceID& interfaceID();
/** fill and write ntuple with vertex finding relevant data of a given TrackCollectiom */
virtual StatusCode fillTrueTracksInfo(const TrackCollection&, const TrackTruthCollection&) const = 0;
};
inline const InterfaceID& Trk::ITrueTracksValidationNtupleTool::interfaceID() {
return IID_ITrueTracksValidationNtupleTool;
}
} // end of namespace
#endif // TRK_ITRUETRACKSVALIDATIONNTUPLETOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
////////////////////////////////////////////////////////////////////////////////
// IVtxValidationNtupleTool.h
// Header file for interface of VtxValidationNtupleTools
//////////////////////////////////////////////////////////////////////////////
// (c) ATLAS Detector software
/////////////////////////////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
////////////////////////////////////////////////////////////////////////////
#ifndef TRK_IVTXVALIDATIONNTUPLETOOL_H
#define TRK_IVTXVALIDATIONNTUPLETOOL_H
#include "GaudiKernel/IAlgTool.h"
#include "VxVertex/VxCandidate.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkTruthData/TrackTruthCollection.h"
namespace Trk {
static const InterfaceID IID_IVtxValidationNtupleTool("IVtxValidationNtupleTool",1,0);
/** @class IVtxValidationNtupleTool
provides the interface for validation tools which write special information
about generated vertices into ntuples.
*/
class IVtxValidationNtupleTool : virtual public IAlgTool {
public:
/**Interface ID, declared here, and defined below*/
static const InterfaceID& interfaceID();
/** fill and write ntuple data of a given VxCandidate */
virtual StatusCode fillVxCandidateData (const Trk::VxCandidate&) const = 0;
virtual StatusCode fillEventInfo(int &) const = 0;
virtual StatusCode fillTrueTrackAtVertexInfo(const Trk::VxCandidate&, const TrackCollection&, const TrackTruthCollection&) const = 0;
};
inline const InterfaceID& Trk::IVtxValidationNtupleTool::interfaceID() {
return IID_IVtxValidationNtupleTool;
}
} // end of namespace
#endif // TRK_IVTXVALIDATIONNTUPLETOOL_H
# Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
# Declare the package name:
atlas_subdir( TrkVertexFitterValidationTools )
# External dependencies:
find_package( CLHEP )
find_package( ROOT COMPONENTS Core Tree MathCore Hist RIO pthread )
# Component(s) in the package:
atlas_add_component( TrkVertexFitterValidationTools
src/*.cxx
src/components/*.cxx
INCLUDE_DIRS ${ROOT_INCLUDE_DIRS} ${CLHEP_INCLUDE_DIRS}
LINK_LIBRARIES ${ROOT_LIBRARIES} ${CLHEP_LIBRARIES} AtlasHepMCLib AthenaBaseComps GaudiKernel EventPrimitives xAODEventInfo GeneratorObjects TrkTrack TrkTruthData TrkVertexFitterValidationInterfacesLib VxVertex )
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////
// BasicVtxValidationNtupleTool.h
//////////////////////////////////////////////
// (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
///////////////////////////////////////////////////////////////////
#ifndef TRK_BASICVTXVALIDATIONNTUPLETOOL_H
#define TRK_BASICVTXVALIDATIONNTUPLETOOL_H
#include "AthenaBaseComps/AthAlgTool.h"
#include "GaudiKernel/ToolHandle.h"
#include "TrkVertexFitterValidationInterfaces/IVtxValidationNtupleTool.h"
class TTree;
namespace Trk {
/** @class BasicVtxValidationNtupleTool
This validation tool writes basic information about Trk::VxCandidate
into an ntuple.
@author Tatjana.Lenz@cern.ch
*/
class BasicVtxValidationNtupleTool : virtual public Trk::IVtxValidationNtupleTool, public AthAlgTool {
public:
// standard AlgToolmethods
BasicVtxValidationNtupleTool(const std::string&,const std::string&,const IInterface*);
~BasicVtxValidationNtupleTool();
// standard Athena methods
StatusCode initialize();
StatusCode finalize();
/** fill and write ntuple data of a given VxCandidate */
virtual StatusCode fillVxCandidateData (const Trk::VxCandidate&) const;
virtual StatusCode fillEventInfo(int &) const;
virtual StatusCode fillTrueTrackAtVertexInfo(const Trk::VxCandidate&, const TrackCollection&, const TrackTruthCollection&) const;
private:
std::string m_ntupleFileName;
std::string m_ntupleDirName;
std::string m_ntupleTreeName;
std::string m_ntupleVtxTreeName;
std::string m_ntupleTrkAtVxTreeName;
TTree * m_tree;
TTree * m_vtx_tree;
TTree * m_trk_at_vxtree;
mutable unsigned int m_lastEventNumber;
mutable int m_runNumber;
mutable int m_eventNumber;
// vertex
mutable int m_numVertices; //!< number of the fitted vertices
mutable float m_x; //!< x coordinate in mm of the fitted vertex
mutable float m_y; //!< y coordinate in mm of the fitted vertex
mutable float m_z; //!< z coordinate in mm of the fitted vertex
mutable float m_err_x; //!< x coordinate error
mutable float m_err_y; //!< y coordinate error
mutable float m_err_z; //!< z coordinate error
mutable float m_chi2; //!< chi2 is the sum over all chi2_per_track per ndf
mutable float m_chi2prob; //!< chi2 propobility of chi2 above
mutable int m_numTracksPerVertex; //!< number of the tracks per vertex
//tracks
// perigee of original tracks with vertex point as origin
mutable std::vector<float> *m_d0;
mutable std::vector<float> *m_z0;
mutable std::vector<float> *m_phi0;
mutable std::vector<float> *m_theta;
mutable std::vector<float> *m_qOverP;
// perigee errors of original tracks with vertex point as origin
mutable std::vector<float> *m_err_d0;
mutable std::vector<float> *m_err_z0;
mutable std::vector<float> *m_err_phi0;
mutable std::vector<float> *m_err_theta;
mutable std::vector<float> *m_err_qOverP;
mutable std::vector<float> *m_chi2_per_track; //!< chi2 per track
// initial track parameters
mutable std::vector<float> *m_initial_d0;
mutable std::vector<float> *m_initial_z0;
mutable std::vector<float> *m_initial_phi0;
mutable std::vector<float> *m_initial_theta;
mutable std::vector<float> *m_initial_qOverP;
mutable std::vector<float> *m_err_initial_d0;
mutable std::vector<float> *m_err_initial_z0;
mutable std::vector<float> *m_err_initial_phi0;
mutable std::vector<float> *m_err_initial_theta;
mutable std::vector<float> *m_err_initial_qOverP;
//variables for vxTrackAtVertex collection
mutable std::vector<float> *m_vxprod_x; //!< x coordinate in mm of
mutable std::vector<float> *m_vxprod_y; //!< y coordinate in mm of
mutable std::vector<float> *m_vxprod_z; //!< z coordinate in mm of
mutable std::vector<int> *m_vxparticle_id;
mutable std::vector<int> *m_vxparent_id;
mutable int m_vxnum_trks;
};
} // end of namespace
#endif // TRK_BASICVTXVALIDATIONNTUPLETOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////
// McEventNtupleTool.h
//////////////////////////////////////////////
// (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
///////////////////////////////////////////////////////////////////
#ifndef TRK_MCEVENTNTUPLETOOL_H
#define TRK_MCEVENTNTUPLETOOL_H
#include "GaudiKernel/ToolHandle.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "TrkVertexFitterValidationInterfaces/IMcEventNtupleTool.h"
class TTree;
namespace Trk {
/** @class McEventNtupleTool
This validation tool writes basic information about monte carlo event
into an ntuple.
@author Tatjana.Lenz@cern.ch
*/
class McEventNtupleTool : virtual public Trk::IMcEventNtupleTool, public AthAlgTool {
public:
// standard AlgToolmethods
McEventNtupleTool(const std::string&,const std::string&,const IInterface*);
~McEventNtupleTool();
// standard Athena methods
StatusCode initialize();
StatusCode finalize();
/** fill and write ntuple data of a given VxCandidate */
virtual StatusCode fillMcEventData (const HepMC::GenEvent&) const;
private:
std::string m_ntupleFileName;
std::string m_ntupleDirName;
std::string m_ntupleMcTreeName;
double m_ptCut;
double m_etaCut;
double m_radiusCut;
double m_zPosCut;
double m_radiusRes;
double m_zPosRes;
TTree * m_vtx_tree;
// vertex
mutable int m_numTrueVertices; //!< number of the gen vertices
mutable float m_true_pri_x; //!< x coordinate in mm of the gen vertex
mutable float m_true_pri_y; //!< y coordinate in mm of the gen vertex
mutable float m_true_pri_z; //!< z coordinate in mm of the gen vertex
mutable std::vector<float> *m_true_sec_x; //!< x coordinate in mm of the gen vertex
mutable std::vector<float> *m_true_sec_y; //!< y coordinate in mm of the gen vertex
mutable std::vector<float> *m_true_sec_z; //!< z coordinate in mm of the gen vertex
};
} // end of namespace
#endif // TRK_MCEVENTNTUPLETOOL_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////
// TrueTracksNtupleTool.h
//////////////////////////////////////////////
// (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
///////////////////////////////////////////////////////////////////
#ifndef TRK_TRUETRACKSNTUPLETOOL_H
#define TRK_TRUETRACKSNTUPLETOOL_H
#include "GaudiKernel/ToolHandle.h"
#include "AthenaBaseComps/AthAlgTool.h"
#include "TrkVertexFitterValidationInterfaces/ITrueTracksValidationNtupleTool.h"
class TTree;
namespace Trk {
/** @class TrueTracksNtupleTool
This validation tool writes basic information about Trk::TrackCollection used by the vertex finding
into an ntuple.
@author Tatjana.Lenz@cern.ch
*/
class TrueTracksNtupleTool : virtual public Trk::ITrueTracksValidationNtupleTool, public AthAlgTool {
public:
// standard AlgTool methods
TrueTracksNtupleTool(const std::string&,const std::string&,const IInterface*);
~TrueTracksNtupleTool();
// standard Athena methods
StatusCode initialize();
StatusCode finalize();
/** fill and write ntuple data of a given VxCandidate */
virtual StatusCode fillTrueTracksInfo(const TrackCollection& trkcoll, const TrackTruthCollection& trk_true_coll) const;
private:
std::string m_ntupleFileName;
std::string m_ntupleDirName;
std::string m_ntupleTreeName;
TTree * m_tree;
//variables for track collection
mutable std::vector<float> *m_prod_x; //!< x coordinate in mm of
mutable std::vector<float> *m_prod_y; //!< y coordinate in mm of
mutable std::vector<float> *m_prod_z; //!< z coordinate in mm of
mutable std::vector<int> *m_particle_id;
mutable std::vector<int> *m_parent_id;
mutable int m_num_trks;
};
} // end of namespace
#endif // TRK_TRUETRACKSNTUPLETOOL_H
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////
// BasicVtxValidationNtupleTool.cxx
// Source file for class BasicVtxValidationNtupleTool
//////////////////////////////////////////////////////
// (c) ATLAS Detector software
//////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
//////////////////////////////////////////////////////
//Gaudi
#include "GaudiKernel/ITHistSvc.h"
#include "TTree.h"
// Trk
#include "TrkVertexFitterValidationTools/BasicVtxValidationNtupleTool.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkTruthData/TrackTruthCollection.h"
#include "TrkTrack/LinkToTrack.h"
//Vertexing
#include "VxVertex/VxCandidate.h"
#include "VxVertex/VxTrackAtVertex.h"
#include "EventPrimitives/EventPrimitivesHelpers.h"
#include "xAODEventInfo/EventInfo.h"
//CLHEP
#include "CLHEP/GenericFunctions/CumulativeChiSquare.hh"
#include "AtlasHepMC/GenParticle.h"
#include "AtlasHepMC/GenVertex.h"
// constructor
Trk::BasicVtxValidationNtupleTool::BasicVtxValidationNtupleTool(
const std::string& t,
const std::string& n,
const IInterface* p )
:
AthAlgTool(t,n,p),
m_ntupleFileName("/NTUPLES"),
m_ntupleDirName("VtxFitterValidation"),
m_ntupleTreeName("EventInfo"),
m_ntupleVtxTreeName("VxCandidate"),
m_ntupleTrkAtVxTreeName("TrueTracksAtVertex"),
// see: http://atlas-computing.web.cern.ch/atlas-computing/projects/qa/draft_guidelines-0.2.html
m_tree(nullptr), //should be m_tree
m_vtx_tree(nullptr), //should be m_vtxTree
m_trk_at_vxtree(nullptr), //should be m_trkAtVxTree
m_lastEventNumber{},
m_runNumber{},
m_eventNumber{},
m_numVertices{},
m_x{},
m_y{},
m_z{},
m_err_x{},
m_err_y{},
m_err_z{},
m_chi2{},
m_chi2prob{},
m_numTracksPerVertex{},
m_d0(nullptr),
m_z0(nullptr),
m_phi0(nullptr),
m_theta(nullptr),
m_qOverP(nullptr),
m_err_d0(nullptr),
m_err_z0(nullptr),
m_err_phi0(nullptr),
m_err_theta(nullptr),
m_err_qOverP(nullptr),
m_chi2_per_track(nullptr),
m_initial_d0(nullptr),
m_initial_z0(nullptr),
m_initial_phi0(nullptr),
m_initial_theta(nullptr),
m_initial_qOverP(nullptr),
m_err_initial_d0(nullptr),
m_err_initial_z0(nullptr),
m_err_initial_phi0(nullptr),
m_err_initial_theta(nullptr),
m_err_initial_qOverP(nullptr),
m_vxprod_x(nullptr),
m_vxprod_y(nullptr),
m_vxprod_z(nullptr),
m_vxparticle_id(nullptr),
m_vxparent_id(nullptr),
m_vxnum_trks{}
{
declareInterface<IVtxValidationNtupleTool>(this);
// Declare the properties
declareProperty("NtupleFileName", m_ntupleFileName, "Ntuple file handle");
declareProperty("NtupleDirectoryName", m_ntupleDirName, "Directory name for ntuple tree");
declareProperty("NtupleTreeName", m_ntupleTreeName, "Name of the event info ntuple tree");
declareProperty("NtupleVtxTreeName", m_ntupleVtxTreeName, "Name of the vtx ntuple tree");
declareProperty("NtupleTrkAtVxTreeName", m_ntupleTrkAtVxTreeName, "Name of the tracks at vertex ntuple tree");
}
// destructor
Trk::BasicVtxValidationNtupleTool::~BasicVtxValidationNtupleTool() = default;
//////////////////
/// initialize
////////////////
StatusCode Trk::BasicVtxValidationNtupleTool::initialize() {
// Retrieve the Histo Service
ITHistSvc* hist_svc;
StatusCode status;
status=service("THistSvc",hist_svc);
if(status.isFailure())
{
msg (MSG::ERROR) << "Could not find HistService" << endmsg;
return status;
}
//registering the event info m_tree
m_tree = new TTree(TString(m_ntupleTreeName), "Event info output");
std::string fullNtupleName = m_ntupleFileName+"/"+m_ntupleDirName+"/"+m_ntupleTreeName;
status = hist_svc->regTree(fullNtupleName, m_tree);
if (status.isFailure()) {
msg(MSG::ERROR) << "Unable to register TTree : " << fullNtupleName << endmsg;
return status;
}
//registering the vtx m_tree --> VxCandidate info
m_vtx_tree = new TTree(TString(m_ntupleVtxTreeName), "VxCandidate output");
std::string fullVtxNtupleName = m_ntupleFileName+"/"+m_ntupleDirName+"/"+m_ntupleVtxTreeName;
status = hist_svc->regTree(fullVtxNtupleName, m_vtx_tree);
if (status.isFailure()) {
msg(MSG::ERROR) << "Unable to register TTree : " << fullVtxNtupleName << endmsg;
return status;
}
//registering the true trackAtVertex m_tree
m_trk_at_vxtree = new TTree(TString(m_ntupleTrkAtVxTreeName), "True tracks at vertex info output");
std::string fullTrkAtVxNtupleName = m_ntupleFileName+"/"+m_ntupleDirName+"/"+m_ntupleTrkAtVxTreeName;
status = hist_svc->regTree(fullTrkAtVxNtupleName, m_trk_at_vxtree);
if (status.isFailure()) {
msg(MSG::ERROR) << "Unable to register TTree : " << fullTrkAtVxNtupleName << endmsg;
return status;
}
//event info m_tree
m_tree->Branch("RunNumber", &m_runNumber, "runNum/I"); // Run number
m_tree->Branch("EventNumber", &m_eventNumber, "eventNum/I"); // Event number
m_tree->Branch ("numVertices", &m_numVertices, "numVtx/I");
//VxCandidate-->vtx m_tree
m_vtx_tree->Branch ("vertex_x", &m_x, "vtx_x/F");
m_vtx_tree->Branch ("vertex_y", &m_y, "vtx_y/F");
m_vtx_tree->Branch ("vertex_z", &m_z, "vtx_z/F");
m_vtx_tree->Branch ("vertex_error_x", &m_err_x, "vtx_err_x/F");
m_vtx_tree->Branch ("vertex_error_y", &m_err_y, "vtx_err_y/F");
m_vtx_tree->Branch ("vertex_error_z", &m_err_z, "vtx_err_z/F");
m_vtx_tree->Branch ("vertex_chi2_per_ndf", &m_chi2, "vtx_chi2/F");
m_vtx_tree->Branch ("vertex_chi2_prob", &m_chi2prob, "vtx_chi2prob/F");
m_vtx_tree->Branch ("num_tracks_per_vertex", &m_numTracksPerVertex, "trk_per_vtx/I");
//VxCandidate-->trks m_tree
m_d0 = new std::vector<float>();
m_z0 = new std::vector<float>();
m_phi0 = new std::vector<float>();
m_theta = new std::vector<float>();
m_qOverP = new std::vector<float>();
m_err_d0 = new std::vector<float>();
m_err_z0 = new std::vector<float>();
m_err_phi0 = new std::vector<float>();
m_err_theta = new std::vector<float>();
m_err_qOverP = new std::vector<float>();
m_chi2_per_track = new std::vector<float>();
m_initial_d0 = new std::vector<float>();
m_initial_z0 = new std::vector<float>();
m_initial_phi0 = new std::vector<float>();
m_initial_theta = new std::vector<float>();
m_initial_qOverP = new std::vector<float>();
m_err_initial_d0 = new std::vector<float>();
m_err_initial_z0 = new std::vector<float>();
m_err_initial_phi0 = new std::vector<float>();
m_err_initial_theta = new std::vector<float>();
m_err_initial_qOverP = new std::vector<float>();
m_vtx_tree->Branch ("track_d0", &m_d0);
m_vtx_tree->Branch ("track_z0", &m_z0);
m_vtx_tree->Branch ("track_phi0", &m_phi0);
m_vtx_tree->Branch ("track_theta", &m_theta);
m_vtx_tree->Branch ("track_qOverP", &m_qOverP);
m_vtx_tree->Branch ("track_err_d0", &m_err_d0);
m_vtx_tree->Branch ("track_err_z0", &m_err_z0);
m_vtx_tree->Branch ("track_err_phi0", &m_err_phi0);
m_vtx_tree->Branch ("track_err_theta", &m_err_theta);
m_vtx_tree->Branch ("track_err_qOverP", &m_err_qOverP);
m_vtx_tree->Branch ("chi2_per_track", &m_chi2_per_track);
m_vtx_tree->Branch ("track_initial_d0", &m_initial_d0);
m_vtx_tree->Branch ("track_initial_z0", &m_initial_z0);
m_vtx_tree->Branch ("track_initial_phi0", &m_initial_phi0);
m_vtx_tree->Branch ("track_initial_theta", &m_initial_theta);
m_vtx_tree->Branch ("track_initial_qOverP", &m_initial_qOverP);
m_vtx_tree->Branch ("track_err_initial_d0", &m_err_initial_d0);
m_vtx_tree->Branch ("track_err_initial_z0", &m_err_initial_z0);
m_vtx_tree->Branch ("track_err_initial_phi0", &m_err_initial_phi0);
m_vtx_tree->Branch ("track_err_initial_theta", &m_err_initial_theta);
m_vtx_tree->Branch ("track_err_initial_qOverP", &m_err_initial_qOverP);
//vxCandidate->true tracks m_tree
m_vxprod_x = new std::vector<float>();
m_vxprod_y= new std::vector<float>();
m_vxprod_z = new std::vector<float>();
m_vxparticle_id = new std::vector<int>();
m_vxparent_id = new std::vector<int>();
m_trk_at_vxtree->Branch ("vtx_track_ prod_x", &m_vxprod_x);
m_trk_at_vxtree->Branch ("vtx_track_prod_y", &m_vxprod_y);
m_trk_at_vxtree->Branch ("vtx_track_prod_z", &m_vxprod_z);
m_trk_at_vxtree->Branch ("vtx_track_particle_id", &m_vxparticle_id);
m_trk_at_vxtree->Branch ("vtx_track_parent_id", &m_vxparent_id);
m_trk_at_vxtree->Branch ("vtx_track_num_tracks", &m_vxnum_trks, "vx_numTrks/I");
return StatusCode::SUCCESS;
}
///////////////////////////////////////
/// finalize
///////////////////////////////////////
StatusCode Trk::BasicVtxValidationNtupleTool::finalize() {
msg(MSG::DEBUG) << "start finalize() in " << name() << endmsg;
return StatusCode::SUCCESS;
}
/////////////////////////////////////
/// fill VxCandidate data
////////////////////////////////////
StatusCode Trk::BasicVtxValidationNtupleTool::fillVxCandidateData (const Trk::VxCandidate& vxCandidate) const {
if (msgLvl(MSG::VERBOSE)) msg(MSG::VERBOSE) << "in fillVxCandidateData(vxCandidate)" << endmsg;
//vertex position & errors
m_x = vxCandidate.recVertex().position()[0];
m_y = vxCandidate.recVertex().position()[1];
m_z = vxCandidate.recVertex().position()[2];
m_err_x = sqrt(vxCandidate.recVertex().covariancePosition()(Trk::x,Trk::x));
m_err_y = sqrt(vxCandidate.recVertex().covariancePosition()(Trk::y,Trk::y));
m_err_z = sqrt(vxCandidate.recVertex().covariancePosition()(Trk::z,Trk::z));
//fit qualities
if (vxCandidate.recVertex().fitQuality().numberDoF() > 0.)
{
double chi2 = vxCandidate.recVertex().fitQuality().chiSquared();
int ndf = vxCandidate.recVertex().fitQuality().numberDoF();
Genfun::CumulativeChiSquare myCumulativeChiSquare(ndf);
m_chi2prob=1.-myCumulativeChiSquare(chi2);
m_chi2 = chi2/ndf;
} else { m_chi2prob = 1.; m_chi2 = 99999.;}
// for storage of tracks used for fit, check if pointer exist
if (vxCandidate.vxTrackAtVertex()) {
int numTracksPerVertex = vxCandidate.vxTrackAtVertex()->size();
m_numTracksPerVertex = numTracksPerVertex;
//loop over tracks
for ( int counter=0; counter < m_numTracksPerVertex; ++counter)
{
Trk::VxTrackAtVertex* trackAtVtx = (*vxCandidate.vxTrackAtVertex())[counter];
const Trk::Perigee* perigee = dynamic_cast<const Trk::Perigee*>(trackAtVtx->perigeeAtVertex());
if (!perigee) {
ATH_MSG_ERROR ("Track parameters are not a perigee");
return StatusCode::FAILURE;
}
//get perigee at vertex & errors
m_chi2_per_track->push_back(trackAtVtx->trackQuality().chiSquared());
m_d0->push_back(perigee->parameters()[Trk::d0]);
m_z0->push_back(perigee->parameters()[Trk::z0]);
m_phi0->push_back(perigee->parameters()[Trk::phi]);
m_theta->push_back(perigee->parameters()[Trk::theta]);
m_qOverP->push_back(perigee->parameters()[Trk::qOverP]);
m_err_d0->push_back(Amg::error(*(perigee->covariance()),Trk::d0));
m_err_z0->push_back(Amg::error(*(perigee->covariance()),Trk::z0));
m_err_phi0->push_back(Amg::error(*(perigee->covariance()),Trk::phi));
m_err_theta->push_back(Amg::error(*(perigee->covariance()),Trk::theta));
m_err_qOverP->push_back(Amg::error(*(perigee->covariance()),Trk::qOverP));
//initial perigee at ATLAS (0,0,0) & errors
const Trk::Perigee* initialPerigee = dynamic_cast<const Trk::Perigee*>(trackAtVtx->initialPerigee());
if (!initialPerigee) {
ATH_MSG_ERROR ("Track parameters are not a perigee");
return StatusCode::FAILURE;
}
m_initial_d0->push_back(initialPerigee->parameters()[Trk::d0]);
m_initial_z0->push_back(initialPerigee->parameters()[Trk::z0]);
m_initial_phi0->push_back(initialPerigee->parameters()[Trk::phi]);
m_initial_theta->push_back(initialPerigee->parameters()[Trk::theta]);
m_initial_qOverP->push_back(initialPerigee->parameters()[Trk::qOverP]);
m_err_initial_d0->push_back(Amg::error(*(initialPerigee->covariance()),Trk::d0));
m_err_initial_z0->push_back(Amg::error(*(initialPerigee->covariance()),Trk::z0));
m_err_initial_phi0->push_back(Amg::error(*(initialPerigee->covariance()),Trk::phi));
m_err_initial_theta->push_back(Amg::error(*(initialPerigee->covariance()),Trk::theta));
m_err_initial_qOverP->push_back(Amg::error(*(initialPerigee->covariance()),Trk::qOverP));
}// loop over all tracks
}
m_vtx_tree->Fill();
//clear
m_chi2_per_track->clear();
m_d0->clear();
m_z0->clear();
m_phi0->clear();
m_theta->clear();
m_qOverP->clear();
m_err_d0->clear();
m_err_z0->clear();
m_err_phi0->clear();
m_err_theta->clear();
m_err_qOverP->clear();
m_initial_d0->clear();
m_initial_z0->clear();
m_initial_phi0->clear();
m_initial_theta->clear();
m_initial_qOverP->clear();
m_err_initial_d0->clear();
m_err_initial_z0->clear();
m_err_initial_phi0->clear();
m_err_initial_theta->clear();
m_err_initial_qOverP->clear();
return StatusCode::SUCCESS;
}
/////////////////////////////////////////////////////////////
// fill true tracks at vertex data
////////////////////////////////////////////////////////////
StatusCode Trk::BasicVtxValidationNtupleTool::fillTrueTrackAtVertexInfo(const Trk::VxCandidate& vxCandidate, const TrackCollection& trk_coll, const TrackTruthCollection& trk_true_coll) const {
if (msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << "in fillTrueTrackAtVertexInfo(VxCandidate)" << endmsg;
StatusCode status;
//fill TrackAtVertex info
if (vxCandidate.vxTrackAtVertex()) {
int numTracksPerVertex = vxCandidate.vxTrackAtVertex()->size();
for (int counter = 0; counter < numTracksPerVertex; ++counter)
{
Trk::VxTrackAtVertex* trackAtVtx = (*(vxCandidate.vxTrackAtVertex()))[counter];
ElementLink<TrackCollection> tracklink;
Trk::ITrackLink* trklink = trackAtVtx->trackOrParticleLink();
Trk::LinkToTrack* linkToTrack = dynamic_cast<Trk::LinkToTrack*>(trklink);
if (!linkToTrack) {
ATH_MSG_ERROR ("Not a link to track.");
return StatusCode::FAILURE;
}
const Trk::Track* theTrack = linkToTrack->cachedElement();
tracklink.setElement(const_cast<Trk::Track*>(theTrack));
tracklink.setStorableObject(trk_coll);
const ElementLink<TrackCollection> tracklink2=tracklink;
TrackTruthCollection::const_iterator found = trk_true_coll.find(tracklink2);
if (found == trk_true_coll.end()) {
if(msgLvl(MSG::DEBUG)) msg(MSG::DEBUG) << " truth is missing" << endmsg;
}
else {
TrackTruth trk_truth=found->second;
const auto& particle = trk_truth.particleLink();
auto prod_vtx = particle->production_vertex();
//fill parent id
#ifdef HEPMC3
auto parent_iter = prod_vtx->particles_in().begin();
#else
HepMC::GenVertex::particle_iterator parent_iter = prod_vtx->particles_begin(HepMC::parents);
#endif
m_vxparent_id->push_back((*parent_iter)->pdg_id());
m_vxparticle_id->push_back(particle->pdg_id());
//fill prod vertex
m_vxprod_x->push_back(prod_vtx->position().x());
m_vxprod_y->push_back(prod_vtx->position().y());
m_vxprod_z->push_back(prod_vtx->position().z());
}
}// loop over all tracks
m_vxnum_trks = numTracksPerVertex;
} else {
if (msgLvl(MSG::DEBUG)) msg (MSG::DEBUG) << "VxCandidate without tracks!!" << endmsg;
return StatusCode::FAILURE;
}
m_trk_at_vxtree->Fill();
//clear
m_vxprod_x->clear();
m_vxprod_y->clear();
m_vxprod_z->clear();
m_vxparticle_id->clear();
m_vxparent_id->clear();
return StatusCode::SUCCESS;
}
StatusCode Trk::BasicVtxValidationNtupleTool::fillEventInfo(int& numRecVtx) const {
// ---------------------------------------
// reset Vtx counter if new event
const xAOD::EventInfo* eventInfo = nullptr;
if ((evtStore()->retrieve(eventInfo)).isFailure()) {
if (msgLvl(MSG::ERROR)) msg(MSG::ERROR) << "Could not retrieve event info" << endmsg; }
if (m_lastEventNumber!=eventInfo->eventNumber()) m_lastEventNumber = eventInfo->eventNumber();
m_eventNumber = eventInfo->eventNumber();
m_runNumber=eventInfo->runNumber();
m_numVertices = numRecVtx;
m_tree->Fill();
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////
// McEventNtupleTool.cxx
// Source file for class McEventNtupleTool
//////////////////////////////////////////////////////
// (c) ATLAS Detector software
//////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
//////////////////////////////////////////////////////
//Gaudi
#include "GaudiKernel/ITHistSvc.h"
#include "TTree.h"
// Trk
#include "TrkVertexFitterValidationTools/McEventNtupleTool.h"
//CLHEP
#include "CLHEP/Vector/LorentzVector.h"
#include "AtlasHepMC/GenParticle.h"
#include "AtlasHepMC/GenVertex.h"
#include "AtlasHepMC/GenEvent.h"
// constructor
Trk::McEventNtupleTool::McEventNtupleTool(
const std::string& t,
const std::string& n,
const IInterface* p )
:
AthAlgTool(t,n,p),
m_ntupleFileName("/NTUPLES"),
m_ntupleDirName("VtxFitterValidation"),
m_ntupleMcTreeName("MC_Vertex"),
m_ptCut(500.),
m_etaCut(2.5),
m_radiusCut(50.5),
m_zPosCut(150.),
m_radiusRes(0.044),
m_zPosRes(0.221),
m_vtx_tree(nullptr),
m_numTrueVertices{},
m_true_pri_x{},
m_true_pri_y{},
m_true_pri_z{},
m_true_sec_x(nullptr),
m_true_sec_y(nullptr),
m_true_sec_z(nullptr)
{
declareInterface<IMcEventNtupleTool>(this);
// Declare the properties
declareProperty("NtupleFileName", m_ntupleFileName, "Ntuple file handle");
declareProperty("NtupleDirectoryName", m_ntupleDirName, "Directory name for ntuple tree");
declareProperty("NtupleTrueTreeName", m_ntupleMcTreeName, "Name of the MC ntuple tree");
declareProperty("ptCut_McCollection", m_ptCut, "Pt cut on true MC vertices");
declareProperty("etaCut_McCollection", m_etaCut, "Eta cut on true MC vertices");
declareProperty("radiusCut_McCollection", m_radiusCut, "Radius cut on true MC vertices");
declareProperty("zPosCut_McCollection", m_zPosCut, "Z position cut on true MC vertices");
declareProperty("radResolution_McCollection", m_radiusRes, "MC vertex resolution criterion (radius)");
declareProperty("zResolution_McCollection", m_zPosRes, "MC vertex resolution criterion (z pos)");
}
// destructor
Trk::McEventNtupleTool::~McEventNtupleTool() = default;
//////////////////
/// initialize
////////////////
StatusCode Trk::McEventNtupleTool::initialize() {
// Retrieve the Histo Service
ITHistSvc* hist_svc;
StatusCode status;
status=service("THistSvc",hist_svc);
if(status.isFailure())
{
msg(MSG::ERROR) << "Could not find HistService" << endmsg;
return status;
}
//registering the mc event tree
m_vtx_tree = new TTree(TString(m_ntupleMcTreeName), "MC output");
std::string fullMcNtupleName = m_ntupleFileName+"/"+m_ntupleDirName+"/"+m_ntupleMcTreeName;
status = hist_svc->regTree(fullMcNtupleName, m_vtx_tree);
if (status.isFailure()) {
msg(MSG::ERROR) << "Unable to register TTree : " << fullMcNtupleName << endmsg;
return status;
}
//mc vtx tree
m_vtx_tree->Branch ("vertex_true_pri_x", &m_true_pri_x, "vtx_true_pri_x/F");
m_vtx_tree->Branch ("vertex_true_pri_y", &m_true_pri_y, "vtx_true_pri_y/F");
m_vtx_tree->Branch ("vertex_true_pri_z", &m_true_pri_z, "vtx_true_pri_z/F");
m_true_sec_x = new std::vector<float>();
m_true_sec_y = new std::vector<float>();
m_true_sec_z = new std::vector<float>();
m_vtx_tree->Branch ("vertex_true_sec_x", &m_true_sec_x);
m_vtx_tree->Branch ("vertex_true_sec_y", &m_true_sec_y);
m_vtx_tree->Branch ("vertex_true_sec_z", &m_true_sec_z);
return StatusCode::SUCCESS;
}
///////////////////////////////////////
/// finalize
///////////////////////////////////////
StatusCode Trk::McEventNtupleTool::finalize() {
msg(MSG::DEBUG) << "start finalize() in " << name() << endmsg;
return StatusCode::SUCCESS;
}
/////////////////////////////////////////////////
// fill Mc vertices data
////////////////////////////////////////////////
StatusCode Trk::McEventNtupleTool::fillMcEventData(const HepMC::GenEvent& myEvent) const {
#ifdef HEPMC3
auto Vert = myEvent.vertices().begin();
#else
HepMC::GenEvent::vertex_const_iterator Vert = myEvent.vertices_begin();
#endif
//store primary vertex
CLHEP::HepLorentzVector pv_pos((*Vert)->position().x(),
(*Vert)->position().y(),
(*Vert)->position().z(),
(*Vert)->position().t());
double pv_r = pv_pos.perp();
double pv_z = pv_pos.z();
std::map<int,HepMC::ConstGenVertexPtr> pv_vtx_ids;
std::vector<std::map<int,HepMC::ConstGenVertexPtr> > sec_vtx_ids_vec;
#ifdef HEPMC3
auto Part = myEvent.particles().begin();
auto Part_end = myEvent.particles().end();
#else
HepMC::GenEvent::particle_const_iterator Part = myEvent.particles_begin();
HepMC::GenEvent::particle_const_iterator Part_end = myEvent.particles_end();
#endif
for (;Part!=Part_end; ++Part){
//information about incomming and outgoing particles
CLHEP::HepLorentzVector par_mom((*Part)->momentum().px(),
(*Part)->momentum().py(),
(*Part)->momentum().pz(),
(*Part)->momentum().e());
auto par_vert = (*Part)->production_vertex();
if (par_vert)
{
CLHEP::HepLorentzVector lv_pos(par_vert->position().x(),
par_vert->position().y(),
par_vert->position().z(),
par_vert->position().t());
if (par_mom.perp() > m_ptCut && fabs(par_mom.eta()) <= m_etaCut && std::fabs(lv_pos.perp()) <= m_radiusCut && std::fabs(lv_pos.z()) <= m_zPosCut){
if(fabs(lv_pos.perp() - pv_r)<m_radiusRes && fabs(lv_pos.z() - pv_z)<m_zPosRes)
{
pv_vtx_ids.insert(std::make_pair(HepMC::barcode(par_vert),par_vert));
} else {
bool new_sec_vtx = true;
//loop over all entries in sec_vtx_ids_vec = vector of sec_vtx_map's
for (unsigned int sec_vec_itr = 0; sec_vec_itr < sec_vtx_ids_vec.size(); ++sec_vec_itr)
{
std::map<int,HepMC::ConstGenVertexPtr> sec_vtx_map = sec_vtx_ids_vec[sec_vec_itr];
std::map<int,HepMC::ConstGenVertexPtr>::iterator map_itr = sec_vtx_map.begin();
for (; map_itr!= sec_vtx_map.end(); ++map_itr)
{
CLHEP::HepLorentzVector sec_pos((*map_itr).second->position().x(),
(*map_itr).second->position().y(),
(*map_itr).second->position().z(),
(*map_itr).second->position().t());
double sec_r = sec_pos.perp();
double sec_z = sec_pos.z();
// if vertex position are nearly the same, store this vertex in the map
if(fabs(lv_pos.perp() - sec_r)< m_radiusRes && fabs(lv_pos.z() - sec_z)<m_zPosRes)
{
sec_vtx_map.insert(std::make_pair(HepMC::barcode(par_vert),par_vert));
new_sec_vtx = false;
break;
}
}
}
if(new_sec_vtx) //store new entry in sec_vtx_ids_vec
{
std::map<int,HepMC::ConstGenVertexPtr> new_map;
new_map.insert(std::make_pair(HepMC::barcode(par_vert),par_vert));
sec_vtx_ids_vec.push_back(new_map);
}
}//if not primary
}//eta && mom cut
}//if production vertex
}//end loop over particles
std::map<int,HepMC::ConstGenVertexPtr>::iterator pv_map_itr = pv_vtx_ids.begin();
m_true_pri_x = (*pv_map_itr).second->position().x();
m_true_pri_y = (*pv_map_itr).second->position().y();
m_true_pri_z = (*pv_map_itr).second->position().z();
for (unsigned int sec_vtx_itr = 0; sec_vtx_itr < sec_vtx_ids_vec.size(); ++sec_vtx_itr)
{
std::map<int,HepMC::ConstGenVertexPtr> sec_map = sec_vtx_ids_vec[sec_vtx_itr];
std::map<int,HepMC::ConstGenVertexPtr>::iterator map_itr = sec_map.begin();
CLHEP::HepLorentzVector sec_vtx_pos;
for (; map_itr != sec_map.end(); ++map_itr){
sec_vtx_pos.setX(sec_vtx_pos.x() + (*map_itr).second->position().x());
sec_vtx_pos.setY(sec_vtx_pos.y() + (*map_itr).second->position().y());
sec_vtx_pos.setZ(sec_vtx_pos.z() + (*map_itr).second->position().z());
sec_vtx_pos.setT(sec_vtx_pos.t() + (*map_itr).second->position().t());
}
if (!sec_map.empty()){
sec_vtx_pos = sec_vtx_pos/sec_map.size();
m_true_sec_x->push_back(sec_vtx_pos.x());
m_true_sec_y->push_back(sec_vtx_pos.y());
m_true_sec_z->push_back(sec_vtx_pos.z());
}
}
m_numTrueVertices = 1 + sec_vtx_ids_vec.size();
m_vtx_tree->Fill();
//clear
m_true_sec_x->clear();
m_true_sec_y->clear();
m_true_sec_z->clear();
return StatusCode::SUCCESS;
}
/*
Copyright (C) 2002-2022 CERN for the benefit of the ATLAS collaboration
*/
//////////////////////////////////////////////////////
// TrueTracksNtupleTool.cxx
// Source file for class TrueTracksNtupleTool
//////////////////////////////////////////////////////
// (c) ATLAS Detector software
//////////////////////////////////////////////////////
// Tatjana.Lenz@cern.ch
//////////////////////////////////////////////////////
//Gaudi
#include "GaudiKernel/ITHistSvc.h"
#include "TTree.h"
// Trk
#include "TrkVertexFitterValidationTools/TrueTracksNtupleTool.h"
#include "TrkTrack/TrackCollection.h"
#include "TrkTrack/Track.h"
#include "TrkTruthData/TrackTruthCollection.h"
//CLHEP
#include "GeneratorObjects/HepMcParticleLink.h"
#include "AtlasHepMC/GenParticle.h"
#include "AtlasHepMC/GenVertex.h"
#include "AtlasHepMC/GenEvent.h"
// constructor
Trk::TrueTracksNtupleTool::TrueTracksNtupleTool(
const std::string& t,
const std::string& n,
const IInterface* p )
:
AthAlgTool(t,n,p),
m_ntupleFileName("/NTUPLES"),
m_ntupleDirName("VtxFitterValidation"),
m_ntupleTreeName("TrueTracks"),
m_tree(nullptr),
m_prod_x(nullptr),
m_prod_y(nullptr),
m_prod_z(nullptr),
m_particle_id(nullptr),
m_parent_id(nullptr),
m_num_trks{}
{
declareInterface<ITrueTracksValidationNtupleTool>(this);
// Declare the properties
declareProperty("NtupleFileName", m_ntupleFileName, "Ntuple file handle");
declareProperty("NtupleDirectoryName", m_ntupleDirName, "directory name for ntuple tree");
declareProperty("NtupleTreeName", m_ntupleTreeName, "Name of the track ntuple tree");
}
// destructor
Trk::TrueTracksNtupleTool::~TrueTracksNtupleTool() = default;
//////////////////
/// initialize
////////////////
StatusCode Trk::TrueTracksNtupleTool::initialize() {
// Retrieve the Histo Service
ITHistSvc* hist_svc;
StatusCode status;
status=service("THistSvc",hist_svc);
if(status.isFailure())
{
msg(MSG::ERROR) << "Could not find HistService" << endmsg;
return status;
}
//registering the true tracks m_tree
m_tree = new TTree(TString(m_ntupleTreeName), "True tracks info output");
std::string fullNtupleName = m_ntupleFileName+"/"+m_ntupleDirName+"/"+m_ntupleTreeName;
status = hist_svc->regTree(fullNtupleName, m_tree);
if (status.isFailure()) {
msg (MSG::ERROR) << "Unable to register TTree : " << fullNtupleName << endmsg;
return status;
}
m_prod_x = new std::vector<float>();
m_prod_y= new std::vector<float>();
m_prod_z = new std::vector<float>();
m_particle_id = new std::vector<int>();
m_parent_id = new std::vector<int>();
m_tree->Branch ("track_ prod_x", &m_prod_x);
m_tree->Branch ("track_prod_y", &m_prod_y);
m_tree->Branch ("track_prod_z", &m_prod_z);
m_tree->Branch ("track_particle_id", &m_particle_id);
m_tree->Branch ("track_parent_id", &m_parent_id);
m_tree->Branch ("track_num_tracks", &m_num_trks, "numTrks/I");
return StatusCode::SUCCESS;
}
///////////////////////////////////////
/// finalize
///////////////////////////////////////
StatusCode Trk::TrueTracksNtupleTool::finalize() {
msg(MSG::DEBUG) << "start finalize() in " << name() << endmsg;
return StatusCode::SUCCESS;
}
/////////////////////////////////////
/// fill VxCandidateData
////////////////////////////////////
StatusCode Trk::TrueTracksNtupleTool::fillTrueTracksInfo(const TrackCollection& trk_coll, const TrackTruthCollection& trk_true_coll) const {
if (msgLvl(MSG::DEBUG)) msg (MSG::DEBUG) << "in fillTrueTracksInfo(vxTrackAtVertex)" << endmsg;
StatusCode status;
//fill track info
m_num_trks = trk_coll.size();
if (m_num_trks != 0) {
DataVector<Trk::Track>::const_iterator itr = trk_coll.begin();
for (; itr != trk_coll.end(); ++itr)
{
ElementLink<TrackCollection> tracklink;
tracklink.setElement(const_cast<Trk::Track*>(*itr));
tracklink.setStorableObject(trk_coll);
const ElementLink<TrackCollection> tracklink2=tracklink;
TrackTruthCollection::const_iterator found = trk_true_coll.find(tracklink2);
if (found == trk_true_coll.end()) {
if (msgLvl(MSG::DEBUG)) msg (MSG::DEBUG) << " truth is missing" << endmsg;
} else {
TrackTruth trk_truth=found->second;
const auto& particle = trk_truth.particleLink();
auto prod_vtx = particle->production_vertex();
//fill prod vertex
m_prod_x->push_back(prod_vtx->position().x());
m_prod_y->push_back(prod_vtx->position().y());
m_prod_z->push_back(prod_vtx->position().z());
#ifdef HEPMC3
auto parent_iter = prod_vtx->particles_in().begin();
#else
HepMC::GenVertex::particle_iterator parent_iter = prod_vtx->particles_begin(HepMC::parents);
#endif
m_parent_id->push_back((*parent_iter)->pdg_id());
m_particle_id->push_back(particle->pdg_id());
}
}//end loop over tracks
} else {
if (msgLvl(MSG::DEBUG)) msg (MSG::DEBUG) << "No tracks in the Track Collection!!" << endmsg;
}
m_tree->Fill();
m_prod_x->clear();
m_prod_y->clear();
m_prod_z->clear();
m_particle_id->clear();
m_parent_id->clear();
return StatusCode::SUCCESS;
}
#include "TrkVertexFitterValidationTools/BasicVtxValidationNtupleTool.h"
#include "TrkVertexFitterValidationTools/TrueTracksNtupleTool.h"
#include "TrkVertexFitterValidationTools/McEventNtupleTool.h"
DECLARE_COMPONENT( Trk::BasicVtxValidationNtupleTool )
DECLARE_COMPONENT( Trk::TrueTracksNtupleTool )
DECLARE_COMPONENT( Trk::McEventNtupleTool )
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