6#include "CaloGeoHelpers/CaloSampling.h"
9using Athena::Units::GeV;
26 return StatusCode::SUCCESS;
40 for (
const auto& key :
m_keys) {
44 if (FormatTool->AddToEvent(
dataTypeName(), key.key() +
"_xAOD", &
data).isFailure()) {
54 return StatusCode::SUCCESS;
83 float eInSampleFull = 0.;
90 tagCells =
"cells multiple=\"1.0\"";
93 for (; itr != ccc->
end(); ++itr) {
98 for (s=0;s<CaloSampling::Unknown; s++){
102 eInSample += (*itr)->eSample(CaloSampling::EMB1);
103 eInSample += (*itr)->eSample(CaloSampling::EMB2);
104 eInSample += (*itr)->eSample(CaloSampling::EMB3);
105 eInSample += (*itr)->eSample(CaloSampling::EME1);
106 eInSample += (*itr)->eSample(CaloSampling::EME2);
107 eInSample += (*itr)->eSample(CaloSampling::EME3);
108 eInSample += (*itr)->eSample(CaloSampling::FCAL1);
110 emfrac = eInSample/eInSampleFull;
113 if ( emfrac > 1.0 ) emfrac = 1.;
114 if ( emfrac < 0.0 ) emfrac = 0.;
115 emfracVec.emplace_back(
DataType(emfrac).toString() );
117 if (
DataType( eInSample ).toString() !=
"0." ){
118 label =
"AllMeV_SumEMSampl=" +
DataType( eInSample ).toString() +
119 "_SumAllSampl=" +
DataType( eInSampleFull ).toString() +
120 "_calcEMFrac=" +
DataType( rawemfrac ).toString()+
121 "_outEMFrac=" +
DataType( emfrac ).toString();
122 }
else{
label =
"n_a"; }
126 labelVec.emplace_back(
label );
135 numCells.emplace_back(
DataType(
"0" ));
136 cells.emplace_back(
DataType(
"0" ));
137 idVec.emplace_back(
DataType( ++
id ));
140 <<
" ,e=" << (*itr)->e()/
GeV <<
", et="
141 << (*itr)->et()/
GeV <<
", eta=" << (*itr)->eta()
142 <<
", phi=" << (*itr)->phi());
145 const auto n =
phi.size();
149 DataMap[tagCells] = std::move(cells);
150 DataMap[
"numCells"] = std::move(numCells);
151 DataMap[
"id"] = std::move(idVec);
152 DataMap[
"emfrac"] = std::move(emfracVec);
153 DataMap[
"label"] = std::move(labelVec);
156 <<
" retrieved with " << n <<
" entries");
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
char data[hepevt_bytes_allocation_ATLAS]
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::CaloClusterContainer *)
Puts the variables into a DataMap.
SG::ReadHandleKeyArray< xAOD::CaloClusterContainer > m_keys
virtual std::string dataTypeName() const
Return the name of the data type that is generated by this retriever.
virtual StatusCode retrieve(ToolHandle< IFormatTool > &FormatTool)
For each cluster collection retrieve basic parameters.
xAODCaloClusterRetriever(const std::string &type, const std::string &name, const IInterface *parent)
Standard Constructor.
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.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
Extra patterns decribing particle interation process.