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 // system include files
20 #include <memory>
21 
22 // user include files
28 
32 
37 
39 
42 
43 //
44 // class declaration
45 //
46 
48 public:
51 
52 private:
53  void produce(edm::Event&, const edm::EventSetup&) override;
54  void beginRun(edm::Run const&, const edm::EventSetup&) override;
55 
56  // ----------member data ---------------------------
60 
61  double minTrackPt_;
62 
66 };
67 
68 //
69 // constants, enums and typedefs
70 //
71 
72 //
73 // static data member definitions
74 //
75 
76 //
77 // constructors and destructor
78 //
80  :
81 
82  trackAssociatorPS_(iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters")),
83  minTrackPt_(iConfig.getParameter<double>("MinTrackPt"))
84 
85 {
86  trackCollectionToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("TrackCollection"));
88  edm::ConsumesCollector iC = consumesCollector();
90 
91  produces<DetIdCollection>();
92 }
93 
95  // do anything here that needs to be done at desctruction time
96  // (e.g. close files, deallocate resources etc.)
97 }
98 
99 //
100 // member functions
101 //
102 
103 // ------------ method called to produce the data ------------
105  using namespace edm;
106 
107  auto interestingDetIdCollection = std::make_unique<DetIdCollection>();
108 
109  // Get tracks from event
111  iEvent.getByToken(trackCollectionToken_, tracks);
112 
113  // Loop over tracks
114  for (reco::TrackCollection::const_iterator tkItr = tracks->begin(); tkItr != tracks->end(); ++tkItr) {
115  if (tkItr->pt() < minTrackPt_)
116  continue;
117 
119  iEvent, iSetup, trackAssociator_.getFreeTrajectoryState(iSetup, *tkItr), trackAssociatorParameters_);
120 
122 
123  if (centerId.rawId() == 0)
124  continue;
125 
126  // Find 5x5 around max
128  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
129  for (std::vector<DetId>::const_iterator idItr = ids.begin(); idItr != ids.end(); ++idItr) {
130  if (std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *idItr) ==
132  interestingDetIdCollection->push_back(*idItr);
133  }
134  }
135 
137 }
138 
140  edm::ESHandle<CaloTopology> theCaloTopology;
141  iSetup.get<CaloTopologyRecord>().get(theCaloTopology);
142  caloTopology_ = &(*theCaloTopology);
143 }
144 
145 //define this as a plug-in
T getParameter(std::string const &) const
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
InterestingTrackEcalDetIdProducer(const edm::ParameterSet &)
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
void useDefaultPropagator()
use the default propagator
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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:19
int iEvent
Definition: GenABIO.cc:224
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
void beginRun(edm::Run const &, const edm::EventSetup &) override
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
void produce(edm::Event &, const edm::EventSetup &) override
Definition: DetId.h:17
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
HLT enums.
T get() const
Definition: EventSetup.h:73
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
def move(src, dest)
Definition: eostools.py:511
Definition: Run.h:45