|
ATLAS Offline Software
|
Go to the documentation of this file.
16 #include "Gaudi/Property.h"
32 ISvcLocator* pSvcLocator ) :
34 m_useBeamConstraint(true),
36 m_iTHistSvc(
"THistSvc",
name)
73 return StatusCode::SUCCESS;
79 return StatusCode::SUCCESS;
89 std::vector<Trk::ITrackLink*> trackVector;
92 std::vector<const Trk::TrackParameters*> perigeeList;
96 std::unique_ptr<Trk::IVertexTrackDensityEstimator::ITrackDensity> dens;
101 for (
int i = 0;
i < 800;
i++)
103 double z = -200.0 + 0.25 +
i*0.5;
109 std::vector<Amg::Vector3D> truth;
117 return StatusCode::SUCCESS;
125 std::vector<const Trk::TrackParameters*>& perigeeList)
127 for (
auto *seedtrkAtVtxIter : trackVector)
129 perigeeList.push_back( seedtrkAtVtxIter->parameters() );
134 std::vector<Trk::ITrackLink*>& trackVector)
136 bool selectionPassed{
false};
140 if(beamSpotHandle.isValid()) beamspot = beamSpotHandle.retrieve();
142 for (
auto itr = trackParticles->
begin(); itr != trackParticles->
end(); ++itr) {
148 selectionPassed=
static_cast<bool>(
m_trackFilter->accept(**itr,&beamposition));
156 vertexError.setZero();
157 null.setCovariancePosition(vertexError);
158 selectionPassed=
static_cast<bool>(
m_trackFilter->accept(**itr,&
null));
166 trackVector.push_back(linkTT);
176 const std::vector<Trk::ITrackLink*>& trackVector,
177 std::vector<Amg::Vector3D>& truth,
179 TH1* h_modeCheck)
const
192 if (vLink ==
nullptr){
193 ATH_MSG_ERROR(
"Invalid truthVertexLink from signalEvents in GaussianDensityTestAlg::findTruth");
194 return StatusCode::FAILURE;
198 for (
auto *trk : trackVector)
203 bool isAssoc = truthParticleAssoc(**(*lxtp)).isValid();
206 const auto& assocParticle = truthParticleAssoc(**(*lxtp));
208 for (
const auto& truthParticle :
evt->truthParticleLinks())
210 if (!truthParticle.isValid())
continue;
211 if (assocParticle == truthParticle)
224 h_truthDensity->Fill(vLink->
z());
240 truth.push_back(vTruth);
241 if (abs(modeClosestDistance) > abs(
mode - vTruth[2]))
242 modeClosestDistance =
mode - vTruth[2];
258 if (vLink ==
nullptr) {
260 return StatusCode::FAILURE;
264 for (
auto *trk : trackVector)
269 bool isAssoc = truthParticleAssoc(**(*lxtp)).isValid();
272 const auto& assocParticle = truthParticleAssoc(**(*lxtp));
274 for (
const auto& truthParticle :
evt->truthParticleLinks())
276 if (!truthParticle.isValid())
continue;
277 if (assocParticle == truthParticle)
290 h_truthDensity->Fill(vLink->
z());
306 truth.push_back(vTruth);
307 if (abs(modeClosestDistance) > abs(
mode - vTruth[2]))
308 modeClosestDistance =
mode - vTruth[2];
317 h_modeCheck->Fill( modeClosestDistance );
318 return StatusCode::SUCCESS;
325 v.makePrivateStore();
328 v.setFitQuality(0., 0.);
330 double significance = 0.0;
332 if ( ipas !=
nullptr )
334 if ( ipas->sigmad0 > 0 && ipas->sigmaz0 > 0)
336 significance = sqrt(
pow(ipas->IPd0/ipas->sigmad0,2) +
pow(ipas->IPz0/ipas->sigmaz0,2) );
void setPosition(const Amg::Vector3D &position)
Sets the 3-position.
virtual StatusCode finalize()
void selectTracks(const xAOD::TrackParticleContainer *trackParticles, std::vector< Trk::ITrackLink * > &trackVector)
@ z
global position (cartesian)
const_pointer_type cptr()
Dereference the pointer.
Dummy class used to allow special convertors to be called for surfaces owned by a detector element.
ToolHandle< InDet::IInDetTrackSelectionTool > m_trackFilter
Helper class to provide constant type-safe access to aux data.
const Trk::RecVertex & beamVtx() const noexcept
#define ATH_MSG_VERBOSE(x)
ToolHandle< Trk::IVertexTrackDensityEstimator > m_estimator
float y() const
Vertex y displacement.
virtual StatusCode execute()
static void analyzeTracks(const std::vector< Trk::ITrackLink * > &trackVector, std::vector< const Trk::TrackParameters * > &perigeeList)
ServiceHandle< ITHistSvc > m_iTHistSvc
AmgSymMatrix(5) &GXFTrackState
SG::ReadHandleKey< xAOD::TrackParticleContainer > m_trackParticlesKey
Data handle keys.
::StatusCode StatusCode
StatusCode definition for legacy code.
Element link to XAOD TrackParticle.
#define CHECK(...)
Evaluate an expression and check for errors.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
const Amg::Vector3D & position() const
return position of vertex
SG::ReadHandleKey< xAOD::TruthEventContainer > m_truthEventsKey
virtual bool isValid() override final
Can the handle be successfully dereferenced?
Gaudi::Property< double > m_significanceTruthCut
bool setElement(ElementType element)
Set to point to an element.
Base class describing a pile-up or signal truth event in the MC record.
Class describing a truth vertex in the MC record.
Ensure that the ATLAS eigen extensions are properly loaded.
bool setStorableObject(BaseConstReference data, bool replace=false, IProxyDict *sg=0)
Set link to point to a new container (storable).
StatusCode initialize(bool used=true)
void makePrivateStore()
Create a new (empty) private store for this object.
Eigen::Matrix< double, 3, 1 > Vector3D
Gaudi::Property< int > m_truthVertexTracks
float x() const
Vertex x displacement.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
StatusCode findTruth(double mode, const std::vector< Trk::ITrackLink * > &trackVector, std::vector< Amg::Vector3D > &truth, TH1 *h_truthDensity, TH1 *h_modeCheck) const
SG::ReadCondHandleKey< InDet::BeamSpotData > m_beamSpotKey
Class describing a Vertex.
SG::ReadHandleKey< xAOD::TruthPileupEventContainer > m_pileupEventsKey
#define ATH_MSG_WARNING(x)
virtual ~GaussianDensityTestAlg()
Destructor:
float z() const
Vertex longitudinal distance along the beam line form the origin.
ToolHandle< Trk::ITrackToVertexIPEstimator > m_ipEstimator
TH1 * m_h_density
Histograms and trees.
def TH1F(name, title, nxbins, bins_par2, bins_par3=None, path='', **kwargs)
constexpr int pow(int base, int exp) noexcept
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
virtual StatusCode initialize()
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
double ipSignificance(const Trk::TrackParameters *params, const Amg::Vector3D *vertex) const