CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ReduceHcalRecHitCollectionProducer Class Reference
Inheritance diagram for ReduceHcalRecHitCollectionProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 ReduceHcalRecHitCollectionProducer (const edm::ParameterSet &)
 
 ~ReduceHcalRecHitCollectionProducer () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Private Attributes

edm::EDGetTokenT< reco::TrackCollectioninputCollectionToken_
 
TrackAssociatorParameters parameters_
 
double ptcut_
 
edm::EDGetTokenT< HBHERecHitCollectionrecHitsToken_
 
std::string reducedHitsCollection_
 
TrackDetectorAssociator trackAssociator_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Detailed Description

Definition at line 63 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

Constructor & Destructor Documentation

◆ ReduceHcalRecHitCollectionProducer()

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

Definition at line 90 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

90  {
91  recHitsToken_ = consumes<HBHERecHitCollection>(iConfig.getParameter<edm::InputTag>("recHitsLabel"));
92 
93  reducedHitsCollection_ = iConfig.getParameter<std::string>("reducedHitsCollection");
94 
95  //register your products
96  produces<HBHERecHitCollection>(reducedHitsCollection_);
97 
98  inputCollectionToken_ = consumes<reco::TrackCollection>(iConfig.getParameter<edm::InputTag>("inputCollection"));
99  ptcut_ = iConfig.getParameter<double>("TrackPt");
100 
101  produces<DetIdCollection>();
102  // TrackAssociator parameters
103  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
107 }

References edm::EDConsumerBase::consumesCollector(), edm::ParameterSet::getParameter(), inputCollectionToken_, TrackAssociatorParameters::loadParameters(), parameters_, ptcut_, recHitsToken_, reducedHitsCollection_, AlCaHLTBitMon_QueryRunRegistry::string, trackAssociator_, and TrackDetectorAssociator::useDefaultPropagator().

◆ ~ReduceHcalRecHitCollectionProducer()

ReduceHcalRecHitCollectionProducer::~ReduceHcalRecHitCollectionProducer ( )
override

Definition at line 109 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

109  {
110  // do anything here that needs to be done at desctruction time
111  // (e.g. close files, deallocate resources etc.)
112 }

Member Function Documentation

◆ produce()

void ReduceHcalRecHitCollectionProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 119 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

119  {
120  using namespace edm;
121 
122  using namespace std;
123 
124  using reco::TrackCollection;
125 
126  Handle<HBHERecHitCollection> recHitsHandle;
127  iEvent.getByToken(recHitsToken_, recHitsHandle);
128  if (!recHitsHandle.isValid()) {
129  edm::LogError("ReduceHcalRecHitCollectionProducer") << "RecHit collection not found";
130  return;
131  }
132 
133  //Create empty output collections
134  std::unique_ptr<HBHERecHitCollection> miniRecHitCollection(new HBHERecHitCollection);
135 
136  //loop through tracks.
137  Handle<TrackCollection> tkTracks;
138  iEvent.getByToken(inputCollectionToken_, tkTracks);
139  std::unique_ptr<DetIdCollection> interestingDetIdCollection(new DetIdCollection());
140  for (TrackCollection::const_iterator itTrack = tkTracks->begin(); itTrack != tkTracks->end(); ++itTrack) {
141  if (itTrack->pt() > ptcut_) {
144 
145  if (!info.crossedHcalIds.empty()) {
146  //loop through hits in the cone
147  for (std::vector<const HBHERecHit*>::const_iterator hit = info.hcalRecHits.begin();
148  hit != info.hcalRecHits.end();
149  ++hit) {
150  DetId hitid = (*hit)->id();
151  HBHERecHitCollection::const_iterator iRecHit = recHitsHandle->find(hitid);
152  if ((iRecHit != recHitsHandle->end()) && (miniRecHitCollection->find(hitid) == miniRecHitCollection->end()))
153  miniRecHitCollection->push_back(*iRecHit);
154  }
155  }
156  }
157  }
158 
159  iEvent.put(std::move(miniRecHitCollection), reducedHitsCollection_);
160 }

References TrackDetectorAssociator::associate(), edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), iEvent, info(), inputCollectionToken_, TrackDetectorAssociator::InsideOut, interestingDetIdCollectionProducer_cfi::interestingDetIdCollection, edm::HandleBase::isValid(), eostools::move(), parameters_, ptcut_, recHitsToken_, reducedHitsCollection_, and trackAssociator_.

Member Data Documentation

◆ inputCollectionToken_

edm::EDGetTokenT<reco::TrackCollection> ReduceHcalRecHitCollectionProducer::inputCollectionToken_
private

◆ parameters_

TrackAssociatorParameters ReduceHcalRecHitCollectionProducer::parameters_
private

◆ ptcut_

double ReduceHcalRecHitCollectionProducer::ptcut_
private

◆ recHitsToken_

edm::EDGetTokenT<HBHERecHitCollection> ReduceHcalRecHitCollectionProducer::recHitsToken_
private

◆ reducedHitsCollection_

std::string ReduceHcalRecHitCollectionProducer::reducedHitsCollection_
private

◆ trackAssociator_

TrackDetectorAssociator ReduceHcalRecHitCollectionProducer::trackAssociator_
private
edm::SortedCollection::const_iterator
std::vector< T >::const_iterator const_iterator
Definition: SortedCollection.h:80
edm
HLT enums.
Definition: AlignableModifier.h:19
TrackDetectorAssociator::useDefaultPropagator
void useDefaultPropagator()
use the default propagator
Definition: TrackDetectorAssociator.cc:120
edm::SortedCollection
Definition: SortedCollection.h:49
edm::EDConsumerBase::consumesCollector
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
Definition: EDConsumerBase.cc:71
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:152
ReduceHcalRecHitCollectionProducer::recHitsToken_
edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
Definition: Skim_ReduceHcalRecHitCollectionProducer.cc:70
ReduceHcalRecHitCollectionProducer::trackAssociator_
TrackDetectorAssociator trackAssociator_
Definition: Skim_ReduceHcalRecHitCollectionProducer.cc:73
edm::Handle
Definition: AssociativeIterator.h:50
parameters
parameters
Definition: BeamSpot_PayloadInspector.cc:14
DetId
Definition: DetId.h:17
ReduceHcalRecHitCollectionProducer::ptcut_
double ptcut_
Definition: Skim_ReduceHcalRecHitCollectionProducer.cc:75
TrackAssociatorParameters::loadParameters
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
Definition: TrackAssociatorParameters.cc:18
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
edm::LogError
Definition: MessageLogger.h:183
edm::SortedCollection::end
const_iterator end() const
Definition: SortedCollection.h:267
iEvent
int iEvent
Definition: GenABIO.cc:224
ReduceHcalRecHitCollectionProducer::inputCollectionToken_
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
Definition: Skim_ReduceHcalRecHitCollectionProducer.cc:72
TrackDetectorAssociator::InsideOut
Definition: TrackDetectorAssociator.h:55
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:14
edm::SortedCollection::find
iterator find(key_type k)
Definition: SortedCollection.h:240
eostools.move
def move(src, dest)
Definition: eostools.py:511
std
Definition: JetResolutionObject.h:76
DetIdCollection
edm::EDCollection< DetId > DetIdCollection
Definition: DetIdCollection.h:7
ReduceHcalRecHitCollectionProducer::reducedHitsCollection_
std::string reducedHitsCollection_
Definition: Skim_ReduceHcalRecHitCollectionProducer.cc:71
TrackDetectorAssociator::associate
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
Definition: TrackDetectorAssociator.cc:154
edm::HandleBase::isValid
bool isValid() const
Definition: HandleBase.h:70
interestingDetIdCollectionProducer_cfi.interestingDetIdCollection
interestingDetIdCollection
Definition: interestingDetIdCollectionProducer_cfi.py:11
edm::InputTag
Definition: InputTag.h:15
reco::TrackCollection
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
edm::ConsumesCollector
Definition: ConsumesCollector.h:39
ReduceHcalRecHitCollectionProducer::parameters_
TrackAssociatorParameters parameters_
Definition: Skim_ReduceHcalRecHitCollectionProducer.cc:74
hit
Definition: SiStripHitEffFromCalibTree.cc:88