CMS 3D CMS Logo

ExtraFromSeeds.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: ExtraFromSeeds
4 // Class: ExtraFromSeeds
5 //
13 //
14 // Original Author: Jean-Roch Vlimant,40 3-A28,+41227671209,
15 // Created: Fri Feb 17 12:03:11 CET 2012
16 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
24 
25 
26 //
27 // constructors and destructor
28 //
30  tracks_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks")))
31 {
32  produces<ExtremeLight>();
33  produces<TrackingRecHitCollection>();
34 
35 }
36 
37 
39 {
40 
41  // do anything here that needs to be done at desctruction time
42  // (e.g. close files, deallocate resources etc.)
43 
44 }
45 
46 
47 //
48 // member functions
49 //
50 
51 // ------------ method called to produce the data ------------
52 void
54 {
55 
56  // in
58  iEvent.getByToken(tracks_,tracks);
59 
60  // out
61  std::unique_ptr<ExtremeLight> exxtralOut(new ExtremeLight());
62  exxtralOut->resize(tracks->size());
63 
64  std::unique_ptr<TrackingRecHitCollection> hitOut(new TrackingRecHitCollection());
66  hitOut->reserve(3*tracks->size());
67 
68  for (unsigned int ie=0;ie!=tracks->size();++ie){
69  const reco::Track & track = (*tracks)[ie];
70  const reco::TrackExtra & extra = *track.extra();
71  //only for high purity tracks
72  if (!track.quality(reco::TrackBase::highPurity)) continue;
73 
74  TrajectorySeed::range seedRange=extra.seedRef()->recHits();
76  (*exxtralOut)[ie]=extra.seedRef()->nHits();
77  for (seedHit=seedRange.first;seedHit!=seedRange.second;++seedHit){
78  TrackingRecHit * hit = seedHit->clone();
79  hitOut->push_back( hit );
80  }
81 
82  }
83 
84  iEvent.put(std::move(exxtralOut));
85  iEvent.put(std::move(hitOut));
86 }
87 
88 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
89 void
91  //The following says we do not know what parameters are allowed so do no validation
92  // Please change this to state exactly what you do use, even if it is no parameters
94  desc.setUnknown();
95  descriptions.addDefault(desc);
96 }
97 
98 
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:127
const std::vector< reco::PFCandidatePtr > & tracks_
const TrackExtraRef & extra() const
reference to "extra" object
Definition: Track.h:189
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:508
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::EDGetTokenT< reco::TrackCollection > tracks_
ExtraFromSeeds(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
const edm::RefToBase< TrajectorySeed > & seedRef() const
Definition: TrackExtra.h:167
~ExtraFromSeeds() override
recHitContainer::const_iterator const_iterator
std::pair< const_iterator, const_iterator > range
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
RefProd< PROD > getRefBeforePut()
Definition: Event.h:147
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
range recHits() const
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:510
unsigned int nHits() const
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:510
void reserve(size_t)
Definition: OwnVector.h:284
std::vector< unsigned int > ExtremeLight