CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
VoronoiBackgroundProducer Class Reference
Inheritance diagram for VoronoiBackgroundProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 VoronoiBackgroundProducer (const edm::ParameterSet &)
 
 ~VoronoiBackgroundProducer ()
 
- Public Member Functions inherited from edm::EDProducer
 EDProducer ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducer ()
 
- Public Member Functions inherited from edm::ProducerBase
 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
 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 

Private Attributes

bool doEqualize_
 
double equalizeR_
 
double equalizeThreshold0_
 
double equalizeThreshold1_
 
int etaBins_
 
int fourierOrder_
 
bool isCalo_
 
edm::EDGetTokenT
< reco::CandidateView
src_
 
VoronoiAlgorithmvoronoi_
 
std::vector
< reco::VoronoiBackground
vvm
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- 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)
 

Detailed Description

Definition at line 26 of file VoronoiBackgroundProducer.cc.

Constructor & Destructor Documentation

VoronoiBackgroundProducer::VoronoiBackgroundProducer ( const edm::ParameterSet iConfig)
explicit

Definition at line 63 of file VoronoiBackgroundProducer.cc.

References edm::ParameterSet::getParameter(), and src_.

63  :
64  voronoi_(0),
65  doEqualize_(iConfig.getParameter<bool>("doEqualize")),
66  equalizeThreshold0_(iConfig.getParameter<double>("equalizeThreshold0")),
67  equalizeThreshold1_(iConfig.getParameter<double>("equalizeThreshold1")),
68  equalizeR_(iConfig.getParameter<double>("equalizeR")),
69  isCalo_(iConfig.getParameter<bool>("isCalo")),
70  etaBins_(iConfig.getParameter<int>("etaBins")),
71  fourierOrder_(iConfig.getParameter<int>("fourierOrder"))
72 {
73 
74  src_ = consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("src"));
75  //register your products
76 
77  produces<reco::VoronoiMap>();
78  produces<std::vector<float> >();
79 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::CandidateView > src_
VoronoiBackgroundProducer::~VoronoiBackgroundProducer ( )

Definition at line 82 of file VoronoiBackgroundProducer.cc.

83 {
84 }

Member Function Documentation

void VoronoiBackgroundProducer::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static
void VoronoiBackgroundProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
privatevirtual

Implements edm::EDProducer.

Definition at line 93 of file VoronoiBackgroundProducer.cc.

References VoronoiAlgorithm::clear(), data, doEqualize_, equalizeR_, equalizeThreshold0_, equalizeThreshold1_, edm::helper::Filler< Map >::fill(), edm::Event::getByToken(), i, edm::helper::Filler< Map >::insert(), isCalo_, edm::EventBase::isRealData(), LogDebug, VoronoiAlgorithm::particle_area(), VoronoiAlgorithm::perp_fourier(), VoronoiAlgorithm::push_back_particle(), edm::Event::put(), mathSSE::sqrt(), src_, VoronoiAlgorithm::subtracted_equalized_perp(), VoronoiAlgorithm::subtracted_unequalized_perp(), voronoi_, and vvm.

94 {
95  using namespace edm;
96  if(voronoi_ == 0){
97  bool data = iEvent.isRealData();
99  }
100 
101  voronoi_->clear();
102  vvm.clear();
103 
105  iEvent.getByToken(src_,inputsHandle);
106 
107  for(unsigned int i = 0; i < inputsHandle->size(); ++i){
108  reco::CandidateViewRef ref(inputsHandle,i);
109  voronoi_->push_back_particle(ref->pt(),ref->eta(),ref->phi(),0);
110  }
111 
112  std::vector<double> subtracted_momenta = voronoi_->subtracted_unequalized_perp();
113  std::vector<double> equalized_momenta = voronoi_->subtracted_equalized_perp();
114  std::vector<double> particle_area = voronoi_->particle_area();
115  std::vector<double> voronoi_vn = voronoi_->perp_fourier();
116  std::auto_ptr<std::vector<float> > vnout(new std::vector<float>(voronoi_vn.begin(), voronoi_vn.end()));
117  std::auto_ptr<reco::VoronoiMap> mapout(new reco::VoronoiMap());
118  reco::VoronoiMap::Filler filler(*mapout);
119 
120  for(unsigned int i = 0; i < inputsHandle->size(); ++i){
121  reco::CandidateViewRef ref(inputsHandle,i);
122  const double pre_eq_pt = subtracted_momenta[i];
123  const double post_eq_pt = equalized_momenta[i];
124  const double area = particle_area[i];
125  const double mass_square = ref->massSqr();
126  const double pre_eq_mt = sqrt(mass_square + pre_eq_pt * pre_eq_pt);
127  const double post_eq_mt = sqrt(mass_square + post_eq_pt * post_eq_pt);
128 
129  reco::VoronoiBackground bkg(pre_eq_pt,post_eq_pt,pre_eq_mt,post_eq_mt,area);
130  LogDebug("VoronoiBackgroundProducer")<<"Subtraction --- oldpt : "<<ref->pt()<<" --- newpt : "<<post_eq_pt<<endl;
131  vvm.push_back(bkg);
132  }
133 
134  filler.insert(inputsHandle,vvm.begin(),vvm.end());
135  filler.fill();
136  iEvent.put(vnout);
137  iEvent.put(mapout);
138 
139 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
std::vector< double > perp_fourier(void)
bool isRealData() const
Definition: EventBase.h:60
std::vector< double > particle_area(void)
void push_back_particle(const double perp, const double pseudorapidity, const double azimuth, const unsigned int reduced_particle_flow_id)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T sqrt(T t)
Definition: SSEVec.h:48
std::vector< reco::VoronoiBackground > vvm
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
edm::EDGetTokenT< reco::CandidateView > src_
std::vector< double > subtracted_unequalized_perp(void)
std::vector< double > subtracted_equalized_perp(void)

Member Data Documentation

bool VoronoiBackgroundProducer::doEqualize_
private

Definition at line 40 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

double VoronoiBackgroundProducer::equalizeR_
private

Definition at line 43 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

double VoronoiBackgroundProducer::equalizeThreshold0_
private

Definition at line 41 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

double VoronoiBackgroundProducer::equalizeThreshold1_
private

Definition at line 42 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

int VoronoiBackgroundProducer::etaBins_
private

Definition at line 45 of file VoronoiBackgroundProducer.cc.

int VoronoiBackgroundProducer::fourierOrder_
private

Definition at line 46 of file VoronoiBackgroundProducer.cc.

bool VoronoiBackgroundProducer::isCalo_
private

Definition at line 44 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

edm::EDGetTokenT<reco::CandidateView> VoronoiBackgroundProducer::src_
private

Definition at line 38 of file VoronoiBackgroundProducer.cc.

Referenced by produce(), and VoronoiBackgroundProducer().

VoronoiAlgorithm* VoronoiBackgroundProducer::voronoi_
private

Definition at line 39 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

std::vector<reco::VoronoiBackground> VoronoiBackgroundProducer::vvm
private

Definition at line 47 of file VoronoiBackgroundProducer.cc.

Referenced by produce().