9using Athena::Units::GeV;
26 return StatusCode::SUCCESS;
38 for (
const auto& key :
m_keys) {
42 if (FormatTool->AddToEvent(
dataTypeName(), key.key() +
"_xAOD", &data).isFailure()) {
51 return StatusCode::SUCCESS;
80 auto prefix = [](
const std::string & root)->std::string {
83 for (; elItr != elItrE; ++elItr) {
85 std::string electronAuthor =
"";
86 std::string electronIsEMString =
"none";
87 std::string electronLabel =
"";
94 if ((*elItr)->trackParticle()){
95 pdgId.emplace_back(
DataType( -11.*(*elItr)->trackParticle()->charge() ));
100 ATH_MSG_DEBUG(
" Electron #" << counter++ <<
" : eta = " << (*elItr)->eta() <<
", phi = "
103 <<
", author = " << (*elItr)->author()
111 bool passesTight(
false);
112 bool passesMedium(
false);
113 bool passesLoose(
false);
114 static const std::string tightStr{
"Tight"};
115 const bool tightSelectionExists = (*elItr)->passSelection(passesTight, tightStr);
117 <<
" and passes? " << passesTight);
118 static const std::string mediumStr{
"Medium"};
119 const bool mediumSelectionExists = (*elItr)->passSelection(passesMedium, mediumStr);
121 <<
" and passes? " << passesMedium);
122 static const std::string looseStr{
"Loose"};
123 const bool looseSelectionExists = (*elItr)->passSelection(passesLoose, looseStr);
125 <<
" and passes? " << passesLoose);
127 electronAuthor =
"author"+
DataType( (*elItr)->author() ).toString();
128 electronLabel = electronAuthor;
129 if (( (*elItr)->author()) == 0){ electronAuthor =
"unknown"; electronLabel +=
"_unknown"; }
130 if (( (*elItr)->author()) == 8){ electronAuthor =
"forward"; electronLabel +=
"_forward"; }
131 if (( (*elItr)->author()) == 2){ electronAuthor =
"softe"; electronLabel +=
"_softe"; }
132 if (( (*elItr)->author()) == 1){ electronAuthor =
"egamma"; electronLabel +=
"_egamma"; }
135 electronLabel += prefix(looseStr);
136 electronIsEMString = looseStr;
139 electronLabel += prefix(mediumStr);
140 electronIsEMString = mediumStr;
143 electronLabel += prefix(tightStr);
144 electronIsEMString = tightStr;
146 author.emplace_back(
DataType( electronAuthor ) );
148 isEMString.emplace_back(
DataType( electronIsEMString ) );
153 std::size_t nEntries =
phi.size();
157 DataMap[
"energy"] = std::move(energy);
158 DataMap[
"mass"] = std::move(mass);
159 DataMap[
"pdgId"] = std::move(pdgId);
160 DataMap[
"isEMString"] = std::move(isEMString);
162 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.
virtual std::string dataTypeName() const
Return the name of the data type that is generated by this retriever.
xAODElectronRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
virtual StatusCode initialize()
const DataMap getData(const xAOD::ElectronContainer *)
Puts the variables into a DataMap.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
For each electron collection retrieve basic parameters.
SG::ReadHandleKeyArray< xAOD::ElectronContainer > m_keys
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.
ElectronContainer_v1 ElectronContainer
Definition of the current "electron container version".