CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
InterestingTrackEcalDetIdProducer.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 //
3 // Package: InterestingTrackEcalDetIdProducer
4 // Class: InterestingTrackEcalDetIdProducer
5 //
13 //
14 // Original Author:
15 // Created: Wed Sep 22 17:02:51 CEST 2010
16 // $Id: InterestingTrackEcalDetIdProducer.cc,v 1.2 2013/02/27 19:33:31 eulisse Exp $
17 //
18 //
19 
20 
21 // system include files
22 #include <memory>
23 
24 // user include files
30 
34 
39 
41 
44 
45 
46 //
47 // class declaration
48 //
49 
51  public:
54 
55  private:
56  virtual void beginJob() ;
57  virtual void produce(edm::Event&, const edm::EventSetup&);
58  virtual void endJob() ;
59  void beginRun(edm::Run const&, const edm::EventSetup&);
60 
61 
62  // ----------member data ---------------------------
65 
66  double minTrackPt_;
67 
71 
72 
73 };
74 
75 //
76 // constants, enums and typedefs
77 //
78 
79 
80 //
81 // static data member definitions
82 //
83 
84 //
85 // constructors and destructor
86 //
88  trackCollection_ (iConfig.getParameter<edm::InputTag>("TrackCollection")),
89  trackAssociatorPS_ (iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters")),
90  minTrackPt_ (iConfig.getParameter<double>("MinTrackPt"))
91 
92 {
95 
96  produces<DetIdCollection>();
97 }
98 
99 
101 {
102 
103  // do anything here that needs to be done at desctruction time
104  // (e.g. close files, deallocate resources etc.)
105 
106 }
107 
108 
109 //
110 // member functions
111 //
112 
113 // ------------ method called to produce the data ------------
114 void
116 {
117  using namespace edm;
118 
119  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
120 
121  // Get tracks from event
124 
125  // Loop over tracks
126  for(reco::TrackCollection::const_iterator tkItr = tracks->begin(); tkItr != tracks->end(); ++tkItr)
127  {
128  if(tkItr->pt() < minTrackPt_)
129  continue;
130 
134 
136 
137  if(centerId.rawId()==0)
138  continue;
139 
140  // Find 5x5 around max
142  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
143  for(std::vector<DetId>::const_iterator idItr = ids.begin(); idItr != ids.end(); ++idItr)
144  {
145  if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *idItr)
146  == interestingDetIdCollection->end())
147  interestingDetIdCollection->push_back(*idItr);
148  }
149 
150  }
151 
152  iEvent.put(interestingDetIdCollection);
153 
154 }
155 
157 {
158  edm::ESHandle<CaloTopology> theCaloTopology;
159  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
160  caloTopology_ = &(*theCaloTopology);
161 }
162 
163 // ------------ method called once each job just before starting event loop ------------
164 void
166 {
167 }
168 
169 // ------------ method called once each job just after ending the event loop ------------
170 void
172 }
173 
174 //define this as a plug-in
InterestingTrackEcalDetIdProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:17
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
void useDefaultPropagator()
use the default propagator
DetId findMaxDeposition(EnergyType)
Find detector elements with highest energy deposition.
void beginRun(edm::Run const &, const edm::EventSetup &)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:7
uint32_t rawId() const
get the raw id
Definition: DetId.h:45
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:94
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:39
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:361
Definition: DetId.h:20
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
tuple tracks
Definition: testEve_cfg.py:39
const T & get() const
Definition: EventSetup.h:55
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:26
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
virtual void produce(edm::Event &, const edm::EventSetup &)
edm::EDCollection< DetId > DetIdCollection
void loadParameters(const edm::ParameterSet &)
Definition: Run.h:36