CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

TrackAssociatorEDProducer Class Reference

Inheritance diagram for TrackAssociatorEDProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

 TrackAssociatorEDProducer (const edm::ParameterSet &)
 ~TrackAssociatorEDProducer ()

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

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.

                                                                               :
  first(true),
  label_tr(pset.getParameter< edm::InputTag >("label_tr")),
  label_tp(pset.getParameter< edm::InputTag >("label_tp")),
  associator(pset.getParameter< std::string >("associator")),
  theIgnoremissingtrackcollection(pset.getUntrackedParameter<bool>("ignoremissingtrackcollection",false))
{
  produces<reco::SimToRecoCollection>();
  produces<reco::RecoToSimCollection>();
}
TrackAssociatorEDProducer::~TrackAssociatorEDProducer ( )

Definition at line 63 of file TrackAssociatorEDProducer.cc.

                                                      {
 
}

Member Function Documentation

virtual void TrackAssociatorEDProducer::beginJob ( void  ) [inline, private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 39 of file TrackAssociatorEDProducer.cc.

{}
void TrackAssociatorEDProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 115 of file TrackAssociatorEDProducer.cc.

                                  {
}
void TrackAssociatorEDProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

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.

                                                                                {
   using namespace edm;
   if(first){
     iSetup.get<TrackAssociatorRecord>().get(associator,theAssociator);
     first = false;
   }
   Handle<TrackingParticleCollection>  TPCollection ;
   iEvent.getByLabel(label_tp, TPCollection);
     
   Handle<edm::View<reco::Track> > trackCollection;
   bool trackAvailable = iEvent.getByLabel (label_tr, trackCollection );

   std::auto_ptr<reco::RecoToSimCollection> rts;
   std::auto_ptr<reco::SimToRecoCollection> str;

   if (theIgnoremissingtrackcollection && !trackAvailable){
     //the track collection is not in the event and we're being told to ignore this.
     //do not output anything to the event, other wise this would be considered as inefficiency.
   }else{
     //associate tracks
     LogTrace("TrackValidator") << "Calling associateRecoToSim method" << "\n";
     reco::RecoToSimCollection recSimColl=theAssociator->associateRecoToSim(trackCollection,
                                                                            TPCollection,
                                                                            &iEvent);
     LogTrace("TrackValidator") << "Calling associateSimToReco method" << "\n";
     reco::SimToRecoCollection simRecColl=theAssociator->associateSimToReco(trackCollection,
                                                                            TPCollection, 
                                                                            &iEvent);
     
     rts.reset(new reco::RecoToSimCollection(recSimColl));
     str.reset(new reco::SimToRecoCollection(simRecColl));

     iEvent.put(rts);
     iEvent.put(str);
   }
}

Member Data Documentation

Definition at line 47 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

Definition at line 44 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

Definition at line 46 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

Definition at line 45 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

Definition at line 43 of file TrackAssociatorEDProducer.cc.

Referenced by produce().

Definition at line 48 of file TrackAssociatorEDProducer.cc.

Referenced by produce().