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 hasAbilityToProduceInLumis () const final
 
bool hasAbilityToProduceInRuns () 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 ( 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.

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

Definition at line 62 of file ElectronSeedTrackRefFix.cc.

63 {
64  // do anything here that needs to be done at desctruction time
65  // (e.g. close files, deallocate resources etc.)
66 }

Member Function Documentation

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

Definition at line 109 of file ElectronSeedTrackRefFix.cc.

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

109  {
110  //The following says we do not know what parameters are allowed so do no validation
111  // Please change this to state exactly what you do use, even if it is no parameters
113  desc.setUnknown();
114  descriptions.addDefault(desc);
115 }
void addDefault(ParameterSetDescription const &psetDescription)
void ElectronSeedTrackRefFix::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 69 of file ElectronSeedTrackRefFix.cc.

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

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

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

Member Data Documentation

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

Definition at line 31 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

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

Definition at line 37 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

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

Definition at line 30 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

edm::InputTag ElectronSeedTrackRefFix::newTracksTag_
private

Definition at line 35 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix().

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

Definition at line 27 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

edm::InputTag ElectronSeedTrackRefFix::oldTracksTag_
private

Definition at line 34 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix().

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

Definition at line 28 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

std::string ElectronSeedTrackRefFix::preidgsfLabel_
private

Definition at line 32 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

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

Definition at line 33 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().

edm::InputTag ElectronSeedTrackRefFix::seedsTag_
private

Definition at line 36 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix().

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

Definition at line 29 of file ElectronSeedTrackRefFix.h.

Referenced by ElectronSeedTrackRefFix(), and produce().