CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

DistortedMETProducer Class Reference

Inheritance diagram for DistortedMETProducer:
edm::EDProducer edm::ProducerBase edm::ProductRegistryHelper

List of all members.

Public Member Functions

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

Private Member Functions

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

Private Attributes

double metScaleShift_
edm::InputTag metTag_

Detailed Description

Definition at line 10 of file DistortedMETProducer.cc.


Constructor & Destructor Documentation

DistortedMETProducer::DistortedMETProducer ( const edm::ParameterSet pset) [explicit]

Definition at line 31 of file DistortedMETProducer.cc.

References edm::ParameterSet::getUntrackedParameter(), metScaleShift_, and metTag_.

                                                                      {

  // What is being produced
      produces<std::vector<reco::MET> >();

  // Input products
      metTag_ = pset.getUntrackedParameter<edm::InputTag> ("MetTag", edm::InputTag("met"));
  // Distortions in MET in Gev**{-1/2}
      metScaleShift_ = pset.getUntrackedParameter<double> ("MetScaleShift",1.e-3);

} 
DistortedMETProducer::~DistortedMETProducer ( )

Definition at line 44 of file DistortedMETProducer.cc.

                                           {
}

Member Function Documentation

void DistortedMETProducer::beginJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 48 of file DistortedMETProducer.cc.

                                    {
}
void DistortedMETProducer::endJob ( void  ) [private, virtual]

Reimplemented from edm::EDProducer.

Definition at line 52 of file DistortedMETProducer.cc.

{}
void DistortedMETProducer::produce ( edm::Event ev,
const edm::EventSetup  
) [private, virtual]

Implements edm::EDProducer.

Definition at line 55 of file DistortedMETProducer.cc.

References funct::cos(), edm::Event::getByLabel(), edm::EventBase::isRealData(), CaloMET_cfi::met, metScaleShift_, metTag_, edm::Event::put(), and funct::sin().

                                                                     {

      if (ev.isRealData()) return;

      // MET collection
      edm::Handle<edm::View<reco::MET> > metCollection;
      if (!ev.getByLabel(metTag_, metCollection)) {
            edm::LogError("") << ">>> MET collection does not exist !!!";
            return;
      }
      edm::RefToBase<reco::MET> met = metCollection->refAt(0);

      std::auto_ptr<reco::METCollection> newmetCollection (new reco::METCollection);

      double met_et = met->et() * (1. + metScaleShift_);
      double sum_et = met->sumEt() * (1. + metScaleShift_);
      double met_phi = met->phi();
      double met_ex = met_et*cos(met_phi);
      double met_ey = met_et*sin(met_phi);
      reco::Particle::LorentzVector met_p4(met_ex, met_ey, 0., met_et);
      reco::Particle::Point met_vtx(0.,0.,0.);
      reco::MET* newmet = new reco::MET(sum_et, met_p4, met_vtx);

      newmetCollection->push_back(*newmet);

      ev.put(newmetCollection);
}

Member Data Documentation

Definition at line 21 of file DistortedMETProducer.cc.

Referenced by DistortedMETProducer(), and produce().

Definition at line 20 of file DistortedMETProducer.cc.

Referenced by DistortedMETProducer(), and produce().