Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:28:59

0001 // -*- C++ -*-
0002 //
0003 // Package:    ExtraFromSeeds
0004 // Class:      ExtraFromSeeds
0005 //
0006 /**\class ExtraFromSeeds ExtraFromSeeds.cc RecoTracker/ExtraFromSeeds/src/ExtraFromSeeds.cc
0007 
0008  Description: [one line class summary]
0009 
0010  Implementation:
0011      [Notes on implementation]
0012 */
0013 //
0014 // Original Author:  Jean-Roch Vlimant,40 3-A28,+41227671209,
0015 //         Created:  Fri Feb 17 12:03:11 CET 2012
0016 //
0017 //
0018 
0019 // system include files
0020 #include <memory>
0021 
0022 #include "RecoTracker/TrackProducer/plugins/ExtraFromSeeds.h"
0023 
0024 //
0025 // constructors and destructor
0026 //
0027 ExtraFromSeeds::ExtraFromSeeds(const edm::ParameterSet& iConfig)
0028     : tracks_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"))) {
0029   produces<ExtremeLight>();
0030   produces<TrackingRecHitCollection>();
0031 }
0032 
0033 ExtraFromSeeds::~ExtraFromSeeds() {
0034   // do anything here that needs to be done at desctruction time
0035   // (e.g. close files, deallocate resources etc.)
0036 }
0037 
0038 //
0039 // member functions
0040 //
0041 
0042 // ------------ method called to produce the data  ------------
0043 void ExtraFromSeeds::produce(edm::StreamID, edm::Event& iEvent, const edm::EventSetup& iSetup) const {
0044   // in
0045   edm::Handle<reco::TrackCollection> tracks;
0046   iEvent.getByToken(tracks_, tracks);
0047 
0048   // out
0049   std::unique_ptr<ExtremeLight> exxtralOut(new ExtremeLight());
0050   exxtralOut->resize(tracks->size());
0051 
0052   std::unique_ptr<TrackingRecHitCollection> hitOut(new TrackingRecHitCollection());
0053   TrackingRecHitRefProd rHits = iEvent.getRefBeforePut<TrackingRecHitCollection>();
0054   hitOut->reserve(3 * tracks->size());
0055 
0056   for (unsigned int ie = 0; ie != tracks->size(); ++ie) {
0057     const reco::Track& track = (*tracks)[ie];
0058     const reco::TrackExtra& extra = *track.extra();
0059     //only for high purity tracks
0060     if (!track.quality(reco::TrackBase::highPurity))
0061       continue;
0062 
0063     (*exxtralOut)[ie] = extra.seedRef()->nHits();
0064     for (auto const& seedHit : extra.seedRef()->recHits()) {
0065       hitOut->push_back(seedHit.clone());
0066     }
0067   }
0068 
0069   iEvent.put(std::move(exxtralOut));
0070   iEvent.put(std::move(hitOut));
0071 }
0072 
0073 // ------------ method fills 'descriptions' with the allowed parameters for the module  ------------
0074 void ExtraFromSeeds::fillDescriptions(edm::ConfigurationDescriptions& descriptions) {
0075   //The following says we do not know what parameters are allowed so do no validation
0076   // Please change this to state exactly what you do use, even if it is no parameters
0077   edm::ParameterSetDescription desc;
0078   desc.setUnknown();
0079   descriptions.addDefault(desc);
0080 }