52 std::vector<const reco::PFCluster*>&,
57 unsigned plane)
const;
132 std::map<reco::GsfTrackRef, reco::SuperClusterRef>
scMap_;
157 desc.add<
bool>(
"CheckStatusFlag",
true);
158 desc.add<
bool>(
"useIsolationValues",
false);
167 desc.add<
bool>(
"emptyIsOk",
false);
177 bool useIsolationValues = iConfig.
getParameter<
bool>(
"useIsolationValues");
178 if (useIsolationValues) {
181 throw cms::Exception(
"PFElectronTranslator|InternalError") <<
"Missing ParameterSet isolationValues";
213 produces<edm::ValueMap<reco::SuperClusterRef>>(
PFSCValueMap_);
221 auto gsfElectronCores_p = std::make_unique<reco::GsfElectronCoreCollection>();
223 auto gsfElectrons_p = std::make_unique<reco::GsfElectronCollection>();
225 auto superClusters_p = std::make_unique<reco::SuperClusterCollection>();
227 auto basicClusters_p = std::make_unique<reco::BasicClusterCollection>();
229 auto psClusters_p = std::make_unique<reco::PreshowerClusterCollection>();
231 auto mvaMap_p = std::make_unique<edm::ValueMap<float>>();
234 auto scMap_p = std::make_unique<edm::ValueMap<reco::SuperClusterRef>>();
267 for (
unsigned i = 0;
i < ncand; ++
i) {
271 if (
cand.gsfTrackRef().isNull())
292 pfClusters_.push_back(std::vector<const reco::PFCluster*>());
296 for (
unsigned iele = 0; iele <
cand.elementsInBlocks().size(); ++iele) {
300 unsigned elementIndex =
cand.elementsInBlocks()[iele].second;
392 std::ostringstream
err;
393 err <<
" cannot get PFCandidates " << std::endl;
405 std::ostringstream
err;
406 err <<
" cannot get GSFTracks " << std::endl;
417 std::vector<const reco::PFCluster*>& pfClusters,
420 if (myPFClusterRef.
isNull())
424 pfClusters.push_back(&myPFCluster);
436 myPFCluster.
seed()));
441 unsigned plane)
const {
444 myPFClusterRef->energy(), myPFClusterRef->position(), myPFClusterRef->hitsAndFractions(), plane));
450 unsigned basicClusterCounter = 0;
453 for (
unsigned iGSF = 0; iGSF <
size; ++iGSF)
456 for (
unsigned ibc = 0; ibc < nbc; ++ibc)
461 ++basicClusterCounter;
469 unsigned psClusterCounter = 0;
472 for (
unsigned iGSF = 0; iGSF <
size; ++iGSF)
475 for (
unsigned ibc = 0; ibc < nbc; ++ibc)
489 for (
unsigned iGSF = 0; iGSF <
size; ++iGSF)
502 for (
unsigned i = 0;
i < ncand; ++
i) {
506 if (
cand.gsfTrackRef().isNull())
515 std::vector<float>
values;
516 for (
unsigned igsf = 0; igsf < ngsf; ++igsf) {
518 std::map<reco::GsfTrackRef, float>::const_iterator itcheck =
gsfMvaMap_.find(theTrackRef);
525 values.push_back(itcheck->second);
536 std::vector<reco::SuperClusterRef>
values;
537 for (
unsigned igsf = 0; igsf < ngsf; ++igsf) {
539 std::map<reco::GsfTrackRef, reco::SuperClusterRef>::const_iterator itcheck =
scMap_.find(theTrackRef);
540 if (itcheck ==
scMap_.end()) {
544 values.push_back(itcheck->second);
553 for (
unsigned iGSF = 0; iGSF < nGSF; ++iGSF) {
555 double sclusterE = 0;
561 for (
unsigned ibc = 0; ibc < nbasics; ++ibc) {
573 edm::LogError(
"PFElectronTranslator") <<
" Major problem in PFElectron Translator" << std::endl;
597 for (
unsigned ibc = 0; ibc < nbasics; ++ibc) {
600 const std::vector<std::pair<DetId, float>>& v1 =
basicClusters_[iGSF][ibc].hitsAndFractions();
602 for (
std::vector<std::pair<DetId, float>>::const_iterator diIt = v1.begin(); diIt != v1.end(); ++diIt) {
609 for (
unsigned ips = 0; ips < nps; ++ips) {
628 unsigned refindex = pfbe.
index();
633 for (; myDaughterCandidate != itend; ++myDaughterCandidate) {
641 return *myPFCandidate;
649 for (
unsigned iGSF = 0; iGSF < nGSF; ++iGSF) {
652 std::map<reco::GsfTrackRef, reco::SuperClusterRef>::const_iterator itcheck =
scMap_.find(
GsfTrackRef_[iGSF]);
653 if (itcheck !=
scMap_.end())
655 gsfElectronCores.push_back(myElectronCore);
663 for (
unsigned iGSF = 0; iGSF <
size; ++iGSF)
671 std::vector<reco::GsfTrackRef>&
tracks)
const {
673 if (GsfEl ==
nullptr)
675 const std::vector<reco::GsfPFRecTrackRef>& ambPFRecTracks(GsfEl->
GsftrackRefPF()->convBremGsfPFRecTrackRef());
676 unsigned ntracks = ambPFRecTracks.size();
678 tracks.push_back(ambPFRecTracks[
it]->gsfTrackRef());
687 for (
unsigned iGSF = 0; iGSF <
size; ++iGSF)
733 gsfelectrons.push_back(myElectron);
const math::XYZPoint & position() const
cluster centroid position
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::string PFPreshowerClusterCollection_
Abstract base class for a PFBlock element (track, cluster...)
void setCtfTrack(const TrackRef &closestCtfTrack, float ctfGsfOverlap)
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
void fetchGsfCollection(edm::Handle< reco::GsfTrackCollection > &c, const edm::EDGetTokenT< reco::GsfTrackCollection > &token, const edm::Event &iEvent) const
void setP4(P4Kind kind, const LorentzVector &p4, float p4Error, bool setCandidate)
T getParameter(std::string const &) const
void MustacheID(const CaloClusterPtrVector &clusters, int &nclusters, float &EoutsideMustache)
std::string PFMVAValueMap_
const std::vector< std::pair< DetId, float > > & hitsAndFractions() const
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
void addHitAndFraction(DetId id, float fraction)
AlgoId algo() const
algorithm identifier
bool fetchCandidateCollection(edm::Handle< reco::PFCandidateCollection > &c, const edm::EDGetTokenT< reco::PFCandidateCollection > &token, const edm::Event &iEvent) const
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
edm::EDGetTokenT< reco::GsfTrackCollection > inputTokenGSFTracks_
void produce(edm::Event &, const edm::EventSetup &) override
double pflowPhiWidth() const
void createGsfElectronCoreRefs(const edm::OrphanHandle< reco::GsfElectronCoreCollection > &gsfElectronCoreHandle)
DetId seed() const
return DetId of seed
double rawEnergy() const
raw uncorrected energy (sum of energies of component BasicClusters)
std::vector< reco::CaloClusterPtrVector > basicClusterPtr_
void getAmbiguousGsfTracks(const reco::PFBlockElement &PFBE, std::vector< reco::GsfTrackRef > &) const
std::vector< reco::GsfElectronCoreRef > gsfElectronCoreRefs_
void setMvaInput(const MvaInput &mi)
void createBasicClusterPtrs(const edm::OrphanHandle< reco::BasicClusterCollection > &basicClustersHandle)
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
double pflowEtaWidth() const
~PFElectronTranslator() override
void createGsfElectronCores(reco::GsfElectronCoreCollection &) const
void setSeed(const CaloClusterPtr &r)
list of used xtals by DetId // now inherited by CaloCluster
std::string GsfElectronCollection_
Log< level::Error, false > LogError
std::vector< std::vector< const reco::PFCluster * > > pfClusters_
void createSuperClusters(const reco::PFCandidateCollection &, reco::SuperClusterCollection &superClusters) const
void setPfIsolationVariables(const PflowIsolationVariables &iso)
void setPhiWidth(double pw)
const CaloID & caloID() const
void setMvaOutput(const MvaOutput &mo)
std::vector< GsfElectron > GsfElectronCollection
collection of GsfElectron objects
std::map< reco::GsfTrackRef, float > gsfMvaMap_
edm::ESGetToken< EcalMustacheSCParameters, EcalMustacheSCParametersRcd > ecalMustacheSCParametersToken_
const LorentzVector & p4() const final
four-momentum Lorentz vector
edm::EDGetTokenT< reco::PFCandidateCollection > inputTokenPFCandidateElectrons_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > inputTokenIsoVals_
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
void setEtaWidth(double ew)
std::vector< reco::GsfTrackRef > GsfTrackRef_
void fillMVAValueMap(edm::Event &iEvent, edm::ValueMap< float >::Filler &filler)
const ElementsInBlocks & elementsInBlocks() const
void setParentSuperCluster(const SuperClusterRef &scl)
std::vector< SuperCluster > SuperClusterCollection
collection of SuperCluser objectr
void createBasicCluster(const reco::PFBlockElement &, reco::BasicClusterCollection &basicClusters, std::vector< const reco::PFCluster *> &, const reco::PFCandidate &coCandidate) const
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
std::vector< GsfElectronCore > GsfElectronCoreCollection
std::vector< reco::PreshowerClusterCollection > preshowerClusters_
void createSuperClusterGsfMapRefs(const edm::OrphanHandle< reco::SuperClusterCollection > &superClustersHandle)
virtual const PFClusterRef & clusterRef() const
std::vector< PreshowerCluster > PreshowerClusterCollection
collection of PreshowerCluster objects
#define DEFINE_FWK_MODULE(type)
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
void fillSCRefValueMap(edm::Event &iEvent, edm::ValueMap< reco::SuperClusterRef >::Filler &filler) const
void fillValueMap(edm::Event &iEvent, edm::ValueMap< float >::Filler &filler) const
std::vector< int > gsfPFCandidateIndex_
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
bool isNull() const
Checks for null.
std::vector< reco::CandidatePtr > CandidatePtr_
std::vector< std::vector< reco::GsfTrackRef > > ambiguousGsfTracks_
const EcalMustacheSCParameters * mustacheSCParams_
std::vector< reco::PFCandidate > PFCandidateCollection
collection of PFCandidates
std::string PFBasicClusterCollection_
std::vector< reco::SuperClusterCollection > superClusters_
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< reco::CaloClusterPtrVector > preshowerClusterPtr_
void addPreshowerCluster(const CaloClusterPtr &r)
add reference to constituent BasicCluster
std::string GsfElectronCoreCollection_
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
const reco::PFCandidate & correspondingDaughterCandidate(const reco::PFCandidate &cand, const reco::PFBlockElement &pfbe) const
void addCluster(const CaloClusterPtr &r)
add reference to constituent BasicCluster
std::vector< reco::BasicClusterCollection > basicClusters_
virtual SuperClusterRef parentSuperCluster() const
Particle reconstructed by the particle flow algorithm.
std::vector< reco::TrackRef > kfTrackRef_
PFElectronTranslator(const edm::ParameterSet &)
const GsfPFRecTrackRef & GsftrackRefPF() const
reco::PFCandidateElectronExtraRef electronExtraRef() const
return a reference to the electron extra
std::string PFSCValueMap_
std::string PFSuperClusterCollection_
double rawEcalEnergy() const
return corrected Ecal energy
edm::EDGetTokenT< reco::PFCandidateCollection > inputTokenPFCandidates_
void createPreshowerCluster(const reco::PFBlockElement &PFBE, reco::PreshowerClusterCollection &preshowerClusters, unsigned plane) const
void createGsfElectrons(const reco::PFCandidateCollection &, const IsolationValueMaps &isolationValues, reco::GsfElectronCollection &)
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
void addAmbiguousGsfTrack(const reco::GsfTrackRef &t)
void createPreshowerClusterPtrs(const edm::OrphanHandle< reco::PreshowerClusterCollection > &preshowerClustersHandle)
double deltaP() const
uncertainty on 3-momentum
float mva_e_pi() const
mva for electron-pion discrimination
void setPreshowerEnergy(double preshowerEnergy)