CMS 3D CMS Logo

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

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &)
 

Private Attributes

const edm::EDGetTokenT< reco::GsfTrackCollectiongsfTracks_
 
const std::vector< std::string > names_
 
const edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > preIdsValueMap_
 

Additional Inherited Members

- 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
 

Detailed Description

Definition at line 21 of file LowPtGsfElectronSeedValueMapsProducer.cc.

Constructor & Destructor Documentation

◆ LowPtGsfElectronSeedValueMapsProducer()

LowPtGsfElectronSeedValueMapsProducer::LowPtGsfElectronSeedValueMapsProducer ( const edm::ParameterSet conf)
explicit

Definition at line 37 of file LowPtGsfElectronSeedValueMapsProducer.cc.

38  : gsfTracks_(consumes<reco::GsfTrackCollection>(conf.getParameter<edm::InputTag>("gsfTracks"))),
39  preIdsValueMap_(consumes<edm::ValueMap<reco::PreIdRef> >(conf.getParameter<edm::InputTag>("preIdsValueMap"))),
40  names_(conf.getParameter<std::vector<std::string> >("ModelNames")) {
41  for (const auto& name : names_) {
42  produces<edm::ValueMap<float> >(name);
43  }
44 }

References Skims_PA_cff::name, and names_.

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 95 of file LowPtGsfElectronSeedValueMapsProducer.cc.

95  {
97  desc.add<edm::InputTag>("gsfTracks", edm::InputTag("lowPtGsfEleGsfTracks"));
98  desc.add<edm::InputTag>("preIdsValueMap", edm::InputTag("lowPtGsfElectronSeeds"));
99  desc.add<std::vector<std::string> >("ModelNames", {"unbiased", "ptbiased"});
100  descriptions.add("lowPtGsfElectronSeedValueMaps", desc);
101 }

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and HLT_2018_cff::InputTag.

◆ produce()

void LowPtGsfElectronSeedValueMapsProducer::produce ( edm::Event event,
const edm::EventSetup setup 
)
override

Definition at line 48 of file LowPtGsfElectronSeedValueMapsProducer.cc.

48  {
49  // Retrieve GsfTracks from Event
51  event.getByToken(gsfTracks_, gsfTracks);
52  if (!gsfTracks.isValid()) {
53  edm::LogError("Problem with gsfTracks handle");
54  }
55 
56  // Retrieve PreIds from Event
58  event.getByToken(preIdsValueMap_, preIdsValueMap);
59  if (!preIdsValueMap.isValid()) {
60  edm::LogError("Problem with preIdsValueMap handle");
61  }
62 
63  // Iterate through GsfTracks, extract BDT output, and store result in ValueMap for each model
64  std::vector<std::vector<float> > output;
65  for (unsigned int iname = 0; iname < names_.size(); ++iname) {
66  output.push_back(std::vector<float>(gsfTracks->size(), -999.));
67  }
68  for (unsigned int igsf = 0; igsf < gsfTracks->size(); igsf++) {
70  if (gsf.isNonnull() && gsf->extra().isNonnull() && gsf->extra()->seedRef().isNonnull()) {
71  reco::ElectronSeedRef seed = gsf->extra()->seedRef().castTo<reco::ElectronSeedRef>();
72  if (seed.isNonnull() && seed->ctfTrack().isNonnull()) {
73  const reco::PreIdRef preid = (*preIdsValueMap)[seed->ctfTrack()];
74  if (preid.isNonnull()) {
75  for (unsigned int iname = 0; iname < names_.size(); ++iname) {
76  output[iname][igsf] = preid->mva(iname);
77  }
78  }
79  }
80  }
81  }
82 
83  // Create and put ValueMap in Event
84  for (unsigned int iname = 0; iname < names_.size(); ++iname) {
85  auto ptr = std::make_unique<edm::ValueMap<float> >(edm::ValueMap<float>());
87  filler.insert(gsfTracks, output[iname].begin(), output[iname].end());
88  filler.fill();
89  event.put(std::move(ptr), names_[iname]);
90  }
91 }

References begin, end, trigObjTnPSource_cfi::filler, ntupleEnum::gsf, ecalDrivenGsfElectronCoresFromMultiCl_cff::gsfTracks, gsfTracks_, edm::Ref< C, T, F >::isNonnull(), edm::HandleBase::isValid(), eostools::move(), names_, convertSQLitetoXML_cfg::output, preIdsValueMap_, and SurveyInfoScenario_cff::seed.

Member Data Documentation

◆ gsfTracks_

const edm::EDGetTokenT<reco::GsfTrackCollection> LowPtGsfElectronSeedValueMapsProducer::gsfTracks_
private

Definition at line 30 of file LowPtGsfElectronSeedValueMapsProducer.cc.

Referenced by produce().

◆ names_

const std::vector<std::string> LowPtGsfElectronSeedValueMapsProducer::names_
private

◆ preIdsValueMap_

const edm::EDGetTokenT<edm::ValueMap<reco::PreIdRef> > LowPtGsfElectronSeedValueMapsProducer::preIdsValueMap_
private

Definition at line 31 of file LowPtGsfElectronSeedValueMapsProducer.cc.

Referenced by produce().

edm::ParameterSetDescription::add
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:95
LowPtGsfElectronSeedValueMapsProducer::preIdsValueMap_
const edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > preIdsValueMap_
Definition: LowPtGsfElectronSeedValueMapsProducer.cc:31
convertSQLitetoXML_cfg.output
output
Definition: convertSQLitetoXML_cfg.py:32
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
edm::Handle< reco::GsfTrackCollection >
end
#define end
Definition: vmac.h:39
edm::Ref< GsfTrackCollection >
edm::ConfigurationDescriptions::add
void add(std::string const &label, ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:57
ecalDrivenGsfElectronCoresFromMultiCl_cff.gsfTracks
gsfTracks
Definition: ecalDrivenGsfElectronCoresFromMultiCl_cff.py:4
LowPtGsfElectronSeedValueMapsProducer::names_
const std::vector< std::string > names_
Definition: LowPtGsfElectronSeedValueMapsProducer.cc:32
HLT_2018_cff.InputTag
InputTag
Definition: HLT_2018_cff.py:79016
edm::LogError
Definition: MessageLogger.h:183
LowPtGsfElectronSeedValueMapsProducer::gsfTracks_
const edm::EDGetTokenT< reco::GsfTrackCollection > gsfTracks_
Definition: LowPtGsfElectronSeedValueMapsProducer.cc:30
trigObjTnPSource_cfi.filler
filler
Definition: trigObjTnPSource_cfi.py:21
edm::Ref::isNonnull
bool isNonnull() const
Checks for non-null.
Definition: Ref.h:238
ntupleEnum.gsf
gsf
Definition: ntupleEnum.py:48
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::ValueMap
Definition: ValueMap.h:107
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
edm::helper::Filler
Definition: ValueMap.h:22
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
edm::InputTag
Definition: InputTag.h:15
begin
#define begin
Definition: vmac.h:32
SurveyInfoScenario_cff.seed
seed
Definition: SurveyInfoScenario_cff.py:295