CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 ElectronSeedTrackRefFix (const edm::ParameterSet &)
 
 ~ElectronSeedTrackRefFix ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

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

Private Attributes

edm::EDGetTokenT
< edm::ValueMap
< reco::PreIdRef > > 
idMapToken
 
edm::InputTag idsTag
 
edm::EDGetTokenT
< reco::PreIdCollection
idsToken
 
edm::InputTag newTracksTag
 
edm::EDGetTokenT
< reco::TrackCollection
newTracksToken
 
edm::InputTag oldTracksTag
 
edm::EDGetTokenT
< reco::TrackCollection
oldTracksToken
 
std::string preidgsfLabel
 
std::string preidLabel
 
edm::InputTag seedsTag
 
edm::EDGetTokenT
< reco::ElectronSeedCollection
seedsToken
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 18 of file ElectronSeedTrackRefFix.h.

Constructor & Destructor Documentation

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

Definition at line 27 of file ElectronSeedTrackRefFix.cc.

References edm::ParameterSet::getParameter().

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

Definition at line 51 of file ElectronSeedTrackRefFix.cc.

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

Member Function Documentation

void ElectronSeedTrackRefFix::beginJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 124 of file ElectronSeedTrackRefFix.cc.

125 {
126 }
void ElectronSeedTrackRefFix::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 130 of file ElectronSeedTrackRefFix.cc.

130  {
131 }
void ElectronSeedTrackRefFix::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 135 of file ElectronSeedTrackRefFix.cc.

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

135  {
136  //The following says we do not know what parameters are allowed so do no validation
137  // Please change this to state exactly what you do use, even if it is no parameters
139  desc.setUnknown();
140  descriptions.addDefault(desc);
141 }
void addDefault(ParameterSetDescription const &psetDescription)
void ElectronSeedTrackRefFix::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 66 of file ElectronSeedTrackRefFix.cc.

References edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), i, edm::helper::Filler< Map >::insert(), edm::Event::put(), alignCSCRings::s, findQualityFiles::size, edmStreamStallGrapher::t, and makeHLTPrescaleTable::values.

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

67 {
68  using namespace edm;
69 
70  Handle<TrackCollection> oldTracks;
71  iEvent.getByToken(oldTracksToken,oldTracks);
72 
73  Handle<TrackCollection> newTracks;
74  iEvent.getByToken(newTracksToken,newTracks);
75 
77  iEvent.getByToken(seedsToken,iSeeds);
78 
80  iEvent.getByToken(idsToken,iIds);
81 
83  iEvent.getByToken(idMapToken,iIdMap);
84 
85  auto_ptr<ElectronSeedCollection> oSeeds(new ElectronSeedCollection);
86  auto_ptr<PreIdCollection> oIds(new PreIdCollection);
87  auto_ptr<ValueMap<PreIdRef> > oIdMap(new ValueMap<PreIdRef>);
88 
89  ValueMap<PreIdRef>::Filler mapFiller(*oIdMap);
90 
91  for(unsigned int s = 0;s<iSeeds->size();++s){
92  oSeeds->push_back(iSeeds->at(s));
93  TrackRef newTrackRef(newTracks,oSeeds->back().ctfTrack().index());
94  oSeeds->back().setCtfTrack(newTrackRef);
95  }
96 
97  for(unsigned int i = 0;i<iIds->size();++i){
98  oIds->push_back(iIds->at(i));
99  TrackRef newTrackRef(newTracks,oIds->back().trackRef().index());
100  oIds->back().setTrack(newTrackRef);
101  }
102 
103  iEvent.put(oSeeds,preidgsfLabel);
104  const edm::OrphanHandle<reco::PreIdCollection> preIdProd = iEvent.put(oIds,preidLabel);
105 
106  vector<PreIdRef> values;
107  for(unsigned int t = 0;t<newTracks->size();++t){
108  if(t < oldTracks->size()){
109  TrackRef oldTrackRef(oldTracks,t);
110  values.push_back(PreIdRef(preIdProd,(*(iIdMap.product()))[oldTrackRef].index()));
111  }
112  else{
113  values.push_back(PreIdRef());
114  }
115  }
116  mapFiller.insert(newTracks,values.begin(),values.end());
117  mapFiller.fill();
118 
119  iEvent.put(oIdMap,preidLabel);
120 }
int i
Definition: DBlmapReader.cc:9
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:449
edm::EDGetTokenT< reco::ElectronSeedCollection > seedsToken
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
edm::EDGetTokenT< edm::ValueMap< reco::PreIdRef > > idMapToken
edm::Ref< reco::PreIdCollection > PreIdRef
Definition: PreIdFwd.h:8
edm::EDGetTokenT< reco::PreIdCollection > idsToken
tuple size
Write out results.

Member Data Documentation

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

Definition at line 35 of file ElectronSeedTrackRefFix.h.

edm::InputTag ElectronSeedTrackRefFix::idsTag
private

Definition at line 42 of file ElectronSeedTrackRefFix.h.

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

Definition at line 34 of file ElectronSeedTrackRefFix.h.

edm::InputTag ElectronSeedTrackRefFix::newTracksTag
private

Definition at line 40 of file ElectronSeedTrackRefFix.h.

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

Definition at line 31 of file ElectronSeedTrackRefFix.h.

edm::InputTag ElectronSeedTrackRefFix::oldTracksTag
private

Definition at line 39 of file ElectronSeedTrackRefFix.h.

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

Definition at line 32 of file ElectronSeedTrackRefFix.h.

std::string ElectronSeedTrackRefFix::preidgsfLabel
private

Definition at line 37 of file ElectronSeedTrackRefFix.h.

std::string ElectronSeedTrackRefFix::preidLabel
private

Definition at line 38 of file ElectronSeedTrackRefFix.h.

edm::InputTag ElectronSeedTrackRefFix::seedsTag
private

Definition at line 41 of file ElectronSeedTrackRefFix.h.

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

Definition at line 33 of file ElectronSeedTrackRefFix.h.