diff --git a/Reconstruction/egamma/egammaTools/cmt/requirements b/Reconstruction/egamma/egammaTools/cmt/requirements index bdbce7205ea399f945401e5d16e52ddc8b4fe0dd..715696efb70e922c24327b3c678c874f88decbb6 100644 --- a/Reconstruction/egamma/egammaTools/cmt/requirements +++ b/Reconstruction/egamma/egammaTools/cmt/requirements @@ -20,6 +20,8 @@ use EventPrimitives EventPrimitives-* Event use LArRecConditions LArRecConditions-* LArCalorimeter use LArTools LArTools-* LArCalorimeter +use LumiBlockComps LumiBlockComps-* LumiBlock + use InDetConversionFinderTools InDetConversionFinderTools-* InnerDetector/InDetRecTools use InDetRecToolInterfaces InDetRecToolInterfaces-* InnerDetector/InDetRecTools use InDetBeamSpotService InDetBeamSpotService-* InnerDetector/InDetConditions @@ -54,7 +56,7 @@ use xAODTruth xAODTruth-* Event/xAOD use PATCore PATCore-* PhysicsAnalysis/AnalysisCommon use ElectronPhotonSelectorTools ElectronPhotonSelectorTools-* PhysicsAnalysis/ElectronPhotonID - +use ElectronPhotonFourMomentumCorrection ElectronPhotonFourMomentumCorrection-* PhysicsAnalysis/ElectronPhotonID end_private diff --git a/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py b/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py index 373030cda9603f085c0878396b442b850af35cd2..c861311a165e1b59be9daa2925df8076014a5ba2 100644 --- a/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py +++ b/Reconstruction/egamma/egammaTools/python/egammaToolsFactories.py @@ -73,7 +73,8 @@ EMConversionBuilder = ToolFactory( egammaToolsConf.EMConversionBuilder, ExtrapolationTool = EMExtrapolationTools) -EMAmbiguityTool = ToolFactory( egammaToolsConf.EMAmbiguityTool ) +from ElectronPhotonSelectorTools import ElectronPhotonSelectorToolsConf +EGammaAmbiguityTool = ToolFactory( ElectronPhotonSelectorToolsConf.EGammaAmbiguityTool ) EMFourMomBuilder = ToolFactory( egammaToolsConf.EMFourMomBuilder) diff --git a/Reconstruction/egamma/egammaTools/src/CandidateMatchHelpers.h b/Reconstruction/egamma/egammaTools/src/CandidateMatchHelpers.h index 67c047f9a8468e253a23263e7bf856bdcdb4bab3..7e421a34a4800ccb04f25e3c9dbf87f6f71de2ae 100644 --- a/Reconstruction/egamma/egammaTools/src/CandidateMatchHelpers.h +++ b/Reconstruction/egamma/egammaTools/src/CandidateMatchHelpers.h @@ -63,7 +63,7 @@ class CandidateMatchHelpers ecCorr = sinTheta0*sqrt(sinTheta0)*ecFactor; } //// - double Rscaled =(Rcalo-r_first)/Rcalo; + double Rscaled =(Rcalo-r_first)*(1./Rcalo); phiRot = Rscaled*ecCorr*charge*430./(Et); return phiRot; } diff --git a/Reconstruction/egamma/egammaTools/src/EMAmbiguityTool.cxx b/Reconstruction/egamma/egammaTools/src/EMAmbiguityTool.cxx deleted file mode 100644 index b0823cc4eaffafede037e072655f89e4612adecd..0000000000000000000000000000000000000000 --- a/Reconstruction/egamma/egammaTools/src/EMAmbiguityTool.cxx +++ /dev/null @@ -1,156 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -/******************************************************************** - -NAME: EMAmbiguityTool.cxx -PACKAGE: offline/Reconstruction/egamma/egammaTools - -********************************************************************/ - -#include "EMAmbiguityTool.h" -#include "xAODEgamma/EgammaDefs.h" -#include "xAODEgamma/EgammaxAODHelpers.h" -#include "xAODTracking/Vertex.h" -#include "xAODTracking/TrackParticle.h" -#include "egammaRecEvent/egammaRec.h" - -EMAmbiguityTool::EMAmbiguityTool(const std::string& type, const std::string& name, const IInterface* parent) : - AthAlgTool(type, name, parent) -{ - declareInterface<IEMAmbiguityTool>(this); - //Minimum silicon hits for electron - - declareProperty("minNoSiHits", m_MinNoSiHits = 4, "Minimum number of silicon hits to be an electron==>not photon for sure"); - declareProperty("minNoPixHits", m_MinNoPixHits = 2, "Minimum number of Pixel hits to be an electron==>not photon for sure"); - declareProperty("maxEoverPCut", m_maxEoverPCut = 10,"Maximum EoverP , more that this is ambiguous"); - declareProperty("minPCut", m_minPtCut = 2000 , "Minimum Pt, less than that is ambiguous"); - -} - -EMAmbiguityTool::~EMAmbiguityTool() {} - -StatusCode EMAmbiguityTool::initialize() { - - ATH_MSG_DEBUG("Initializing " << name() << "..."); - - return StatusCode::SUCCESS; -} - -StatusCode EMAmbiguityTool::finalize() { - return StatusCode::SUCCESS; -} - -// ==================================================================== -// return value: AuthorElectron, AuthorPhoton, AuthorAmbiguous, AuthorUnknown - -unsigned int EMAmbiguityTool::ambiguityResolve(const egammaRec *egRec) const -{ - - const xAOD::CaloCluster* cluster = egRec->caloCluster(); - const xAOD::Vertex* vx = egRec->vertex(); - const xAOD::TrackParticle* tp = egRec->trackParticle(); - - - uint8_t trkExpectBlayerHit(0), trkBlayerHits(0), trkPixelHits(0), trkSiHits(0); - - double ep(0); - if(tp){ - ep= cluster->e() * fabs(tp->qOverP()); - } - - if (tp && !tp->summaryValue(trkExpectBlayerHit,xAOD::expectInnermostPixelLayerHit)) - ATH_MSG_WARNING("Could not retrieve expected InnermostPixelLayer hit from track"); - - if (tp && !tp->summaryValue(trkBlayerHits,xAOD::numberOfInnermostPixelLayerHits)) - ATH_MSG_WARNING("Could not retrieve number of InnermostPixelLayer hits from track"); - - if (tp && !tp->summaryValue(trkPixelHits,xAOD::numberOfPixelHits)) - ATH_MSG_WARNING("Could not retrieve number of pixel hits from track"); - - if (tp && !tp->summaryValue(trkSiHits, xAOD::numberOfSCTHits)) - ATH_MSG_WARNING("Could not retrieve number of SCT hits from track"); - trkSiHits += trkPixelHits; - - xAOD::EgammaParameters::ConversionType convType(xAOD::EgammaHelpers::conversionType(vx)); - bool vxDoubleSi = (convType == xAOD::EgammaParameters::doubleSi); - - - //See if the Si+Si conversion shares one track with the electron - //if not we might have a trident. - //if yes and the track is not good we definetely matched the conversion as electron. - bool shareTrack=false; - if(tp && trkSiHits>=m_MinNoSiHits && vxDoubleSi){ - const xAOD::TrackParticle *trk1 = ( vx->nTrackParticles() ? vx->trackParticle(0) : 0 ); - const xAOD::TrackParticle *trk2 = ( vx->nTrackParticles() > 1 ? vx->trackParticle(1) : 0 ); - - if( (tp==trk1) || (tp==trk2)) { - shareTrack=true; - - } - } - - ATH_MSG_DEBUG("Vertex, SiSi: " << (vx != 0) << " , " << vxDoubleSi); - ATH_MSG_DEBUG("Track, Si hits, pixel hits, bLayerHits, expectBlayerHit: " - << (tp != 0) << " , " << (int) trkSiHits << " , " << (int) trkPixelHits - << " , " << (int) trkBlayerHits << " , " << (int) trkExpectBlayerHit); - ATH_MSG_DEBUG("Share track : " << shareTrack); - - //The Electron collection will NOT contain Photons - //The Photon collection will NOT contain Electrons - - //So for conversions vs electrons better to go to ambiguous - //except if we are sure. - - //Practically a photon here means definetely not Electron - //And vice-versa - - //Photon ==> Surely not electron - // - no track - // - or no track with the minimum requirent hits to be an electron - // - or Si+Si vertex and - // - No pixel - // - The electron track is part of the conversion - // In this case we do not want this to be in Electrons - - if (!tp || - trkSiHits<m_MinNoSiHits || - (vxDoubleSi && !trkPixelHits && shareTrack)){ - ATH_MSG_DEBUG("Returning Photon"); - return xAOD::EgammaParameters::AuthorPhoton; - } - - //Ambigous due to E/P ,Min Pt, pixel hits - //We are not sure it is a Photon , but is not good enough either to be surely an Electron - // - E/P >10 or track Pt < 2.0 GeV or no-pixel then Ambiguous - if( ep > m_maxEoverPCut || tp->pt()<m_minPtCut || !trkPixelHits) { - ATH_MSG_DEBUG("Returning Ambiguous due to E over P || min Pt || no pixels"); - return xAOD::EgammaParameters::AuthorAmbiguous; - } - - //Electron ==> Surely not Photon - // - Track with at least the minimum Si and Pixel hits (previous selection for photons/ambiguous) - // - And has E/P < 10 and Pt > 2.0 GeV (previous for ambiguous) - // - No vertex Matched - // - Or if a vertex exists and is not Si+Si - // - Either Blayer hit - // - Or (2) or more Pixel hits when not expecting a b-layer hit - // In this case we do not want this to be in Photons - - if ( !vx|| - (trkBlayerHits && !vxDoubleSi) || - (!trkExpectBlayerHit && trkPixelHits>=m_MinNoPixHits && !vxDoubleSi) ){ - ATH_MSG_DEBUG("Returning Electron"); - return xAOD::EgammaParameters::AuthorElectron; - } - - // Ambiguous all else, these will go to both electrons and photons - // A matched Si+Si vertex and a track with 2 pixel / blayer hits - // A non Si+Si vertex matched and a track with no 2 pixel / blayer hits - - - ATH_MSG_DEBUG("Returning Ambiguous"); - return xAOD::EgammaParameters::AuthorAmbiguous; -} - diff --git a/Reconstruction/egamma/egammaTools/src/EMAmbiguityTool.h b/Reconstruction/egamma/egammaTools/src/EMAmbiguityTool.h deleted file mode 100644 index ac7e0bcede5e1a468e9e63f65f8a09858bddc432..0000000000000000000000000000000000000000 --- a/Reconstruction/egamma/egammaTools/src/EMAmbiguityTool.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration -*/ - -#ifndef EMAMBIGUITYTOOL_H -#define EMAMBIGUITYTOOL_H - -#include "AthenaBaseComps/AthAlgTool.h" -// #include "GaudiKernel/ToolHandle.h" -#include "egammaInterfaces/IEMAmbiguityTool.h" - -#include "xAODTracking/VertexFwd.h" -#include "xAODTracking/TrackParticleFwd.h" - -/** - @class EMAmbiguityTool - This tool resolves the electron-converted photon ambiguity. - @author Thomas Koffas - @author Bruno Lenzi - @author Christos Anastopoulos -*/ - -class egammaRec; - -class EMAmbiguityTool : virtual public IEMAmbiguityTool, public AthAlgTool { - -public: - EMAmbiguityTool (const std::string& type,const std::string& name, const IInterface* parent); - virtual ~EMAmbiguityTool(); - - virtual StatusCode initialize(); - virtual StatusCode finalize(); - - unsigned int ambiguityResolve(const egammaRec* egRec) const; - -private: - - /** @brief Minimum number of silicon hits to be an electron */ - unsigned int m_MinNoSiHits; - unsigned int m_MinNoPixHits; - double m_maxEoverPCut; - double m_minPtCut; - -}; - -#endif // EMAMBIGUITYTOOL_H diff --git a/Reconstruction/egamma/egammaTools/src/EMBremCollectionBuilder.cxx b/Reconstruction/egamma/egammaTools/src/EMBremCollectionBuilder.cxx index ea3457adf824fbd92224753ebaabf5b576619ff5..951595f9ff2e8931ed4548218bccd1c1d0f1b839 100644 --- a/Reconstruction/egamma/egammaTools/src/EMBremCollectionBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMBremCollectionBuilder.cxx @@ -277,7 +277,6 @@ StatusCode EMBremCollectionBuilder::contExecute() ElementLink<xAOD::TrackParticleContainer> linkToOriginal(*m_trackTES,trackNumber); xAOD::TrackParticle* gsfTrack = m_finalTrkPartContainer->back(); gsfTrack->auxdata< ElementLink< xAOD::TrackParticleContainer > >( "originalTrackParticle" ) = linkToOriginal; - linkToOriginal.toPersistent(); if(m_doTruth){ //Add Truth decorations. Copy from the original. @@ -285,7 +284,6 @@ StatusCode EMBremCollectionBuilder::contExecute() if(tPL.isAvailable(*(*track_iter))){ ElementLink<xAOD::TruthParticleContainer> linkToTruth= tPL(*(*track_iter)); tPL(*gsfTrack) = linkToTruth; - linkToTruth.toPersistent(); if(!linkToTruth.isValid()){ ATH_MSG_DEBUG("Cannot create Valid Link to Truth Particle for GSFTrackParticle"); diff --git a/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx b/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx index 0ba3911b4f027e5d3ce1546a934fe21c5261e853..1f1546da1e3b788da2b241c94070205761950d9d 100644 --- a/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMClusterTool.cxx @@ -104,7 +104,7 @@ StatusCode EMClusterTool::contExecute() xAOD::CaloClusterContainer* outputTopoSeededClusterContainer = outputClusterContainer; if (m_outputTopoSeededClusterContainerName != m_outputClusterContainerName) { - outputTopoSeededClusterContainer = \ + outputTopoSeededClusterContainer = CaloClusterStoreHelper::makeContainer(&*evtStore(), m_outputTopoSeededClusterContainerName, msg()); @@ -156,8 +156,7 @@ void EMClusterTool::setNewCluster(xAOD::Egamma *eg, { if (!eg) return; - if (!eg->caloCluster()) - { + if (!eg->caloCluster()){ ATH_MSG_DEBUG("egamma object does not have a cluster associated"); return; } @@ -166,6 +165,7 @@ void EMClusterTool::setNewCluster(xAOD::Egamma *eg, xAOD::CaloCluster* cluster =0; if(eg->author(xAOD::EgammaParameters::AuthorCaloTopo35)) { cluster = new xAOD::CaloCluster(*(eg->caloCluster())); + fillPositionsInCalo(cluster); } else { cluster = makeNewCluster(*(eg->caloCluster()), eg,egType); @@ -188,14 +188,12 @@ xAOD::CaloCluster* EMClusterTool::makeNewCluster(const xAOD::CaloCluster& cluste // // protection against cluster not in barrel nor endcap - if (!cluster.inBarrel() && !cluster.inEndcap() ) - { + if (!cluster.inBarrel() && !cluster.inEndcap() ){ ATH_MSG_ERROR("Cluster neither in barrel nor in endcap, Skipping cluster"); return 0; } - if ((int) egType < 0 || egType >= xAOD::EgammaParameters::NumberOfEgammaTypes) - { + if ((int) egType < 0 || egType >= xAOD::EgammaParameters::NumberOfEgammaTypes){ ATH_MSG_WARNING("Invalid egamma type"); return 0; } diff --git a/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.cxx b/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.cxx index 6d113fb73b8d9d1d2d77f622e14342a53463e5a7..51222832f52f0e979b52fc2afd556c3115e1aa69 100644 --- a/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMConversionBuilder.cxx @@ -257,7 +257,7 @@ bool EMConversionBuilder::passPtAndEoverP(const xAOD::Vertex& vertex, const xAOD auto convType = xAOD::EgammaHelpers::conversionType(&vertex); bool isSingle = (convType == singleTRT || convType == singleSi); bool isTRT = (convType == singleTRT || convType == xAOD::EgammaParameters::doubleTRT); - float EoverPcut = m_maxEoverP_singleTrack*(1+m_maxEoverP_singleTrack_EtSf*cluster.et()/1e3); + float EoverPcut = m_maxEoverP_singleTrack*(1+m_maxEoverP_singleTrack_EtSf*cluster.et()*1e-3); // Check TRT tube hit fraction float tubeHitFraction = getMaxTRTTubeHitFraction(vertex); diff --git a/Reconstruction/egamma/egammaTools/src/EMFourMomBuilder.cxx b/Reconstruction/egamma/egammaTools/src/EMFourMomBuilder.cxx index 05f143d6c7f5e3be25e5b43976e992462a3b29a8..3be810847f07575af1221052b2a47455c19a0b3a 100644 --- a/Reconstruction/egamma/egammaTools/src/EMFourMomBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMFourMomBuilder.cxx @@ -24,6 +24,7 @@ PACKAGE: offline/Reconstruction/egamma/egammaTools #include "xAODEgamma/EgammaxAODHelpers.h" #include "EventPrimitives/EventPrimitives.h" #include "FourMom/EigenP5Jacobiand0z0PhiThetaqOverP2d0z0PhiEtaP.h" +#include "ElectronPhotonFourMomentumCorrection/eg_resolution.h" // END OF HEADER FILES INCLUDE using CLHEP::GeV; @@ -51,6 +52,12 @@ EMFourMomBuilder::EMFourMomBuilder(const std::string& type, declareProperty("m_FourMomCombiner", m_FourMomCombiner, "Tool for performing E-p combination"); + + + // + declareProperty("ResolutionConfiguration", + m_ResolutionConfiguration = "run2_pre", + "Resolution Configuration"); } @@ -65,7 +72,6 @@ EMFourMomBuilder::~EMFourMomBuilder() StatusCode EMFourMomBuilder::initialize() { ATH_MSG_DEBUG(" Initializing EMFourMomBuilder"); - return StatusCode::SUCCESS; } @@ -125,6 +131,8 @@ StatusCode EMFourMomBuilder::hltExecute(xAOD::Egamma* eg, unsigned int index) // =================================================================== StatusCode EMFourMomBuilder::setFromTrkCluster(xAOD::Electron* el,unsigned int index){ + + //=========== In case we manage to have combination as default if (m_useCombination) { //Get # of Si hits. uint8_t nPixel(0), nSCT(0); @@ -141,7 +149,7 @@ StatusCode EMFourMomBuilder::setFromTrkCluster(xAOD::Electron* el,unsigned int i //Put combined error matrix in EMErrorDetail. saveParameters(el); } - //===========No combination + //===========No combination default for now ! else{ const xAOD::CaloCluster *cluster = el->caloCluster(); if (!cluster) { @@ -172,8 +180,13 @@ StatusCode EMFourMomBuilder::setFromTrkCluster(xAOD::Electron* el,unsigned int i m.setZero(); m = J * (covmat * J.transpose()); + //Energy resolution for the cluster + static eg_resolution eg_resol(m_ResolutionConfiguration); + eg_resol.msg().setLevel(this->msg().level()); + const float sigmaE_over_E= eg_resol.getResolution(0,E,cluster->eta()); + //Rearrange the elements of the d0, z0, phi, eta, P representation to make the (E, eta, phi, M) - matrix(0,0) = m(4,4); //This should come from the cluster E + matrix(0,0) = sigmaE_over_E* E * sigmaE_over_E *E ;//This comes from the cluster Energy resolution matrix(1,1) = m(3,3); matrix(2,2) = m(2,2); matrix.fillSymmetric(0,1,m(4,3)); @@ -207,11 +220,6 @@ StatusCode EMFourMomBuilder::setFromTrkCluster(xAOD::Photon* ph){ //Set the four momentum. ATH_MSG_DEBUG("Setting P4 using E=" << E << " eta=" << eta << " phi=" << phi <<" mass" << mass); ph->setP4( E/cosh(eta), eta, phi, mass); - //Set the covariance matrix. - //dynamic variable not filled for now for Photons - //AmgMatrix(4,4) matrix; - //matrix.setZero(); - //ph->setCovMatrix(matrix.cast<float>()); return StatusCode::SUCCESS; } @@ -240,22 +248,13 @@ StatusCode EMFourMomBuilder::setFromCluster(xAOD::Egamma* eg) else{ eg->setP4( E/cosh(eta), eta, phi, mass); } - //Set the covariance matrix. - //dynamic variable not filled for now for Photons - //AmgMatrix(4,4) matrix; - //matrix.setZero(); - //eg->setCovMatrix(matrix.cast<float>()); - return StatusCode::SUCCESS; } // ================================================================= // Fill egamma with the combined parameters + matrix. void EMFourMomBuilder::saveParameters(xAOD::Egamma *eg) { - saveCombinedParams(eg); -} -void EMFourMomBuilder::saveCombinedParams(xAOD::Egamma *eg) { double mass(0.); if (eg->type()==xAOD::Type::Electron){ mass = 0.510998; diff --git a/Reconstruction/egamma/egammaTools/src/EMFourMomBuilder.h b/Reconstruction/egamma/egammaTools/src/EMFourMomBuilder.h index 0ad8b52b7c64f230771305dcff337f91c0310271..5a8258427137d6d6d3455f015a018a7fc38d1ad4 100644 --- a/Reconstruction/egamma/egammaTools/src/EMFourMomBuilder.h +++ b/Reconstruction/egamma/egammaTools/src/EMFourMomBuilder.h @@ -73,7 +73,6 @@ private: //Method to save parameters in egamma object. void saveParameters (xAOD::Egamma*); - void saveCombinedParams(xAOD::Egamma*); //Adding in separate combination tool - this should act as the shell that makes the decision. ToolHandle<IFourMomCombiner> m_FourMomCombiner; @@ -81,6 +80,8 @@ private: /** @brief Use E-p combination*/ bool m_useCombination; + /** @brief Resolution configuration*/ + std::string m_ResolutionConfiguration; }; diff --git a/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.cxx b/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.cxx index 873e1724c0148f332a1320ad05eb41f06f739665..f7ff455c7dee6d03145ab5561764d1a2a761cec7 100644 --- a/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.cxx @@ -11,6 +11,7 @@ #include "ElectronPhotonSelectorTools/IAsgElectronLikelihoodTool.h" #include "ElectronPhotonSelectorTools/IAsgPhotonIsEMSelector.h" #include "PATCore/IAsgSelectionTool.h" +#include "LumiBlockComps/LumiBlockMuTool.h" // =========================================================================== EMPIDBuilder::EMPIDBuilder(const std::string& type, @@ -48,6 +49,12 @@ EMPIDBuilder::EMPIDBuilder(const std::string& type, declareProperty("LHValueName", m_LHValueName="LHValue", "The LH Value name"); + /** Luminosity tool */ + declareProperty("LuminosityTool", m_lumiBlockMuTool, "Luminosity Tool"); + //** Flag *// + declareProperty("UseLuminosityTool", m_UselumiBlockMuTool = false, + "Use Luminosity Tool instead of value stored in xAOD"); + } // =============================================================== @@ -105,6 +112,14 @@ StatusCode EMPIDBuilder::initialize() return StatusCode::FAILURE; } + if (m_UselumiBlockMuTool) { + // retrieve the lumi tool + if (m_lumiBlockMuTool.retrieve().isFailure()) { + ATH_MSG_DEBUG("Unable to retrieve Luminosity Tool"); + } else { + ATH_MSG_DEBUG("Successfully retrieved Luminosity Tool"); + } + } return StatusCode::SUCCESS; } @@ -154,20 +169,30 @@ StatusCode EMPIDBuilder::execute(xAOD::Egamma* eg) size_t sizeLH = m_electronLHselectors.size(); - for (size_t i = 0; i<sizeLH; ++i) { - const Root::TAccept& accept = m_electronLHselectors[i]->accept(eg); - //save the bool result - eg->setPassSelection(static_cast<bool>(accept), m_electronLHselectorResultNames[i]); - //save the isem - eg->setSelectionisEM(static_cast<unsigned int> (accept.getCutResultInverted()), "isEM"+m_electronLHselectorResultNames[i]); - - //save the LHValue only once - if(i==0){ - eg->setLikelihoodValue(static_cast<float>(m_electronLHselectors[i]->getTResult().getResult(0)),m_LHValueName); - } + //negative mu means the default behaviour --> retrieve the one in xAOD + double mu = -99.; + double avg_mu = -99.; + if(m_UselumiBlockMuTool && m_lumiBlockMuTool){ // + mu = m_lumiBlockMuTool->actualInteractionsPerCrossing(); // (retrieve mu for the current BCID) + avg_mu = m_lumiBlockMuTool->averageInteractionsPerCrossing(); + ATH_MSG_DEBUG("REGTEST: Retrieved Mu Value : " << mu); + ATH_MSG_DEBUG("REGTEST: Average Mu Value : " << avg_mu); + } + for (size_t i = 0; i<sizeLH; ++i) { + + const Root::TAccept& accept = m_electronLHselectors[i]->accept(eg,avg_mu); + //save the bool result + eg->setPassSelection(static_cast<bool>(accept), m_electronLHselectorResultNames[i]); + //save the isem + eg->setSelectionisEM(static_cast<unsigned int> (accept.getCutResultInverted()), "isEM"+m_electronLHselectorResultNames[i]); + + //save the LHValue only once + if(i==0){ + eg->setLikelihoodValue(static_cast<float>(m_electronLHselectors[i]->getTResult().getResult(0)),m_LHValueName); + } } - + size_t sizeGen = m_genericIsEMselectors.size(); for (size_t i = 0; i<sizeGen;++i) { const Root::TAccept& accept = m_genericIsEMselectors[i]->accept(eg); diff --git a/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.h b/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.h index b56bad18de7f7d620ca5be565d1ea397fe45a6c6..982a40d6cd20ef0ec92654b3fd0d614aba53b632 100644 --- a/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.h +++ b/Reconstruction/egamma/egammaTools/src/EMPIDBuilder.h @@ -23,6 +23,7 @@ class IAsgSelectionTool; class IAsgElectronIsEMSelector; class IAsgElectronLikelihoodTool; class IAsgPhotonIsEMSelector; +class ILumiBlockMuTool; class EMPIDBuilder : public egammaBaseTool { @@ -57,8 +58,16 @@ class EMPIDBuilder : public egammaBaseTool ToolHandleArray<IAsgPhotonIsEMSelector> m_photonIsEMselectors; std::vector<std::string> m_photonIsEMselectorResultNames; + + ToolHandle<ILumiBlockMuTool> m_lumiBlockMuTool; std::string m_LHValueName; + + private: + bool m_UselumiBlockMuTool; + + + }; #endif diff --git a/Reconstruction/egamma/egammaTools/src/FourMomCombiner.cxx b/Reconstruction/egamma/egammaTools/src/FourMomCombiner.cxx index a32f6ef01ae891c90ca56b129bdcb82bd94454f5..817aaa81f739fd6f1e85ae1a89815e9734da6b0b 100644 --- a/Reconstruction/egamma/egammaTools/src/FourMomCombiner.cxx +++ b/Reconstruction/egamma/egammaTools/src/FourMomCombiner.cxx @@ -146,7 +146,6 @@ StatusCode FourMomCombiner::TrackClusterExecute(xAOD::Egamma *eg, return StatusCode::FAILURE; } - //Load track parameters from egamma object. fillTrackVectorElements(eg,index); @@ -228,9 +227,7 @@ StatusCode FourMomCombiner::execute() { m_combMatrix = wVM.getMatrix(); } - return StatusCode::SUCCESS; - } StatusCode FourMomCombiner::finalize() { @@ -575,9 +572,7 @@ double FourMomCombiner::getClusterPhiError(const xAOD::Egamma* eg) const if (aCluster == 0 /*|| pars == 0*/) return 1E11; return 1e-3; - //return pars->getPhiMatrix(tp).getError(caloEta(eg, aCluster->eta()), aCluster->e()); - } double FourMomCombiner::getClusterEtaError(const xAOD::Egamma* eg) const @@ -594,11 +589,8 @@ double FourMomCombiner::getClusterEtaError(const xAOD::Egamma* eg) const const double sigma_theta = 0.07 /sqrt(clusterEnergyGeV); const double theta = 2.*atan(exp(eta)); return ( fabs(sigma_theta/sin(theta)) ); - } - return 0.; - } double FourMomCombiner::getClusterEtaPosError(const xAOD::Egamma* eg) const @@ -634,13 +626,9 @@ double FourMomCombiner::getClusterEnergyError(const xAOD::Egamma* eg) const double cl_err = 1E10; - return cl_err; - } - - double FourMomCombiner::caloEta(const xAOD::Egamma* eg, double clusterEta) const { if (!eg) return clusterEta; @@ -652,11 +640,9 @@ double FourMomCombiner::caloEta(const xAOD::Egamma* eg, double clusterEta) const } else { return clusterEta; } - } -bool FourMomCombiner::isElectron(const xAOD::Egamma* eg) const -{ +bool FourMomCombiner::isElectron(const xAOD::Egamma* eg) const { return (xAOD::EgammaHelpers::isElectron(eg)); } diff --git a/Reconstruction/egamma/egammaTools/src/components/egammaTools_entries.cxx b/Reconstruction/egamma/egammaTools/src/components/egammaTools_entries.cxx index 8257ca927ea1e26ed493bf4577dcd1d7ab98d5d2..75f93c0b87d42b0a81add3ab75fa5c9fcb543eff 100755 --- a/Reconstruction/egamma/egammaTools/src/components/egammaTools_entries.cxx +++ b/Reconstruction/egamma/egammaTools/src/components/egammaTools_entries.cxx @@ -1,6 +1,5 @@ #include "GaudiKernel/DeclareFactoryEntries.h" -#include "../EMAmbiguityTool.h" #include "../EMBremCollectionBuilder.h" #include "../EMClusterTool.h" #include "../EMConversionBuilder.h" @@ -17,7 +16,6 @@ #include "../egammaSuperClusterBuilder.h" #include "../egammaClusterOverlapMarker.h" -DECLARE_TOOL_FACTORY ( EMAmbiguityTool ) DECLARE_TOOL_FACTORY ( EMBremCollectionBuilder ) DECLARE_TOOL_FACTORY ( EMClusterTool ) DECLARE_TOOL_FACTORY ( EMConversionBuilder ) @@ -35,7 +33,6 @@ DECLARE_TOOL_FACTORY ( egammaSuperClusterBuilder ) DECLARE_TOOL_FACTORY ( egammaClusterOverlapMarker ) DECLARE_FACTORY_ENTRIES(egammaTools) { - DECLARE_TOOL ( EMAmbiguityTool ) DECLARE_TOOL ( EMBremCollectionBuilder ) DECLARE_TOOL ( EMClusterTool ) DECLARE_TOOL ( EMConversionBuilder ) diff --git a/Reconstruction/egamma/egammaTools/src/egammaCheckEnergyDepositTool.cxx b/Reconstruction/egamma/egammaTools/src/egammaCheckEnergyDepositTool.cxx index 87717d03547b6f4bc2c8198b24fbef2dafea8842..125ebb257d4bef27a7ec8ae52d9851716dfeaa2e 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaCheckEnergyDepositTool.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaCheckEnergyDepositTool.cxx @@ -103,7 +103,6 @@ bool egammaCheckEnergyDepositTool::checkFractioninSamplingCluster(const xAOD::Ca double e1 = 0.; double e2 = 0.; double e3 = 0.; - double eallsamples = 0; if ( cluster->inBarrel() && !cluster->inEndcap() ){ e0 = cluster->eSample(CaloSampling::PreSamplerB); @@ -141,23 +140,25 @@ bool egammaCheckEnergyDepositTool::checkFractioninSamplingCluster(const xAOD::Ca } // sum of energy in all samplings - eallsamples = e0+e1+e2+e3; + const double eallsamples = e0+e1+e2+e3; if (eallsamples!=0.) { + const double inv_eallsamples = 1. / eallsamples; + // check fraction of energy reconstructed in presampler - double f0 = e0/eallsamples; + double f0 = e0 * inv_eallsamples; if (f0 > m_thrF0max) return false; // check fraction of energy reconstructed in first sampling - double f1 = e1/eallsamples; + double f1 = e1 * inv_eallsamples; if (f1 > m_thrF1max) return false; // check fraction of energy reconstructed in second sampling - double f2 = e2/eallsamples; + double f2 = e2 * inv_eallsamples; if (f2 > m_thrF2max) return false; // check fraction of energy reconstructed in third sampling - double f3 = e3/eallsamples; + double f3 = e3 * inv_eallsamples; if (f3 > m_thrF3max) return false; } diff --git a/Reconstruction/egamma/egammaTools/src/egammaClusterOverlapMarker.cxx b/Reconstruction/egamma/egammaTools/src/egammaClusterOverlapMarker.cxx index 2089af62973b49d68d66d20b268626760166eb02..465cf0dc30a8d0bcbb4c0d40b64b1682f4a71879 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaClusterOverlapMarker.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaClusterOverlapMarker.cxx @@ -37,7 +37,7 @@ egammaClusterOverlapMarker::egammaClusterOverlapMarker(const std::string& type, declareProperty("dEta", m_dEta = 0.05); - declareProperty("dEta", + declareProperty("dPhi", m_dPhi = 0.1); //Object containers. @@ -65,8 +65,7 @@ StatusCode egammaClusterOverlapMarker::finalize() { ////////////////////////////////////////////////////////////////////////////// StatusCode egammaClusterOverlapMarker::execute(const xAOD::CaloCluster *clus) - -{ + { xAOD::ElectronContainer *elecs = 0; const xAOD::CaloClusterContainer *tcClusters = 0; @@ -85,13 +84,8 @@ StatusCode egammaClusterOverlapMarker::execute(const xAOD::CaloCluster *clus) ATH_MSG_DEBUG("Retrieved cluster containers for overlap check!"); - float pi(4*atan(1)); - ElementLink<xAOD::ElectronContainer> nullLink; - // xAOD::ElectronContainer::iterator elIter = elecs->begin(); - // for (; elIter != elecs->end(); ++elIter) { - for (unsigned int elIndex(0); elIndex < elecs->size(); elIndex++) { xAOD::Electron *elIter = elecs->at(elIndex); @@ -101,7 +95,7 @@ StatusCode egammaClusterOverlapMarker::execute(const xAOD::CaloCluster *clus) //Need to get seed cluster info from electron. float dEta(fabs(seedClus->eta()-clus->eta())); - float dPhi(remainder(fabs(seedClus->phi()-clus->phi()),2*pi)); + float dPhi(remainder(fabs(seedClus->phi()-clus->phi()),2*M_PI)); ElementLink<xAOD::ElectronContainer> linkToEl(*elecs, elIndex); static SG::AuxElement::Decorator<ElementLink<xAOD::ElectronContainer> > overlapLink ("overlapLink"); diff --git a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx index 23b77cea0e41ccfa4db7a53a3314ecb70c6fe827..4e51acbf3d6ba178a31741861ea62ac57e3a9ceb 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaOQFlagsBuilder.cxx @@ -248,7 +248,7 @@ StatusCode egammaOQFlagsBuilder::execute(xAOD::Egamma* eg) bool foundCentralCell = egammaOQFlagsBuilder::findCentralCell(cluster); //=================== Set timing bit ===================================================// - const double absEnergyGeV = fabs(cluster->e()/GeV); + const double absEnergyGeV = fabs(cluster->e()*(1./GeV)); if(absEnergyGeV != 0 && fabs(cluster->time()) > m_TCut + m_TCutVsE/absEnergyGeV) { iflag |= ( 0x1 << xAOD::EgammaParameters::OutTime); } diff --git a/Reconstruction/egamma/egammaTools/src/egammaSuperClusterBuilder.cxx b/Reconstruction/egamma/egammaTools/src/egammaSuperClusterBuilder.cxx index 04127611a91b37827e964d4a42c050fbd1c388e5..e9c58f5492afecda31eba430c8f95fc61d874f5a 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaSuperClusterBuilder.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaSuperClusterBuilder.cxx @@ -492,9 +492,7 @@ void egammaSuperClusterBuilder::fillPositionsInCalo(xAOD::CaloCluster* cluster) ElementLink< xAOD::TrackParticleContainer > egammaSuperClusterBuilder::GetTrackParticleLink(const xAOD::TrackParticleContainer* tracks, const xAOD::TrackParticle* track) { - - int nTrk(-1); - + int nTrk(-1); for (const auto& egTrack : *tracks) { nTrk++; if (egTrack->perigeeParameters().position().perp() == track->perigeeParameters().position().perp()) { diff --git a/Reconstruction/egamma/egammaTools/src/egammaTopoClusterMap.cxx b/Reconstruction/egamma/egammaTools/src/egammaTopoClusterMap.cxx index f2c00511b8e640b2164abb1ba8e91bb5a7ec0053..874da495e0b7d37890270b3bbb0cd11edd606129 100644 --- a/Reconstruction/egamma/egammaTools/src/egammaTopoClusterMap.cxx +++ b/Reconstruction/egamma/egammaTools/src/egammaTopoClusterMap.cxx @@ -225,10 +225,10 @@ std::vector<const xAOD::CaloCluster*> egammaTopoClusterMap::RetrieveTopoClusters double Pt) { - if ((Pt / 1000.) < 15) { + if ((Pt * 1e-3) < 15) { return RetrieveTopoClusters(eta, phi, 0.2, 0.2); } - else if ((Pt/1000.) < 50) { + else if ((Pt * 1e-3) < 50) { return RetrieveTopoClusters(eta, phi, 0.2, 0.4); } else {