CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/src/RecoTracker/TrackProducer/plugins/ExtraFromSeeds.cc

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 //
00003 // Package:    ExtraFromSeeds
00004 // Class:      ExtraFromSeeds
00005 // 
00013 //
00014 // Original Author:  Jean-Roch Vlimant,40 3-A28,+41227671209,
00015 //         Created:  Fri Feb 17 12:03:11 CET 2012
00016 // $Id: ExtraFromSeeds.cc,v 1.2 2013/02/27 13:28:54 muzaffar Exp $
00017 //
00018 //
00019 
00020 
00021 // system include files
00022 #include <memory>
00023 
00024 #include "RecoTracker/TrackProducer/plugins/ExtraFromSeeds.h"
00025 
00026 
00027 //
00028 // constructors and destructor
00029 //
00030 ExtraFromSeeds::ExtraFromSeeds(const edm::ParameterSet& iConfig)
00031 {
00032   tracks_=iConfig.getParameter<edm::InputTag>("tracks");
00033   produces<ExtremeLight>();
00034   produces<TrackingRecHitCollection>();
00035   
00036 }
00037 
00038 
00039 ExtraFromSeeds::~ExtraFromSeeds()
00040 {
00041  
00042    // do anything here that needs to be done at desctruction time
00043    // (e.g. close files, deallocate resources etc.)
00044 
00045 }
00046 
00047 
00048 //
00049 // member functions
00050 //
00051 
00052 // ------------ method called to produce the data  ------------
00053 void
00054 ExtraFromSeeds::produce(edm::Event& iEvent, const edm::EventSetup& iSetup)
00055 {
00056 
00057   // in
00058   edm::Handle<reco::TrackCollection> tracks;
00059   iEvent.getByLabel(tracks_,tracks);
00060 
00061   // out  
00062   std::auto_ptr<ExtremeLight> exxtralOut(new ExtremeLight());
00063   exxtralOut->resize(tracks->size());
00064 
00065   std::auto_ptr<TrackingRecHitCollection> hitOut(new TrackingRecHitCollection());
00066   TrackingRecHitRefProd rHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
00067   hitOut->reserve(3*tracks->size());
00068 
00069   for (unsigned int ie=0;ie!=tracks->size();++ie){
00070     const reco::Track & track = (*tracks)[ie];
00071     const reco::TrackExtra & extra = *track.extra();
00072     //only for high purity tracks
00073     if (!track.quality(reco::TrackBase::highPurity)) continue;
00074 
00075     TrajectorySeed::range seedRange=extra.seedRef()->recHits();
00076     TrajectorySeed::const_iterator seedHit;
00077     (*exxtralOut)[ie]=extra.seedRef()->nHits();
00078     for (seedHit=seedRange.first;seedHit!=seedRange.second;++seedHit){
00079       TrackingRecHit * hit = seedHit->clone();
00080       hitOut->push_back( hit );
00081     }
00082 
00083   }
00084   
00085   iEvent.put(exxtralOut);
00086   iEvent.put(hitOut);
00087 }
00088 // ------------ method called once each job just before starting event loop  ------------
00089 void 
00090 ExtraFromSeeds::beginJob()
00091 {
00092 }
00093 
00094 // ------------ method called once each job just after ending the event loop  ------------
00095 void 
00096 ExtraFromSeeds::endJob() {
00097 }
00098 
00099 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
00100 void
00101 ExtraFromSeeds::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
00102   //The following says we do not know what parameters are allowed so do no validation
00103   // Please change this to state exactly what you do use, even if it is no parameters
00104   edm::ParameterSetDescription desc;
00105   desc.setUnknown();
00106   descriptions.addDefault(desc);
00107 }
00108 
00109