CMS 3D CMS Logo

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

void beginRun (edm::Run const &, edm::EventSetup const &) override
 
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 HcalPFCuts *) const
 
void produce (edm::Event &, const edm::EventSetup &) override
 

Private Attributes

fastjet::GridMedianBackgroundEstimator bge_
 
const edm::ESGetToken< CaloGeometry, CaloGeometryRecordcaloGeometryToken_
 
const bool cutsFromDB_
 
const edm::EDGetTokenT< EcalRecHitCollectionebRecHitsTag_
 
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcdecalPFRecHitThresholdsToken_
 
const edm::EDGetTokenT< EcalRecHitCollectioneeRecHitsTag_
 
const EgammaHcalIsolation::arrayHB eThresHB_
 
const EgammaHcalIsolation::arrayHE eThresHE_
 
const edm::EDGetTokenT< HBHERecHitCollectionhbheRecHitsTag_
 
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcdhcalCutsToken_
 
HcalPFCuts const * paramPF_ = nullptr
 
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 33 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Constructor & Destructor Documentation

◆ FixedGridRhoProducerFastjetFromRecHit()

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

Definition at line 68 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References deDxTools::esConsumes().

69  : bge_(iConfig.getParameter<double>("maxRapidity"), iConfig.getParameter<double>("gridSpacing")),
70  hbheRecHitsTag_(consumes(iConfig.getParameter<edm::InputTag>("hbheRecHitsTag"))),
71  ebRecHitsTag_(consumes(iConfig.getParameter<edm::InputTag>("ebRecHitsTag"))),
72  eeRecHitsTag_(consumes(iConfig.getParameter<edm::InputTag>("eeRecHitsTag"))),
75  skipHCAL_(iConfig.getParameter<bool>("skipHCAL")),
76  skipECAL_(iConfig.getParameter<bool>("skipECAL")),
79  cutsFromDB_(iConfig.getParameter<bool>("usePFThresholdsFromDB")) {
80  if (skipHCAL_ && skipECAL_) {
81  throw cms::Exception("FixedGridRhoProducerFastjetFromRecHit")
82  << "skipHCAL and skipECAL both can't be True. Please make at least one of them False.";
83  }
84  if (cutsFromDB_) {
85  hcalCutsToken_ = esConsumes<HcalPFCuts, HcalPFCutsRcd, edm::Transition::BeginRun>(edm::ESInputTag("", "withTopo"));
86  }
87  produces<double>();
88 }
ESGetTokenH3DDVariant esConsumes(std::string const &Record, edm::ConsumesCollector &)
Definition: DeDxTools.cc:283
T getParameter(std::string const &) const
Definition: ParameterSet.h:307
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsTag_
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRecHitThresholdsToken_
const edm::EDGetTokenT< HBHERecHitCollection > hbheRecHitsTag_
edm::ESGetToken< HcalPFCuts, HcalPFCutsRcd > hcalCutsToken_
const edm::EDGetTokenT< EcalRecHitCollection > eeRecHitsTag_
const edm::ESGetToken< CaloGeometry, CaloGeometryRecord > caloGeometryToken_
std::array< double, 4 > arrayHB
std::array< double, 7 > arrayHE

◆ ~FixedGridRhoProducerFastjetFromRecHit()

FixedGridRhoProducerFastjetFromRecHit::~FixedGridRhoProducerFastjetFromRecHit ( )
overridedefault

Member Function Documentation

◆ beginRun()

void FixedGridRhoProducerFastjetFromRecHit::beginRun ( edm::Run const &  r,
edm::EventSetup const &  es 
)
overrideprivate

◆ fillDescriptions()

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

Definition at line 90 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References edm::ConfigurationDescriptions::addWithDefaultLabel(), submitPVResolutionJobs::desc, and ProducerED_cfi::InputTag.

90  {
92  //We use raw recHits and not the PF recHits, because in Phase1 muon and egamma HLT,
93  //PF recHit collection is regional, while the full raw recHit collection is available.
94  desc.add<edm::InputTag>("hbheRecHitsTag", edm::InputTag("hltHbhereco"));
95  desc.add<edm::InputTag>("ebRecHitsTag", edm::InputTag("hltEcalRecHit", "EcalRecHitsEB"));
96  desc.add<edm::InputTag>("eeRecHitsTag", edm::InputTag("hltEcalRecHit", "EcalRecHitsEE"));
97  desc.add<bool>("skipHCAL", false);
98  desc.add<bool>("skipECAL", false);
99  //eThresHB/HE are from RecoParticleFlow/PFClusterProducer/python/particleFlowRecHitHBHE_cfi.py
100  desc.add<std::vector<double> >("eThresHB", {0.1, 0.2, 0.3, 0.3});
101  desc.add<std::vector<double> >("eThresHE", {0.1, 0.2, 0.2, 0.2, 0.2, 0.2, 0.2});
102  desc.add<double>("maxRapidity", 2.5);
103  desc.add<double>("gridSpacing", 0.55);
104  desc.add<bool>("usePFThresholdsFromDB", true);
105  descriptions.addWithDefaultLabel(desc);
106 }
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)

◆ getHitP4()

std::array< double, 4 > FixedGridRhoProducerFastjetFromRecHit::getHitP4 ( const DetId detId,
const double  hitE,
const CaloGeometry caloGeometry 
) const
private

Definition at line 156 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References funct::cos(), hcalRecHitTable_cff::detId, CaloGeometry::getSubdetectorGeometry(), funct::sin(), and GeomDetEnumerators::subDetGeom.

Referenced by produce().

158  {
160  const auto &gpPos = subDetGeom->getGeometry(detId)->repPos();
161  const double thispt = hitE / cosh(gpPos.eta());
162  const double thispx = thispt * cos(gpPos.phi());
163  const double thispy = thispt * sin(gpPos.phi());
164  const double thispz = thispt * sinh(gpPos.eta());
165  return std::array<double, 4>{{thispx, thispy, thispz, hitE}};
166 }
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
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:34

◆ passedEcalNoiseCut()

bool FixedGridRhoProducerFastjetFromRecHit::passedEcalNoiseCut ( const EcalRecHit hit,
const EcalPFRecHitThresholds thresholds 
) const
private

◆ passedHcalNoiseCut()

bool FixedGridRhoProducerFastjetFromRecHit::passedHcalNoiseCut ( const HBHERecHit hit,
const HcalPFCuts hcalcuts 
) const
private

Definition at line 169 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References eThresHB_, eThresHE_, HcalCondObjectContainer< Item >::getValues(), HcalBarrel, HcalEndcap, hit::id, and B2GTnPMonitor_cfi::item.

Referenced by produce().

170  {
171  if (hcalcuts != nullptr) { // using hcal cuts from DB
172  const HcalPFCut *item = hcalcuts->getValues(hit.id().rawId());
173  return (hit.energy() > item->noiseThreshold());
174  } else { // using hcal cuts from config file
175  const auto thisDetId = hit.id();
176  const auto thisDepth = thisDetId.depth();
177  return (thisDetId.subdet() == HcalBarrel && hit.energy() > eThresHB_[thisDepth - 1]) ||
178  (thisDetId.subdet() == HcalEndcap && hit.energy() > eThresHE_[thisDepth - 1]);
179  }
180 }
const Item * getValues(DetId fId, bool throwOnFail=true) const
unsigned int id

◆ produce()

void FixedGridRhoProducerFastjetFromRecHit::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivate

Definition at line 116 of file FixedGridRhoProducerFastjetFromRecHit.cc.

References bge_, caloGeometryToken_, ebRecHitsTag_, ecalPFRecHitThresholdsToken_, eeRecHitsTag_, edm::EventSetup::getData(), getHitP4(), ecalDrivenElectronSeeds_cfi::hbheRecHits, hbheRecHitsTag_, hit::id, iEvent, PixelMapPlotter::inputs, paramPF_, passedEcalNoiseCut(), passedHcalNoiseCut(), skipECAL_, skipHCAL_, and particleFlowZeroSuppressionECAL_cff::thresholds.

116  {
117  std::vector<fastjet::PseudoJet> inputs;
118  auto const &thresholds = iSetup.getData(ecalPFRecHitThresholdsToken_);
119  auto const &caloGeometry = iSetup.getData(caloGeometryToken_);
120 
121  if (!skipHCAL_) {
122  auto const &hbheRecHits = iEvent.get(hbheRecHitsTag_);
123  inputs.reserve(inputs.size() + hbheRecHits.size());
124  for (const auto &hit : hbheRecHits) {
126  const auto &hitp4 = getHitP4(hit.id(), hit.energy(), caloGeometry);
127  inputs.emplace_back(fastjet::PseudoJet(hitp4[0], hitp4[1], hitp4[2], hitp4[3]));
128  }
129  }
130  }
131 
132  if (!skipECAL_) {
133  auto const &ebRecHits = iEvent.get(ebRecHitsTag_);
134  inputs.reserve(inputs.size() + ebRecHits.size());
135  for (const auto &hit : ebRecHits) {
137  const auto &hitp4 = getHitP4(hit.id(), hit.energy(), caloGeometry);
138  inputs.emplace_back(fastjet::PseudoJet(hitp4[0], hitp4[1], hitp4[2], hitp4[3]));
139  }
140  }
141 
142  auto const &eeRecHits = iEvent.get(eeRecHitsTag_);
143  inputs.reserve(inputs.size() + eeRecHits.size());
144  for (const auto &hit : eeRecHits) {
146  const auto &hitp4 = getHitP4(hit.id(), hit.energy(), caloGeometry);
147  inputs.emplace_back(fastjet::PseudoJet(hitp4[0], hitp4[1], hitp4[2], hitp4[3]));
148  }
149  }
150  }
151 
152  bge_.set_particles(inputs);
153  iEvent.put(std::make_unique<double>(bge_.rho()));
154 }
const edm::EDGetTokenT< EcalRecHitCollection > ebRecHitsTag_
T const & getData(const ESGetToken< T, R > &iToken) const noexcept(false)
Definition: EventSetup.h:119
bool passedHcalNoiseCut(const HBHERecHit &hit, const HcalPFCuts *) const
const edm::ESGetToken< EcalPFRecHitThresholds, EcalPFRecHitThresholdsRcd > ecalPFRecHitThresholdsToken_
int iEvent
Definition: GenABIO.cc:224
std::array< double, 4 > getHitP4(const DetId &detId, const double hitE, const CaloGeometry &caloGeometry) const
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

◆ bge_

fastjet::GridMedianBackgroundEstimator FixedGridRhoProducerFastjetFromRecHit::bge_
private

Definition at line 46 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

◆ caloGeometryToken_

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

Definition at line 60 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

◆ cutsFromDB_

const bool FixedGridRhoProducerFastjetFromRecHit::cutsFromDB_
private

Definition at line 64 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by beginRun().

◆ ebRecHitsTag_

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

Definition at line 48 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

◆ ecalPFRecHitThresholdsToken_

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

Definition at line 59 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

◆ eeRecHitsTag_

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

Definition at line 49 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

◆ eThresHB_

const EgammaHcalIsolation::arrayHB FixedGridRhoProducerFastjetFromRecHit::eThresHB_
private

Definition at line 51 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by passedHcalNoiseCut().

◆ eThresHE_

const EgammaHcalIsolation::arrayHE FixedGridRhoProducerFastjetFromRecHit::eThresHE_
private

Definition at line 52 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by passedHcalNoiseCut().

◆ hbheRecHitsTag_

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

Definition at line 47 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

◆ hcalCutsToken_

edm::ESGetToken<HcalPFCuts, HcalPFCutsRcd> FixedGridRhoProducerFastjetFromRecHit::hcalCutsToken_
private

Definition at line 63 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by beginRun().

◆ paramPF_

HcalPFCuts const* FixedGridRhoProducerFastjetFromRecHit::paramPF_ = nullptr
private

Definition at line 65 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by beginRun(), and produce().

◆ skipECAL_

const bool FixedGridRhoProducerFastjetFromRecHit::skipECAL_
private

Definition at line 57 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().

◆ skipHCAL_

const bool FixedGridRhoProducerFastjetFromRecHit::skipHCAL_
private

Definition at line 56 of file FixedGridRhoProducerFastjetFromRecHit.cc.

Referenced by produce().