36 #include <Math/Point3D.h> 42 using namespace reco ;
46 : cacheIDGeom(0), cacheIDTopo(0), cacheIDTDGeom(0), cacheIDMagField(0),
53 if ((!originalCtfTrackCollectionRetreived)&&(ctfTrack.
isNonnull()))
55 event->get(ctfTrack.
id(),originalCtfTracks) ;
56 originalCtfTrackCollectionRetreived =
true ;
58 if ((!originalGsfTrackCollectionRetreived)&&(gsfTrack.
isNonnull()))
60 event->get(gsfTrack.
id(),originalGsfTracks) ;
61 originalGsfTrackCollectionRetreived =
true ;
70 gsfTrackRef(coreRef->gsfTrack()),
71 superClusterRef(coreRef->superCluster()),
72 ctfTrackRef(coreRef->ctfTrack()), shFracInnerHits(coreRef->ctfGsfOverlap()),
92 int chargeGsf = gsfTrackRef->charge() ;
94 info.
isGsfCtfConsistent = (ctfTrackRef.isNonnull()&&((chargeGsf*ctfTrackRef->charge())>0)) ;
101 { charge = ctfTrackRef->charge() ; }
109 float dphimin = 1.e30 ;
110 for(
auto const& bc : superClusterRef->clusters())
112 GlobalPoint posclu(bc->position().x(),bc->position().y(),bc->position().z()) ;
114 if (!tempTSOS.isValid()) tempTSOS=outTSOS ;
132 if (!innTSOS.isValid())
return false;
139 if (!vtxTSOS.isValid()) vtxTSOS=innTSOS;
143 if (!outTSOS.isValid())
return false;
147 GlobalPoint(superClusterRef->seed()->position().x(),
148 superClusterRef->seed()->position().y(),
149 superClusterRef->seed()->position().z()));
150 if (!seedTSOS.isValid()) seedTSOS=outTSOS;
154 if (!sclTSOS.isValid()) sclTSOS=outTSOS;
181 double scale = superClusterRef->energy()/vtxMom.mag() ;
184 superClusterRef->energy() ) ;
200 int nSaturatedXtals = 0;
201 bool isSeedSaturated =
false;
202 for (
auto&& hitFractionPair : theClus->hitsAndFractions()) {
205 if (
ecalRecHit->checkFlag(EcalRecHit::Flags::kSaturated)) {
208 isSeedSaturated =
true;
216 template<
bool full5x5>
233 std::vector<int> recHitFlagsToBeExcluded ;
234 std::vector<int> recHitSeverityToBeExcluded ;
248 std::vector<float> covariances = ClusterTools::covariances(seedCluster,recHits,topology,geometry) ;
249 std::vector<float> localCovariances = ClusterTools::localCovariances(seedCluster,recHits,topology) ;
254 showerShape.
e2x5Max = ClusterTools::e2x5Max(seedCluster,recHits,topology) ;
256 showerShape.
r9 = ClusterTools::e3x3(seedCluster,recHits,topology)/theClus->rawEnergy() ;
258 const float scale = full5x5 ? showerShape.
e5x5 : theClus->energy();
271 if( see_by_spp > 0 ) {
272 showerShape.
sigmaIetaIphi = localCovariances[1] / see_by_spp;
273 }
else if ( localCovariances[1] > 0 ) {
279 showerShape.
e2nd = ClusterTools::e2nd(seedCluster,recHits);
280 showerShape.
eTop = ClusterTools::eTop(seedCluster,recHits,topology);
281 showerShape.
eLeft = ClusterTools::eLeft(seedCluster,recHits,topology);
282 showerShape.
eRight = ClusterTools::eRight(seedCluster,recHits,topology);
283 showerShape.
eBottom = ClusterTools::eBottom(seedCluster,recHits,topology);
285 showerShape.
e2x5Left = ClusterTools::e2x5Left(seedCluster,recHits,topology);
286 showerShape.
e2x5Right = ClusterTools::e2x5Right(seedCluster,recHits,topology);
287 showerShape.
e2x5Top = ClusterTools::e2x5Top(seedCluster,recHits,topology);
288 showerShape.
e2x5Bottom = ClusterTools::e2x5Bottom(seedCluster,recHits,topology);
314 :
generalData_{inputCfg,strategyCfg,cutsCfg,cutsCfgPflow,isoCfg,recHitsCfg,hcalCfg,hcalCfgPflow,superClusterErrorFunction,crackCorrectionFunction,regCfg},
336 if ( updateField || updateGeometry ) {
378 float egHcalIsoConeSizeOutSmall=0.3, egHcalIsoConeSizeOutLarge=0.4;
380 int egHcalDepth1=1, egHcalDepth2=2;
402 .hadDepth1Isolation03 =
EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,&towers),
403 .hadDepth1Isolation04 =
EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth1,&towers),
404 .hadDepth2Isolation03 =
EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,&towers),
405 .hadDepth2Isolation04 =
EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,egHcalIsoConeSizeIn,egHcalIsoPtMin,egHcalDepth2,&towers),
406 .hadDepth1Isolation03Bc =
EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth1,&towers),
407 .hadDepth1Isolation04Bc =
EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth1,&towers),
408 .hadDepth2Isolation03Bc =
EgammaTowerIsolation(egHcalIsoConeSizeOutSmall,0.,egHcalIsoPtMin,egHcalDepth2,&towers),
409 .hadDepth2Isolation04Bc =
EgammaTowerIsolation(egHcalIsoConeSizeOutLarge,0.,egHcalIsoPtMin,egHcalDepth2,&towers),
446 for (
unsigned int i=0 ;
i<coreCollection->size() ; ++
i )
450 bool coreFound =
false ;
451 for(
auto const& ele : electrons)
453 if (ele.core()==coreRef)
459 if (coreFound) continue ;
462 if (coreRef->superCluster().
isNull())
continue ;
465 ElectronData electronData(coreRef,*eventData.beamspot) ;
483 bool eg = ele.
core()->ecalDrivenSeed() ;
484 bool pf = ele.
core()->trackerDrivenSeed() && !ele.
core()->ecalDrivenSeed() ;
486 if (eg&&pf) {
throw cms::Exception(
"GsfElectronAlgo|BothEcalAndPureTrackerDriven")<<
"An electron cannot be both egamma and purely pflow" ; }
487 if ((!eg)&&(!pf)) {
throw cms::Exception(
"GsfElectronAlgo|NeitherEcalNorPureTrackerDriven")<<
"An electron cannot be neither egamma nor purely pflow" ; }
493 double etValue = ele.
superCluster()->energy()/cosh(etaValue) ;
494 LogTrace(
"GsfElectronAlgo") <<
"Et : " << etValue ;
497 LogTrace(
"GsfElectronAlgo") <<
"Et criteria are satisfied";
501 LogTrace(
"GsfElectronAlgo") <<
"E/p : " << eopValue ;
506 LogTrace(
"GsfElectronAlgo") <<
"E/p criteria are satisfied";
514 bool HoEveto =
false ;
525 LogTrace(
"GsfElectronAlgo") <<
"H/E criteria are satisfied";
529 LogTrace(
"GsfElectronAlgo") <<
"delta eta : " << deta ;
532 LogTrace(
"GsfElectronAlgo") <<
"Delta eta criteria are satisfied";
536 LogTrace(
"GsfElectronAlgo") <<
"delta phi : " << dphi;
539 LogTrace(
"GsfElectronAlgo") <<
"Delta phi criteria are satisfied";
545 LogTrace(
"GsfElectronAlgo") <<
"Sigma ieta ieta criteria are satisfied";
551 LogTrace(
"GsfElectronAlgo") <<
"Fiducial flags criteria are satisfied";
559 {
throw cms::Exception(
"GsfElectronAlgo|NotElectronSeed")<<
"The GsfTrack seed is not an ElectronSeed ?!" ; }
561 {
if (elseed->subDet2()==6)
return ; }
566 LogTrace(
"GsfElectronAlgo") <<
"TIP criterion is satisfied" ;
568 LogTrace(
"GsfElectronAlgo") <<
"All cut based criteria are satisfied" ;
658 int region = seedXtalId.
det();
696 {
throw cms::Exception(
"GsfElectronAlgo|UnknownXtalRegion")<<
"createElectron(): do not know if it is a barrel or endcap seed cluster !!!!" ; }
713 const bool pflow = !(electronData.
coreRef->ecalDrivenSeed());
715 calculateShowerShape<false>(electronData.
superClusterRef,hcalHelper,showerShape,eventData) ;
716 calculateShowerShape<true>(electronData.
superClusterRef,hcalHelper,full5x5_showerShape,eventData) ;
739 conversionVars.
flags = conversionInfo.
flag ;
740 conversionVars.
dist = conversionInfo.
dist ;
741 conversionVars.
dcot = conversionInfo.
dcot ;
755 if ((conversionVars.
flags==0)
or(conversionVars.
flags==1))
757 else if ((conversionVars.
flags==2)
or(conversionVars.
flags==3))
765 electrons.emplace_back( eleCharge,eleChargeInfo,electronData.
coreRef,
766 tcMatching, tkExtra, ctfInfo,
767 fiducialFlags,showerShape, full5x5_showerShape,
768 conversionVars, saturationInfo ) ;
769 auto & ele = electrons.back();
772 ele.setP4(GsfElectron::P4_FROM_SUPER_CLUSTER,momentum,0,
true) ;
787 if (sc->clustersSize()>1)
789 float pf_fbrem =( sc->energy() - cl->
energy() ) / sc->energy();
790 ele.setSuperClusterFbrem( pf_fbrem ) ;
794 ele.setSuperClusterFbrem(0) ;
817 if (ele.core()->ecalDrivenSeed())
834 if (ele.core()->ecalDrivenSeed())
868 ele.setIsolation03(dr03);
869 ele.setIsolation04(dr04);
889 LogTrace(
"GsfElectronAlgo")<<
"Constructed new electron with energy "<< ele.p4().e() ;
907 sd1 = elseed->subDet1() ;
908 sd2 = elseed->subDet2() ;
909 dPhi1 = (ele.
charge()>0) ? elseed->dPhi1Pos() : elseed->dPhi1() ;
910 dPhi2 = (ele.
charge()>0) ? elseed->dPhi2Pos() : elseed->dPhi2() ;
911 dRz1 = (ele.
charge()>0) ? elseed->dRz1Pos () : elseed->dRz1 () ;
912 dRz2 = (ele.
charge()>0) ? elseed->dRz2Pos () : elseed->dRz2 () ;
TrajectoryStateOnSurface constrainAtBeamSpot(const reco::GsfTrack &, const reco::BeamSpot &) const
(multi)TSOS after including the beamspot
edm::Handle< reco::TrackCollection > originalCtfTracks
GsfTrackRef gsfTrack() const override
reference to a GsfTrack
EgammaRecHitIsolation ecalEndcapIsol04
EgammaRecHitIsolation ecalBarrelIsol03
unsigned long long cacheIdentifier() const
const math::XYZPoint & position() const
cluster centroid position
void applyCombinationRegression(reco::GsfElectron &ele) const
std::unique_ptr< const SoftElectronMVAEstimator > sElectronMVAEstimator
const CutsConfiguration cutsCfgPflow
static bool isNextToEtaBoundary(EBDetId id)
EgammaRecHitIsolation ecalEndcapIsol03
void setPassCutBasedPreselection(bool flag)
bool isNonnull() const
Checks for non-null.
double intRadiusEcalEndcaps
unsigned long long cacheIDGeom
void calculateSaturationInfo(const reco::SuperClusterRef &, reco::GsfElectron::SaturationInfo &, EventData const &eventData)
std::vector< int > recHitSeverityToBeExcludedEndcaps
void setPixelMatchDRz2(float dRz2)
EgammaTowerIsolation hadDepth1Isolation03
void readEvent(const edm::Event &)
EgammaTowerIsolation hadDepth2Isolation03
float eSuperClusterOverP() const
std::unique_ptr< const MultiTrajectoryStateTransform > mtsTransform
RegressionHelper regHelper
CaloTopology const * topology(0)
void retreiveOriginalTrackCollections(const reco::TrackRef &, const reco::GsfTrackRef &)
void setPixelMatchDPhi1(float dPhi1)
void createElectron(reco::GsfElectronCollection &electrons, ElectronData &electronData, EventData &eventData, const gsfAlgoHelpers::HeavyObjectCache *)
bool ecalDrivenEcalErrorFromClassBasedParameterization
float hcalDepth2OverEcal() const
constexpr bool isNotFinite(T x)
double getEtSum(const reco::Candidate *emObject) const
const IsolationConfiguration isoCfg
double intRadiusEcalBarrel
constexpr T normalizedPhi(T phi)
unsigned long long cacheIDTopo
bool useCombinationRegression
double maxSigmaIetaIetaEndcaps
const EcalRecHitsConfiguration recHitsCfg
Global3DPoint GlobalPoint
EgammaTowerIsolation hadDepth1Isolation04Bc
edm::Handle< EcalRecHitCollection > endcapRecHits
double maxHOverEEndcapsTower
EgammaTowerIsolation hadDepth1Isolation03Bc
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
int charge() const final
electric charge
double maxDeltaEtaEndcaps
void checkSetup(const edm::EventSetup &)
float deltaEtaSuperClusterAtVtx
float deltaPhiSuperClusterAtVtx
void computeCharge(int &charge, reco::GsfElectron::ChargeInfo &info)
float hcalDepth1TowerSumEt
const InputTagsConfiguration inputCfg
edm::ESHandle< EcalSeverityLevelAlgo > sevLevel
void calculateShowerShape(const reco::SuperClusterRef &, ElectronHcalHelper const &hcalHelper, reco::GsfElectron::ShowerShape &, EventData const &eventData)
float hcalDepth1TowerSumEtBc
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
double hcalESumDepth1(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
const StrategyConfiguration strategyCfg
ProductID id() const
Accessor for product ID.
const reco::TrackRef conversionPartnerCtfTk
void setPixelMatchSubdetectors(int sd1, int sd2)
edm::ESHandle< CaloTopology > caloTopo
CaloClusterPtr electronCluster
double maxHOverEBarrelTower
void completeElectrons(reco::GsfElectronCollection &electrons, edm::Event const &event, edm::EventSetup const &eventSetup, const gsfAlgoHelpers::HeavyObjectCache *hoc)
bool isGsfCtfScPixConsistent
EventSetupData eventSetupData_
virtual float getValue(const reco::BasicCluster &, const EcalRecHitCollection &) const =0
EleTkIsolFromCands tkIsolHEEP03Calc_
void setUseNumCrystals(bool b=true)
float deltaEtaSuperClusterTrackAtVtx() const
std::vector< int > recHitSeverityToBeExcludedBarrel
float sigmaIetaIeta() const
double maxHOverEBarrelCone
EgammaTowerIsolation hadDepth1Isolation04
float eSeedClusterOverPout
void simpleParameterizationUncertainty(reco::GsfElectron &)
unsigned long long cacheSevLevel
edm::RefToBase< reco::Track > TrackBaseRef
persistent reference to a Track, using views
void checkSetup(edm::EventSetup const &eventSetup)
bool positionFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalPoint &position)
static bool isNextToPhiBoundary(EBDetId id)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
edm::Handle< EcalRecHitCollection > barrelRecHits
float deltaPhiSuperClusterTrackAtVtx() const
std::vector< GsfElectronCore > GsfElectronCoreCollection
const double radiusOfConversion
void correct(reco::GsfElectron &, TrajectoryStateOnSurface &)
float hcalOverEcal() const
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool pureTrackerDrivenEcalErrorFromSimpleParameterization
Abs< T >::type abs(const T &t)
std::vector< CaloTowerDetId > hcalTowersBehindClusters
float deltaEtaSeedClusterAtCalo
static bool isNextToRingBoundary(EEDetId id)
double energy() const
cluster energy
const CutsConfiguration cutsCfg
double calIsolPt(Args &&...args) const
const reco::BeamSpot * beamspot
edm::ESHandle< MagneticField > magField
EgammaTowerIsolation hadDepth2Isolation04Bc
std::unique_ptr< GsfConstraintAtVertex > constraintAtVtx
edm::Handle< reco::ConversionCollection > conversions
static bool isNextToDBoundary(EEDetId id)
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger but the state exists so we define the behavior If all triggers are the negative crieriion will lead to accepting the event(this again matches the behavior of"!*"before the partial wildcard feature was incorporated).The per-event"cost"of each negative criterion with multiple relevant triggers is about the same as!*was in the past
double maxDeltaPhiEndcaps
float hcalOverEcalBc() const
std::vector< int > recHitFlagsToBeExcludedBarrel
bool isNull() const
Checks for null.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
unsigned long long cacheIDMagField
void classify(reco::GsfElectron &)
ElectronHcalHelper hcalHelperPflow
const_iterator end() const
unsigned long long cacheIDTDGeom
float hcalDepth2TowerSumEtBc
GsfElectronAlgo(const InputTagsConfiguration &, const StrategyConfiguration &, const CutsConfiguration &cutsCfg, const CutsConfiguration &cutsCfgPflow, const ElectronHcalHelper::Configuration &hcalCfg, const ElectronHcalHelper::Configuration &hcalCfgPflow, const IsolationConfiguration &, const EcalRecHitsConfiguration &, EcalClusterFunctionBaseClass *superClusterErrorFunction, EcalClusterFunctionBaseClass *crackCorrectionFunction, const RegressionHelper::Configuration ®Cfg, const edm::ParameterSet &tkIsol03Cfg, const edm::ParameterSet &tkIsol04Cfg, const edm::ParameterSet &tkIsolHEEP03Cfg, const edm::ParameterSet &tkIsolHEEP04Cfg)
const reco::GsfTrackRef conversionPartnerGsfTk
float hcalDepth1OverEcal() const
bool calculateTSOS(MultiTrajectoryStateTransform const &, GsfConstraintAtVertex const &)
void setPixelMatchDPhi2(float dPhi2)
reco::CaloClusterPtr getEleBasicCluster(MultiTrajectoryStateTransform const &)
void classBasedParameterizationEnergy(reco::GsfElectron &, const reco::BeamSpot &bs)
edm::Handle< reco::VertexCollection > vertices
reco::TrackRef ctfTrackRef
EgammaRecHitIsolation ecalBarrelIsol04
void setPixelMatchInfomation(reco::GsfElectron &)
DetId seed() const
return DetId of seed
bool isGsfScPixConsistent
double hcalESumDepth2(const reco::SuperCluster &, const std::vector< CaloTowerDetId > *excludeTowers=0) const
std::vector< int > recHitFlagsToBeExcludedEndcaps
float hcalDepth2TowerSumEt
bool hasActiveHcal(const reco::SuperCluster &sc) const
EcalClusterFunctionBaseClass * superClusterErrorFunction
bool isNull() const
Checks for null.
double maxSigmaIetaIetaBarrel
const reco::GsfTrackRef gsfTrackRef
EgammaTowerIsolation hadDepth2Isolation03Bc
bool ecalDrivenEcalEnergyFromClassBasedParameterization
void ele_convert(const Type1 &obj1, Type2 &obj2)
float hcalDepth2OverEcalBc
math::XYZTLorentzVector LorentzVector
Lorentz vector.
virtual GsfElectronCoreRef core() const
double hcalESumDepth2BehindClusters(const std::vector< CaloTowerDetId > &towers) const
float deltaEtaEleClusterAtCalo
float hcalDepth1OverEcalBc
void refineWithPflow(reco::GsfElectron &)
iterator find(key_type k)
edm::Handle< reco::GsfTrackCollection > originalGsfTracks
void applyEcalRegression(reco::GsfElectron &electron, const edm::Handle< reco::VertexCollection > &vertices, const edm::Handle< EcalRecHitCollection > &rechitsEB, const edm::Handle< EcalRecHitCollection > &rechitsEE) const
float eEleClusterOverPout
const reco::GsfElectronCoreRef coreRef
std::vector< CaloTowerDetId > hcalTowersBehindClusters(const reco::SuperCluster &sc) const
float deltaPhiEleClusterAtCalo
edm::Handle< reco::TrackCollection > currentCtfTracks
EleTkIsolFromCands tkIsol04Calc_
double getTowerEtSum(const reco::Candidate *cand, const std::vector< CaloTowerDetId > *detIdToExclude=0) const
edm::ESHandle< CaloGeometry > caloGeom
EcalClusterFunctionBaseClass * crackCorrectionFunction
SuperClusterRef superCluster() const override
reference to a SuperCluster
const reco::SuperClusterRef superClusterRef
float deltaPhiSeedClusterAtCalo
const Point & position() const
position
double maxHOverEEndcapsCone
ElectronData(const reco::GsfElectronCoreRef &core, const reco::BeamSpot &bs)
ElectronHcalHelper hcalHelper
bool momentumFromModeCartesian(TrajectoryStateOnSurface const &tsos, GlobalVector &momentum)
edm::ESHandle< TrackerGeometry > trackerHandle
EleTkIsolFromCands tkIsolHEEP04Calc_
EventData beginEvent(edm::Event const &event)
virtual void init(const edm::EventSetup &es)=0
EleTkIsolFromCands tkIsol03Calc_
GlobalVector vtxMomWithConstraint
int ietaAbs() const
get the absolute value of the crystal ieta
void classBasedParameterizationUncertainty(reco::GsfElectron &)
T const * product() const
EgammaTowerIsolation hadDepth2Isolation04
void checkSetup(const edm::EventSetup &)
void setPixelMatchDRz1(float dRz1)
void setCutBasedPreselectionFlag(reco::GsfElectron &ele, const reco::BeamSpot &)
double hcalESumDepth1BehindClusters(const std::vector< CaloTowerDetId > &towers) const
math::PtEtaPhiELorentzVectorF LorentzVector
Global3DVector GlobalVector
TrajectoryStateOnSurface vtxTSOS
constexpr Detector det() const
get the detector field from this detid
reco::Candidate::LorentzVector calculateMomentum()