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
 
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 &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<>
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 12 of file ElectronSeedTrackRefFix.h.

Constructor & Destructor Documentation

◆ ElectronSeedTrackRefFix()

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

Definition at line 33 of file ElectronSeedTrackRefFix.cc.

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 }

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

◆ ~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.

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 }

References edm::ConfigurationDescriptions::addDefault(), and edm::ParameterSetDescription::setUnknown().

◆ produce()

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

Definition at line 65 of file ElectronSeedTrackRefFix.cc.

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 }

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

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().

ElectronSeedTrackRefFix::idMapToken_
std::vector< edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > > idMapToken_
Definition: ElectronSeedTrackRefFix.h:28
mps_fire.i
i
Definition: mps_fire.py:355
ElectronSeedTrackRefFix::seedsTag_
edm::InputTag seedsTag_
Definition: ElectronSeedTrackRefFix.h:33
ElectronSeedTrackRefFix::idsToken_
std::vector< edm::EDGetTokenT< reco::PreIdCollection > > idsToken_
Definition: ElectronSeedTrackRefFix.h:27
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
ElectronSeedTrackRefFix::seedsToken_
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsToken_
Definition: ElectronSeedTrackRefFix.h:26
ElectronSeedTrackRefFix::idsTag_
std::vector< edm::InputTag > idsTag_
Definition: ElectronSeedTrackRefFix.h:34
ElectronSeedTrackRefFix::preidLabel_
std::vector< std::string > preidLabel_
Definition: ElectronSeedTrackRefFix.h:30
edm::Ref< TrackCollection >
ElectronSeedTrackRefFix::newTracksToken_
edm::EDGetTokenT< reco::TrackCollection > newTracksToken_
Definition: ElectronSeedTrackRefFix.h:24
alignCSCRings.s
s
Definition: alignCSCRings.py:92
contentValuesCheck.values
values
Definition: contentValuesCheck.py:38
ElectronSeedTrackRefFix::newTracksTag_
edm::InputTag newTracksTag_
Definition: ElectronSeedTrackRefFix.h:32
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ElectronSeedTrackRefFix::oldTracksToken_
edm::EDGetTokenT< reco::TrackCollection > oldTracksToken_
Definition: ElectronSeedTrackRefFix.h:25
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::ParameterSetDescription::setUnknown
void setUnknown()
Definition: ParameterSetDescription.cc:39
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
eostools.move
def move(src, dest)
Definition: eostools.py:511
edm::OrphanHandle
Definition: EDProductfwd.h:39
edm::ValueMap
Definition: ValueMap.h:107
ElectronSeedTrackRefFix::oldTracksTag_
edm::InputTag oldTracksTag_
Definition: ElectronSeedTrackRefFix.h:31
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
ElectronSeedTrackRefFix::preidgsfLabel_
std::string preidgsfLabel_
Definition: ElectronSeedTrackRefFix.h:29
edm::InputTag
Definition: InputTag.h:15
findQualityFiles.size
size
Write out results.
Definition: findQualityFiles.py:443