CMS 3D CMS Logo

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, kL2L3Res
}
 
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 &)=delete
 
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 &)=delete
 
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 mps_fire::i, kL1, kL1fj, kL1JPT, kL2, kL2L3Res, kL3, kL4, kL5, kL6, kL7, mapping(), mBinTypes, mCorrectors, mLevels, mParTypes, 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 == "L2L3Residual")
46  mLevels.push_back(kL2L3Res);
47  else if (ss == "L4EMF")
48  mLevels.push_back(kL4);
49  else if (ss == "L5Flavor")
50  mLevels.push_back(kL5);
51  else if (ss == "L6SLB")
52  mLevels.push_back(kL6);
53  else if (ss == "L7Parton")
54  mLevels.push_back(kL7);
55  else if (ss == "L1FastJet")
56  mLevels.push_back(kL1fj);
57  else {
58  std::stringstream sserr;
59  sserr<<"unknown correction level "<<ss;
60  handleError("FactorizedJetCorrectorCalculator",sserr.str());
61  }
62  mCorrectors.push_back(new SimpleJetCorrector(fParameters[i]));
63  mBinTypes.push_back(mapping(mCorrectors[i]->parameters().definitions().binVar()));
64  mParTypes.push_back(mapping(mCorrectors[i]->parameters().definitions().parVar()));
65  }
66 }
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 71 of file FactorizedJetCorrectorCalculator.cc.

References mps_fire::i, and mCorrectors.

72 {
73  for(unsigned i=0;i<mCorrectors.size();i++)
74  delete mCorrectors[i];
75 }
std::vector< SimpleJetCorrector const * > mCorrectors
FactorizedJetCorrectorCalculator::FactorizedJetCorrectorCalculator ( const FactorizedJetCorrectorCalculator )
privatedelete

Member Function Documentation

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

Definition at line 187 of file FactorizedJetCorrectorCalculator.cc.

References mps_fire::i.

Referenced by initCorrectors().

188 {
189  //---- First check: the number of tags must be equal to the number of sub-corrections.
190  if (fLevels.size() != fTags.size()) {
191  std::stringstream sserr;
192  sserr<<"number of correction levels: "<<fLevels.size()<<" doesn't match # of tags: "<<fTags.size();
193  handleError("FactorizedJetCorrectorCalculator",sserr.str());
194  }
195  //---- Second check: each tag must contain the corresponding sub-correction level.
196  for(unsigned int i=0;i<fTags.size();i++) {
197  if ((int)fTags[i].find(fLevels[i])<0) {
198  std::stringstream sserr;
199  sserr<<"inconsistent tag: "<<fTags[i]<<" for "<<"the requested correction: "<<fLevels[i];
200  handleError("FactorizedJetCorrectorCalculator",sserr.str());
201  }
202  }
203 }
std::vector< float > FactorizedJetCorrectorCalculator::fillVector ( const std::vector< VarTypes > &  fVarTypes,
const VariableValues iValues 
) const
private

Definition at line 317 of file FactorizedJetCorrectorCalculator.cc.

References getPtRel(), getRelLepPt(), mps_fire::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 mps_fire::result.

Referenced by getSubCorrections().

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

Definition at line 274 of file FactorizedJetCorrectorCalculator.cc.

References getSubCorrections().

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

275 {
276  std::vector<float> && vv = getSubCorrections(iValues);
277  return vv.back();
278 }
std::vector< float > getSubCorrections(VariableValues &) const
float FactorizedJetCorrectorCalculator::getLepPt ( const VariableValues iValues) const
private

Definition at line 409 of file FactorizedJetCorrectorCalculator.cc.

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

Referenced by getRelLepPt(), and getSubCorrections().

410 {
411  return std::sqrt(iValues.mLepPx*iValues.mLepPx + iValues.mLepPy*iValues.mLepPy);
412 }
T sqrt(T t)
Definition: SSEVec.h:18
float FactorizedJetCorrectorCalculator::getPtRel ( const VariableValues iValues) const
private

Definition at line 424 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().

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

Definition at line 416 of file FactorizedJetCorrectorCalculator.cc.

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

Referenced by fillVector().

417 {
418  float lepPt = getLepPt(iValues);
419  return (iValues.mAddLepToJet) ? lepPt/(iValues.mJetPt + lepPt) : lepPt/iValues.mJetPt;
420 }
float getLepPt(const VariableValues &) const
std::vector< float > FactorizedJetCorrectorCalculator::getSubCorrections ( FactorizedJetCorrectorCalculator::VariableValues iValues) const

Definition at line 282 of file FactorizedJetCorrectorCalculator.cc.

References fillVector(), getLepPt(), mps_fire::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(), Scenarios_cff::scale, and FactorizedJetCorrectorCalculator::VariableValues::setJPTrawOff().

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

283 {
284  float scale,factor;
285  std::vector<float> factors;
286  std::vector<float> vx,vy;
287  factor = 1;
288  for(unsigned int i=0;i<mLevels.size();i++) {
289  vx = fillVector(mBinTypes[i],iValues);
290  vy = fillVector(mParTypes[i],iValues);
291  //if (mLevels[i]==kL2 || mLevels[i]==kL6)
292  //mCorrectors[i]->setInterpolation(true);
293  scale = mCorrectors[i]->correction(vx,vy);
294  //----- For JPT jets, the offset is stored in order to be used later by the the L1JPTOffset
295  if ((mLevels[i]==kL1 || mLevels[i]==kL1fj) && iValues.mIsJPTrawP4set && !iValues.mIsJPTrawOFFset) {
296  iValues.setJPTrawOff(scale);
297  }
298  else if (mLevels[i]==kL6 && iValues.mAddLepToJet) {
299  scale *= 1.0 + getLepPt(iValues) / iValues.mJetPt;
300  iValues.mJetE *= scale;
301  iValues.mJetPt *= scale;
302  factor *= scale;
303  }
304  else {
305  iValues.mJetE *= scale;
306  iValues.mJetPt *= scale;
307  factor *= scale;
308  }
309  factors.push_back(factor);
310  }
311  iValues.reset();
312  return factors;
313 }
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 79 of file FactorizedJetCorrectorCalculator.cc.

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

Referenced by FactorizedJetCorrectorCalculator().

80 {
81  //---- Read the CorrectionLevels string and parse the requested sub-correction levels.
82  std::vector<std::string> tmp = parseLevels(removeSpaces(fLevels));
83  for(unsigned i=0;i<tmp.size();i++) {
84  if (tmp[i] == "L1Offset")
85  mLevels.push_back(kL1);
86  else if (tmp[i] == "L1JPTOffset")
87  mLevels.push_back(kL1JPT);
88  else if (tmp[i] == "L2Relative")
89  mLevels.push_back(kL2);
90  else if (tmp[i] == "L3Absolute")
91  mLevels.push_back(kL3);
92  else if (tmp[i] == "L2L3Residual")
93  mLevels.push_back(kL2L3Res);
94  else if (tmp[i] == "L4EMF")
95  mLevels.push_back(kL4);
96  else if (tmp[i] == "L5Flavor")
97  mLevels.push_back(kL5);
98  else if (tmp[i] == "L6SLB")
99  mLevels.push_back(kL6);
100  else if (tmp[i] == "L7Parton")
101  mLevels.push_back(kL7);
102  else if (tmp[i] == "L1FastJet")
103  mLevels.push_back(kL1fj);
104  else {
105  std::stringstream sserr;
106  sserr<<"unknown correction level "<<tmp[i];
107  handleError("FactorizedJetCorrectorCalculator",sserr.str());
108  }
109  }
110  //---- Read the parameter filenames string and parse the requested sub-correction tags.
111  std::vector<std::string> Files = parseLevels(removeSpaces(fFiles));
112  //---- Read the Options string and define the FlavorOption and PartonOption.
113  std::string FlavorOption = parseOption(removeSpaces(fOptions),"L5Flavor");
114  std::string PartonOption = parseOption(removeSpaces(fOptions),"L7Parton");
115  //---- Check the consistency between tags and requested sub-corrections.
116  checkConsistency(tmp,Files);
117  //---- Create instances of the requested sub-correctors.
118  for(unsigned i=0;i<mLevels.size();i++) {
120  mCorrectors.push_back(new SimpleJetCorrector(Files[i]));
121  else if (mLevels[i]==kL5 && FlavorOption.length()==0)
122  handleError("FactorizedJetCorrectorCalculator","must specify flavor option when requesting L5Flavor correction!");
123  else if (mLevels[i]==kL5 && FlavorOption.length()>0)
124  mCorrectors.push_back(new SimpleJetCorrector(Files[i],FlavorOption));
125  else if (mLevels[i]==kL7 && PartonOption.length()==0)
126  handleError("FactorizedJetCorrectorCalculator","must specify parton option when requesting L7Parton correction!");
127  else if (mLevels[i]==kL7 && PartonOption.length()>0)
128  mCorrectors.push_back(new SimpleJetCorrector(Files[i],PartonOption));
129  else {
130  std::stringstream sserr;
131  sserr<<"unknown correction level "<<tmp[i];
132  handleError("FactorizedJetCorrectorCalculator",sserr.str());
133  }
134  mBinTypes.push_back(mapping(mCorrectors[i]->parameters().definitions().binVar()));
135  mParTypes.push_back(mapping(mCorrectors[i]->parameters().definitions().parVar()));
136  }
137 }
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 141 of file FactorizedJetCorrectorCalculator.cc.

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

Referenced by FactorizedJetCorrectorCalculator(), and initCorrectors().

142 {
143  std::vector<VarTypes> result;
144  for(unsigned i=0;i<fNames.size();i++) {
145  std::string ss = fNames[i];
146  if (ss=="JetPt")
147  result.push_back(kJetPt);
148  else if (ss=="JetEta")
149  result.push_back(kJetEta);
150  else if (ss=="JetPhi")
151  result.push_back(kJetPhi);
152  else if (ss=="JetE")
153  result.push_back(kJetE);
154  else if (ss=="JetEMF")
155  result.push_back(kJetEMF);
156  else if (ss=="RelLepPt")
157  result.push_back(kRelLepPt);
158  else if (ss=="PtRel")
159  result.push_back(kPtRel);
160  else if (ss=="NPV")
161  result.push_back(kNPV);
162  else if (ss=="JetA")
163  result.push_back(kJetA);
164  else if (ss=="Rho")
165  result.push_back(kRho);
166  else if (ss=="JPTrawE")
167  result.push_back(kJPTrawE);
168  else if (ss=="JPTrawEt")
169  result.push_back(kJPTrawEt);
170  else if (ss=="JPTrawPt")
171  result.push_back(kJPTrawPt);
172  else if (ss=="JPTrawEta")
173  result.push_back(kJPTrawEta);
174  else if (ss=="JPTrawOff")
175  result.push_back(kJPTrawOff);
176  else {
177  std::stringstream sserr;
178  sserr<<"unknown parameter name: "<<ss;
179  handleError("FactorizedJetCorrectorCalculator",sserr.str());
180  }
181  }
182  return result;
183 }
FactorizedJetCorrectorCalculator& FactorizedJetCorrectorCalculator::operator= ( const FactorizedJetCorrectorCalculator )
privatedelete
std::vector< std::string > FactorizedJetCorrectorCalculator::parseLevels ( const std::string &  ss) const
private

Definition at line 207 of file FactorizedJetCorrectorCalculator.cc.

References mps_fire::i, mps_fire::result, AlCaHLTBitMon_QueryRunRegistry::string, and tmp.

Referenced by initCorrectors().

208 {
209  std::vector<std::string> result;
210  unsigned int pos(0),j,newPos;
211  int i;
213  //---- The ss string must be of the form: "LX:LY:...:LZ"
214  while (pos<ss.length()) {
215  tmp = "";
216  i = ss.find(":" , pos);
217  if (i<0 && pos==0) {
218  result.push_back(ss);
219  pos = ss.length();
220  }
221  else if (i<0 && pos>0) {
222  for(j=pos;j<ss.length();j++)
223  tmp+=ss[j];
224  result.push_back(tmp);
225  pos = ss.length();
226  }
227  else {
228  newPos = i;
229  for(j=pos;j<newPos;j++)
230  tmp+=ss[j];
231  result.push_back(tmp);
232  pos = newPos+1;
233  }
234  }
235  return result;
236 }
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 240 of file FactorizedJetCorrectorCalculator.cc.

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

Referenced by initCorrectors().

241 {
243  int pos1(-1),pos2(-1);
244  //---- The ss string must be of the form: "type1:option1&type2:option2&..."
245  pos1 = ss.find(type+":");
246  if (pos1<0)
247  result = "";
248  else {
249  pos2 = ss.find("&",pos1+type.length()+1);
250  if (pos2<0)
251  result = ss.substr(pos1+type.length()+1,ss.length()-pos1-type.length()-1);
252  else
253  result = ss.substr(pos1+type.length()+1,pos2-pos1-type.length()-1);
254  }
255  return result;
256 }
type
Definition: HCALResponse.h:21
std::string FactorizedJetCorrectorCalculator::removeSpaces ( const std::string &  ss) const
private

Definition at line 260 of file FactorizedJetCorrectorCalculator.cc.

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

Referenced by initCorrectors().

261 {
262  std::string result("");
263  std::string aChar;
264  for(unsigned int i=0;i<ss.length();i++) {
265  aChar = ss.substr(i,1);
266  if (aChar != " ")
267  result+=aChar;
268  }
269  return result;
270 }

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