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:
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 
120 
121  DetId centerId = info.findMaxDeposition(TrackDetMatchInfo::EcalRecHits);
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
PDWG_EXOHSCP_cff.tracks
tracks
Definition: PDWG_EXOHSCP_cff.py:28
InterestingTrackEcalDetIdProducer::beginRun
void beginRun(edm::Run const &, const edm::EventSetup &) override
Definition: InterestingTrackEcalDetIdProducer.cc:139
InterestingTrackEcalDetIdProducer::trackCollection_
edm::InputTag trackCollection_
Definition: InterestingTrackEcalDetIdProducer.cc:58
InterestingTrackEcalDetIdProducer::InterestingTrackEcalDetIdProducer
InterestingTrackEcalDetIdProducer(const edm::ParameterSet &)
Definition: InterestingTrackEcalDetIdProducer.cc:79
InterestingTrackEcalDetIdProducer::trackCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
Definition: InterestingTrackEcalDetIdProducer.cc:57
TrackDetectorAssociator.h
edm::Run
Definition: Run.h:45
edm::EDGetTokenT< reco::TrackCollection >
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackDetectorAssociator::useDefaultPropagator
void useDefaultPropagator()
use the default propagator
Definition: TrackDetectorAssociator.cc:120
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:152
CaloTopologyRecord
Definition: CaloTopologyRecord.h:10
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 >
CaloTopology
Definition: CaloTopology.h:19
EcalRecHitCollections.h
TrackDetectorAssociator::getFreeTrajectoryState
static FreeTrajectoryState getFreeTrajectoryState(const edm::EventSetup &, const reco::Track &)
get FreeTrajectoryState from different track representations
Definition: TrackDetectorAssociator.cc:600
TrackDetMatchInfo::EcalRecHits
Definition: TrackDetMatchInfo.h:16
DetId
Definition: DetId.h:17
MakerMacros.h
Track.h
edm::EventSetup::get
T get() const
Definition: EventSetup.h:73
DEFINE_FWK_MODULE
#define DEFINE_FWK_MODULE(type)
Definition: MakerMacros.h:16
ecaldqm::topology
const CaloTopology * topology(nullptr)
edm::ESHandle< CaloTopology >
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:36
Event.h
ParameterSet
Definition: Functions.h:16
InterestingTrackEcalDetIdProducer::caloTopology_
const CaloTopology * caloTopology_
Definition: InterestingTrackEcalDetIdProducer.cc:63
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:61
TrackDetectorAssociator
Definition: TrackDetectorAssociator.h:49
CaloTopologyRecord.h
iEvent
int iEvent
Definition: GenABIO.cc:224
edm::stream::EDProducer
Definition: EDProducer.h:38
InterestingTrackEcalDetIdProducer::trackAssociatorPS_
edm::ParameterSet trackAssociatorPS_
Definition: InterestingTrackEcalDetIdProducer.cc:59
edm::EventSetup
Definition: EventSetup.h:57
CaloSubdetectorTopology
Definition: CaloSubdetectorTopology.h:17
DetId::Ecal
Definition: DetId.h:27
get
#define get
InterestingTrackEcalDetIdProducer::~InterestingTrackEcalDetIdProducer
~InterestingTrackEcalDetIdProducer() override
Definition: InterestingTrackEcalDetIdProducer.cc:94
InterestingTrackEcalDetIdProducer::trackAssociator_
TrackDetectorAssociator trackAssociator_
Definition: InterestingTrackEcalDetIdProducer.cc:64
CaloTopology.h
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
CaloSubdetectorTopology.h
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:14
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
writedatasetfile.run
run
Definition: writedatasetfile.py:27
InterestingTrackEcalDetIdProducer::produce
void produce(edm::Event &, const edm::EventSetup &) override
Definition: InterestingTrackEcalDetIdProducer.cc:104
Frameworkfwd.h
InterestingTrackEcalDetIdProducer::trackAssociatorParameters_
TrackAssociatorParameters trackAssociatorParameters_
Definition: InterestingTrackEcalDetIdProducer.cc:65
TrackDetectorAssociator::associate
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
Definition: TrackDetectorAssociator.cc:154
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:39
DetIdCollection.h
TrackAssociatorParameters
Definition: TrackAssociatorParameters.h:34