CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
InterestingTrackEcalDetIdProducer Class Reference

#include <Producers/InterestingTrackEcalDetIdProducer/src/InterestingTrackEcalDetIdProducer.cc>

Inheritance diagram for InterestingTrackEcalDetIdProducer:
edm::stream::EDProducer<>

Public Member Functions

 InterestingTrackEcalDetIdProducer (const edm::ParameterSet &)
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
 EDProducer (const EDProducer &)=delete
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
const EDProduceroperator= (const EDProducer &)=delete
 

Private Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

edm::ESGetToken< CaloTopology, CaloTopologyRecordcaloTopologyToken_
 
double minTrackPt_
 
TrackDetectorAssociator trackAssociator_
 
TrackAssociatorParameters trackAssociatorParameters_
 
edm::ParameterSet trackAssociatorPS_
 
edm::EDGetTokenT< reco::TrackCollectiontrackCollectionToken_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T... >
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T... >
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 47 of file InterestingTrackEcalDetIdProducer.cc.

Constructor & Destructor Documentation

◆ InterestingTrackEcalDetIdProducer()

InterestingTrackEcalDetIdProducer::InterestingTrackEcalDetIdProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 76 of file InterestingTrackEcalDetIdProducer.cc.

References edm::ParameterSet::getParameter(), TrackAssociatorParameters::loadParameters(), trackAssociator_, trackAssociatorParameters_, trackCollectionToken_, and TrackDetectorAssociator::useDefaultPropagator().

77  : minTrackPt_(iConfig.getParameter<double>("MinTrackPt")),
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 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
void useDefaultPropagator()
use the default propagator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
edm::EDGetTokenT< reco::TrackCollection > trackCollectionToken_
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_

Member Function Documentation

◆ produce()

void InterestingTrackEcalDetIdProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 94 of file InterestingTrackEcalDetIdProducer.cc.

References TrackDetectorAssociator::associate(), TrackAssociatorParameters::bFieldToken, caloTopologyToken_, DetId::Ecal, TrackDetMatchInfo::EcalRecHits, spr::find(), edm::EventSetup::getData(), TrackDetectorAssociator::getFreeTrajectoryState(), CaloSubdetectorTopology::getWindow(), iEvent, info(), interestingDetIdCollectionProducer_cfi::interestingDetIdCollection, minTrackPt_, eostools::move(), DetId::rawId(), DetId::subdetId(), trackAssociator_, trackAssociatorParameters_, trackCollectionToken_, and pwdgSkimBPark_cfi::tracks.

94  {
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
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) ==
127  interestingDetIdCollection->push_back(*idItr);
128  }
129  }
130 
132 }
static const TGPicture * info(bool iBackgroundIsBlack)
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
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
edm::ESGetToken< MagneticField, IdealMagneticFieldRecord > bFieldToken
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
Definition: DetId.h:17
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
static FreeTrajectoryState getFreeTrajectoryState(const MagneticField *, const reco::Track &)
get FreeTrajectoryState from different track representations
HLT enums.
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

◆ caloTopologyToken_

edm::ESGetToken<CaloTopology, CaloTopologyRecord> InterestingTrackEcalDetIdProducer::caloTopologyToken_
private

Definition at line 60 of file InterestingTrackEcalDetIdProducer.cc.

Referenced by produce().

◆ minTrackPt_

double InterestingTrackEcalDetIdProducer::minTrackPt_
private

Definition at line 58 of file InterestingTrackEcalDetIdProducer.cc.

Referenced by produce().

◆ trackAssociator_

TrackDetectorAssociator InterestingTrackEcalDetIdProducer::trackAssociator_
private

◆ trackAssociatorParameters_

TrackAssociatorParameters InterestingTrackEcalDetIdProducer::trackAssociatorParameters_
private

◆ trackAssociatorPS_

edm::ParameterSet InterestingTrackEcalDetIdProducer::trackAssociatorPS_
private

Definition at line 56 of file InterestingTrackEcalDetIdProducer.cc.

◆ trackCollectionToken_

edm::EDGetTokenT<reco::TrackCollection> InterestingTrackEcalDetIdProducer::trackCollectionToken_
private