Commit eedb1e84 authored by Christos Anastopoulos's avatar Christos Anastopoulos
Browse files

Factor in common code

parent 2d811b64
......@@ -67,35 +67,17 @@ egammaSuperClusterBuilder::execute(const EventContext& ctx) const
std::vector<bool> isUsedRevert(egammaRecs->size(), false);
// Loop over input egammaRec objects, build superclusters.
for (std::size_t i = 0; i < egammaRecs->size(); ++i) {
if (isUsed[i])
if (isUsed[i]){
continue;
}
const auto* const egRec = (*egammaRecs)[i];
// Seed selections
const auto* const clus = egRec->caloCluster();
// The seed should have 2nd sampling
if (!clus->hasSampling(CaloSampling::EMB2) &&
!clus->hasSampling(CaloSampling::EME2)) {
continue;
}
const double eta2 = std::abs(clus->etaBE(2));
if (eta2 > 10) {
continue;
}
// Accordeon Energy samplings 1 to 3
const double EMAccEnergy =
clus->energyBE(1) + clus->energyBE(2) + clus->energyBE(3);
const double EMAccEt = EMAccEnergy / cosh(eta2);
// Require minimum energy for supercluster seeding.
if (EMAccEt < m_EtThresholdCut) {
// check for good seed cluster
const xAOD::CaloCluster* clus = egRec->caloCluster();
if (!seedClusterSelection(clus)) {
continue;
}
// Passed preliminary custs
ATH_MSG_DEBUG("Creating supercluster egammaRec egamma object "
<< 'n' << "Using cluster Et = " << clus->et()
<< " EM Accordeon Et " << EMAccEt);
// Mark seed as used
isUsedRevert = isUsed; // save status in case we fail to create supercluster
isUsed[i] = true;
......
......@@ -375,6 +375,26 @@ egammaSuperClusterBuilderBase::createNewCluster(
// return the new cluster
return newCluster;
}
bool
egammaSuperClusterBuilderBase::seedClusterSelection(
const xAOD::CaloCluster* clus) const
{
// The seed should have 2nd sampling
if (!clus->hasSampling(CaloSampling::EMB2) &&
!clus->hasSampling(CaloSampling::EME2)) {
return false;
}
const double eta2 = std::abs(clus->etaBE(2));
if (eta2 > 10) {
return false;
}
// Accordeon Energy samplings 1 to 3
const double EMAccEnergy =
clus->energyBE(1) + clus->energyBE(2) + clus->energyBE(3);
const double EMAccEt = EMAccEnergy / cosh(eta2);
// Require minimum energy for supercluster seeding.
return EMAccEt >= m_EtThresholdCut;
}
StatusCode
egammaSuperClusterBuilderBase::fillClusterConstrained(
......
......@@ -26,7 +26,7 @@
#include <vector>
class CaloDetDescrManager;
/** Base class for electronSuperClusterBuilder
/** Base class for electronSuperClusterBuilder
* photonSuperClusterBuilder
* egammaSuperClusterBuilder
* This class cannot be instantiated by itself since the execute method is not
......@@ -124,6 +124,11 @@ protected:
const CaloDetDescrManager& mgr,
xAOD::EgammaParameters::EgammaType egType) const;
/** check if we pass the basic criteria for
* a seed cluster
*/
bool seedClusterSelection(const xAOD::CaloCluster* clus) const;
// some constants to use
static constexpr float s_cellEtaSize = 0.025;
static constexpr float s_cellPhiSize = M_PI / 128.;
......
......@@ -86,35 +86,20 @@ electronSuperClusterBuilder::execute(const EventContext& ctx) const
std::vector<bool> isUsedRevert(egammaRecs->size(), false);
// Loop over input egammaRec objects, build superclusters.
for (std::size_t i = 0; i < egammaRecs->size(); ++i) {
if (isUsed[i])
if (isUsed[i]){
continue;
}
const auto* egRec = (*egammaRecs)[i];
// Seed selections
// check for good seed cluster
const xAOD::CaloCluster* clus = egRec->caloCluster();
// The seed should have 2nd sampling
if (!clus->hasSampling(CaloSampling::EMB2) &&
!clus->hasSampling(CaloSampling::EME2)) {
continue;
}
const double eta2 = std::abs(clus->etaBE(2));
if (eta2 > 10) {
continue;
}
// Accordeon Energy samplings 1 to 3
const double EMAccEnergy =
clus->energyBE(1) + clus->energyBE(2) + clus->energyBE(3);
const double EMAccEt = EMAccEnergy / cosh(eta2);
// Require minimum energy for supercluster seeding.
if (EMAccEt < m_EtThresholdCut) {
if (!seedClusterSelection(clus)) {
continue;
}
// We need tracks
if (egRec->getNumberOfTrackParticles() == 0) {
continue;
}
// with possible pixel
uint8_t nPixelHits(0);
uint8_t uint8_value(0);
......@@ -129,7 +114,6 @@ electronSuperClusterBuilder::execute(const EventContext& ctx) const
if (nPixelHits < m_numberOfPixelHits) {
continue;
}
// and with silicon (add SCT to pixel)
uint8_t nSiHits = nPixelHits;
if (egRec->trackParticle(0)->summaryValue(uint8_value,
......@@ -139,12 +123,6 @@ electronSuperClusterBuilder::execute(const EventContext& ctx) const
if (nSiHits < m_numberOfSiHits) {
continue;
}
ATH_MSG_DEBUG(
"Creating supercluster egammaRec electron using cluster Et = "
<< egRec->caloCluster()->et() << " eta " << egRec->caloCluster()->eta()
<< " phi " << egRec->caloCluster()->phi() << " EM Accordeon Et "
<< EMAccEt << " pixel hits " << static_cast<unsigned int>(nPixelHits)
<< " silicon hits " << static_cast<unsigned int>(nSiHits));
// Mark seed as used
isUsedRevert = isUsed; // save status in case we fail to create supercluster
isUsed[i] = true;
......
......@@ -77,35 +77,17 @@ photonSuperClusterBuilder::execute(const EventContext& ctx) const
std::vector<bool> isUsedRevert(egammaRecs->size(), false);
// Loop over input egammaRec objects, build superclusters.
for (std::size_t i = 0; i < egammaRecs->size(); ++i) {
if (isUsed[i])
if (isUsed[i]){
continue;
}
const auto* const egRec = (*egammaRecs)[i];
// Seed selections
const auto* const clus = egRec->caloCluster();
// The seed should have 2nd sampling
if (!clus->hasSampling(CaloSampling::EMB2) &&
!clus->hasSampling(CaloSampling::EME2)) {
continue;
}
const double eta2 = std::abs(clus->etaBE(2));
if (eta2 > 10) {
continue;
}
// Accordeon Energy samplings 1 to 3
const double EMAccEnergy =
clus->energyBE(1) + clus->energyBE(2) + clus->energyBE(3);
const double EMAccEt = EMAccEnergy / cosh(eta2);
// Require minimum energy for supercluster seeding.
if (EMAccEt < m_EtThresholdCut) {
// Seed cluster selections
const xAOD::CaloCluster* clus = egRec->caloCluster();
if (!seedClusterSelection(clus)) {
continue;
}
// Passed preliminary custs
ATH_MSG_DEBUG("Creating supercluster egammaRec photon object "
<< 'n' << "Using cluster Et = " << clus->et()
<< " EM Accordeon Et " << EMAccEt);
// Mark seed as used
isUsedRevert = isUsed; // save status in case we fail to create supercluster
isUsed[i] = true;
......@@ -120,7 +102,6 @@ photonSuperClusterBuilder::execute(const EventContext& ctx) const
for (const auto secClusIndex : secondaryIndices) {
const auto* const secRec = (*egammaRecs)[secClusIndex];
accumulatedClusters.push_back(secRec->caloCluster());
// no need to add vertices
}
// Create the new cluster: take the full list of cluster and add their cells
......
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