CMS 3D CMS Logo

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

#include <FFTJetInterface.h>

Inheritance diagram for fftjetcms::FFTJetInterface:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper FFTJetEFlowSmoother FFTJetPatRecoProducer FFTJetPileupProcessor FFTJetProducer

Public Member Functions

 ~FFTJetInterface () override
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDProducer () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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 Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

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 Member Functions

 FFTJetInterface ()=delete
 
 FFTJetInterface (const FFTJetInterface &)=delete
 
FFTJetInterfaceoperator= (const FFTJetInterface &)=delete
 

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::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Detailed Description

Definition at line 52 of file FFTJetInterface.h.

Constructor & Destructor Documentation

◆ ~FFTJetInterface()

fftjetcms::FFTJetInterface::~FFTJetInterface ( )
inlineoverride

Definition at line 54 of file FFTJetInterface.h.

54 {}

◆ FFTJetInterface() [1/3]

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

Definition at line 17 of file FFTJetInterface.cc.

18  : edm::EDProducer(),
24  etaDependentMagnutideFactors(ps.getParameter<std::vector<double> >("etaDependentMagnutideFactors")),
28  vertex_(0.0, 0.0, 0.0) {
30  throw cms::Exception("FFTJetBadConfig") << "Bad scale for the complete event : must be positive" << std::endl;
31 
32  inputToken = consumes<reco::CandidateView>(inputLabel);
33 
34  if (doPVCorrection && jetType == CALOJET)
35  srcPVsToken = consumes<reco::VertexCollection>(srcPVs);
36  }

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

◆ FFTJetInterface() [2/3]

fftjetcms::FFTJetInterface::FFTJetInterface ( )
privatedelete

◆ FFTJetInterface() [3/3]

fftjetcms::FFTJetInterface::FFTJetInterface ( const FFTJetInterface )
privatedelete

Member Function Documentation

◆ checkConfig()

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

Definition at line 60 of file FFTJetInterface.h.

60  {
61  if (ptr.get() == nullptr)
62  throw cms::Exception("FFTJetBadConfig") << message << std::endl;
63  }

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

◆ discretizeEnergyFlow()

void FFTJetInterface::discretizeEnergyFlow ( )
protected

Definition at line 79 of file FFTJetInterface.cc.

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

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().

◆ getEventScale()

double FFTJetInterface::getEventScale ( ) const
protected

◆ loadInputCollection()

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

Definition at line 40 of file FFTJetInterface.cc.

40  {
41  // Figure out if we are going to perform the vertex adjustment
42  const bool adjustForVertex = doPVCorrection && jetType == CALOJET;
43 
44  // Figure out the vertex
45  if (adjustForVertex) {
47  iEvent.getByToken(srcPVsToken, pvCollection);
48  if (pvCollection->empty())
49  vertex_ = reco::Particle::Point(0.0, 0.0, 0.0);
50  else
51  vertex_ = pvCollection->begin()->position();
52  }
53 
54  // Get the input collection
55  iEvent.getByToken(inputToken, inputCollection);
56 
57  // Create the set of 4-vectors needed by the algorithm
58  eventData.clear();
59  candidateIndex.clear();
60  unsigned index = 0;
62  for (reco::CandidateView::const_iterator it = inputCollection->begin(); it != end; ++it, ++index) {
63  const reco::Candidate& item(*it);
64  if (anomalous(item))
65  continue;
66  if (edm::isNotFinite(item.pt()))
67  continue;
68 
69  if (adjustForVertex) {
70  const CaloTower& tower(dynamic_cast<const CaloTower&>(item));
71  eventData.push_back(VectorLike(tower.p4(vertex_)));
72  } else
73  eventData.push_back(item.p4());
74  candidateIndex.push_back(index);
75  }
76  assert(eventData.size() == candidateIndex.size());
77  }

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

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

◆ operator=()

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

◆ storeInSinglePrecision()

bool FFTJetInterface::storeInSinglePrecision ( ) const
protected

◆ vertexUsed()

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

Definition at line 70 of file FFTJetInterface.h.

70 { return vertex_; }

References vertex_.

Referenced by FFTJetProducer::writeJets().

Member Data Documentation

◆ anomalous

const AnomalousTower fftjetcms::FFTJetInterface::anomalous
protected

Definition at line 91 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 112 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

◆ doPVCorrection

const bool fftjetcms::FFTJetInterface::doPVCorrection
protected

Definition at line 82 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 88 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 73 of file FFTJetInterface.h.

Referenced by FFTJetInterface().

◆ inputToken

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

Definition at line 115 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

◆ insertCompleteEvent

const bool fftjetcms::FFTJetInterface::insertCompleteEvent
private

Definition at line 111 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

◆ jetType

const JetType fftjetcms::FFTJetInterface::jetType
protected

Definition at line 79 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

◆ outputLabel

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

◆ srcPVs

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

Definition at line 85 of file FFTJetInterface.h.

Referenced by FFTJetInterface().

◆ srcPVsToken

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

Definition at line 116 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

◆ vertex_

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

Definition at line 113 of file FFTJetInterface.h.

Referenced by loadInputCollection(), and vertexUsed().

mps_fire.i
i
Definition: mps_fire.py:355
fftjetcms::FFTJetInterface::outputLabel
const std::string outputLabel
Definition: FFTJetInterface.h:76
edm::isNotFinite
constexpr bool isNotFinite(T x)
Definition: isFinite.h:9
fftjetcms::FFTJetInterface::inputCollection
edm::Handle< reco::CandidateView > inputCollection
Definition: FFTJetInterface.h:103
hgcalTowerProducer_cfi.tower
tower
Definition: hgcalTowerProducer_cfi.py:3
cms::cuda::assert
assert(be >=bs)
fftjetcms::VectorLike
math::XYZTLorentzVector VectorLike
Definition: fftjetTypedefs.h:26
fftjetcms::FFTJetInterface::inputLabel
const edm::InputTag inputLabel
Definition: FFTJetInterface.h:73
edm::Handle< reco::VertexCollection >
fftjetcms::FFTJetInterface::completeEventScale
const double completeEventScale
Definition: FFTJetInterface.h:112
end
#define end
Definition: vmac.h:39
fftjetcms::FFTJetInterface::srcPVsToken
edm::EDGetTokenT< reco::VertexCollection > srcPVsToken
Definition: FFTJetInterface.h:116
fftjetcms::FFTJetInterface::jetType
const JetType jetType
Definition: FFTJetInterface.h:79
fftjetcms::FFTJetInterface::candidateIndex
std::vector< unsigned > candidateIndex
Definition: FFTJetInterface.h:97
fftjetcms::FFTJetInterface::srcPVs
const edm::InputTag srcPVs
Definition: FFTJetInterface.h:85
fftjetcms::FFTJetInterface::etaDependentMagnutideFactors
const std::vector< double > etaDependentMagnutideFactors
Definition: FFTJetInterface.h:88
anotherprimaryvertexanalyzer_cfi.pvCollection
pvCollection
Definition: anotherprimaryvertexanalyzer_cfi.py:4
fftjetcms::CALOJET
Definition: JetType.h:7
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSet
Definition: ParameterSet.h:36
fftjetcms::FFTJetInterface::vertex_
reco::Particle::Point vertex_
Definition: FFTJetInterface.h:113
fftjetcms::parseJetType
JetType parseJetType(const std::string &name)
Definition: JetType.cc:5
iEvent
int iEvent
Definition: GenABIO.cc:224
fftjetcms::FFTJetInterface::energyFlow
std::unique_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
Definition: FFTJetInterface.h:100
CaloTower
Definition: CaloTower.h:26
fftjetcms::FFTJetInterface::insertCompleteEvent
const bool insertCompleteEvent
Definition: FFTJetInterface.h:111
B2GTnPMonitor_cfi.item
item
Definition: B2GTnPMonitor_cfi.py:147
reco::Candidate
Definition: Candidate.h:27
fftjetcms::FFTJetInterface::anomalous
const AnomalousTower anomalous
Definition: FFTJetInterface.h:91
edm::ParameterSet::getParameter
T getParameter(std::string const &) const
init_param
#define init_param(type, varname)
Definition: FFTJetInterface.cc:11
fftjetcms::FFTJetInterface::eventData
std::vector< fftjetcms::VectorLike > eventData
Definition: FFTJetInterface.h:94
Exception
Definition: hltDiff.cc:246
edm::EDProducer
Definition: EDProducer.h:36
AlignmentPI::index
index
Definition: AlignmentPayloadInspectorHelper.h:46
edm::View::const_iterator
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
reco::Particle::Point
math::XYZPoint Point
point in the space
Definition: Particle.h:25
fftjetcms::FFTJetInterface::doPVCorrection
const bool doPVCorrection
Definition: FFTJetInterface.h:82
cms::Exception
Definition: Exception.h:70
fftjetcms::FFTJetInterface::inputToken
edm::EDGetTokenT< reco::CandidateView > inputToken
Definition: FFTJetInterface.h:115
edm::InputTag
Definition: InputTag.h:15
g
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