CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
TrackAssociatorEDProducer Class Reference
Inheritance diagram for TrackAssociatorEDProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 TrackAssociatorEDProducer (const edm::ParameterSet &)
 
 ~TrackAssociatorEDProducer ()
 
- 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

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

Private Attributes

std::string associator
 
bool first
 
edm::InputTag label_tp
 
edm::InputTag label_tr
 
edm::ESHandle
< TrackAssociatorBase
theAssociator
 
bool theIgnoremissingtrackcollection
 
edm::EDGetTokenT
< TrackingParticleCollection
TPCollectionToken_
 
edm::EDGetTokenT< edm::View
< reco::Track > > 
trackCollectionToken_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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 36 of file TrackAssociatorEDProducer.cc.

Constructor & Destructor Documentation

TrackAssociatorEDProducer::TrackAssociatorEDProducer ( const edm::ParameterSet pset)
explicit

Definition at line 58 of file TrackAssociatorEDProducer.cc.

References edm::ParameterSet::getParameter(), TPCollectionToken_, and trackCollectionToken_.

58  :
59  first(true),
60  label_tr(pset.getParameter< edm::InputTag >("label_tr")),
61  label_tp(pset.getParameter< edm::InputTag >("label_tp")),
62  associator(pset.getParameter< std::string >("associator")),
63  theIgnoremissingtrackcollection(pset.getUntrackedParameter<bool>("ignoremissingtrackcollection",false))
64 {
65  produces<reco::SimToRecoCollection>();
66  produces<reco::RecoToSimCollection>();
67 
68  TPCollectionToken_ = consumes<TrackingParticleCollection>(pset.getParameter< edm::InputTag >("label_tp"));
69  trackCollectionToken_ = consumes<edm::View<reco::Track> >(pset.getParameter< edm::InputTag >("label_tr"));
70 
71 }
edm::EDGetTokenT< edm::View< reco::Track > > trackCollectionToken_
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
edm::EDGetTokenT< TrackingParticleCollection > TPCollectionToken_
TrackAssociatorEDProducer::~TrackAssociatorEDProducer ( )

Definition at line 74 of file TrackAssociatorEDProducer.cc.

74  {
75 
76 }

Member Function Documentation

virtual void TrackAssociatorEDProducer::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 42 of file TrackAssociatorEDProducer.cc.

42 {}
void TrackAssociatorEDProducer::endJob ( void  )
overrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 128 of file TrackAssociatorEDProducer.cc.

128  {
129 }
void TrackAssociatorEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 85 of file TrackAssociatorEDProducer.cc.

References associator, first, edm::EventSetup::get(), edm::Event::getByToken(), LogTrace, edm::Event::put(), theAssociator, theIgnoremissingtrackcollection, ecalTPGAnalyzer_cfg::TPCollection, TPCollectionToken_, and trackCollectionToken_.

85  {
86  using namespace edm;
87  if(first){
89  first = false;
90  }
92  // iEvent.getByLabel(label_tp, TPCollection);
94 
95  Handle<edm::View<reco::Track> > trackCollection;
96  // bool trackAvailable = iEvent.getByLabel (label_tr, trackCollection );
97  bool trackAvailable = iEvent.getByToken(trackCollectionToken_, trackCollection );
98 
99  std::auto_ptr<reco::RecoToSimCollection> rts;
100  std::auto_ptr<reco::SimToRecoCollection> str;
101 
102  if (theIgnoremissingtrackcollection && !trackAvailable){
103  //the track collection is not in the event and we're being told to ignore this.
104  //do not output anything to the event, other wise this would be considered as inefficiency.
105  } else {
106  //associate tracks
107  LogTrace("TrackValidator") << "Calling associateRecoToSim method" << "\n";
108  reco::RecoToSimCollection recSimColl=theAssociator->associateRecoToSim(trackCollection,
109  TPCollection,
110  &iEvent, &iSetup);
111  LogTrace("TrackValidator") << "Calling associateSimToReco method" << "\n";
112  reco::SimToRecoCollection simRecColl=theAssociator->associateSimToReco(trackCollection,
113  TPCollection,
114  &iEvent, &iSetup);
115 
116  rts.reset(new reco::RecoToSimCollection(recSimColl));
117  str.reset(new reco::SimToRecoCollection(simRecColl));
118 
119  iEvent.put(rts);
120  iEvent.put(str);
121  }
122 }
edm::EDGetTokenT< edm::View< reco::Track > > trackCollectionToken_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
edm::ESHandle< TrackAssociatorBase > theAssociator
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
#define LogTrace(id)
const T & get() const
Definition: EventSetup.h:55
edm::EDGetTokenT< TrackingParticleCollection > TPCollectionToken_

Member Data Documentation

std::string TrackAssociatorEDProducer::associator
private

Definition at line 50 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

bool TrackAssociatorEDProducer::first
private

Definition at line 47 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

edm::InputTag TrackAssociatorEDProducer::label_tp
private

Definition at line 49 of file TrackAssociatorEDProducer.cc.

edm::InputTag TrackAssociatorEDProducer::label_tr
private

Definition at line 48 of file TrackAssociatorEDProducer.cc.

edm::ESHandle<TrackAssociatorBase> TrackAssociatorEDProducer::theAssociator
private

Definition at line 46 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

bool TrackAssociatorEDProducer::theIgnoremissingtrackcollection
private

Definition at line 51 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

edm::EDGetTokenT<TrackingParticleCollection> TrackAssociatorEDProducer::TPCollectionToken_
private

Definition at line 53 of file TrackAssociatorEDProducer.cc.

Referenced by produce(), and TrackAssociatorEDProducer().

edm::EDGetTokenT<edm::View<reco::Track> > TrackAssociatorEDProducer::trackCollectionToken_
private

Definition at line 54 of file TrackAssociatorEDProducer.cc.

Referenced by produce(), and TrackAssociatorEDProducer().