CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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

virtual ~FFTJetInterface ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

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::VectorLike
eventData
 
edm::Handle< reco::CandidateViewinputCollection
 
const edm::InputTag inputLabel
 
const JetType jetType
 
const std::string outputLabel
 
const edm::InputTag srcPVs
 

Private Member Functions

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

Private Attributes

const double completeEventScale
 
edm::EDGetTokenT
< reco::CandidateView
inputToken
 
const bool insertCompleteEvent
 
edm::EDGetTokenT
< reco::VertexCollection
srcPVsToken
 
reco::Particle::Point vertex_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
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)
 

Detailed Description

Definition at line 52 of file FFTJetInterface.h.

Constructor & Destructor Documentation

virtual fftjetcms::FFTJetInterface::~FFTJetInterface ( )
inlinevirtual

Definition at line 55 of file FFTJetInterface.h.

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 ( )
private
fftjetcms::FFTJetInterface::FFTJetInterface ( const FFTJetInterface )
private

Member Function Documentation

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

Definition at line 61 of file FFTJetInterface.h.

References NULL.

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

62  {
63  if (ptr.get() == NULL)
64  throw cms::Exception("FFTJetBadConfig") << message << std::endl;
65  }
#define NULL
Definition: scimark2.h:8
void FFTJetInterface::discretizeEnergyFlow ( )
protected

Definition at line 100 of file FFTJetInterface.cc.

References assert(), energyFlow, etaDependentMagnutideFactors, eventData, g, and i.

Referenced by 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] : 0;
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 }
int i
Definition: DBlmapReader.cc:9
std::auto_ptr< fftjet::Grid2d< fftjetcms::Real > > energyFlow
assert(m_qm.get())
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, assert(), fftjetcms::CALOJET, candidateIndex, doPVCorrection, end, eventData, edm::Event::getByToken(), cmsHarvester::index, inputCollection, inputToken, edm::isNotFinite(), jetType, reco::Candidate::p4(), CaloTower::p4(), reco::Candidate::pt(), srcPVsToken, and vertex_.

Referenced by 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:464
assert(m_qm.get())
std::vector< unsigned > candidateIndex
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:37
const AnomalousTower anomalous
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:85
std::vector< fftjetcms::VectorLike > eventData
FFTJetInterface& fftjetcms::FFTJetInterface::operator= ( const FFTJetInterface )
private
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().