9using Athena::Units::GeV;
25 return StatusCode::SUCCESS;
38 for (
const auto& key :
m_keys) {
42 if (FormatTool->AddToEvent(
dataTypeName(), key.key() +
"_xAOD", &data).isFailure()) {
52 return StatusCode::SUCCESS;
80 const std::string mediumStr{
"Medium"};
81 const std::string tightStr{
"Tight"};
82 const std::string looseStr{
"Loose"};
83 auto prefix = [](
const std::string & root)->std::string{
86 for (; phItr != phItrE; ++phItr) {
87 ATH_MSG_DEBUG(
" Photon #" << counter++ <<
" : eta = " << (*phItr)->eta() <<
", phi = "
90 std::string photonAuthor =
"";
91 std::string photonIsEMString =
"none";
92 std::string photonLabel =
"";
98 bool passesTight(
false);
99 bool passesMedium(
false);
100 bool passesLoose(
false);
101 const bool tightSelectionExists = (*phItr)->passSelection(passesTight, tightStr);
103 <<
" and passes? " << passesTight);
104 const bool mediumSelectionExists = (*phItr)->passSelection(passesMedium, mediumStr);
106 <<
" and passes? " << passesMedium);
107 const bool looseSelectionExists = (*phItr)->passSelection(passesLoose, looseStr);
109 <<
" and passes? " << passesLoose);
111 photonAuthor =
"author"+
DataType( (*phItr)->author() ).toString();
112 photonLabel = photonAuthor;
113 if (( (*phItr)->author()) == 0){ photonAuthor =
"unknown"; photonLabel +=
"_unknown"; }
114 if (( (*phItr)->author()) == 8){ photonAuthor =
"forward"; photonLabel +=
"_forward"; }
115 if (( (*phItr)->author()) == 2){ photonAuthor =
"softe"; photonLabel +=
"_softe"; }
116 if (( (*phItr)->author()) == 1){ photonAuthor =
"egamma"; photonLabel +=
"_egamma"; }
119 photonLabel += prefix(looseStr);
120 photonIsEMString = looseStr;
123 photonLabel += prefix(mediumStr);
124 photonIsEMString = mediumStr;
127 photonLabel += prefix(tightStr);
128 photonIsEMString = tightStr;
130 author.emplace_back(
DataType( photonAuthor ) );
132 isEMString.emplace_back(
DataType( photonIsEMString ) );
135 energy.emplace_back(
DataType((*phItr)->e()/
GeV ) );
139 std::size_t nEntries =
phi.size();
143 DataMap[
"energy"] = std::move(energy);
144 DataMap[
"mass"] = std::move(mass);
145 DataMap[
"isEMString"] = std::move(isEMString);
147 DataMap[
"author"] = std::move(author);
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_WARNING(x,...)
#define ATH_MSG_VERBOSE(x,...)
Wrapper to avoid constant divisions when using units.
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
const DataMap getData(const xAOD::PhotonContainer *)
Puts the variables into a DataMap.
virtual std::string dataTypeName() const
Return the name of the data type that is generated by this retriever.
SG::ReadHandleKeyArray< xAOD::PhotonContainer > m_keys
xAODPhotonRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
For each photon collection retrieve basic parameters.
virtual StatusCode initialize()
virtual bool isValid() override final
Can the handle be successfully dereferenced?
std::string label(const std::string &format, int i)
This header is shared inbetween the C-style server thread and the C++ Athena ServerSvc.
std::map< std::string, DataVect > DataMap
std::vector< DataType > DataVect
Defines a map with a key and a vector of DataType objects e.g.
PhotonContainer_v1 PhotonContainer
Definition of the current "photon container version".