CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
PFElectronTranslator Class Reference

#include <PFElectronTranslator.h>

Inheritance diagram for PFElectronTranslator:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

typedef std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
 
- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 PFElectronTranslator (const edm::ParameterSet &)
 
virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ~PFElectronTranslator ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

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::InputTag &tag, const edm::Event &iEvent) const
 
void fetchGsfCollection (edm::Handle< reco::GsfTrackCollection > &c, const edm::InputTag &tag, 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_
 
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::InputTag inputTagGSFTracks_
 
std::vector< edm::InputTaginputTagIsoVals_
 
edm::InputTag inputTagPFCandidateElectrons_
 
edm::InputTag inputTagPFCandidates_
 
std::vector< reco::TrackRefkfTrackRef_
 
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_
 

Additional Inherited Members

- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 23 of file PFElectronTranslator.h.

Member Typedef Documentation

Definition at line 31 of file PFElectronTranslator.h.

Constructor & Destructor Documentation

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

Definition at line 22 of file PFElectronTranslator.cc.

References checkStatusFlag_, emptyIsOk_, edm::ParameterSet::exists(), edm::ParameterSet::getParameter(), GsfElectronCollection_, GsfElectronCoreCollection_, inputTagGSFTracks_, inputTagIsoVals_, inputTagPFCandidateElectrons_, inputTagPFCandidates_, MVACut_, PFBasicClusterCollection_, PFMVAValueMap_, PFPreshowerClusterCollection_, PFSCValueMap_, PFSuperClusterCollection_, AlCaHLTBitMon_QueryRunRegistry::string, and gedGsfElectrons_cfi::useIsolationValues.

22  {
24  = iConfig.getParameter<edm::InputTag>("PFCandidate");
26  = iConfig.getParameter<edm::InputTag>("PFCandidateElectron");
28  = iConfig.getParameter<edm::InputTag>("GSFTracks");
29 
30  bool useIsolationValues = iConfig.getParameter<bool>("useIsolationValues") ;
31  if ( useIsolationValues ) {
32  if( ! iConfig.exists("isolationValues") )
33  throw cms::Exception("PFElectronTranslator|InternalError")
34  <<"Missing ParameterSet isolationValues" ;
35  else {
36  edm::ParameterSet isoVals =
37  iConfig.getParameter<edm::ParameterSet> ("isolationValues");
38  inputTagIsoVals_.push_back
39  (isoVals.getParameter<edm::InputTag>("pfSumChargedHadronPt"));
40  inputTagIsoVals_.push_back
41  (isoVals.getParameter<edm::InputTag>("pfSumPhotonEt"));
42  inputTagIsoVals_.push_back
43  (isoVals.getParameter<edm::InputTag>("pfSumNeutralHadronEt"));
44  inputTagIsoVals_.push_back
45  (isoVals.getParameter<edm::InputTag>("pfSumPUPt"));
46  }
47  }
48 
49  PFBasicClusterCollection_ = iConfig.getParameter<std::string>("PFBasicClusters");
50  PFPreshowerClusterCollection_ = iConfig.getParameter<std::string>("PFPreshowerClusters");
51  PFSuperClusterCollection_ = iConfig.getParameter<std::string>("PFSuperClusters");
52  GsfElectronCoreCollection_ = iConfig.getParameter<std::string>("PFGsfElectronCore");
53  GsfElectronCollection_ = iConfig.getParameter<std::string>("PFGsfElectron");
54 
55  PFMVAValueMap_ = iConfig.getParameter<std::string>("ElectronMVA");
56  PFSCValueMap_ = iConfig.getParameter<std::string>("ElectronSC");
57  MVACut_ = (iConfig.getParameter<edm::ParameterSet>("MVACutBlock")).getParameter<double>("MVACut");
58  checkStatusFlag_ = iConfig.getParameter<bool>("CheckStatusFlag");
59 
60  if (iConfig.exists("emptyIsOk")) emptyIsOk_ = iConfig.getParameter<bool>("emptyIsOk");
61  else emptyIsOk_=false;
62 
63  produces<reco::BasicClusterCollection>(PFBasicClusterCollection_);
64  produces<reco::PreshowerClusterCollection>(PFPreshowerClusterCollection_);
65  produces<reco::SuperClusterCollection>(PFSuperClusterCollection_);
66  produces<reco::GsfElectronCoreCollection>(GsfElectronCoreCollection_);
67  produces<reco::GsfElectronCollection>(GsfElectronCollection_);
68  produces<edm::ValueMap<float> >(PFMVAValueMap_);
69  produces<edm::ValueMap<reco::SuperClusterRef> >(PFSCValueMap_);
70 }
T getParameter(std::string const &) const
std::string PFPreshowerClusterCollection_
bool exists(std::string const &parameterName) const
checks if a parameter exists
std::string GsfElectronCollection_
edm::InputTag inputTagPFCandidateElectrons_
edm::InputTag inputTagPFCandidates_
edm::InputTag inputTagGSFTracks_
std::string PFBasicClusterCollection_
std::string GsfElectronCoreCollection_
std::vector< edm::InputTag > inputTagIsoVals_
std::string PFSuperClusterCollection_
PFElectronTranslator::~PFElectronTranslator ( )

Definition at line 72 of file PFElectronTranslator.cc.

72 {}

Member Function Documentation

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

Definition at line 528 of file PFElectronTranslator.cc.

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

Referenced by produce().

529 {
530  unsigned refindex=pfbe.index();
531  // std::cout << " N daughters " << cand.numberOfDaughters() << std::endl;
532  reco::PFCandidate::const_iterator myDaughterCandidate=cand.begin();
534 
535  for(;myDaughterCandidate!=itend;++myDaughterCandidate)
536  {
537  const reco::PFCandidate * myPFCandidate = (const reco::PFCandidate*)&*myDaughterCandidate;
538  if(myPFCandidate->elementsInBlocks().size()!=1)
539  {
540  // std::cout << " Daughter with " << myPFCandidate.elementsInBlocks().size()<< " element in block " << std::endl;
541  return cand;
542  }
543  if(myPFCandidate->elementsInBlocks()[0].second==refindex)
544  {
545  // std::cout << " Found it " << cand << std::endl;
546  return *myPFCandidate;
547  }
548  }
549  return cand;
550 }
unsigned index() const
const_iterator end() const
last daughter const_iterator
Definition: Candidate.h:146
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
const_iterator begin() const
first daughter const_iterator
Definition: Candidate.h:144
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:687
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 285 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().

289 {
290  reco::PFClusterRef myPFClusterRef= PFBE.clusterRef();
291  if(myPFClusterRef.isNull()) return;
292 
293  const reco::PFCluster & myPFCluster (*myPFClusterRef);
294  pfClusters.push_back(&myPFCluster);
295 // std::cout << " Creating BC " << myPFCluster.energy() << " " << coCandidate.ecalEnergy() <<" "<< coCandidate.rawEcalEnergy() <<std::endl;
296 // std::cout << " # hits " << myPFCluster.hitsAndFractions().size() << std::endl;
297 
298 // basicClusters.push_back(reco::CaloCluster(myPFCluster.energy(),
299  basicClusters.push_back(reco::CaloCluster(
300  // myPFCluster.energy(),
301  coCandidate.rawEcalEnergy(),
302  myPFCluster.position(),
303  myPFCluster.caloID(),
304  myPFCluster.hitsAndFractions(),
305  myPFCluster.algo(),
306  myPFCluster.seed()));
307 }
double rawEcalEnergy() const
return corrected Ecal energy
Definition: PFCandidate.h:224
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:47
virtual const PFClusterRef & clusterRef() const
bool isNull() const
Checks for null.
Definition: Ref.h:250
void PFElectronTranslator::createBasicClusterPtrs ( const edm::OrphanHandle< reco::BasicClusterCollection > &  basicClustersHandle)
private

Definition at line 317 of file PFElectronTranslator.cc.

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

Referenced by produce().

318 {
319  unsigned size=GsfTrackRef_.size();
320  unsigned basicClusterCounter=0;
321  basicClusterPtr_.resize(size);
322 
323  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
324  {
325  unsigned nbc=basicClusters_[iGSF].size();
326  for(unsigned ibc=0;ibc<nbc;++ibc) // loop on basic clusters
327  {
328  // std::cout << "Track "<< iGSF << " ref " << basicClusterCounter << std::endl;
329  reco::CaloClusterPtr bcPtr(basicClustersHandle,basicClusterCounter);
330  basicClusterPtr_[iGSF].push_back(bcPtr);
331  ++basicClusterCounter;
332  }
333  }
334 }
size
Write out results.
std::vector< reco::CaloClusterPtrVector > basicClusterPtr_
std::vector< reco::GsfTrackRef > GsfTrackRef_
std::vector< reco::BasicClusterCollection > basicClusters_
void PFElectronTranslator::createGsfElectronCoreRefs ( const edm::OrphanHandle< reco::GsfElectronCoreCollection > &  gsfElectronCoreHandle)
private

Definition at line 566 of file PFElectronTranslator.cc.

References gsfElectronCoreRefs_, GsfTrackRef_, and findQualityFiles::size.

Referenced by produce().

566  {
567  unsigned size=GsfTrackRef_.size();
568 
569  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
570  {
571  edm::Ref<reco::GsfElectronCoreCollection> elecCoreRef(gsfElectronCoreHandle,iGSF);
572  gsfElectronCoreRefs_.push_back(elecCoreRef);
573  }
574 }
size
Write out results.
std::vector< reco::GsfElectronCoreRef > gsfElectronCoreRefs_
std::vector< reco::GsfTrackRef > GsfTrackRef_
void PFElectronTranslator::createGsfElectronCores ( reco::GsfElectronCoreCollection gsfElectronCores) const
private

Definition at line 552 of file PFElectronTranslator.cc.

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

Referenced by produce().

552  {
553  unsigned nGSF=GsfTrackRef_.size();
554  for(unsigned iGSF=0;iGSF<nGSF;++iGSF)
555  {
556  reco::GsfElectronCore myElectronCore(GsfTrackRef_[iGSF]);
557  myElectronCore.setCtfTrack(kfTrackRef_[iGSF],-1.);
558  std::map<reco::GsfTrackRef,reco::SuperClusterRef>::const_iterator
559  itcheck=scMap_.find(GsfTrackRef_[iGSF]);
560  if(itcheck!=scMap_.end())
561  myElectronCore.setParentSuperCluster(itcheck->second);
562  gsfElectronCores.push_back(myElectronCore);
563  }
564 }
std::vector< reco::GsfTrackRef > GsfTrackRef_
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
std::vector< reco::TrackRef > kfTrackRef_
void PFElectronTranslator::createGsfElectrons ( const reco::PFCandidateCollection pfcand,
const IsolationValueMaps isolationValues,
reco::GsfElectronCollection gsfelectrons 
)
private

Definition at line 587 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, reco::GsfElectron::MvaInput::lateBrem, reco::Mustache::MustacheID(), 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, reco::LeafCandidate::p4(), reco::GsfElectron::P4_PFLOW_COMBINATION, 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().

589  {
590  unsigned size=GsfTrackRef_.size();
591 
592  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
593  {
594  const reco::PFCandidate& pfCandidate(pfcand[gsfPFCandidateIndex_[iGSF]]);
595  // Electron
596  reco::GsfElectron myElectron(gsfElectronCoreRefs_[iGSF]);
597  // Warning set p4 error !
598  myElectron.setP4(reco::GsfElectron::P4_PFLOW_COMBINATION, pfCandidate.p4(),pfCandidate.deltaP(), true);
599 
600  // MVA inputs
601  reco::GsfElectron::MvaInput myMvaInput;
602  myMvaInput.earlyBrem = pfCandidate.electronExtraRef()->mvaVariable(reco::PFCandidateElectronExtra::MVA_FirstBrem);
603  myMvaInput.lateBrem = pfCandidate.electronExtraRef()->mvaVariable(reco::PFCandidateElectronExtra::MVA_LateBrem);
604  myMvaInput.deltaEta = pfCandidate.electronExtraRef()->mvaVariable(reco::PFCandidateElectronExtra::MVA_DeltaEtaTrackCluster);
605  myMvaInput.sigmaEtaEta = pfCandidate.electronExtraRef()->sigmaEtaEta();
606  myMvaInput.hadEnergy = pfCandidate.electronExtraRef()->hadEnergy();
607 
608  // Mustache
609  reco::Mustache myMustache;
610  myMustache.MustacheID(*(myElectron. parentSuperCluster()), myMvaInput.nClusterOutsideMustache, myMvaInput.etOutsideMustache );
611 
612  myElectron.setMvaInput(myMvaInput);
613 
614  // MVA output
615  reco::GsfElectron::MvaOutput myMvaOutput;
616  myMvaOutput.status = pfCandidate.electronExtraRef()->electronStatus();
617  myMvaOutput.mva_e_pi = pfCandidate.mva_e_pi();
618  myElectron.setMvaOutput(myMvaOutput);
619 
620  // ambiguous tracks
621  unsigned ntracks=ambiguousGsfTracks_[iGSF].size();
622  for(unsigned it=0;it<ntracks;++it) {
623  myElectron.addAmbiguousGsfTrack(ambiguousGsfTracks_[iGSF][it]);
624  }
625 
626  // isolation
627  if( isolationValues.size() != 0 ) {
629  myPFIso.sumChargedHadronPt=(*isolationValues[0])[CandidatePtr_[iGSF]];
630  myPFIso.sumPhotonEt=(*isolationValues[1])[CandidatePtr_[iGSF]];
631  myPFIso.sumNeutralHadronEt=(*isolationValues[2])[CandidatePtr_[iGSF]];
632  myPFIso.sumPUPt=(*isolationValues[3])[CandidatePtr_[iGSF]];
633  myElectron.setPfIsolationVariables(myPFIso);
634  }
635 
636  gsfelectrons.push_back(myElectron);
637  }
638 
639 }
size
Write out results.
void MustacheID(const CaloClusterPtrVector &clusters, int &nclusters, float &EoutsideMustache)
Definition: Mustache.cc:162
std::vector< reco::GsfElectronCoreRef > gsfElectronCoreRefs_
float sumPUPt
sum pt of charged Particles not from PV (for Pu corrections)
Definition: GsfElectron.h:632
std::vector< reco::GsfTrackRef > GsfTrackRef_
float sumPhotonEt
sum pt of PF photons // old float photonIso ;
Definition: GsfElectron.h:627
float sumNeutralHadronEt
sum pt of neutral hadrons // old float neutralHadronIso ;
Definition: GsfElectron.h:626
std::vector< int > gsfPFCandidateIndex_
std::vector< reco::CandidatePtr > CandidatePtr_
std::vector< std::vector< reco::GsfTrackRef > > ambiguousGsfTracks_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
float sumChargedHadronPt
sum-pt of charged Hadron // old float chargedHadronIso ;
Definition: GsfElectron.h:625
void PFElectronTranslator::createPreshowerCluster ( const reco::PFBlockElement PFBE,
reco::PreshowerClusterCollection preshowerClusters,
unsigned  plane 
) const
private

Definition at line 310 of file PFElectronTranslator.cc.

References reco::PFBlockElement::clusterRef().

Referenced by produce().

311 {
312  reco::PFClusterRef myPFClusterRef= PFBE.clusterRef();
313  preshowerClusters.push_back(reco::PreshowerCluster(myPFClusterRef->energy(),myPFClusterRef->position(),
314  myPFClusterRef->hitsAndFractions(),plane));
315 }
virtual const PFClusterRef & clusterRef() const
void PFElectronTranslator::createPreshowerClusterPtrs ( const edm::OrphanHandle< reco::PreshowerClusterCollection > &  preshowerClustersHandle)
private

Definition at line 336 of file PFElectronTranslator.cc.

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

Referenced by produce().

337 {
338  unsigned size=GsfTrackRef_.size();
339  unsigned psClusterCounter=0;
340  preshowerClusterPtr_.resize(size);
341 
342  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
343  {
344  unsigned nbc=preshowerClusters_[iGSF].size();
345  for(unsigned ibc=0;ibc<nbc;++ibc) // loop on basic clusters
346  {
347  // std::cout << "Track "<< iGSF << " ref " << basicClusterCounter << std::endl;
348  reco::CaloClusterPtr psPtr(preshowerClustersHandle,psClusterCounter);
349  preshowerClusterPtr_[iGSF].push_back(psPtr);
350  ++psClusterCounter;
351  }
352  }
353 }
size
Write out results.
std::vector< reco::GsfTrackRef > GsfTrackRef_
std::vector< reco::PreshowerClusterCollection > preshowerClusters_
std::vector< reco::CaloClusterPtrVector > preshowerClusterPtr_
void PFElectronTranslator::createSuperClusterGsfMapRefs ( const edm::OrphanHandle< reco::SuperClusterCollection > &  superClustersHandle)
private

Definition at line 355 of file PFElectronTranslator.cc.

References GsfTrackRef_, scMap_, and findQualityFiles::size.

Referenced by produce().

356 {
357  unsigned size=GsfTrackRef_.size();
358 
359  for(unsigned iGSF=0;iGSF<size;++iGSF) // loop on tracks
360  {
361  edm::Ref<reco::SuperClusterCollection> scRef(superClustersHandle,iGSF);
362  scMap_[GsfTrackRef_[iGSF]]=scRef;
363  }
364 }
size
Write out results.
std::vector< reco::GsfTrackRef > GsfTrackRef_
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
void PFElectronTranslator::createSuperClusters ( const reco::PFCandidateCollection pfCand,
reco::SuperClusterCollection superClusters 
) const
private

Definition at line 438 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(), and reco::SuperCluster::setSeed().

Referenced by produce().

440 {
441  unsigned nGSF=GsfTrackRef_.size();
442  for(unsigned iGSF=0;iGSF<nGSF;++iGSF)
443  {
444 
445  // Computes energy position a la e/gamma
446  double sclusterE=0;
447  double posX=0.;
448  double posY=0.;
449  double posZ=0.;
450 
451  unsigned nbasics=basicClusters_[iGSF].size();
452  for(unsigned ibc=0;ibc<nbasics;++ibc)
453  {
454  double e = basicClusters_[iGSF][ibc].energy();
455  sclusterE += e;
456  posX += e * basicClusters_[iGSF][ibc].position().X();
457  posY += e * basicClusters_[iGSF][ibc].position().Y();
458  posZ += e * basicClusters_[iGSF][ibc].position().Z();
459  }
460  posX /=sclusterE;
461  posY /=sclusterE;
462  posZ /=sclusterE;
463 
464  if(pfCand[gsfPFCandidateIndex_[iGSF]].gsfTrackRef()!=GsfTrackRef_[iGSF])
465  {
466  edm::LogError("PFElectronTranslator") << " Major problem in PFElectron Translator" << std::endl;
467  }
468 
469  // compute the width
470  PFClusterWidthAlgo pfwidth(pfClusters_[iGSF]);
471 
472  double correctedEnergy=pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
473  reco::SuperCluster mySuperCluster(correctedEnergy,math::XYZPoint(posX,posY,posZ));
474  // protection against empty basic cluster collection ; the value is -2 in this case
475  if(nbasics)
476  {
477 // std::cout << "SuperCluster creation; energy " << pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
478 // std::cout << " " << pfCand[gsfPFCandidateIndex_[iGSF]].rawEcalEnergy() << std::endl;
479 // std::cout << "Seed energy from basic " << basicClusters_[iGSF][0].energy() << std::endl;
480  mySuperCluster.setSeed(basicClusterPtr_[iGSF][0]);
481  }
482  else
483  {
484  // std::cout << "SuperCluster creation ; seed energy " << 0 << std::endl;
485 // std::cout << "SuperCluster creation ; energy " << pfCand[gsfPFCandidateIndex_[iGSF]].ecalEnergy();
486 // std::cout << " " << pfCand[gsfPFCandidateIndex_[iGSF]].rawEcalEnergy() << std::endl;
487 // std::cout << " No seed found " << 0 << std::endl;
488 // std::cout << " MVA " << pfCand[gsfPFCandidateIndex_[iGSF]].mva_e_pi() << std::endl;
489  mySuperCluster.setSeed(reco::CaloClusterPtr());
490  }
491  // the seed should be the first basic cluster
492 
493  for(unsigned ibc=0;ibc<nbasics;++ibc)
494  {
495  mySuperCluster.addCluster(basicClusterPtr_[iGSF][ibc]);
496  // std::cout <<"Adding Ref to SC " << basicClusterPtr_[iGSF][ibc].index() << std::endl;
497  const std::vector< std::pair<DetId, float> > & v1 = basicClusters_[iGSF][ibc].hitsAndFractions();
498  // std::cout << " Number of cells " << v1.size() << std::endl;
499  for( std::vector< std::pair<DetId, float> >::const_iterator diIt = v1.begin();
500  diIt != v1.end();
501  ++diIt ) {
502  // std::cout << " Adding DetId " << (diIt->first).rawId() << " " << diIt->second << std::endl;
503  mySuperCluster.addHitAndFraction(diIt->first,diIt->second);
504  } // loop over rechits
505  }
506 
507  unsigned nps=preshowerClusterPtr_[iGSF].size();
508  for(unsigned ips=0;ips<nps;++ips)
509  {
510  mySuperCluster.addPreshowerCluster(preshowerClusterPtr_[iGSF][ips]);
511  }
512 
513 
514  // Set the preshower energy
515  mySuperCluster.setPreshowerEnergy(pfCand[gsfPFCandidateIndex_[iGSF]].pS1Energy()+
516  pfCand[gsfPFCandidateIndex_[iGSF]].pS2Energy());
517 
518  // Set the cluster width
519  mySuperCluster.setEtaWidth(pfwidth.pflowEtaWidth());
520  mySuperCluster.setPhiWidth(pfwidth.pflowPhiWidth());
521  // Force the computation of rawEnergy_ of the reco::SuperCluster
522  mySuperCluster.rawEnergy();
523  superClusters.push_back(mySuperCluster);
524  }
525 }
std::vector< std::vector< const reco::PFCluster * > > pfClusters_
std::vector< reco::CaloClusterPtrVector > basicClusterPtr_
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_
bool PFElectronTranslator::fetchCandidateCollection ( edm::Handle< reco::PFCandidateCollection > &  c,
const edm::InputTag tag,
const edm::Event iEvent 
) const
private

Definition at line 252 of file PFElectronTranslator.cc.

References emptyIsOk_, runEdmFileComparison::found, and edm::Event::getByLabel().

Referenced by fillMVAValueMap(), and produce().

254  {
255  bool found = iEvent.getByLabel(tag, c);
256 
257  if(!found && !emptyIsOk_)
258  {
259  std::ostringstream err;
260  err<<" cannot get PFCandidates: "
261  <<tag<<std::endl;
262  edm::LogError("PFElectronTranslator")<<err.str();
263  }
264  return found;
265 
266 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:416
void PFElectronTranslator::fetchGsfCollection ( edm::Handle< reco::GsfTrackCollection > &  c,
const edm::InputTag tag,
const edm::Event iEvent 
) const
private

Definition at line 268 of file PFElectronTranslator.cc.

References Exception, runEdmFileComparison::found, and edm::Event::getByLabel().

Referenced by fillMVAValueMap(), and fillSCRefValueMap().

270  {
271  bool found = iEvent.getByLabel(tag, c);
272 
273  if(!found ) {
274  std::ostringstream err;
275  err<<" cannot get GSFTracks: "
276  <<tag<<std::endl;
277  edm::LogError("PFElectronTranslator")<<err.str();
278  throw cms::Exception( "MissingProduct", err.str());
279  }
280 }
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:416
void PFElectronTranslator::fillMVAValueMap ( edm::Event iEvent,
edm::ValueMap< float >::Filler &  filler 
)
private

Definition at line 367 of file PFElectronTranslator.cc.

References reco::PFCandidate::e, fetchCandidateCollection(), fetchGsfCollection(), gsfMvaMap_, reco::PFCandidate::gsfTrackRef(), gedGsfElectronCores_cfi::gsfTracks, mps_fire::i, inputTagGSFTracks_, inputTagPFCandidateElectrons_, edm::helper::Filler< Map >::insert(), edm::Ref< C, T, F >::isNull(), reco::PFCandidate::mva_e_pi(), reco::PFCandidate::particleId(), slimmedMuons_cfi::pfCandidates, mps_update::status, and MuonErrorMatrixValues_cff::values.

Referenced by produce().

368 {
369  gsfMvaMap_.clear();
371  bool status=fetchCandidateCollection(pfCandidates,
373  iEvent );
374 
375  unsigned ncand=(status)?pfCandidates->size():0;
376  for( unsigned i=0; i<ncand; ++i ) {
377 
378  const reco::PFCandidate& cand = (*pfCandidates)[i];
379  if(cand.particleId()!=reco::PFCandidate::e) continue;
380  if(cand.gsfTrackRef().isNull()) continue;
381  // Fill the MVA map
382  gsfMvaMap_[cand.gsfTrackRef()]=cand.mva_e_pi();
383  }
384 
386  fetchGsfCollection(gsfTracks,
388  iEvent);
389  unsigned ngsf=gsfTracks->size();
390  std::vector<float> values;
391  for(unsigned igsf=0;igsf<ngsf;++igsf)
392  {
393  reco::GsfTrackRef theTrackRef(gsfTracks, igsf);
394  std::map<reco::GsfTrackRef,float>::const_iterator itcheck=gsfMvaMap_.find(theTrackRef);
395  if(itcheck==gsfMvaMap_.end())
396  {
397  // edm::LogWarning("PFElectronTranslator") << "MVA Map, missing GSF track ref " << std::endl;
398  values.push_back(-99.);
399  // std::cout << " Push_back -99. " << std::endl;
400  }
401  else
402  {
403  // std::cout << " Value " << itcheck->second << std::endl;
404  values.push_back(itcheck->second);
405  }
406  }
407  filler.insert(gsfTracks,values.begin(),values.end());
408 }
bool fetchCandidateCollection(edm::Handle< reco::PFCandidateCollection > &c, const edm::InputTag &tag, const edm::Event &iEvent) const
std::map< reco::GsfTrackRef, float > gsfMvaMap_
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
edm::InputTag inputTagPFCandidateElectrons_
bool isNull() const
Checks for null.
Definition: Ref.h:250
edm::InputTag inputTagGSFTracks_
float mva_e_pi() const
mva for electron-pion discrimination
Definition: PFCandidate.h:313
void fetchGsfCollection(edm::Handle< reco::GsfTrackCollection > &c, const edm::InputTag &tag, const edm::Event &iEvent) const
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:476
virtual ParticleType particleId() const
Definition: PFCandidate.h:373
void PFElectronTranslator::fillSCRefValueMap ( edm::Event iEvent,
edm::ValueMap< reco::SuperClusterRef >::Filler &  filler 
) const
private

Definition at line 411 of file PFElectronTranslator.cc.

References fetchGsfCollection(), gedGsfElectronCores_cfi::gsfTracks, inputTagGSFTracks_, edm::helper::Filler< Map >::insert(), scMap_, and MuonErrorMatrixValues_cff::values.

Referenced by produce().

413 {
415  fetchGsfCollection(gsfTracks,
417  iEvent);
418  unsigned ngsf=gsfTracks->size();
419  std::vector<reco::SuperClusterRef> values;
420  for(unsigned igsf=0;igsf<ngsf;++igsf)
421  {
422  reco::GsfTrackRef theTrackRef(gsfTracks, igsf);
423  std::map<reco::GsfTrackRef,reco::SuperClusterRef>::const_iterator itcheck=scMap_.find(theTrackRef);
424  if(itcheck==scMap_.end())
425  {
426  // edm::LogWarning("PFElectronTranslator") << "SCRef Map, missing GSF track ref" << std::endl;
427  values.push_back(reco::SuperClusterRef());
428  }
429  else
430  {
431  values.push_back(itcheck->second);
432  }
433  }
434  filler.insert(gsfTracks,values.begin(),values.end());
435 }
void insert(const H &h, I begin, I end)
Definition: ValueMap.h:53
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
edm::InputTag inputTagGSFTracks_
void fetchGsfCollection(edm::Handle< reco::GsfTrackCollection > &c, const edm::InputTag &tag, const edm::Event &iEvent) const
void PFElectronTranslator::fillValueMap ( edm::Event iEvent,
edm::ValueMap< float >::Filler &  filler 
) const
private
void PFElectronTranslator::getAmbiguousGsfTracks ( const reco::PFBlockElement PFBE,
std::vector< reco::GsfTrackRef > &  tracks 
) const
private

Definition at line 576 of file PFElectronTranslator.cc.

References reco::PFBlockElementGsfTrack::GsftrackRefPF().

Referenced by produce().

576  {
577  const reco::PFBlockElementGsfTrack * GsfEl = dynamic_cast<const reco::PFBlockElementGsfTrack*>(&PFBE);
578  if(GsfEl==0) return;
579  const std::vector<reco::GsfPFRecTrackRef>& ambPFRecTracks(GsfEl->GsftrackRefPF()->convBremGsfPFRecTrackRef());
580  unsigned ntracks=ambPFRecTracks.size();
581  for(unsigned it=0;it<ntracks;++it) {
582  tracks.push_back(ambPFRecTracks[it]->gsfTrackRef());
583  }
584 }
const GsfPFRecTrackRef & GsftrackRefPF() const
void PFElectronTranslator::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Definition at line 74 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, reco::PFCandidate::electronExtraRef(), allElectronIsolations_cfi::elements, reco::PFCandidate::elementsInBlocks(), fetchCandidateCollection(), fillMVAValueMap(), fillSCRefValueMap(), getAmbiguousGsfTracks(), edm::Event::getByLabel(), reco::PFBlockElement::GSF, GsfElectronCollection_, GsfElectronCoreCollection_, gsfElectronCoreRefs_, gsfPFCandidateIndex_, reco::PFCandidate::gsfTrackRef(), GsfTrackRef_, mps_fire::i, inputTagIsoVals_, inputTagPFCandidates_, edm::Ref< C, T, F >::isNull(), electronProducer_cff::isolationValues, kfTrackRef_, eostools::move(), reco::PFCandidate::mva_e_pi(), MVACut_, reco::PFCandidate::particleId(), PFBasicClusterCollection_, slimmedMuons_cfi::pfCandidates, pfClusters_, PFMVAValueMap_, PFPreshowerClusterCollection_, PFSCValueMap_, PFSuperClusterCollection_, preshowerClusterPtr_, preshowerClusters_, reco::PFBlockElement::PS1, reco::PFBlockElement::PS2, edm::Event::put(), scMap_, reco::PFCandidateElectronExtra::Selected, mps_update::status, superClusters_, reco::PFCandidate::trackRef(), and reco::PFBlockElement::type().

75  {
76 
77  auto gsfElectronCores_p = std::make_unique<reco::GsfElectronCoreCollection>();
78 
79  auto gsfElectrons_p = std::make_unique<reco::GsfElectronCollection>();
80 
81  auto superClusters_p = std::make_unique<reco::SuperClusterCollection>();
82 
83  auto basicClusters_p = std::make_unique<reco::BasicClusterCollection>();
84 
85  auto psClusters_p = std::make_unique<reco::PreshowerClusterCollection>();
86 
87  auto mvaMap_p = std::make_unique<edm::ValueMap<float>>();
88  edm::ValueMap<float>::Filler mvaFiller(*mvaMap_p);
89 
90  auto scMap_p = std::make_unique<edm::ValueMap<reco::SuperClusterRef>>();
92 
93 
95  bool status=fetchCandidateCollection(pfCandidates,
97  iEvent );
98 
100  for (size_t j = 0; j<inputTagIsoVals_.size(); ++j) {
102  }
103 
104 
105  // clear the vectors
106  GsfTrackRef_.clear();
107  CandidatePtr_.clear();
108  ambiguousGsfTracks_.clear();
109  kfTrackRef_.clear();
110  basicClusters_.clear();
111  pfClusters_.clear();
112  preshowerClusters_.clear();
113  superClusters_.clear();
114  basicClusterPtr_.clear();
115  preshowerClusterPtr_.clear();
116  gsfPFCandidateIndex_.clear();
117  gsfElectronCoreRefs_.clear();
118  scMap_.clear();
119 
120 
121  // loop on the candidates
122  //CC@@
123  // we need first to create AND put the SuperCluster,
124  // basic clusters and presh clusters collection
125  // in order to get a working Handle
126  unsigned ncand=(status)?pfCandidates->size():0;
127  unsigned iGSF=0;
128  for( unsigned i=0; i<ncand; ++i ) {
129 
130  const reco::PFCandidate& cand = (*pfCandidates)[i];
131  if(cand.particleId()!=reco::PFCandidate::e) continue;
132  if(cand.gsfTrackRef().isNull()) continue;
133  // Note that -1 will still cut some total garbage candidates
134  // Fill the MVA map
135  if(cand.mva_e_pi()<MVACut_) continue;
136 
137  // Check the status flag
139  continue;
140  }
141 
142  GsfTrackRef_.push_back(cand.gsfTrackRef());
143  kfTrackRef_.push_back(cand.trackRef());
144  gsfPFCandidateIndex_.push_back(i);
145 
146  reco::PFCandidatePtr ptrToPFElectron(pfCandidates,i);
147  //CandidatePtr_.push_back(ptrToPFElectron->sourceCandidatePtr(0));
148  CandidatePtr_.push_back(ptrToPFElectron);
149 
151  pfClusters_.push_back(std::vector<const reco::PFCluster *>());
153  ambiguousGsfTracks_.push_back(std::vector<reco::GsfTrackRef>());
154 
155  for(unsigned iele=0; iele<cand.elementsInBlocks().size(); ++iele) {
156  // first get the block
157  reco::PFBlockRef blockRef = cand.elementsInBlocks()[iele].first;
158  //
159  unsigned elementIndex = cand.elementsInBlocks()[iele].second;
160  // check it actually exists
161  if(blockRef.isNull()) continue;
162 
163  // then get the elements of the block
164  const edm::OwnVector< reco::PFBlockElement >& elements = (*blockRef).elements();
165 
166  const reco::PFBlockElement & pfbe (elements[elementIndex]);
167  // The first ECAL element should be the cluster associated to the GSF; defined as the seed
168  if(pfbe.type()==reco::PFBlockElement::ECAL)
169  {
170  // const reco::PFCandidate * coCandidate = &cand;
171  // the Brem photons are saved as daughter PFCandidate; this
172  // is convenient to access the corrected energy
173  // std::cout << " Found candidate " << correspondingDaughterCandidate(coCandidate,pfbe) << " " << coCandidate << std::endl;
175  }
176  if(pfbe.type()==reco::PFBlockElement::PS1)
177  {
179  }
180  if(pfbe.type()==reco::PFBlockElement::PS2)
181  {
183  }
184  if(pfbe.type()==reco::PFBlockElement::GSF)
185  {
187  }
188 
189  } // loop on the elements
190 
191  // save the basic clusters
192  basicClusters_p->insert(basicClusters_p->end(),basicClusters_[iGSF].begin(), basicClusters_[iGSF].end());
193  // save the preshower clusters
194  psClusters_p->insert(psClusters_p->end(),preshowerClusters_[iGSF].begin(),preshowerClusters_[iGSF].end());
195 
196  ++iGSF;
197  } // loop on PFCandidates
198 
199 
200  //Save the basic clusters and get an handle as to be able to create valid Refs (thanks to Claude)
201  // std::cout << " Number of basic clusters " << basicClusters_p->size() << std::endl;
203  iEvent.put(std::move(basicClusters_p),PFBasicClusterCollection_);
204 
205  //preshower clusters
207  iEvent.put(std::move(psClusters_p),PFPreshowerClusterCollection_);
208 
209  // now that the Basic clusters are in the event, the Ref can be created
210  createBasicClusterPtrs(bcRefProd);
211  // now that the preshower clusters are in the event, the Ref can be created
212  createPreshowerClusterPtrs(psRefProd);
213 
214  // and now the Super cluster can be created with valid references
215  if(status) createSuperClusters(*pfCandidates,*superClusters_p);
216 
217  // Let's put the super clusters in the event
219  // create the super cluster Ref
220  createSuperClusterGsfMapRefs(scRefProd);
221 
222  // Now create the GsfElectronCoers
223  createGsfElectronCores(*gsfElectronCores_p);
224  // Put them in the as to get to be able to build a Ref
225  const edm::OrphanHandle<reco::GsfElectronCoreCollection> gsfElectronCoreRefProd =
226  iEvent.put(std::move(gsfElectronCores_p),GsfElectronCoreCollection_);
227 
228  // now create the Refs
229  createGsfElectronCoreRefs(gsfElectronCoreRefProd);
230 
231  // now make the GsfElectron
232  createGsfElectrons(*pfCandidates,isolationValues,*gsfElectrons_p);
233  iEvent.put(std::move(gsfElectrons_p),GsfElectronCollection_);
234 
235  fillMVAValueMap(iEvent,mvaFiller);
236  mvaFiller.fill();
237 
238  fillSCRefValueMap(iEvent,scRefFiller);
239  scRefFiller.fill();
240 
241  // MVA map
242  iEvent.put(std::move(mvaMap_p),PFMVAValueMap_);
243  // Gsf-SC map
244  iEvent.put(std::move(scMap_p),PFSCValueMap_);
245 
246 
247 
248 }
std::vector< std::vector< const reco::PFCluster * > > pfClusters_
std::string PFPreshowerClusterCollection_
Abstract base class for a PFBlock element (track, cluster...)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
bool fetchCandidateCollection(edm::Handle< reco::PFCandidateCollection > &c, const edm::InputTag &tag, const edm::Event &iEvent) const
void createGsfElectronCoreRefs(const edm::OrphanHandle< reco::GsfElectronCoreCollection > &gsfElectronCoreHandle)
std::vector< edm::Handle< edm::ValueMap< double > > > IsolationValueMaps
std::vector< reco::CaloClusterPtrVector > basicClusterPtr_
std::vector< reco::GsfElectronCoreRef > gsfElectronCoreRefs_
void createBasicClusterPtrs(const edm::OrphanHandle< reco::BasicClusterCollection > &basicClustersHandle)
std::string GsfElectronCollection_
void fillSCRefValueMap(edm::Event &iEvent, edm::ValueMap< reco::SuperClusterRef >::Filler &filler) const
reco::TrackRef trackRef() const
Definition: PFCandidate.cc:438
std::vector< reco::GsfTrackRef > GsfTrackRef_
void fillMVAValueMap(edm::Event &iEvent, edm::ValueMap< float >::Filler &filler)
const reco::PFCandidate & correspondingDaughterCandidate(const reco::PFCandidate &cand, const reco::PFBlockElement &pfbe) const
std::vector< reco::PreshowerClusterCollection > preshowerClusters_
void createSuperClusterGsfMapRefs(const edm::OrphanHandle< reco::SuperClusterCollection > &superClustersHandle)
std::vector< PreshowerCluster > PreshowerClusterCollection
collection of PreshowerCluster objects
std::vector< int > gsfPFCandidateIndex_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:416
bool isNull() const
Checks for null.
Definition: Ref.h:250
std::vector< reco::CandidatePtr > CandidatePtr_
edm::InputTag inputTagPFCandidates_
std::vector< std::vector< reco::GsfTrackRef > > ambiguousGsfTracks_
std::map< reco::GsfTrackRef, reco::SuperClusterRef > scMap_
float mva_e_pi() const
mva for electron-pion discrimination
Definition: PFCandidate.h:313
reco::PFCandidateElectronExtraRef electronExtraRef() const
return a reference to the electron extra
Definition: PFCandidate.cc:589
std::string PFBasicClusterCollection_
void createBasicCluster(const reco::PFBlockElement &, reco::BasicClusterCollection &basicClusters, std::vector< const reco::PFCluster * > &, const reco::PFCandidate &coCandidate) const
std::vector< reco::SuperClusterCollection > superClusters_
std::vector< reco::CaloClusterPtrVector > preshowerClusterPtr_
void createSuperClusters(const reco::PFCandidateCollection &, reco::SuperClusterCollection &superClusters) const
void getAmbiguousGsfTracks(const reco::PFBlockElement &PFBE, std::vector< reco::GsfTrackRef > &) const
std::string GsfElectronCoreCollection_
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
std::vector< edm::InputTag > inputTagIsoVals_
std::vector< reco::BasicClusterCollection > basicClusters_
Particle reconstructed by the particle flow algorithm.
Definition: PFCandidate.h:39
std::vector< reco::TrackRef > kfTrackRef_
void createPreshowerCluster(const reco::PFBlockElement &PFBE, reco::PreshowerClusterCollection &preshowerClusters, unsigned plane) const
reco::GsfTrackRef gsfTrackRef() const
Definition: PFCandidate.cc:476
std::string PFSuperClusterCollection_
void createGsfElectronCores(reco::GsfElectronCoreCollection &) const
virtual ParticleType particleId() const
Definition: PFCandidate.h:373
void createGsfElectrons(const reco::PFCandidateCollection &, const IsolationValueMaps &isolationValues, reco::GsfElectronCollection &)
const ElementsInBlocks & elementsInBlocks() const
Definition: PFCandidate.cc:687
void createPreshowerClusterPtrs(const edm::OrphanHandle< reco::PreshowerClusterCollection > &preshowerClustersHandle)
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

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

Definition at line 110 of file PFElectronTranslator.h.

Referenced by createGsfElectrons(), and produce().

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

Definition at line 120 of file PFElectronTranslator.h.

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

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

Definition at line 112 of file PFElectronTranslator.h.

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

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

Definition at line 106 of file PFElectronTranslator.h.

Referenced by createGsfElectrons(), and produce().

bool PFElectronTranslator::checkStatusFlag_
private

Definition at line 100 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

bool PFElectronTranslator::emptyIsOk_
private

Definition at line 131 of file PFElectronTranslator.h.

Referenced by fetchCandidateCollection(), and PFElectronTranslator().

std::string PFElectronTranslator::GsfElectronCollection_
private

Definition at line 98 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

std::string PFElectronTranslator::GsfElectronCoreCollection_
private

Definition at line 97 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

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

Definition at line 124 of file PFElectronTranslator.h.

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

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

Definition at line 129 of file PFElectronTranslator.h.

Referenced by fillMVAValueMap().

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

Definition at line 126 of file PFElectronTranslator.h.

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

std::vector<reco::GsfTrackRef> PFElectronTranslator::GsfTrackRef_
private
edm::InputTag PFElectronTranslator::inputTagGSFTracks_
private

Definition at line 90 of file PFElectronTranslator.h.

Referenced by fillMVAValueMap(), fillSCRefValueMap(), and PFElectronTranslator().

std::vector<edm::InputTag> PFElectronTranslator::inputTagIsoVals_
private

Definition at line 91 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

edm::InputTag PFElectronTranslator::inputTagPFCandidateElectrons_
private

Definition at line 89 of file PFElectronTranslator.h.

Referenced by fillMVAValueMap(), and PFElectronTranslator().

edm::InputTag PFElectronTranslator::inputTagPFCandidates_
private

Definition at line 88 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

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

Definition at line 108 of file PFElectronTranslator.h.

Referenced by createGsfElectronCores(), and produce().

double PFElectronTranslator::MVACut_
private

Definition at line 99 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

std::string PFElectronTranslator::PFBasicClusterCollection_
private

Definition at line 92 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

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

Definition at line 114 of file PFElectronTranslator.h.

Referenced by createSuperClusters(), and produce().

std::string PFElectronTranslator::PFMVAValueMap_
private

Definition at line 95 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

std::string PFElectronTranslator::PFPreshowerClusterCollection_
private

Definition at line 93 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

std::string PFElectronTranslator::PFSCValueMap_
private

Definition at line 96 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

std::string PFElectronTranslator::PFSuperClusterCollection_
private

Definition at line 94 of file PFElectronTranslator.h.

Referenced by PFElectronTranslator(), and produce().

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

Definition at line 116 of file PFElectronTranslator.h.

Referenced by createPreshowerClusterPtrs(), and produce().

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

Definition at line 118 of file PFElectronTranslator.h.

Referenced by produce().