CMS 3D CMS Logo

Public Member Functions | Private Attributes

TrackInfoProducer Class Reference

#include <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 13 of file TrackInfoProducer.cc.

                                                                  :
    conf_(iConfig),
    theAlgo_(iConfig)
{
  produces<reco::TrackInfoCollection>();
  produces<reco::TrackInfoTrackAssociationCollection>();


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

Definition at line 28 of file TrackInfoProducer.h.

{};

Member Function Documentation

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

Implements edm::EDProducer.

Definition at line 24 of file TrackInfoProducer.cc.

References conf_, edm::EventSetup::get(), edm::Event::getByLabel(), edm::ParameterSet::getParameter(), i, edm::Ref< C, T, F >::key(), convertSQLitetoXML_cfg::output, edm::Event::put(), TrackInfoProducerAlgorithm::run(), theAlgo_, and patCandidatesForDimuonsSequences_cff::tracker.

{
   //
  // create empty output collections
  //

  std::auto_ptr<reco::TrackInfoCollection>    outputColl (new reco::TrackInfoCollection);
  std::auto_ptr<reco::TrackInfoTrackAssociationCollection>    TIassociationColl (new reco::TrackInfoTrackAssociationCollection);
  
  edm::InputTag TkTag = conf_.getParameter<edm::InputTag>("cosmicTracks");
  
  edm::Handle<std::vector<Trajectory> > TrajectoryCollection;
  edm::Handle<reco::TrackCollection > trackCollection;
  edm::Handle<TrajTrackAssociationCollection> assoMap;
    
  edm::ESHandle<TrackerGeometry> tkgeom;
  setup.get<TrackerDigiGeometryRecord>().get( tkgeom );
  const TrackerGeometry * tracker=&(* tkgeom);
    
  theEvent.getByLabel(TkTag,TrajectoryCollection);
  theEvent.getByLabel(TkTag,trackCollection);
  theEvent.getByLabel(TkTag,assoMap);
 
  //
  //run the algorithm  
  //
  reco::TrackInfo output;
  
  std::vector<Trajectory>::const_iterator traj_iterator;
  edm::LogInfo("TrackInfoProducer") << "Loop on trajectories";
  std::map<reco::TrackRef,unsigned int> trackid;
  int i=0;

 for(TrajTrackAssociationCollection::const_iterator it = assoMap->begin();it != assoMap->end(); ++it){
   const edm::Ref<std::vector<Trajectory> > traj = it->key;
   const reco::TrackRef track = it->val;
   trackid.insert(make_pair(track,i));
   i++;
   theAlgo_.run(traj,track,output,tracker);
   outputColl->push_back(*(new reco::TrackInfo(output)));

 }
 

    //put everything in the event
    edm::OrphanHandle<reco::TrackInfoCollection> rTrackInfo;

//     if(forwardPredictedStateTag_!="") rTrackInfof = theEvent.put(outputFwdColl,forwardPredictedStateTag_ );
//     if(backwardPredictedStateTag_!="") rTrackInfob =   theEvent.put(outputBwdColl,backwardPredictedStateTag_);
//     if(updatedStateTag_!="") rTrackInfou =   theEvent.put(outputUpdatedColl,updatedStateTag_ );
//     if(combinedStateTag_!="") rTrackInfoc =   theEvent.put(outputCombinedColl,combinedStateTag_ );
    rTrackInfo=theEvent.put(outputColl);

    for(std::map<reco::TrackRef,unsigned int>::iterator ref_iter=trackid.begin();ref_iter!=trackid.end();ref_iter++){

      TIassociationColl->insert( ref_iter->first,edm::Ref<reco::TrackInfoCollection>(rTrackInfo,ref_iter->second ));
    }

    theEvent.put(TIassociationColl); 
}

Member Data Documentation

Definition at line 36 of file TrackInfoProducer.h.

std::string TrackInfoProducer::combinedStateTag_ [private]

Definition at line 36 of file TrackInfoProducer.h.

Definition at line 34 of file TrackInfoProducer.h.

Referenced by produce().

Definition at line 36 of file TrackInfoProducer.h.

Definition at line 35 of file TrackInfoProducer.h.

Referenced by produce().

std::string TrackInfoProducer::updatedStateTag_ [private]

Definition at line 36 of file TrackInfoProducer.h.