CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
FTSLuminosityFromLumiSummary Class Reference
Inheritance diagram for FTSLuminosityFromLumiSummary:
edm::global::EDAnalyzer<> edm::global::EDAnalyzerBase edm::EDConsumerBase

Public Member Functions

 FTSLuminosityFromLumiSummary (edm::ParameterSet const &)
 
 ~FTSLuminosityFromLumiSummary ()
 
- Public Member Functions inherited from edm::global::EDAnalyzer<>
 EDAnalyzer ()=default
 
- Public Member Functions inherited from edm::global::EDAnalyzerBase
 EDAnalyzerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDAnalyzerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::global::EDAnalyzerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 

Private Types

enum  Type { Type::InstantaneousLuminosity, Type::Pileup, Type::Invalid = -1 }
 

Private Member Functions

virtual void analyze (edm::StreamID sid, edm::Event const &event, const edm::EventSetup &setup) const override
 
virtual void doStreamBeginLuminosityBlock_ (edm::StreamID id, edm::LuminosityBlock const &lumi, edm::EventSetup const &setup) override
 
virtual void preallocStreams (unsigned int size) override
 

Static Private Member Functions

static Type parse (std::string const &type)
 

Private Attributes

double m_cross_section
 
unsigned int m_lumi_id
 
edm::EDGetTokenT< LumiSummarym_token
 
Type m_type
 
std::vector< double > m_value
 

Additional Inherited Members

- Public Types inherited from edm::global::EDAnalyzerBase
typedef EDAnalyzerBase ModuleType
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 22 of file FTSLuminosityFromLumiSummary.cc.

Member Enumeration Documentation

Enumerator
InstantaneousLuminosity 
Pileup 
Invalid 

Definition at line 30 of file FTSLuminosityFromLumiSummary.cc.

30  {
31  InstantaneousLuminosity,
32  Pileup,
33  Invalid = -1
34  };

Constructor & Destructor Documentation

FTSLuminosityFromLumiSummary::FTSLuminosityFromLumiSummary ( edm::ParameterSet const &  config)
explicit

Definition at line 56 of file FTSLuminosityFromLumiSummary.cc.

References edm::ParameterSet::getParameter(), diffTwoXMLs::label, m_lumi_id, mergeVDriftHistosByStation::name, dtDQMClient_cfg::resolution, AlCaHLTBitMon_QueryRunRegistry::string, and indexGen::title.

56  :
57  m_token(consumes<LumiSummary, edm::InLumi>(config.getParameter<edm::InputTag>("source"))),
58  m_cross_section(config.getParameter<double>("crossSection")),
59  m_type(parse(config.getParameter<std::string>("type"))),
60  m_lumi_id((unsigned int) -1)
61 {
62  if (not edm::Service<FastTimerService>().isAvailable())
63  return;
64 
65  std::string const & name = config.getParameter<std::string>("name");
66  std::string const & title = config.getParameter<std::string>("title");
67  std::string const & label = config.getParameter<std::string>("label");
68  double range = config.getParameter<double>("range");
69  double resolution = config.getParameter<double>("resolution");
70 
71  m_lumi_id = edm::Service<FastTimerService>()->reserveLuminosityPlots(name, title, label, range, resolution);
72 }
edm::EDGetTokenT< LumiSummary > m_token
static Type parse(std::string const &type)
FTSLuminosityFromLumiSummary::~FTSLuminosityFromLumiSummary ( )

Definition at line 74 of file FTSLuminosityFromLumiSummary.cc.

75 {
76 }

Member Function Documentation

void FTSLuminosityFromLumiSummary::analyze ( edm::StreamID  sid,
edm::Event const &  event,
const edm::EventSetup setup 
) const
overrideprivatevirtual

Implements edm::global::EDAnalyzerBase.

Definition at line 123 of file FTSLuminosityFromLumiSummary.cc.

References m_lumi_id, and m_value.

124 {
125  if (not edm::Service<FastTimerService>().isAvailable())
126  return;
127 
128  edm::Service<FastTimerService>()->setLuminosity(sid, m_lumi_id, m_value[sid]);
129 }
void FTSLuminosityFromLumiSummary::doStreamBeginLuminosityBlock_ ( edm::StreamID  id,
edm::LuminosityBlock const &  lumi,
edm::EventSetup const &  setup 
)
overrideprivatevirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 83 of file FTSLuminosityFromLumiSummary.cc.

References mvaPFMET_cff::corrector, edm::LuminosityBlock::getByToken(), edm::EventSetup::getData(), InstantaneousLuminosity, Invalid, edm::ESHandleBase::isValid(), m_cross_section, m_token, m_type, m_value, and Pileup.

84 {
85  m_value[sid] = 0.;
86 
88  setup.getData(corrector);
89  if (not corrector.isValid()) {
90  edm::LogError("FTSLuminosityFromLumiSummary") << "unable to calibrate the raw luminosity values, please add a LumiCorrectionSource ESProducer to your configuration";
91  return;
92  }
93 
94  edm::Handle<LumiSummary> h_summary;
95  if (lumi.getByToken(m_token, h_summary)) {
96  double correction = corrector->getCorrection(h_summary->avgInsDelLumi());
97  /*
98  std::cerr << "LumiSummary loaded" << std::endl;
99  std::cerr << " uncorrected luminosity: " << h_summary->avgInsDelLumi() << std::endl;
100  std::cerr << " correction factor: " << correction << std::endl;
101  std::cerr << " corrected luminosity: " << h_summary->avgInsDelLumi() * correction * 1.e30 << std::endl;
102  std::cerr << " integrated luminosity: " << h_summary->intgDelLumi() * correction * 1.e30 << std::endl;
103  std::cerr << " colliding bunches: " << corrector->ncollidingbunches() << std::endl;
104  std::cerr << " orbits: " << h_summary->numOrbit() << std::endl;
105  std::cerr << " pileup: " << h_summary->intgDelLumi() * correction * m_cross_section * 1.e3 / h_summary->numOrbit() / corrector->ncollidingbunches() << std::endl;
106  */
107  switch (m_type) {
109  m_value[sid] = h_summary->avgInsDelLumi() * correction * 1.e30;
110  break;
111  case Type::Pileup:
112  // integrated luminosity [nb-1] * pp cross section [mb] * 10^6 nb/mb / 2^18 orbits / number of colliding bunches
113  m_value[sid] = h_summary->intgDelLumi() * correction * m_cross_section * 1.e3 / h_summary->numOrbit() / corrector->ncollidingbunches();
114  break;
115  case Type::Invalid:
116  m_value[sid] = 0.;
117  break;
118  }
119  }
120 }
edm::EDGetTokenT< LumiSummary > m_token
tuple lumi
Definition: fjr2json.py:35
tuple corrector
Definition: mvaPFMET_cff.py:50
bool isValid() const
Definition: ESHandle.h:47
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
void FTSLuminosityFromLumiSummary::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 132 of file FTSLuminosityFromLumiSummary.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

132  {
133  // instantaneous luminosity
134  {
136  desc.add<edm::InputTag>("source", edm::InputTag("lumiProducer"));
137  desc.add<double>("crossSection", 69.3);
138  desc.add<std::string>("type", "InstantaneousLuminosity");
139  desc.add<std::string>("name", "luminosity");
140  desc.add<std::string>("title", "instantaneous luminosity");
141  desc.add<std::string>("label", "instantaneous luminosity [cm^{-2}s^{-1}]");
142  desc.add<double>("range", 8.e33);
143  desc.add<double>("resolution", 1.e31);
144  descriptions.add("ftsLuminosityFromLumiSummary", desc);
145  }
146  // pileup
147  {
149  desc.add<edm::InputTag>("source", edm::InputTag("lumiProducer"));
150  desc.add<double>("crossSection", 69.3);
151  desc.add<std::string>("type", "Pileup");
152  desc.add<std::string>("name", "pileup");
153  desc.add<std::string>("title", "pileup");
154  desc.add<std::string>("label", "pileup");
155  desc.add<double>("range", 40);
156  desc.add<double>("resolution", 1);
157  descriptions.add("ftsPileupFromLumiSummary", desc);
158  }
159 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
static Type FTSLuminosityFromLumiSummary::parse ( std::string const &  type)
inlinestaticprivate

Definition at line 36 of file FTSLuminosityFromLumiSummary.cc.

References InstantaneousLuminosity, Invalid, and Pileup.

36  {
37  if (type == "InstantaneousLuminosity")
39  else if (type == "Pileup")
40  return Type::Pileup;
41  else
42  return Type::Invalid;
43  }
type
Definition: HCALResponse.h:21
void FTSLuminosityFromLumiSummary::preallocStreams ( unsigned int  size)
overrideprivatevirtual

Reimplemented from edm::global::EDAnalyzerBase.

Definition at line 78 of file FTSLuminosityFromLumiSummary.cc.

References m_value.

79 {
80  m_value.resize(size, 0.);
81 }
tuple size
Write out results.

Member Data Documentation

double FTSLuminosityFromLumiSummary::m_cross_section
private

Definition at line 46 of file FTSLuminosityFromLumiSummary.cc.

Referenced by doStreamBeginLuminosityBlock_().

unsigned int FTSLuminosityFromLumiSummary::m_lumi_id
private

Definition at line 48 of file FTSLuminosityFromLumiSummary.cc.

Referenced by analyze(), and FTSLuminosityFromLumiSummary().

edm::EDGetTokenT<LumiSummary> FTSLuminosityFromLumiSummary::m_token
private

Definition at line 45 of file FTSLuminosityFromLumiSummary.cc.

Referenced by doStreamBeginLuminosityBlock_().

Type FTSLuminosityFromLumiSummary::m_type
private

Definition at line 47 of file FTSLuminosityFromLumiSummary.cc.

Referenced by doStreamBeginLuminosityBlock_().

std::vector<double> FTSLuminosityFromLumiSummary::m_value
private