CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups 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:
50 
51 private:
52  void produce(edm::Event&, const edm::EventSetup&) override;
53 
54  // ----------member data ---------------------------
57 
58  double minTrackPt_;
59 
63 };
64 
65 //
66 // constants, enums and typedefs
67 //
68 
69 //
70 // static data member definitions
71 //
72 
73 //
74 // constructors and destructor
75 //
77  : minTrackPt_(iConfig.getParameter<double>("MinTrackPt")),
78  caloTopologyToken_(esConsumes())
79 
80 {
81  trackCollectionToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("TrackCollection"));
83  edm::ConsumesCollector iC = consumesCollector();
84  trackAssociatorParameters_.loadParameters(iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters"), iC);
85 
86  produces<DetIdCollection>();
87 }
88 
89 //
90 // member functions
91 //
92 
93 // ------------ method called to produce the data ------------
95  using namespace edm;
96 
97  auto interestingDetIdCollection = std::make_unique<DetIdCollection>();
98 
99  // Get tracks from event
102 
103  const auto& caloTopology = iSetup.getData(caloTopologyToken_);
104 
105  // Loop over tracks
106  for (reco::TrackCollection::const_iterator tkItr = tracks->begin(); tkItr != tracks->end(); ++tkItr) {
107  if (tkItr->pt() < minTrackPt_)
108  continue;
109 
111  iEvent,
112  iSetup,
115 
117 
118  if (centerId.rawId() == 0)
119  continue;
120 
121  // Find 5x5 around max
122  const CaloSubdetectorTopology* topology = caloTopology.getSubdetectorTopology(DetId::Ecal, centerId.subdetId());
123  const std::vector<DetId>& ids = topology->getWindow(centerId, 5, 5);
124  for (std::vector<DetId>::const_iterator idItr = ids.begin(); idItr != ids.end(); ++idItr) {
125  if (std::find(interestingDetIdCollection->begin(), interestingDetIdCollection->end(), *idItr) ==
126  interestingDetIdCollection->end())
127  interestingDetIdCollection->push_back(*idItr);
128  }
129  }
130 
131  iEvent.put(std::move(interestingDetIdCollection));
132 }
133 
134 //define this as a plug-in
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
InterestingTrackEcalDetIdProducer(const edm::ParameterSet &)
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
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.
auto const & tracks
cannot be loose
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
bool getData(T &iHolder) const
Definition: EventSetup.h:122
int iEvent
Definition: GenABIO.cc:224
def move
Definition: eostools.py:511
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken
void produce(edm::Event &, const edm::EventSetup &) override
Definition: DetId.h:17
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
static FreeTrajectoryState getFreeTrajectoryState(const MagneticField *, const reco::Track &)
get FreeTrajectoryState from different track representations
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283