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

Public Member Functions

 TrackAssociatorEDProducer (const edm::ParameterSet &)
 
 ~TrackAssociatorEDProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
boost::function< void(const
BranchDescription &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 

Private Member Functions

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

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
 
typedef WorkerT< EDProducerWorkerType
 
- 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::EDProducer
CurrentProcessingContext const * currentContext () const
 
- Protected Member Functions inherited from edm::ProducerBase
template<class TProducer , class TMethod >
void callWhenNewProductsRegistered (TProducer *iProd, TMethod iMethod)
 

Detailed Description

Definition at line 33 of file TrackAssociatorEDProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 51 of file TrackAssociatorEDProducer.cc.

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

Definition at line 63 of file TrackAssociatorEDProducer.cc.

63  {
64 
65 }

Member Function Documentation

virtual void TrackAssociatorEDProducer::beginJob ( void  )
inlineprivatevirtual

Reimplemented from edm::EDProducer.

Definition at line 39 of file TrackAssociatorEDProducer.cc.

39 {}
void TrackAssociatorEDProducer::endJob ( void  )
privatevirtual

Reimplemented from edm::EDProducer.

Definition at line 115 of file TrackAssociatorEDProducer.cc.

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

Implements edm::EDProducer.

Definition at line 74 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.

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

Member Data Documentation

std::string TrackAssociatorEDProducer::associator
private

Definition at line 47 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

bool TrackAssociatorEDProducer::first
private

Definition at line 44 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

edm::InputTag TrackAssociatorEDProducer::label_tp
private

Definition at line 46 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

edm::InputTag TrackAssociatorEDProducer::label_tr
private

Definition at line 45 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

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

Definition at line 43 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

bool TrackAssociatorEDProducer::theIgnoremissingtrackcollection
private

Definition at line 48 of file TrackAssociatorEDProducer.cc.

Referenced by produce().