CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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::auto_ptr<ExtremeLight> exxtralOut(new ExtremeLight());
62  exxtralOut->resize(tracks->size());
63 
64  std::auto_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(exxtralOut);
85  iEvent.put(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 
edm::RefToBase< TrajectorySeed > seedRef() const
Definition: TrackExtra.h:172
const std::vector< reco::PFCandidatePtr > & tracks_
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:189
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:457
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:13
edm::EDGetTokenT< reco::TrackCollection > tracks_
ExtraFromSeeds(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:230
void addDefault(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:115
recHitContainer::const_iterator const_iterator
virtual void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
std::pair< const_iterator, const_iterator > range
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
RefProd< PROD > getRefBeforePut()
Definition: Event.h:135
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
tuple tracks
Definition: testEve_cfg.py:39
range recHits() const
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:473
unsigned int nHits() const
void reserve(size_t)
Definition: OwnVector.h:274
std::vector< unsigned int > ExtremeLight