61{
62
63
64 static const std::vector<CaloSampling::CaloSample> s_sam
65 { CaloSampling::PreSamplerB, CaloSampling::EMB1,
66 CaloSampling::EMB2, CaloSampling::EMB3,
67 CaloSampling::PreSamplerE, CaloSampling::EME1,
68 CaloSampling::EME2, CaloSampling::EME3,
69 CaloSampling::TileBar0, CaloSampling::TileBar1, CaloSampling::TileBar2,
70 CaloSampling::TileExt0, CaloSampling::TileExt1, CaloSampling::TileExt2,
71 CaloSampling::TileGap1, CaloSampling::TileGap2, CaloSampling::TileGap3,
72 CaloSampling::HEC0, CaloSampling::HEC1,
73 CaloSampling::HEC2, CaloSampling::HEC3,
74 CaloSampling::FCAL0, CaloSampling::FCAL1, CaloSampling::FCAL2 };
75
76
77 SG::WriteHandle<xAOD::CaloClusterContainer> outClusterContainer(
79 ctx
80 );
82
83 SG::WriteHandle<CaloClusterCellLinkContainer> outClusterContainerCellLink(
85 ctx
86 );
87 ATH_CHECK(outClusterContainerCellLink.record(
88 std::make_unique<CaloClusterCellLinkContainer>())
89 );
90
91
93 ctx);
95 if (nF == 0) {
96 return StatusCode::SUCCESS;
97 }
98
99 std::vector<SG::WriteDecorHandle<xAOD::EgammaContainer, float>> decoM;
103 }
104
105 if (msgLevel(MSG::DEBUG)) {
106 std::call_once(
m_Seen, [
this,&decoM]() {
110 << " " << decoM[i].decorKey());
111 }
112 });
113 }
115 ElementLink<xAOD::CaloClusterContainer>>
117
118
119 SG::ReadCondHandle<CaloDetDescrManager> caloDetDescrMgrHandle{
121 };
123 const CaloDetDescrManager* calodetdescrmgr = *caloDetDescrMgrHandle;
124
125
126 int iel = 0;
127 std::vector<bool> success(nF,true);
130
133 <<
" pT = " << cluster->
pt()
134 <<
" eta = " << cluster->
eta());
135
136 const DataLink<CaloCellContainer>& cellCont =
138
139 std::unique_ptr<xAOD::CaloCluster> newCluster =
142
143 if (!newCluster || newCluster->getCellLinks()->size() == 0) {
148 <<
" original cluster " << cluster->
index()
149 <<
" pT = " << cluster->
pt()
150 <<
" eta = " << cluster->
eta()
151 << " has EME2 or FCAL0"
153 <<
" " << cluster->
hasSampling(CaloSampling::FCAL0)
154 << " reason : "
155 << (newCluster ? " no cells in cluster" : " no cluster"));
156 if (!newCluster) {
158 for (auto s : s_sam)
160 }
161 decoEl(*electron) = ElementLink<xAOD::CaloClusterContainer>();
162 success[iel] = false;
163 }
164
165 if (success[iel]) {
166 if (newCluster) {
168 << " pT = " << newCluster->pt()
169 << " eta = " << newCluster->eta());
170 }
171 outClusterContainer->push_back(std::move(newCluster));
172 size_t index = outClusterContainer->size() - 1;
173 ElementLink<xAOD::CaloClusterContainer>
174 clusterLink(*outClusterContainer, index, ctx);
175
176 decoEl(*electron) = clusterLink;
177 }
178
179
181 for (
size_t i = 0;
i <
m_vecM.size();
i++) {
186 if (!gotM) {
188 << " does not exist for the original cluster");
189 }
190 decoM[indexDecor](*electron) =
float(m);
192 << " with original moment "
194 << " = " << m << " (decoration index =" << indexDecor
195 << " key = " << decoM[indexDecor].decorKey() << ")");
196 }
197 }
198 iel++;
199 }
200
202 ToolHandleArray<CaloClusterCollectionProcessor>::const_iterator
205 for (; toolIt != toolIt_e; ++toolIt) {
206 ATH_CHECK((*toolIt)->execute(ctx, outClusterContainer.ptr()));
207 }
208
211 ElementLink< xAOD::CaloClusterContainer > >
212 cookClusLinkAcc( "cookiecutClusterLink" );
213 iel = 0;
216 if (success[iel]) {
218 }
219 if (success[iel] && cluster == nullptr) {
221 "could not be retrieved");
222 }
223
224 for (
size_t i = 0;
i <
m_vecM.size();
i++) {
227 if (cluster) {
230 if (!gotM) {
232 << " does not exist for the new cluster");
233 }
234 }
235 decoM[indexDecor](*electron) =
float(m);
237 << " with new moment "
239 << " = " << m << " (decoration index = " << indexDecor
240 << " key = " << decoM[indexDecor].decorKey() << ")");
241 }
242 iel++;
243 }
244 }
245 }
246
248 ctx,
249 outClusterContainer,
250 outClusterContainerCellLink);
251
253 << " cookie cut clusters");
254
255 return StatusCode::SUCCESS;
256}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
xAOD::ElectronContainer * electronContainer
const DataLink< CaloCellContainer > & getCellContainerLink() const
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
static StatusCode finalizeClusters(SG::WriteHandle< CaloClusterCellLinkContainer > &h, xAOD::CaloClusterContainer *pClusterColl)
Finalize clusters (move CaloClusterCellLink to a separate container).
size_type size() const noexcept
Returns the number of elements in the collection.
SG::Accessor< T, ALLOC > Accessor
size_t index() const
Return the index of this element within its container.
bool retrieveMoment(MomentType type, double &value) const
Retrieve individual moment.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
virtual double pt() const
The transverse momentum ( ) of the particle (negative for negative-energy clusters)
virtual double eta() const
The pseudorapidity ( ) of the particle.
float eSample(const CaloSample sampling) const
MomentType
Enums to identify different moments.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
std::unique_ptr< xAOD::CaloCluster > cookieCut(const xAOD::CaloCluster &cluster, const CaloDetDescrManager &mgr, const DataLink< CaloCellContainer > &cellCont, const egammaClusterCookieCut::CookieCutPars &pars)
const xAOD::CaloCluster * getCluster(const xAOD::Egamma *eg, bool cook=true)
return the associated egamma cluster, that might be cookie-cut cluster (fwd electron)
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
EgammaContainer_v1 EgammaContainer
Definition of the current "egamma container version".