Commit 8cbb9f26 authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

CaloCellDetPos keep only methods that the CaloDetDescrManager is passed....

CaloCellDetPos keep only methods that the CaloDetDescrManager is passed. Modify the Calo D3PD to use those
parent c7be9272
......@@ -16,9 +16,7 @@
#include "CaloIdentifier/CaloCell_ID.h"
#include "CaloGeoHelpers/CaloPhiRange.h"
class CaloDetDescrManager;
#include "CaloDetDescr/CaloDetDescrManager.h"
class CaloCellDetPos
{
......@@ -52,30 +50,6 @@ class CaloCellDetPos
double phiDet, double& etaAtlas,
double& phiAtlas) ;
/**
* @brief get Detector level eta-phi position from Atlas level (aligned) position
* @param CaloCell_ID::CaloSample sam layer to use
* @param double etaAtlas : input eta Atlas level position
* @param double phiAtlas : input phi Atlas level position
* @param double etaDet : estimated eta detector in nominal calo frame
* @param double phiDet : estimated phi detector in nominal calo frame
*/
static bool getDetPosition(CaloCell_ID::CaloSample sam , double etaAtlas, double phiAtlas,
double & etaDet, double & phiDet) ;
/**
* @brief get Atlas (aligned) level eta-phi position from detector level eta-phi positions
* @param CaloCell_ID::CaloSample sam layer to use
* @param double etaDet : input eta detector level position
* @param double phiDet : input phi detector level position
* @param double etaAtlas : estimated eta detector in aligned Atlas frame
* @param double phiAtlas : estimated phi detector in aligned Atlas frame
*/
static bool getAtlasPosition(CaloCell_ID::CaloSample sam , double etaDet, double phiDet,
double & etaAtlas, double & phiAtlas) ;
};
#endif
......@@ -8,7 +8,6 @@
// the methods return true if an element of the correct layer is found within the cell, false otherwise
#include "CaloUtils/CaloCellDetPos.h"
#include "CaloDetDescr/CaloDetDescrManager.h"
#include "CaloDetDescr/CaloDetDescrElement.h"
bool CaloCellDetPos::getDetPosition(const CaloDetDescrManager& mgr,
......@@ -43,21 +42,3 @@ bool CaloCellDetPos::getAtlasPosition(const CaloDetDescrManager& mgr,
phiAtlas = CaloPhiRange::fix(phiDet + elt->phi()-elt->phi_raw());
return true;
}
bool CaloCellDetPos::getDetPosition(CaloCell_ID::CaloSample sam,
double etaAtlas, double phiAtlas,
double& etaDet, double& phiDet) {
const CaloDetDescrManager* calo_mgr;
calo_mgr = CaloDetDescrManager::instance();
return getDetPosition(*calo_mgr,sam,etaAtlas,phiAtlas,etaDet,phiDet);
}
bool CaloCellDetPos::getAtlasPosition(CaloCell_ID::CaloSample sam,
double etaDet, double phiDet,
double& etaAtlas,
double& phiAtlas) {
const CaloDetDescrManager* calo_mgr;
calo_mgr = CaloDetDescrManager::instance();
return getAtlasPosition(*calo_mgr,sam,etaDet,phiDet,etaAtlas,phiAtlas);
}
......@@ -36,6 +36,13 @@ ClusterPositionInCaloFillerTool::ClusterPositionInCaloFillerTool
book().ignore(); // Avoid coverity warnings.
}
StatusCode ClusterPositionInCaloFillerTool::initialize()
{
ATH_CHECK(m_caloDetDescrMgrKey.initialize());
return StatusCode::SUCCESS;
}
/**
* @brief Book variables for this block.
......@@ -99,6 +106,8 @@ StatusCode ClusterPositionInCaloFillerTool::fill (const xAOD::CaloCluster& p)
template <class T>
StatusCode ClusterPositionInCaloFillerTool::fillT (const T& p)
{
SG::ReadCondHandle<CaloDetDescrManager> caloDetDescrMgrHandle { m_caloDetDescrMgrKey };
CaloCell_ID::CaloSample sam = CaloCell_ID::EMB2;
if (p.inBarrel() && !p.inEndcap())
sam = CaloCell_ID::EMB2;
......@@ -108,12 +117,19 @@ StatusCode ClusterPositionInCaloFillerTool::fillT (const T& p)
if (p.eSample(CaloSampling::EMB2) > p.eSample(CaloSampling::EME2)) sam=CaloCell_ID::EMB2;
else sam = CaloCell_ID::EME2;
}
if(m_FillSeedCoordinates)
m_caloCellDetPos.getDetPosition(sam, p.eta0(), p.phi0(), *m_eta0Calo, *m_phi0Calo);
else
m_caloCellDetPos.getDetPosition(sam, p.eta(), p.phi(), *m_etaCalo, *m_phiCalo);
if (m_FillSeedCoordinates) {
CaloCellDetPos::getDetPosition(**caloDetDescrMgrHandle,
sam,
p.eta0(),
p.phi0(),
*m_eta0Calo,
*m_phi0Calo);
} else {
CaloCellDetPos::getDetPosition(
**caloDetDescrMgrHandle, sam, p.eta(), p.phi(), *m_etaCalo, *m_phiCalo);
}
return StatusCode::SUCCESS;
}
......
......@@ -43,6 +43,7 @@ public:
const std::string& name,
const IInterface* parent);
virtual StatusCode initialize() override;
/// Book variables for this block.
virtual StatusCode book() override;
......@@ -96,8 +97,13 @@ private:
/// Variable: whether to dump the seed coordinates
bool m_FillSeedCoordinates;
/// Position helper.
CaloCellDetPos m_caloCellDetPos;
SG::ReadCondHandleKey<CaloDetDescrManager> m_caloDetDescrMgrKey{
this,
"CaloDetDescrManager",
"CaloDetDescrManager",
"SG Key for CaloDetDescrManager in the Condition Store"
};
};
......
......@@ -74,6 +74,11 @@ ClusterSamplingFillerTool::ClusterSamplingFillerTool
std::fill (m_etamax, m_etamax + NSAMP, (float*)0);
}
StatusCode ClusterSamplingFillerTool::initialize()
{
ATH_CHECK(m_caloDetDescrMgrKey.initialize());
return StatusCode::SUCCESS;
}
/**
* @brief Book variables for this block.
......@@ -235,8 +240,7 @@ ClusterSamplingFillerTool::fillSamplings (const std::vector<double>& eSamp,
const std::vector<double>& etaSamp,
const std::vector<double>& phiSamp)
{
CaloCellDetPos detpos;
SG::ReadCondHandle<CaloDetDescrManager> caloDetDescrMgrHandle { m_caloDetDescrMgrKey };
if( m_writeEmHadEnergies && eSamp.size() >= NSAMP) {
*m_Eem =
vget (eSamp, CaloSampling::PreSamplerB) +
......@@ -279,14 +283,15 @@ ClusterSamplingFillerTool::fillSamplings (const std::vector<double>& eSamp,
}
if (m_writeSamplingEtaPhiRaw) {
double eta_raw=0, phi_raw=0;
if (detpos.getDetPosition (static_cast<CaloCell_ID::CaloSample>(m_samplings[i]),
vget (etaSamp, m_samplings[i]),
vget (phiSamp, m_samplings[i]),
eta_raw,
phi_raw))
{
*m_raw_etas[i] = eta_raw;
*m_raw_phis[i] = phi_raw;
if (CaloCellDetPos::getDetPosition(
**caloDetDescrMgrHandle,
static_cast<CaloCell_ID::CaloSample>(m_samplings[i]),
vget(etaSamp, m_samplings[i]),
vget(phiSamp, m_samplings[i]),
eta_raw,
phi_raw)) {
*m_raw_etas[i] = eta_raw;
*m_raw_phis[i] = phi_raw;
}
}
}
......
......@@ -18,13 +18,13 @@
#include "D3PDMakerUtils/BlockFillerTool.h"
#include "xAODCaloEvent/CaloCluster.h"
#include "CaloUtils/CaloCellDetPos.h"
#include <vector>
class CaloCluster;
namespace D3PD {
/**
* @brief Block filler tool for EM samplings from a CaloCluster.
*/
......@@ -46,8 +46,10 @@ public:
const IInterface* parent);
virtual StatusCode initialize() override;
/// Book variables for this block.
virtual StatusCode book();
virtual StatusCode book() override;
/**
......@@ -58,7 +60,7 @@ public:
* is responsible for arranging that all the pointers for booked variables
* are set appropriately upon entry.
*/
virtual StatusCode fill (const CaloCluster& p);
virtual StatusCode fill (const CaloCluster& p) override;
/**
......@@ -69,7 +71,7 @@ public:
* is responsible for arranging that all the pointers for booked variables
* are set appropriately upon entry.
*/
virtual StatusCode fill (const xAOD::CaloCluster& p);
virtual StatusCode fill (const xAOD::CaloCluster& p) override;
private:
......@@ -128,10 +130,14 @@ private:
float* m_etamax[NSAMP];
unsigned int* m_RecoStatus;
SG::ReadCondHandleKey<CaloDetDescrManager> m_caloDetDescrMgrKey{
this,
"CaloDetDescrManager",
"CaloDetDescrManager",
"SG Key for CaloDetDescrManager in the Condition Store"
};
};
} // namespace D3PD
......
......@@ -13,11 +13,9 @@
#include "xAODEgamma/PhotonContainer.h"
#include "CaloDetDescr/CaloDetDescrManager.h"
#include "CaloUtils/CaloCellDetPos.h"
#include "CaloUtils/CaloClusterStoreHelper.h"
#include "StoreGate/WriteHandle.h"
// =============================================================
EMClusterTool::EMClusterTool(const std::string& type,
const std::string& name,
const IInterface* parent)
......
......@@ -19,7 +19,6 @@
#include "xAODEgamma/EgammaEnums.h"
#include "xAODEgamma/EgammaFwd.h"
#include "CaloUtils/CaloCellDetPos.h"
class CaloClusterCellLink;
/**
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment