CMS 3D CMS Logo

TrackInfoProducer Class Reference

#include <AnalysisAlgos/TrackInfoProducer/interface/TrackInfoProducer.h>

Inheritance diagram for TrackInfoProducer:

edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 TrackInfoProducer (const edm::ParameterSet &iConfig)
virtual ~TrackInfoProducer ()

Private Attributes

std::string backwardPredictedStateTag_
std::string combinedStateTag_
edm::ParameterSet conf_
std::string forwardPredictedStateTag_
TrackInfoProducerAlgorithm theAlgo_
std::string updatedStateTag_


Detailed Description

Definition at line 22 of file TrackInfoProducer.h.


Constructor & Destructor Documentation

TrackInfoProducer::TrackInfoProducer ( const edm::ParameterSet iConfig  )  [explicit]

Definition at line 15 of file TrackInfoProducer.cc.

00015                                                                   :
00016     conf_(iConfig),
00017     theAlgo_(iConfig)
00018 {
00019   produces<reco::TrackInfoCollection>();
00020   produces<reco::TrackInfoTrackAssociationCollection>();
00021 
00022 
00023 }

virtual TrackInfoProducer::~TrackInfoProducer (  )  [inline, virtual]

Definition at line 28 of file TrackInfoProducer.h.

00028 {};


Member Function Documentation

void TrackInfoProducer::produce ( edm::Event theEvent,
const edm::EventSetup setup 
) [virtual]

Implements edm::EDProducer.

Definition at line 26 of file TrackInfoProducer.cc.

References conf_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), i, it, output(), edm::Event::put(), TrackInfoProducerAlgorithm::run(), theAlgo_, and track.

00027 {
00028    //
00029   // create empty output collections
00030   //
00031 
00032   std::auto_ptr<reco::TrackInfoCollection>    outputColl (new reco::TrackInfoCollection);
00033   std::auto_ptr<reco::TrackInfoTrackAssociationCollection>    TIassociationColl (new reco::TrackInfoTrackAssociationCollection);
00034   
00035   edm::InputTag TkTag = conf_.getParameter<edm::InputTag>("cosmicTracks");
00036   
00037   edm::Handle<std::vector<Trajectory> > TrajectoryCollection;
00038   edm::Handle<reco::TrackCollection > trackCollection;
00039   edm::Handle<TrajTrackAssociationCollection> assoMap;
00040     
00041   edm::ESHandle<TrackerGeometry> tkgeom;
00042   setup.get<TrackerDigiGeometryRecord>().get( tkgeom );
00043   const TrackerGeometry * tracker=&(* tkgeom);
00044     
00045   theEvent.getByLabel(TkTag,TrajectoryCollection);
00046   theEvent.getByLabel(TkTag,trackCollection);
00047   theEvent.getByLabel(TkTag,assoMap);
00048  
00049   //
00050   //run the algorithm  
00051   //
00052   reco::TrackInfo output;
00053   
00054   std::vector<Trajectory>::const_iterator traj_iterator;
00055   edm::LogInfo("TrackInfoProducer") << "Loop on trajectories";
00056   std::map<reco::TrackRef,unsigned int> trackid;
00057   int i=0;
00058 
00059  for(TrajTrackAssociationCollection::const_iterator it = assoMap->begin();it != assoMap->end(); ++it){
00060    const edm::Ref<std::vector<Trajectory> > traj = it->key;
00061    const reco::TrackRef track = it->val;
00062    trackid.insert(make_pair(track,i));
00063    i++;
00064    theAlgo_.run(traj,track,output,tracker);
00065    outputColl->push_back(*(new reco::TrackInfo(output)));
00066 
00067  }
00068  
00069 
00070     //put everything in the event
00071     edm::OrphanHandle<reco::TrackInfoCollection> rTrackInfo;
00072 
00073 //     if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(outputFwdColl,forwardPredictedStateTag_ );
00074 //     if(backwardPredictedStateTag_!="") rTrackInfob =   theEvent.put(outputBwdColl,backwardPredictedStateTag_);
00075 //     if(updatedStateTag_!="") rTrackInfou =   theEvent.put(outputUpdatedColl,updatedStateTag_ );
00076 //     if(combinedStateTag_!="") rTrackInfoc =   theEvent.put(outputCombinedColl,combinedStateTag_ );
00077     rTrackInfo=theEvent.put(outputColl);
00078 
00079     for(std::map<reco::TrackRef,unsigned int>::iterator ref_iter=trackid.begin();ref_iter!=trackid.end();ref_iter++){
00080 
00081       TIassociationColl->insert( ref_iter->first,edm::Ref<reco::TrackInfoCollection>(rTrackInfo,ref_iter->second ));
00082     }
00083 
00084     theEvent.put(TIassociationColl); 
00085 }


Member Data Documentation

std::string TrackInfoProducer::backwardPredictedStateTag_ [private]

Definition at line 36 of file TrackInfoProducer.h.

std::string TrackInfoProducer::combinedStateTag_ [private]

Definition at line 36 of file TrackInfoProducer.h.

edm::ParameterSet TrackInfoProducer::conf_ [private]

Definition at line 34 of file TrackInfoProducer.h.

Referenced by produce().

std::string TrackInfoProducer::forwardPredictedStateTag_ [private]

Definition at line 36 of file TrackInfoProducer.h.

TrackInfoProducerAlgorithm TrackInfoProducer::theAlgo_ [private]

Definition at line 35 of file TrackInfoProducer.h.

Referenced by produce().

std::string TrackInfoProducer::updatedStateTag_ [private]

Definition at line 36 of file TrackInfoProducer.h.


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:34:11 2009 for CMSSW by  doxygen 1.5.4