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 // $Id: ExtraFromSeeds.cc,v 1.2 2013/02/27 13:28:54 muzaffar Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
25 
26 
27 //
28 // constructors and destructor
29 //
31 {
32  tracks_=iConfig.getParameter<edm::InputTag>("tracks");
33  produces<ExtremeLight>();
34  produces<TrackingRecHitCollection>();
35 
36 }
37 
38 
40 {
41 
42  // do anything here that needs to be done at desctruction time
43  // (e.g. close files, deallocate resources etc.)
44 
45 }
46 
47 
48 //
49 // member functions
50 //
51 
52 // ------------ method called to produce the data ------------
53 void
55 {
56 
57  // in
59  iEvent.getByLabel(tracks_,tracks);
60 
61  // out
62  std::auto_ptr<ExtremeLight> exxtralOut(new ExtremeLight());
63  exxtralOut->resize(tracks->size());
64 
65  std::auto_ptr<TrackingRecHitCollection> hitOut(new TrackingRecHitCollection());
67  hitOut->reserve(3*tracks->size());
68 
69  for (unsigned int ie=0;ie!=tracks->size();++ie){
70  const reco::Track & track = (*tracks)[ie];
71  const reco::TrackExtra & extra = *track.extra();
72  //only for high purity tracks
73  if (!track.quality(reco::TrackBase::highPurity)) continue;
74 
75  TrajectorySeed::range seedRange=extra.seedRef()->recHits();
77  (*exxtralOut)[ie]=extra.seedRef()->nHits();
78  for (seedHit=seedRange.first;seedHit!=seedRange.second;++seedHit){
79  TrackingRecHit * hit = seedHit->clone();
80  hitOut->push_back( hit );
81  }
82 
83  }
84 
85  iEvent.put(exxtralOut);
86  iEvent.put(hitOut);
87 }
88 // ------------ method called once each job just before starting event loop ------------
89 void
91 {
92 }
93 
94 // ------------ method called once each job just after ending the event loop ------------
95 void
97 }
98 
99 // ------------ method fills 'descriptions' with the allowed parameters for the module ------------
100 void
102  //The following says we do not know what parameters are allowed so do no validation
103  // Please change this to state exactly what you do use, even if it is no parameters
105  desc.setUnknown();
106  descriptions.addDefault(desc);
107 }
108 
109 
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:243
void addDefault(ParameterSetDescription const &psetDescription)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
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:361
RefProd< PROD > getRefBeforePut()
Definition: Event.h:106
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:377
unsigned int nHits() const
virtual void produce(edm::Event &, const edm::EventSetup &) override
void reserve(size_t)
Definition: OwnVector.h:267
std::vector< unsigned int > ExtremeLight