CMS 3D CMS Logo

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
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndRuns () const final
 

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 bool doIsolated_
 
const std::vector< edm::InputTaghitLabels
 
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
 
const double l1LowerThr_
 
const double l1LowerThrIgnoreIsolation_
 
const edm::EDGetTokenT< T1Collectionl1TokenIsolated_
 
const edm::EDGetTokenT< T1Collectionl1TokenNonIsolated_
 
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<>
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

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 107 of file HLTRechitInRegionsProducer.cc.

References HLTRechitInRegionsProducer< T1 >::hitLabels, HLTRechitInRegionsProducer< T1 >::hitTokens, mps_fire::i, HLTRechitInRegionsProducer< T1 >::productLabels, HLTRechitInRegionsProducer< T1 >::uncalibHitTokens, and HLTRechitInRegionsProducer< T1 >::useUncalib_.

108  : useUncalib_(ps.getParameter<bool>("useUncalib")),
109  doIsolated_(ps.getParameter<bool>("doIsolated")),
110  l1TokenIsolated_(doIsolated_ ? consumes<T1Collection>(ps.getParameter<edm::InputTag>("l1TagIsolated"))
112  l1TokenNonIsolated_(consumes<T1Collection>(ps.getParameter<edm::InputTag>("l1TagNonIsolated"))),
113  l1LowerThr_(ps.getParameter<double>("l1LowerThr")),
114  l1UpperThr_(ps.getParameter<double>("l1UpperThr")),
115  l1LowerThrIgnoreIsolation_(ps.getParameter<double>("l1LowerThrIgnoreIsolation")),
116  regionEtaMargin_(ps.getParameter<double>("regionEtaMargin")),
117  regionPhiMargin_(ps.getParameter<double>("regionPhiMargin")),
118  hitLabels(ps.getParameter<std::vector<edm::InputTag>>("ecalhitLabels")),
119  productLabels(ps.getParameter<std::vector<std::string>>("productLabels")) {
120  if (useUncalib_) {
121  for (unsigned int i = 0; i < hitLabels.size(); i++) {
122  uncalibHitTokens.push_back(consumes<EcalUncalibratedRecHitCollection>(hitLabels[i]));
123  produces<EcalUncalibratedRecHitCollection>(productLabels[i]);
124  }
125  } else {
126  for (unsigned int i = 0; i < hitLabels.size(); i++) {
127  hitTokens.push_back(consumes<EcalRecHitCollection>(hitLabels[i]));
128  produces<EcalRecHitCollection>(productLabels[i]);
129  }
130  }
131 }
T getParameter(std::string const &) const
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::EDGetTokenT< T1Collection > l1TokenNonIsolated_
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens
template<typename T1 >
HLTRechitInRegionsProducer< T1 >::~HLTRechitInRegionsProducer ( )
override

Definition at line 134 of file HLTRechitInRegionsProducer.cc.

134 {}

Member Function Documentation

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

Definition at line 137 of file HLTRechitInRegionsProducer.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), defaultModuleLabel(), HLT_2018_cff::InputTag, and HLTMuonOfflineAnalyzer_cfi::inputTags.

137  {
139  std::vector<std::string> productTags;
140  productTags.push_back("EcalRegionalRecHitsEB");
141  productTags.push_back("EcalRegionalRecHitsEE");
142  desc.add<std::vector<std::string>>("productLabels", productTags);
143  std::vector<edm::InputTag> inputTags;
144  inputTags.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEB"));
145  inputTags.push_back(edm::InputTag("hltEcalRegionalEgammaRecHit:EcalRecHitsEE"));
146  inputTags.push_back(edm::InputTag("hltESRegionalEgammaRecHit:EcalRecHitsES"));
147  desc.add<std::vector<edm::InputTag>>("ecalhitLabels", inputTags);
148  desc.add<edm::InputTag>("l1TagIsolated", edm::InputTag("l1extraParticles", "Isolated"));
149  desc.add<edm::InputTag>("l1TagNonIsolated", edm::InputTag("l1extraParticles", "NonIsolated"));
150  desc.add<bool>("useUncalib", true);
151  desc.add<bool>("doIsolated", true);
152  desc.add<double>("l1LowerThr", 5.0);
153  desc.add<double>("l1UpperThr", 999.);
154  desc.add<double>("l1LowerThrIgnoreIsolation", 0.0);
155  desc.add<double>("regionEtaMargin", 0.14);
156  desc.add<double>("regionPhiMargin", 0.4);
158 }
std::string defaultModuleLabel()
ParameterDescriptionBase * add(U const &iLabel, T const &value)
inputTags
All input tags are specified in this pset for convenience.
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 317 of file HLTRechitInRegionsProducer.cc.

References HLTRechitInRegionsProducer< T1 >::l1LowerThr_, HLTRechitInRegionsProducer< T1 >::l1UpperThr_, HLTRechitInRegionsProducer< T1 >::regionEtaMargin_, and HLTRechitInRegionsProducer< T1 >::regionPhiMargin_.

Referenced by HLTRechitInRegionsProducer< T1 >::produce().

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

Definition at line 282 of file HLTRechitInRegionsProducer.cc.

References HLTRechitInRegionsProducer< T1 >::doIsolated_, L1CaloGeometry::emJetPhiBinHighEdge(), L1CaloGeometry::emJetPhiBinLowEdge(), reco::LeafCandidate::et(), L1CaloGeometry::etaBinHighEdge(), L1CaloGeometry::etaBinLowEdge(), L1GctEmCand::etaIndex(), l1extra::L1EmParticle::gctEmCand(), HLTRechitInRegionsProducer< T1 >::l1LowerThr_, HLTRechitInRegionsProducer< T1 >::l1LowerThrIgnoreIsolation_, HLTRechitInRegionsProducer< T1 >::l1UpperThr_, L1GctEmCand::phiIndex(), HLTRechitInRegionsProducer< T1 >::regionEtaMargin_, and HLTRechitInRegionsProducer< T1 >::regionPhiMargin_.

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

Definition at line 161 of file HLTRechitInRegionsProducer.cc.

References edm::SortedCollection< T, SORT >::begin(), HLTRechitInRegionsProducer< T1 >::doIsolated_, DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, edm::SortedCollection< T, SORT >::empty(), edm::SortedCollection< T, SORT >::end(), edm::EventSetup::get(), edm::Event::getByToken(), HLTRechitInRegionsProducer< T1 >::getEtaPhiRegions(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), HLTRechitInRegionsProducer< T1 >::hitLabels, hfClusterShapes_cfi::hits, HLTRechitInRegionsProducer< T1 >::hitTokens, mps_fire::i, HLTRechitInRegionsProducer< T1 >::l1LowerThrIgnoreIsolation_, HLTRechitInRegionsProducer< T1 >::l1TokenIsolated_, HLTRechitInRegionsProducer< T1 >::l1TokenNonIsolated_, eostools::move(), or, edm::Handle< T >::product(), HLTRechitInRegionsProducer< T1 >::productLabels, edm::Event::put(), FastTrackerRecHitMaskProducer_cfi::recHits, HLT_2018_cff::region, ecaldqm::topology(), HLTRechitInRegionsProducer< T1 >::uncalibHitTokens, and HLTRechitInRegionsProducer< T1 >::useUncalib_.

161  {
162  // get the collection geometry:
163  edm::ESHandle<CaloGeometry> geoHandle;
164  es.get<CaloGeometryRecord>().get(geoHandle);
165  const CaloGeometry& geometry = *geoHandle;
166  const CaloSubdetectorGeometry* geometry_p;
167  std::unique_ptr<const CaloSubdetectorTopology> topology;
168 
169  //Get the L1 EM Particle Collection
170  edm::Handle<T1Collection> emIsolColl;
171  if (doIsolated_) {
172  evt.getByToken(l1TokenIsolated_, emIsolColl);
173  }
174 
175  //Get the L1 EM Particle Collection
176  edm::Handle<T1Collection> emNonIsolColl;
177  evt.getByToken(l1TokenNonIsolated_, emNonIsolColl);
178 
179  // Get the CaloGeometry
181  es.get<L1CaloGeometryRecord>().get(l1CaloGeom);
182 
183  std::vector<RectangularEtaPhiRegion> regions;
184  if (doIsolated_)
185  getEtaPhiRegions(&regions, *emIsolColl, *l1CaloGeom, true);
186 
188  getEtaPhiRegions(&regions, *emNonIsolColl, *l1CaloGeom, false);
189 
190  if (useUncalib_) {
192  for (unsigned int i = 0; i < hitLabels.size(); i++) {
193  auto uhits = std::make_unique<EcalUncalibratedRecHitCollection>();
194 
195  evt.getByToken(uncalibHitTokens[i], urhcH[i]);
196  if (!(urhcH[i].isValid())) {
197  edm::LogError("ProductNotFound") << "could not get a handle on the EcalRecHitCollection! ("
198  << hitLabels[i].encode() << ")" << std::endl;
199  return;
200  }
201  const EcalUncalibratedRecHitCollection* uncalibRecHits = urhcH[i].product();
202 
203  if (!uncalibRecHits->empty()) {
204  if ((*uncalibRecHits)[0].id().subdetId() == EcalBarrel) {
205  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
206  topology = std::make_unique<EcalBarrelTopology>(*geoHandle);
207  } else if ((*uncalibRecHits)[0].id().subdetId() == EcalEndcap) {
208  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
209  topology = std::make_unique<EcalEndcapTopology>(*geoHandle);
210  } else if ((*uncalibRecHits)[0].id().subdetId() == EcalPreshower) {
211  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
212  topology = std::make_unique<EcalPreshowerTopology>();
213  } else
214  throw(std::runtime_error("\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
215 
216  if (!regions.empty()) {
218 
219  for (it = uncalibRecHits->begin(); it != uncalibRecHits->end(); it++) {
220  auto this_cell = geometry_p->getGeometry(it->id());
221 
222  std::vector<RectangularEtaPhiRegion>::const_iterator region;
223  for (region = regions.begin(); region != regions.end(); region++) {
224  if (region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
225  uhits->push_back(*it);
226  break;
227  }
228  }
229  }
230  }
231  }
232  evt.put(std::move(uhits), productLabels[i]);
233  }
234 
235  } else {
237  for (unsigned int i = 0; i < hitLabels.size(); i++) {
238  auto hits = std::make_unique<EcalRecHitCollection>();
239 
240  evt.getByToken(hitTokens[i], rhcH[i]);
241  if (!(rhcH[i].isValid())) {
242  edm::LogError("ProductNotFound") << "could not get a handle on the EcalRecHitCollection! ("
243  << hitLabels[i].encode() << ")" << std::endl;
244  return;
245  }
246  const EcalRecHitCollection* recHits = rhcH[i].product();
247 
248  if (!recHits->empty()) {
249  if ((*recHits)[0].id().subdetId() == EcalBarrel) {
250  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalBarrel);
251  topology = std::make_unique<EcalBarrelTopology>(*geoHandle);
252  } else if ((*recHits)[0].id().subdetId() == EcalEndcap) {
253  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalEndcap);
254  topology = std::make_unique<EcalEndcapTopology>(*geoHandle);
255  } else if ((*recHits)[0].id().subdetId() == EcalPreshower) {
256  geometry_p = geometry.getSubdetectorGeometry(DetId::Ecal, EcalPreshower);
257  topology = std::make_unique<EcalPreshowerTopology>();
258  } else
259  throw(std::runtime_error("\n\nProducer encountered invalied ecalhitcollection type.\n\n"));
260 
261  if (!regions.empty()) {
263  for (it = recHits->begin(); it != recHits->end(); it++) {
264  auto this_cell = geometry_p->getGeometry(it->id());
265 
266  std::vector<RectangularEtaPhiRegion>::const_iterator region;
267  for (region = regions.begin(); region != regions.end(); region++) {
268  if (region->inRegion(this_cell->etaPos(), this_cell->phiPos())) {
269  hits->push_back(*it);
270  break;
271  }
272  }
273  }
274  }
275  }
276  evt.put(std::move(hits), productLabels[i]);
277  }
278  }
279 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:131
const std::vector< edm::InputTag > hitLabels
CaloTopology const * topology(0)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:525
const std::vector< std::string > productLabels
std::vector< T >::const_iterator const_iterator
const edm::EDGetTokenT< T1Collection > l1TokenIsolated_
std::vector< edm::EDGetTokenT< EcalRecHitCollection > > hitTokens
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::EventID const &, edm::Timestamp const & > We also list in braces which AR_WATCH_USING_METHOD_ is used for those or
Definition: Activities.doc:12
const_iterator end() const
T const * product() const
Definition: Handle.h:69
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.
void getEtaPhiRegions(std::vector< RectangularEtaPhiRegion > *, T1Collection, const L1CaloGeometry &, bool)
T get() const
Definition: EventSetup.h:73
const edm::EDGetTokenT< T1Collection > l1TokenNonIsolated_
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const
std::vector< edm::EDGetTokenT< EcalUncalibratedRecHitCollection > > uncalibHitTokens

Member Data Documentation

template<typename T1 >
const bool HLTRechitInRegionsProducer< T1 >::doIsolated_
private
template<typename T1 >
const std::vector<edm::InputTag> HLTRechitInRegionsProducer< T1 >::hitLabels
private
template<typename T1 >
std::vector<edm::EDGetTokenT<EcalRecHitCollection> > HLTRechitInRegionsProducer< T1 >::hitTokens
private
template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::l1LowerThr_
private
template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::l1LowerThrIgnoreIsolation_
private
template<typename T1 >
const edm::EDGetTokenT<T1Collection> HLTRechitInRegionsProducer< T1 >::l1TokenIsolated_
private
template<typename T1 >
const edm::EDGetTokenT<T1Collection> HLTRechitInRegionsProducer< T1 >::l1TokenNonIsolated_
private
template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::l1UpperThr_
private
template<typename T1 >
const std::vector<std::string> HLTRechitInRegionsProducer< T1 >::productLabels
private
template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::regionEtaMargin_
private
template<typename T1 >
const double HLTRechitInRegionsProducer< T1 >::regionPhiMargin_
private
template<typename T1 >
std::vector<edm::EDGetTokenT<EcalUncalibratedRecHitCollection> > HLTRechitInRegionsProducer< T1 >::uncalibHitTokens
private
template<typename T1 >
const bool HLTRechitInRegionsProducer< T1 >::useUncalib_
private