CMS 3D CMS Logo

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  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"));
94  edm::ConsumesCollector iC = consumesCollector();
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  auto interestingDetIdCollection = std::make_unique<DetIdCollection>();
121 
122  // Get tracks from event
124  iEvent.getByToken(trackCollectionToken_,tracks);
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  {
147  == interestingDetIdCollection->end())
148  interestingDetIdCollection->push_back(*idItr);
149  }
150 
151  }
152 
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)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:47
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:20
int iEvent
Definition: GenABIO.cc:230
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:41
void produce(edm::Event &, const edm::EventSetup &) override
Definition: DetId.h:18
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:25
HLT enums.
T get() const
Definition: EventSetup.h:63
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
def move(src, dest)
Definition: eostools.py:510
Definition: Run.h:44