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 // 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());
53  TrackingRecHitRefProd rHits = iEvent.getRefBeforePut<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
60  if (!track.quality(reco::TrackBase::highPurity))
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 }
RecHitRange recHits() const
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::EDGetTokenT< reco::TrackCollection > tracks_
const edm::RefToBase< TrajectorySeed > & seedRef() const
Definition: TrackExtra.h:129
ExtraFromSeeds(const edm::ParameterSet &)
int iEvent
Definition: GenABIO.cc:224
void addDefault(ParameterSetDescription const &psetDescription)
~ExtraFromSeeds() override
unsigned int nHits() const
void produce(edm::StreamID, edm::Event &, const edm::EventSetup &) const override
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
edm::OwnVector< TrackingRecHit > TrackingRecHitCollection
collection of TrackingRecHits
fixed size matrix
HLT enums.
def move(src, dest)
Definition: eostools.py:511
void reserve(size_t)
Definition: OwnVector.h:320
std::vector< unsigned int > ExtremeLight