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

edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > idMapToken
 
edm::InputTag idsTag
 
edm::EDGetTokenT< reco::PreIdCollectionidsToken
 
edm::InputTag newTracksTag
 
edm::EDGetTokenT< reco::TrackCollectionnewTracksToken
 
edm::InputTag oldTracksTag
 
edm::EDGetTokenT< reco::TrackCollectionoldTracksToken
 
std::string preidgsfLabel
 
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 18 of file ElectronSeedTrackRefFix.h.

Constructor & Destructor Documentation

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

Definition at line 26 of file ElectronSeedTrackRefFix.cc.

References edm::ParameterSet::getParameter(), and gedGsfElectrons_cfi::seedsTag.

27 {
28  // read parameters
29  preidgsfLabel = iConfig.getParameter<string>("PreGsfLabel");
30  preidLabel= iConfig.getParameter<string>("PreIdLabel");
31  oldTracksTag = iConfig.getParameter<InputTag>("oldTrackCollection");
32  newTracksTag = iConfig.getParameter<InputTag>("newTrackCollection");
33  seedsTag = iConfig.getParameter<InputTag>("seedCollection");
34  idsTag = iConfig.getParameter<InputTag>("idCollection");
35 
36  //register your products
37  produces<reco::ElectronSeedCollection>(preidgsfLabel);
38  produces<reco::PreIdCollection>(preidLabel);
39  produces<ValueMap<reco::PreIdRef> >(preidLabel);
40 
41  //create tokens
42  oldTracksToken = consumes<reco::TrackCollection>(oldTracksTag);
43  newTracksToken = consumes<reco::TrackCollection>(newTracksTag);
44  seedsToken = consumes<reco::ElectronSeedCollection>(seedsTag);
45  idsToken = consumes<reco::PreIdCollection >(idsTag);
46  idMapToken = consumes<ValueMap<reco::PreIdRef> >(idsTag) ;
47 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::TrackCollection > newTracksToken
edm::EDGetTokenT< reco::TrackCollection > oldTracksToken
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsToken
edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > idMapToken
edm::EDGetTokenT< reco::PreIdCollection > idsToken
ElectronSeedTrackRefFix::~ElectronSeedTrackRefFix ( )
override

Definition at line 50 of file ElectronSeedTrackRefFix.cc.

51 {
52 
53  // do anything here that needs to be done at desctruction time
54  // (e.g. close files, deallocate resources etc.)
55 
56 }

Member Function Documentation

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

Definition at line 123 of file ElectronSeedTrackRefFix.cc.

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

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

Definition at line 65 of file ElectronSeedTrackRefFix.cc.

References edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), mps_fire::i, edm::helper::Filler< Map >::insert(), eostools::move(), edm::Handle< T >::product(), edm::Event::put(), alignCSCRings::s, findQualityFiles::size, lumiQTWidget::t, and MuonErrorMatrixValues_cff::values.

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

66 {
67  using namespace edm;
68 
69  Handle<TrackCollection> oldTracks;
70  iEvent.getByToken(oldTracksToken,oldTracks);
71 
72  Handle<TrackCollection> newTracks;
73  iEvent.getByToken(newTracksToken,newTracks);
74 
76  iEvent.getByToken(seedsToken,iSeeds);
77 
79  iEvent.getByToken(idsToken,iIds);
80 
82  iEvent.getByToken(idMapToken,iIdMap);
83 
84  unique_ptr<ElectronSeedCollection> oSeeds(new ElectronSeedCollection);
85  unique_ptr<PreIdCollection> oIds(new PreIdCollection);
86  unique_ptr<ValueMap<PreIdRef> > oIdMap(new ValueMap<PreIdRef>);
87 
88  ValueMap<PreIdRef>::Filler mapFiller(*oIdMap);
89 
90  for(unsigned int s = 0;s<iSeeds->size();++s){
91  oSeeds->push_back(iSeeds->at(s));
92  TrackRef newTrackRef(newTracks,oSeeds->back().ctfTrack().index());
93  oSeeds->back().setCtfTrack(newTrackRef);
94  }
95 
96  for(unsigned int i = 0;i<iIds->size();++i){
97  oIds->push_back(iIds->at(i));
98  TrackRef newTrackRef(newTracks,oIds->back().trackRef().index());
99  oIds->back().setTrack(newTrackRef);
100  }
101 
102  iEvent.put(std::move(oSeeds),preidgsfLabel);
103  const edm::OrphanHandle<reco::PreIdCollection> preIdProd = iEvent.put(std::move(oIds),preidLabel);
104 
105  vector<PreIdRef> values;
106  for(unsigned int t = 0;t<newTracks->size();++t){
107  if(t < oldTracks->size()){
108  TrackRef oldTrackRef(oldTracks,t);
109  values.push_back(PreIdRef(preIdProd,(*(iIdMap.product()))[oldTrackRef].index()));
110  }
111  else{
112  values.push_back(PreIdRef());
113  }
114  }
115  mapFiller.insert(newTracks,values.begin(),values.end());
116  mapFiller.fill();
117 
118  iEvent.put(std::move(oIdMap),preidLabel);
119 }
size
Write out results.
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:136
std::vector< reco::PreId > PreIdCollection
Definition: PreIdFwd.h:6
edm::EDGetTokenT< reco::TrackCollection > newTracksToken
edm::EDGetTokenT< reco::TrackCollection > oldTracksToken
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:519
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsToken
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > idMapToken
edm::Ref< reco::PreIdCollection > PreIdRef
Definition: PreIdFwd.h:8
T const * product() const
Definition: Handle.h:81
HLT enums.
edm::EDGetTokenT< reco::PreIdCollection > idsToken
def move(src, dest)
Definition: eostools.py:510

Member Data Documentation

edm::EDGetTokenT<edm::ValueMap<reco::PreIdRef> > ElectronSeedTrackRefFix::idMapToken
private

Definition at line 33 of file ElectronSeedTrackRefFix.h.

edm::InputTag ElectronSeedTrackRefFix::idsTag
private

Definition at line 40 of file ElectronSeedTrackRefFix.h.

edm::EDGetTokenT<reco::PreIdCollection > ElectronSeedTrackRefFix::idsToken
private

Definition at line 32 of file ElectronSeedTrackRefFix.h.

edm::InputTag ElectronSeedTrackRefFix::newTracksTag
private

Definition at line 38 of file ElectronSeedTrackRefFix.h.

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

Definition at line 29 of file ElectronSeedTrackRefFix.h.

edm::InputTag ElectronSeedTrackRefFix::oldTracksTag
private

Definition at line 37 of file ElectronSeedTrackRefFix.h.

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

Definition at line 30 of file ElectronSeedTrackRefFix.h.

std::string ElectronSeedTrackRefFix::preidgsfLabel
private

Definition at line 35 of file ElectronSeedTrackRefFix.h.

std::string ElectronSeedTrackRefFix::preidLabel
private

Definition at line 36 of file ElectronSeedTrackRefFix.h.

edm::InputTag ElectronSeedTrackRefFix::seedsTag
private

Definition at line 39 of file ElectronSeedTrackRefFix.h.

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

Definition at line 31 of file ElectronSeedTrackRefFix.h.