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 produce(edm::Event&, const edm::EventSetup&) override;
56  void beginRun(edm::Run const&, const edm::EventSetup&) override;
57 
58 
59  // ----------member data ---------------------------
63 
64  double minTrackPt_;
65 
69 
70 
71 };
72 
73 //
74 // constants, enums and typedefs
75 //
76 
77 
78 //
79 // static data member definitions
80 //
81 
82 //
83 // constructors and destructor
84 //
86 
87  trackAssociatorPS_ (iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters")),
88  minTrackPt_ (iConfig.getParameter<double>("MinTrackPt"))
89 
90 {
92  consumes<reco::TrackCollection> (iConfig.getParameter<edm::InputTag>("TrackCollection"));
96 
97  produces<DetIdCollection>();
98 }
99 
100 
102 {
103 
104  // do anything here that needs to be done at desctruction time
105  // (e.g. close files, deallocate resources etc.)
106 
107 }
108 
109 
110 //
111 // member functions
112 //
113 
114 // ------------ method called to produce the data ------------
115 void
117 {
118  using namespace edm;
119 
120  std::auto_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
121 
122  // Get tracks from event
125 
126  // Loop over tracks
127  for(reco::TrackCollection::const_iterator tkItr = tracks->begin(); tkItr != tracks->end(); ++tkItr)
128  {
129  if(tkItr->pt() < minTrackPt_)
130  continue;
131 
135 
137 
138  if(centerId.rawId()==0)
139  continue;
140 
141  // Find 5x5 around max
143  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
144  for(std::vector<DetId>::const_iterator idItr = ids.begin(); idItr != ids.end(); ++idItr)
145  {
146  if(std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *idItr)
147  == interestingDetIdCollection->end())
148  interestingDetIdCollection->push_back(*idItr);
149  }
150 
151  }
152 
153  iEvent.put(interestingDetIdCollection);
154 
155 }
156 
158 {
159  edm::ESHandle<CaloTopology> theCaloTopology;
160  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
161  caloTopology_ = &(*theCaloTopology);
162 }
163 
164 //define this as a plug-in
T getParameter(std::string const &) const
static const TGPicture * info(bool iBackgroundIsBlack)
CaloTopology const * topology(0)
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
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
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:230
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
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
Definition: Run.h:41