CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual void produce (edm::Event &, const edm::EventSetup &) override
 
 ReduceHcalRecHitCollectionProducer (const edm::ParameterSet &)
 
 ~ReduceHcalRecHitCollectionProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (std::string const &iProcessName, std::string const &iModuleLabel, bool iPrint, std::vector< char const * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Attributes

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

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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)
 
- 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(), HLT_25ns10e33_v2_cff::parameters, 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 ( )

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 
)
overridevirtual

Implements edm::EDProducer.

Definition at line 129 of file Skim_ReduceHcalRecHitCollectionProducer.cc.

References TrackDetectorAssociator::associate(), TrackDetMatchInfo::crossedHcalIds, edm::Event::getByToken(), TrackDetMatchInfo::hcalRecHits, info(), inputCollectionToken_, TrackDetectorAssociator::InsideOut, 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::auto_ptr< HBHERecHitCollection > miniRecHitCollection (new HBHERecHitCollection) ;
147 
148 //loop through tracks.
149  Handle<TrackCollection> tkTracks;
150  iEvent.getByToken(inputCollectionToken_,tkTracks);
151  std::auto_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.size()>0){
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( miniRecHitCollection,reducedHitsCollection_ );
176 
177 
178 
179 }
static const TGPicture * info(bool iBackgroundIsBlack)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
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
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:121
std::vector< const HBHERecHit * > hcalRecHits
Definition: DetId.h:18
edm::EDGetTokenT< reco::TrackCollection > inputCollectionToken_
TrackDetMatchInfo associate(const edm::Event &, const edm::EventSetup &, const FreeTrajectoryState &, const AssociatorParameters &)
edm::EDCollection< DetId > DetIdCollection

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