|  | ATLAS Offline Software
    | 
 
 
 
Go to the documentation of this file.
   48 std::pair<const double, const double>
 
   56   constexpr 
double eps = 0.001;
 
   60   double deta_l = elt_l ? std::abs(
eta - elt_l->
eta_raw()) + eps : 0.;
 
   64   double deta_r = elt_r ? std::abs(
eta - elt_r->
eta_raw()) + eps : 0.; 
 
  128   if (clusterEtaMax == -999. || clusterPhiMax == -999.) {
 
  131   if (std::abs(clusterEtaMax) < 1
E-6 && std::abs(clusterPhiMax) < 1
E-6) {
 
  148   double etamax = dde->
eta_raw();
 
  149   double phimax = dde->
phi_raw();
 
  157   auto [detastr, dphistr] = 
etaphi_range(
mgr, etamax, phimax, xsample, elt);
 
  160   if (detastr > 0 && dphistr > 0) {
 
  163     helper.fill(cellLink->begin(),
 
  172     if (
helper.etam() != -999.) {
 
  189   const double aeta = std::abs(cluster->
etaBE(2));
 
  204   const std::string& 
name,
 
  205   ISvcLocator* pSvcLocator)
 
  235     ATH_MSG_FATAL(
"For adding cells relative to the hottest cell to be " 
  236                   "symmetric in eta, the AddCells " 
  237                   "window size needs to be odd");
 
  239     return StatusCode::FAILURE;
 
  257                << 
"--> Eta Window size for L0/L1/L2 cells : " 
  260                << 
"--> Eta Window size for L3 cells : " 
  265                << 
" -> Phi window is fully dynamic for L2/L3" << 
'\n' 
  266                << 
" -> L0/L1 cells in phi will be collected in a Window : " 
  270   return StatusCode::SUCCESS;
 
  291   ATH_CHECK(newEgammaRecs.
record(std::make_unique<EgammaRecContainer>()));
 
  293   size_t inputSize = egammaRecs->
size();
 
  294   outputClusterContainer->
reserve(inputSize);
 
  295   newEgammaRecs->
reserve(inputSize);
 
  297   std::optional<SG::WriteHandle<xAOD::CaloClusterContainer>> precorrClustersH;
 
  301     precorrClustersH->ptr()->reserve(inputSize);
 
  308   ATH_CHECK(caloDetDescrMgrHandle.isValid());
 
  312   if (egammaRecs->
empty()) {
 
  313     return StatusCode::SUCCESS;
 
  318     (*egammaRecs)[0]->caloCluster()->getCellLinks()->getCellContainerLink();
 
  321   size_t numInput = egammaRecs->
size();
 
  322   std::vector<bool> isUsed(numInput, 
false);
 
  323   std::vector<bool> isUsedRevert(numInput, 
false);
 
  325   for (std::size_t 
i = 0; 
i < egammaRecs->
size(); ++
i) {
 
  329     const auto* egRec = (*egammaRecs)[
i];
 
  341     isUsedRevert = isUsed;
 
  346     std::vector<const xAOD::CaloCluster*> accumulatedClusters;
 
  347     accumulatedClusters.push_back(clus);
 
  351     const std::vector<std::size_t> secondaryIndices =
 
  353     for (
const auto& secClusIndex : secondaryIndices) {
 
  354       const auto* 
const secRec = (*egammaRecs)[secClusIndex];
 
  355       accumulatedClusters.push_back(secRec->caloCluster());
 
  357     ATH_MSG_DEBUG(
"Total clusters " << accumulatedClusters.size());
 
  360     std::unique_ptr<xAOD::CaloCluster> newCluster = 
 
  366                        precorrClustersH ? precorrClustersH->ptr() : 
nullptr);
 
  370       outputClusterContainer->
push_back(std::move(newCluster));
 
  373       isUsed.swap(isUsedRevert);
 
  379       *outputClusterContainer, outputClusterContainer->
size() - 1, ctx);
 
  380     std::vector<ElementLink<xAOD::CaloClusterContainer>> elClusters{
 
  385     auto newEgRec = std::make_unique<egammaRec>(*egRec);
 
  386     newEgRec->setCaloClusters(elClusters);
 
  387     newEgammaRecs->
push_back(std::move(newEgRec));
 
  392   return StatusCode::SUCCESS;
 
  402   [[maybe_unused]] 
const EventContext &ctx, 
 
  405   return StatusCode::SUCCESS;
 
  414                     float eta2, 
float phi2,
 
  415                     float etaWindow, 
float phiWindow) {
 
  420     return dEta < etaWindow && 
dPhi < phiWindow;
 
  427     const bool inRangeBarrel = 
inRange(
ref->eta(), 
 
  434     const bool inRangeEndcap = 
inRange(
ref->eta(), 
 
  456     return inRangeBarrel || inRangeEndcap || inRangeBarrelL2 || inRangeEndcapL2;
 
  476 std::unique_ptr<xAOD::CaloCluster>
 
  478   const EventContext& ctx,
 
  479   const std::vector<const xAOD::CaloCluster*>& 
clusters,
 
  486     ATH_MSG_ERROR(
"Missing the seed cluster! Should not happen.");
 
  495     ATH_MSG_ERROR(
"CaloClusterStoreHelper::makeCluster failed.");
 
  506     newCluster->setEta0(cp0.
etaB);
 
  507     newCluster->setPhi0(cp0.
phiB);
 
  509     newCluster->setEta0(cp0.
etaEC);
 
  510     newCluster->setPhi0(cp0.
phiEC);
 
  518   float eta0 = std::abs(newCluster->eta0());
 
  527                     "AddTileGap3CellsinWindow?");
 
  555   if (newCluster->et() < 0) {
 
  561     std::vector<ElementLink<xAOD::CaloClusterContainer>> constituentLinks;
 
  568         constituentLinks.push_back(sisterCluster);
 
  576       std::vector<ElementLink<xAOD::CaloClusterContainer>>>
 
  577       caloClusterLinks(
"constituentClusterLinks");
 
  578     caloClusterLinks(*newCluster) = constituentLinks;
 
  593   const double eta2 = std::abs(clus->
etaBE(2));
 
  598   const double EMAccEnergy =
 
  600   const double EMAccEt = EMAccEnergy / cosh(
eta2);
 
  608   const std::vector<const xAOD::CaloCluster*>& 
clusters,
 
  613   const float addCellsWindowL3EtaBarrel =
 
  615   const float addCellsWindowL3EtaEndcap =
 
  623     for (; cell_itr != cell_end; ++cell_itr) {
 
  639       const bool isL2Cell =
 
  641       const bool isL3Cell =
 
  644       if ((!isL2Cell) && (!isL3Cell)) {
 
  652       bool inEtaRange = 
false;
 
  657             (std::abs(cp0.
etaB - dde->
eta_raw()) < addCellsWindowEtaBarrel)) {
 
  661             (std::abs(cp0.
etaB - dde->
eta_raw()) < addCellsWindowL3EtaBarrel)) {
 
  667             (std::abs(cp0.
etaEC - dde->
eta_raw()) < addCellsWindowEtaEndcap)) {
 
  671                          addCellsWindowL3EtaEndcap)) {
 
  683   if (tofill.
size() == 0) {
 
  684     return StatusCode::FAILURE;
 
  699     for (; cell_itr != cell_end; ++cell_itr) {
 
  712       const bool isL0L1Cell =
 
  720       bool inEtaRange = 
false;
 
  724         if (std::abs(cp0.
etaB - dde->
eta_raw()) < addCellsWindowEtaBarrel) {
 
  729         if (std::abs(cp0.
etaEC - dde->
eta_raw()) < addCellsWindowEtaEndcap) {
 
  738       bool inPhiRange = 
false;
 
  741         if (cell_phi > phiMinusB && cell_phi < phiPlusB) {
 
  747         if (cell_phi > phiMinusEC && cell_phi < phiPlusEC) {
 
  775     for (
const auto *
c : 
info.addedCells) {
 
  781   return StatusCode::SUCCESS;
 
  791   constexpr 
double searchWindowPhi = 2 * 
M_PI / 64.0 + 
M_PI / 64; 
 
  792   std::vector<const CaloCell*> 
cells;
 
  798     ATH_MSG_ERROR(
"No cell container in addRemainingCellsToCluster?");
 
  799     return StatusCode::FAILURE;
 
  804   const std::vector<CaloSampling::CaloSample> samples = {
 
  808   for (
auto samp : samples) {
 
  811       tofill.
eta0(), tofill.
phi0(), searchWindowEta, searchWindowPhi, samp);
 
  830       if (std::abs(tofill.
eta0()) > 1.56) {
 
  834     float cellaEtaRaw = std::abs(dde->
eta_raw());
 
  835     if (cellaEtaRaw >= minEta && cellaEtaRaw <= 
maxEta) {
 
  840   return StatusCode::SUCCESS;
 
  845   const EventContext& ctx,
 
  852   refineEta1Position(newCluster, 
mgr);
 
  854   newCluster->
setAltE(newCluster->
e());
 
  858   if (precorrClusters) {
 
  859     precorrClusters->
push_back(std::make_unique<xAOD::CaloCluster>());
 
  860     *precorrClusters->
back() = *newCluster;
 
  864   double aeta = std::abs(newCluster->
eta());
 
  867           "SuperCluster rejected");
 
  868     return StatusCode::FAILURE;
 
  870   newCluster->
setRawE(newCluster->
e());
 
  874   fillPositionsInCalo(newCluster, 
mgr);
 
  877   return StatusCode::SUCCESS;
 
  
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
float deta() const
cell deta
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
float phimax(const CaloSample sampling) const
Retrieve  of cell with maximum energy in given sampling.
flt_t phi0() const
Returns raw  of cluster seed.
Find the reference position (eta, phi) relative to which cells are restricted.
virtual double phi() const
The azimuthal angle ( ) of the particle.
bool hasSampling(const CaloSample s, const std::uint32_t samplingPattern)
Checks if certain smapling contributes to cluster.
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...
bool is_lar_em_endcap_inner() const
cell belongs to the inner wheel of EM end cap
ServiceHandle< IegammaMVASvc > m_MVACalibSvc
Handle to the MVA calibration service.
float m_searchWindowPhiEndcap
float m_searchWindowEtaBarrel
list_iterator begin() const
virtual bool egammaRecPassesSelection(const egammaRec *egRec) const
ToolHandle< IegammaSwTool > m_clusterCorrectionTool
Tool to handle cluster corrections.
Scalar phi() const
phi method
void select(double eta, double phi, double deta, double dphi)
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
const_pointer_type cptr()
Dereference the pointer.
Helper class to provide type-safe access to aux data.
Scalar eta() const
pseudorapidity method
static constexpr float s_TG3Run3E3cellEtaMin
@ ETA2CALOFRAME
Eta of sampling 2 in the calo frame (for egamma)
float m_addCellsWindowEtaBarrel
virtual StatusCode initialize() override
should be called by the derived class in the initialize phase
This class groups all DetDescr information related to a CaloCell. Provides a generic interface for al...
@ ETA1CALOFRAME
Eta of sampling 1 in the calo frame (for egamma)
double proxim(double b, double a)
void setAltEta(flt_t)
Set  for signal state ALTCALIBRATED.
void insertMoment(MomentType type, double value)
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.
static constexpr float s_cellPhiSize
setEt setPhi setE277 setWeta2 eta1
float phiBE(const unsigned layer) const
Get the phi in one layer of the EM Calo.
static constexpr float s_TG3Run3E4cellEtaMax
unsigned index() const
Accessor for the index of the cell in the CaloCellContainer.
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_outputSuperClusterCollectionName
Key for output clusters.
bool empty() const
Test if the key is blank.
bool dPhi(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
float etamax(const CaloSample sampling) const
Retrieve  of cell with maximum energy in given sampling.
@ PHI1CALOFRAME
Phi of sampling 1 in the calo frame (for egamma)
virtual xAOD::EgammaParameters::EgammaType getEgammaRecType(const egammaRec *egRec) const =0
ToolHandle< IegammaCheckEnergyDepositTool > m_egammaCheckEnergyDepositTool
Pointer to the egammaCheckEnergyDepositTool.
bool dEta(const xAOD::TauJet &tau, const xAOD::CaloVertexedTopoCluster &cluster, float &out)
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...
weight_t weight() const
Accessor for weight associated to this cell.
float eta_raw() const
cell eta_raw
An algorithm that can be simultaneously executed in multiple threads.
CaloCell_ID::SUBCALO getSubCalo() const
cell subcalo
bool isBarrel(const xAOD::Egamma *eg)
return true if the cluster is in the barrel
virtual StatusCode execute(const EventContext &ctx) const override
should be called by the derived class in the execute phase
list_iterator end() const
float etaBE(const unsigned layer) const
Get the eta in one layer of the EM Calo.
StatusCode addTileGap3CellsinWindow(xAOD::CaloCluster &tofill, const CaloDetDescrManager &mgr) const
add all tile Gap 3 cells in a window.
Gaudi::Property< bool > m_linkToConstituents
Decorate the supercluster with links to the component topoclusters.
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloDetDescrMgrKey
bool matchesInWindow(const xAOD::CaloCluster *ref, const xAOD::CaloCluster *clus) const
Is clus in window center around ref?
Description of a calorimeter cluster.
double deltaPhi(double phiA, double phiB)
delta Phi in range [-pi,pi[
ToolHandle< IegammaCellRecoveryTool > m_egammaCellRecoveryTool
Pointer to the egammaCellRecoveryTool.
const CaloCellContainer * getCellContainer() const
Method to access underlying cell container.
Gaudi::Property< int > m_searchWindowPhiCellsEndcap
Size of topocluster search window in phi for the end-cap.
IdentifierHash calo_hash() const
cell calo hash
void setRawE(flt_t)
Set Energy for signal state UNCALIBRATED.
virtual double eta() const
The pseudorapidity ( ) of the particle.
virtual StatusCode redoMatching(const EventContext &ctx, SG::WriteHandle< EgammaRecContainer > &newEgammaRecs) const
egammaSuperClusterBuilderBase(const std::string &name, ISvcLocator *pSvcLocator)
Protected constructor since this class should not be instantiated by itself.
const ElementLink< xAOD::CaloClusterContainer_v1 > & getSisterClusterLink() const
Get a link to a 'sister' cluster (eg the non-calibrated counterpart)
::StatusCode StatusCode
StatusCode definition for legacy code.
size_t size() const
size method (forwarded from CaloClusterCellLink obj)
void setAltE(flt_t)
Set Energy for signal state ALTCALIBRATED.
void setRawEta(flt_t)
Set  for signal state UNCALIBRATED.
float m_searchWindowPhiBarrel
void etaphi_range(const CaloDetDescrManager &dd_man, double eta, double phi, CaloCell_ID::CaloSample sampling, double &deta, double &dphi)
Return eta/phi ranges encompassing +- 1 cell.
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Gaudi::Property< int > m_searchWindowEtaCellsBarrel
Size of topocluster search window in eta for the barrel.
const T * back() const
Access the last element in the collection as an rvalue.
static constexpr float s_TG3Run2E4cellEtaMin
static double fix(double phi)
const CaloClusterCellLink * getCellLinks() const
Get a pointer to the CaloClusterCellLink object (const version)
SG::WriteHandleKey< xAOD::CaloClusterContainer > m_precorrClustersKey
Optional key for pre-correction clusters.
virtual bool isValid() override final
Can the handle be successfully dereferenced?
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...
bool inRange(const double *boundaries, const double value, const double tolerance=0.02)
ElementLink implementation for ROOT usage.
static bool getDetPosition(const CaloDetDescrManager &mgr, CaloCell_ID::CaloSample sam, double etaAtlas, double phiAtlas, double &etaDet, double &phiDet)
get Detector level eta-phi position from Atlas level (aligned) position
float m_addCellsWindowEtaEndcap
SG::ReadHandleKey< EgammaRecContainer > m_inputEgammaRecContainerKey
Key for input egammaRec container.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
StatusCode initialize(bool used=true)
Find the size of the cluster in phi using L2 cells.
Container class for CaloCell.
@ PHICALOFRAME
Phi in the calo frame (for egamma)
virtual std::vector< std::size_t > searchForSecondaryClusters(std::size_t egammaInd, const EgammaRecContainer *egammaRecs, std::vector< bool > &isUsed) const =0
static constexpr float s_TG3Run2E4cellEtaMax
float dphi() const
cell dphi
flt_t eta0() const
Returns raw  of cluster seed.
static constexpr float s_cellEtaSize
Gaudi::Property< float > m_EtThresholdCut
Seed selection requirements.
This class provides the client interface for accessing the detector description information common to...
StatusCode record(std::unique_ptr< T > data)
Record a const object to the store.
Data object for each calorimeter readout cell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
#define ATH_MSG_WARNING(x)
const boost::regex ref(r_ef)
@ PHI2CALOFRAME
Phi of sampling 2 in the calo frame (for egamma)
bool addCell(const unsigned index, const double weight)
Method to add a cell to the cluster (Beware: Kinematics not updated!)
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
float energyBE(const unsigned layer) const
Get the energy in one layer of the EM Calo.
int findIndex(const IdentifierHash theHash) const
Return index of the cell with a given hash.
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.
bool seedClusterSelection(const xAOD::CaloCluster *clus) const
check if we pass the basic criteria for a seed cluster
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...
static constexpr float s_ClEtaMinForTG3cell
bool setEta(const CaloSample sampling, const float eta)
Set  in a given sampling. Returns false if the sample isn't part of the cluster.
bool hasSampling(const CaloSample s) const
Checks if certain smapling contributes to cluster.
@ ETACALOFRAME
Eta in the calo frame (for egamma)
Gaudi::Property< int > m_searchWindowPhiCellsBarrel
Size of topocluster search window in phi for the barrel.
void setAltPhi(flt_t)
Set  for signal state ALTCALIBRATED.
const CaloDetDescrElement * get_element_raw(CaloCell_ID::CaloSample sample, double eta, double phi) const
Get element from raw quantities (to build real fixed size clusters)
const_iterator to loop over cells belonging to a cluster
Gaudi::Property< bool > m_useExtendedTG3
Use extended TG3 definition (only after Run 2)
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...
size_type size() const noexcept
Returns the number of elements in the collection.
float m_searchWindowEtaEndcap
virtual double e() const
The total energy of the particle.
Gaudi::Property< int > m_searchWindowEtaCellsEndcap
Size of topocluster search window in eta for the end-cap.
bool empty() const noexcept
Returns true if the collection is empty.
Gaudi::Property< int > m_extraL3EtaSizeCells
"When adding L3 cells, how much wider in eta than the L2
static constexpr float s_ClEtaMaxForTG3cell
void setRawPhi(flt_t)
Set  for signal state UNCALIBRATED.
float phi_raw() const
cell phi_raw
Calculate total energy, position, etc. for a given layer of a cluster.
SG::WriteHandleKey< EgammaRecContainer > m_outputEgammaRecContainerKey
Key for output egammaRec container.