CMS 3D CMS Logo

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::ProductRegistryHelper

List of all members.

Public Member Functions

 HiEgammaIsolationProducer (const edm::ParameterSet &)
 ~HiEgammaIsolationProducer ()

Private Types

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

Private Member Functions

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

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_

Detailed Description

Description: Produce HI Egamma isolationsfor PAT

Implementation:

Definition at line 52 of file HiEgammaIsolationProducer.cc.


Member Enumeration Documentation

Enumerator:
calcCx 
calcRx 
calcTxy 
calcDRxy 
calcErr 

Definition at line 71 of file HiEgammaIsolationProducer.cc.


Constructor & Destructor Documentation

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

Definition at line 81 of file HiEgammaIsolationProducer.cc.

                                                                                  :
  photons_(iConfig.getParameter<edm::InputTag>("photons")),
  barrelBCLabel_(iConfig.getParameter<edm::InputTag>("barrelBasicCluster")),
  endcapBCLabel_(iConfig.getParameter<edm::InputTag>("endcapBasicCluster")),
  hfLabel_(iConfig.getParameter<edm::InputTag>("hfreco")),
  hoLabel_(iConfig.getParameter<edm::InputTag>("horeco")),
  hbheLabel_(iConfig.getParameter<edm::InputTag>("hbhereco")),
  trackLabel_(iConfig.getParameter<edm::InputTag>("track")),
  label_(iConfig.existsAs<std::string>("label") ? iConfig.getParameter<std::string>("label") : ""),
  x_(iConfig.getParameter<double>("x")),
  y_(iConfig.getParameter<double>("y")),
  var_(iConfig.getParameter<std::string>("iso") == "Cx" ? calcCx :
       iConfig.getParameter<std::string>("iso") == "Rx" ? calcRx :
       iConfig.getParameter<std::string>("iso") == "Txy" ? calcTxy :
       iConfig.getParameter<std::string>("iso") == "dRxy" ? calcDRxy : calcErr ),
  mode_( iConfig.getParameter<std::string>("mode") == "BackgroundSubtracted" ? 1 : 0)
{
      produces<edm::ValueMap<float> >();
}
HiEgammaIsolationProducer::~HiEgammaIsolationProducer ( )

Definition at line 102 of file HiEgammaIsolationProducer.cc.

{
}

Member Function Documentation

void HiEgammaIsolationProducer::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
) [private, virtual]

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_.

{
   using namespace edm;
   using namespace std;

   Handle<View<reco::Photon> > recoPhotons;
   iEvent.getByLabel(photons_, recoPhotons);
   //std::cout << "Got " << recoPhotons->size() << " photons" << std::endl;
   //std::cout << "mode "<<mode_<<std::endl;
   vector<float> floats(recoPhotons->size(), -100);
   
   CxCalculator   CxC(iEvent,iSetup,barrelBCLabel_,endcapBCLabel_);
   RxCalculator   RxC(iEvent,iSetup,hbheLabel_,hfLabel_,hoLabel_);
   TxyCalculator  TxyC(iEvent,iSetup,trackLabel_);
   dRxyCalculator dRxyC(iEvent,iSetup,trackLabel_);

   for (size_t i = 0; i < recoPhotons->size(); ++i) {
      if (var_ == calcRx) {
         if (mode_ == 1) {
            floats[i] = RxC.getCRx((*recoPhotons)[i].superCluster(),x_,0);
         } else {
            floats[i] = RxC.getRx((*recoPhotons)[i].superCluster(),x_,0);
         }
      } else if (var_ == calcCx) {
         if (mode_ == 1) {
            floats[i] = CxC.getCCx((*recoPhotons)[i].superCluster(),x_,0);
         } else {
            floats[i] = CxC.getCx((*recoPhotons)[i].superCluster(),x_,0);
         }
      } else if (var_ == calcTxy) {
         if (mode_ == 1) {
            // No background subtraction for the moment...
            floats[i] = TxyC.getTxy((*recoPhotons)[i].superCluster(),x_,y_);
         } else {
            floats[i] = TxyC.getTxy((*recoPhotons)[i].superCluster(),x_,y_);
         }
      } else if (var_ == calcDRxy) {
         if (mode_ == 1) {
            // No background subtraction for the moment...
            floats[i] = dRxyC.getDRxy((*recoPhotons)[i].superCluster(),x_,y_);
         } else {
            floats[i] = dRxyC.getDRxy((*recoPhotons)[i].superCluster(),x_,y_);
         }
      }
   }

   auto_ptr<ValueMap<float> > pis(new ValueMap<float>());
   ValueMap<float>::Filler floatfiller(*pis);
   floatfiller.insert(recoPhotons, floats.begin(), floats.end());
   floatfiller.fill();
   iEvent.put(pis);
   

}

Member Data Documentation

Definition at line 63 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 64 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 67 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 65 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 66 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

std::string HiEgammaIsolationProducer::label_ [private]

Definition at line 70 of file HiEgammaIsolationProducer.cc.

Definition at line 75 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 62 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 68 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 74 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 72 of file HiEgammaIsolationProducer.cc.

Referenced by produce().

Definition at line 73 of file HiEgammaIsolationProducer.cc.

Referenced by produce().