ATLAS Offline Software
Classes | Functions
egammaClusterCookieCut Namespace Reference

Classes

struct  CookieCutPars
 

Functions

std::unique_ptr< xAOD::CaloClustercookieCut (const xAOD::CaloCluster &cluster, const CaloDetDescrManager &mgr, const DataLink< CaloCellContainer > &cellCont, const egammaClusterCookieCut::CookieCutPars &pars)
 

Function Documentation

◆ cookieCut()

std::unique_ptr< xAOD::CaloCluster > egammaClusterCookieCut::cookieCut ( const xAOD::CaloCluster cluster,
const CaloDetDescrManager mgr,
const DataLink< CaloCellContainer > &  cellCont,
const egammaClusterCookieCut::CookieCutPars pars 
)

Definition at line 28 of file egammaClusterCookieCut.cxx.

33  {
34  if (!cluster.hasSampling(CaloSampling::EME2) &&
35  !cluster.hasSampling(CaloSampling::FCAL0)) {
36  return nullptr;
37  }
38 
40 
41  const bool isEC = cp0.emaxEC >= cp0.emaxF;
42  const float eta = isEC ? cp0.etaEC : cp0.etaF;
43  const float phi = isEC ? cp0.phiEC : cp0.phiF;
44 
45  auto newCluster = CaloClusterStoreHelper::makeCluster(cellCont);
46 
47  if (!newCluster) {
48  return nullptr;
49  }
50 
51  CaloClusterCellLink* newCellLinks = newCluster->getOwnCellLinks();
52  if (!pars.recomputeMoments) {
53  copyMoments(cluster,
54  newCluster,
63  }
64 
65  const CaloClusterCellLink* cellLinks = cluster.getCellLinks();
66  CaloClusterCellLink::const_iterator cellItr = cellLinks->begin();
67  CaloClusterCellLink::const_iterator cellEnd = cellLinks->end();
68 
69  for (; cellItr != cellEnd; ++cellItr) {
70  const float deltaEta = std::abs(eta - cellItr->eta());
71  const float deltaPhi = std::abs(P4Helpers::deltaPhi(phi, cellItr->phi()));
72 
73  const float deltaEta2 = deltaEta * deltaEta;
74  const float deltaPhi2 = deltaPhi * deltaPhi;
75 
76  const bool excludeCell = isEC ?
77  (deltaEta >= pars.maxDelEta || deltaPhi >= pars.maxDelPhi) :
78  (deltaEta2 + deltaPhi2 >= pars.maxDelR2);
79 
80  if (!excludeCell) {
81  newCellLinks->addCell(cellItr.index(), cellItr.weight());
82  }
83  }
84 
85  CaloClusterKineHelper::calculateKine(newCluster.get(), true, true);
86 
87  return newCluster;
88 }
CaloClusterStoreHelper::makeCluster
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
Definition: CaloClusterStoreHelper.cxx:13
xAOD::CaloCluster_v1::SECOND_R
@ SECOND_R
Second Moment in .
Definition: CaloCluster_v1.h:126
CookieCutterHelpers::CentralPosition
Find the reference position (eta, phi) relative to which cells are restricted.
Definition: CookieCutterHelpers.h:19
make_hlt_rep.pars
pars
Definition: make_hlt_rep.py:90
CaloCell::phi
virtual double phi() const override final
get phi (through CaloDetDescrElement)
Definition: CaloCell.h:369
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
eta
Scalar eta() const
pseudorapidity method
Definition: AmgMatrixBasePlugin.h:83
xAOD::deltaPhi
setSAddress setEtaMS setDirPhiMS setDirZMS setBarrelRadius setEndcapAlpha setEndcapRadius setInterceptInner setEtaMap setEtaBin setIsTgcFailure setDeltaPt deltaPhi
Definition: L2StandAloneMuon_v1.cxx:161
xAOD::EgammaParameters::deltaEta2
@ deltaEta2
difference between the cluster eta (second sampling) and the eta of the track extrapolated to the sec...
Definition: EgammaEnums.h:187
xAOD::CaloCluster_v1::CENTER_LAMBDA
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
Definition: CaloCluster_v1.h:139
xAOD::CaloCluster_v1::ENG_FRAC_MAX
@ ENG_FRAC_MAX
Energy fraction of hottest cell.
Definition: CaloCluster_v1.h:143
xAOD::CaloCluster_v1::SECOND_LAMBDA
@ SECOND_LAMBDA
Second Moment in .
Definition: CaloCluster_v1.h:127
BchCleanup.mgr
mgr
Definition: BchCleanup.py:294
xAOD::CaloCluster_v1::SECOND_ENG_DENS
@ SECOND_ENG_DENS
Second Moment in E/V.
Definition: CaloCluster_v1.h:147
P4Helpers::deltaPhi
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
Definition: P4Helpers.h:34
P4Helpers::deltaEta
double deltaEta(const I4Momentum &p1, const I4Momentum &p2)
Computes efficiently .
Definition: P4Helpers.h:66
xAOD::CaloCluster_v1::getCellLinks
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
Definition: CaloCluster_v1.cxx:859
xAOD::EgammaParameters::deltaPhi2
@ deltaPhi2
difference between the cluster phi (second sampling) and the phi of the track extrapolated to the sec...
Definition: EgammaEnums.h:204
xAOD::CaloCluster_v1::SIGNIFICANCE
@ SIGNIFICANCE
Cluster significance.
Definition: CaloCluster_v1.h:160
CaloClusterKineHelper::calculateKine
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.
Definition: CaloClusterKineHelper.cxx:223
xAOD::CaloCluster_v1::LATERAL
@ LATERAL
Normalized lateral moment.
Definition: CaloCluster_v1.h:140
xAOD::CaloCluster_v1::hasSampling
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
Definition: CaloCluster_v1.h:882
xAOD::CaloCluster_v1::LONGITUDINAL
@ LONGITUDINAL
Normalized longitudinal moment.
Definition: CaloCluster_v1.h:141
CaloCell_ID_FCS::FCAL0
@ FCAL0
Definition: FastCaloSim_CaloCell_ID.h:40
CookieCutterHelpers::CentralPosition::emaxEC
float emaxEC
Definition: CookieCutterHelpers.h:25
constants.EME2
int EME2
Definition: Calorimeter/CaloClusterCorrection/python/constants.py:56
CaloCell::eta
virtual double eta() const override final
get eta (through CaloDetDescrElement)
Definition: CaloCell.h:376