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

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_
 
bool jetCorrectorFormat_
 
edm::EDGetTokenT
< reco::CandidateView
src_
 
std::string tableLabel_
 
bool useTextTable_
 
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 37 of file VoronoiBackgroundProducer.cc.

Constructor & Destructor Documentation

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

Definition at line 77 of file VoronoiBackgroundProducer.cc.

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

77  :
78  voronoi_(0),
79  doEqualize_(iConfig.getParameter<bool>("doEqualize")),
80  equalizeThreshold0_(iConfig.getParameter<double>("equalizeThreshold0")),
81  equalizeThreshold1_(iConfig.getParameter<double>("equalizeThreshold1")),
82  equalizeR_(iConfig.getParameter<double>("equalizeR")),
83  useTextTable_(iConfig.getParameter<bool>("useTextTable")),
84  jetCorrectorFormat_(iConfig.getParameter<bool>("jetCorrectorFormat")),
85  isCalo_(iConfig.getParameter<bool>("isCalo")),
86  tableLabel_(iConfig.getParameter<std::string>("tableLabel")),
87  etaBins_(iConfig.getParameter<int>("etaBins")),
88  fourierOrder_(iConfig.getParameter<int>("fourierOrder"))
89 {
90 
91  src_ = consumes<reco::CandidateView>(iConfig.getParameter<edm::InputTag>("src"));
92  //register your products
93 
94  produces<reco::VoronoiMap>();
95  produces<std::vector<float> >();
96 }
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::CandidateView > src_
VoronoiBackgroundProducer::~VoronoiBackgroundProducer ( )

Definition at line 99 of file VoronoiBackgroundProducer.cc.

100 {
101 }

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 110 of file VoronoiBackgroundProducer.cc.

References VoronoiAlgorithm::clear(), doEqualize_, equalizeR_, equalizeThreshold0_, equalizeThreshold1_, edm::helper::Filler< Map >::fill(), edm::EventSetup::get(), edm::Event::getByToken(), i, edm::helper::Filler< Map >::insert(), isCalo_, edm::EventBase::isRealData(), jetCorrectorFormat_, JetCorrectorParametersCollection::L1Offset, LogDebug, NULL, VoronoiAlgorithm::particle_area(), VoronoiAlgorithm::perp_fourier(), edm::ESHandle< class >::product(), VoronoiAlgorithm::push_back_particle(), edm::Event::put(), mathSSE::sqrt(), src_, VoronoiAlgorithm::subtracted_equalized_perp(), VoronoiAlgorithm::subtracted_unequalized_perp(), tableLabel_, useTextTable_, UETable::values, voronoi_, and vvm.

111 {
112  using namespace edm;
113  if(voronoi_ == 0){
114  UECalibration *ue = NULL;
115  if (useTextTable_) {
116  const bool isData = iEvent.isRealData();
117  const char *calibrationFile = NULL;
118  if(isCalo_){
119  if(isData) calibrationFile = "RecoHI/HiJetAlgos/data/ue_calibrations_hermite_calo_data.txt";
120  if(!isData) calibrationFile = "RecoHI/HiJetAlgos/data/ue_calibrations_hermite_calo_mc.txt";
121  }else{
122  if(isData) calibrationFile = "RecoHI/HiJetAlgos/data/ue_calibrations_hermite_pf_data.txt";
123  if(!isData) calibrationFile = "RecoHI/HiJetAlgos/data/ue_calibrations_hermite_pf_mc.txt";
124  }
125  ue = new UECalibration(calibrationFile);
126  }
127  else if (jetCorrectorFormat_) {
129 
130  iSetup.get<JetCorrectionsRecord>().get(tableLabel_,ueHandle);
131 
132  const JetCorrectorParametersCollection *payload = ueHandle.product();
133  std::vector<float> ue_vec = (*payload)[JetCorrectorParametersCollection::L1Offset].record(0).parameters();
134 
135  ue = new UECalibration(ue_vec);
136  }
137  else {
138  edm::ESHandle<UETable> ueHandle;
139 
140  iSetup.get<HeavyIonUERcd>().get(tableLabel_,ueHandle);
141 
142  const UETable *ueTable = ueHandle.product();
143  ue = new UECalibration(ueTable->values);
144  }
145 
147  }
148 
149  voronoi_->clear();
150  vvm.clear();
151 
153  iEvent.getByToken(src_,inputsHandle);
154 
155  for(unsigned int i = 0; i < inputsHandle->size(); ++i){
156  reco::CandidateViewRef ref(inputsHandle,i);
157  voronoi_->push_back_particle(ref->pt(),ref->eta(),ref->phi(),0);
158  }
159 
160  std::vector<double> subtracted_momenta = voronoi_->subtracted_unequalized_perp();
161  std::vector<double> equalized_momenta = voronoi_->subtracted_equalized_perp();
162  std::vector<double> particle_area = voronoi_->particle_area();
163  std::vector<double> voronoi_vn = voronoi_->perp_fourier();
164  std::auto_ptr<std::vector<float> > vnout(new std::vector<float>(voronoi_vn.begin(), voronoi_vn.end()));
165  std::auto_ptr<reco::VoronoiMap> mapout(new reco::VoronoiMap());
166  reco::VoronoiMap::Filler filler(*mapout);
167 
168  for(unsigned int i = 0; i < inputsHandle->size(); ++i){
169  reco::CandidateViewRef ref(inputsHandle,i);
170  const double pre_eq_pt = subtracted_momenta[i];
171  const double post_eq_pt = equalized_momenta[i];
172  const double area = particle_area[i];
173  const double mass_square = ref->massSqr();
174  const double pre_eq_mt = sqrt(mass_square + pre_eq_pt * pre_eq_pt);
175  const double post_eq_mt = sqrt(mass_square + post_eq_pt * post_eq_pt);
176 
177  reco::VoronoiBackground bkg(pre_eq_pt,post_eq_pt,pre_eq_mt,post_eq_mt,area);
178  LogDebug("VoronoiBackgroundProducer")<<"Subtraction --- oldpt : "<<ref->pt()<<" --- newpt : "<<post_eq_pt<<endl;
179  vvm.push_back(bkg);
180  }
181 
182  filler.insert(inputsHandle,vvm.begin(),vvm.end());
183  filler.fill();
184  iEvent.put(vnout);
185  iEvent.put(mapout);
186 
187 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:449
std::vector< double > perp_fourier(void)
#define NULL
Definition: scimark2.h:8
bool isRealData() const
Definition: EventBase.h:64
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
std::vector< float > values
Definition: UETable.h:25
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:86
edm::EDGetTokenT< reco::CandidateView > src_
std::vector< double > subtracted_unequalized_perp(void)
std::vector< double > subtracted_equalized_perp(void)
Definition: UETable.h:7

Member Data Documentation

bool VoronoiBackgroundProducer::doEqualize_
private

Definition at line 51 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

double VoronoiBackgroundProducer::equalizeR_
private

Definition at line 54 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

double VoronoiBackgroundProducer::equalizeThreshold0_
private

Definition at line 52 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

double VoronoiBackgroundProducer::equalizeThreshold1_
private

Definition at line 53 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

int VoronoiBackgroundProducer::etaBins_
private

Definition at line 59 of file VoronoiBackgroundProducer.cc.

int VoronoiBackgroundProducer::fourierOrder_
private

Definition at line 60 of file VoronoiBackgroundProducer.cc.

bool VoronoiBackgroundProducer::isCalo_
private

Definition at line 57 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

bool VoronoiBackgroundProducer::jetCorrectorFormat_
private

Definition at line 56 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

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

Definition at line 49 of file VoronoiBackgroundProducer.cc.

Referenced by produce(), and VoronoiBackgroundProducer().

std::string VoronoiBackgroundProducer::tableLabel_
private

Definition at line 58 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

bool VoronoiBackgroundProducer::useTextTable_
private

Definition at line 55 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

VoronoiAlgorithm* VoronoiBackgroundProducer::voronoi_
private

Definition at line 50 of file VoronoiBackgroundProducer.cc.

Referenced by produce().

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

Definition at line 61 of file VoronoiBackgroundProducer.cc.

Referenced by produce().