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 Member Functions | Private Attributes
FixedGridRhoProducerFastjetFromRecHit Class Reference
Inheritance diagram for FixedGridRhoProducerFastjetFromRecHit:
edm::stream::EDProducer<>

Public Member Functions

 FixedGridRhoProducerFastjetFromRecHit (const edm::ParameterSet &iConfig)
 
 ~FixedGridRhoProducerFastjetFromRecHit () 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 Member Functions

std::array< double, 4 > getHitP4 (const DetId &detId, const double hitE, const CaloGeometry &caloGeometry) const
 
bool passedEcalNoiseCut (const EcalRecHit &hit, const EcalPFRecHitThresholds &thresholds) const
 
bool passedHcalNoiseCut (const HBHERecHit &hit) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

fastjet::GridMedianBackgroundEstimator bge_
 
const edm::ESGetToken
< CaloGeometry,
CaloGeometryRecord
caloGeometryToken_
 
const edm::EDGetTokenT
< EcalRecHitCollection
ebRecHitsTag_
 
const edm::ESGetToken
< EcalPFRecHitThresholds,
EcalPFRecHitThresholdsRcd
ecalPFRecHitThresholdsToken_
 
const edm::EDGetTokenT
< EcalRecHitCollection
eeRecHitsTag_
 
const EgammaHcalIsolation::arrayHB eThresHB_
 
const EgammaHcalIsolation::arrayHE eThresHE_
 
const edm::EDGetTokenT
< HBHERecHitCollection
hbheRecHitsTag_
 
const bool skipECAL_
 
const bool skipHCAL_
 

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

Definition at line 31 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Constructor & Destructor Documentation

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

Definition at line 60 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References DeDxTools::esConsumes().

61  : bge_(iConfig.getParameter<double>("maxRapidity"), iConfig.getParameter<double>("gridSpacing")),
62  hbheRecHitsTag_(consumes(iConfig.getParameter<edm::InputTag>("hbheRecHitsTag"))),
63  ebRecHitsTag_(consumes(iConfig.getParameter<edm::InputTag>("ebRecHitsTag"))),
64  eeRecHitsTag_(consumes(iConfig.getParameter<edm::InputTag>("eeRecHitsTag"))),
67  skipHCAL_(iConfig.getParameter<bool>("skipHCAL")),
68  skipECAL_(iConfig.getParameter<bool>("skipECAL")),
71  if (skipHCAL_ && skipECAL_) {
72  throw cms::Exception("FixedGridRhoProducerFastjetFromRecHit")
73  << "skipHCAL and skipECAL both can't be True. Please make at least one of them False.";
74  }
75  produces<double>();
76 }
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsTag_
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRecHitThresholdsToken_
const edm::EDGetTokenT< HBHERecHitCollection > hbheRecHitsTag_
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHitsTag_
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
std::array< double, 4 > arrayHB
ESGetTokenH3DDVariant esConsumes(std::string const &Reccord, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
std::array< double, 7 > arrayHE
FixedGridRhoProducerFastjetFromRecHit::~FixedGridRhoProducerFastjetFromRecHit ( )
overridedefault

Member Function Documentation

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

Definition at line 78 of file FixedGridRhoProducerFastjetFromRecHit.cc.

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

78  {
80  //We use raw recHits and not the PF recHits, because in Phase1 muon and egamma HLT,
81  //PF recHit collection is regional, while the full raw recHit collection is available.
82  desc.add<edm::InputTag>("hbheRecHitsTag", edm::InputTag("hltHbhereco"));
83  desc.add<edm::InputTag>("ebRecHitsTag", edm::InputTag("hltEcalRecHit", "EcalRecHitsEB"));
84  desc.add<edm::InputTag>("eeRecHitsTag", edm::InputTag("hltEcalRecHit", "EcalRecHitsEE"));
85  desc.add<bool>("skipHCAL", false);
86  desc.add<bool>("skipECAL", false);
87  //eThresHB/HE are from RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py
88  desc.add<std::vector<double> >("eThresHB", {0.1, 0.2, 0.3, 0.3});
89  desc.add<std::vector<double> >("eThresHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2});
90  desc.add<double>("maxRapidity", 2.5);
91  desc.add<double>("gridSpacing", 0.55);
92  descriptions.addWithDefaultLabel(desc);
93 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::array< double, 4 > FixedGridRhoProducerFastjetFromRecHit::getHitP4 ( const DetId detId,
const double  hitE,
const CaloGeometry caloGeometry 
) const
private

Definition at line 137 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References funct::cos(), CaloSubdetectorGeometry::getGeometry(), CaloGeometry::getSubdetectorGeometry(), funct::sin(), and GeomDetEnumerators::subDetGeom.

Referenced by produce().

139  {
140  const CaloSubdetectorGeometry *subDetGeom = caloGeometry.getSubdetectorGeometry(detId);
141  const auto &gpPos = subDetGeom->getGeometry(detId)->repPos();
142  const double thispt = hitE / cosh(gpPos.eta());
143  const double thispx = thispt * cos(gpPos.phi());
144  const double thispy = thispt * sin(gpPos.phi());
145  const double thispz = thispt * sinh(gpPos.eta());
146  return std::array<double, 4>{{thispx, thispy, thispz, hitE}};
147 }
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34
constexpr SubDetector subDetGeom[21]
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
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.
bool FixedGridRhoProducerFastjetFromRecHit::passedEcalNoiseCut ( const EcalRecHit hit,
const EcalPFRecHitThresholds thresholds 
) const
private

Definition at line 158 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References EcalRecHit::detid(), and EcalRecHit::energy().

Referenced by produce().

159  {
160  return (hit.energy() > thresholds[hit.detid()]);
161 }
const DetId & detid() const
Definition: EcalRecHit.h:72
float energy() const
Definition: EcalRecHit.h:68
bool FixedGridRhoProducerFastjetFromRecHit::passedHcalNoiseCut ( const HBHERecHit hit) const
private

Definition at line 150 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References HcalDetId::depth(), CaloRecHit::energy(), eThresHB_, eThresHE_, HcalBarrel, HcalEndcap, and HBHERecHit::id().

Referenced by produce().

150  {
151  const auto thisDetId = hit.id();
152  const auto thisDepth = thisDetId.depth();
153  return (thisDetId.subdet() == HcalBarrel && hit.energy() > eThresHB_[thisDepth - 1]) ||
154  (thisDetId.subdet() == HcalEndcap && hit.energy() > eThresHE_[thisDepth - 1]);
155 }
constexpr float energy() const
Definition: CaloRecHit.h:29
constexpr HcalDetId id() const
get the id
Definition: HBHERecHit.h:41
constexpr int depth() const
get the tower depth
Definition: HcalDetId.h:164
void FixedGridRhoProducerFastjetFromRecHit::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 97 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References bge_, caloGeometryToken_, ebRecHitsTag_, ecalPFRecHitThresholdsToken_, eeRecHitsTag_, edm::Event::get(), edm::EventSetup::getData(), getHitP4(), ootPhotons_cff::hbheRecHits, hbheRecHitsTag_, hit::id, PixelMapPlotter::inputs, passedEcalNoiseCut(), passedHcalNoiseCut(), edm::Event::put(), skipECAL_, skipHCAL_, and lowPtGsfElectronSeeds_cfi::thresholds().

97  {
98  std::vector<fastjet::PseudoJet> inputs;
99  auto const &thresholds = iSetup.getData(ecalPFRecHitThresholdsToken_);
100  auto const &caloGeometry = iSetup.getData(caloGeometryToken_);
101 
102  if (!skipHCAL_) {
103  auto const &hbheRecHits = iEvent.get(hbheRecHitsTag_);
104  inputs.reserve(inputs.size() + hbheRecHits.size());
105  for (const auto &hit : hbheRecHits) {
106  if (passedHcalNoiseCut(hit)) {
107  const auto &hitp4 = getHitP4(hit.id(), hit.energy(), caloGeometry);
108  inputs.emplace_back(fastjet::PseudoJet(hitp4[0], hitp4[1], hitp4[2], hitp4[3]));
109  }
110  }
111  }
112 
113  if (!skipECAL_) {
114  auto const &ebRecHits = iEvent.get(ebRecHitsTag_);
115  inputs.reserve(inputs.size() + ebRecHits.size());
116  for (const auto &hit : ebRecHits) {
118  const auto &hitp4 = getHitP4(hit.id(), hit.energy(), caloGeometry);
119  inputs.emplace_back(fastjet::PseudoJet(hitp4[0], hitp4[1], hitp4[2], hitp4[3]));
120  }
121  }
122 
123  auto const &eeRecHits = iEvent.get(eeRecHitsTag_);
124  inputs.reserve(inputs.size() + eeRecHits.size());
125  for (const auto &hit : eeRecHits) {
127  const auto &hitp4 = getHitP4(hit.id(), hit.energy(), caloGeometry);
128  inputs.emplace_back(fastjet::PseudoJet(hitp4[0], hitp4[1], hitp4[2], hitp4[3]));
129  }
130  }
131  }
132 
133  bge_.set_particles(inputs);
134  iEvent.put(std::make_unique<double>(bge_.rho()));
135 }
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
Definition: Event.h:133
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsTag_
std::array< double, 4 > getHitP4(const DetId &detId, const double hitE, const CaloGeometry &caloGeometry) const
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRecHitThresholdsToken_
bool getData(T &iHolder) const
Definition: EventSetup.h:128
bool get(ProductID const &oid, Handle< PROD > &result) const
Definition: Event.h:346
unsigned int id
const edm::EDGetTokenT< HBHERecHitCollection > hbheRecHitsTag_
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHitsTag_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
bool passedEcalNoiseCut(const EcalRecHit &hit, const EcalPFRecHitThresholds &thresholds) const

Member Data Documentation

fastjet::GridMedianBackgroundEstimator FixedGridRhoProducerFastjetFromRecHit::bge_
private

Definition at line 43 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

const edm::ESGetToken<CaloGeometry, CaloGeometryRecord> FixedGridRhoProducerFastjetFromRecHit::caloGeometryToken_
private

Definition at line 57 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

const edm::EDGetTokenT<EcalRecHitCollection> FixedGridRhoProducerFastjetFromRecHit::ebRecHitsTag_
private

Definition at line 45 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

const edm::ESGetToken<EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd> FixedGridRhoProducerFastjetFromRecHit::ecalPFRecHitThresholdsToken_
private

Definition at line 56 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

const edm::EDGetTokenT<EcalRecHitCollection> FixedGridRhoProducerFastjetFromRecHit::eeRecHitsTag_
private

Definition at line 46 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

const EgammaHcalIsolation::arrayHB FixedGridRhoProducerFastjetFromRecHit::eThresHB_
private

Definition at line 48 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by passedHcalNoiseCut().

const EgammaHcalIsolation::arrayHE FixedGridRhoProducerFastjetFromRecHit::eThresHE_
private

Definition at line 49 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by passedHcalNoiseCut().

const edm::EDGetTokenT<HBHERecHitCollection> FixedGridRhoProducerFastjetFromRecHit::hbheRecHitsTag_
private

Definition at line 44 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

const bool FixedGridRhoProducerFastjetFromRecHit::skipECAL_
private

Definition at line 54 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

const bool FixedGridRhoProducerFastjetFromRecHit::skipHCAL_
private

Definition at line 53 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().