CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Public Attributes
Type2CorrectionProducer::type2BinningEntryType Struct Reference

Public Member Functions

void initialize (const std::string &binCorrFormula, const edm::ParameterSet &binCorrParameter)
 
 type2BinningEntryType (const std::string &binCorrformula, const edm::ParameterSet &binCorrParameter, const vInputTag &srcUnclEnergySums, edm::ConsumesCollector &&iConsumesCollector)
 
 type2BinningEntryType (const edm::ParameterSet &cfg, const vInputTag &srcUnclEnergySums, edm::ConsumesCollector &&iConsumesCollector)
 
 ~type2BinningEntryType ()
 

Public Attributes

TFormula * binCorrFormula_
 
std::vector< double > binCorrParameter_
 
std::string binLabel_
 
std::vector< edm::EDGetTokenT
< CorrMETData > > 
corrTokens_
 

Detailed Description

Definition at line 32 of file Type2CorrectionProducer.cc.

Constructor & Destructor Documentation

Type2CorrectionProducer::type2BinningEntryType::type2BinningEntryType ( const std::string &  binCorrformula,
const edm::ParameterSet binCorrParameter,
const vInputTag srcUnclEnergySums,
edm::ConsumesCollector &&  iConsumesCollector 
)
inline

Definition at line 34 of file Type2CorrectionProducer.cc.

References corrTokens_, initialize(), and beam_dqm_sourceclient-live_cfg::inputTag.

35  : binLabel_(""),
37  {
38  for (vInputTag::const_iterator inputTag = srcUnclEnergySums.begin(); inputTag != srcUnclEnergySums.end(); ++inputTag)
39  {
40  corrTokens_.push_back(iConsumesCollector.consumes<CorrMETData>(*inputTag));
41  }
42 
43  initialize(binCorrformula, binCorrParameter);
44  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
std::vector< edm::EDGetTokenT< CorrMETData > > corrTokens_
void initialize(const std::string &binCorrFormula, const edm::ParameterSet &binCorrParameter)
a MET correction term
Definition: CorrMETData.h:14
Type2CorrectionProducer::type2BinningEntryType::type2BinningEntryType ( const edm::ParameterSet cfg,
const vInputTag srcUnclEnergySums,
edm::ConsumesCollector &&  iConsumesCollector 
)
inline

Definition at line 45 of file Type2CorrectionProducer.cc.

References binLabel_, corrTokens_, data, edm::ParameterSet::getParameter(), initialize(), beam_dqm_sourceclient-live_cfg::inputTag, and AlCaHLTBitMon_QueryRunRegistry::string.

46  : binLabel_(cfg.getParameter<std::string>("binLabel")),
48  {
49 
50  for ( vInputTag::const_iterator srcUnclEnergySum = srcUnclEnergySums.begin();
51  srcUnclEnergySum != srcUnclEnergySums.end(); ++srcUnclEnergySum )
52  {
53  std::string instanceLabel = srcUnclEnergySum->instance();
54  if ( instanceLabel != "" && binLabel_ != "" ) instanceLabel.append("#");
55  instanceLabel.append(binLabel_);
56  edm::InputTag inputTag(srcUnclEnergySum->label(), instanceLabel);
57  corrTokens_.push_back(iConsumesCollector.consumes<CorrMETData>(inputTag));
58  }
59 
60  std::string binCorrFormula = cfg.getParameter<std::string>("binCorrFormula").data();
61 
62  edm::ParameterSet binCorrParameter = cfg.getParameter<edm::ParameterSet>("binCorrParameter");
63 
64  initialize(binCorrFormula, binCorrParameter);
65  }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
std::vector< edm::EDGetTokenT< CorrMETData > > corrTokens_
void initialize(const std::string &binCorrFormula, const edm::ParameterSet &binCorrParameter)
a MET correction term
Definition: CorrMETData.h:14
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82
Type2CorrectionProducer::type2BinningEntryType::~type2BinningEntryType ( )
inline

Definition at line 97 of file Type2CorrectionProducer.cc.

References binCorrFormula_.

Member Function Documentation

void Type2CorrectionProducer::type2BinningEntryType::initialize ( const std::string &  binCorrFormula,
const edm::ParameterSet binCorrParameter 
)
inline

Definition at line 66 of file Type2CorrectionProducer.cc.

References binCorrFormula_, binCorrParameter_, binLabel_, data, Exception, EcalElecEmulTccOnlyExample_cfg::formula, edm::ParameterSet::getParameter(), edm::ParameterSet::getParameterNamesForType(), and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by type2BinningEntryType().

67  {
68  TString formula = binCorrFormula;
69 
70  vstring parNames = binCorrParameter.getParameterNamesForType<double>();
71  int numParameter = parNames.size();
72  binCorrParameter_.resize(numParameter);
73  for ( int parIndex = 0; parIndex < numParameter; ++parIndex ) {
74  const std::string& parName = parNames[parIndex].data();
75 
76  double parValue = binCorrParameter.getParameter<double>(parName);
77  binCorrParameter_[parIndex] = parValue;
78 
79  TString parName_internal = Form("[%i]", parIndex);
80  formula = formula.ReplaceAll(parName.data(), parName_internal);
81  }
82 
83  std::string binCorrFormulaName = std::string("binCorrFormula").append("_").append(binLabel_);
84  binCorrFormula_ = new TFormula(binCorrFormulaName.data(), formula);
85 
86 //--- check that syntax of formula string is valid
87 // (i.e. that TFormula "compiled" without errors)
88  if ( !(binCorrFormula_->GetNdim() <= 1 && binCorrFormula_->GetNpar() == numParameter) )
89  throw cms::Exception("METCorrectionAlgorithm2")
90  << "Formula for Type 2 correction has invalid syntax = " << formula << " !!\n";
91 
92  for ( int parIndex = 0; parIndex < numParameter; ++parIndex ) {
93  binCorrFormula_->SetParameter(parIndex, binCorrParameter_[parIndex]);
94  binCorrFormula_->SetParName(parIndex, parNames[parIndex].data());
95  }
96  }
T getParameter(std::string const &) const
vector< string > vstring
Definition: ExoticaDQM.cc:86
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
Definition: ParameterSet.h:194
char data[epos_bytes_allocation]
Definition: EPOS_Wrapper.h:82

Member Data Documentation

TFormula* Type2CorrectionProducer::type2BinningEntryType::binCorrFormula_

Definition at line 103 of file Type2CorrectionProducer.cc.

Referenced by initialize(), and ~type2BinningEntryType().

std::vector<double> Type2CorrectionProducer::type2BinningEntryType::binCorrParameter_

Definition at line 104 of file Type2CorrectionProducer.cc.

Referenced by initialize().

std::string Type2CorrectionProducer::type2BinningEntryType::binLabel_

Definition at line 101 of file Type2CorrectionProducer.cc.

Referenced by initialize(), and type2BinningEntryType().

std::vector<edm::EDGetTokenT<CorrMETData> > Type2CorrectionProducer::type2BinningEntryType::corrTokens_

Definition at line 102 of file Type2CorrectionProducer.cc.

Referenced by type2BinningEntryType().