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::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper 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::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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (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::array< std::vector< ModuleDescription const *> *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const *> const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< Bconsumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, 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)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

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::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 wantsInputProcessBlocks ()
 
static bool wantsProcessBlocks ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

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.

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  }
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::beginJob(), 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 79 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().

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  }
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 40 of file FFTJetInterface.cc.

References anomalous, cms::cuda::assert(), fftjetcms::CALOJET, candidateIndex, doPVCorrection, mps_fire::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().

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