CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Types | Private Member Functions | Private Attributes
HiEgammaIsolationProducer Class Reference

#include <PhysicsTools/PatAlgos/test/HiEgammaIsolationProducer.cc>

Inheritance diagram for HiEgammaIsolationProducer:
edm::EDProducer edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 HiEgammaIsolationProducer (const edm::ParameterSet &)
 
 ~HiEgammaIsolationProducer ()
 
- 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
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Types

enum  IsoMode {
  calcCx, calcRx, calcTxy, calcDRxy,
  calcErr
}
 

Private Member Functions

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

Private Attributes

edm::InputTag barrelBCLabel_
 
edm::InputTag endcapBCLabel_
 
edm::InputTag hbheLabel_
 
edm::InputTag hfLabel_
 
edm::InputTag hoLabel_
 
std::string label_
 
int mode_
 
edm::InputTag photons_
 
edm::InputTag trackLabel_
 
IsoMode var_
 
double x_
 
double y_
 

Additional Inherited Members

- Public Types inherited from edm::EDProducer
typedef EDProducer ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::EDProducer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- 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

Description: Produce HI Egamma isolationsfor PAT

Implementation:

Definition at line 52 of file HiEgammaIsolationProducer.cc.

Member Enumeration Documentation

Constructor & Destructor Documentation

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

Definition at line 81 of file HiEgammaIsolationProducer.cc.

81  :
82  photons_(iConfig.getParameter<edm::InputTag>("photons")),
83  barrelBCLabel_(iConfig.getParameter<edm::InputTag>("barrelBasicCluster")),
84  endcapBCLabel_(iConfig.getParameter<edm::InputTag>("endcapBasicCluster")),
85  hfLabel_(iConfig.getParameter<edm::InputTag>("hfreco")),
86  hoLabel_(iConfig.getParameter<edm::InputTag>("horeco")),
87  hbheLabel_(iConfig.getParameter<edm::InputTag>("hbhereco")),
88  trackLabel_(iConfig.getParameter<edm::InputTag>("track")),
89  label_(iConfig.existsAs<std::string>("label") ? iConfig.getParameter<std::string>("label") : ""),
90  x_(iConfig.getParameter<double>("x")),
91  y_(iConfig.getParameter<double>("y")),
92  var_(iConfig.getParameter<std::string>("iso") == "Cx" ? calcCx :
93  iConfig.getParameter<std::string>("iso") == "Rx" ? calcRx :
94  iConfig.getParameter<std::string>("iso") == "Txy" ? calcTxy :
95  iConfig.getParameter<std::string>("iso") == "dRxy" ? calcDRxy : calcErr ),
96  mode_( iConfig.getParameter<std::string>("mode") == "BackgroundSubtracted" ? 1 : 0)
97 {
98  produces<edm::ValueMap<float> >();
99 }
T getParameter(std::string const &) const
bool existsAs(std::string const &parameterName, bool trackiness=true) const
checks if a parameter exists as a given type
Definition: ParameterSet.h:184
HiEgammaIsolationProducer::~HiEgammaIsolationProducer ( )

Definition at line 102 of file HiEgammaIsolationProducer.cc.

103 {
104 }

Member Function Documentation

void HiEgammaIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprivatevirtual

Implements edm::EDProducer.

Definition at line 108 of file HiEgammaIsolationProducer.cc.

References barrelBCLabel_, calcCx, calcDRxy, calcRx, calcTxy, endcapBCLabel_, edm::Event::getByLabel(), RxCalculator::getCRx(), dRxyCalculator::getDRxy(), RxCalculator::getRx(), TxyCalculator::getTxy(), hbheLabel_, hfLabel_, hoLabel_, i, mode_, photons_, edm::Event::put(), trackLabel_, var_, x_, and y_.

109 {
110  using namespace edm;
111  using namespace std;
112 
113  Handle<View<reco::Photon> > recoPhotons;
114  iEvent.getByLabel(photons_, recoPhotons);
115  //std::cout << "Got " << recoPhotons->size() << " photons" << std::endl;
116  //std::cout << "mode "<<mode_<<std::endl;
117  vector<float> floats(recoPhotons->size(), -100);
118 
119  CxCalculator CxC(iEvent,iSetup,barrelBCLabel_,endcapBCLabel_);
120  RxCalculator RxC(iEvent,iSetup,hbheLabel_,hfLabel_,hoLabel_);
121  TxyCalculator TxyC(iEvent,iSetup,trackLabel_);
122  dRxyCalculator dRxyC(iEvent,iSetup,trackLabel_);
123 
124  for (size_t i = 0; i < recoPhotons->size(); ++i) {
125  if (var_ == calcRx) {
126  if (mode_ == 1) {
127  floats[i] = RxC.getCRx((*recoPhotons)[i].superCluster(),x_,0);
128  } else {
129  floats[i] = RxC.getRx((*recoPhotons)[i].superCluster(),x_,0);
130  }
131  } else if (var_ == calcCx) {
132  if (mode_ == 1) {
133  floats[i] = CxC.getCCx((*recoPhotons)[i].superCluster(),x_,0);
134  } else {
135  floats[i] = CxC.getCx((*recoPhotons)[i].superCluster(),x_,0);
136  }
137  } else if (var_ == calcTxy) {
138  if (mode_ == 1) {
139  // No background subtraction for the moment...
140  floats[i] = TxyC.getTxy((*recoPhotons)[i],x_,y_);
141  } else {
142  floats[i] = TxyC.getTxy((*recoPhotons)[i],x_,y_);
143  }
144  } else if (var_ == calcDRxy) {
145  if (mode_ == 1) {
146  // No background subtraction for the moment...
147  floats[i] = dRxyC.getDRxy((*recoPhotons)[i],x_,y_);
148  } else {
149  floats[i] = dRxyC.getDRxy((*recoPhotons)[i],x_,y_);
150  }
151  }
152  }
153 
154  auto_ptr<ValueMap<float> > pis(new ValueMap<float>());
155  ValueMap<float>::Filler floatfiller(*pis);
156  floatfiller.insert(recoPhotons, floats.begin(), floats.end());
157  floatfiller.fill();
158  iEvent.put(pis);
159 
160 
161 }
int i
Definition: DBlmapReader.cc:9
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:116
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
Definition: Event.h:390

Member Data Documentation

edm::InputTag HiEgammaIsolationProducer::barrelBCLabel_
private

Definition at line 63 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

edm::InputTag HiEgammaIsolationProducer::endcapBCLabel_
private

Definition at line 64 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

edm::InputTag HiEgammaIsolationProducer::hbheLabel_
private

Definition at line 67 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

edm::InputTag HiEgammaIsolationProducer::hfLabel_
private

Definition at line 65 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

edm::InputTag HiEgammaIsolationProducer::hoLabel_
private

Definition at line 66 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

std::string HiEgammaIsolationProducer::label_
private
int HiEgammaIsolationProducer::mode_
private

Definition at line 75 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

edm::InputTag HiEgammaIsolationProducer::photons_
private

Definition at line 62 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

edm::InputTag HiEgammaIsolationProducer::trackLabel_
private

Definition at line 68 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

IsoMode HiEgammaIsolationProducer::var_
private

Definition at line 74 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

double HiEgammaIsolationProducer::x_
private

Definition at line 72 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

double HiEgammaIsolationProducer::y_
private

Definition at line 73 of file HiEgammaIsolationProducer.cc.

Referenced by produce().