CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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 // system include files
20 #include <memory>
21 
23 
24 //
25 // constructors and destructor
26 //
28  : tracks_(consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("tracks"))) {
29  produces<ExtremeLight>();
30  produces<TrackingRecHitCollection>();
31 }
32 
34  // do anything here that needs to be done at desctruction time
35  // (e.g. close files, deallocate resources etc.)
36 }
37 
38 //
39 // member functions
40 //
41 
42 // ------------ method called to produce the data ------------
44  // in
46  iEvent.getByToken(tracks_, tracks);
47 
48  // out
49  std::unique_ptr<ExtremeLight> exxtralOut(new ExtremeLight());
50  exxtralOut->resize(tracks->size());
51 
52  std::unique_ptr<TrackingRecHitCollection> hitOut(new TrackingRecHitCollection());
54  hitOut->reserve(3 * tracks->size());
55 
56  for (unsigned int ie = 0; ie != tracks->size(); ++ie) {
57  const reco::Track& track = (*tracks)[ie];
58  const reco::TrackExtra& extra = *track.extra();
59  //only for high purity tracks
61  continue;
62 
63  (*exxtralOut)[ie] = extra.seedRef()->nHits();
64  for (auto const& seedHit : extra.seedRef()->recHits()) {
65  hitOut->push_back(seedHit.clone());
66  }
67  }
68 
69  iEvent.put(std::move(exxtralOut));
70  iEvent.put(std::move(hitOut));
71 }
72 
73 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
75  //The following says we do not know what parameters are allowed so do no validation
76  // Please change this to state exactly what you do use, even if it is no parameters
78  desc.setUnknown();
79  descriptions.addDefault(desc);
80 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:139
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
auto const & tracks
cannot be loose
edm::EDGetTokenT< reco::TrackCollection > tracks_
ExtraFromSeeds(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
const edm::RefToBase< TrajectorySeed > & seedRef() const
Definition: TrackExtra.h:129
~ExtraFromSeeds() override
def move
Definition: eostools.py:511
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
RefProd< PROD > getRefBeforePut()
Definition: Event.h:158
RecHitRange recHits() const
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
bool quality(const TrackQuality) const
Track quality.
Definition: TrackBase.h:552
unsigned int nHits() const
void reserve(size_t)
Definition: OwnVector.h:320
std::vector< unsigned int > ExtremeLight