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::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, 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 74 of file OnlineBeamMonitor.cc.

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

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 307 of file OnlineBeamMonitor.cc.

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

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

◆ fillDescriptions()

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

◆ globalBeginLuminosityBlock()

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

Definition at line 122 of file OnlineBeamMonitor.cc.

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

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 234 of file OnlineBeamMonitor.cc.

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

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:95
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:462
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:39
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:981
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
jetUpdater_cfi.sort
sort
Definition: jetUpdater_cfi.py:29
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:155
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
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
edm::ConfigurationDescriptions::addWithDefaultLabel
void addWithDefaultLabel(ParameterSetDescription const &psetDescription)
Definition: ConfigurationDescriptions.cc:87
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