CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GetLumi.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * $Date: 2012/08/23 13:27:32 $
5  * $Revision: 1.3 $
6  * \author: Mia Tosi,40 3-B32,+41227671609
7  */
8 
10 
14 
16  : lumiInputTag_ ( iConfig.getParameter<edm::InputTag>("lumi") )
17  , lumiScale_ ( iConfig.getParameter<double>("lumiScale") )
18 {
19 }
20 
21 GetLumi::GetLumi(edm::InputTag lumiInputTag, double lumiScale)
22  : lumiInputTag_ ( lumiInputTag )
23  , lumiScale_ ( lumiScale )
24 {
25 }
26 
28 {
29 }
30 
31 double
33 {
34 
35  // taken from
36  // DPGAnalysis/SiStripTools/src/DigiLumiCorrHistogramMaker.cc
37  // the scale factor 6.37 should follow the lumi prescriptions
40 
41  double bxlumi = -1.;
42  if(lumi->isValid()) {
43  bxlumi = lumi->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing());
44  }
45 
46  return bxlumi;
47 
48 }
49 
50 
51 double
53 {
54  // bxlumi = lumi->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing())*6.37;
55  return getRawValue(iEvent)*lumiScale_;
56 }
57 
58 double
60  edm::EventSetup const&eSetup)
61 {
62 
63  double lumi = -1.;
64  double intDelLumi = -1.;
65 
66  // size_t LS = lumiBlock.luminosityBlockAuxiliary().luminosityBlock();
67  // accumulate HF data at every LS as it is closed.
68  // note: lumi unit from DIPLumiSummary and Detail is microbarns
69  edm::Handle<LumiSummary> lumiSummary_;
70  lumiBlock.getByLabel(lumiInputTag_, lumiSummary_);
71  if(lumiSummary_->isValid()){
72  lumi = lumiSummary_->avgInsDelLumi();
73  intDelLumi = lumiSummary_->intgDelLumi();
74  std::cout << "Luminosity in this Lumi Section " << lumi << " --> " << intDelLumi << std::endl;
75  } else {
76  std::cout << "No valid data found!" << std::endl;
77  }
78 
79 
80  return lumi;
81 
82 }
83 
84 
85 double
87  edm::EventSetup const&eSetup)
88 {
89  return getRawValue(lumiBlock,eSetup)*lumiScale_;
90 }
91 
92 
93 double
94 GetLumi::convert2PU(double instLumi, double inelastic_xSec = GetLumi::INELASTIC_XSEC_8TeV) // inelastic_xSec in mb
95 {
96 
97  // from https://cmswbm.web.cern.ch/cmswbm/images/pileup.png
98  return instLumi*inelastic_xSec/FREQ_ORBIT;
99 }
100 
101 double
102 GetLumi::convert2PU(double instLumi, int sqrt_s = GetLumi::SQRT_S_8TeV)
103 {
104 
105  double inelastic_xSec = 0.;
106 
107  switch(sqrt_s) {
108  case GetLumi::SQRT_S_7TeV :
109  inelastic_xSec = GetLumi::INELASTIC_XSEC_7TeV;
110  break;
111  case GetLumi::SQRT_S_8TeV :
112  inelastic_xSec = GetLumi::INELASTIC_XSEC_8TeV;
113  break;
114  default :
115  break;
116  }
117 
118  return convert2PU(instLumi,inelastic_xSec);
119 
120 }
tuple lumi
Definition: fjr2json.py:35
int bunchCrossing() const
Definition: EventBase.h:62
bool getByLabel(std::string const &label, Handle< PROD > &result) const
static constexpr double FREQ_ORBIT
Definition: GetLumi.h:26
virtual ~GetLumi()
Definition: GetLumi.cc:27
double getValue(const edm::Event &)
Definition: GetLumi.cc:52
int iEvent
Definition: GenABIO.cc:243
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:59
bool isValid() const
Definition: HandleBase.h:76
static constexpr double INELASTIC_XSEC_7TeV
Definition: GetLumi.h:29
double getRawValue(const edm::Event &)
Definition: GetLumi.cc:32
static constexpr double INELASTIC_XSEC_8TeV
Definition: GetLumi.h:30
GetLumi(const edm::ParameterSet &)
Definition: GetLumi.cc:15
double convert2PU(double, double)
Definition: GetLumi.cc:94
tuple cout
Definition: gather_cfg.py:121
edm::InputTag lumiInputTag_
Definition: GetLumi.h:47
double lumiScale_
Definition: GetLumi.h:48