CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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,
CaloTopologyRecord
caloTopologyToken_
 
double minTrackPt_
 
TrackDetectorAssociator trackAssociator_
 
TrackAssociatorParameters trackAssociatorParameters_
 
edm::ParameterSet trackAssociatorPS_
 
edm::EDGetTokenT
< reco::TrackCollection
trackCollectionToken_
 

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

Member Function Documentation

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(), TrackDetMatchInfo::findMaxDeposition(), edm::Event::getByToken(), edm::EventSetup::getData(), TrackDetectorAssociator::getFreeTrajectoryState(), CaloSubdetectorTopology::getWindow(), info(), minTrackPt_, eostools::move(), edm::Event::put(), DetId::rawId(), DetId::subdetId(), trackAssociator_, trackAssociatorParameters_, trackCollectionToken_, and tracks.

94  {
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 }
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
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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:128
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
Definition: DetId.h:17
edm::ESGetToken< CaloTopology, CaloTopologyRecord > caloTopologyToken_
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
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 &)

Member Data Documentation

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

Definition at line 60 of file InterestingTrackEcalDetIdProducer.cc.

Referenced by produce().

double InterestingTrackEcalDetIdProducer::minTrackPt_
private

Definition at line 58 of file InterestingTrackEcalDetIdProducer.cc.

Referenced by produce().

TrackDetectorAssociator InterestingTrackEcalDetIdProducer::trackAssociator_
private
TrackAssociatorParameters InterestingTrackEcalDetIdProducer::trackAssociatorParameters_
private
edm::ParameterSet InterestingTrackEcalDetIdProducer::trackAssociatorPS_
private

Definition at line 56 of file InterestingTrackEcalDetIdProducer.cc.

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