CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Types | Private Attributes
OnlineBeamMonitor Class Reference

#include <OnlineBeamMonitor.h>

Inheritance diagram for OnlineBeamMonitor:
DQMOneEDAnalyzer< edm::LuminosityBlockCache< onlinebeammonitor::NoCache > > edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 OnlineBeamMonitor (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< onlinebeammonitor::NoCache > >
void accumulate (edm::Event const &event, edm::EventSetup const &setup) override
 
void beginRun (edm::Run const &run, edm::EventSetup const &setup) final
 
 DQMOneEDAnalyzer ()
 
void endRun (edm::Run const &, edm::EventSetup const &) final
 
void endRunProduce (edm::Run &run, edm::EventSetup const &setup) final
 
virtual bool getCanSaveByLumi ()
 
- Public Member Functions inherited from edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... >
 EDProducer ()=default
 
SerialTaskQueueglobalLuminosityBlocksQueue () final
 
SerialTaskQueueglobalRunsQueue () final
 
bool hasAbilityToProduceInBeginLumis () const final
 
bool hasAbilityToProduceInBeginProcessBlocks () const final
 
bool hasAbilityToProduceInBeginRuns () const final
 
bool hasAbilityToProduceInEndLumis () const final
 
bool hasAbilityToProduceInEndProcessBlocks () const final
 
bool hasAbilityToProduceInEndRuns () const final
 
bool wantsGlobalLuminosityBlocks () const final
 
bool wantsGlobalRuns () const final
 
bool wantsInputProcessBlocks () const final
 
bool wantsProcessBlocks () const final
 
- Public Member Functions inherited from edm::one::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
bool wantsStreamLuminosityBlocks () const
 
bool wantsStreamRuns () const
 
 ~EDProducerBase () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
std::vector< bool > const & recordProvenanceList () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
TypeLabelList const & typeLabelList () const
 used by the fwk to register the list of products of this module More...
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase &&)=default
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex > const & esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

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

Protected Member Functions

void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmEndRun (edm::Run const &, edm::EventSetup const &) override
 
std::shared_ptr< onlinebeammonitor::NoCacheglobalBeginLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) const override
 
void globalEndLuminosityBlock (const edm::LuminosityBlock &iLumi, const edm::EventSetup &iSetup) override
 
- Protected Member Functions inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< onlinebeammonitor::NoCache > >
virtual void analyze (edm::Event const &, edm::EventSetup const &)
 
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
template<class ProductType >
BranchAliasSetterT< ProductType > produces ()
 declare what type of product will make and with which optional label More...
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<BranchType B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<Transition B>
BranchAliasSetter produces (const TypeID &id, std::string instanceName=std::string(), bool recordProvenance=true)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 

Private Types

typedef std::map< std::string, reco::BeamSpotBeamSpotContainer
 
typedef std::map< std::string, std::map< std::string, std::map< std::string, MonitorElement * > > > HistosContainer
 
typedef std::map< std::string, std::map< std::string, std::map< std::string, int > > > PositionContainer
 

Private Attributes

BeamSpotContainer beamSpotsMap_
 
MonitorElementbsChoice_
 
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcdbsHLTToken_
 
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcdbsLegacyToken_
 
edm::ESGetToken< BeamSpotObjects, BeamSpotTransientObjectsRcdbsTransientToken_
 
std::multimap< std::string, std::string > histoByCategoryNames_
 
HistosContainer histosMap_
 
std::string monitorName_
 
int numberOfProcessedLumis_
 
int numberOfValuesToSave_
 
PositionContainer positionsMap_
 
std::vector< int > processedLumis_
 
std::vector< std::string > varNamesV_
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< onlinebeammonitor::NoCache > >
typedef dqm::reco::DQMStore DQMStore
 
typedef dqm::reco::MonitorElement MonitorElement
 
- Public Types inherited from edm::one::EDProducerBase
typedef EDProducerBase ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex > >
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Attributes inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< onlinebeammonitor::NoCache > >
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 31 of file OnlineBeamMonitor.h.

Member Typedef Documentation

◆ BeamSpotContainer

typedef std::map<std::string, reco::BeamSpot> OnlineBeamMonitor::BeamSpotContainer
private

Definition at line 46 of file OnlineBeamMonitor.h.

◆ HistosContainer

typedef std::map<std::string, std::map<std::string, std::map<std::string, MonitorElement*> > > OnlineBeamMonitor::HistosContainer
private

Definition at line 48 of file OnlineBeamMonitor.h.

◆ PositionContainer

typedef std::map<std::string, std::map<std::string, std::map<std::string, int> > > OnlineBeamMonitor::PositionContainer
private

Definition at line 50 of file OnlineBeamMonitor.h.

Constructor & Destructor Documentation

◆ OnlineBeamMonitor()

OnlineBeamMonitor::OnlineBeamMonitor ( const edm::ParameterSet ps)

Definition at line 30 of file OnlineBeamMonitor.cc.

31  : monitorName_(ps.getUntrackedParameter<string>("MonitorName")),
32  bsTransientToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()),
33  bsHLTToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()),
34  bsLegacyToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()),
36  if (!monitorName_.empty())
37  monitorName_ = monitorName_ + "/";
38 
39  processedLumis_.clear();
40 
41  varNamesV_.push_back("x");
42  varNamesV_.push_back("y");
43  varNamesV_.push_back("z");
44  varNamesV_.push_back("sigmaX");
45  varNamesV_.push_back("sigmaY");
46  varNamesV_.push_back("sigmaZ");
47 
48  //histoByCategoryNames_.insert(pair<string, string>("run", "Coordinate"));
49  //histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex fit-DataBase"));
50  //histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex fit-BeamFit"));
51  //histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex fit-Scalers"));
52  //histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex-DataBase"));
53  //histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex-BeamFit"));
54  //histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex-Scalers"));
55 
56  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased BeamSpotHLT"));
57  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased BeamSpotLegacy"));
58  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased BeamSpotTransient"));
59 
60  for (const auto& itV : varNamesV_) {
61  for (const auto& itM : histoByCategoryNames_) {
62  histosMap_[itV][itM.first][itM.second] = nullptr;
63  }
64  }
65 }

References edm::BeginLuminosityBlock, histoByCategoryNames_, histosMap_, monitorName_, processedLumis_, and varNamesV_.

Member Function Documentation

◆ bookHistograms()

void OnlineBeamMonitor::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

Implements DQMOneEDAnalyzer< edm::LuminosityBlockCache< onlinebeammonitor::NoCache > >.

Definition at line 75 of file OnlineBeamMonitor.cc.

77  {
78  string name;
79  string title;
80  int firstLumi = 1;
81  int lastLumi = 3000;
82  for (auto& itM : histosMap_) {
83  //Making histos per Lumi
84  // x,y,z,sigmaX,sigmaY,sigmaZ
85  for (auto& itMM : itM.second) {
86  if (itMM.first != "run") {
87  for (auto& itMMM : itMM.second) {
88  name = string("h") + itM.first + itMMM.first;
89  title = itM.first + "_{0} " + itMMM.first;
90  if (itMM.first == "lumi") {
91  ibooker.setCurrentFolder(monitorName_ + "Debug");
92  itMMM.second = ibooker.book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
93  itMMM.second->setEfficiencyFlag();
94  } else {
95  LogInfo("OnlineBeamMonitorClient") << "Unrecognized category " << itMM.first;
96  }
97  if (itMMM.second != nullptr) {
98  if (itMMM.first.find('-') != string::npos) {
99  itMMM.second->setAxisTitle(string("#Delta ") + itM.first + "_{0} (cm)", 2);
100  } else {
101  itMMM.second->setAxisTitle(itM.first + "_{0} (cm)", 2);
102  }
103  itMMM.second->setAxisTitle("Lumisection", 1);
104  }
105  }
106  }
107  }
108  }
109 
110  // create and cd into new folder
111  ibooker.setCurrentFolder(monitorName_ + "Validation");
112  //Book histograms
113  bsChoice_ = ibooker.book1D("bsChoice",
114  "Choice between HLT (+1) and Legacy (-1) BS",
115  lastLumi - firstLumi + 1,
116  firstLumi - 0.5,
117  lastLumi + 0.5);
118  bsChoice_->setAxisTitle("Lumisection", 1);
119  bsChoice_->setAxisTitle("Choice", 2);
120 }

References dqm::implementation::IBooker::book1D(), bsChoice_, histosMap_, BeamSpotPI::lastLumi, monitorName_, Skims_PA_cff::name, dqm::impl::MonitorElement::setAxisTitle(), dqm::implementation::NavigatorBase::setCurrentFolder(), dqm::impl::MonitorElement::setEfficiencyFlag(), AlCaHLTBitMon_QueryRunRegistry::string, and runGCPTkAlMap::title.

◆ dqmEndRun()

void OnlineBeamMonitor::dqmEndRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Reimplemented from DQMOneEDAnalyzer< edm::LuminosityBlockCache< onlinebeammonitor::NoCache > >.

Definition at line 308 of file OnlineBeamMonitor.cc.

308  {
309  if (processedLumis_.empty()) {
310  return;
311  }
312 
313  const double bigNumber = 1000000.;
314  std::sort(processedLumis_.begin(), processedLumis_.end());
315  int firstLumi = *processedLumis_.begin();
316  int lastLumi = *(--processedLumis_.end());
317  bsChoice_->getTH1()->GetXaxis()->SetRangeUser(firstLumi - 0.5, lastLumi + 0.5);
318  for (auto& itH : histosMap_) {
319  for (auto& itHH : itH.second) {
320  double min = bigNumber;
321  double max = -bigNumber;
322  if (itHH.first != "run") {
323  for (auto& itHHH : itHH.second) {
324  if (itHHH.second != nullptr) {
325  for (int bin = 1; bin <= itHHH.second->getTH1()->GetNbinsX(); bin++) {
326  if (itHHH.second->getTH1()->GetBinError(bin) != 0 || itHHH.second->getTH1()->GetBinContent(bin) != 0) {
327  if (itHHH.first == "Lumibased BeamSpotHLT" || itHHH.first == "Lumibased BeamSpotLegacy" ||
328  itHHH.first == "Lumibased BeamSpotTransient") {
329  if (min > itHHH.second->getTH1()->GetBinContent(bin)) {
330  min = itHHH.second->getTH1()->GetBinContent(bin);
331  }
332  if (max < itHHH.second->getTH1()->GetBinContent(bin)) {
333  max = itHHH.second->getTH1()->GetBinContent(bin);
334  }
335  } else {
336  LogInfo("OnlineBeamMonitorClient") << "The histosMap_ have a histogram named " << itHHH.first
337  << " that I can't recognize in this loop!";
338  }
339  }
340  }
341  }
342  }
343  for (auto& itHHH : itHH.second) {
344  if (itHHH.second != nullptr) {
345  if (itHHH.first == "Lumibased BeamSpotHLT" || itHHH.first == "Lumibased BeamSpotLegacy" ||
346  itHHH.first == "Lumibased BeamSpotTransient") {
347  if ((max == -bigNumber && min == bigNumber) || max - min == 0) {
348  itHHH.second->getTH1()->SetMinimum(itHHH.second->getTH1()->GetMinimum() - 0.01);
349  itHHH.second->getTH1()->SetMaximum(itHHH.second->getTH1()->GetMaximum() + 0.01);
350  } else {
351  itHHH.second->getTH1()->SetMinimum(min - 0.1 * (max - min));
352  itHHH.second->getTH1()->SetMaximum(max + 0.1 * (max - min));
353  }
354  } else {
355  LogInfo("OnlineBeamMonitorClient")
356  << "The histosMap_ have a histogram named " << itHHH.first << " that I can't recognize in this loop!";
357  }
358  itHHH.second->getTH1()->GetXaxis()->SetRangeUser(firstLumi - 0.5, lastLumi + 0.5);
359  }
360  }
361  }
362  }
363  }
364 }

References newFWLiteAna::bin, bsChoice_, dqm::impl::MonitorElement::getTH1(), histosMap_, BeamSpotPI::lastLumi, SiStripPI::max, min(), and processedLumis_.

◆ fillDescriptions()

void OnlineBeamMonitor::fillDescriptions ( edm::ConfigurationDescriptions iDesc)
static

Definition at line 67 of file OnlineBeamMonitor.cc.

67  {
69 
70  ps.addUntracked<std::string>("MonitorName", "YourSubsystemName");
71  iDesc.addDefault(ps);
72 }

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

◆ globalBeginLuminosityBlock()

std::shared_ptr< onlinebeammonitor::NoCache > OnlineBeamMonitor::globalBeginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
) const
overrideprotected

Definition at line 123 of file OnlineBeamMonitor.cc.

124  {
125  // Always create a beamspot group for each lumi weather we have results or not! Each Beamspot will be of unknown type!
126 
127  processedLumis_.push_back(iLumi.id().luminosityBlock());
128  //Read BeamSpot from DB
130  ESHandle<BeamSpotOnlineObjects> bsLegacyHandle;
131  ESHandle<BeamSpotObjects> bsTransientHandle;
132 
133  if (auto bsHLTHandle = iSetup.getHandle(bsHLTToken_)) {
134  auto const& spotDB = *bsHLTHandle;
135 
136  // translate from BeamSpotObjects to reco::BeamSpot
137  BeamSpot::Point apoint(spotDB.GetX(), spotDB.GetY(), spotDB.GetZ());
138 
140  for (int i = 0; i < 7; ++i) {
141  for (int j = 0; j < 7; ++j) {
142  matrix(i, j) = spotDB.GetCovariance(i, j);
143  }
144  }
145 
146  beamSpotsMap_["HLT"] =
147  BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(), matrix);
148 
149  BeamSpot* aSpot = &(beamSpotsMap_["HLT"]);
150 
151  aSpot->setBeamWidthY(spotDB.GetBeamWidthY());
152  aSpot->setEmittanceX(spotDB.GetEmittanceX());
153  aSpot->setEmittanceY(spotDB.GetEmittanceY());
154  aSpot->setbetaStar(spotDB.GetBetaStar());
155 
156  if (spotDB.GetBeamType() == 2) {
157  aSpot->setType(reco::BeamSpot::Tracker);
158  } else {
159  aSpot->setType(reco::BeamSpot::Fake);
160  }
161  //LogInfo("OnlineBeamMonitor")
162  // << *aSpot << std::endl;
163  } else {
164  LogInfo("OnlineBeamMonitor") << "Database BeamSpot is not valid at lumi: " << iLumi.id().luminosityBlock();
165  }
166  if (auto bsLegacyHandle = iSetup.getHandle(bsLegacyToken_)) {
167  auto const& spotDB = *bsLegacyHandle;
168  // translate from BeamSpotObjects to reco::BeamSpot
169  BeamSpot::Point apoint(spotDB.GetX(), spotDB.GetY(), spotDB.GetZ());
170 
172  for (int i = 0; i < 7; ++i) {
173  for (int j = 0; j < 7; ++j) {
174  matrix(i, j) = spotDB.GetCovariance(i, j);
175  }
176  }
177 
178  beamSpotsMap_["Legacy"] =
179  BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(), matrix);
180 
181  BeamSpot* aSpot = &(beamSpotsMap_["Legacy"]);
182 
183  aSpot->setBeamWidthY(spotDB.GetBeamWidthY());
184  aSpot->setEmittanceX(spotDB.GetEmittanceX());
185  aSpot->setEmittanceY(spotDB.GetEmittanceY());
186  aSpot->setbetaStar(spotDB.GetBetaStar());
187 
188  if (spotDB.GetBeamType() == 2) {
189  aSpot->setType(reco::BeamSpot::Tracker);
190  } else {
191  aSpot->setType(reco::BeamSpot::Fake);
192  }
193  //LogInfo("OnlineBeamMonitor")
194  // << *aSpot << std::endl;
195  } else {
196  LogInfo("OnlineBeamMonitor") << "Database BeamSpot is not valid at lumi: " << iLumi.id().luminosityBlock();
197  }
198  if (auto bsTransientHandle = iSetup.getHandle(bsTransientToken_)) {
199  auto const& spotDB = *bsTransientHandle;
200 
201  // translate from BeamSpotObjects to reco::BeamSpot
202  BeamSpot::Point apoint(spotDB.GetX(), spotDB.GetY(), spotDB.GetZ());
203 
205  for (int i = 0; i < 7; ++i) {
206  for (int j = 0; j < 7; ++j) {
207  matrix(i, j) = spotDB.GetCovariance(i, j);
208  }
209  }
210 
211  beamSpotsMap_["Transient"] =
212  BeamSpot(apoint, spotDB.GetSigmaZ(), spotDB.Getdxdz(), spotDB.Getdydz(), spotDB.GetBeamWidthX(), matrix);
213 
214  BeamSpot* aSpot = &(beamSpotsMap_["Transient"]);
215 
216  aSpot->setBeamWidthY(spotDB.GetBeamWidthY());
217  aSpot->setEmittanceX(spotDB.GetEmittanceX());
218  aSpot->setEmittanceY(spotDB.GetEmittanceY());
219  aSpot->setbetaStar(spotDB.GetBetaStar());
220 
221  if (spotDB.GetBeamType() == 2) {
222  aSpot->setType(reco::BeamSpot::Tracker);
223  } else {
224  aSpot->setType(reco::BeamSpot::Fake);
225  }
226  //LogInfo("OnlineBeamMonitor")
227  // << *aSpot << std::endl;
228  } else {
229  LogInfo("OnlineBeamMonitor") << "Database BeamSpot is not valid at lumi: " << iLumi.id().luminosityBlock();
230  }
231  return nullptr;
232 }

References align::BeamSpot, beamSpotsMap_, bsHLTToken_, bsLegacyToken_, bsTransientToken_, reco::BeamSpot::Fake, edm::EventSetup::getHandle(), mps_fire::i, edm::LuminosityBlockBase::id(), dqmiolumiharvest::j, edm::LuminosityBlockID::luminosityBlock(), makeMuonMisalignmentScenario::matrix, processedLumis_, reco::BeamSpot::setBeamWidthY(), and reco::BeamSpot::Tracker.

◆ globalEndLuminosityBlock()

void OnlineBeamMonitor::globalEndLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 235 of file OnlineBeamMonitor.cc.

235  {
236  //Setting up the choice
237  if (beamSpotsMap_.find("Transient") != beamSpotsMap_.end()) {
238  if (beamSpotsMap_.find("HLT") != beamSpotsMap_.end() &&
239  beamSpotsMap_["Transient"].x0() == beamSpotsMap_["HLT"].x0()) {
240  bsChoice_->setBinContent(iLumi.id().luminosityBlock(), 1);
241  bsChoice_->setBinError(iLumi.id().luminosityBlock(), 0.05);
242  } else if (beamSpotsMap_.find("Legacy") != beamSpotsMap_.end() &&
243  beamSpotsMap_["Transient"].x0() == beamSpotsMap_["Legacy"].x0()) {
244  bsChoice_->setBinContent(iLumi.id().luminosityBlock(), -1);
245  bsChoice_->setBinError(iLumi.id().luminosityBlock(), 0.05);
246  } else {
247  bsChoice_->setBinContent(iLumi.id().luminosityBlock(), -10);
248  bsChoice_->setBinError(iLumi.id().luminosityBlock(), 0.05);
249  }
250  } else {
251  bsChoice_->setBinContent(iLumi.id().luminosityBlock(), 0);
252  bsChoice_->setBinError(iLumi.id().luminosityBlock(), 0.05);
253  }
254 
255  // "PV,BF..." Value,Error
256  map<std::string, pair<double, double> > resultsMap;
257  vector<pair<double, double> > vertexResults;
258  MonitorElement* histo = nullptr;
259  for (const auto& itV : varNamesV_) {
260  resultsMap.clear();
261  for (const auto& itBS : beamSpotsMap_) {
262  if (itBS.second.type() == BeamSpot::Tracker) {
263  if (itV == "x") {
264  resultsMap[itBS.first] = pair<double, double>(itBS.second.x0(), itBS.second.x0Error());
265  } else if (itV == "y") {
266  resultsMap[itBS.first] = pair<double, double>(itBS.second.y0(), itBS.second.y0Error());
267  } else if (itV == "z") {
268  resultsMap[itBS.first] = pair<double, double>(itBS.second.z0(), itBS.second.z0Error());
269  } else if (itV == "sigmaX") {
270  resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthX(), itBS.second.BeamWidthXError());
271  } else if (itV == "sigmaY") {
272  resultsMap[itBS.first] = pair<double, double>(itBS.second.BeamWidthY(), itBS.second.BeamWidthYError());
273  } else if (itV == "sigmaZ") {
274  resultsMap[itBS.first] = pair<double, double>(itBS.second.sigmaZ(), itBS.second.sigmaZ0Error());
275  } else {
276  LogInfo("OnlineBeamMonitor") << "The histosMap_ has been built with the name " << itV
277  << " that I can't recognize!";
278  }
279  }
280  }
281 
282  for (const auto& itM : histoByCategoryNames_) {
283  if ((histo = histosMap_[itV][itM.first][itM.second]) == nullptr)
284  continue;
285  if (itM.second == "Lumibased BeamSpotHLT") {
286  if (resultsMap.find("HLT") != resultsMap.end()) {
287  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["HLT"].first);
288  histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["HLT"].second);
289  }
290  } else if (itM.second == "Lumibased BeamSpotLegacy") {
291  if (resultsMap.find("Legacy") != resultsMap.end()) {
292  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["Legacy"].first);
293  histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["Legacy"].second);
294  }
295  } else if (itM.second == "Lumibased BeamSpotTransient") {
296  if (resultsMap.find("Transient") != resultsMap.end()) {
297  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["Transient"].first);
298  histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["Transient"].second);
299  }
300  } else {
301  LogInfo("OnlineBeamMonitor") << "The histosMap_ have a histogram named " << itM.second
302  << " that I can't recognize in this loop!";
303  }
304  }
305  }
306 }

References beamSpotsMap_, bsChoice_, timingPdfMaker::histo, histoByCategoryNames_, histosMap_, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), align::Tracker, and varNamesV_.

Member Data Documentation

◆ beamSpotsMap_

BeamSpotContainer OnlineBeamMonitor::beamSpotsMap_
mutableprivate

Definition at line 66 of file OnlineBeamMonitor.h.

Referenced by globalBeginLuminosityBlock(), and globalEndLuminosityBlock().

◆ bsChoice_

MonitorElement* OnlineBeamMonitor::bsChoice_
private

Definition at line 63 of file OnlineBeamMonitor.h.

Referenced by bookHistograms(), dqmEndRun(), and globalEndLuminosityBlock().

◆ bsHLTToken_

edm::ESGetToken<BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd> OnlineBeamMonitor::bsHLTToken_
private

Definition at line 55 of file OnlineBeamMonitor.h.

Referenced by globalBeginLuminosityBlock().

◆ bsLegacyToken_

edm::ESGetToken<BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd> OnlineBeamMonitor::bsLegacyToken_
private

Definition at line 56 of file OnlineBeamMonitor.h.

Referenced by globalBeginLuminosityBlock().

◆ bsTransientToken_

edm::ESGetToken<BeamSpotObjects, BeamSpotTransientObjectsRcd> OnlineBeamMonitor::bsTransientToken_
private

Definition at line 54 of file OnlineBeamMonitor.h.

Referenced by globalBeginLuminosityBlock().

◆ histoByCategoryNames_

std::multimap<std::string, std::string> OnlineBeamMonitor::histoByCategoryNames_
private

Definition at line 70 of file OnlineBeamMonitor.h.

Referenced by globalEndLuminosityBlock(), and OnlineBeamMonitor().

◆ histosMap_

HistosContainer OnlineBeamMonitor::histosMap_
private

◆ monitorName_

std::string OnlineBeamMonitor::monitorName_
private

Definition at line 53 of file OnlineBeamMonitor.h.

Referenced by bookHistograms(), and OnlineBeamMonitor().

◆ numberOfProcessedLumis_

int OnlineBeamMonitor::numberOfProcessedLumis_
mutableprivate

Definition at line 60 of file OnlineBeamMonitor.h.

◆ numberOfValuesToSave_

int OnlineBeamMonitor::numberOfValuesToSave_
private

Definition at line 59 of file OnlineBeamMonitor.h.

◆ positionsMap_

PositionContainer OnlineBeamMonitor::positionsMap_
private

Definition at line 68 of file OnlineBeamMonitor.h.

◆ processedLumis_

std::vector<int> OnlineBeamMonitor::processedLumis_
mutableprivate

Definition at line 61 of file OnlineBeamMonitor.h.

Referenced by dqmEndRun(), globalBeginLuminosityBlock(), and OnlineBeamMonitor().

◆ varNamesV_

std::vector<std::string> OnlineBeamMonitor::varNamesV_
private

Definition at line 69 of file OnlineBeamMonitor.h.

Referenced by globalEndLuminosityBlock(), and OnlineBeamMonitor().

runGCPTkAlMap.title
string title
Definition: runGCPTkAlMap.py:94
mps_fire.i
i
Definition: mps_fire.py:428
reco::BeamSpot::setBeamWidthY
void setBeamWidthY(double v)
Definition: BeamSpot.h:105
OnlineBeamMonitor::varNamesV_
std::vector< std::string > varNamesV_
Definition: OnlineBeamMonitor.h:69
makeMuonMisalignmentScenario.matrix
list matrix
Definition: makeMuonMisalignmentScenario.py:141
align::BeamSpot
Definition: StructureType.h:89
OnlineBeamMonitor::bsChoice_
MonitorElement * bsChoice_
Definition: OnlineBeamMonitor.h:63
OnlineBeamMonitor::processedLumis_
std::vector< int > processedLumis_
Definition: OnlineBeamMonitor.h:61
min
T min(T a, T b)
Definition: MathUtil.h:58
OnlineBeamMonitor::histosMap_
HistosContainer histosMap_
Definition: OnlineBeamMonitor.h:67
dqm::impl::MonitorElement::setEfficiencyFlag
void setEfficiencyFlag()
Definition: MonitorElement.h:267
edm::ParameterSetDescription
Definition: ParameterSetDescription.h:52
dqm::implementation::NavigatorBase::setCurrentFolder
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
timingPdfMaker.histo
histo
Definition: timingPdfMaker.py:279
OnlineBeamMonitor::histoByCategoryNames_
std::multimap< std::string, std::string > histoByCategoryNames_
Definition: OnlineBeamMonitor.h:70
dqm::legacy::MonitorElement
Definition: MonitorElement.h:461
edm::ParameterSet::getUntrackedParameter
T getUntrackedParameter(std::string const &, T const &) const
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
BeamSpotPI::lastLumi
Definition: BeamSpotPayloadInspectorHelper.h:38
align::Tracker
Definition: StructureType.h:70
OnlineBeamMonitor::monitorName_
std::string monitorName_
Definition: OnlineBeamMonitor.h:53
OnlineBeamMonitor::bsTransientToken_
edm::ESGetToken< BeamSpotObjects, BeamSpotTransientObjectsRcd > bsTransientToken_
Definition: OnlineBeamMonitor.h:54
reco::BeamSpot
Definition: BeamSpot.h:21
reco::BeamSpot::Tracker
Definition: BeamSpot.h:24
edm::ESHandle
Definition: DTSurvey.h:22
reco::BeamSpot::Fake
Definition: BeamSpot.h:24
OnlineBeamMonitor::bsHLTToken_
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd > bsHLTToken_
Definition: OnlineBeamMonitor.h:55
dqm::impl::MonitorElement::getTH1
virtual TH1 * getTH1()
Definition: MonitorElement.cc:969
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
edm::ParameterSetDescription::addUntracked
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
Definition: ParameterSetDescription.h:100
SiStripPI::max
Definition: SiStripPayloadInspectorHelper.h:169
edm::LuminosityBlockID::luminosityBlock
LuminosityBlockNumber_t luminosityBlock() const
Definition: LuminosityBlockID.h:42
edm::LuminosityBlockBase::id
LuminosityBlockID id() const
Definition: LuminosityBlockBase.h:44
edm::EventSetup::getHandle
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:148
OnlineBeamMonitor::beamSpotsMap_
BeamSpotContainer beamSpotsMap_
Definition: OnlineBeamMonitor.h:66
reco::BeamSpot::CovarianceMatrix
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
newFWLiteAna.bin
bin
Definition: newFWLiteAna.py:161
OnlineBeamMonitor::bsLegacyToken_
edm::ESGetToken< BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd > bsLegacyToken_
Definition: OnlineBeamMonitor.h:56
dqm::impl::MonitorElement::setBinContent
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
Definition: MonitorElement.cc:691
OnlineBeamMonitor::numberOfValuesToSave_
int numberOfValuesToSave_
Definition: OnlineBeamMonitor.h:59
dqm::impl::MonitorElement::setBinError
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Definition: MonitorElement.cc:709
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
reco::BeamSpot::Point
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
dqmiolumiharvest.j
j
Definition: dqmiolumiharvest.py:66
edm::ConfigurationDescriptions::addDefault
void addDefault(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:99
dqm::impl::MonitorElement::setAxisTitle
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
Definition: MonitorElement.cc:800
dqm::implementation::IBooker::book1D
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98