|
ATLAS Offline Software
|
Go to the documentation of this file.
12 #include <TLorentzVector.h>
24 :
EL::AnaAlgorithm(
name, svcLoc) {}
50 <<
" photons for pointing");
54 for (
unsigned int icut = 0;
57 "cut " << icut <<
": "
60 return StatusCode::SUCCESS;
78 const std::pair<float, float> z_common_and_error =
83 auto pointingVertices = std::make_unique<xAOD::VertexContainer>();
84 auto pointingVerticesAux = std::make_unique<xAOD::VertexAuxContainer>();
85 pointingVertices->setStore(pointingVerticesAux.get());
89 (*pointingVertices).push_back(std::make_unique<xAOD::Vertex>());
93 vtx_pointing->
setZ(z_common_and_error.first);
94 vtx_pointing->
setX(0.0);
95 vtx_pointing->
setY(0.0);
98 cov(2, 2) = z_common_and_error.second * z_common_and_error.second;
102 ANA_CHECK(writeHandle.record(std::move(pointingVertices),
103 std::move(pointingVerticesAux)));
107 const unsigned int n_good_photons =
108 std::count_if(photons_selected.
begin(), photons_selected.
end(),
110 return m_goodPhotonSelectionTool->accept(photon);
113 std::vector<ElementLink<xAOD::EgammaContainer>> ph_links;
114 ph_links.reserve(photons_selected.size());
116 ph_links.emplace_back(*original_photons,
photon->index());
123 dec_nphotons(*vtx_pointing) = photons_selected.size();
124 dec_ph_links(*vtx_pointing) = ph_links;
125 dec_nphotons_good(*vtx_pointing) = n_good_photons;
129 photons_selected.begin(), photons_selected.end(),
130 TLorentzVector(0, 0, 0, 0),
134 v_ph.SetPtEtaPhiM(
photon->e() / cosh(cluster->
etaBE(2)),
144 dec_photons_px(*vtx_pointing) = p4_photons.X();
145 dec_photons_py(*vtx_pointing) = p4_photons.Y();
146 dec_photons_pz(*vtx_pointing) = p4_photons.Z();
148 return StatusCode::SUCCESS;
156 photons_selected.push_back(
photon);
162 "number of photons selected for pointing: " << photons_selected.size());
167 std::sort(photons_selected.begin(), photons_selected.end(),
169 return a->pt() > b->pt();
174 ATH_MSG_DEBUG(
"number of photons selected for pointing after limiting: "
175 << photons_selected.size());
SG::ReadDecorHandleKey< xAOD::EgammaContainer > m_photon_zvertex_key
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
iterator end() noexcept
Return an iterator pointing past the end of the collection.
DataVector adapter that acts like it holds const pointers.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_photon_links_key
BuildVertexPointingAlg(const std::string &name, ISvcLocator *svcLoc=nullptr)
bool accumulate(AccumulateMap &map, std::vector< module_t > const &modules, FPGATrackSimMatrixAccumulator const &acc)
Accumulates an accumulator (e.g.
std::pair< float, float > getZCommonAndError(const xAOD::EventInfo *eventInfo, const xAOD::EgammaContainer *egammas, float convPtCut=2e3)
Return zCommon and zCommonError.
bool msgLvl(const MSG::Level lvl) const
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
Gaudi::Property< float > m_convPtCut
SG::ReadDecorHandleKey< xAOD::EgammaContainer > m_photon_errz_key
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_nphotons_good_key
void setX(float value)
Sets the x position.
Class providing the definition of the 4-vector interface.
#define AmgSymMatrix(dim)
const DV * asDataVector() const
Return a pointer to this object, as a const DataVector.
SG::ReadCondHandle< T > makeHandle(const SG::ReadCondHandleKey< T > &key, const EventContext &ctx=Gaudi::Hive::currentContext())
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
void setVertexType(VxType::VertexType vType)
Set the type of the vertex.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_photons_px_key
Description of a calorimeter cluster.
void setZ(float value)
Sets the z position.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_photons_py_key
void setY(float value)
Sets the y position.
::StatusCode StatusCode
StatusCode definition for legacy code.
Gaudi::Property< int > m_nphotons_to_use
This module defines the arguments passed from the BATCH driver to the BATCH worker.
virtual StatusCode execute()
ToolHandle< IAsgSelectionTool > m_selectionTool
SG::ReadDecorHandleKey< xAOD::EgammaContainer > m_photon_HPV_zvertex_key
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
SG::ReadDecorHandleKey< xAOD::EgammaContainer > m_photon_HPV_errz_key
SG::WriteHandleKey< xAOD::VertexContainer > m_pointingVertexContainerKey
void selectPhotons(const xAOD::EgammaContainer &original_photons, ConstDataVector< DataVector< xAOD::Egamma >> &photons_selected) const
Class describing the basic event information.
SG::ReadHandleKey< xAOD::EgammaContainer > m_photonContainerKey
Class describing a Vertex.
DataVector adapter that acts like it holds const pointers.
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_photons_pz_key
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
SG::WriteDecorHandleKey< xAOD::VertexContainer > m_z_common_nphotons_key
virtual StatusCode initialize()
const T * get(const ReadHandleKey< T > &key)
Convenience function to retrieve an object given a ReadHandleKey.
void setCovariancePosition(const AmgSymMatrix(3)&covariancePosition)
Sets the vertex covariance matrix.
iterator begin() noexcept
Return an iterator pointing at the beginning of the collection.