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 //
17 //
18 
19 
20 // system include files
21 #include <memory>
22 
23 // user include files
29 
33 
38 
40 
43 
44 
45 //
46 // class declaration
47 //
48 
50  public:
53 
54  private:
55  virtual void beginJob() override ;
56  virtual void produce(edm::Event&, const edm::EventSetup&) override;
57  virtual void endJob() override ;
58  void beginRun(edm::Run const&, const edm::EventSetup&) override;
59 
60 
61  // ----------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 
89  trackAssociatorPS_ (iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters")),
90  minTrackPt_ (iConfig.getParameter<double>("MinTrackPt"))
91 
92 {
94  consumes<reco::TrackCollection> (iConfig.getParameter<edm::InputTag>("TrackCollection"));
97 
98  produces<DetIdCollection>();
99 }
100 
101 
103 {
104 
105  // do anything here that needs to be done at desctruction time
106  // (e.g. close files, deallocate resources etc.)
107 
108 }
109 
110 
111 //
112 // member functions
113 //
114 
115 // ------------ method called to produce the data ------------
116 void
118 {
119  using namespace edm;
120 
121  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
122 
123  // Get tracks from event
126 
127  // Loop over tracks
128  for(reco::TrackCollection::const_iterator tkItr = tracks->begin(); tkItr != tracks->end(); ++tkItr)
129  {
130  if(tkItr->pt() < minTrackPt_)
131  continue;
132 
136 
138 
139  if(centerId.rawId()==0)
140  continue;
141 
142  // Find 5x5 around max
144  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
145  for(std::vector<DetId>::const_iterator idItr = ids.begin(); idItr != ids.end(); ++idItr)
146  {
147  if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *idItr)
148  == interestingDetIdCollection->end())
149  interestingDetIdCollection->push_back(*idItr);
150  }
151 
152  }
153 
154  iEvent.put(interestingDetIdCollection);
155 
156 }
157 
159 {
160  edm::ESHandle<CaloTopology> theCaloTopology;
161  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
162  caloTopology_ = &(*theCaloTopology);
163 }
164 
165 // ------------ method called once each job just before starting event loop ------------
166 void
168 {
169 }
170 
171 // ------------ method called once each job just after ending the event loop ------------
172 void
174 }
175 
176 //define this as a plug-in
T getParameter(std::string const &) const
static const TGPicture * info(bool iBackgroundIsBlack)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:434
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.
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
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:43
int iEvent
Definition: GenABIO.cc:243
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
void beginRun(edm::Run const &, const edm::EventSetup &) override
virtual void produce(edm::Event &, const edm::EventSetup &) override
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
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 &)
edm::EDCollection< DetId > DetIdCollection
void loadParameters(const edm::ParameterSet &)
Definition: Run.h:41