CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
HLTRechitInRegionsProducer< T1 > Class Template Reference
Inheritance diagram for HLTRechitInRegionsProducer< T1 >:
edm::stream::EDProducer<>

Public Member Functions

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

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Private Types

typedef std::vector< T1 > T1Collection
 
typedef T1::const_iterator T1iterator
 

Private Member Functions

void getEtaPhiRegions (std::vector< RectangularEtaPhiRegion > *, T1Collection, const L1CaloGeometry &, bool)
 
template<>
void getEtaPhiRegions (std::vector< RectangularEtaPhiRegion > *theRegions, T1Collection theCandidateCollection, const L1CaloGeometry &l1CaloGeom, bool isolatedCase)
 

Private Attributes

const edm::ESGetToken
< CaloGeometry,
CaloGeometryRecord
caloGeometryToken_
 
const bool doIsolated_
 
const std::vector< edm::InputTaghitLabels
 
std::vector< edm::EDGetTokenT
< EcalRecHitCollection > > 
hitTokens
 
const edm::ESGetToken
< L1CaloGeometry,
L1CaloGeometryRecord
l1CaloGeometryToken_
 
const double l1LowerThr_
 
const double l1LowerThrIgnoreIsolation_
 
const edm::EDGetTokenT
< T1Collection
l1TokenIsolated_
 
const edm::EDGetTokenT
< T1Collection
l1TokenNonIsolated_
 
const double l1UpperThr_
 
const std::vector< std::string > productLabels
 
const double regionEtaMargin_
 
const double regionPhiMargin_
 
std::vector< edm::EDGetTokenT
< EcalUncalibratedRecHitCollection > > 
uncalibHitTokens
 
const bool useUncalib_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
using CacheTypes = CacheContexts< T...>
 
using GlobalCache = typename CacheTypes::GlobalCache
 
using HasAbility = AbilityChecker< T...>
 
using InputProcessBlockCache = typename CacheTypes::InputProcessBlockCache
 
using LuminosityBlockCache = typename CacheTypes::LuminosityBlockCache
 
using LuminosityBlockContext = LuminosityBlockContextT< LuminosityBlockCache, RunCache, GlobalCache >
 
using LuminosityBlockSummaryCache = typename CacheTypes::LuminosityBlockSummaryCache
 
using RunCache = typename CacheTypes::RunCache
 
using RunContext = RunContextT< RunCache, GlobalCache >
 
using RunSummaryCache = typename CacheTypes::RunSummaryCache
 

Detailed Description

template<typename T1>
class HLTRechitInRegionsProducer< T1 >

Definition at line 72 of file HLTRechitInRegionsProducer.cc.

Member Typedef Documentation

template<typename T1 >
typedef std::vector<T1> HLTRechitInRegionsProducer< T1 >::T1Collection
private

Definition at line 73 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
typedef T1::const_iterator HLTRechitInRegionsProducer< T1 >::T1iterator
private

Definition at line 74 of file HLTRechitInRegionsProducer.cc.

Constructor & Destructor Documentation

template<typename T1 >
HLTRechitInRegionsProducer< T1 >::HLTRechitInRegionsProducer ( const edm::ParameterSet ps)

Definition at line 110 of file HLTRechitInRegionsProducer.cc.

References DeDxTools::esConsumes().

111  : useUncalib_(ps.getParameter<bool>("useUncalib")),
112  doIsolated_(ps.getParameter<bool>("doIsolated")),
113  l1TokenIsolated_(doIsolated_ ? consumes<T1Collection>(ps.getParameter<edm::InputTag>("l1TagIsolated"))
115  l1TokenNonIsolated_(consumes<T1Collection>(ps.getParameter<edm::InputTag>("l1TagNonIsolated"))),
116  l1LowerThr_(ps.getParameter<double>("l1LowerThr")),
117  l1UpperThr_(ps.getParameter<double>("l1UpperThr")),
118  l1LowerThrIgnoreIsolation_(ps.getParameter<double>("l1LowerThrIgnoreIsolation")),
119  regionEtaMargin_(ps.getParameter<double>("regionEtaMargin")),
120  regionPhiMargin_(ps.getParameter<double>("regionPhiMargin")),
121  hitLabels(ps.getParameter<std::vector<edm::InputTag>>("ecalhitLabels")),
122  productLabels(ps.getParameter<std::vector<std::string>>("productLabels")),
125  if (useUncalib_) {
126  for (unsigned int i = 0; i < hitLabels.size(); i++) {
127  uncalibHitTokens.push_back(consumes<EcalUncalibratedRecHitCollection>(hitLabels[i]));
128  produces<EcalUncalibratedRecHitCollection>(productLabels[i]);
129  }
130  } else {
131  for (unsigned int i = 0; i < hitLabels.size(); i++) {
132  hitTokens.push_back(consumes<EcalRecHitCollection>(hitLabels[i]));
133  produces<EcalRecHitCollection>(productLabels[i]);
134  }
135  }
136 }
const std::vector< edm::InputTag > hitLabels
const std::vector< std::string > productLabels
const edm::EDGetTokenT< T1Collection > l1TokenIsolated_
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
const edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > l1CaloGeometryToken_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::EDGetTokenT< T1Collection > l1TokenNonIsolated_
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens
template<typename T1 >
HLTRechitInRegionsProducer< T1 >::~HLTRechitInRegionsProducer ( )
override

Definition at line 139 of file HLTRechitInRegionsProducer.cc.

139 {}

Member Function Documentation

template<typename T1 >
void HLTRechitInRegionsProducer< T1 >::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 142 of file HLTRechitInRegionsProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), defaultModuleLabel(), submitPVResolutionJobs::desc, and HLT_FULL_cff::InputTag.

142  {
144  std::vector<std::string> productTags;
145  productTags.push_back("EcalRegionalRecHitsEB");
146  productTags.push_back("EcalRegionalRecHitsEE");
147  desc.add<std::vector<std::string>>("productLabels", productTags);
148  std::vector<edm::InputTag> inputTags;
149  inputTags.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
150  inputTags.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
151  inputTags.push_back(edm::InputTag("hltESRegionalEgammaRecHit:EcalRecHitsES"));
152  desc.add<std::vector<edm::InputTag>>("ecalhitLabels", inputTags);
153  desc.add<edm::InputTag>("l1TagIsolated", edm::InputTag("l1extraParticles", "Isolated"));
154  desc.add<edm::InputTag>("l1TagNonIsolated", edm::InputTag("l1extraParticles", "NonIsolated"));
155  desc.add<bool>("useUncalib", true);
156  desc.add<bool>("doIsolated", true);
157  desc.add<double>("l1LowerThr", 5.0);
158  desc.add<double>("l1UpperThr", 999.);
159  desc.add<double>("l1LowerThrIgnoreIsolation", 0.0);
160  desc.add<double>("regionEtaMargin", 0.14);
161  desc.add<double>("regionPhiMargin", 0.4);
163 }
std::string defaultModuleLabel()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
template<typename T1 >
void HLTRechitInRegionsProducer< T1 >::getEtaPhiRegions ( std::vector< RectangularEtaPhiRegion > *  theRegions,
T1Collection  theCandidateCollection,
const L1CaloGeometry l1CaloGeom,
bool  isolatedCase 
)
private

Definition at line 315 of file HLTRechitInRegionsProducer.cc.

318  {
319  for (unsigned int candItr = 0; candItr < theCandidateCollection.size(); candItr++) {
320  T1 emItr = theCandidateCollection.at(candItr);
321  if ((emItr.et() > l1LowerThr_) and (emItr.et() < l1UpperThr_)) {
322  double etaLow = emItr.eta() - regionEtaMargin_;
323  double etaHigh = emItr.eta() + regionEtaMargin_;
324  double phiLow = emItr.phi() - regionPhiMargin_;
325  double phiHigh = emItr.phi() + regionPhiMargin_;
326 
327  theRegions->push_back(RectangularEtaPhiRegion(etaLow, etaHigh, phiLow, phiHigh));
328  }
329  }
330 }
template<>
void HLTRechitInRegionsProducer< l1extra::L1EmParticle >::getEtaPhiRegions ( std::vector< RectangularEtaPhiRegion > *  theRegions,
T1Collection  theCandidateCollection,
const L1CaloGeometry l1CaloGeom,
bool  isolatedCase 
)
private

Definition at line 280 of file HLTRechitInRegionsProducer.cc.

References L1CaloGeometry::emJetPhiBinHighEdge(), L1CaloGeometry::emJetPhiBinLowEdge(), reco::LeafCandidate::et(), L1CaloGeometry::etaBinHighEdge(), L1CaloGeometry::etaBinLowEdge(), L1GctEmCand::etaIndex(), l1extra::L1EmParticle::gctEmCand(), and L1GctEmCand::phiIndex().

284  {
285  for (unsigned int candItr = 0; candItr < theCandidateCollection.size(); candItr++) {
286  l1extra::L1EmParticle emItr = theCandidateCollection.at(candItr);
287 
288  if (!isolatedCase) {
289  if (doIsolated_ and (emItr.et() < l1LowerThrIgnoreIsolation_))
290  continue;
291  }
292 
293  if ((emItr.et() > l1LowerThr_) and (emItr.et() < l1UpperThr_)) {
294  // Access the GCT hardware object corresponding to the L1Extra EM object.
295  int etaIndex = emItr.gctEmCand()->etaIndex();
296  int phiIndex = emItr.gctEmCand()->phiIndex();
297 
298  // Use the L1CaloGeometry to find the eta, phi bin boundaries.
299  double etaLow = l1CaloGeom.etaBinLowEdge(etaIndex);
300  double etaHigh = l1CaloGeom.etaBinHighEdge(etaIndex);
301  double phiLow = l1CaloGeom.emJetPhiBinLowEdge(phiIndex);
302  double phiHigh = l1CaloGeom.emJetPhiBinHighEdge(phiIndex);
303 
304  etaLow -= regionEtaMargin_;
305  etaHigh += regionEtaMargin_;
306  phiLow -= regionPhiMargin_;
307  phiHigh += regionPhiMargin_;
308 
309  theRegions->push_back(RectangularEtaPhiRegion(etaLow, etaHigh, phiLow, phiHigh));
310  }
311  }
312 }
unsigned etaIndex() const override
get eta index -6 to -0, +0 to +6 (bit 3 is sign, 1 for -ve Z, 0 for +ve Z)
Definition: L1GctEmCand.h:62
double etaBinHighEdge(unsigned int etaIndex, bool central=true) const
double etaBinLowEdge(unsigned int etaIndex, bool central=true) const
const L1GctEmCand * gctEmCand() const
Definition: L1EmParticle.h:50
double et() const final
transverse energy
double emJetPhiBinLowEdge(unsigned int phiIndex) const
unsigned phiIndex() const override
get phi index (0-17)
Definition: L1GctEmCand.h:68
double emJetPhiBinHighEdge(unsigned int phiIndex) const
template<typename T1 >
void HLTRechitInRegionsProducer< T1 >::produce ( edm::Event evt,
const edm::EventSetup eventSetup 
)
override

Definition at line 166 of file HLTRechitInRegionsProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, edm::SortedCollection< T, SORT >::empty(), edm::SortedCollection< T, SORT >::end(), relativeConstraints::geometry, edm::Event::get(), edm::Event::getByToken(), edm::EventSetup::getData(), CaloSubdetectorGeometry::getGeometry(), mps_fire::i, sistrip::SpyUtilities::isValid(), eostools::move(), or, edm::Handle< T >::product(), HLT_FULL_cff::productLabels, edm::Event::put(), HLT_FULL_cff::recHits, and HLT_FULL_cff::region.

166  {
167  // get the collection geometry:
168  auto const& geometry = eventSetup.getData(caloGeometryToken_);
169  const CaloSubdetectorGeometry* geometry_p;
170  std::unique_ptr<const CaloSubdetectorTopology> topology;
171 
172  //Get the L1 EM Particle Collection
173  edm::Handle<T1Collection> emIsolColl;
174  if (doIsolated_) {
175  evt.getByToken(l1TokenIsolated_, emIsolColl);
176  }
177 
178  // Get the CaloGeometry
179  auto const& l1CaloGeom = eventSetup.getData(l1CaloGeometryToken_);
180 
181  std::vector<RectangularEtaPhiRegion> regions;
182  if (doIsolated_)
183  getEtaPhiRegions(&regions, *emIsolColl, l1CaloGeom, true);
184 
186  getEtaPhiRegions(&regions, evt.get(l1TokenNonIsolated_), l1CaloGeom, false);
187 
188  if (useUncalib_) {
190  for (unsigned int i = 0; i < hitLabels.size(); i++) {
191  auto uhits = std::make_unique<EcalUncalibratedRecHitCollection>();
192 
193  evt.getByToken(uncalibHitTokens[i], urhcH[i]);
194  if (!(urhcH[i].isValid())) {
195  edm::LogError("ProductNotFound") << "could not get a handle on the EcalRecHitCollection! ("
196  << hitLabels[i].encode() << ")" << std::endl;
197  return;
198  }
199  const EcalUncalibratedRecHitCollection* uncalibRecHits = urhcH[i].product();
200 
201  if (!uncalibRecHits->empty()) {
202  if ((*uncalibRecHits)[0].id().subdetId() == EcalBarrel) {
203  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
204  topology = std::make_unique<EcalBarrelTopology>(geometry);
205  } else if ((*uncalibRecHits)[0].id().subdetId() == EcalEndcap) {
206  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
207  topology = std::make_unique<EcalEndcapTopology>(geometry);
208  } else if ((*uncalibRecHits)[0].id().subdetId() == EcalPreshower) {
209  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
210  topology = std::make_unique<EcalPreshowerTopology>();
211  } else
212  throw(std::runtime_error("\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
213 
214  if (!regions.empty()) {
216 
217  for (it = uncalibRecHits->begin(); it != uncalibRecHits->end(); it++) {
218  auto this_cell = geometry_p->getGeometry(it->id());
219 
220  std::vector<RectangularEtaPhiRegion>::const_iterator region;
221  for (region = regions.begin(); region != regions.end(); region++) {
222  if (region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
223  uhits->push_back(*it);
224  break;
225  }
226  }
227  }
228  }
229  }
230  evt.put(std::move(uhits), productLabels[i]);
231  }
232 
233  } else {
235  for (unsigned int i = 0; i < hitLabels.size(); i++) {
236  auto hits = std::make_unique<EcalRecHitCollection>();
237 
238  evt.getByToken(hitTokens[i], rhcH[i]);
239  if (!(rhcH[i].isValid())) {
240  edm::LogError("ProductNotFound") << "could not get a handle on the EcalRecHitCollection! ("
241  << hitLabels[i].encode() << ")" << std::endl;
242  return;
243  }
244  const EcalRecHitCollection* recHits = rhcH[i].product();
245 
246  if (!recHits->empty()) {
247  if ((*recHits)[0].id().subdetId() == EcalBarrel) {
248  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
249  topology = std::make_unique<EcalBarrelTopology>(geometry);
250  } else if ((*recHits)[0].id().subdetId() == EcalEndcap) {
251  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
252  topology = std::make_unique<EcalEndcapTopology>(geometry);
253  } else if ((*recHits)[0].id().subdetId() == EcalPreshower) {
254  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
255  topology = std::make_unique<EcalPreshowerTopology>();
256  } else
257  throw(std::runtime_error("\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
258 
259  if (!regions.empty()) {
261  for (it = recHits->begin(); it != recHits->end(); it++) {
262  auto this_cell = geometry_p->getGeometry(it->id());
263 
264  std::vector<RectangularEtaPhiRegion>::const_iterator region;
265  for (region = regions.begin(); region != regions.end(); region++) {
266  if (region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
267  hits->push_back(*it);
268  break;
269  }
270  }
271  }
272  }
273  }
274  evt.put(std::move(hits), productLabels[i]);
275  }
276  }
277 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const bool isValid(const Frame &aFrame, const FrameQuality &aQuality, const uint16_t aExpectedPos)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e< void, edm::EventIDconst &, edm::Timestampconst & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const std::vector< edm::InputTag > hitLabels
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
const std::vector< std::string > productLabels
std::vector< T >::const_iterator const_iterator
const edm::EDGetTokenT< T1Collection > l1TokenIsolated_
Log< level::Error, false > LogError
bool getData(T &iHolder) const
Definition: EventSetup.h:128
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
def move
Definition: eostools.py:511
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
const_iterator end() const
T const * product() const
Definition: Handle.h:70
virtual std::shared_ptr< const CaloCellGeometry > getGeometry(const DetId &id) const
Get the cell geometry of a given detector id. Should return false if not found.
const edm::ESGetToken< L1CaloGeometry, L1CaloGeometryRecord > l1CaloGeometryToken_
void getEtaPhiRegions(std::vector< RectangularEtaPhiRegion > *, T1Collection, const L1CaloGeometry &, bool)
const edm::EDGetTokenT< T1Collection > l1TokenNonIsolated_
const_iterator begin() const
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens

Member Data Documentation

template<typename T1 >
const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> HLTRechitInRegionsProducer< T1 >::caloGeometryToken_
private

Definition at line 105 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const bool HLTRechitInRegionsProducer< T1 >::doIsolated_
private

Definition at line 88 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const std::vector<edm::InputTag> HLTRechitInRegionsProducer< T1 >::hitLabels
private

Definition at line 99 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
std::vector<edm::EDGetTokenT<EcalRecHitCollection> > HLTRechitInRegionsProducer< T1 >::hitTokens
private

Definition at line 102 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const edm::ESGetToken<L1CaloGeometry, L1CaloGeometryRecord> HLTRechitInRegionsProducer< T1 >::l1CaloGeometryToken_
private

Definition at line 106 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::l1LowerThr_
private

Definition at line 92 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::l1LowerThrIgnoreIsolation_
private

Definition at line 94 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const edm::EDGetTokenT<T1Collection> HLTRechitInRegionsProducer< T1 >::l1TokenIsolated_
private

Definition at line 90 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const edm::EDGetTokenT<T1Collection> HLTRechitInRegionsProducer< T1 >::l1TokenNonIsolated_
private

Definition at line 91 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::l1UpperThr_
private

Definition at line 93 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const std::vector<std::string> HLTRechitInRegionsProducer< T1 >::productLabels
private

Definition at line 100 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::regionEtaMargin_
private

Definition at line 96 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::regionPhiMargin_
private

Definition at line 97 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
std::vector<edm::EDGetTokenT<EcalUncalibratedRecHitCollection> > HLTRechitInRegionsProducer< T1 >::uncalibHitTokens
private

Definition at line 103 of file HLTRechitInRegionsProducer.cc.

template<typename T1 >
const bool HLTRechitInRegionsProducer< T1 >::useUncalib_
private

Definition at line 86 of file HLTRechitInRegionsProducer.cc.