Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:20:26

0001 // JetCalibrationMethods.cc
0002 // Authors: Inga Bucinskaite, UIC
0003 //
0004 // This file should contain the different algorithms used for Jet Calibration
0005 //
0006 
0007 #include "L1Trigger/L1TCalorimeter/interface/JetCalibrationMethods.h"
0008 #include <vector>
0009 
0010 namespace l1t {
0011 
0012   void JetCalibration(std::vector<l1t::Jet>* uncalibjets,
0013                       std::vector<double> jetCalibrationParams,
0014                       std::vector<l1t::Jet>* jets,
0015                       std::string jetCalibrationType,
0016                       double jetLSB) {
0017     for (std::vector<l1t::Jet>::const_iterator uncalibjet = uncalibjets->begin(); uncalibjet != uncalibjets->end();
0018          ++uncalibjet) {
0019       if (jetCalibrationType == "None") {
0020         const l1t::Jet& corrjets = *uncalibjet;
0021         jets->push_back(corrjets);
0022         continue;
0023       }
0024 
0025       if (jetCalibrationType == "Stage1JEC") {
0026         int jetPt = (uncalibjet->hwPt()) * jetLSB;  // correction factors are parameterized as functions of physical pt
0027         int jetPhi = uncalibjet->hwPhi();
0028         int jetEta = uncalibjet->hwEta();
0029         int jetQual = uncalibjet->hwQual();
0030         double jpt = 0.0;
0031 
0032         double alpha = jetCalibrationParams[2 * jetEta + 0];      //Scale factor (See jetSF_cfi.py)
0033         double gamma = ((jetCalibrationParams[2 * jetEta + 1]));  //Offset
0034 
0035         jpt = jetPt * alpha + gamma;
0036         unsigned int corjetET = (int)(jpt / jetLSB);
0037 
0038         ROOT::Math::LorentzVector<ROOT::Math::PxPyPzE4D<double> > jetLorentz(0, 0, 0, 0);
0039         l1t::Jet corrjets(*&jetLorentz, corjetET, jetEta, jetPhi, jetQual);
0040 
0041         jets->push_back(corrjets);
0042       }
0043     }
0044   }
0045 }  // namespace l1t