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
 
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)
 
 ~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
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
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::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Protected Attributes

const AnomalousTower anomalous
 
std::vector< unsigned > candidateIndex
 
const bool doPVCorrection
 
std::auto_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

fftjetcms::FFTJetInterface::~FFTJetInterface ( )
inlineoverride

Definition at line 55 of file FFTJetInterface.h.

References FFTJetInterface().

55 {}
FFTJetInterface::FFTJetInterface ( const edm::ParameterSet ps)
explicitprotected

Definition at line 21 of file FFTJetInterface.cc.

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

22  : edm::EDProducer(),
29  ps.getParameter<std::vector<double> >(
30  "etaDependentMagnutideFactors")),
34  vertex_(0.0, 0.0, 0.0)
35 {
37  throw cms::Exception("FFTJetBadConfig")
38  << "Bad scale for the complete event : must be positive"
39  << std::endl;
40 
41  inputToken = consumes<reco::CandidateView>(inputLabel);
42 
43  if (doPVCorrection && jetType == CALOJET)
44  srcPVsToken = consumes<reco::VertexCollection>(srcPVs);
45 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::CandidateView > inputToken
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
fftjetcms::FFTJetInterface::FFTJetInterface ( )
privatedelete

Referenced by ~FFTJetInterface().

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

Member Function Documentation

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

Definition at line 100 of file FFTJetInterface.cc.

References energyFlow, etaDependentMagnutideFactors, eventData, g, and mps_fire::i.

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

101 {
102  // It is a bug to call this function before defining the energy flow grid
103  assert(energyFlow.get());
104 
105  fftjet::Grid2d<Real>& g(*energyFlow);
106  g.reset();
107 
108  const unsigned nInputs = eventData.size();
109  const VectorLike* inp = nInputs ? &eventData[0] : nullptr;
110  for (unsigned i=0; i<nInputs; ++i)
111  {
112  const VectorLike& item(inp[i]);
113  g.fill(item.Eta(), item.Phi(), item.Et());
114  }
115 
116  if (!etaDependentMagnutideFactors.empty())
117  {
118  if (etaDependentMagnutideFactors.size() != g.nEta())
119  throw cms::Exception("FFTJetBadConfig")
120  << "ERROR in FFTJetInterface::discretizeEnergyFlow() :"
121  " number of elements in the \"etaDependentMagnutideFactors\""
122  " vector is inconsistent with the grid binning"
123  << std::endl;
124  g.scaleData(&etaDependentMagnutideFactors[0],
126  }
127 }
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
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
math::XYZTLorentzVector VectorLike
const std::vector< double > etaDependentMagnutideFactors
std::vector< fftjetcms::VectorLike > eventData
double FFTJetInterface::getEventScale ( ) const
protected
void FFTJetInterface::loadInputCollection ( const edm::Event iEvent)
protected

Definition at line 54 of file FFTJetInterface.cc.

References anomalous, edm::View< T >::begin(), fftjetcms::CALOJET, candidateIndex, doPVCorrection, end, edm::View< T >::end(), eventData, edm::Event::getByToken(), inputCollection, inputToken, edm::isNotFinite(), jetType, reco::Candidate::p4(), CaloTower::p4(), reco::Candidate::pt(), anotherprimaryvertexanalyzer_cfi::pvCollection, srcPVsToken, and vertex_.

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

55 {
56  // Figure out if we are going to perform the vertex adjustment
57  const bool adjustForVertex = doPVCorrection && jetType == CALOJET;
58 
59  // Figure out the vertex
60  if (adjustForVertex)
61  {
63  iEvent.getByToken(srcPVsToken, pvCollection);
64  if (pvCollection->empty())
65  vertex_ = reco::Particle::Point(0.0, 0.0, 0.0);
66  else
67  vertex_ = pvCollection->begin()->position();
68  }
69 
70  // Get the input collection
72 
73  // Create the set of 4-vectors needed by the algorithm
74  eventData.clear();
75  candidateIndex.clear();
76  unsigned index = 0;
79  it != end; ++it, ++index)
80  {
81  const reco::Candidate& item(*it);
82  if (anomalous(item))
83  continue;
84  if (edm::isNotFinite(item.pt()))
85  continue;
86 
87  if (adjustForVertex)
88  {
89  const CaloTower& tower(dynamic_cast<const CaloTower&>(item));
90  eventData.push_back(VectorLike(tower.p4(vertex_)));
91  }
92  else
93  eventData.push_back(item.p4());
94  candidateIndex.push_back(index);
95  }
96  assert(eventData.size() == candidateIndex.size());
97 }
edm::EDGetTokenT< reco::CandidateView > inputToken
edm::Handle< reco::CandidateView > inputCollection
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
std::vector< unsigned > candidateIndex
const_iterator begin() const
bool isNotFinite(T x)
Definition: isFinite.h:10
reco::Particle::Point vertex_
math::XYZTLorentzVector VectorLike
edm::EDGetTokenT< reco::VertexCollection > srcPVsToken
math::XYZPoint Point
point in the space
Definition: Particle.h:25
#define end
Definition: vmac.h:39
const AnomalousTower anomalous
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:86
const_iterator end() const
std::vector< fftjetcms::VectorLike > eventData
FFTJetInterface& fftjetcms::FFTJetInterface::operator= ( const FFTJetInterface )
privatedelete
bool FFTJetInterface::storeInSinglePrecision ( ) const
protected
const reco::Particle::Point& fftjetcms::FFTJetInterface::vertexUsed ( ) const
inlineprotected

Definition at line 72 of file FFTJetInterface.h.

References vertex_.

Referenced by FFTJetProducer::writeJets().

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

Member Data Documentation

const AnomalousTower fftjetcms::FFTJetInterface::anomalous
protected

Definition at line 93 of file FFTJetInterface.h.

Referenced by loadInputCollection().

std::vector<unsigned> fftjetcms::FFTJetInterface::candidateIndex
protected
const double fftjetcms::FFTJetInterface::completeEventScale
private

Definition at line 114 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

const bool fftjetcms::FFTJetInterface::doPVCorrection
protected

Definition at line 84 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

std::auto_ptr<fftjet::Grid2d<fftjetcms::Real> > fftjetcms::FFTJetInterface::energyFlow
protected
const std::vector<double> fftjetcms::FFTJetInterface::etaDependentMagnutideFactors
protected

Definition at line 90 of file FFTJetInterface.h.

Referenced by discretizeEnergyFlow().

std::vector<fftjetcms::VectorLike> fftjetcms::FFTJetInterface::eventData
protected
edm::Handle<reco::CandidateView> fftjetcms::FFTJetInterface::inputCollection
protected
const edm::InputTag fftjetcms::FFTJetInterface::inputLabel
protected

Definition at line 75 of file FFTJetInterface.h.

Referenced by FFTJetInterface().

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

Definition at line 117 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

const bool fftjetcms::FFTJetInterface::insertCompleteEvent
private

Definition at line 113 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and getEventScale().

const JetType fftjetcms::FFTJetInterface::jetType
protected

Definition at line 81 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

const std::string fftjetcms::FFTJetInterface::outputLabel
protected
const edm::InputTag fftjetcms::FFTJetInterface::srcPVs
protected

Definition at line 87 of file FFTJetInterface.h.

Referenced by FFTJetInterface().

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

Definition at line 118 of file FFTJetInterface.h.

Referenced by FFTJetInterface(), and loadInputCollection().

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

Definition at line 115 of file FFTJetInterface.h.

Referenced by loadInputCollection(), and vertexUsed().