CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
PFElectronTranslator Class Reference
Inheritance diagram for PFElectronTranslator:
edm::stream::EDProducer<>

Public Types

typedef std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
 
- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Public Member Functions

 PFElectronTranslator (const edm::ParameterSet &)
 
void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFElectronTranslator () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Member Functions

const reco::PFCandidatecorrespondingDaughterCandidate (const reco::PFCandidate &cand, const reco::PFBlockElement &pfbe) const
 
void createBasicCluster (const reco::PFBlockElement &, reco::BasicClusterCollection &basicClusters, std::vector< const reco::PFCluster *> &, const reco::PFCandidate &coCandidate) const
 
void createBasicClusterPtrs (const edm::OrphanHandle< reco::BasicClusterCollection > &basicClustersHandle)
 
void createGsfElectronCoreRefs (const edm::OrphanHandle< reco::GsfElectronCoreCollection > &gsfElectronCoreHandle)
 
void createGsfElectronCores (reco::GsfElectronCoreCollection &) const
 
void createGsfElectrons (const reco::PFCandidateCollection &, const IsolationValueMaps &isolationValues, reco::GsfElectronCollection &)
 
void createPreshowerCluster (const reco::PFBlockElement &PFBE, reco::PreshowerClusterCollection &preshowerClusters, unsigned plane) const
 
void createPreshowerClusterPtrs (const edm::OrphanHandle< reco::PreshowerClusterCollection > &preshowerClustersHandle)
 
void createSuperClusterGsfMapRefs (const edm::OrphanHandle< reco::SuperClusterCollection > &superClustersHandle)
 
void createSuperClusters (const reco::PFCandidateCollection &, reco::SuperClusterCollection &superClusters) const
 
bool fetchCandidateCollection (edm::Handle< reco::PFCandidateCollection > &c, const edm::EDGetTokenT< reco::PFCandidateCollection > &token, const edm::Event &iEvent) const
 
void fetchGsfCollection (edm::Handle< reco::GsfTrackCollection > &c, const edm::EDGetTokenT< reco::GsfTrackCollection > &token, const edm::Event &iEvent) const
 
void fillMVAValueMap (edm::Event &iEvent, edm::ValueMap< float >::Filler &filler)
 
void fillSCRefValueMap (edm::Event &iEvent, edm::ValueMap< reco::SuperClusterRef >::Filler &filler) const
 
void fillValueMap (edm::Event &iEvent, edm::ValueMap< float >::Filler &filler) const
 
void getAmbiguousGsfTracks (const reco::PFBlockElement &PFBE, std::vector< reco::GsfTrackRef > &) const
 

Private Attributes

std::vector< std::vector< reco::GsfTrackRef > > ambiguousGsfTracks_
 
std::vector< reco::CaloClusterPtrVectorbasicClusterPtr_
 
std::vector< reco::BasicClusterCollectionbasicClusters_
 
std::vector< reco::CandidatePtrCandidatePtr_
 
bool checkStatusFlag_
 
edm::ESGetToken< EcalMustacheSCParameters, EcalMustacheSCParametersRcdecalMustacheSCParametersToken_
 
bool emptyIsOk_
 
std::string GsfElectronCollection_
 
std::string GsfElectronCoreCollection_
 
std::vector< reco::GsfElectronCoreRefgsfElectronCoreRefs_
 
std::map< reco::GsfTrackRef, float > gsfMvaMap_
 
std::vector< int > gsfPFCandidateIndex_
 
std::vector< reco::GsfTrackRefGsfTrackRef_
 
edm::EDGetTokenT< reco::GsfTrackCollectioninputTokenGSFTracks_
 
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > inputTokenIsoVals_
 
edm::EDGetTokenT< reco::PFCandidateCollectioninputTokenPFCandidateElectrons_
 
edm::EDGetTokenT< reco::PFCandidateCollectioninputTokenPFCandidates_
 
std::vector< reco::TrackRefkfTrackRef_
 
const EcalMustacheSCParametersmustacheSCParams_
 
double MVACut_
 
std::string PFBasicClusterCollection_
 
std::vector< std::vector< const reco::PFCluster * > > pfClusters_
 
std::string PFMVAValueMap_
 
std::string PFPreshowerClusterCollection_
 
std::string PFSCValueMap_
 
std::string PFSuperClusterCollection_
 
std::vector< reco::CaloClusterPtrVectorpreshowerClusterPtr_
 
std::vector< reco::PreshowerClusterCollectionpreshowerClusters_
 
std::map< reco::GsfTrackRef, reco::SuperClusterRefscMap_
 
std::vector< reco::SuperClusterCollectionsuperClusters_
 

Detailed Description

Definition at line 28 of file PFElectronTranslator.cc.

Member Typedef Documentation

◆ IsolationValueMaps

Definition at line 36 of file PFElectronTranslator.cc.

Constructor & Destructor Documentation

◆ PFElectronTranslator()

PFElectronTranslator::PFElectronTranslator ( const edm::ParameterSet iConfig)
explicit

Definition at line 171 of file PFElectronTranslator.cc.

References checkStatusFlag_, ecalMustacheSCParametersToken_, emptyIsOk_, edm::ParameterSet::getParameter(), GsfElectronCollection_, GsfElectronCoreCollection_, inputTokenGSFTracks_, inputTokenIsoVals_, inputTokenPFCandidateElectrons_, inputTokenPFCandidates_, MVACut_, PFBasicClusterCollection_, PFMVAValueMap_, PFPreshowerClusterCollection_, PFSCValueMap_, PFSuperClusterCollection_, and AlCaHLTBitMon_QueryRunRegistry::string.

171  {
172  inputTokenPFCandidates_ = consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("PFCandidate"));
174  consumes<reco::PFCandidateCollection>(iConfig.getParameter<edm::InputTag>("PFCandidateElectron"));
175  inputTokenGSFTracks_ = consumes<reco::GsfTrackCollection>(iConfig.getParameter<edm::InputTag>("GSFTracks"));
176 
177  bool useIsolationValues = iConfig.getParameter<bool>("useIsolationValues");
178  if (useIsolationValues) {
179  const auto& isoVals = iConfig.getParameter<edm::ParameterSet>("isolationValues");
180  if (isoVals.empty())
181  throw cms::Exception("PFElectronTranslator|InternalError") << "Missing ParameterSet isolationValues";
182  else {
183  inputTokenIsoVals_.push_back(
184  consumes<edm::ValueMap<double>>(isoVals.getParameter<edm::InputTag>("pfSumChargedHadronPt")));
185  inputTokenIsoVals_.push_back(
186  consumes<edm::ValueMap<double>>(isoVals.getParameter<edm::InputTag>("pfSumPhotonEt")));
187  inputTokenIsoVals_.push_back(
188  consumes<edm::ValueMap<double>>(isoVals.getParameter<edm::InputTag>("pfSumNeutralHadronEt")));
189  inputTokenIsoVals_.push_back(consumes<edm::ValueMap<double>>(isoVals.getParameter<edm::InputTag>("pfSumPUPt")));
190  }
191  }
192 
193  PFBasicClusterCollection_ = iConfig.getParameter<std::string>("PFBasicClusters");
194  PFPreshowerClusterCollection_ = iConfig.getParameter<std::string>("PFPreshowerClusters");
195  PFSuperClusterCollection_ = iConfig.getParameter<std::string>("PFSuperClusters");
196  GsfElectronCoreCollection_ = iConfig.getParameter<std::string>("PFGsfElectronCore");
197  GsfElectronCollection_ = iConfig.getParameter<std::string>("PFGsfElectron");
198 
199  PFMVAValueMap_ = iConfig.getParameter<std::string>("ElectronMVA");
200  PFSCValueMap_ = iConfig.getParameter<std::string>("ElectronSC");
201  MVACut_ = (iConfig.getParameter<edm::ParameterSet>("MVACutBlock")).getParameter<double>("MVACut");
202  checkStatusFlag_ = iConfig.getParameter<bool>("CheckStatusFlag");
203  emptyIsOk_ = iConfig.getParameter<bool>("emptyIsOk");
204 
205  ecalMustacheSCParametersToken_ = esConsumes<EcalMustacheSCParameters, EcalMustacheSCParametersRcd>();
206 
207  produces<reco::BasicClusterCollection>(PFBasicClusterCollection_);
208  produces<reco::PreshowerClusterCollection>(PFPreshowerClusterCollection_);
209  produces<reco::SuperClusterCollection>(PFSuperClusterCollection_);
210  produces<reco::GsfElectronCoreCollection>(GsfElectronCoreCollection_);
211  produces<reco::GsfElectronCollection>(GsfElectronCollection_);
212  produces<edm::ValueMap<float>>(PFMVAValueMap_);
213  produces<edm::ValueMap<reco::SuperClusterRef>>(PFSCValueMap_);
214 }
std::string PFPreshowerClusterCollection_
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< reco::GsfTrackCollection > inputTokenGSFTracks_
edm::ESGetToken< EcalMustacheSCParameters, EcalMustacheSCParametersRcd > ecalMustacheSCParametersToken_
edm::EDGetTokenT< reco::PFCandidateCollection > inputTokenPFCandidateElectrons_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > inputTokenIsoVals_
std::string PFBasicClusterCollection_
std::string GsfElectronCoreCollection_
std::string PFSuperClusterCollection_
edm::EDGetTokenT< reco::PFCandidateCollection > inputTokenPFCandidates_

◆ ~PFElectronTranslator()

PFElectronTranslator::~PFElectronTranslator ( )
override

Definition at line 216 of file PFElectronTranslator.cc.

216 {}

Member Function Documentation

◆ correspondingDaughterCandidate()

const reco::PFCandidate & PFElectronTranslator::correspondingDaughterCandidate ( const reco::PFCandidate cand,
const reco::PFBlockElement pfbe 
) const
private

Definition at line 626 of file PFElectronTranslator.cc.

References reco::PFCandidate::elementsInBlocks(), and reco::PFBlockElement::index().

Referenced by produce().

627  {
628  unsigned refindex = pfbe.index();
629  // std::cout << " N daughters " << cand.numberOfDaughters() << std::endl;
630  reco::PFCandidate::const_iterator myDaughterCandidate = cand.begin();
632 
633  for (; myDaughterCandidate != itend; ++myDaughterCandidate) {
634  const reco::PFCandidate* myPFCandidate = (const reco::PFCandidate*)&*myDaughterCandidate;
635  if (myPFCandidate->elementsInBlocks().size() != 1) {
636  // std::cout << " Daughter with " << myPFCandidate.elementsInBlocks().size()<< " element in block " << std::endl;
637  return cand;
638  }
639  if (myPFCandidate->elementsInBlocks()[0].second == refindex) {
640  // std::cout << " Found it " << cand << std::endl;
641  return *myPFCandidate;
642  }
643  }
644  return cand;
645 }
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:665
unsigned index() const
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41

◆ createBasicCluster()

void PFElectronTranslator::createBasicCluster ( const reco::PFBlockElement PFBE,
reco::BasicClusterCollection basicClusters,
std::vector< const reco::PFCluster *> &  pfClusters,
const reco::PFCandidate coCandidate 
) const
private

Definition at line 415 of file PFElectronTranslator.cc.

References reco::CaloCluster::algo(), reco::CaloCluster::caloID(), reco::PFBlockElement::clusterRef(), reco::CaloCluster::hitsAndFractions(), edm::Ref< C, T, F >::isNull(), reco::CaloCluster::position(), reco::PFCandidate::rawEcalEnergy(), and reco::CaloCluster::seed().

Referenced by produce().

418  {
419  const reco::PFClusterRef& myPFClusterRef = PFBE.clusterRef();
420  if (myPFClusterRef.isNull())
421  return;
422 
423  const reco::PFCluster& myPFCluster(*myPFClusterRef);
424  pfClusters.push_back(&myPFCluster);
425  // std::cout << " Creating BC " << myPFCluster.energy() << " " << coCandidate.ecalEnergy() <<" "<< coCandidate.rawEcalEnergy() <<std::endl;
426  // std::cout << " # hits " << myPFCluster.hitsAndFractions().size() << std::endl;
427 
428  // basicClusters.push_back(reco::CaloCluster(myPFCluster.energy(),
429  basicClusters.push_back(reco::CaloCluster(
430  // myPFCluster.energy(),
431  coCandidate.rawEcalEnergy(),
432  myPFCluster.position(),
433  myPFCluster.caloID(),
434  myPFCluster.hitsAndFractions(),
435  myPFCluster.algo(),
436  myPFCluster.seed()));
437 }
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
virtual const PFClusterRef & clusterRef() const
bool isNull() const
Checks for null.
Definition: Ref.h:235
double rawEcalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:224

◆ createBasicClusterPtrs()

void PFElectronTranslator::createBasicClusterPtrs ( const edm::OrphanHandle< reco::BasicClusterCollection > &  basicClustersHandle)
private

Definition at line 447 of file PFElectronTranslator.cc.

References basicClusterPtr_, basicClusters_, GsfTrackRef_, and findQualityFiles::size.

Referenced by produce().

448  {
449  unsigned size = GsfTrackRef_.size();
450  unsigned basicClusterCounter = 0;
451  basicClusterPtr_.resize(size);
452 
453  for (unsigned iGSF = 0; iGSF < size; ++iGSF) // loop on tracks
454  {
455  unsigned nbc = basicClusters_[iGSF].size();
456  for (unsigned ibc = 0; ibc < nbc; ++ibc) // loop on basic clusters
457  {
458  // std::cout << "Track "<< iGSF << " ref " << basicClusterCounter << std::endl;
459  reco::CaloClusterPtr bcPtr(basicClustersHandle, basicClusterCounter);
460  basicClusterPtr_[iGSF].push_back(bcPtr);
461  ++basicClusterCounter;
462  }
463  }
464 }
size
Write out results.
std::vector< reco::CaloClusterPtrVector > basicClusterPtr_
std::vector< reco::GsfTrackRef > GsfTrackRef_
std::vector< reco::BasicClusterCollection > basicClusters_

◆ createGsfElectronCoreRefs()

void PFElectronTranslator::createGsfElectronCoreRefs ( const edm::OrphanHandle< reco::GsfElectronCoreCollection > &  gsfElectronCoreHandle)
private

Definition at line 659 of file PFElectronTranslator.cc.

References gsfElectronCoreRefs_, GsfTrackRef_, and findQualityFiles::size.

Referenced by produce().

660  {
661  unsigned size = GsfTrackRef_.size();
662 
663  for (unsigned iGSF = 0; iGSF < size; ++iGSF) // loop on tracks
664  {
665  edm::Ref<reco::GsfElectronCoreCollection> elecCoreRef(gsfElectronCoreHandle, iGSF);
666  gsfElectronCoreRefs_.push_back(elecCoreRef);
667  }
668 }
size
Write out results.
std::vector< reco::GsfElectronCoreRef > gsfElectronCoreRefs_
std::vector< reco::GsfTrackRef > GsfTrackRef_

◆ createGsfElectronCores()

void PFElectronTranslator::createGsfElectronCores ( reco::GsfElectronCoreCollection gsfElectronCores) const
private

Definition at line 647 of file PFElectronTranslator.cc.

References GsfTrackRef_, kfTrackRef_, scMap_, reco::GsfElectronCore::setCtfTrack(), and reco::GsfElectronCore::setParentSuperCluster().

Referenced by produce().

647  {
648  unsigned nGSF = GsfTrackRef_.size();
649  for (unsigned iGSF = 0; iGSF < nGSF; ++iGSF) {
650  reco::GsfElectronCore myElectronCore(GsfTrackRef_[iGSF]);
651  myElectronCore.setCtfTrack(kfTrackRef_[iGSF], -1.);
652  std::map<reco::GsfTrackRef, reco::SuperClusterRef>::const_iterator itcheck = scMap_.find(GsfTrackRef_[iGSF]);
653  if (itcheck != scMap_.end())
654  myElectronCore.setParentSuperCluster(itcheck->second);
655  gsfElectronCores.push_back(myElectronCore);
656  }
657 }
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
std::vector< reco::GsfTrackRef > GsfTrackRef_
std::vector< reco::TrackRef > kfTrackRef_

◆ createGsfElectrons()

void PFElectronTranslator::createGsfElectrons ( const reco::PFCandidateCollection pfcand,
const IsolationValueMaps isolationValues,
reco::GsfElectronCollection gsfelectrons 
)
private

Definition at line 682 of file PFElectronTranslator.cc.

References reco::GsfElectron::addAmbiguousGsfTrack(), ambiguousGsfTracks_, CandidatePtr_, reco::GsfElectron::MvaInput::deltaEta, reco::PFCandidate::deltaP(), reco::GsfElectron::MvaInput::earlyBrem, reco::PFCandidate::electronExtraRef(), reco::GsfElectron::MvaInput::etOutsideMustache, gsfElectronCoreRefs_, gsfPFCandidateIndex_, GsfTrackRef_, reco::GsfElectron::MvaInput::hadEnergy, displacedMuonProducer_cff::isolationValues, ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, reco::GsfElectron::MvaInput::lateBrem, reco::Mustache::MustacheID(), mustacheSCParams_, reco::PFCandidateElectronExtra::MVA_DeltaEtaTrackCluster, reco::PFCandidate::mva_e_pi(), reco::GsfElectron::MvaOutput::mva_e_pi, reco::PFCandidateElectronExtra::MVA_FirstBrem, reco::PFCandidateElectronExtra::MVA_LateBrem, reco::GsfElectron::MvaInput::nClusterOutsideMustache, vertices_cff::ntracks, reco::LeafCandidate::p4(), reco::GsfElectron::P4_PFLOW_COMBINATION, reco::GsfElectron::parentSuperCluster(), pfDeepBoostedJetPreprocessParams_cfi::pfcand, reco::GsfElectron::setMvaInput(), reco::GsfElectron::setMvaOutput(), reco::GsfElectron::setP4(), reco::GsfElectron::setPfIsolationVariables(), reco::GsfElectron::MvaInput::sigmaEtaEta, findQualityFiles::size, reco::GsfElectron::MvaOutput::status, reco::GsfElectron::PflowIsolationVariables::sumChargedHadronPt, reco::GsfElectron::PflowIsolationVariables::sumNeutralHadronEt, reco::GsfElectron::PflowIsolationVariables::sumPhotonEt, and reco::GsfElectron::PflowIsolationVariables::sumPUPt.

Referenced by produce().

684  {
685  unsigned size = GsfTrackRef_.size();
686 
687  for (unsigned iGSF = 0; iGSF < size; ++iGSF) // loop on tracks
688  {
689  const reco::PFCandidate& pfCandidate(pfcand[gsfPFCandidateIndex_[iGSF]]);
690  // Electron
691  reco::GsfElectron myElectron(gsfElectronCoreRefs_[iGSF]);
692  // Warning set p4 error !
693  myElectron.setP4(reco::GsfElectron::P4_PFLOW_COMBINATION, pfCandidate.p4(), pfCandidate.deltaP(), true);
694 
695  // MVA inputs
696  reco::GsfElectron::MvaInput myMvaInput;
697  myMvaInput.earlyBrem = pfCandidate.electronExtraRef()->mvaVariable(reco::PFCandidateElectronExtra::MVA_FirstBrem);
698  myMvaInput.lateBrem = pfCandidate.electronExtraRef()->mvaVariable(reco::PFCandidateElectronExtra::MVA_LateBrem);
699  myMvaInput.deltaEta =
700  pfCandidate.electronExtraRef()->mvaVariable(reco::PFCandidateElectronExtra::MVA_DeltaEtaTrackCluster);
701  myMvaInput.sigmaEtaEta = pfCandidate.electronExtraRef()->sigmaEtaEta();
702  myMvaInput.hadEnergy = pfCandidate.electronExtraRef()->hadEnergy();
703 
704  // Mustache
705  reco::Mustache myMustache(mustacheSCParams_);
706  myMustache.MustacheID(
707  *(myElectron.parentSuperCluster()), myMvaInput.nClusterOutsideMustache, myMvaInput.etOutsideMustache);
708 
709  myElectron.setMvaInput(myMvaInput);
710 
711  // MVA output
712  reco::GsfElectron::MvaOutput myMvaOutput;
713  myMvaOutput.status = pfCandidate.electronExtraRef()->electronStatus();
714  myMvaOutput.mva_e_pi = pfCandidate.mva_e_pi();
715  myElectron.setMvaOutput(myMvaOutput);
716 
717  // ambiguous tracks
718  unsigned ntracks = ambiguousGsfTracks_[iGSF].size();
719  for (unsigned it = 0; it < ntracks; ++it) {
720  myElectron.addAmbiguousGsfTrack(ambiguousGsfTracks_[iGSF][it]);
721  }
722 
723  // isolation
724  if (!isolationValues.empty()) {
726  myPFIso.sumChargedHadronPt = (*isolationValues[0])[CandidatePtr_[iGSF]];
727  myPFIso.sumPhotonEt = (*isolationValues[1])[CandidatePtr_[iGSF]];
728  myPFIso.sumNeutralHadronEt = (*isolationValues[2])[CandidatePtr_[iGSF]];
729  myPFIso.sumPUPt = (*isolationValues[3])[CandidatePtr_[iGSF]];
730  myElectron.setPfIsolationVariables(myPFIso);
731  }
732 
733  gsfelectrons.push_back(myElectron);
734  }
735 }
size
Write out results.
std::vector< reco::GsfElectronCoreRef > gsfElectronCoreRefs_
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:670
std::vector< reco::GsfTrackRef > GsfTrackRef_
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:665
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:664
std::vector< int > gsfPFCandidateIndex_
std::vector< reco::CandidatePtr > CandidatePtr_
std::vector< std::vector< reco::GsfTrackRef > > ambiguousGsfTracks_
const EcalMustacheSCParameters * mustacheSCParams_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:663

◆ createPreshowerCluster()

void PFElectronTranslator::createPreshowerCluster ( const reco::PFBlockElement PFBE,
reco::PreshowerClusterCollection preshowerClusters,
unsigned  plane 
) const
private

Definition at line 439 of file PFElectronTranslator.cc.

References reco::PFBlockElement::clusterRef().

Referenced by produce().

441  {
442  const reco::PFClusterRef& myPFClusterRef = PFBE.clusterRef();
443  preshowerClusters.push_back(reco::PreshowerCluster(
444  myPFClusterRef->energy(), myPFClusterRef->position(), myPFClusterRef->hitsAndFractions(), plane));
445 }
virtual const PFClusterRef & clusterRef() const

◆ createPreshowerClusterPtrs()

void PFElectronTranslator::createPreshowerClusterPtrs ( const edm::OrphanHandle< reco::PreshowerClusterCollection > &  preshowerClustersHandle)
private

Definition at line 466 of file PFElectronTranslator.cc.

References GsfTrackRef_, preshowerClusterPtr_, preshowerClusters_, and findQualityFiles::size.

Referenced by produce().

467  {
468  unsigned size = GsfTrackRef_.size();
469  unsigned psClusterCounter = 0;
470  preshowerClusterPtr_.resize(size);
471 
472  for (unsigned iGSF = 0; iGSF < size; ++iGSF) // loop on tracks
473  {
474  unsigned nbc = preshowerClusters_[iGSF].size();
475  for (unsigned ibc = 0; ibc < nbc; ++ibc) // loop on basic clusters
476  {
477  // std::cout << "Track "<< iGSF << " ref " << basicClusterCounter << std::endl;
478  reco::CaloClusterPtr psPtr(preshowerClustersHandle, psClusterCounter);
479  preshowerClusterPtr_[iGSF].push_back(psPtr);
480  ++psClusterCounter;
481  }
482  }
483 }
size
Write out results.
std::vector< reco::GsfTrackRef > GsfTrackRef_
std::vector< reco::PreshowerClusterCollection > preshowerClusters_
std::vector< reco::CaloClusterPtrVector > preshowerClusterPtr_

◆ createSuperClusterGsfMapRefs()

void PFElectronTranslator::createSuperClusterGsfMapRefs ( const edm::OrphanHandle< reco::SuperClusterCollection > &  superClustersHandle)
private

Definition at line 485 of file PFElectronTranslator.cc.

References GsfTrackRef_, scMap_, and findQualityFiles::size.

Referenced by produce().

486  {
487  unsigned size = GsfTrackRef_.size();
488 
489  for (unsigned iGSF = 0; iGSF < size; ++iGSF) // loop on tracks
490  {
491  edm::Ref<reco::SuperClusterCollection> scRef(superClustersHandle, iGSF);
492  scMap_[GsfTrackRef_[iGSF]] = scRef;
493  }
494 }
size
Write out results.
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
std::vector< reco::GsfTrackRef > GsfTrackRef_

◆ createSuperClusters()

void PFElectronTranslator::createSuperClusters ( const reco::PFCandidateCollection pfCand,
reco::SuperClusterCollection superClusters 
) const
private

Definition at line 550 of file PFElectronTranslator.cc.

References reco::SuperCluster::addCluster(), reco::CaloCluster::addHitAndFraction(), reco::SuperCluster::addPreshowerCluster(), basicClusterPtr_, basicClusters_, MillePedeFileConverter_cfg::e, gsfPFCandidateIndex_, GsfTrackRef_, pfClusters_, PFClusterWidthAlgo::pflowEtaWidth(), PFClusterWidthAlgo::pflowPhiWidth(), RecoTauValidation_cfi::posX, RecoTauValidation_cfi::posY, preshowerClusterPtr_, reco::SuperCluster::rawEnergy(), reco::SuperCluster::setEtaWidth(), reco::SuperCluster::setPhiWidth(), reco::SuperCluster::setPreshowerEnergy(), reco::SuperCluster::setSeed(), HLT_2024v14_cff::superClusters, and trackerHitRTTI::vector.

Referenced by produce().

551  {
552  unsigned nGSF = GsfTrackRef_.size();
553  for (unsigned iGSF = 0; iGSF < nGSF; ++iGSF) {
554  // Computes energy position a la e/gamma
555  double sclusterE = 0;
556  double posX = 0.;
557  double posY = 0.;
558  double posZ = 0.;
559 
560  unsigned nbasics = basicClusters_[iGSF].size();
561  for (unsigned ibc = 0; ibc < nbasics; ++ibc) {
562  double e = basicClusters_[iGSF][ibc].energy();
563  sclusterE += e;
564  posX += e * basicClusters_[iGSF][ibc].position().X();
565  posY += e * basicClusters_[iGSF][ibc].position().Y();
566  posZ += e * basicClusters_[iGSF][ibc].position().Z();
567  }
568  posX /= sclusterE;
569  posY /= sclusterE;
570  posZ /= sclusterE;
571 
572  if (pfCand[gsfPFCandidateIndex_[iGSF]].gsfTrackRef() != GsfTrackRef_[iGSF]) {
573  edm::LogError("PFElectronTranslator") << " Major problem in PFElectron Translator" << std::endl;
574  }
575 
576  // compute the width
577  PFClusterWidthAlgo pfwidth(pfClusters_[iGSF]);
578 
579  double correctedEnergy = pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
580  reco::SuperCluster mySuperCluster(correctedEnergy, math::XYZPoint(posX, posY, posZ));
581  // protection against empty basic cluster collection ; the value is -2 in this case
582  if (nbasics) {
583  // std::cout << "SuperCluster creation; energy " << pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
584  // std::cout << " " << pfCand[gsfPFCandidateIndex_[iGSF]].rawEcalEnergy() << std::endl;
585  // std::cout << "Seed energy from basic " << basicClusters_[iGSF][0].energy() << std::endl;
586  mySuperCluster.setSeed(basicClusterPtr_[iGSF][0]);
587  } else {
588  // std::cout << "SuperCluster creation ; seed energy " << 0 << std::endl;
589  // std::cout << "SuperCluster creation ; energy " << pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
590  // std::cout << " " << pfCand[gsfPFCandidateIndex_[iGSF]].rawEcalEnergy() << std::endl;
591  // std::cout << " No seed found " << 0 << std::endl;
592  // std::cout << " MVA " << pfCand[gsfPFCandidateIndex_[iGSF]].mva_e_pi() << std::endl;
593  mySuperCluster.setSeed(reco::CaloClusterPtr());
594  }
595  // the seed should be the first basic cluster
596 
597  for (unsigned ibc = 0; ibc < nbasics; ++ibc) {
598  mySuperCluster.addCluster(basicClusterPtr_[iGSF][ibc]);
599  // std::cout <<"Adding Ref to SC " << basicClusterPtr_[iGSF][ibc].index() << std::endl;
600  const std::vector<std::pair<DetId, float>>& v1 = basicClusters_[iGSF][ibc].hitsAndFractions();
601  // std::cout << " Number of cells " << v1.size() << std::endl;
602  for (std::vector<std::pair<DetId, float>>::const_iterator diIt = v1.begin(); diIt != v1.end(); ++diIt) {
603  // std::cout << " Adding DetId " << (diIt->first).rawId() << " " << diIt->second << std::endl;
604  mySuperCluster.addHitAndFraction(diIt->first, diIt->second);
605  } // loop over rechits
606  }
607 
608  unsigned nps = preshowerClusterPtr_[iGSF].size();
609  for (unsigned ips = 0; ips < nps; ++ips) {
610  mySuperCluster.addPreshowerCluster(preshowerClusterPtr_[iGSF][ips]);
611  }
612 
613  // Set the preshower energy
614  mySuperCluster.setPreshowerEnergy(pfCand[gsfPFCandidateIndex_[iGSF]].pS1Energy() +
615  pfCand[gsfPFCandidateIndex_[iGSF]].pS2Energy());
616 
617  // Set the cluster width
618  mySuperCluster.setEtaWidth(pfwidth.pflowEtaWidth());
619  mySuperCluster.setPhiWidth(pfwidth.pflowPhiWidth());
620  // Force the computation of rawEnergy_ of the reco::SuperCluster
621  mySuperCluster.rawEnergy();
622  superClusters.push_back(mySuperCluster);
623  }
624 }
std::vector< reco::CaloClusterPtrVector > basicClusterPtr_
Log< level::Error, false > LogError
std::vector< std::vector< const reco::PFCluster * > > pfClusters_
std::vector< reco::GsfTrackRef > GsfTrackRef_
std::vector< int > gsfPFCandidateIndex_
XYZPointD XYZPoint
point in space with cartesian internal representation
Definition: Point3D.h:12
std::vector< reco::CaloClusterPtrVector > preshowerClusterPtr_
std::vector< reco::BasicClusterCollection > basicClusters_

◆ fetchCandidateCollection()

bool PFElectronTranslator::fetchCandidateCollection ( edm::Handle< reco::PFCandidateCollection > &  c,
const edm::EDGetTokenT< reco::PFCandidateCollection > &  token,
const edm::Event iEvent 
) const
private

Definition at line 386 of file PFElectronTranslator.cc.

References DummyCfis::c, emptyIsOk_, submitPVResolutionJobs::err, iEvent, and unpackBuffers-CaloStage2::token.

Referenced by fillMVAValueMap(), and produce().

388  {
389  c = iEvent.getHandle(token);
390 
391  if (!c.isValid() && !emptyIsOk_) {
392  std::ostringstream err;
393  err << " cannot get PFCandidates " << std::endl;
394  edm::LogError("PFElectronTranslator") << err.str();
395  }
396  return c.isValid();
397 }
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224

◆ fetchGsfCollection()

void PFElectronTranslator::fetchGsfCollection ( edm::Handle< reco::GsfTrackCollection > &  c,
const edm::EDGetTokenT< reco::GsfTrackCollection > &  token,
const edm::Event iEvent 
) const
private

Definition at line 399 of file PFElectronTranslator.cc.

References DummyCfis::c, submitPVResolutionJobs::err, Exception, iEvent, and unpackBuffers-CaloStage2::token.

Referenced by fillMVAValueMap(), and fillSCRefValueMap().

401  {
402  c = iEvent.getHandle(token);
403 
404  if (!c.isValid()) {
405  std::ostringstream err;
406  err << " cannot get GSFTracks " << std::endl;
407  edm::LogError("PFElectronTranslator") << err.str();
408  throw cms::Exception("MissingProduct", err.str());
409  }
410 }
Log< level::Error, false > LogError
int iEvent
Definition: GenABIO.cc:224

◆ fillDescriptions()

void PFElectronTranslator::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 144 of file PFElectronTranslator.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, muonDTDigis_cfi::pset, and AlCaHLTBitMon_QueryRunRegistry::string.

144  {
146  desc.add<edm::InputTag>("PFCandidate", {"pfSelectedElectrons"});
147  desc.add<edm::InputTag>("PFCandidateElectron", {"particleFlowTmp:electrons"});
148  desc.add<edm::InputTag>("GSFTracks", {"electronGsfTracks"});
149  desc.add<std::string>("PFBasicClusters", "pf");
150  desc.add<std::string>("PFPreshowerClusters", "pf");
151  desc.add<std::string>("PFSuperClusters", "pf");
152  desc.add<std::string>("ElectronMVA", "pf");
153  desc.add<std::string>("ElectronSC", "pf");
154  desc.add<std::string>("PFGsfElectron", "pf");
155  desc.add<std::string>("PFGsfElectronCore", "pf");
156  desc.add<edm::ParameterSetDescription>("MVACutBlock", {});
157  desc.add<bool>("CheckStatusFlag", true);
158  desc.add<bool>("useIsolationValues", false);
159  {
161  pset.add<edm::InputTag>("pfSumChargedHadronPt", {"elPFIsoValueCharged04PFId"});
162  pset.add<edm::InputTag>("pfSumPhotonEt", {"elPFIsoValueGamma04PFId"});
163  pset.add<edm::InputTag>("pfSumNeutralHadronEt", {"elPFIsoValueNeutral04PFId"});
164  pset.add<edm::InputTag>("pfSumPUPt", {"elPFIsoValuePU04PFId"});
165  desc.add<edm::ParameterSetDescription>("isolationValues", pset);
166  }
167  desc.add<bool>("emptyIsOk", false);
168  descriptions.addWithDefaultLabel(desc);
169 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ fillMVAValueMap()

void PFElectronTranslator::fillMVAValueMap ( edm::Event iEvent,
edm::ValueMap< float >::Filler &  filler 
)
private

Definition at line 496 of file PFElectronTranslator.cc.

References reco::PFCandidate::e, fetchCandidateCollection(), fetchGsfCollection(), trigObjTnPSource_cfi::filler, gsfMvaMap_, ecalDrivenGsfElectronCoresHGC_cff::gsfTracks, mps_fire::i, iEvent, inputTokenGSFTracks_, inputTokenPFCandidateElectrons_, zmumugammaAnalyzer_cfi::pfCandidates, mps_update::status, and contentValuesCheck::values.

Referenced by produce().

496  {
497  gsfMvaMap_.clear();
500 
501  unsigned ncand = (status) ? pfCandidates->size() : 0;
502  for (unsigned i = 0; i < ncand; ++i) {
503  const reco::PFCandidate& cand = (*pfCandidates)[i];
504  if (cand.particleId() != reco::PFCandidate::e)
505  continue;
506  if (cand.gsfTrackRef().isNull())
507  continue;
508  // Fill the MVA map
509  gsfMvaMap_[cand.gsfTrackRef()] = cand.mva_e_pi();
510  }
511 
514  unsigned ngsf = gsfTracks->size();
515  std::vector<float> values;
516  for (unsigned igsf = 0; igsf < ngsf; ++igsf) {
517  reco::GsfTrackRef theTrackRef(gsfTracks, igsf);
518  std::map<reco::GsfTrackRef, float>::const_iterator itcheck = gsfMvaMap_.find(theTrackRef);
519  if (itcheck == gsfMvaMap_.end()) {
520  // edm::LogWarning("PFElectronTranslator") << "MVA Map, missing GSF track ref " << std::endl;
521  values.push_back(-99.);
522  // std::cout << " Push_back -99. " << std::endl;
523  } else {
524  // std::cout << " Value " << itcheck->second << std::endl;
525  values.push_back(itcheck->second);
526  }
527  }
528  filler.insert(gsfTracks, values.begin(), values.end());
529 }
void fetchGsfCollection(edm::Handle< reco::GsfTrackCollection > &c, const edm::EDGetTokenT< reco::GsfTrackCollection > &token, const edm::Event &iEvent) const
bool fetchCandidateCollection(edm::Handle< reco::PFCandidateCollection > &c, const edm::EDGetTokenT< reco::PFCandidateCollection > &token, const edm::Event &iEvent) const
edm::EDGetTokenT< reco::GsfTrackCollection > inputTokenGSFTracks_
std::map< reco::GsfTrackRef, float > gsfMvaMap_
edm::EDGetTokenT< reco::PFCandidateCollection > inputTokenPFCandidateElectrons_
int iEvent
Definition: GenABIO.cc:224
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41

◆ fillSCRefValueMap()

void PFElectronTranslator::fillSCRefValueMap ( edm::Event iEvent,
edm::ValueMap< reco::SuperClusterRef >::Filler &  filler 
) const
private

Definition at line 531 of file PFElectronTranslator.cc.

References fetchGsfCollection(), trigObjTnPSource_cfi::filler, ecalDrivenGsfElectronCoresHGC_cff::gsfTracks, iEvent, inputTokenGSFTracks_, scMap_, and contentValuesCheck::values.

Referenced by produce().

532  {
535  unsigned ngsf = gsfTracks->size();
536  std::vector<reco::SuperClusterRef> values;
537  for (unsigned igsf = 0; igsf < ngsf; ++igsf) {
538  reco::GsfTrackRef theTrackRef(gsfTracks, igsf);
539  std::map<reco::GsfTrackRef, reco::SuperClusterRef>::const_iterator itcheck = scMap_.find(theTrackRef);
540  if (itcheck == scMap_.end()) {
541  // edm::LogWarning("PFElectronTranslator") << "SCRef Map, missing GSF track ref" << std::endl;
542  values.push_back(reco::SuperClusterRef());
543  } else {
544  values.push_back(itcheck->second);
545  }
546  }
547  filler.insert(gsfTracks, values.begin(), values.end());
548 }
void fetchGsfCollection(edm::Handle< reco::GsfTrackCollection > &c, const edm::EDGetTokenT< reco::GsfTrackCollection > &token, const edm::Event &iEvent) const
edm::EDGetTokenT< reco::GsfTrackCollection > inputTokenGSFTracks_
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
int iEvent
Definition: GenABIO.cc:224

◆ fillValueMap()

void PFElectronTranslator::fillValueMap ( edm::Event iEvent,
edm::ValueMap< float >::Filler &  filler 
) const
private

◆ getAmbiguousGsfTracks()

void PFElectronTranslator::getAmbiguousGsfTracks ( const reco::PFBlockElement PFBE,
std::vector< reco::GsfTrackRef > &  tracks 
) const
private

Definition at line 670 of file PFElectronTranslator.cc.

References reco::PFBlockElementGsfTrack::GsftrackRefPF(), ALPAKA_ACCELERATOR_NAMESPACE::vertexFinder::it, vertices_cff::ntracks, and DiMuonV_cfg::tracks.

Referenced by produce().

671  {
672  const reco::PFBlockElementGsfTrack* GsfEl = dynamic_cast<const reco::PFBlockElementGsfTrack*>(&PFBE);
673  if (GsfEl == nullptr)
674  return;
675  const std::vector<reco::GsfPFRecTrackRef>& ambPFRecTracks(GsfEl->GsftrackRefPF()->convBremGsfPFRecTrackRef());
676  unsigned ntracks = ambPFRecTracks.size();
677  for (unsigned it = 0; it < ntracks; ++it) {
678  tracks.push_back(ambPFRecTracks[it]->gsfTrackRef());
679  }
680 }
const GsfPFRecTrackRef & GsftrackRefPF() const

◆ produce()

void PFElectronTranslator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

Definition at line 218 of file PFElectronTranslator.cc.

References ambiguousGsfTracks_, basicClusterPtr_, basicClusters_, CandidatePtr_, checkStatusFlag_, correspondingDaughterCandidate(), createBasicCluster(), createBasicClusterPtrs(), createGsfElectronCoreRefs(), createGsfElectronCores(), createGsfElectrons(), createPreshowerCluster(), createPreshowerClusterPtrs(), createSuperClusterGsfMapRefs(), createSuperClusters(), reco::PFCandidate::e, reco::PFBlockElement::ECAL, ecalMustacheSCParametersToken_, bookConverter::elements, fetchCandidateCollection(), fillMVAValueMap(), fillSCRefValueMap(), getAmbiguousGsfTracks(), edm::EventSetup::getData(), reco::PFBlockElement::GSF, GsfElectronCollection_, GsfElectronCoreCollection_, gsfElectronCoreRefs_, gsfPFCandidateIndex_, GsfTrackRef_, mps_fire::i, iEvent, inputTokenIsoVals_, inputTokenPFCandidates_, edm::Ref< C, T, F >::isNull(), displacedMuonProducer_cff::isolationValues, dqmiolumiharvest::j, kfTrackRef_, eostools::move(), mustacheSCParams_, MVACut_, PFBasicClusterCollection_, zmumugammaAnalyzer_cfi::pfCandidates, pfClusters_, PFMVAValueMap_, PFPreshowerClusterCollection_, PFSCValueMap_, PFSuperClusterCollection_, preshowerClusterPtr_, preshowerClusters_, reco::PFBlockElement::PS1, reco::PFBlockElement::PS2, scMap_, reco::PFCandidateElectronExtra::Selected, mps_update::status, superClusters_, and reco::PFBlockElement::type().

218  {
220 
221  auto gsfElectronCores_p = std::make_unique<reco::GsfElectronCoreCollection>();
222 
223  auto gsfElectrons_p = std::make_unique<reco::GsfElectronCollection>();
224 
225  auto superClusters_p = std::make_unique<reco::SuperClusterCollection>();
226 
227  auto basicClusters_p = std::make_unique<reco::BasicClusterCollection>();
228 
229  auto psClusters_p = std::make_unique<reco::PreshowerClusterCollection>();
230 
231  auto mvaMap_p = std::make_unique<edm::ValueMap<float>>();
232  edm::ValueMap<float>::Filler mvaFiller(*mvaMap_p);
233 
234  auto scMap_p = std::make_unique<edm::ValueMap<reco::SuperClusterRef>>();
235  edm::ValueMap<reco::SuperClusterRef>::Filler scRefFiller(*scMap_p);
236 
239 
241  for (size_t j = 0; j < inputTokenIsoVals_.size(); ++j) {
243  }
244 
245  // clear the vectors
246  GsfTrackRef_.clear();
247  CandidatePtr_.clear();
248  ambiguousGsfTracks_.clear();
249  kfTrackRef_.clear();
250  basicClusters_.clear();
251  pfClusters_.clear();
252  preshowerClusters_.clear();
253  superClusters_.clear();
254  basicClusterPtr_.clear();
255  preshowerClusterPtr_.clear();
256  gsfPFCandidateIndex_.clear();
257  gsfElectronCoreRefs_.clear();
258  scMap_.clear();
259 
260  // loop on the candidates
261  //CC@@
262  // we need first to create AND put the SuperCluster,
263  // basic clusters and presh clusters collection
264  // in order to get a working Handle
265  unsigned ncand = (status) ? pfCandidates->size() : 0;
266  unsigned iGSF = 0;
267  for (unsigned i = 0; i < ncand; ++i) {
268  const reco::PFCandidate& cand = (*pfCandidates)[i];
269  if (cand.particleId() != reco::PFCandidate::e)
270  continue;
271  if (cand.gsfTrackRef().isNull())
272  continue;
273  // Note that -1 will still cut some total garbage candidates
274  // Fill the MVA map
275  if (cand.mva_e_pi() < MVACut_)
276  continue;
277 
278  // Check the status flag
279  if (checkStatusFlag_ && !cand.electronExtraRef()->electronStatus(reco::PFCandidateElectronExtra::Selected)) {
280  continue;
281  }
282 
283  GsfTrackRef_.push_back(cand.gsfTrackRef());
284  kfTrackRef_.push_back(cand.trackRef());
285  gsfPFCandidateIndex_.push_back(i);
286 
287  reco::PFCandidatePtr ptrToPFElectron(pfCandidates, i);
288  //CandidatePtr_.push_back(ptrToPFElectron->sourceCandidatePtr(0));
289  CandidatePtr_.push_back(ptrToPFElectron);
290 
292  pfClusters_.push_back(std::vector<const reco::PFCluster*>());
294  ambiguousGsfTracks_.push_back(std::vector<reco::GsfTrackRef>());
295 
296  for (unsigned iele = 0; iele < cand.elementsInBlocks().size(); ++iele) {
297  // first get the block
298  reco::PFBlockRef blockRef = cand.elementsInBlocks()[iele].first;
299  //
300  unsigned elementIndex = cand.elementsInBlocks()[iele].second;
301  // check it actually exists
302  if (blockRef.isNull())
303  continue;
304 
305  // then get the elements of the block
306  const edm::OwnVector<reco::PFBlockElement>& elements = (*blockRef).elements();
307 
308  const reco::PFBlockElement& pfbe(elements[elementIndex]);
309  // The first ECAL element should be the cluster associated to the GSF; defined as the seed
310  if (pfbe.type() == reco::PFBlockElement::ECAL) {
311  // const reco::PFCandidate * coCandidate = &cand;
312  // the Brem photons are saved as daughter PFCandidate; this
313  // is convenient to access the corrected energy
314  // std::cout << " Found candidate " << correspondingDaughterCandidate(coCandidate,pfbe) << " " << coCandidate << std::endl;
316  }
317  if (pfbe.type() == reco::PFBlockElement::PS1) {
319  }
320  if (pfbe.type() == reco::PFBlockElement::PS2) {
322  }
323  if (pfbe.type() == reco::PFBlockElement::GSF) {
325  }
326 
327  } // loop on the elements
328 
329  // save the basic clusters
330  basicClusters_p->insert(basicClusters_p->end(), basicClusters_[iGSF].begin(), basicClusters_[iGSF].end());
331  // save the preshower clusters
332  psClusters_p->insert(psClusters_p->end(), preshowerClusters_[iGSF].begin(), preshowerClusters_[iGSF].end());
333 
334  ++iGSF;
335  } // loop on PFCandidates
336 
337  //Save the basic clusters and get an handle as to be able to create valid Refs (thanks to Claude)
338  // std::cout << " Number of basic clusters " << basicClusters_p->size() << std::endl;
340  iEvent.put(std::move(basicClusters_p), PFBasicClusterCollection_);
341 
342  //preshower clusters
344  iEvent.put(std::move(psClusters_p), PFPreshowerClusterCollection_);
345 
346  // now that the Basic clusters are in the event, the Ref can be created
347  createBasicClusterPtrs(bcRefProd);
348  // now that the preshower clusters are in the event, the Ref can be created
349  createPreshowerClusterPtrs(psRefProd);
350 
351  // and now the Super cluster can be created with valid references
352  if (status)
353  createSuperClusters(*pfCandidates, *superClusters_p);
354 
355  // Let's put the super clusters in the event
357  iEvent.put(std::move(superClusters_p), PFSuperClusterCollection_);
358  // create the super cluster Ref
359  createSuperClusterGsfMapRefs(scRefProd);
360 
361  // Now create the GsfElectronCoers
362  createGsfElectronCores(*gsfElectronCores_p);
363  // Put them in the as to get to be able to build a Ref
364  const edm::OrphanHandle<reco::GsfElectronCoreCollection> gsfElectronCoreRefProd =
365  iEvent.put(std::move(gsfElectronCores_p), GsfElectronCoreCollection_);
366 
367  // now create the Refs
368  createGsfElectronCoreRefs(gsfElectronCoreRefProd);
369 
370  // now make the GsfElectron
371  createGsfElectrons(*pfCandidates, isolationValues, *gsfElectrons_p);
372  iEvent.put(std::move(gsfElectrons_p), GsfElectronCollection_);
373 
374  fillMVAValueMap(iEvent, mvaFiller);
375  mvaFiller.fill();
376 
377  fillSCRefValueMap(iEvent, scRefFiller);
378  scRefFiller.fill();
379 
380  // MVA map
381  iEvent.put(std::move(mvaMap_p), PFMVAValueMap_);
382  // Gsf-SC map
383  iEvent.put(std::move(scMap_p), PFSCValueMap_);
384 }
std::string PFPreshowerClusterCollection_
Abstract base class for a PFBlock element (track, cluster...)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
bool fetchCandidateCollection(edm::Handle< reco::PFCandidateCollection > &c, const edm::EDGetTokenT< reco::PFCandidateCollection > &token, const edm::Event &iEvent) const
void createGsfElectronCoreRefs(const edm::OrphanHandle< reco::GsfElectronCoreCollection > &gsfElectronCoreHandle)
std::vector< reco::CaloClusterPtrVector > basicClusterPtr_
void getAmbiguousGsfTracks(const reco::PFBlockElement &PFBE, std::vector< reco::GsfTrackRef > &) const
std::vector< reco::GsfElectronCoreRef > gsfElectronCoreRefs_
void createBasicClusterPtrs(const edm::OrphanHandle< reco::BasicClusterCollection > &basicClustersHandle)
void createGsfElectronCores(reco::GsfElectronCoreCollection &) const
std::vector< std::vector< const reco::PFCluster * > > pfClusters_
void createSuperClusters(const reco::PFCandidateCollection &, reco::SuperClusterCollection &superClusters) const
edm::ESGetToken< EcalMustacheSCParameters, EcalMustacheSCParametersRcd > ecalMustacheSCParametersToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< double > > > inputTokenIsoVals_
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
std::vector< reco::GsfTrackRef > GsfTrackRef_
int iEvent
Definition: GenABIO.cc:224
void fillMVAValueMap(edm::Event &iEvent, edm::ValueMap< float >::Filler &filler)
void createBasicCluster(const reco::PFBlockElement &, reco::BasicClusterCollection &basicClusters, std::vector< const reco::PFCluster *> &, const reco::PFCandidate &coCandidate) const
std::vector< reco::PreshowerClusterCollection > preshowerClusters_
void createSuperClusterGsfMapRefs(const edm::OrphanHandle< reco::SuperClusterCollection > &superClustersHandle)
std::vector< PreshowerCluster > PreshowerClusterCollection
collection of PreshowerCluster objects
void fillSCRefValueMap(edm::Event &iEvent, edm::ValueMap< reco::SuperClusterRef >::Filler &filler) const
std::vector< int > gsfPFCandidateIndex_
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
bool isNull() const
Checks for null.
Definition: Ref.h:235
std::vector< reco::CandidatePtr > CandidatePtr_
std::vector< std::vector< reco::GsfTrackRef > > ambiguousGsfTracks_
const EcalMustacheSCParameters * mustacheSCParams_
std::string PFBasicClusterCollection_
std::vector< reco::SuperClusterCollection > superClusters_
std::vector< reco::CaloClusterPtrVector > preshowerClusterPtr_
std::string GsfElectronCoreCollection_
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
const reco::PFCandidate & correspondingDaughterCandidate(const reco::PFCandidate &cand, const reco::PFBlockElement &pfbe) const
std::vector< reco::BasicClusterCollection > basicClusters_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:41
std::vector< reco::TrackRef > kfTrackRef_
std::string PFSuperClusterCollection_
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 &)
void createPreshowerClusterPtrs(const edm::OrphanHandle< reco::PreshowerClusterCollection > &preshowerClustersHandle)
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ ambiguousGsfTracks_

std::vector<std::vector<reco::GsfTrackRef> > PFElectronTranslator::ambiguousGsfTracks_
private

Definition at line 114 of file PFElectronTranslator.cc.

Referenced by createGsfElectrons(), and produce().

◆ basicClusterPtr_

std::vector<reco::CaloClusterPtrVector> PFElectronTranslator::basicClusterPtr_
private

Definition at line 124 of file PFElectronTranslator.cc.

Referenced by createBasicClusterPtrs(), createSuperClusters(), and produce().

◆ basicClusters_

std::vector<reco::BasicClusterCollection> PFElectronTranslator::basicClusters_
private

Definition at line 116 of file PFElectronTranslator.cc.

Referenced by createBasicClusterPtrs(), createSuperClusters(), and produce().

◆ CandidatePtr_

std::vector<reco::CandidatePtr> PFElectronTranslator::CandidatePtr_
private

Definition at line 110 of file PFElectronTranslator.cc.

Referenced by createGsfElectrons(), and produce().

◆ checkStatusFlag_

bool PFElectronTranslator::checkStatusFlag_
private

Definition at line 104 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ ecalMustacheSCParametersToken_

edm::ESGetToken<EcalMustacheSCParameters, EcalMustacheSCParametersRcd> PFElectronTranslator::ecalMustacheSCParametersToken_
private

Definition at line 136 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ emptyIsOk_

bool PFElectronTranslator::emptyIsOk_
private

Definition at line 139 of file PFElectronTranslator.cc.

Referenced by fetchCandidateCollection(), and PFElectronTranslator().

◆ GsfElectronCollection_

std::string PFElectronTranslator::GsfElectronCollection_
private

Definition at line 102 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ GsfElectronCoreCollection_

std::string PFElectronTranslator::GsfElectronCoreCollection_
private

Definition at line 101 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ gsfElectronCoreRefs_

std::vector<reco::GsfElectronCoreRef> PFElectronTranslator::gsfElectronCoreRefs_
private

Definition at line 128 of file PFElectronTranslator.cc.

Referenced by createGsfElectronCoreRefs(), createGsfElectrons(), and produce().

◆ gsfMvaMap_

std::map<reco::GsfTrackRef, float> PFElectronTranslator::gsfMvaMap_
private

Definition at line 133 of file PFElectronTranslator.cc.

Referenced by fillMVAValueMap().

◆ gsfPFCandidateIndex_

std::vector<int> PFElectronTranslator::gsfPFCandidateIndex_
private

Definition at line 130 of file PFElectronTranslator.cc.

Referenced by createGsfElectrons(), createSuperClusters(), and produce().

◆ GsfTrackRef_

std::vector<reco::GsfTrackRef> PFElectronTranslator::GsfTrackRef_
private

◆ inputTokenGSFTracks_

edm::EDGetTokenT<reco::GsfTrackCollection> PFElectronTranslator::inputTokenGSFTracks_
private

◆ inputTokenIsoVals_

std::vector<edm::EDGetTokenT<edm::ValueMap<double> > > PFElectronTranslator::inputTokenIsoVals_
private

Definition at line 95 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ inputTokenPFCandidateElectrons_

edm::EDGetTokenT<reco::PFCandidateCollection> PFElectronTranslator::inputTokenPFCandidateElectrons_
private

Definition at line 93 of file PFElectronTranslator.cc.

Referenced by fillMVAValueMap(), and PFElectronTranslator().

◆ inputTokenPFCandidates_

edm::EDGetTokenT<reco::PFCandidateCollection> PFElectronTranslator::inputTokenPFCandidates_
private

Definition at line 92 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ kfTrackRef_

std::vector<reco::TrackRef> PFElectronTranslator::kfTrackRef_
private

Definition at line 112 of file PFElectronTranslator.cc.

Referenced by createGsfElectronCores(), and produce().

◆ mustacheSCParams_

const EcalMustacheSCParameters* PFElectronTranslator::mustacheSCParams_
private

Definition at line 137 of file PFElectronTranslator.cc.

Referenced by createGsfElectrons(), and produce().

◆ MVACut_

double PFElectronTranslator::MVACut_
private

Definition at line 103 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ PFBasicClusterCollection_

std::string PFElectronTranslator::PFBasicClusterCollection_
private

Definition at line 96 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ pfClusters_

std::vector<std::vector<const reco::PFCluster*> > PFElectronTranslator::pfClusters_
private

Definition at line 118 of file PFElectronTranslator.cc.

Referenced by createSuperClusters(), and produce().

◆ PFMVAValueMap_

std::string PFElectronTranslator::PFMVAValueMap_
private

Definition at line 99 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ PFPreshowerClusterCollection_

std::string PFElectronTranslator::PFPreshowerClusterCollection_
private

Definition at line 97 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ PFSCValueMap_

std::string PFElectronTranslator::PFSCValueMap_
private

Definition at line 100 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ PFSuperClusterCollection_

std::string PFElectronTranslator::PFSuperClusterCollection_
private

Definition at line 98 of file PFElectronTranslator.cc.

Referenced by PFElectronTranslator(), and produce().

◆ preshowerClusterPtr_

std::vector<reco::CaloClusterPtrVector> PFElectronTranslator::preshowerClusterPtr_
private

◆ preshowerClusters_

std::vector<reco::PreshowerClusterCollection> PFElectronTranslator::preshowerClusters_
private

Definition at line 120 of file PFElectronTranslator.cc.

Referenced by createPreshowerClusterPtrs(), and produce().

◆ scMap_

std::map<reco::GsfTrackRef, reco::SuperClusterRef> PFElectronTranslator::scMap_
private

◆ superClusters_

std::vector<reco::SuperClusterCollection> PFElectronTranslator::superClusters_
private

Definition at line 122 of file PFElectronTranslator.cc.

Referenced by produce().