CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Types | Public Member Functions | Private Member Functions | Private Attributes
FactorizedJetCorrectorCalculator Class Reference

#include <FactorizedJetCorrectorCalculator.h>

Classes

class  VariableValues
 

Public Types

enum  LevelTypes {
  kL1, kL2, kL3, kL4,
  kL5, kL6, kL7, kL1fj,
  kL1JPT
}
 
enum  VarTypes {
  kJetPt, kJetEta, kJetPhi, kJetE,
  kJetEMF, kRelLepPt, kPtRel, kNPV,
  kJetA, kRho, kJPTrawE, kJPTrawEt,
  kJPTrawPt, kJPTrawEta, kJPTrawOff
}
 

Public Member Functions

 FactorizedJetCorrectorCalculator ()
 
 FactorizedJetCorrectorCalculator (const std::string &fLevels, const std::string &fTags, const std::string &fOptions="")
 
 FactorizedJetCorrectorCalculator (const std::vector< JetCorrectorParameters > &fParameters)
 
float getCorrection (VariableValues &) const
 
std::vector< float > getSubCorrections (VariableValues &) const
 
 ~FactorizedJetCorrectorCalculator ()
 

Private Member Functions

void checkConsistency (const std::vector< std::string > &fLevels, const std::vector< std::string > &fTags)
 
 FactorizedJetCorrectorCalculator (const FactorizedJetCorrectorCalculator &)
 
std::vector< float > fillVector (const std::vector< VarTypes > &fVarTypes, const VariableValues &) const
 
float getLepPt (const VariableValues &) const
 
float getPtRel (const VariableValues &) const
 
float getRelLepPt (const VariableValues &) const
 
void initCorrectors (const std::string &fLevels, const std::string &fFiles, const std::string &fOptions)
 
std::vector< VarTypesmapping (const std::vector< std::string > &fNames) const
 
FactorizedJetCorrectorCalculatoroperator= (const FactorizedJetCorrectorCalculator &)
 
std::vector< std::string > parseLevels (const std::string &ss) const
 
std::string parseOption (const std::string &ss, const std::string &type) const
 
std::string removeSpaces (const std::string &ss) const
 

Private Attributes

std::vector< std::vector
< VarTypes > > 
mBinTypes
 
std::vector
< SimpleJetCorrector const * > 
mCorrectors
 
std::vector< LevelTypesmLevels
 
std::vector< std::vector
< VarTypes > > 
mParTypes
 

Detailed Description

Definition at line 17 of file FactorizedJetCorrectorCalculator.h.

Member Enumeration Documentation

Enumerator
kJetPt 
kJetEta 
kJetPhi 
kJetE 
kJetEMF 
kRelLepPt 
kPtRel 
kNPV 
kJetA 
kRho 
kJPTrawE 
kJPTrawEt 
kJPTrawPt 
kJPTrawEta 
kJPTrawOff 

Definition at line 78 of file FactorizedJetCorrectorCalculator.h.

Constructor & Destructor Documentation

FactorizedJetCorrectorCalculator::FactorizedJetCorrectorCalculator ( )

Definition at line 20 of file FactorizedJetCorrectorCalculator.cc.

21 {
22 }
FactorizedJetCorrectorCalculator::FactorizedJetCorrectorCalculator ( const std::string &  fLevels,
const std::string &  fTags,
const std::string &  fOptions = "" 
)

Definition at line 26 of file FactorizedJetCorrectorCalculator.cc.

References initCorrectors().

27 {
28  initCorrectors(fLevels, fFiles, fOptions);
29 }
void initCorrectors(const std::string &fLevels, const std::string &fFiles, const std::string &fOptions)
FactorizedJetCorrectorCalculator::FactorizedJetCorrectorCalculator ( const std::vector< JetCorrectorParameters > &  fParameters)

Definition at line 33 of file FactorizedJetCorrectorCalculator.cc.

References i, kL1, kL1fj, kL1JPT, kL2, kL3, kL4, kL5, kL6, kL7, mapping(), mBinTypes, mCorrectors, mLevels, mParTypes, Parameters::parameters, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

34 {
35  for(unsigned i=0;i<fParameters.size();i++) {
36  std::string ss = fParameters[i].definitions().level();
37  if (ss == "L1Offset")
38  mLevels.push_back(kL1);
39  else if (ss == "L1JPTOffset")
40  mLevels.push_back(kL1JPT);
41  else if (ss == "L2Relative")
42  mLevels.push_back(kL2);
43  else if (ss == "L3Absolute")
44  mLevels.push_back(kL3);
45  else if (ss == "L4EMF")
46  mLevels.push_back(kL4);
47  else if (ss == "L5Flavor")
48  mLevels.push_back(kL5);
49  else if (ss == "L6SLB")
50  mLevels.push_back(kL6);
51  else if (ss == "L7Parton")
52  mLevels.push_back(kL7);
53  else if (ss == "L1FastJet")
54  mLevels.push_back(kL1fj);
55  mCorrectors.push_back(new SimpleJetCorrector(fParameters[i]));
56  mBinTypes.push_back(mapping(mCorrectors[i]->parameters().definitions().binVar()));
57  mParTypes.push_back(mapping(mCorrectors[i]->parameters().definitions().parVar()));
58  }
59 }
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
std::vector< std::vector< VarTypes > > mParTypes
std::vector< std::vector< VarTypes > > mBinTypes
std::vector< VarTypes > mapping(const std::vector< std::string > &fNames) const
std::vector< SimpleJetCorrector const * > mCorrectors
FactorizedJetCorrectorCalculator::~FactorizedJetCorrectorCalculator ( )

Definition at line 64 of file FactorizedJetCorrectorCalculator.cc.

References i, and mCorrectors.

65 {
66  for(unsigned i=0;i<mCorrectors.size();i++)
67  delete mCorrectors[i];
68 }
int i
Definition: DBlmapReader.cc:9
std::vector< SimpleJetCorrector const * > mCorrectors
FactorizedJetCorrectorCalculator::FactorizedJetCorrectorCalculator ( const FactorizedJetCorrectorCalculator )
private

Member Function Documentation

void FactorizedJetCorrectorCalculator::checkConsistency ( const std::vector< std::string > &  fLevels,
const std::vector< std::string > &  fTags 
)
private

Definition at line 178 of file FactorizedJetCorrectorCalculator.cc.

References i.

Referenced by initCorrectors().

179 {
180  //---- First check: the number of tags must be equal to the number of sub-corrections.
181  if (fLevels.size() != fTags.size()) {
182  std::stringstream sserr;
183  sserr<<"number of correction levels: "<<fLevels.size()<<" doesn't match # of tags: "<<fTags.size();
184  handleError("FactorizedJetCorrectorCalculator",sserr.str());
185  }
186  //---- Second check: each tag must contain the corresponding sub-correction level.
187  for(unsigned int i=0;i<fTags.size();i++) {
188  if ((int)fTags[i].find(fLevels[i])<0) {
189  std::stringstream sserr;
190  sserr<<"inconsistent tag: "<<fTags[i]<<" for "<<"the requested correction: "<<fLevels[i];
191  handleError("FactorizedJetCorrectorCalculator",sserr.str());
192  }
193  }
194 }
int i
Definition: DBlmapReader.cc:9
std::vector< float > FactorizedJetCorrectorCalculator::fillVector ( const std::vector< VarTypes > &  fVarTypes,
const VariableValues iValues 
) const
private

Definition at line 308 of file FactorizedJetCorrectorCalculator.cc.

References getPtRel(), getRelLepPt(), i, kJetA, kJetE, kJetEMF, kJetEta, kJetPhi, kJetPt, kJPTrawE, kJPTrawEt, kJPTrawEta, kJPTrawOff, kJPTrawPt, kNPV, kPtRel, kRelLepPt, kRho, FactorizedJetCorrectorCalculator::VariableValues::mIsAddLepToJetset, FactorizedJetCorrectorCalculator::VariableValues::mIsJetAset, FactorizedJetCorrectorCalculator::VariableValues::mIsJetEMFset, FactorizedJetCorrectorCalculator::VariableValues::mIsJetEset, FactorizedJetCorrectorCalculator::VariableValues::mIsJetEtaset, FactorizedJetCorrectorCalculator::VariableValues::mIsJetPhiset, FactorizedJetCorrectorCalculator::VariableValues::mIsJetPtset, FactorizedJetCorrectorCalculator::VariableValues::mIsJPTrawOFFset, FactorizedJetCorrectorCalculator::VariableValues::mIsJPTrawP4set, FactorizedJetCorrectorCalculator::VariableValues::mIsLepPxset, FactorizedJetCorrectorCalculator::VariableValues::mIsLepPyset, FactorizedJetCorrectorCalculator::VariableValues::mIsLepPzset, FactorizedJetCorrectorCalculator::VariableValues::mIsNPVset, FactorizedJetCorrectorCalculator::VariableValues::mIsRhoset, FactorizedJetCorrectorCalculator::VariableValues::mJetA, FactorizedJetCorrectorCalculator::VariableValues::mJetE, FactorizedJetCorrectorCalculator::VariableValues::mJetEMF, FactorizedJetCorrectorCalculator::VariableValues::mJetEta, FactorizedJetCorrectorCalculator::VariableValues::mJetPhi, FactorizedJetCorrectorCalculator::VariableValues::mJetPt, FactorizedJetCorrectorCalculator::VariableValues::mJPTrawE, FactorizedJetCorrectorCalculator::VariableValues::mJPTrawEt, FactorizedJetCorrectorCalculator::VariableValues::mJPTrawEta, FactorizedJetCorrectorCalculator::VariableValues::mJPTrawOff, FactorizedJetCorrectorCalculator::VariableValues::mJPTrawPt, FactorizedJetCorrectorCalculator::VariableValues::mNPV, FactorizedJetCorrectorCalculator::VariableValues::mRho, and query::result.

Referenced by getSubCorrections().

310 {
311 // std::vector<VarTypes> fVarTypes = _fVarTypes;
312  std::vector<float> result;
313  for(unsigned i=0;i<fVarTypes.size();i++) {
314  if (fVarTypes[i] == kJetEta) {
315  if (!iValues.mIsJetEtaset)
316  handleError("FactorizedJetCorrectorCalculator","jet eta is not set");
317  result.push_back(iValues.mJetEta);
318  }
319  else if (fVarTypes[i] == kNPV) {
320  if (!iValues.mIsNPVset)
321  handleError("FactorizedJetCorrectorCalculator","number of primary vertices is not set");
322  result.push_back(iValues.mNPV);
323  }
324  else if (fVarTypes[i] == kJetPt) {
325  if (!iValues.mIsJetPtset)
326  handleError("FactorizedJetCorrectorCalculator","jet pt is not set");
327  result.push_back(iValues.mJetPt);
328  }
329  else if (fVarTypes[i] == kJetPhi) {
330  if (!iValues.mIsJetPhiset)
331  handleError("FactorizedJetCorrectorCalculator","jet phi is not set");
332  result.push_back(iValues.mJetPhi);
333  }
334  else if (fVarTypes[i] == kJetE) {
335  if (!iValues.mIsJetEset)
336  handleError("FactorizedJetCorrectorCalculator","jet E is not set");
337  result.push_back(iValues.mJetE);
338  }
339  else if (fVarTypes[i] == kJetEMF) {
340  if (!iValues.mIsJetEMFset)
341  handleError("FactorizedJetCorrectorCalculator","jet EMF is not set");
342  result.push_back(iValues.mJetEMF);
343  }
344  else if (fVarTypes[i] == kJetA) {
345  if (!iValues.mIsJetAset)
346  handleError("FactorizedJetCorrectorCalculator","jet area is not set");
347  result.push_back(iValues.mJetA);
348  }
349  else if (fVarTypes[i] == kRho) {
350  if (!iValues.mIsRhoset)
351  handleError("FactorizedJetCorrectorCalculator","fastjet density Rho is not set");
352  result.push_back(iValues.mRho);
353  }
354  else if (fVarTypes[i] == kJPTrawE) {
355  if (!iValues.mIsJPTrawP4set)
356  handleError("FactorizedJetCorrectorCalculator","raw CaloJet P4 for JPT is not set");
357  result.push_back(iValues.mJPTrawE);
358  }
359  else if (fVarTypes[i] == kJPTrawEt) {
360  if (!iValues.mIsJPTrawP4set)
361  handleError("FactorizedJetCorrectorCalculator","raw CaloJet P4 for JPT is not set");
362  result.push_back(iValues.mJPTrawEt);
363  }
364  else if (fVarTypes[i] == kJPTrawPt) {
365  if (!iValues.mIsJPTrawP4set)
366  handleError("FactorizedJetCorrectorCalculator","raw CaloJet P4 for JPT is not set");
367  result.push_back(iValues.mJPTrawPt);
368  }
369  else if (fVarTypes[i] == kJPTrawEta) {
370  if (!iValues.mIsJPTrawP4set)
371  handleError("FactorizedJetCorrectorCalculator","raw CaloJet P4 for JPT is not set");
372  result.push_back(iValues.mJPTrawEta);
373  }
374  else if (fVarTypes[i] == kJPTrawOff) {
375  if (!iValues.mIsJPTrawOFFset)
376  handleError("FactorizedJetCorrectorCalculator","Offset correction for JPT is not set");
377  result.push_back(iValues.mJPTrawOff);
378  }
379  else if (fVarTypes[i] == kRelLepPt) {
380  if (!iValues.mIsJetPtset||!iValues.mIsAddLepToJetset||!iValues.mIsLepPxset||!iValues.mIsLepPyset)
381  handleError("FactorizedJetCorrectorCalculator","can't calculate rel lepton pt");
382  result.push_back(getRelLepPt(iValues));
383  }
384  else if (fVarTypes[i] == kPtRel) {
385  if (!iValues.mIsJetPtset||!iValues.mIsJetEtaset||!iValues.mIsJetPhiset||!iValues.mIsJetEset||!iValues.mIsAddLepToJetset||!iValues.mIsLepPxset||!iValues.mIsLepPyset||!iValues.mIsLepPzset)
386  handleError("FactorizedJetCorrectorCalculator","can't calculate ptrel");
387  result.push_back(getPtRel(iValues));
388  }
389  else {
390  std::stringstream sserr;
391  sserr<<"unknown parameter "<<fVarTypes[i];
392  handleError("FactorizedJetCorrectorCalculator",sserr.str());
393  }
394  }
395  return result;
396 }
int i
Definition: DBlmapReader.cc:9
float getRelLepPt(const VariableValues &) const
tuple result
Definition: query.py:137
float getPtRel(const VariableValues &) const
float FactorizedJetCorrectorCalculator::getCorrection ( FactorizedJetCorrectorCalculator::VariableValues iValues) const

Definition at line 265 of file FactorizedJetCorrectorCalculator.cc.

References getSubCorrections().

Referenced by JetReCalibrator.JetReCalibrator::correct(), L1FastjetCorrector::correction(), L6SLBCorrector::correction(), and FactorizedJetCorrector::getCorrection().

266 {
267  std::vector<float> && vv = getSubCorrections(iValues);
268  return vv.back();
269 }
std::vector< float > getSubCorrections(VariableValues &) const
float FactorizedJetCorrectorCalculator::getLepPt ( const VariableValues iValues) const
private

Definition at line 400 of file FactorizedJetCorrectorCalculator.cc.

References FactorizedJetCorrectorCalculator::VariableValues::mLepPx, FactorizedJetCorrectorCalculator::VariableValues::mLepPy, and mathSSE::sqrt().

Referenced by getRelLepPt(), and getSubCorrections().

401 {
402  return std::sqrt(iValues.mLepPx*iValues.mLepPx + iValues.mLepPy*iValues.mLepPy);
403 }
T sqrt(T t)
Definition: SSEVec.h:48
float FactorizedJetCorrectorCalculator::getPtRel ( const VariableValues iValues) const
private

Definition at line 415 of file FactorizedJetCorrectorCalculator.cc.

References metsig::jet, RazorAnalyzer::lep2, FactorizedJetCorrectorCalculator::VariableValues::mAddLepToJet, FactorizedJetCorrectorCalculator::VariableValues::mJetE, FactorizedJetCorrectorCalculator::VariableValues::mJetEta, FactorizedJetCorrectorCalculator::VariableValues::mJetPhi, FactorizedJetCorrectorCalculator::VariableValues::mJetPt, FactorizedJetCorrectorCalculator::VariableValues::mLepPx, FactorizedJetCorrectorCalculator::VariableValues::mLepPy, FactorizedJetCorrectorCalculator::VariableValues::mLepPz, and mathSSE::sqrt().

Referenced by fillVector().

416 {
417  typedef ROOT::Math::LorentzVector<ROOT::Math::PtEtaPhiE4D<float> >
419  typedef ROOT::Math::DisplacementVector3D<ROOT::Math::Cartesian3D<float> >
420  XYZVector;
421  PtEtaPhiELorentzVector jet;
422  XYZVector lep;
423  jet.SetPt(iValues.mJetPt);
424  jet.SetEta(iValues.mJetEta);
425  jet.SetPhi(iValues.mJetPhi);
426  jet.SetE(iValues.mJetE);
427  lep.SetXYZ(iValues.mLepPx,iValues.mLepPy,iValues.mLepPz);
428  float lj_x = (iValues.mAddLepToJet) ? lep.X()+jet.Px() : jet.Px();
429  float lj_y = (iValues.mAddLepToJet) ? lep.Y()+jet.Py() : jet.Py();
430  float lj_z = (iValues.mAddLepToJet) ? lep.Z()+jet.Pz() : jet.Pz();
431  // absolute values squared
432  float lj2 = lj_x*lj_x+lj_y*lj_y+lj_z*lj_z;
433  if (lj2<=0) {
434  std::stringstream sserr;
435  sserr<<"lepton+jet momentum sq is not positive: "<<lj2;
436  handleError("FactorizedJetCorrectorCalculator",sserr.str());
437  }
438  float lep2 = lep.X()*lep.X()+lep.Y()*lep.Y()+lep.Z()*lep.Z();
439  // projection vec(mu) to lepjet axis
440  float lepXlj = lep.X()*lj_x+lep.Y()*lj_y+lep.Z()*lj_z;
441  // absolute value squared and normalized
442  float pLrel2 = lepXlj*lepXlj/lj2;
443  // lep2 = pTrel2 + pLrel2
444  float pTrel2 = lep2-pLrel2;
445  return (pTrel2 > 0) ? std::sqrt(pTrel2) : 0.0;
446 }
T sqrt(T t)
Definition: SSEVec.h:48
PtEtaPhiELorentzVectorD PtEtaPhiELorentzVector
Lorentz vector with cartesian internal representation.
Definition: LorentzVector.h:27
XYZVectorD XYZVector
spatial vector with cartesian internal representation
Definition: Vector3D.h:30
float FactorizedJetCorrectorCalculator::getRelLepPt ( const VariableValues iValues) const
private

Definition at line 407 of file FactorizedJetCorrectorCalculator.cc.

References getLepPt(), FactorizedJetCorrectorCalculator::VariableValues::mAddLepToJet, and FactorizedJetCorrectorCalculator::VariableValues::mJetPt.

Referenced by fillVector().

408 {
409  float lepPt = getLepPt(iValues);
410  return (iValues.mAddLepToJet) ? lepPt/(iValues.mJetPt + lepPt) : lepPt/iValues.mJetPt;
411 }
float getLepPt(const VariableValues &) const
std::vector< float > FactorizedJetCorrectorCalculator::getSubCorrections ( FactorizedJetCorrectorCalculator::VariableValues iValues) const

Definition at line 273 of file FactorizedJetCorrectorCalculator.cc.

References fillVector(), getLepPt(), i, kL1, kL1fj, kL6, FactorizedJetCorrectorCalculator::VariableValues::mAddLepToJet, mBinTypes, mCorrectors, FactorizedJetCorrectorCalculator::VariableValues::mIsJPTrawOFFset, FactorizedJetCorrectorCalculator::VariableValues::mIsJPTrawP4set, FactorizedJetCorrectorCalculator::VariableValues::mJetE, FactorizedJetCorrectorCalculator::VariableValues::mJetPt, mLevels, mParTypes, FactorizedJetCorrectorCalculator::VariableValues::reset(), pileupReCalc_HLTpaths::scale, and FactorizedJetCorrectorCalculator::VariableValues::setJPTrawOff().

Referenced by getCorrection(), and FactorizedJetCorrector::getSubCorrections().

274 {
275  float scale,factor;
276  std::vector<float> factors;
277  std::vector<float> vx,vy;
278  factor = 1;
279  for(unsigned int i=0;i<mLevels.size();i++) {
280  vx = fillVector(mBinTypes[i],iValues);
281  vy = fillVector(mParTypes[i],iValues);
282  //if (mLevels[i]==kL2 || mLevels[i]==kL6)
283  //mCorrectors[i]->setInterpolation(true);
284  scale = mCorrectors[i]->correction(vx,vy);
285  //----- For JPT jets, the offset is stored in order to be used later by the the L1JPTOffset
286  if ((mLevels[i]==kL1 || mLevels[i]==kL1fj) && iValues.mIsJPTrawP4set && !iValues.mIsJPTrawOFFset) {
287  iValues.setJPTrawOff(scale);
288  }
289  else if (mLevels[i]==kL6 && iValues.mAddLepToJet) {
290  scale *= 1.0 + getLepPt(iValues) / iValues.mJetPt;
291  iValues.mJetE *= scale;
292  iValues.mJetPt *= scale;
293  factor *= scale;
294  }
295  else {
296  iValues.mJetE *= scale;
297  iValues.mJetPt *= scale;
298  factor *= scale;
299  }
300  factors.push_back(factor);
301  }
302  iValues.reset();
303  return factors;
304 }
int i
Definition: DBlmapReader.cc:9
float getLepPt(const VariableValues &) const
std::vector< float > fillVector(const std::vector< VarTypes > &fVarTypes, const VariableValues &) const
std::vector< std::vector< VarTypes > > mParTypes
std::vector< std::vector< VarTypes > > mBinTypes
std::vector< SimpleJetCorrector const * > mCorrectors
void FactorizedJetCorrectorCalculator::initCorrectors ( const std::string &  fLevels,
const std::string &  fFiles,
const std::string &  fOptions 
)
private

Definition at line 72 of file FactorizedJetCorrectorCalculator.cc.

References checkConsistency(), i, kL1, kL1fj, kL1JPT, kL2, kL3, kL4, kL5, kL6, kL7, mapping(), mBinTypes, mCorrectors, mLevels, mParTypes, Parameters::parameters, parseLevels(), parseOption(), removeSpaces(), AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

Referenced by FactorizedJetCorrectorCalculator().

73 {
74  //---- Read the CorrectionLevels string and parse the requested sub-correction levels.
75  std::vector<std::string> tmp = parseLevels(removeSpaces(fLevels));
76  for(unsigned i=0;i<tmp.size();i++) {
77  if (tmp[i] == "L1Offset")
78  mLevels.push_back(kL1);
79  else if (tmp[i] == "L1JPTOffset")
80  mLevels.push_back(kL1JPT);
81  else if (tmp[i] == "L2Relative")
82  mLevels.push_back(kL2);
83  else if (tmp[i] == "L3Absolute")
84  mLevels.push_back(kL3);
85  else if (tmp[i] == "L4EMF")
86  mLevels.push_back(kL4);
87  else if (tmp[i] == "L5Flavor")
88  mLevels.push_back(kL5);
89  else if (tmp[i] == "L6SLB")
90  mLevels.push_back(kL6);
91  else if (tmp[i] == "L7Parton")
92  mLevels.push_back(kL7);
93  else if (tmp[i] == "L1FastJet")
94  mLevels.push_back(kL1fj);
95  else {
96  std::stringstream sserr;
97  sserr<<"unknown correction level "<<tmp[i];
98  handleError("FactorizedJetCorrectorCalculator",sserr.str());
99  }
100  }
101  //---- Read the parameter filenames string and parse the requested sub-correction tags.
102  std::vector<std::string> Files = parseLevels(removeSpaces(fFiles));
103  //---- Read the Options string and define the FlavorOption and PartonOption.
104  std::string FlavorOption = parseOption(removeSpaces(fOptions),"L5Flavor");
105  std::string PartonOption = parseOption(removeSpaces(fOptions),"L7Parton");
106  //---- Check the consistency between tags and requested sub-corrections.
107  checkConsistency(tmp,Files);
108  //---- Create instances of the requested sub-correctors.
109  for(unsigned i=0;i<mLevels.size();i++) {
111  mCorrectors.push_back(new SimpleJetCorrector(Files[i]));
112  else if (mLevels[i]==kL5 && FlavorOption.length()==0)
113  handleError("FactorizedJetCorrectorCalculator","must specify flavor option when requesting L5Flavor correction!");
114  else if (mLevels[i]==kL5 && FlavorOption.length()>0)
115  mCorrectors.push_back(new SimpleJetCorrector(Files[i],FlavorOption));
116  else if (mLevels[i]==kL7 && PartonOption.length()==0)
117  handleError("FactorizedJetCorrectorCalculator","must specify parton option when requesting L7Parton correction!");
118  else if (mLevels[i]==kL7 && PartonOption.length()>0)
119  mCorrectors.push_back(new SimpleJetCorrector(Files[i],PartonOption));
120  else {
121  std::stringstream sserr;
122  sserr<<"unknown correction level "<<tmp[i];
123  handleError("FactorizedJetCorrectorCalculator",sserr.str());
124  }
125  mBinTypes.push_back(mapping(mCorrectors[i]->parameters().definitions().binVar()));
126  mParTypes.push_back(mapping(mCorrectors[i]->parameters().definitions().parVar()));
127  }
128 }
int i
Definition: DBlmapReader.cc:9
dictionary parameters
Definition: Parameters.py:2
void checkConsistency(const std::vector< std::string > &fLevels, const std::vector< std::string > &fTags)
std::vector< std::vector< VarTypes > > mParTypes
std::vector< std::vector< VarTypes > > mBinTypes
std::vector< VarTypes > mapping(const std::vector< std::string > &fNames) const
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::string parseOption(const std::string &ss, const std::string &type) const
std::string removeSpaces(const std::string &ss) const
std::vector< SimpleJetCorrector const * > mCorrectors
std::vector< std::string > parseLevels(const std::string &ss) const
std::vector< FactorizedJetCorrectorCalculator::VarTypes > FactorizedJetCorrectorCalculator::mapping ( const std::vector< std::string > &  fNames) const
private

Definition at line 132 of file FactorizedJetCorrectorCalculator.cc.

References i, kJetA, kJetE, kJetEMF, kJetEta, kJetPhi, kJetPt, kJPTrawE, kJPTrawEt, kJPTrawEta, kJPTrawOff, kJPTrawPt, kNPV, kPtRel, kRelLepPt, kRho, query::result, contentValuesCheck::ss, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FactorizedJetCorrectorCalculator(), and initCorrectors().

133 {
134  std::vector<VarTypes> result;
135  for(unsigned i=0;i<fNames.size();i++) {
136  std::string ss = fNames[i];
137  if (ss=="JetPt")
138  result.push_back(kJetPt);
139  else if (ss=="JetEta")
140  result.push_back(kJetEta);
141  else if (ss=="JetPhi")
142  result.push_back(kJetPhi);
143  else if (ss=="JetE")
144  result.push_back(kJetE);
145  else if (ss=="JetEMF")
146  result.push_back(kJetEMF);
147  else if (ss=="RelLepPt")
148  result.push_back(kRelLepPt);
149  else if (ss=="PtRel")
150  result.push_back(kPtRel);
151  else if (ss=="NPV")
152  result.push_back(kNPV);
153  else if (ss=="JetA")
154  result.push_back(kJetA);
155  else if (ss=="Rho")
156  result.push_back(kRho);
157  else if (ss=="JPTrawE")
158  result.push_back(kJPTrawE);
159  else if (ss=="JPTrawEt")
160  result.push_back(kJPTrawEt);
161  else if (ss=="JPTrawPt")
162  result.push_back(kJPTrawPt);
163  else if (ss=="JPTrawEta")
164  result.push_back(kJPTrawEta);
165  else if (ss=="JPTrawOff")
166  result.push_back(kJPTrawOff);
167  else {
168  std::stringstream sserr;
169  sserr<<"unknown parameter name: "<<ss;
170  handleError("FactorizedJetCorrectorCalculator",sserr.str());
171  }
172  }
173  return result;
174 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
FactorizedJetCorrectorCalculator& FactorizedJetCorrectorCalculator::operator= ( const FactorizedJetCorrectorCalculator )
private
std::vector< std::string > FactorizedJetCorrectorCalculator::parseLevels ( const std::string &  ss) const
private

Definition at line 198 of file FactorizedJetCorrectorCalculator.cc.

References i, j, query::result, AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

Referenced by initCorrectors().

199 {
200  std::vector<std::string> result;
201  unsigned int pos(0),j,newPos;
202  int i;
204  //---- The ss string must be of the form: "LX:LY:...:LZ"
205  while (pos<ss.length()) {
206  tmp = "";
207  i = ss.find(":" , pos);
208  if (i<0 && pos==0) {
209  result.push_back(ss);
210  pos = ss.length();
211  }
212  else if (i<0 && pos>0) {
213  for(j=pos;j<ss.length();j++)
214  tmp+=ss[j];
215  result.push_back(tmp);
216  pos = ss.length();
217  }
218  else {
219  newPos = i;
220  for(j=pos;j<newPos;j++)
221  tmp+=ss[j];
222  result.push_back(tmp);
223  pos = newPos+1;
224  }
225  }
226  return result;
227 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137
int j
Definition: DBlmapReader.cc:9
std::vector< std::vector< double > > tmp
Definition: MVATrainer.cc:100
std::string FactorizedJetCorrectorCalculator::parseOption ( const std::string &  ss,
const std::string &  type 
) const
private

Definition at line 231 of file FactorizedJetCorrectorCalculator.cc.

References query::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by initCorrectors().

232 {
234  int pos1(-1),pos2(-1);
235  //---- The ss string must be of the form: "type1:option1&type2:option2&..."
236  pos1 = ss.find(type+":");
237  if (pos1<0)
238  result = "";
239  else {
240  pos2 = ss.find("&",pos1+type.length()+1);
241  if (pos2<0)
242  result = ss.substr(pos1+type.length()+1,ss.length()-pos1-type.length()-1);
243  else
244  result = ss.substr(pos1+type.length()+1,pos2-pos1-type.length()-1);
245  }
246  return result;
247 }
type
Definition: HCALResponse.h:21
tuple result
Definition: query.py:137
std::string FactorizedJetCorrectorCalculator::removeSpaces ( const std::string &  ss) const
private

Definition at line 251 of file FactorizedJetCorrectorCalculator.cc.

References i, query::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by initCorrectors().

252 {
253  std::string result("");
254  std::string aChar;
255  for(unsigned int i=0;i<ss.length();i++) {
256  aChar = ss.substr(i,1);
257  if (aChar != " ")
258  result+=aChar;
259  }
260  return result;
261 }
int i
Definition: DBlmapReader.cc:9
tuple result
Definition: query.py:137

Member Data Documentation

std::vector<std::vector<VarTypes> > FactorizedJetCorrectorCalculator::mBinTypes
private
std::vector<SimpleJetCorrector const*> FactorizedJetCorrectorCalculator::mCorrectors
private
std::vector<LevelTypes> FactorizedJetCorrectorCalculator::mLevels
private
std::vector<std::vector<VarTypes> > FactorizedJetCorrectorCalculator::mParTypes
private