CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
ReduceHcalRecHitCollectionProducer Class Reference
Inheritance diagram for ReduceHcalRecHitCollectionProducer:
edm::stream::EDProducer<>

Public Member Functions

void produce (edm::Event &, const edm::EventSetup &) override
 
 ReduceHcalRecHitCollectionProducer (const edm::ParameterSet &)
 
 ~ReduceHcalRecHitCollectionProducer () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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::stream::EDProducer<>
typedef CacheContexts< T... > CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T... > HasAbility
 
typedef CacheTypes::LuminosityBlockCache LuminosityBlockCache
 
typedef LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCacheLuminosityBlockContext
 
typedef CacheTypes::LuminosityBlockSummaryCache LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache, GlobalCacheRunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 

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");
104  edm::ConsumesCollector iC = consumesCollector();
107 }

References 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 
)
override

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
BeamSpotPI::parameters
parameters
Definition: BeamSpotPayloadInspectorHelper.h:29
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:81
edm::SortedCollection
Definition: SortedCollection.h:49
info
static const TGPicture * info(bool iBackgroundIsBlack)
Definition: FWCollectionSummaryWidget.cc:153
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
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:47
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
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
TrackDetectorAssociator::InsideOut
Definition: TrackDetectorAssociator.h:50
TrackDetMatchInfo
Definition: TrackDetMatchInfo.h:13
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
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
TrackDetectorAssociator::associate
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
Definition: TrackDetectorAssociator.cc:110
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:45
ReduceHcalRecHitCollectionProducer::parameters_
TrackAssociatorParameters parameters_
Definition: Skim_ReduceHcalRecHitCollectionProducer.cc:74
hit
Definition: SiStripHitEffFromCalibTree.cc:88