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 // 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
101  iEvent.getByToken(trackCollectionToken_, tracks);
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 
116  DetId centerId = info.findMaxDeposition(TrackDetMatchInfo::EcalRecHits);
117 
118  if (centerId.rawId() == 0)
119  continue;
120 
121  // Find 5x5 around max
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) ==
127  interestingDetIdCollection->push_back(*idItr);
128  }
129  }
130 
132 }
133 
134 //define this as a plug-in
InterestingTrackEcalDetIdProducer::caloTopologyToken_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
Definition: InterestingTrackEcalDetIdProducer.cc:60
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
InterestingTrackEcalDetIdProducer::InterestingTrackEcalDetIdProducer
InterestingTrackEcalDetIdProducer(const edm::ParameterSet &)
Definition: InterestingTrackEcalDetIdProducer.cc:76
InterestingTrackEcalDetIdProducer::trackCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
Definition: InterestingTrackEcalDetIdProducer.cc:55
TrackDetectorAssociator.h
edm::EDGetTokenT< reco::TrackCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackDetectorAssociator::useDefaultPropagator
void useDefaultPropagator()
use the default propagator
Definition: TrackDetectorAssociator.cc:81
CaloTopology::getWindow
std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Get the neighbors of the given cell in a window of given size.
Definition: CaloTopology.cc:64
EBDetId.h
EEDetId.h
EDProducer.h
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
spr::find
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
edm::Handle< reco::TrackCollection >
EcalRecHitCollections.h
TrackDetMatchInfo::EcalRecHits
Definition: TrackDetMatchInfo.h:15
DetId
Definition: DetId.h:17
MakerMacros.h
Track.h
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ecaldqm::topology
const CaloTopology * topology(nullptr)
TrackAssociatorParameters::loadParameters
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
Definition: TrackAssociatorParameters.cc:18
InterestingTrackEcalDetIdProducer
Definition: InterestingTrackEcalDetIdProducer.cc:47
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
edm::ParameterSet
Definition: ParameterSet.h:47
Event.h
TrackDetectorAssociator::getFreeTrajectoryState
static FreeTrajectoryState getFreeTrajectoryState(const MagneticField *, const reco::Track &)
get FreeTrajectoryState from different track representations
Definition: TrackDetectorAssociator.cc:553
CaloTopology::getSubdetectorTopology
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:17
InterestingTrackEcalDetIdProducer::minTrackPt_
double minTrackPt_
Definition: InterestingTrackEcalDetIdProducer.cc:58
TrackDetectorAssociator
Definition: TrackDetectorAssociator.h:44
CaloTopologyRecord.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:38
InterestingTrackEcalDetIdProducer::trackAssociatorPS_
edm::ParameterSet trackAssociatorPS_
Definition: InterestingTrackEcalDetIdProducer.cc:56
edm::EventSetup
Definition: EventSetup.h:57
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
DetId::Ecal
Definition: DetId.h:27
edm::ESGetToken< CaloTopology, CaloTopologyRecord >
InterestingTrackEcalDetIdProducer::trackAssociator_
TrackDetectorAssociator trackAssociator_
Definition: InterestingTrackEcalDetIdProducer.cc:61
edm::EventSetup::getData
bool getData(T &iHolder) const
Definition: EventSetup.h:120
CaloTopology.h
CaloSubdetectorTopology.h
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:13
eostools.move
def move(src, dest)
Definition: eostools.py:511
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
InterestingTrackEcalDetIdProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: InterestingTrackEcalDetIdProducer.cc:94
Frameworkfwd.h
InterestingTrackEcalDetIdProducer::trackAssociatorParameters_
TrackAssociatorParameters trackAssociatorParameters_
Definition: InterestingTrackEcalDetIdProducer.cc:62
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackAssociatorParameters::bFieldToken
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken
Definition: TrackAssociatorParameters.h:130
TrackDetectorAssociator::associate
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
Definition: TrackDetectorAssociator.cc:110
ParameterSet.h
edm::Event
Definition: Event.h:73
TrackAssociatorParameters.h
interestingDetIdCollectionProducer_cfi.interestingDetIdCollection
interestingDetIdCollection
Definition: interestingDetIdCollectionProducer_cfi.py:11
edm::InputTag
Definition: InputTag.h:15
edm::ConsumesCollector
Definition: ConsumesCollector.h:45
DetIdCollection.h
TrackAssociatorParameters
Definition: TrackAssociatorParameters.h:43