CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes
fftjetcms::FFTJetInterface Class Reference

#include <FFTJetInterface.h>

Inheritance diagram for fftjetcms::FFTJetInterface:
edm::stream::EDProducer<> FFTJetEFlowSmoother FFTJetPatRecoProducer FFTJetPileupProcessor FFTJetProducer

Public Member Functions

 FFTJetInterface ()=delete
 
 FFTJetInterface (const FFTJetInterface &)=delete
 
FFTJetInterfaceoperator= (const FFTJetInterface &)=delete
 
 ~FFTJetInterface () 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
 

Protected Member Functions

template<class Ptr >
void checkConfig (const Ptr &ptr, const char *message)
 
void discretizeEnergyFlow ()
 
 FFTJetInterface (const edm::ParameterSet &)
 
double getEventScale () const
 
void loadInputCollection (const edm::Event &)
 
bool storeInSinglePrecision () const
 
const reco::Particle::PointvertexUsed () const
 

Protected Attributes

const AnomalousTower anomalous
 
std::vector< unsigned > candidateIndex
 
const bool doPVCorrection
 
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
 
const std::vector< double > etaDependentMagnutideFactors
 
std::vector< fftjetcms::VectorLikeeventData
 
edm::Handle< reco::CandidateViewinputCollection
 
const edm::InputTag inputLabel
 
const JetType jetType
 
const std::string outputLabel
 
const edm::InputTag srcPVs
 

Private Attributes

const double completeEventScale
 
edm::EDGetTokenT< reco::CandidateViewinputToken
 
const bool insertCompleteEvent
 
edm::EDGetTokenT< reco::VertexCollectionsrcPVsToken
 
reco::Particle::Point vertex_
 

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 52 of file FFTJetInterface.h.

Constructor & Destructor Documentation

◆ FFTJetInterface() [1/3]

fftjetcms::FFTJetInterface::FFTJetInterface ( )
delete

◆ FFTJetInterface() [2/3]

fftjetcms::FFTJetInterface::FFTJetInterface ( const FFTJetInterface )
delete

◆ ~FFTJetInterface()

fftjetcms::FFTJetInterface::~FFTJetInterface ( )
inlineoverride

Definition at line 58 of file FFTJetInterface.h.

58 {}

◆ FFTJetInterface() [3/3]

FFTJetInterface::FFTJetInterface ( const edm::ParameterSet ps)
explicitprotected

Definition at line 17 of file FFTJetInterface.cc.

References fftjetcms::CALOJET, completeEventScale, doPVCorrection, Exception, inputLabel, inputToken, insertCompleteEvent, jetType, srcPVs, and srcPVsToken.

23  etaDependentMagnutideFactors(ps.getParameter<std::vector<double> >("etaDependentMagnutideFactors")),
27  vertex_(0.0, 0.0, 0.0) {
29  throw cms::Exception("FFTJetBadConfig") << "Bad scale for the complete event : must be positive" << std::endl;
30 
31  inputToken = consumes<reco::CandidateView>(inputLabel);
32 
33  if (doPVCorrection && jetType == CALOJET)
34  srcPVsToken = consumes<reco::VertexCollection>(srcPVs);
35  }
edm::EDGetTokenT< reco::CandidateView > inputToken
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const edm::InputTag inputLabel
const edm::InputTag srcPVs
reco::Particle::Point vertex_
const std::vector< double > etaDependentMagnutideFactors
edm::EDGetTokenT< reco::VertexCollection > srcPVsToken
const AnomalousTower anomalous
JetType parseJetType(const std::string &name)
Definition: JetType.cc:5
#define init_param(type, varname)
const std::string outputLabel

Member Function Documentation

◆ checkConfig()

template<class Ptr >
void fftjetcms::FFTJetInterface::checkConfig ( const Ptr &  ptr,
const char *  message 
)
inlineprotected

Definition at line 64 of file FFTJetInterface.h.

Referenced by FFTJetProducer::beginStream(), FFTJetEFlowSmoother::FFTJetEFlowSmoother(), FFTJetPatRecoProducer::FFTJetPatRecoProducer(), FFTJetPileupProcessor::FFTJetPileupProcessor(), and FFTJetProducer::FFTJetProducer().

64  {
65  if (ptr.get() == nullptr)
66  throw cms::Exception("FFTJetBadConfig") << message << std::endl;
67  }

◆ discretizeEnergyFlow()

void FFTJetInterface::discretizeEnergyFlow ( )
protected

Definition at line 78 of file FFTJetInterface.cc.

References cms::cuda::assert(), energyFlow, etaDependentMagnutideFactors, eventData, g, mps_fire::i, and B2GTnPMonitor_cfi::item.

Referenced by FFTJetEFlowSmoother::produce(), FFTJetPileupProcessor::produce(), FFTJetPatRecoProducer::produce(), and FFTJetProducer::produce().

78  {
79  // It is a bug to call this function before defining the energy flow grid
80  assert(energyFlow.get());
81 
82  fftjet::Grid2d<Real>& g(*energyFlow);
83  g.reset();
84 
85  const unsigned nInputs = eventData.size();
86  const VectorLike* inp = nInputs ? &eventData[0] : nullptr;
87  for (unsigned i = 0; i < nInputs; ++i) {
88  const VectorLike& item(inp[i]);
89  g.fill(item.Eta(), item.Phi(), item.Et());
90  }
91 
92  if (!etaDependentMagnutideFactors.empty()) {
93  if (etaDependentMagnutideFactors.size() != g.nEta())
94  throw cms::Exception("FFTJetBadConfig") << "ERROR in FFTJetInterface::discretizeEnergyFlow() :"
95  " number of elements in the \"etaDependentMagnutideFactors\""
96  " vector is inconsistent with the grid binning"
97  << std::endl;
99  }
100  }
assert(be >=bs)
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 g
Definition: Activities.doc:4
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
math::XYZTLorentzVector VectorLike
const std::vector< double > etaDependentMagnutideFactors
std::vector< fftjetcms::VectorLike > eventData

◆ getEventScale()

double FFTJetInterface::getEventScale ( ) const
protected

◆ loadInputCollection()

void FFTJetInterface::loadInputCollection ( const edm::Event iEvent)
protected

Definition at line 39 of file FFTJetInterface.cc.

References anomalous, cms::cuda::assert(), fftjetcms::CALOJET, candidateIndex, doPVCorrection, eventData, iEvent, inputCollection, inputToken, edm::isNotFinite(), B2GTnPMonitor_cfi::item, jetType, heavyFlavorDQMFirstStep_cff::pvCollection, srcPVsToken, l1tHGCalTowerProducer_cfi::tower, and vertex_.

Referenced by FFTJetEFlowSmoother::produce(), FFTJetPileupProcessor::produce(), FFTJetPatRecoProducer::produce(), and FFTJetProducer::produce().

39  {
40  // Figure out if we are going to perform the vertex adjustment
41  const bool adjustForVertex = doPVCorrection && jetType == CALOJET;
42 
43  // Figure out the vertex
44  if (adjustForVertex) {
46  iEvent.getByToken(srcPVsToken, pvCollection);
47  if (pvCollection->empty())
48  vertex_ = reco::Particle::Point(0.0, 0.0, 0.0);
49  else
50  vertex_ = pvCollection->begin()->position();
51  }
52 
53  // Get the input collection
54  iEvent.getByToken(inputToken, inputCollection);
55 
56  // Create the set of 4-vectors needed by the algorithm
57  eventData.clear();
58  candidateIndex.clear();
59  unsigned index = 0;
61  for (reco::CandidateView::const_iterator it = inputCollection->begin(); it != end; ++it, ++index) {
62  const reco::Candidate& item(*it);
63  if (anomalous(item))
64  continue;
65  if (edm::isNotFinite(item.pt()))
66  continue;
67 
68  if (adjustForVertex) {
69  const CaloTower& tower(dynamic_cast<const CaloTower&>(item));
70  eventData.push_back(VectorLike(tower.p4(vertex_)));
71  } else
72  eventData.push_back(item.p4());
73  candidateIndex.push_back(index);
74  }
75  assert(eventData.size() == candidateIndex.size());
76  }
edm::EDGetTokenT< reco::CandidateView > inputToken
edm::Handle< reco::CandidateView > inputCollection
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
assert(be >=bs)
int iEvent
Definition: GenABIO.cc:224
std::vector< unsigned > candidateIndex
reco::Particle::Point vertex_
math::XYZTLorentzVector VectorLike
edm::EDGetTokenT< reco::VertexCollection > srcPVsToken
math::XYZPoint Point
point in the space
Definition: Particle.h:25
const AnomalousTower anomalous
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
std::vector< fftjetcms::VectorLike > eventData

◆ operator=()

FFTJetInterface& fftjetcms::FFTJetInterface::operator= ( const FFTJetInterface )
delete

◆ storeInSinglePrecision()

bool FFTJetInterface::storeInSinglePrecision ( ) const
protected

◆ vertexUsed()

const reco::Particle::Point& fftjetcms::FFTJetInterface::vertexUsed ( ) const
inlineprotected

Definition at line 74 of file FFTJetInterface.h.

References vertex_.

Referenced by FFTJetProducer::writeJets().

74 { return vertex_; }
reco::Particle::Point vertex_

Member Data Documentation

◆ anomalous

const AnomalousTower fftjetcms::FFTJetInterface::anomalous
protected

Definition at line 95 of file FFTJetInterface.h.

Referenced by loadInputCollection().

◆ candidateIndex

std::vector<unsigned> fftjetcms::FFTJetInterface::candidateIndex
protected

◆ completeEventScale

const double fftjetcms::FFTJetInterface::completeEventScale
private

Definition at line 111 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

◆ doPVCorrection

const bool fftjetcms::FFTJetInterface::doPVCorrection
protected

Definition at line 86 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

◆ energyFlow

std::unique_ptr<fftjet::Grid2d<fftjetcms::Real> > fftjetcms::FFTJetInterface::energyFlow
protected

◆ etaDependentMagnutideFactors

const std::vector<double> fftjetcms::FFTJetInterface::etaDependentMagnutideFactors
protected

Definition at line 92 of file FFTJetInterface.h.

Referenced by discretizeEnergyFlow().

◆ eventData

std::vector<fftjetcms::VectorLike> fftjetcms::FFTJetInterface::eventData
protected

◆ inputCollection

edm::Handle<reco::CandidateView> fftjetcms::FFTJetInterface::inputCollection
protected

◆ inputLabel

const edm::InputTag fftjetcms::FFTJetInterface::inputLabel
protected

Definition at line 77 of file FFTJetInterface.h.

Referenced by FFTJetInterface().

◆ inputToken

edm::EDGetTokenT<reco::CandidateView> fftjetcms::FFTJetInterface::inputToken
private

Definition at line 114 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

◆ insertCompleteEvent

const bool fftjetcms::FFTJetInterface::insertCompleteEvent
private

Definition at line 110 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

◆ jetType

const JetType fftjetcms::FFTJetInterface::jetType
protected

◆ outputLabel

const std::string fftjetcms::FFTJetInterface::outputLabel
protected

◆ srcPVs

const edm::InputTag fftjetcms::FFTJetInterface::srcPVs
protected

Definition at line 89 of file FFTJetInterface.h.

Referenced by FFTJetInterface().

◆ srcPVsToken

edm::EDGetTokenT<reco::VertexCollection> fftjetcms::FFTJetInterface::srcPVsToken
private

Definition at line 115 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

◆ vertex_

reco::Particle::Point fftjetcms::FFTJetInterface::vertex_
private

Definition at line 112 of file FFTJetInterface.h.

Referenced by loadInputCollection(), and vertexUsed().