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
 
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
 

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 32 of file TrackAssociatorEDProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 50 of file TrackAssociatorEDProducer.cc.

50  :
51  first(true),
52  label_tr(pset.getParameter< edm::InputTag >("label_tr")),
53  label_tp(pset.getParameter< edm::InputTag >("label_tp")),
54  associator(pset.getParameter< std::string >("associator")),
55  theIgnoremissingtrackcollection(pset.getUntrackedParameter<bool>("ignoremissingtrackcollection",false))
56 {
57  produces<reco::SimToRecoCollection>();
58  produces<reco::RecoToSimCollection>();
59 }
T getParameter(std::string const &) const
T getUntrackedParameter(std::string const &, T const &) const
TrackAssociatorEDProducer::~TrackAssociatorEDProducer ( )

Definition at line 62 of file TrackAssociatorEDProducer.cc.

62  {
63 
64 }

Member Function Documentation

virtual void TrackAssociatorEDProducer::beginJob ( void  )
inlineoverrideprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 38 of file TrackAssociatorEDProducer.cc.

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

Reimplemented from edm::EDProducer.

Definition at line 114 of file TrackAssociatorEDProducer.cc.

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

Implements edm::EDProducer.

Definition at line 73 of file TrackAssociatorEDProducer.cc.

References associator, first, edm::EventSetup::get(), edm::Event::getByLabel(), label_tp, label_tr, LogTrace, edm::Event::put(), theAssociator, theIgnoremissingtrackcollection, and ecalTPGAnalyzer_cfg::TPCollection.

73  {
74  using namespace edm;
75  if(first){
77  first = false;
78  }
81 
82  Handle<edm::View<reco::Track> > trackCollection;
83  bool trackAvailable = iEvent.getByLabel (label_tr, trackCollection );
84 
85  std::auto_ptr<reco::RecoToSimCollection> rts;
86  std::auto_ptr<reco::SimToRecoCollection> str;
87 
88  if (theIgnoremissingtrackcollection && !trackAvailable){
89  //the track collection is not in the event and we're being told to ignore this.
90  //do not output anything to the event, other wise this would be considered as inefficiency.
91  }else{
92  //associate tracks
93  LogTrace("TrackValidator") << "Calling associateRecoToSim method" << "\n";
94  reco::RecoToSimCollection recSimColl=theAssociator->associateRecoToSim(trackCollection,
96  &iEvent, &iSetup);
97  LogTrace("TrackValidator") << "Calling associateSimToReco method" << "\n";
98  reco::SimToRecoCollection simRecColl=theAssociator->associateSimToReco(trackCollection,
99  TPCollection,
100  &iEvent, &iSetup);
101 
102  rts.reset(new reco::RecoToSimCollection(recSimColl));
103  str.reset(new reco::SimToRecoCollection(simRecColl));
104 
105  iEvent.put(rts);
106  iEvent.put(str);
107  }
108 }
edm::ESHandle< TrackAssociatorBase > theAssociator
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
#define LogTrace(id)
const T & get() const
Definition: EventSetup.h:55

Member Data Documentation

std::string TrackAssociatorEDProducer::associator
private

Definition at line 46 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

bool TrackAssociatorEDProducer::first
private

Definition at line 43 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

edm::InputTag TrackAssociatorEDProducer::label_tp
private

Definition at line 45 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

edm::InputTag TrackAssociatorEDProducer::label_tr
private

Definition at line 44 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

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

Definition at line 42 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

bool TrackAssociatorEDProducer::theIgnoremissingtrackcollection
private

Definition at line 47 of file TrackAssociatorEDProducer.cc.

Referenced by produce().