ATLAS Offline Software
Loading...
Searching...
No Matches
egammaSuperClusterBuilderBase.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
3*/
4
6
10
12
21#include "xAODTracking/Vertex.h"
22
25
26#include <cmath>
27#include <optional>
28#include <utility>
29
31
32/*
33 * Gaudi Algorithm implementation
34 */
36 const std::string& name,
37 ISvcLocator* pSvcLocator)
38 : AthReentrantAlgorithm(name, pSvcLocator)
39{
40}
41
42StatusCode
44{
47 ATH_CHECK(m_caloDetDescrMgrKey.initialize());
50
55 // The +- to account for the different L3 eta granularity
57 // the + is to account for different L0/L1 phi granularity
59
64
65 if (m_addCellsWindowEtaCellsBarrel % 2 == 0 ||
67 ATH_MSG_FATAL("For adding cells relative to the hottest cell to be "
68 "symmetric in eta, the AddCells "
69 "window size needs to be odd");
70
71 return StatusCode::FAILURE;
72 }
74 ATH_CHECK(m_MVACalibSvc.retrieve());
75
76 if (!m_egammaCheckEnergyDepositTool.empty()) {
78 } else {
80 }
81 if (!m_egammaCellRecoveryTool.empty()) {
83 } else {
85 }
86
87 ATH_MSG_INFO("e/gamma super clusters"
88 << '\n'
89 << "--> Eta Window size for L0/L1/L2 cells : "
90 << " Barrel +- " << m_addCellsWindowEtaBarrel << " ,EndCap +- "
92 << "--> Eta Window size for L3 cells : "
93 << " Barrel +- "
95 << " ,EndCap +- "
97 << " -> Phi window is fully dynamic for L2/L3" << '\n'
98 << " -> L0/L1 cells in phi will be collected in a Window : "
99 << "(L2 neg extend - " << m_extraL0L1PhiSize << " , "
100 << "L2 pos extend + " << m_extraL0L1PhiSize << ")");
101
102 return StatusCode::SUCCESS;
103}
104
105StatusCode
106egammaSuperClusterBuilderBase::execute(const EventContext& ctx) const
107{
109 ctx);
110 // check is only used for serial running; remove when MT scheduler used
111 ATH_CHECK(egammaRecs.isValid());
112
113 // Have to register cluster container in order to properly get cluster
114 // links.
115 SG::WriteHandle<xAOD::CaloClusterContainer> outputClusterContainer(
117
119
120 // Create the new Electron Super Cluster based EgammaRecContainer
123 ATH_CHECK(newEgammaRecs.record(std::make_unique<EgammaRecContainer>()));
124
125 size_t inputSize = egammaRecs->size();
126 outputClusterContainer->reserve(inputSize);
127 newEgammaRecs->reserve(inputSize);
128
129 std::optional<SG::WriteHandle<xAOD::CaloClusterContainer>> precorrClustersH;
130 if (!m_precorrClustersKey.empty()) {
131 precorrClustersH.emplace(m_precorrClustersKey, ctx);
133 precorrClustersH->ptr()->reserve(inputSize);
134 }
135
136 // The calo Det Descr manager
137 SG::ReadCondHandle<CaloDetDescrManager> caloDetDescrMgrHandle{
139 };
140 ATH_CHECK(caloDetDescrMgrHandle.isValid());
141 const CaloDetDescrManager* calodetdescrmgr = *caloDetDescrMgrHandle;
142
143 // If no input return
144 if (egammaRecs->empty()) {
145 return StatusCode::SUCCESS;
146 }
147
148 // Figure the cellCont we need to point to
149 const DataLink<CaloCellContainer>& cellCont =
150 (*egammaRecs)[0]->caloCluster()->getCellLinks()->getCellContainerLink();
151
152 // Loop over input egammaRec objects, build superclusters.
153 size_t numInput = egammaRecs->size();
154 std::vector<bool> isUsed(numInput, false);
155 std::vector<bool> isUsedRevert(numInput, false);
156
157 for (std::size_t i = 0; i < egammaRecs->size(); ++i) {
158 if (isUsed[i]) {
159 continue;
160 }
161 const auto* egRec = (*egammaRecs)[i];
162 // check for good seed cluster
163 const xAOD::CaloCluster* clus = egRec->caloCluster();
164 if (!seedClusterSelection(clus)) {
165 continue;
166 }
167
168 if (!egammaRecPassesSelection(egRec)) {
169 continue;
170 }
171
172 // save status in case we fail to create supercluster
173 isUsedRevert = isUsed;
174 // Mark seed as used,
175 isUsed[i] = true;
176
177 // Start accumulating the clusters from the seed
178 std::vector<const xAOD::CaloCluster*> accumulatedClusters;
179 accumulatedClusters.push_back(clus);
180
181 // Now we find all the secondary cluster for this seed
182 // and we accumulate them
183 const std::vector<std::size_t> secondaryIndices =
184 searchForSecondaryClusters(i, egammaRecs.cptr(), isUsed);
185 for (const auto& secClusIndex : secondaryIndices) {
186 const auto* const secRec = (*egammaRecs)[secClusIndex];
187 accumulatedClusters.push_back(secRec->caloCluster());
188 }
189 ATH_MSG_DEBUG("Total clusters " << accumulatedClusters.size());
190
191 // Create the new cluster
192 std::unique_ptr<xAOD::CaloCluster> newCluster =
194 accumulatedClusters,
195 cellCont,
196 *calodetdescrmgr,
197 getEgammaRecType(egRec),
198 precorrClustersH ? precorrClustersH->ptr() : nullptr);
199
200 // If we failed to create a cluster revert isUsed for the cluster
201 if (newCluster) {
202 outputClusterContainer->push_back(std::move(newCluster));
203 }
204 else {
205 isUsed.swap(isUsedRevert);
206 continue;
207 }
208
209 // Add the cluster links to the super cluster
211 *outputClusterContainer, outputClusterContainer->size() - 1, ctx);
212 std::vector<ElementLink<xAOD::CaloClusterContainer>> elClusters{
213 clusterLink
214 };
215
216 // Make egammaRec object, and push it back into output container.
217 auto newEgRec = std::make_unique<egammaRec>(*egRec);
218 newEgRec->setCaloClusters(elClusters);
219 newEgammaRecs->push_back(std::move(newEgRec));
220 } // End loop on egammaRecs
221
222 ATH_CHECK(redoMatching(ctx, newEgammaRecs));
223
224 return StatusCode::SUCCESS;
225}
226
227bool
229 return true;
230}
231
232StatusCode
234 [[maybe_unused]] const EventContext &ctx,
235 [[maybe_unused]] SG::WriteHandle<EgammaRecContainer> &newEgammaRecs
236) const {
237 return StatusCode::SUCCESS;
238}
239
240bool
242 const xAOD::CaloCluster* ref,
243 const xAOD::CaloCluster* clus) const
244{
245 auto inRange = [](float eta1, float phi1,
246 float eta2, float phi2,
247 float etaWindow, float phiWindow) {
248
249 const float dEta = std::abs(eta1 - eta2);
250 const float dPhi = std::abs(P4Helpers::deltaPhi(phi1, phi2));
251
252 return dEta < etaWindow && dPhi < phiWindow;
253 };
254
255 // First the case where the seed is both endcap and barrel, i.e. in the crack
256 // Check around both measurements of the seed
257 if (ref->hasSampling(CaloSampling::EMB2) &&
258 ref->hasSampling(CaloSampling::EME2)) {
259 const bool inRangeBarrel = inRange(ref->eta(),
260 ref->phi(),
261 clus->eta(),
262 clus->phi(),
265
266 const bool inRangeEndcap = inRange(ref->eta(),
267 ref->phi(),
268 clus->eta(),
269 clus->phi(),
272
273 const bool inRangeBarrelL2 = inRange(ref->etaSample(CaloSampling::EMB2),
274 ref->phiSample(CaloSampling::EMB2),
275 clus->eta(),
276 clus->phi(),
279
280 const bool inRangeEndcapL2 = inRange(ref->etaSample(CaloSampling::EME2),
281 ref->phiSample(CaloSampling::EME2),
282 clus->eta(),
283 clus->phi(),
286
287 // Matches any in case of split
288 return inRangeBarrel || inRangeEndcap || inRangeBarrelL2 || inRangeEndcapL2;
289 }
290
292 return inRange(ref->eta(),
293 ref->phi(),
294 clus->eta(),
295 clus->phi(),
298 }
299
300 return inRange(ref->eta(),
301 ref->phi(),
302 clus->eta(),
303 clus->phi(),
306}
307
308std::unique_ptr<xAOD::CaloCluster>
310 const EventContext& ctx,
311 const std::vector<const xAOD::CaloCluster*>& clusters,
312 const DataLink<CaloCellContainer>& cellCont,
313 const CaloDetDescrManager& mgr,
315 xAOD::CaloClusterContainer* precorrClusters) const
316{
317 if (clusters.empty()) {
318 ATH_MSG_ERROR("Missing the seed cluster! Should not happen.");
319 return nullptr;
320 }
321
322 // create a new empty cluster
323 // collection will own it if
324 auto newCluster = CaloClusterStoreHelper::makeCluster(cellCont);
325
326 if (!newCluster) {
327 ATH_MSG_ERROR("CaloClusterStoreHelper::makeCluster failed.");
328 return nullptr;
329 }
330 //
331 newCluster->setClusterSize(xAOD::CaloCluster::SuperCluster);
332 // Let's try to find the eta and phi of the hottest cell in L2.
333 // This will be used as the center for restricting the cluster size.
334 CookieCutterHelpers::CentralPosition cp0(clusters, mgr);
335
336 // Set the eta0/phi0 based on the references, but in raw coordinates
337 if (cp0.emaxB >= cp0.emaxEC) {
338 newCluster->setEta0(cp0.etaB);
339 newCluster->setPhi0(cp0.phiB);
340 } else {
341 newCluster->setEta0(cp0.etaEC);
342 newCluster->setPhi0(cp0.phiEC);
343 }
344
345 // Actually fill the cluster here
346 if (fillClusterConstrained(*newCluster, clusters, cp0).isFailure()) {
347 return nullptr;
348 }
349 // Apply SW-style summation of TileGap3 cells (if necessary).
350 float eta0 = std::abs(newCluster->eta0());
351 // In Run2, we did not impose restriction to include TG3 cells at this level.
352 // It should have been [1.37,1.63]. It has no impact on performance as TG3 was
353 // only used in energy calibration BDT in [1.4,1.6].
354 // In Run three we restrict to [1.37,1.75]
355 if (!m_useExtendedTG3 ||
356 (eta0 > s_ClEtaMinForTG3cell && eta0 < s_ClEtaMaxForTG3cell)) {
357 if (addTileGap3CellsinWindow(*newCluster, mgr).isFailure()) {
358 ATH_MSG_ERROR("Problem with the input cluster when running "
359 "AddTileGap3CellsinWindow?");
360
361 return nullptr;
362 }
363 }
365 CaloClusterKineHelper::calculateKine(newCluster.get(), true, true);
366
367 // If adding all EM cells we are somehow below the seed threshold then remove
368 if (newCluster->et() < m_EtThresholdCut) {
369 return nullptr;
370 }
371
372 // Check to see if cluster pases basic requirements. If not, kill it.
373 if (!m_egammaCheckEnergyDepositTool.empty() &&
374 !m_egammaCheckEnergyDepositTool->checkFractioninSamplingCluster(
375 newCluster.get())) {
376 return nullptr;
377 }
378
379 // Apply correction calibration
380 if (calibrateCluster(ctx, newCluster.get(), mgr, egType, precorrClusters)
381 .isFailure()) {
382 ATH_MSG_WARNING("There was problem calibrating the object");
383 return nullptr;
384 }
385
386 // Avoid negative energy clusters
387 if (newCluster->et() < 0) {
388 return nullptr;
389 }
390
392 // EDM vector to constituent clusters
393 std::vector<ElementLink<xAOD::CaloClusterContainer>> constituentLinks;
394 for (const xAOD::CaloCluster* cluster : clusters) {
396 cluster->getSisterClusterLink();
397
398 // Set the element Link to the constitents
399 if (sisterCluster) {
400 constituentLinks.push_back(sisterCluster);
401 } else {
402 ATH_MSG_WARNING("No sister Link available");
403 }
404 }
405 // Set the link from the super cluster to the constituents (accumulated)
406 // clusters used.
407 static const SG::AuxElement::Accessor<
408 std::vector<ElementLink<xAOD::CaloClusterContainer>>>
409 caloClusterLinks("constituentClusterLinks");
410 caloClusterLinks(*newCluster) = constituentLinks;
411 }
412 // return the new cluster
413 return newCluster;
414}
415
416bool
418 const xAOD::CaloCluster* clus) const
419{
420 // The seed should have 2nd sampling
421 if (!clus->hasSampling(CaloSampling::EMB2) &&
422 !clus->hasSampling(CaloSampling::EME2)) {
423 return false;
424 }
425 const double eta2 = std::abs(clus->etaBE(2));
426 if (eta2 > 10) {
427 return false;
428 }
429 // Accordeon Energy samplings 1 to 3
430 const double EMAccEnergy =
431 clus->energyBE(1) + clus->energyBE(2) + clus->energyBE(3);
432 const double EMAccEt = EMAccEnergy / cosh(eta2);
433 // Require minimum energy for supercluster seeding.
434 return EMAccEt >= m_EtThresholdCut;
435}
436
437StatusCode
439 xAOD::CaloCluster& tofill,
440 const std::vector<const xAOD::CaloCluster*>& clusters,
442{
443 const float addCellsWindowEtaBarrel = m_addCellsWindowEtaBarrel;
444 const float addCellsWindowEtaEndcap = m_addCellsWindowEtaEndcap;
445 const float addCellsWindowL3EtaBarrel =
447 const float addCellsWindowL3EtaEndcap =
449
450 // Loop for L2/L3
451 for (const xAOD::CaloCluster* tocheck : clusters) {
452 xAOD::CaloCluster::const_cell_iterator cell_itr = tocheck->begin();
453 xAOD::CaloCluster::const_cell_iterator cell_end = tocheck->end();
454 // Loop over cells
455 for (; cell_itr != cell_end; ++cell_itr) {
456 // sanity check on the cell
457 const CaloCell* cell = *cell_itr;
458 if (!cell) {
459 continue;
460 }
461 const CaloDetDescrElement* dde = cell->caloDDE();
462 if (!dde) {
463 continue;
464 }
465 // we want only LAREM
466 if (!(dde->getSubCalo() == CaloCell_ID::LAREM)) {
467 continue;
468 }
469 // we want L2 or L3 cells
470 const auto sampling = dde->getSampling();
471 const bool isL2Cell =
472 (CaloCell_ID::EMB2 == sampling || CaloCell_ID::EME2 == sampling);
473 const bool isL3Cell =
474 (CaloCell_ID::EMB3 == sampling || CaloCell_ID::EME3 == sampling);
475
476 if ((!isL2Cell) && (!isL3Cell)) {
477 continue;
478 }
479 // Also exclude the inner wheel Endcap
480 if (dde->is_lar_em_endcap_inner()) {
481 continue;
482 }
483
484 bool inEtaRange = false;
485 // Check if is inside the eta range wrt to the hottest
486 // cell(s) for the cluster we construct
487 if (cp0.emaxB > 0) { // barrel
488 if (isL2Cell &&
489 (std::abs(cp0.etaB - dde->eta_raw()) < addCellsWindowEtaBarrel)) {
490 inEtaRange = true;
491 }
492 if (isL3Cell &&
493 (std::abs(cp0.etaB - dde->eta_raw()) < addCellsWindowL3EtaBarrel)) {
494 inEtaRange = true;
495 }
496 }
497 if (cp0.emaxEC > 0) { // endcap
498 if (isL2Cell &&
499 (std::abs(cp0.etaEC - dde->eta_raw()) < addCellsWindowEtaEndcap)) {
500 inEtaRange = true;
501 }
502 if (isL3Cell && (std::abs(cp0.etaEC - dde->eta_raw()) <
503 addCellsWindowL3EtaEndcap)) {
504 inEtaRange = true;
505 }
506 }
507 if (!inEtaRange) {
508 continue;
509 }
510 tofill.addCell(cell_itr.index(), cell_itr.weight());
511 } // Loop over cells for L2/L3
512 } // Loop over clusters for L2/L3
513
514 // We should have a size here
515 if (tofill.size() == 0) {
516 return StatusCode::FAILURE;
517 }
518 // Now calculate the cluster size in 2nd layer
519 // use that for constraining the L0/L1 cells we add
520 const CookieCutterHelpers::PhiSize phiSize(cp0, tofill);
521 const float phiPlusB = cp0.phiB + phiSize.plusB + m_extraL0L1PhiSize;
522 const float phiMinusB = cp0.phiB - phiSize.minusB - m_extraL0L1PhiSize;
523 const float phiPlusEC = cp0.phiEC + phiSize.plusEC + m_extraL0L1PhiSize;
524 const float phiMinusEC = cp0.phiEC - phiSize.minusEC - m_extraL0L1PhiSize;
525
526 // Loop for L0/L1
527 for (const xAOD::CaloCluster* tocheck : clusters) {
528 xAOD::CaloCluster::const_cell_iterator cell_itr = tocheck->begin();
529 xAOD::CaloCluster::const_cell_iterator cell_end = tocheck->end();
530 // Loop over cells
531 for (; cell_itr != cell_end; ++cell_itr) {
532 // sanity check on the cell
533 const CaloCell* cell = *cell_itr;
534 if (!cell) {
535 continue;
536 }
537 const CaloDetDescrElement* dde = cell->caloDDE();
538 if (!dde) {
539 continue;
540 }
541
542 // only deal with L1 or PS
543 const auto sampling = dde->getSampling();
544 const bool isL0L1Cell =
545 (CaloCell_ID::EMB1 == sampling || CaloCell_ID::EME1 == sampling ||
546 CaloCell_ID::PreSamplerB == sampling ||
547 CaloCell_ID::PreSamplerE == sampling);
548 if (!isL0L1Cell) {
549 continue;
550 }
551
552 bool inEtaRange = false;
553 // Check if is inside the eta range wrt to the hottest
554 // cell(s) for the cluster we construct
555 if (cp0.emaxB > 0) { // barrel
556 if (std::abs(cp0.etaB - dde->eta_raw()) < addCellsWindowEtaBarrel) {
557 inEtaRange = true;
558 }
559 }
560 if (cp0.emaxEC > 0) { // endcap
561 if (std::abs(cp0.etaEC - dde->eta_raw()) < addCellsWindowEtaEndcap) {
562 inEtaRange = true;
563 }
564 }
565 if (!inEtaRange) {
566 continue;
567 }
568
569 // Add L0/L1 when we are in the narrow range
570 bool inPhiRange = false;
571 if (cp0.emaxB > 0) { // barrel
572 const double cell_phi = proxim(dde->phi_raw(), cp0.phiB);
573 if (cell_phi > phiMinusB && cell_phi < phiPlusB) {
574 inPhiRange = true;
575 }
576 }
577 if (cp0.emaxEC > 0) { // endcap
578 const double cell_phi = proxim(dde->phi_raw(), cp0.phiEC);
579 if (cell_phi > phiMinusEC && cell_phi < phiPlusEC) {
580 inPhiRange = true;
581 }
582 }
583 if (!inPhiRange) {
584 continue;
585 }
586
587 tofill.addCell(cell_itr.index(), cell_itr.weight());
588 } // Cell Loop for L0/L1
589 } // Cluster loop for L0/L1
590
591 if (!m_egammaCellRecoveryTool.empty()) {
593 if (cp0.emaxB > cp0.emaxEC) {
594 info.etamax = cp0.etaB;
595 info.phimax = cp0.phiB;
596 } else {
597 info.etamax = cp0.etaEC;
598 info.phimax = cp0.phiEC;
599 }
600 if (m_egammaCellRecoveryTool->execute(tofill,info).isFailure()) {
601 ATH_MSG_WARNING("Issue trying to recover cells");
602 }
603
604 // And finally add the recovered cells
605 const CaloCellContainer* inputcells =
606 tofill.getCellLinks()->getCellContainer();
607 for (const auto *c : info.addedCells) {
608 int index = inputcells->findIndex(c->caloDDE()->calo_hash());
609 tofill.addCell(index, 1.);
610 }
611 }
612
613 return StatusCode::SUCCESS;
614}
615
616StatusCode
618 xAOD::CaloCluster& tofill,
619 const CaloDetDescrManager& mgr) const
620{
621
622 double searchWindowEta = m_useExtendedTG3 ? 0.35 : 0.2;
623 constexpr double searchWindowPhi = 2 * M_PI / 64.0 + M_PI / 64; // ~ 0.15 rad
624 std::vector<const CaloCell*> cells;
625 cells.reserve(16);
626 const CaloCellContainer* inputcells =
627 tofill.getCellLinks()->getCellContainer();
628
629 if (!inputcells) {
630 ATH_MSG_ERROR("No cell container in addRemainingCellsToCluster?");
631 return StatusCode::FAILURE;
632 }
633
634 CaloCellList myList(&mgr, inputcells);
635
636 const std::vector<CaloSampling::CaloSample> samples = {
637 CaloSampling::TileGap3
638 };
639
640 for (auto samp : samples) {
641 // quite slow
642 myList.select(
643 tofill.eta0(), tofill.phi0(), searchWindowEta, searchWindowPhi, samp);
644 cells.insert(cells.end(), myList.begin(), myList.end());
645 }
646
647 for (const auto* cell : cells) {
648 if (!cell) {
649 continue;
650 }
651 const CaloDetDescrElement* dde = cell->caloDDE();
652 if (!dde) {
653 continue;
654 }
655
656 float maxEta = s_TG3Run2E4cellEtaMax;
657 float minEta = s_TG3Run2E4cellEtaMin;
658 if (m_useExtendedTG3) {
659 minEta = s_TG3Run3E3cellEtaMin;
660 // if |eta2| < 1.56, keep only E3, else keep E3+E4.
661 // |eta2| uses as the eta of the highest energy cell in layer 2 as proxy
662 if (std::abs(tofill.eta0()) > 1.56) {
663 maxEta = s_TG3Run3E4cellEtaMax;
664 }
665 }
666 float cellaEtaRaw = std::abs(dde->eta_raw());
667 if (cellaEtaRaw >= minEta && cellaEtaRaw <= maxEta) {
668 int index = inputcells->findIndex(dde->calo_hash());
669 tofill.addCell(index, 1.);
670 }
671 }
672 return StatusCode::SUCCESS;
673}
674
675StatusCode
677 const EventContext& ctx,
678 xAOD::CaloCluster* newCluster,
679 const CaloDetDescrManager& mgr,
681 xAOD::CaloClusterContainer* precorrClusters) const
682{
683
685 // Save the state before the corrections
686 newCluster->setAltE(newCluster->e());
687 newCluster->setAltEta(newCluster->eta());
688 newCluster->setAltPhi(newCluster->phi());
689 // first do the corrections
690 if (precorrClusters) {
691 precorrClusters->push_back(std::make_unique<xAOD::CaloCluster>());
692 *precorrClusters->back() = *newCluster;
693 }
695 ctx, newCluster, egType, xAOD::EgammaHelpers::isBarrel(newCluster)));
696 double aeta = std::abs(newCluster->eta());
697 if (aeta > 10) {
698 ATH_MSG_DEBUG("Too large eta after S-shape corrections. "
699 "SuperCluster rejected");
700 return StatusCode::FAILURE;
701 }
702 newCluster->setRawE(newCluster->e());
703 newCluster->setRawEta(newCluster->eta());
704 newCluster->setRawPhi(newCluster->phi());
705 //
707 ATH_CHECK(m_MVACalibSvc->execute(*newCluster, egType));
708
709 return StatusCode::SUCCESS;
710}
711
const boost::regex ref(r_ef)
#define M_PI
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_FATAL(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
Calculate total energy, position, etc. for a given layer of a cluster.
bool inRange(const double *boundaries, const double value, const double tolerance=0.02)
An algorithm that can be simultaneously executed in multiple threads.
Container class for CaloCell.
int findIndex(const IdentifierHash theHash) const
Return index of the cell with a given hash.
list_iterator end() const
void select(double eta, double phi, double deta, double dphi)
list_iterator begin() const
Data object for each calorimeter readout cell.
Definition CaloCell.h:57
static void calculateKine(xAOD::CaloCluster *clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria=false)
Helper class to calculate cluster kinematics based on cells.
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
bool is_lar_em_endcap_inner() const
cell belongs to the inner wheel of EM end cap
This class provides the client interface for accessing the detector description information common to...
const T * back() const
Access the last element in the collection as an rvalue.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
SG::Accessor< T, ALLOC > Accessor
Definition AuxElement.h:573
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const_pointer_type cptr()
Dereference the pointer.
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Represent an egamma object for internal egamma usage during reconstruction.
Definition egammaRec.h:31
Gaudi::Property< int > m_addCellsWindowEtaCellsEndcap
Size of windows et eta in which cells of topoclusters are edded for the endcap (units of 2nd layer ce...
egammaSuperClusterBuilderBase(const std::string &name, ISvcLocator *pSvcLocator)
Protected constructor since this class should not be instantiated by itself.
SG::WriteHandleKey< EgammaRecContainer > m_outputEgammaRecContainerKey
Key for output egammaRec container.
SG::ReadHandleKey< EgammaRecContainer > m_inputEgammaRecContainerKey
Key for input egammaRec container.
Gaudi::Property< int > m_extraL3EtaSizeCells
"When adding L3 cells, how much wider in eta than the L2
Gaudi::Property< float > m_EtThresholdCut
Seed selection requirements.
StatusCode fillClusterConstrained(xAOD::CaloCluster &tofill, const std::vector< const xAOD::CaloCluster * > &clusters, const CookieCutterHelpers::CentralPosition &cp0) const
Fill super cluster constraining its size in eta,phi around the overall hottest cell and the its L2 si...
virtual StatusCode redoMatching(const EventContext &ctx, SG::WriteHandle< EgammaRecContainer > &newEgammaRecs) const
Gaudi::Property< int > m_searchWindowEtaCellsBarrel
Size of topocluster search window in eta for the barrel.
bool matchesInWindow(const xAOD::CaloCluster *ref, const xAOD::CaloCluster *clus) const
Is clus in window center around ref?
std::unique_ptr< xAOD::CaloCluster > createNewCluster(const EventContext &ctx, const std::vector< const xAOD::CaloCluster * > &clusters, const DataLink< CaloCellContainer > &cellCont, const CaloDetDescrManager &mgr, xAOD::EgammaParameters::EgammaType egType, xAOD::CaloClusterContainer *precorrClusters) const
Add new supercluster ,created out of the input clusters, to the newClusters collections.
Gaudi::Property< bool > m_linkToConstituents
Decorate the supercluster with links to the component topoclusters.
StatusCode calibrateCluster(const EventContext &ctx, xAOD::CaloCluster *newCluster, const CaloDetDescrManager &mgr, const xAOD::EgammaParameters::EgammaType egType, xAOD::CaloClusterContainer *precorrClusters) const
function to calibrate the new clusters energy
ToolHandle< IegammaCheckEnergyDepositTool > m_egammaCheckEnergyDepositTool
Pointer to the egammaCheckEnergyDepositTool.
ToolHandle< IegammaCellRecoveryTool > m_egammaCellRecoveryTool
Pointer to the egammaCellRecoveryTool.
Gaudi::Property< bool > m_useExtendedTG3
Use extended TG3 definition (only after Run 2)
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_precorrClustersKey
Optional key for pre-correction clusters.
virtual StatusCode execute(const EventContext &ctx) const override
should be called by the derived class in the execute phase
virtual bool egammaRecPassesSelection(const egammaRec *egRec) const
StatusCode addTileGap3CellsinWindow(xAOD::CaloCluster &tofill, const CaloDetDescrManager &mgr) const
add all tile Gap 3 cells in a window.
Gaudi::Property< int > m_searchWindowPhiCellsEndcap
Size of topocluster search window in phi for the end-cap.
virtual xAOD::EgammaParameters::EgammaType getEgammaRecType(const egammaRec *egRec) const =0
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
ToolHandle< IegammaSwTool > m_clusterCorrectionTool
Tool to handle cluster corrections.
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outputSuperClusterCollectionName
Key for output clusters.
Gaudi::Property< int > m_extraL0L1PhiSizeCells
"When adding L0 (PS) and L1 cells, how much wider than the L2 size of the cluster is the acceptance i...
Gaudi::Property< int > m_searchWindowEtaCellsEndcap
Size of topocluster search window in eta for the end-cap.
ServiceHandle< IegammaMVASvc > m_MVACalibSvc
Handle to the MVA calibration service.
virtual std::vector< std::size_t > searchForSecondaryClusters(std::size_t egammaInd, const EgammaRecContainer *egammaRecs, std::vector< bool > &isUsed) const =0
Gaudi::Property< int > m_addCellsWindowEtaCellsBarrel
Size of windows et eta in which cells of topoclusters are added for the barrel (units of 2nd layer ce...
Gaudi::Property< int > m_searchWindowPhiCellsBarrel
Size of topocluster search window in phi for the barrel.
virtual StatusCode initialize() override
should be called by the derived class in the initialize phase
bool seedClusterSelection(const xAOD::CaloCluster *clus) const
check if we pass the basic criteria for a seed cluster
void setRawEta(flt_t)
Set for signal state UNCALIBRATED.
void setAltPhi(flt_t)
Set for signal state ALTCALIBRATED.
void setRawPhi(flt_t)
Set for signal state UNCALIBRATED.
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
virtual double eta() const
The pseudorapidity ( ) of the particle.
void setAltEta(flt_t)
Set for signal state ALTCALIBRATED.
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
virtual double e() const
The total energy of the particle.
CaloClusterCellLink::const_iterator const_cell_iterator
Iterator of the underlying CaloClusterCellLink (explicitly const version)
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
virtual double phi() const
The azimuthal angle ( ) of the particle.
void setAltE(flt_t)
Set Energy for signal state ALTCALIBRATED.
flt_t eta0() const
Returns raw of cluster seed.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
bool addCell(const unsigned index, const double weight)
Method to add a cell to the cluster (Beware: Kinematics not updated!)
flt_t phi0() const
Returns raw of cluster seed.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition P4Helpers.h:34
void fillPositionsInCalo(xAOD::CaloCluster *cluster, const CaloDetDescrManager &mgr)
Function to decorate the calo cluster with position variables.
void refineEta1Position(xAOD::CaloCluster *cluster, const CaloDetDescrManager &mgr)
function to refine position in eta1
Definition index.py:1
bool isBarrel(const xAOD::Egamma *eg)
return true if the cluster is in the barrel
int summaryValueInt(const xAOD::TrackParticle &tp, const xAOD::SummaryType &info, int deflt=-999)
return the summary value for a TrackParticle or default value (-999) (to be used mostly in python whe...
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.
CaloClusterContainer_v1 CaloClusterContainer
Define the latest version of the calorimeter cluster container.
double proxim(double b, double a)
Definition proxim.h:17
Find the reference position (eta, phi) relative to which cells are restricted.
Find the size of the cluster in phi using L2 cells.