CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
HLTRechitsToDigis Class Reference

#include <HLTrigger/special/plugins/HLTRechitsToDigis.cc>

Inheritance diagram for HLTRechitsToDigis:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Types

enum  ecalRegion { invalidRegion =0, barrel, endcap }
 
- 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
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 

Public Member Functions

 HLTRechitsToDigis (const edm::ParameterSet &)
 
 ~HLTRechitsToDigis () override
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- 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 ()
 
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, std::unordered_multimap< std::string, edm::ProductResolverIndex > const &iIndicies, std::string const &moduleLabel)
 
virtual ~ProducerBase () noexcept(false)
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 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
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
static const HLTRechitsToDigis::ecalRegion stringToRegion (const std::string &region)
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

void produce (edm::Event &, edm::EventSetup const &) override
 

Private Attributes

edm::EDGetTokenT< EBDigiCollectiondigisEBInToken_
 
edm::EDGetTokenT< EEDigiCollectiondigisEEInToken_
 
edm::InputTag digisIn_
 
std::string digisOut_
 
edm::InputTag recHits_
 
edm::EDGetTokenT< EcalRecHitCollectionrecHitsToken_
 
ecalRegion region_
 

Additional Inherited Members

- 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

Description: [one line class summary]

Implementation: [Notes on implementation]

Definition at line 42 of file HLTRechitsToDigis.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 72 of file HLTRechitsToDigis.cc.

References barrel, digisEBInToken_, digisEEInToken_, digisIn_, digisOut_, endcap, edm::ParameterSet::getParameter(), invalidRegion, recHits_, recHitsToken_, region_, AlCaHLTBitMon_QueryRunRegistry::string, and stringToRegion().

73 {
74  //region to do rechit digi matching
75  region_ = stringToRegion(iConfig.getParameter<std::string> ("region"));
76 
77  // digis to match to hit collections
78  digisIn_ = iConfig.getParameter<edm::InputTag> ("digisIn");
79  digisOut_ = iConfig.getParameter<std::string> ("digisOut");
80 
81  // hit collections to save digis for
82  recHits_ = iConfig.getParameter<edm::InputTag> ("recHits");
83 
84  // region specific tokens
85  switch(region_) {
86  case barrel:
87  digisEBInToken_ = consumes<EBDigiCollection>(digisIn_);
88  produces<EBDigiCollection>(digisOut_);
89  break;
90  case endcap:
91  digisEEInToken_ = consumes<EEDigiCollection>(digisIn_);
92  produces<EEDigiCollection>(digisOut_);
93  break;
94  case invalidRegion:
95  break;
96  }
97 
98  recHitsToken_ = consumes<EcalRecHitCollection>(recHits_);
99 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EEDigiCollection > digisEEInToken_
static const HLTRechitsToDigis::ecalRegion stringToRegion(const std::string &region)
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
edm::InputTag digisIn_
edm::InputTag recHits_
edm::EDGetTokenT< EBDigiCollection > digisEBInToken_
HLTRechitsToDigis::~HLTRechitsToDigis ( )
override

Definition at line 101 of file HLTRechitsToDigis.cc.

102 {
103  // do anything here that needs to be done at desctruction time
104  // (e.g. close files, deallocate resources etc.)
105 }

Member Function Documentation

void HLTRechitsToDigis::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 212 of file HLTRechitsToDigis.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), DEFINE_FWK_MODULE, and AlCaHLTBitMon_QueryRunRegistry::string.

212  {
213  //The following says we do not know what parameters are allowed so do no validation
214  // Please change this to state exactly what you do use, even if it is no parameters
216 
217  desc.add<std::string>("region", "barrel")
218  ->setComment("Region of rechits to save Digis for. Allowed values: barrel or endcap.");
219  desc.add<edm::InputTag>("digisIn",edm::InputTag("ecalDigis","ebDigis"))
220  ->setComment("The collection of either barrel or endcap digis which correspond to the rechit collection");
221  desc.add<std::string>("digisOut","pi0EBDigis")
222  ->setComment("Name for the collection of Digis saved by the module");
223  desc.add<edm::InputTag>("recHits",edm::InputTag("hltAlCaPi0EBUncalibrator","pi0EcalRecHitsEB"))
224  ->setComment("Collection of rechits to match Digis to");
225  descriptions.add("hltFindMatchingECALDigisToRechits", desc);
226 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
void HLTRechitsToDigis::produce ( edm::Event iEvent,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Implements edm::stream::EDProducerBase.

Definition at line 120 of file HLTRechitsToDigis.cc.

References barrel, edm::SortedCollection< T, SORT >::begin(), digisEBInToken_, digisEEInToken_, digisOut_, edm::SortedCollection< T, SORT >::end(), edm::DataFrameContainer::end(), endcap, edm::DataFrameContainer::find(), edm::Event::getByToken(), EcalRecHit::id(), invalidRegion, eostools::move(), edm::Handle< T >::product(), edm::Event::put(), recHitsToken_, and region_.

120  {
121  using namespace edm;
122  // handles for digis
123  Handle<EBDigiCollection> digisEBHandle;
124  Handle<EEDigiCollection> digisEEHandle;
125 
126  // output collections
127  std::unique_ptr<EBDigiCollection> outputEBDigiCollection( new EBDigiCollection );
128  std::unique_ptr<EEDigiCollection> outputEEDigiCollection( new EEDigiCollection );
129 
130  // calibrated rechits
131  Handle<EcalRecHitCollection> recHitsHandle;
132  iEvent.getByToken(recHitsToken_, recHitsHandle);
133 
134  // match the digis based on the region
135  switch(region_) {
136  case barrel: {
137  iEvent.getByToken(digisEBInToken_, digisEBHandle);
138  const EBDigiCollection* digisEB = digisEBHandle.product();
139 
140  // loop over the collection of rechits and match to digis
142  for (ituneEB = recHitsHandle->begin(); ituneEB != recHitsHandle->end(); ituneEB++) {
143  EcalRecHit const & hit = (*ituneEB);
144  EcalDigiCollection::const_iterator digiLookUp = digisEB->find(hit.id());
145  // protect against a digi not existing
146  if( digiLookUp == digisEB->end()) continue;
147  outputEBDigiCollection->push_back( digiLookUp->id(), digiLookUp->begin() );
148  }
149 
150  // add the built collection to the event
151  iEvent.put(std::move(outputEBDigiCollection), digisOut_);
152  break;
153  }
154  case endcap: {
155  iEvent.getByToken(digisEEInToken_, digisEEHandle);
156  const EEDigiCollection* digisEE = digisEEHandle.product();
157 
158  // loop over the collection of rechits and match to digis
160  for (ituneEE = recHitsHandle->begin(); ituneEE != recHitsHandle->end(); ituneEE++) {
161  EcalRecHit const & hit = (*ituneEE);
162  EcalDigiCollection::const_iterator digiLookUp = digisEE->find(hit.id());
163  // protect against a digi not existing for the saved rechit
164  if(digiLookUp == digisEE->end()) continue;
165  outputEEDigiCollection->push_back( digiLookUp->id(), digiLookUp->begin() );
166  } // end loop over endcap rechits
167 
168  // add the built collection to the event
169  iEvent.put(std::move(outputEEDigiCollection), digisOut_);
170  break;
171  }
172  case invalidRegion: {
173  break;
174  }
175  } // end switch statement for the region (barrel, endcap, invalid)
176 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:122
boost::transform_iterator< IterHelp, boost::counting_iterator< int > > const_iterator
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:460
std::vector< EcalRecHit >::const_iterator const_iterator
edm::EDGetTokenT< EEDigiCollection > digisEEInToken_
const_iterator find(id_type i) const
edm::EDGetTokenT< EcalRecHitCollection > recHitsToken_
const_iterator end() const
DetId id() const
get the id
Definition: EcalRecHit.h:77
T const * product() const
Definition: Handle.h:81
const_iterator end() const
HLT enums.
edm::EDGetTokenT< EBDigiCollection > digisEBInToken_
def move(src, dest)
Definition: eostools.py:510
const_iterator begin() const
const HLTRechitsToDigis::ecalRegion HLTRechitsToDigis::stringToRegion ( const std::string &  region)
static

Definition at line 111 of file HLTRechitsToDigis.cc.

References barrel, endcap, and invalidRegion.

Referenced by HLTRechitsToDigis().

111  {
112  if (region == "barrel") return barrel;
113  else if (region == "endcap") return endcap;
114  else return invalidRegion;
115 }

Member Data Documentation

edm::EDGetTokenT<EBDigiCollection> HLTRechitsToDigis::digisEBInToken_
private

Definition at line 55 of file HLTRechitsToDigis.cc.

Referenced by HLTRechitsToDigis(), and produce().

edm::EDGetTokenT<EEDigiCollection> HLTRechitsToDigis::digisEEInToken_
private

Definition at line 56 of file HLTRechitsToDigis.cc.

Referenced by HLTRechitsToDigis(), and produce().

edm::InputTag HLTRechitsToDigis::digisIn_
private

Definition at line 60 of file HLTRechitsToDigis.cc.

Referenced by HLTRechitsToDigis().

std::string HLTRechitsToDigis::digisOut_
private

Definition at line 64 of file HLTRechitsToDigis.cc.

Referenced by HLTRechitsToDigis(), and produce().

edm::InputTag HLTRechitsToDigis::recHits_
private

Definition at line 61 of file HLTRechitsToDigis.cc.

Referenced by HLTRechitsToDigis().

edm::EDGetTokenT<EcalRecHitCollection> HLTRechitsToDigis::recHitsToken_
private

Definition at line 57 of file HLTRechitsToDigis.cc.

Referenced by HLTRechitsToDigis(), and produce().

ecalRegion HLTRechitsToDigis::region_
private

Definition at line 65 of file HLTRechitsToDigis.cc.

Referenced by HLTRechitsToDigis(), and produce().