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
 
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)
 
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::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 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 65 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 92 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().

93 {
94  recHitsToken_ = consumes<HBHERecHitCollection>(iConfig.getParameter< edm::InputTag > ("recHitsLabel"));
95 
96  reducedHitsCollection_ = iConfig.getParameter<std::string>("reducedHitsCollection");
97 
98  //register your products
99  produces< HBHERecHitCollection > (reducedHitsCollection_) ;
100 
101  inputCollectionToken_ = consumes<reco::TrackCollection>(iConfig.getParameter< edm::InputTag >("inputCollection"));
102  ptcut_= iConfig.getParameter< double >("TrackPt");
103 
104  produces< DetIdCollection >() ;
105  // TrackAssociator parameters
106  edm::ParameterSet parameters = iConfig.getParameter<edm::ParameterSet>("TrackAssociatorParameters");
110 
111 }
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 114 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

115 {
116 
117  // do anything here that needs to be done at desctruction time
118  // (e.g. close files, deallocate resources etc.)
119 
120 }

Member Function Documentation

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

Definition at line 129 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_.

130 {
131  using namespace edm;
132 
133  using namespace std;
134 
135  using reco::TrackCollection;
136 
137  Handle<HBHERecHitCollection> recHitsHandle;
138  iEvent.getByToken(recHitsToken_,recHitsHandle);
139  if( !recHitsHandle.isValid() )
140  {
141  edm::LogError("ReduceHcalRecHitCollectionProducer") << "RecHit collection not found";
142  return;
143  }
144 
145  //Create empty output collections
146  std::unique_ptr< HBHERecHitCollection > miniRecHitCollection (new HBHERecHitCollection) ;
147 
148 //loop through tracks.
149  Handle<TrackCollection> tkTracks;
150  iEvent.getByToken(inputCollectionToken_,tkTracks);
151  std::unique_ptr< DetIdCollection > interestingDetIdCollection( new DetIdCollection() ) ;
152  for(TrackCollection::const_iterator itTrack = tkTracks->begin();
153  itTrack != tkTracks->end();
154  ++itTrack) {
155  if(itTrack->pt()>ptcut_){
156 
158 
159  if(!info.crossedHcalIds.empty()){
160  //loop through hits in the cone
161  for(std::vector<const HBHERecHit*>::const_iterator hit = info.hcalRecHits.begin();
162  hit != info.hcalRecHits.end(); ++hit)
163  {
164  DetId hitid=(*hit)->id();
165  HBHERecHitCollection::const_iterator iRecHit = recHitsHandle->find(hitid);
166  if ( (iRecHit != recHitsHandle->end()) && (miniRecHitCollection->find(hitid) == miniRecHitCollection->end()) )
167  miniRecHitCollection->push_back(*iRecHit);
168  }
169 
170 
171  }
172  }
173  }
174 
175  iEvent.put(std::move(miniRecHitCollection),reducedHitsCollection_ );
176 
177 
178 
179 }
static const TGPicture * info(bool iBackgroundIsBlack)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:137
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
edm::EDGetTokenT< HBHERecHitCollection > recHitsToken_
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
std::vector< HBHERecHit >::const_iterator const_iterator
std::vector< DetId > crossedHcalIds
std::vector< const HBHERecHit * > hcalRecHits
bool isValid() const
Definition: HandleBase.h:74
const_iterator end() const
Definition: DetId.h:18
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:510

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