CMS 3D CMS Logo

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

#include <GetLumi.h>

Public Types

enum  SQRT_S { SQRT_S_7TeV, SQRT_S_8TeV }
 

Public Member Functions

double convert2PU (double, double)
 
double convert2PU (double, int)
 
 GetLumi (const edm::ParameterSet &)
 
 GetLumi (const edm::InputTag &, double)
 
 GetLumi (const edm::ParameterSet &, edm::ConsumesCollector &iC)
 
 GetLumi (const edm::InputTag &, double, edm::ConsumesCollector &iC)
 
double getRawValue (const edm::Event &)
 
double getRawValue (edm::LuminosityBlock const &, edm::EventSetup const &)
 
double getValue (const edm::Event &)
 
double getValue (edm::LuminosityBlock const &, edm::EventSetup const &)
 
virtual ~GetLumi ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 

Public Attributes

edm::EDGetTokenT< LumiDetailslumiDetailsToken_
 
edm::InputTag lumiInputTag_
 
double lumiScale_
 
edm::EDGetTokenT< LumiSummarylumiSummaryToken_
 

Static Public Attributes

static constexpr double FREQ_ORBIT = 11246.
 
static constexpr double INELASTIC_XSEC_7TeV = 68.0
 
static constexpr double INELASTIC_XSEC_8TeV = 69.3
 
static const unsigned int NUM_BX = 3564
 
static constexpr double SECONDS_PER_LS = double(0x40000)/double(FREQ_ORBIT)
 

Detailed Description

Definition at line 21 of file GetLumi.h.

Member Enumeration Documentation

Enumerator
SQRT_S_7TeV 
SQRT_S_8TeV 

Definition at line 25 of file GetLumi.h.

Constructor & Destructor Documentation

GetLumi::GetLumi ( const edm::ParameterSet iConfig)

Definition at line 14 of file GetLumi.cc.

15  : lumiInputTag_ ( iConfig.getParameter<edm::InputTag>("lumi") )
16  , lumiScale_ ( iConfig.getParameter<double>("lumiScale") )
17 {
18 }
T getParameter(std::string const &) const
edm::InputTag lumiInputTag_
Definition: GetLumi.h:54
double lumiScale_
Definition: GetLumi.h:55
GetLumi::GetLumi ( const edm::InputTag lumiInputTag,
double  lumiScale 
)

Definition at line 20 of file GetLumi.cc.

21  : lumiInputTag_ ( lumiInputTag )
22  , lumiScale_ ( lumiScale )
23 {
24 }
edm::InputTag lumiInputTag_
Definition: GetLumi.h:54
double lumiScale_
Definition: GetLumi.h:55
GetLumi::GetLumi ( const edm::ParameterSet iConfig,
edm::ConsumesCollector iC 
)

Definition at line 26 of file GetLumi.cc.

References edm::ConsumesCollector::consumes(), edm::InLumi, lumiDetailsToken_, lumiInputTag_, and lumiSummaryToken_.

26  : GetLumi(iConfig)
27 {
30 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< LumiDetails > lumiDetailsToken_
Definition: GetLumi.h:57
edm::EDGetTokenT< LumiSummary > lumiSummaryToken_
Definition: GetLumi.h:58
GetLumi(const edm::ParameterSet &)
Definition: GetLumi.cc:14
edm::InputTag lumiInputTag_
Definition: GetLumi.h:54
GetLumi::GetLumi ( const edm::InputTag lumiInputTag,
double  lumiScale,
edm::ConsumesCollector iC 
)

Definition at line 32 of file GetLumi.cc.

References edm::ConsumesCollector::consumes(), edm::InLumi, lumiDetailsToken_, lumiInputTag_, and lumiSummaryToken_.

32  : GetLumi(lumiInputTag,lumiScale)
33 {
36 }
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
edm::EDGetTokenT< LumiDetails > lumiDetailsToken_
Definition: GetLumi.h:57
edm::EDGetTokenT< LumiSummary > lumiSummaryToken_
Definition: GetLumi.h:58
GetLumi(const edm::ParameterSet &)
Definition: GetLumi.cc:14
edm::InputTag lumiInputTag_
Definition: GetLumi.h:54
GetLumi::~GetLumi ( )
virtual

Definition at line 38 of file GetLumi.cc.

39 {
40 }

Member Function Documentation

double GetLumi::convert2PU ( double  instLumi,
double  inelastic_xSec = GetLumi::INELASTIC_XSEC_8TeV 
)

Definition at line 108 of file GetLumi.cc.

References FREQ_ORBIT.

Referenced by convert2PU().

109 {
110 
111  // from https://cmswbm.web.cern.ch/cmswbm/images/pileup.png
112  return instLumi*inelastic_xSec/FREQ_ORBIT;
113 }
static constexpr double FREQ_ORBIT
Definition: GetLumi.h:31
double GetLumi::convert2PU ( double  instLumi,
int  sqrt_s = GetLumi::SQRT_S_8TeV 
)

Definition at line 116 of file GetLumi.cc.

References convert2PU(), INELASTIC_XSEC_7TeV, INELASTIC_XSEC_8TeV, SQRT_S_7TeV, and SQRT_S_8TeV.

117 {
118 
119  double inelastic_xSec = 0.;
120 
121  switch(sqrt_s) {
122  case GetLumi::SQRT_S_7TeV :
123  inelastic_xSec = GetLumi::INELASTIC_XSEC_7TeV;
124  break;
125  case GetLumi::SQRT_S_8TeV :
126  inelastic_xSec = GetLumi::INELASTIC_XSEC_8TeV;
127  break;
128  default :
129  break;
130  }
131 
132  return convert2PU(instLumi,inelastic_xSec);
133 
134 }
static constexpr double INELASTIC_XSEC_7TeV
Definition: GetLumi.h:34
static constexpr double INELASTIC_XSEC_8TeV
Definition: GetLumi.h:35
double convert2PU(double, double)
Definition: GetLumi.cc:108
static void GetLumi::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static
double GetLumi::getRawValue ( const edm::Event iEvent)

Definition at line 43 of file GetLumi.cc.

References edm::EventBase::bunchCrossing(), edm::LuminosityBlock::getByToken(), edm::Event::getLuminosityBlock(), edm::HandleBase::isValid(), LumiDetails::kOCC1, fjr2json::lumi, and lumiSummaryToken_.

Referenced by getValue().

44 {
45 
46  // taken from
47  // DPGAnalysis/SiStripTools/src/DigiLumiCorrHistogramMaker.cc
48  // the scale factor 6.37 should follow the lumi prescriptions
50  // iEvent.getLuminosityBlock().getByLabel(lumiInputTag_,lumi);
52 
53 
54  double bxlumi = -1.;
55  if(lumi->isValid()) {
56  bxlumi = lumi->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing());
57  }
58 
59  return bxlumi;
60 
61 }
bool getByToken(EDGetToken token, Handle< PROD > &result) const
tuple lumi
Definition: fjr2json.py:35
int bunchCrossing() const
Definition: EventBase.h:62
edm::EDGetTokenT< LumiSummary > lumiSummaryToken_
Definition: GetLumi.h:58
LuminosityBlock const & getLuminosityBlock() const
Definition: Event.h:80
bool isValid() const
Definition: HandleBase.h:76
double GetLumi::getRawValue ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  eSetup 
)

Definition at line 72 of file GetLumi.cc.

References gather_cfg::cout, edm::LuminosityBlock::getByToken(), edm::HandleBase::isValid(), fjr2json::lumi, and lumiSummaryToken_.

74 {
75 
76  double lumi = -1.;
77  double intDelLumi = -1.;
78 
79  // size_t LS = lumiBlock.luminosityBlockAuxiliary().luminosityBlock();
80  // accumulate HF data at every LS as it is closed.
81  // note: lumi unit from DIPLumiSummary and Detail is microbarns
82  edm::Handle<LumiSummary> lumiSummary_;
83  // lumiBlock.getByLabel(lumiInputTag_, lumiSummary_);
84  lumiBlock.getByToken(lumiSummaryToken_, lumiSummary_);
85  if(lumiSummary_->isValid()){
86  lumi = lumiSummary_->avgInsDelLumi();
87  intDelLumi = lumiSummary_->intgDelLumi();
88  std::cout << "Luminosity in this Lumi Section " << lumi << " --> " << intDelLumi << std::endl;
89  } else {
90  std::cout << "No valid data found!" << std::endl;
91  }
92 
93 
94  return lumi;
95 
96 }
tuple lumi
Definition: fjr2json.py:35
edm::EDGetTokenT< LumiSummary > lumiSummaryToken_
Definition: GetLumi.h:58
bool isValid() const
Definition: HandleBase.h:76
tuple cout
Definition: gather_cfg.py:121
double GetLumi::getValue ( const edm::Event iEvent)

Definition at line 65 of file GetLumi.cc.

References getRawValue(), and lumiScale_.

Referenced by VertexMonitor::analyze(), TrackingMonitor::analyze(), and LogMessageMonitor::analyze().

66 {
67  // bxlumi = lumi->lumiValue(LumiDetails::kOCC1,iEvent.bunchCrossing())*6.37;
68  return getRawValue(iEvent)*lumiScale_;
69 }
double getRawValue(const edm::Event &)
Definition: GetLumi.cc:43
double lumiScale_
Definition: GetLumi.h:55
double GetLumi::getValue ( edm::LuminosityBlock const &  lumiBlock,
edm::EventSetup const &  eSetup 
)

Definition at line 100 of file GetLumi.cc.

References getRawValue(), and lumiScale_.

102 {
103  return getRawValue(lumiBlock,eSetup)*lumiScale_;
104 }
double getRawValue(const edm::Event &)
Definition: GetLumi.cc:43
double lumiScale_
Definition: GetLumi.h:55

Member Data Documentation

constexpr double GetLumi::FREQ_ORBIT = 11246.
static

Definition at line 31 of file GetLumi.h.

Referenced by convert2PU().

constexpr double GetLumi::INELASTIC_XSEC_7TeV = 68.0
static

Definition at line 34 of file GetLumi.h.

Referenced by convert2PU().

constexpr double GetLumi::INELASTIC_XSEC_8TeV = 69.3
static

Definition at line 35 of file GetLumi.h.

Referenced by convert2PU().

edm::EDGetTokenT<LumiDetails> GetLumi::lumiDetailsToken_

Definition at line 57 of file GetLumi.h.

Referenced by GetLumi().

edm::InputTag GetLumi::lumiInputTag_

Definition at line 54 of file GetLumi.h.

Referenced by GetLumi().

double GetLumi::lumiScale_

Definition at line 55 of file GetLumi.h.

Referenced by getValue().

edm::EDGetTokenT<LumiSummary> GetLumi::lumiSummaryToken_

Definition at line 58 of file GetLumi.h.

Referenced by GetLumi(), and getRawValue().

const unsigned int GetLumi::NUM_BX = 3564
static

Definition at line 30 of file GetLumi.h.

constexpr double GetLumi::SECONDS_PER_LS = double(0x40000)/double(FREQ_ORBIT)
static

Definition at line 32 of file GetLumi.h.