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 {
31  tracks_=iConfig.getParameter<edm::InputTag>("tracks");
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.getByLabel(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 // ------------ method called once each job just before starting event loop ------------
88 void
90 {
91 }
92 
93 // ------------ method called once each job just after ending the event loop ------------
94 void
96 }
97 
98 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
99 void
101  //The following says we do not know what parameters are allowed so do no validation
102  // Please change this to state exactly what you do use, even if it is no parameters
104  desc.setUnknown();
105  descriptions.addDefault(desc);
106 }
107 
108 
T getParameter(std::string const &) const
edm::RefToBase< TrajectorySeed > seedRef() const
Definition: TrackExtra.h:128
const TrackExtraRef & extra() const
reference to &quot;extra&quot; object
Definition: Track.h:97
edm::InputTag 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:116
recHitContainer::const_iterator const_iterator
virtual void endJob()
std::pair< const_iterator, const_iterator > range
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
virtual void beginJob()
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390
RefProd< PROD > getRefBeforePut()
Definition: Event.h:128
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:375
unsigned int nHits() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
void reserve(size_t)
Definition: OwnVector.h:268
std::vector< unsigned int > ExtremeLight