CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

JetEnergyShift Class Reference

Plugin to shift the jet energy scale and recalculate the MET accordingly. More...

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

List of all members.

Public Member Functions

 JetEnergyShift (const edm::ParameterSet &)
 default constructor
 ~JetEnergyShift ()
 default destructor

Private Member Functions

virtual void produce (edm::Event &, const edm::EventSetup &)
 rescale jet energy and recalculated MET

Private Attributes

edm::InputTag inputJets_
 jet input collection
edm::InputTag inputMETs_
 met input collection
double jetEMLimitForMET_
 limit on the emf of the jet for Type1 MET corrections
double jetPTThresholdForMET_
 threshold on (raw!) jet pt for Type1 MET corrections
std::string outputJets_
 jet output collection
std::string outputMETs_
 MET output collection.
double scaleFactor_
 scale factor for the rescaling

Detailed Description

Plugin to shift the jet energy scale and recalculate the MET accordingly.

Plugin to shift the jet energy scale and recalculate the MET accordingly. The module mimics the assumption that the jet energy scale (JES) has been estimated wrong by a factor of _scaleFactor_, corresponding to a L2L3 corrected jet. The p4 of the patJet is beeing rescaled. All other patJet properties stay the same. The MET is recalculated taking the shifted JES into account for the Type1 MET correction. For the patMET the rescaled sumET and the p4 are stored. The different correction levels are lost for the new collection. The module has the following parameters:

inputJets : input collection for MET (expecting patMET). inputMETs : input collection for jets (expecting patJets). scaleFactor : scale factor to which to shift the JES. jetPTThresholdForMET : pt threshold for (uncorrected!) jets considered for Type1 MET corrections. jetEMLimitForMET : limit in em fraction for Type1 MET correction.

For expected parameters for _jetPTThresholdForMET_ and _jetEMLimitForMET_ have a look at: JetMETCorrections/Type1MET/python/MetType1Corrections_cff.py. Two output collections are written to file with instance label corresponding to the input label of the jet and met input collections.

Definition at line 31 of file JetEnergyShift.cc.


Constructor & Destructor Documentation

JetEnergyShift::JetEnergyShift ( const edm::ParameterSet cfg) [explicit]

default constructor

Definition at line 64 of file JetEnergyShift.cc.

References inputJets_, inputMETs_, edm::InputTag::label(), outputJets_, and outputMETs_.

                                                        :
  inputJets_           (cfg.getParameter<edm::InputTag>("inputJets"           )),
  inputMETs_           (cfg.getParameter<edm::InputTag>("inputMETs"           )),
  scaleFactor_         (cfg.getParameter<double>       ("scaleFactor"         )),
  jetPTThresholdForMET_(cfg.getParameter<double>       ("jetPTThresholdForMET")),
  jetEMLimitForMET_    (cfg.getParameter<double>       ("jetEMLimitForMET"    ))
{
  // use label of input to create label for output
  outputJets_ = inputJets_.label();
  outputMETs_ = inputMETs_.label();
  // register products
  produces<std::vector<pat::Jet> >(outputJets_);
  produces<std::vector<pat::MET> >(outputMETs_);
}
JetEnergyShift::~JetEnergyShift ( ) [inline]

default destructor

Definition at line 37 of file JetEnergyShift.cc.

{};

Member Function Documentation

void JetEnergyShift::produce ( edm::Event event,
const edm::EventSetup setup 
) [private, virtual]

rescale jet energy and recalculated MET

Implements edm::EDProducer.

Definition at line 80 of file JetEnergyShift.cc.

References reco::LeafCandidate::et(), inputJets_, inputMETs_, metsig::jet, jetEMLimitForMET_, jetPTThresholdForMET_, analyzePatCleaning_cfg::jets, CaloMET_cfi::met, outputJets_, outputMETs_, reco::LeafCandidate::px(), reco::LeafCandidate::py(), reco::Jet::scaleEnergy(), scaleFactor_, mathSSE::sqrt(), and reco::MET::sumEt().

{
  edm::Handle<std::vector<pat::Jet> > jets;
  event.getByLabel(inputJets_, jets);

  edm::Handle<std::vector<pat::MET> > mets;
  event.getByLabel(inputMETs_, mets);
  
  std::auto_ptr<std::vector<pat::Jet> > pJets(new std::vector<pat::Jet>);
  std::auto_ptr<std::vector<pat::MET> > pMETs(new std::vector<pat::MET>);

  double dPx    = 0.;
  double dPy    = 0.;
  double dSumEt = 0.;

  for(std::vector<pat::Jet>::const_iterator jet = jets->begin(); jet != jets->end(); ++jet) {
    pat::Jet scaledJet = *jet;
    scaledJet.scaleEnergy( scaleFactor_ );
    pJets->push_back( scaledJet );
    // consider jet scale shift only if the raw jet pt and emf 
    // is above the thresholds given in the module definition
    if(jet->correctedJet("raw").pt() > jetPTThresholdForMET_
       && jet->emEnergyFraction() < jetEMLimitForMET_) {
      dPx    += scaledJet.px() - jet->px();
      dPy    += scaledJet.py() - jet->py();
      dSumEt += scaledJet.et() - jet->et();
    }
  }

  // scale MET accordingly
  pat::MET met = *(mets->begin());
  double scaledMETPx = met.px() - dPx;
  double scaledMETPy = met.py() - dPy;
  pat::MET scaledMET(reco::MET(met.sumEt()+dSumEt, reco::MET::LorentzVector(scaledMETPx, scaledMETPy, 0, sqrt(scaledMETPx*scaledMETPx+scaledMETPy*scaledMETPy)), reco::MET::Point(0,0,0)));
  pMETs->push_back( scaledMET );
  event.put(pJets, outputJets_);
  event.put(pMETs, outputMETs_);
}

Member Data Documentation

jet input collection

Definition at line 45 of file JetEnergyShift.cc.

Referenced by JetEnergyShift(), and produce().

met input collection

Definition at line 47 of file JetEnergyShift.cc.

Referenced by JetEnergyShift(), and produce().

limit on the emf of the jet for Type1 MET corrections

Definition at line 57 of file JetEnergyShift.cc.

Referenced by produce().

threshold on (raw!) jet pt for Type1 MET corrections

Definition at line 55 of file JetEnergyShift.cc.

Referenced by produce().

std::string JetEnergyShift::outputJets_ [private]

jet output collection

Definition at line 49 of file JetEnergyShift.cc.

Referenced by JetEnergyShift(), and produce().

std::string JetEnergyShift::outputMETs_ [private]

MET output collection.

Definition at line 51 of file JetEnergyShift.cc.

Referenced by JetEnergyShift(), and produce().

double JetEnergyShift::scaleFactor_ [private]

scale factor for the rescaling

Definition at line 53 of file JetEnergyShift.cc.

Referenced by produce().