CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
fPoly.cc
Go to the documentation of this file.
3 #include <algorithm>
4 #include <map>
5 namespace lumi{
6  class fPoly:public NormFunctor{
7  public:
8  fPoly(){}
9  ~fPoly(){}
10  void initialize(const std::map< std::string , float >& coeffmap,
11  const std::map< unsigned int, float >& afterglowmap);
12  virtual float getCorrection(float luminonorm,float intglumi,unsigned int nBXs)const override;
13  };
14 }//ns lumi
15 
16 void
17 lumi::fPoly::initialize(const std::map< std::string , float >& coeffmap,
18  const std::map< unsigned int, float >& afterglowmap){
19  m_coeffmap=coeffmap;
20  m_afterglowmap=afterglowmap;
21 }
22 float
23 lumi::fPoly::getCorrection(float luminonorm,float intglumi,unsigned int nBXs)const{
24  float result=1.0;
25  float avglumi=0.;
26  float c1=0.;
27  std::map< std::string , float >::const_iterator coeffIt=m_coeffmap.find("C1");
28  if(coeffIt!=m_coeffmap.end()){
29  c1=coeffIt->second;
30  }
31  if(c1!=0. && nBXs>0){
32  avglumi=c1*luminonorm/nBXs;
33  }
34  float Afterglow=1.0;
35  if(!m_afterglowmap.empty()){
36  std::map< unsigned int, float >::const_iterator afterglowit=m_afterglowmap.lower_bound(nBXs+1);
37  if(afterglowit != m_afterglowmap.begin()){
38  Afterglow=(--afterglowit)->second;
39  }
40  }
41  float driftterm=1.0;
42  coeffIt=m_coeffmap.find("DRIFT");
43  if(coeffIt!=m_coeffmap.end()){
44  driftterm=1.0+coeffIt->second*intglumi;
45  }
46  float a0=1.0;
47  coeffIt=m_coeffmap.find("A0");
48  if(coeffIt!=m_coeffmap.end()){
49  a0=coeffIt->second;
50  }
51  float a1=0.;
52  coeffIt=m_coeffmap.find("A1");
53  if(coeffIt!=m_coeffmap.end()){
54  a1=coeffIt->second;
55  }
56  float a2=0.;
57  coeffIt=m_coeffmap.find("A2");
58  if(coeffIt!=m_coeffmap.end()){
59  a2=coeffIt->second;
60  }
61  result=a0*Afterglow/(1.+a1*avglumi+a2*avglumi*avglumi)*driftterm;
62  return result;
63 }
66 
tuple lumi
Definition: fjr2json.py:35
U second(std::pair< T, U > const &p)
std::map< unsigned int, float > m_afterglowmap
Definition: NormFunctor.h:15
fPoly()
Definition: fPoly.cc:8
tuple result
Definition: query.py:137
float intglumi
Definition: normFunctors.py:63
~fPoly()
Definition: fPoly.cc:9
std::map< std::string, float > m_coeffmap
Definition: NormFunctor.h:14
void initialize(const std::map< std::string, float > &coeffmap, const std::map< unsigned int, float > &afterglowmap)
Definition: fPoly.cc:17
#define DEFINE_EDM_PLUGIN(factory, type, name)
float luminonorm
Definition: normFunctors.py:62
virtual float getCorrection(float luminonorm, float intglumi, unsigned int nBXs) const override
Definition: fPoly.cc:23