CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
ElectronSeedTrackRefFix Class Reference

#include <ElectronSeedTrackRefFix.h>

Inheritance diagram for ElectronSeedTrackRefFix:
edm::stream::EDProducer<>

Public Member Functions

 ElectronSeedTrackRefFix (const edm::ParameterSet &)
 
 ~ElectronSeedTrackRefFix () 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

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

std::vector< edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > > idMapToken_
 
std::vector< edm::InputTagidsTag_
 
std::vector< edm::EDGetTokenT< reco::PreIdCollection > > idsToken_
 
edm::InputTag newTracksTag_
 
edm::EDGetTokenT< reco::TrackCollectionnewTracksToken_
 
edm::InputTag oldTracksTag_
 
edm::EDGetTokenT< reco::TrackCollectionoldTracksToken_
 
std::string preidgsfLabel_
 
std::vector< std::string > preidLabel_
 
edm::InputTag seedsTag_
 
edm::EDGetTokenT< reco::ElectronSeedCollectionseedsToken_
 

Additional Inherited Members

- 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
 

Detailed Description

Definition at line 12 of file ElectronSeedTrackRefFix.h.

Constructor & Destructor Documentation

◆ ElectronSeedTrackRefFix()

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

Definition at line 33 of file ElectronSeedTrackRefFix.cc.

References edm::ParameterSet::getParameter(), idMapToken_, idsTag_, idsToken_, newTracksTag_, newTracksToken_, oldTracksTag_, oldTracksToken_, preidgsfLabel_, preidLabel_, seedsTag_, seedsToken_, and AlCaHLTBitMon_QueryRunRegistry::string.

33  {
34  // read parameters
35  preidgsfLabel_ = iConfig.getParameter<std::string>("PreGsfLabel");
36  preidLabel_ = iConfig.getParameter<std::vector<std::string>>("PreIdLabel");
37  oldTracksTag_ = iConfig.getParameter<edm::InputTag>("oldTrackCollection");
38  newTracksTag_ = iConfig.getParameter<edm::InputTag>("newTrackCollection");
39  seedsTag_ = iConfig.getParameter<edm::InputTag>("seedCollection");
40  idsTag_ = iConfig.getParameter<std::vector<edm::InputTag>>("idCollection");
41 
42  //register your products
43  produces<reco::ElectronSeedCollection>(preidgsfLabel_);
44  for (const auto& idLabel : preidLabel_) {
45  produces<reco::PreIdCollection>(idLabel);
46  produces<edm::ValueMap<reco::PreIdRef>>(idLabel);
47  }
48 
49  //create tokens
50  oldTracksToken_ = consumes<reco::TrackCollection>(oldTracksTag_);
51  newTracksToken_ = consumes<reco::TrackCollection>(newTracksTag_);
52  seedsToken_ = consumes<reco::ElectronSeedCollection>(seedsTag_);
53  for (const auto& idTag : idsTag_) {
54  idsToken_.emplace_back(consumes<reco::PreIdCollection>(idTag));
55  idMapToken_.emplace_back(consumes<edm::ValueMap<reco::PreIdRef>>(idTag));
56  }
57 }
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
edm::EDGetTokenT< reco::TrackCollection > newTracksToken_
std::vector< std::string > preidLabel_
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsToken_
std::vector< edm::EDGetTokenT< reco::PreIdCollection > > idsToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > > idMapToken_
std::vector< edm::InputTag > idsTag_
edm::EDGetTokenT< reco::TrackCollection > oldTracksToken_

◆ ~ElectronSeedTrackRefFix()

ElectronSeedTrackRefFix::~ElectronSeedTrackRefFix ( )
override

Definition at line 59 of file ElectronSeedTrackRefFix.cc.

59  {
60  // do anything here that needs to be done at desctruction time
61  // (e.g. close files, deallocate resources etc.)
62 }

Member Function Documentation

◆ fillDescriptions()

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

Definition at line 103 of file ElectronSeedTrackRefFix.cc.

References edm::ConfigurationDescriptions::addDefault(), and submitPVResolutionJobs::desc.

103  {
104  //The following says we do not know what parameters are allowed so do no validation
105  // Please change this to state exactly what you do use, even if it is no parameters
107  desc.setUnknown();
108  descriptions.addDefault(desc);
109 }
void addDefault(ParameterSetDescription const &psetDescription)

◆ produce()

void ElectronSeedTrackRefFix::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 65 of file ElectronSeedTrackRefFix.cc.

References mps_fire::i, idMapToken_, idsTag_, idsToken_, iEvent, eostools::move(), newTracksToken_, oldTracksToken_, preidgsfLabel_, preidLabel_, alignCSCRings::s, seedsToken_, findQualityFiles::size, and contentValuesCheck::values.

65  {
66  auto oldTracks = getHandle(iEvent, oldTracksToken_);
67  auto newTracks = getHandle(iEvent, newTracksToken_);
68  auto iSeeds = getHandle(iEvent, seedsToken_);
69 
70  auto oSeeds = std::make_unique<reco::ElectronSeedCollection>();
71  for (unsigned int s = 0; s < iSeeds->size(); ++s) {
72  oSeeds->push_back(iSeeds->at(s));
73  reco::TrackRef newTrackRef(newTracks, oSeeds->back().ctfTrack().index());
74  oSeeds->back().setCtfTrack(newTrackRef);
75  }
76  iEvent.put(std::move(oSeeds), preidgsfLabel_);
77 
78  for (size_t idNr = 0; idNr < idsTag_.size(); idNr++) {
79  auto iIds = getHandle(iEvent, idsToken_[idNr]);
80  auto oIds = std::make_unique<reco::PreIdCollection>();
81  for (unsigned int i = 0; i < iIds->size(); ++i) {
82  oIds->push_back(iIds->at(i));
83  reco::TrackRef newTrackRef(newTracks, oIds->back().trackRef().index());
84  oIds->back().setTrack(newTrackRef);
85  }
86  const edm::OrphanHandle<reco::PreIdCollection> preIdProd = iEvent.put(std::move(oIds), preidLabel_[idNr]);
87 
88  auto iIdMap = getHandle(iEvent, idMapToken_[idNr]);
89  std::vector<reco::PreIdRef> values;
90  for (size_t trkNr = 0; trkNr < newTracks->size(); ++trkNr) {
91  //low pt electron seeds do not make the idMaps so this is now optional to fill in a useful way
92  if (trkNr < oldTracks->size() && iIdMap.isValid()) {
93  reco::TrackRef oldTrackRef(oldTracks, trkNr);
94  values.push_back(reco::PreIdRef(preIdProd, (*(iIdMap.product()))[oldTrackRef].index()));
95  } else
96  values.push_back(reco::PreIdRef());
97  }
98  addVMToEvent(iEvent, newTracks, std::move(values), preidLabel_[idNr]);
99  } //end loop over ids
100 }
size
Write out results.
edm::EDGetTokenT< reco::TrackCollection > newTracksToken_
std::vector< std::string > preidLabel_
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsToken_
int iEvent
Definition: GenABIO.cc:224
std::vector< edm::EDGetTokenT< reco::PreIdCollection > > idsToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > > idMapToken_
std::vector< edm::InputTag > idsTag_
edm::EDGetTokenT< reco::TrackCollection > oldTracksToken_
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ idMapToken_

std::vector<edm::EDGetTokenT<edm::ValueMap<reco::PreIdRef> > > ElectronSeedTrackRefFix::idMapToken_
private

Definition at line 28 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

◆ idsTag_

std::vector<edm::InputTag> ElectronSeedTrackRefFix::idsTag_
private

Definition at line 34 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

◆ idsToken_

std::vector<edm::EDGetTokenT<reco::PreIdCollection> > ElectronSeedTrackRefFix::idsToken_
private

Definition at line 27 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

◆ newTracksTag_

edm::InputTag ElectronSeedTrackRefFix::newTracksTag_
private

Definition at line 32 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix().

◆ newTracksToken_

edm::EDGetTokenT<reco::TrackCollection> ElectronSeedTrackRefFix::newTracksToken_
private

Definition at line 24 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

◆ oldTracksTag_

edm::InputTag ElectronSeedTrackRefFix::oldTracksTag_
private

Definition at line 31 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix().

◆ oldTracksToken_

edm::EDGetTokenT<reco::TrackCollection> ElectronSeedTrackRefFix::oldTracksToken_
private

Definition at line 25 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

◆ preidgsfLabel_

std::string ElectronSeedTrackRefFix::preidgsfLabel_
private

Definition at line 29 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

◆ preidLabel_

std::vector<std::string> ElectronSeedTrackRefFix::preidLabel_
private

Definition at line 30 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

◆ seedsTag_

edm::InputTag ElectronSeedTrackRefFix::seedsTag_
private

Definition at line 33 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix().

◆ seedsToken_

edm::EDGetTokenT<reco::ElectronSeedCollection> ElectronSeedTrackRefFix::seedsToken_
private

Definition at line 26 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().