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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
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
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, 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)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 63 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 90 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

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

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 }
T getParameter(std::string const &) const
edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
void useDefaultPropagator()
use the default propagator
void loadParameters(const edm::ParameterSet &, edm::ConsumesCollector &)
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
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

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

Definition at line 119 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

References TrackDetectorAssociator::associate(), TrackDetMatchInfo::crossedHcalIds, DEFINE_FWK_MODULE, edm::SortedCollection< T, SORT >::end(), edm::SortedCollection< T, SORT >::find(), edm::Event::getByToken(), TrackDetMatchInfo::hcalRecHits, info(), inputCollectionToken_, TrackDetectorAssociator::InsideOut, interestingDetIdCollectionProducer_cfi::interestingDetIdCollection, edm::HandleBase::isValid(), eostools::move(), parameters_, ptcut_, edm::Event::put(), recHitsToken_, reducedHitsCollection_, and trackAssociator_.

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 }
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::vector< T >::const_iterator const_iterator
std::vector< DetId > crossedHcalIds
std::vector< const HBHERecHit * > hcalRecHits
bool isValid() const
Definition: HandleBase.h:70
const_iterator end() const
Definition: DetId.h:17
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
iterator find(key_type k)
HLT enums.
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
edm::EDCollection< DetId > DetIdCollection
def move(src, dest)
Definition: eostools.py:511

Member Data Documentation

edm::EDGetTokenT<reco::TrackCollection> ReduceHcalRecHitCollectionProducer::inputCollectionToken_
private
TrackAssociatorParameters ReduceHcalRecHitCollectionProducer::parameters_
private
double ReduceHcalRecHitCollectionProducer::ptcut_
private
edm::EDGetTokenT<HBHERecHitCollection> ReduceHcalRecHitCollectionProducer::recHitsToken_
private
std::string ReduceHcalRecHitCollectionProducer::reducedHitsCollection_
private
TrackDetectorAssociator ReduceHcalRecHitCollectionProducer::trackAssociator_
private