CMS 3D CMS Logo

L1GctCalibFunConfigurer Class Reference

Description: <one line="" class="" summary>="">. More...

#include <L1Trigger/L1GctConfigProducers/interface/L1GctCalibFunConfigurer.h>

List of all members.

Public Types

typedef boost::shared_ptr
< L1GctJetEtCalibrationFunction
CalibFunReturnType

Public Member Functions

 L1GctCalibFunConfigurer (const edm::ParameterSet &)
CalibFunReturnType produceCalibFun (const L1CaloGeometry *)
 ~L1GctCalibFunConfigurer ()

Private Member Functions

std::vector< double > etToEnergyConversion (const L1CaloGeometry *) const
 Calculate Et-to-energy conversion factors for eta bins.
void setOrcaStyleParams ()
 member functions to set up the ORCA-style calibrations (if needed)
void setOrcaStyleParamsForBin (std::vector< double > &paramsForBin)
void setPiecewiseCubicParams ()
 member functions to set up the piecewise cubic calibrations (if needed)
void setPiecewiseCubicParamsForBin (std::vector< double > &paramsForBin)

Private Attributes

bool m_convertToEnergy
 Option to convert Et back to energy for special trigger configurations.
L1GctJetEtCalibrationFunction::CorrectionFunctionType m_corrFunType
 type of correction function to apply
double m_htScaleLSB
 scale and threshold parameters
std::vector< std::vector
< double > > 
m_jetCalibFunc
 the calibration function - converts jet Et to linear
std::vector< std::vector
< double > > 
m_tauCalibFunc
double m_threshold


Detailed Description

Description: <one line="" class="" summary>="">.

Implementation: <Notes on="" implementation>="">

Definition at line 40 of file L1GctCalibFunConfigurer.h.


Member Typedef Documentation

typedef boost::shared_ptr<L1GctJetEtCalibrationFunction> L1GctCalibFunConfigurer::CalibFunReturnType

Definition at line 45 of file L1GctCalibFunConfigurer.h.


Constructor & Destructor Documentation

L1GctCalibFunConfigurer::L1GctCalibFunConfigurer ( const edm::ParameterSet iConfig  ) 

Definition at line 23 of file L1GctCalibFunConfigurer.cc.

References lat::endl(), edm::ParameterSet::getParameter(), i, m_corrFunType, m_jetCalibFunc, m_tauCalibFunc, L1GctJetEtCalibrationFunction::N_CENTRAL_ETA_VALUES, L1GctJetEtCalibrationFunction::NO_CORRECTION, L1GctJetEtCalibrationFunction::NUMBER_ETA_VALUES, L1GctJetEtCalibrationFunction::ORCA_STYLE_CORRECTION, L1GctJetEtCalibrationFunction::PIECEWISE_CUBIC_CORRECTION, L1GctJetEtCalibrationFunction::POWER_SERIES_CORRECTION, setOrcaStyleParams(), setPiecewiseCubicParams(), and ss.

00023                                                                                :
00024   m_htScaleLSB(iConfig.getParameter<double>("L1CaloHtScaleLsbInGeV")), // get the CalibrationFunction parameters
00025   m_threshold (iConfig.getParameter<double>("L1CaloJetZeroSuppressionThresholdInGeV")),
00026   m_convertToEnergy (iConfig.getParameter<bool>("ConvertEtValuesToEnergy")),
00027   m_jetCalibFunc(), m_tauCalibFunc(),
00028   m_corrFunType(L1GctJetEtCalibrationFunction::POWER_SERIES_CORRECTION)
00029 {
00030 
00031   // ------------------------------------------------------------------------------------------
00032   // Read options for different styles of calbration function from the config file
00033   //
00034   std::string CalibStyle = iConfig.getParameter<std::string>("CalibrationStyle");
00035 
00036   edm::ParameterSet calibCoeffs;
00037 
00038   if (CalibStyle == "PowerSeries") {
00039     m_corrFunType = L1GctJetEtCalibrationFunction::POWER_SERIES_CORRECTION;
00040     calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PowerSeriesCoefficients");
00041   }
00042 
00043   if (CalibStyle == "ORCAStyle") {
00044     m_corrFunType = L1GctJetEtCalibrationFunction::ORCA_STYLE_CORRECTION;
00045     calibCoeffs = iConfig.getParameter<edm::ParameterSet>("OrcaStyleCoefficients");
00046   }
00047   
00048   if (CalibStyle == "PiecewiseCubic") {
00049     m_corrFunType = L1GctJetEtCalibrationFunction::PIECEWISE_CUBIC_CORRECTION;
00050     calibCoeffs = iConfig.getParameter<edm::ParameterSet>("PiecewiseCubicCoefficients");
00051   }
00052 
00053   if ((CalibStyle == "PowerSeries") || (CalibStyle == "ORCAStyle") || (CalibStyle == "PiecewiseCubic")) {
00054 
00055     // Read the coefficients from file
00056     // coefficients for non-tau jet corrections
00057     for (unsigned i=0; i<L1GctJetEtCalibrationFunction::NUMBER_ETA_VALUES; ++i) {
00058       std::stringstream ss;
00059       std::string str;
00060       ss << "nonTauJetCalib" << i;
00061       ss >> str;
00062       m_jetCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
00063     }
00064     // coefficients for tau jet corrections
00065     for (unsigned i=0; i<L1GctJetEtCalibrationFunction::N_CENTRAL_ETA_VALUES; ++i) {
00066       std::stringstream ss;
00067       std::string str;
00068       ss << "tauJetCalib" << i;
00069       ss >> str;
00070       m_tauCalibFunc.push_back(calibCoeffs.getParameter< std::vector<double> >(str));
00071     }
00072 
00073     if (m_corrFunType==L1GctJetEtCalibrationFunction::ORCA_STYLE_CORRECTION)
00074       { setOrcaStyleParams(); }
00075 
00076     if (m_corrFunType==L1GctJetEtCalibrationFunction::PIECEWISE_CUBIC_CORRECTION)
00077       { setPiecewiseCubicParams(); }
00078 
00079   } else {
00080     // No corrections to be applied
00081     m_corrFunType = L1GctJetEtCalibrationFunction::NO_CORRECTION;
00082     // Set the vector sizes to those expected by the CalibrationFunction
00083     m_jetCalibFunc.resize(L1GctJetEtCalibrationFunction::NUMBER_ETA_VALUES);
00084     m_tauCalibFunc.resize(L1GctJetEtCalibrationFunction::N_CENTRAL_ETA_VALUES);
00085     if (CalibStyle != "None") {
00086       edm::LogWarning("L1GctConfig") << "Unrecognised Calibration Style option " << CalibStyle
00087                                       << "; no Level-1 jet corrections will be applied" << std::endl;
00088     }
00089   }
00090 
00091                                  
00092 }

L1GctCalibFunConfigurer::~L1GctCalibFunConfigurer (  ) 

Definition at line 95 of file L1GctCalibFunConfigurer.cc.

00096 {
00097  
00098    // do anything here that needs to be done at desctruction time
00099    // (e.g. close files, deallocate resources etc.)
00100 
00101 }


Member Function Documentation

std::vector< double > L1GctCalibFunConfigurer::etToEnergyConversion ( const L1CaloGeometry geom  )  const [private]

Calculate Et-to-energy conversion factors for eta bins.

Definition at line 281 of file L1GctCalibFunConfigurer.cc.

References L1CaloGeometry::etaBinCenter(), funct::exp(), and HLT_VtxMuL3::result.

Referenced by produceCalibFun().

00282                                      {
00283   //  L1CaloGeometry* geom = new L1CaloGeometry();
00284   std::vector<double> result;
00285   // Factors for central eta bins
00286   for (unsigned ieta=0; ieta<7; ieta++) {
00287     double bineta = geom->etaBinCenter(ieta, true);
00288     double factor = 0.5*(exp(bineta)+exp(-bineta)); // Conversion from eta to cosec(theta)
00289     result.push_back(factor);
00290   }
00291   // Factors for forward eta bins
00292   for (unsigned ieta=0; ieta<4; ieta++) {
00293     double bineta = geom->etaBinCenter(ieta, false);
00294     double factor = 0.5*(exp(bineta)+exp(-bineta)); // Conversion from eta to cosec(theta)
00295     result.push_back(factor);
00296   }
00297   return result;
00298 }

L1GctCalibFunConfigurer::CalibFunReturnType L1GctCalibFunConfigurer::produceCalibFun ( const L1CaloGeometry geom  ) 

Definition at line 111 of file L1GctCalibFunConfigurer.cc.

References etToEnergyConversion(), m_convertToEnergy, m_corrFunType, m_htScaleLSB, m_jetCalibFunc, m_tauCalibFunc, and m_threshold.

Referenced by L1GctConfigProducers::produceCalibFun().

00112 {
00113    boost::shared_ptr<L1GctJetEtCalibrationFunction> pL1GctJetEtCalibrationFunction =
00114      boost::shared_ptr<L1GctJetEtCalibrationFunction> (new L1GctJetEtCalibrationFunction());
00115 
00116    pL1GctJetEtCalibrationFunction->setParams(m_htScaleLSB, m_threshold,
00117                                              m_jetCalibFunc,
00118                                              m_tauCalibFunc);
00119 
00120    pL1GctJetEtCalibrationFunction->setCorrectionFunctionType(m_corrFunType);
00121 
00122    if (m_convertToEnergy) {
00123      pL1GctJetEtCalibrationFunction->setConversionToEnergyOn(etToEnergyConversion(geom));
00124    }
00125 
00126    return pL1GctJetEtCalibrationFunction ;
00127 }

void L1GctCalibFunConfigurer::setOrcaStyleParams (  )  [private]

member functions to set up the ORCA-style calibrations (if needed)

Definition at line 133 of file L1GctCalibFunConfigurer.cc.

References i, m_jetCalibFunc, m_tauCalibFunc, and setOrcaStyleParamsForBin().

Referenced by L1GctCalibFunConfigurer().

00134 {
00135   for (unsigned i=0; i<m_jetCalibFunc.size(); ++i) {
00136     setOrcaStyleParamsForBin(m_jetCalibFunc.at(i));
00137   }
00138   for (unsigned i=0; i<m_tauCalibFunc.size(); ++i) {
00139     setOrcaStyleParamsForBin(m_tauCalibFunc.at(i));
00140   }
00141 }

void L1GctCalibFunConfigurer::setOrcaStyleParamsForBin ( std::vector< double > &  paramsForBin  )  [private]

Definition at line 153 of file L1GctCalibFunConfigurer.cc.

References funct::A, funct::C, g, m_threshold, funct::pow(), and funct::sqrt().

Referenced by setOrcaStyleParams().

00154 {
00155   assert (paramsForBin.size() == 4);
00156 
00157   // The threshold for using the high-energy coefficients is
00158   // Measured Et=x2; Calibrated Et=y2.
00159   // The value of x2 is supplied from the .cfi file.
00160   double x2 = paramsForBin.at(0);
00161   double A  = paramsForBin.at(1);
00162   double B  = paramsForBin.at(2);
00163   double C  = paramsForBin.at(3);
00164 
00165   double y2 = 2*(x2-A)/(B + sqrt(B*B - 4*(A-x2)*C));
00166 
00167   // The thresold for using the low-energy coefficients is
00168   // Measured Et=x1; Calibrated Et=y1.
00169   // Here we set x1=y1=zero-suppression threshold
00170   double x1 = m_threshold;
00171   double y1 = x1;
00172 
00173   // Calculate the low-energy coefficients given (x1, y1) and y2.
00174   double g = (x1 - (A + y1*(B+y1*C)))/(pow((y2-y1),2));
00175   A = A + g*y2*y2;
00176   B = B - 2.0*g*y2;
00177   C = C + g;
00178 
00179   // Add the new threshold and coefficients to the end of the list.
00180   paramsForBin.push_back(x1);
00181   paramsForBin.push_back(A);
00182   paramsForBin.push_back(B);
00183   paramsForBin.push_back(C);
00184 
00185 }

void L1GctCalibFunConfigurer::setPiecewiseCubicParams (  )  [private]

member functions to set up the piecewise cubic calibrations (if needed)

Definition at line 191 of file L1GctCalibFunConfigurer.cc.

References i, m_jetCalibFunc, m_tauCalibFunc, and setPiecewiseCubicParamsForBin().

Referenced by L1GctCalibFunConfigurer().

00192 {
00193   for (unsigned i=0; i<m_jetCalibFunc.size(); ++i) {
00194     setPiecewiseCubicParamsForBin(m_jetCalibFunc.at(i));
00195   }
00196   for (unsigned i=0; i<m_tauCalibFunc.size(); ++i) {
00197     setPiecewiseCubicParamsForBin(m_tauCalibFunc.at(i));
00198   }
00199 }

void L1GctCalibFunConfigurer::setPiecewiseCubicParamsForBin ( std::vector< double > &  paramsForBin  )  [private]

Definition at line 214 of file L1GctCalibFunConfigurer.cc.

References funct::A, funct::C, HcalDataFrameFilter_impl::check(), funct::D, p1, p2, p3, and dimuonsSequences_cff::threshold.

Referenced by setPiecewiseCubicParams().

00215 {
00216   unsigned numberOfPars   = paramsForBin.size();
00217   unsigned numberOfPieces = (numberOfPars-1)/5;
00218   // Check that we have a sensible number of parameters
00219   if ( ((numberOfPars-1) % 5) == 0) {
00220     std::vector<double>::const_iterator par = paramsForBin.begin();
00221     double etMax = *par++;
00222 
00223     // Check the parameters read from file.
00224     // Copy them into vectors for the five different parameter types.
00225     // The vectors are initialised with a size of 1, to hold the
00226     // coefficients for the extrapolation above etMax.
00227     std::vector<double> threshold(1), p0(1), p1(1), p2(1), p3(1);
00228     while (par != paramsForBin.end()) {
00229       threshold.push_back(*par++);
00230       p0.push_back(*par++);
00231       p1.push_back(*par++);
00232       p2.push_back(*par++);
00233       p3.push_back(*par++);
00234     }
00235 
00236     // Here's the extrapolation above etMax
00237     double etMaxCorr = p0.at(1) + etMax*(p1.at(1) + etMax*(p2.at(1) + etMax*p3.at(1)));
00238     threshold.at(0) = etMax;
00239     p0.at(0) = 0.0;
00240     p1.at(0) = etMaxCorr/etMax;
00241     p2.at(0) = 0.0;
00242     p3.at(0) = 0.0;
00243 
00244     // Here's the continuity check
00245     for (unsigned piece=1; piece<(numberOfPieces-1); piece++) {
00246       double et = threshold.at(piece);
00247       double A  = p0.at(piece) - p0.at(piece+1);
00248       double B  = p1.at(piece) - p1.at(piece+1);
00249       double C  = p2.at(piece) - p2.at(piece+1);
00250       double D  = p3.at(piece) - p3.at(piece+1);
00251       // Find the difference between the two pieces of the function
00252       // above and below the threshold
00253       double check = A + et*(B + et*(C + et*D));
00254       // How much discontinuity to allow? Try this ...
00255       if (fabs(check)>0.1) {
00256         edm::LogError ("L1GctConfig") << "Error reading parameters from file for piecewise cubic calibration.\n"
00257                                       << "The function is discontinuous at threshold no. " << piece
00258                                       << ", et value " << et << " GeV, by an amount " << check << " GeV"; 
00259       }
00260     }
00261 
00262     // Put the parameters back into the vector, with
00263     // the high-Et extrapolation at the beginning
00264     paramsForBin.clear();
00265     for (unsigned piece=0; piece<=numberOfPieces; piece++) {
00266       paramsForBin.push_back(threshold.at(piece));
00267       paramsForBin.push_back(p0.at(piece));
00268       paramsForBin.push_back(p1.at(piece));
00269       paramsForBin.push_back(p2.at(piece));
00270       paramsForBin.push_back(p3.at(piece));
00271     }
00272   } else {
00273     // The number of parameters is wrong
00274     edm::LogError ("L1GctConfig") << "Error reading parameters from file for piecewise cubic calibration.\n"
00275                                   << "The number of parameters is "
00276                                   << numberOfPars << ", but we need five parameters per piece, plus one";
00277   }
00278 }


Member Data Documentation

bool L1GctCalibFunConfigurer::m_convertToEnergy [private]

Option to convert Et back to energy for special trigger configurations.

Definition at line 58 of file L1GctCalibFunConfigurer.h.

Referenced by produceCalibFun().

L1GctJetEtCalibrationFunction::CorrectionFunctionType L1GctCalibFunConfigurer::m_corrFunType [private]

type of correction function to apply

Definition at line 65 of file L1GctCalibFunConfigurer.h.

Referenced by L1GctCalibFunConfigurer(), and produceCalibFun().

double L1GctCalibFunConfigurer::m_htScaleLSB [private]

scale and threshold parameters

Definition at line 54 of file L1GctCalibFunConfigurer.h.

Referenced by produceCalibFun().

std::vector< std::vector<double> > L1GctCalibFunConfigurer::m_jetCalibFunc [private]

the calibration function - converts jet Et to linear

Definition at line 61 of file L1GctCalibFunConfigurer.h.

Referenced by L1GctCalibFunConfigurer(), produceCalibFun(), setOrcaStyleParams(), and setPiecewiseCubicParams().

std::vector< std::vector<double> > L1GctCalibFunConfigurer::m_tauCalibFunc [private]

Definition at line 62 of file L1GctCalibFunConfigurer.h.

Referenced by L1GctCalibFunConfigurer(), produceCalibFun(), setOrcaStyleParams(), and setPiecewiseCubicParams().

double L1GctCalibFunConfigurer::m_threshold [private]

Definition at line 55 of file L1GctCalibFunConfigurer.h.

Referenced by produceCalibFun(), and setOrcaStyleParamsForBin().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:26:28 2009 for CMSSW by  doxygen 1.5.4