CMS 3D CMS Logo

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

#include <AlcaBeamMonitor.h>

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

Public Member Functions

 AlcaBeamMonitor (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< alcabeammonitor::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
 
 EDProducer (const EDProducer &)=delete
 
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
 
const EDProduceroperator= (const EDProducer &)=delete
 
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
 
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)
 
 ~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 const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
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
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
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 analyze (const edm::Event &iEvent, const edm::EventSetup &iSetup) override
 
void bookHistograms (DQMStore::IBooker &, edm::Run const &, edm::EventSetup const &) override
 
void dqmEndRun (edm::Run const &, edm::EventSetup const &) override
 
std::shared_ptr
< alcabeammonitor::NoCache
globalBeginLuminosityBlock (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< alcabeammonitor::NoCache > >
virtual void dqmBeginRun (edm::Run const &, edm::EventSetup const &)
 
- Protected Member Functions inherited from edm::ProducerBase
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
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 ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
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...
 
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)
 
void resetItemsToGetFrom (BranchType iType)
 

Private Types

typedef std::map< std::string,
reco::BeamSpot
BeamSpotContainer
 
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_
 
const edm::ESGetToken
< BeamSpotObjects,
BeamSpotObjectsRcd
beamSpotToken_
 
MonitorElementhD0Phi0_
 
MonitorElementhDxyBS_
 
std::multimap< std::string,
std::string > 
histoByCategoryNames_
 
HistosContainer histosMap_
 
std::string monitorName_
 
int numberOfProcessedLumis_
 
int numberOfValuesToSave_
 
bool perLSsaving_
 
PositionContainer positionsMap_
 
const edm::EDGetTokenT
< reco::VertexCollection
primaryVertexLabel_
 
std::vector< int > processedLumis_
 
const edm::EDGetTokenT
< reco::BeamSpot
scalerLabel_
 
std::unique_ptr< BeamFittertheBeamFitter_
 
std::unique_ptr< PVFitterthePVFitter_
 
const edm::EDGetTokenT
< reco::TrackCollection
trackLabel_
 
std::vector< std::string > varNamesV_
 
std::vector
< reco::VertexCollection
vertices_
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer< edm::LuminosityBlockCache< alcabeammonitor::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< alcabeammonitor::NoCache > >
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 34 of file AlcaBeamMonitor.h.

Member Typedef Documentation

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

Definition at line 50 of file AlcaBeamMonitor.h.

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

Definition at line 52 of file AlcaBeamMonitor.h.

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

Definition at line 54 of file AlcaBeamMonitor.h.

Constructor & Destructor Documentation

AlcaBeamMonitor::AlcaBeamMonitor ( const edm::ParameterSet ps)

Definition at line 31 of file AlcaBeamMonitor.cc.

References edm::BeginLuminosityBlock, edm::EDConsumerBase::consumesCollector(), histoByCategoryNames_, histosMap_, monitorName_, perLSsaving_, processedLumis_, theBeamFitter_, thePVFitter_, and varNamesV_.

32  : monitorName_(ps.getUntrackedParameter<string>("MonitorName")),
33  primaryVertexLabel_(consumes<VertexCollection>(ps.getUntrackedParameter<InputTag>("PrimaryVertexLabel"))),
34  trackLabel_(consumes<reco::TrackCollection>(ps.getUntrackedParameter<InputTag>("TrackLabel"))),
35  scalerLabel_(consumes<BeamSpot>(ps.getUntrackedParameter<InputTag>("ScalerLabel"))),
36  beamSpotToken_(esConsumes<edm::Transition::BeginLuminosityBlock>()),
37  perLSsaving_(ps.getUntrackedParameter<bool>("perLSsaving", false)),
39  if (!monitorName_.empty())
40  monitorName_ = monitorName_ + "/";
41 
42  theBeamFitter_ = std::make_unique<BeamFitter>(ps, consumesCollector());
43  theBeamFitter_->resetTrkVector();
44  theBeamFitter_->resetLSRange();
45  theBeamFitter_->resetRefTime();
46  theBeamFitter_->resetPVFitter();
47 
48  thePVFitter_ = std::make_unique<PVFitter>(ps, consumesCollector());
49 
50  processedLumis_.clear();
51 
52  varNamesV_.push_back("x");
53  varNamesV_.push_back("y");
54  varNamesV_.push_back("z");
55  varNamesV_.push_back("sigmaX");
56  varNamesV_.push_back("sigmaY");
57  varNamesV_.push_back("sigmaZ");
58 
59  if (!perLSsaving_) {
60  histoByCategoryNames_.insert(pair<string, string>("run", "Coordinate"));
61  histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex fit-DataBase"));
62  histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex fit-BeamFit"));
63  histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex fit-Scalers"));
64  histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex-DataBase"));
65  histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex-BeamFit"));
66  histoByCategoryNames_.insert(pair<string, string>("run", "PrimaryVertex-Scalers"));
67 
68  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased BeamSpotFit"));
69  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased PrimaryVertex"));
70  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased DataBase"));
71  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased Scalers"));
72  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased PrimaryVertex-DataBase fit"));
73  histoByCategoryNames_.insert(pair<string, string>("lumi", "Lumibased PrimaryVertex-Scalers fit"));
74  histoByCategoryNames_.insert(pair<string, string>("validation", "Lumibased Scalers-DataBase fit"));
75  histoByCategoryNames_.insert(pair<string, string>("validation", "Lumibased PrimaryVertex-DataBase"));
76  histoByCategoryNames_.insert(pair<string, string>("validation", "Lumibased PrimaryVertex-Scalers"));
77  }
78 
79  for (vector<string>::iterator itV = varNamesV_.begin(); itV != varNamesV_.end(); itV++) {
80  for (multimap<string, string>::iterator itM = histoByCategoryNames_.begin(); itM != histoByCategoryNames_.end();
81  itM++) {
82  histosMap_[*itV][itM->first][itM->second] = nullptr;
83  }
84  }
85 }
T getUntrackedParameter(std::string const &, T const &) const
std::multimap< std::string, std::string > histoByCategoryNames_
std::vector< std::string > varNamesV_
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< int > processedLumis_
const edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > beamSpotToken_
std::unique_ptr< PVFitter > thePVFitter_
std::unique_ptr< BeamFitter > theBeamFitter_
HistosContainer histosMap_
std::string monitorName_
const edm::EDGetTokenT< reco::BeamSpot > scalerLabel_
const edm::EDGetTokenT< reco::TrackCollection > trackLabel_
const edm::EDGetTokenT< reco::VertexCollection > primaryVertexLabel_

Member Function Documentation

void AlcaBeamMonitor::analyze ( const edm::Event iEvent,
const edm::EventSetup iSetup 
)
overrideprotectedvirtual

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

Definition at line 279 of file AlcaBeamMonitor.cc.

References beamSpotsMap_, cppFunctionSkipper::exception, reco::BeamSpot::Fake, dqm::impl::MonitorElement::Fill(), edm::Event::getByToken(), hD0Phi0_, hDxyBS_, primaryVertexLabel_, edm::Handle< T >::product(), scalerLabel_, theBeamFitter_, thePVFitter_, HLT_FULL_cff::track, reco::BeamSpot::Tracker, trackLabel_, tracks, vertices_, and cms::Exception::what().

279  {
280  //------ BeamFitter
281  theBeamFitter_->readEvent(iEvent);
282  //------ PVFitter
283  thePVFitter_->readEvent(iEvent);
284 
285  if (beamSpotsMap_.find("DB") != beamSpotsMap_.end()) {
286  //------ Tracks
288  iEvent.getByToken(trackLabel_, TrackCollection);
289  const reco::TrackCollection* tracks = TrackCollection.product();
290  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) {
291  hD0Phi0_->Fill(track->phi(), -1 * track->dxy());
292  hDxyBS_->Fill(-1 * track->dxy(beamSpotsMap_["DB"].position()));
293  }
294  }
295 
296  //------ Primary Vertices
297  Handle<VertexCollection> PVCollection;
298  if (iEvent.getByToken(primaryVertexLabel_, PVCollection)) {
299  vertices_.push_back(*PVCollection.product());
300  }
301 
302  if (beamSpotsMap_.find("SC") == beamSpotsMap_.end()) {
303  //BeamSpot from file for this stream is = to the scalar BeamSpot
304  Handle<BeamSpot> recoBeamSpotHandle;
305  try {
306  iEvent.getByToken(scalerLabel_, recoBeamSpotHandle);
307  } catch (cms::Exception& exception) {
308  LogInfo("AlcaBeamMonitor") << exception.what();
309  return;
310  }
311  beamSpotsMap_["SC"] = *recoBeamSpotHandle;
312  if (beamSpotsMap_["SC"].BeamWidthX() != 0) {
313  beamSpotsMap_["SC"].setType(reco::BeamSpot::Tracker);
314  } else {
315  beamSpotsMap_["SC"].setType(reco::BeamSpot::Fake);
316  }
317  }
318 }
MonitorElement * hD0Phi0_
MonitorElement * hDxyBS_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:539
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
auto const & tracks
cannot be loose
void Fill(long long x)
BeamSpotContainer beamSpotsMap_
char const * what() const noexceptoverride
Definition: Exception.cc:103
Log< level::Info, false > LogInfo
std::unique_ptr< PVFitter > thePVFitter_
std::unique_ptr< BeamFitter > theBeamFitter_
T const * product() const
Definition: Handle.h:70
const edm::EDGetTokenT< reco::BeamSpot > scalerLabel_
const edm::EDGetTokenT< reco::TrackCollection > trackLabel_
const edm::EDGetTokenT< reco::VertexCollection > primaryVertexLabel_
std::vector< reco::VertexCollection > vertices_
void AlcaBeamMonitor::bookHistograms ( DQMStore::IBooker ibooker,
edm::Run const &  iRun,
edm::EventSetup const &  iSetup 
)
overrideprotectedvirtual

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

Definition at line 103 of file AlcaBeamMonitor.cc.

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

103  {
104  string name;
105  string title;
106  int firstLumi = 1;
107  int lastLumi = 3000;
108  for (HistosContainer::iterator itM = histosMap_.begin(); itM != histosMap_.end(); itM++) {
109  ibooker.setCurrentFolder(monitorName_ + "Debug");
110  for (map<string, MonitorElement*>::iterator itMM = itM->second["run"].begin(); itMM != itM->second["run"].end();
111  itMM++) {
112  name = string("h") + itM->first + itMM->first;
113  title = itM->first + "_{0} " + itMM->first;
114  if (itM->first == "x" || itM->first == "y") {
115  if (itMM->first == "Coordinate") {
116  itMM->second = ibooker.book1D(name, title, 1001, -0.2525, 0.2525);
117  } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" ||
118  itMM->first == "PrimaryVertex fit-Scalers" || itMM->first == "PrimaryVertex-DataBase" ||
119  itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Scalers") {
120  itMM->second = ibooker.book1D(name, title, 1001, -0.02525, 0.02525);
121  } else {
122  //assert(0);
123  }
124  } else if (itM->first == "z") {
125  if (itMM->first == "Coordinate") {
126  itMM->second = ibooker.book1D(name, title, 101, -5.05, 5.05);
127  } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" ||
128  itMM->first == "PrimaryVertex fit-Scalers") {
129  itMM->second = ibooker.book1D(name, title, 101, -0.505, 0.505);
130  } else if (itMM->first == "PrimaryVertex-DataBase" || itMM->first == "PrimaryVertex-BeamFit" ||
131  itMM->first == "PrimaryVertex-Scalers") {
132  itMM->second = ibooker.book1D(name, title, 1001, -5.005, 5.005);
133  } else {
134  //assert(0);
135  }
136  } else if (itM->first == "sigmaX" || itM->first == "sigmaY") {
137  if (itMM->first == "Coordinate") {
138  itMM->second = ibooker.book1D(name, title, 100, 0, 0.015);
139  } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" ||
140  itMM->first == "PrimaryVertex fit-Scalers" || itMM->first == "PrimaryVertex-DataBase" ||
141  itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Scalers") {
142  itMM->second = nullptr;
143  } else {
144  //assert(0);
145  }
146  } else if (itM->first == "sigmaZ") {
147  if (itMM->first == "Coordinate") {
148  itMM->second = ibooker.book1D(name, title, 110, 0, 11);
149  } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" ||
150  itMM->first == "PrimaryVertex fit-Scalers" || itMM->first == "PrimaryVertex-DataBase" ||
151  itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Scalers") {
152  itMM->second = ibooker.book1D(name, title, 101, -5.05, 5.05);
153  } else {
154  //assert(0);
155  }
156  } else {
157  //assert(0);
158  }
159  if (itMM->second != nullptr) {
160  if (itMM->first == "Coordinate") {
161  itMM->second->setAxisTitle(itM->first + "_{0} (cm)", 1);
162  } else if (itMM->first == "PrimaryVertex fit-DataBase" || itMM->first == "PrimaryVertex fit-BeamFit" ||
163  itMM->first == "PrimaryVertex fit-Scalers" || itMM->first == "PrimaryVertex-DataBase" ||
164  itMM->first == "PrimaryVertex-BeamFit" || itMM->first == "PrimaryVertex-Scalers") {
165  itMM->second->setAxisTitle(itMM->first + " " + itM->first + "_{0} (cm)", 1);
166  }
167  itMM->second->setAxisTitle("Entries", 2);
168  }
169  }
170 
171  //Making histos per Lumi
172  // x,y,z,sigmaX,sigmaY,sigmaZ
173  for (map<string, map<string, MonitorElement*> >::iterator itMM = itM->second.begin(); itMM != itM->second.end();
174  itMM++) {
175  if (itMM->first != "run") {
176  for (map<string, MonitorElement*>::iterator itMMM = itMM->second.begin(); itMMM != itMM->second.end();
177  itMMM++) {
178  name = string("h") + itM->first + itMMM->first;
179  title = itM->first + "_{0} " + itMMM->first;
180  if (itMM->first == "lumi") {
181  ibooker.setCurrentFolder(monitorName_ + "Debug");
182  itMMM->second = ibooker.book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
183  itMMM->second->setEfficiencyFlag();
184  } else if (itMM->first == "validation" && itMMM->first == "Lumibased Scalers-DataBase fit") {
185  ibooker.setCurrentFolder(monitorName_ + "Validation");
186  itMMM->second = ibooker.book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
187  itMMM->second->setEfficiencyFlag();
188  } else if (itMM->first == "validation" && itMMM->first != "Lumibased Scalers-DataBase fit" &&
189  (itM->first == "x" || itM->first == "y" || itM->first == "z")) {
190  ibooker.setCurrentFolder(monitorName_ + "Validation");
191  itMMM->second = ibooker.book1D(name, title, lastLumi - firstLumi + 1, firstLumi - 0.5, lastLumi + 0.5);
192  itMMM->second->setEfficiencyFlag();
193  } else if (itMM->first == "validation" &&
194  (itM->first == "sigmaX" || itM->first == "sigmaY" || itM->first == "sigmaZ")) {
195  ibooker.setCurrentFolder(monitorName_ + "Validation");
196  itMMM->second = nullptr;
197  } else {
198  LogInfo("AlcaBeamMonitorClient") << "Unrecognized category " << itMM->first;
199  // assert(0);
200  }
201  if (itMMM->second != nullptr) {
202  if (itMMM->first.find('-') != string::npos) {
203  itMMM->second->setAxisTitle(string("#Delta ") + itM->first + "_{0} (cm)", 2);
204  } else {
205  itMMM->second->setAxisTitle(itM->first + "_{0} (cm)", 2);
206  }
207  itMMM->second->setAxisTitle("Lumisection", 1);
208  }
209  }
210  }
211  }
212  }
213 
214  // create and cd into new folder
215  ibooker.setCurrentFolder(monitorName_ + "Validation");
216  //Book histograms
217  hD0Phi0_ = ibooker.bookProfile("hD0Phi0", "d_{0} vs. #phi_{0} (All Tracks)", 63, -3.15, 3.15, 100, -0.5, 0.5, "");
218  hD0Phi0_->setAxisTitle("#phi_{0} (rad)", 1);
219  hD0Phi0_->setAxisTitle("d_{0} (cm)", 2);
220 
221  ibooker.setCurrentFolder(monitorName_ + "Debug");
222  hDxyBS_ = ibooker.book1D("hDxyBS", "dxy_{0} w.r.t. Beam spot (All Tracks)", 100, -0.1, 0.1);
223  hDxyBS_->setAxisTitle("dxy_{0} w.r.t. Beam spot (cm)", 1);
224 }
MonitorElement * hD0Phi0_
MonitorElement * hDxyBS_
virtual void setCurrentFolder(std::string const &fullpath)
Definition: DQMStore.cc:32
MonitorElement * bookProfile(TString const &name, TString const &title, int nchX, double lowX, double highX, int, double lowY, double highY, char const *option="s", FUNC onbooking=NOOP())
Definition: DQMStore.h:322
Log< level::Info, false > LogInfo
HistosContainer histosMap_
std::string monitorName_
MonitorElement * book1D(TString const &name, TString const &title, int const nchX, double const lowX, double const highX, FUNC onbooking=NOOP())
Definition: DQMStore.h:98
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
void AlcaBeamMonitor::dqmEndRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

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

Definition at line 495 of file AlcaBeamMonitor.cc.

References newFWLiteAna::bin, histosMap_, BeamSpotPI::lastLumi, SiStripPI::max, min(), processedLumis_, and edm::second().

495  {
496  if (processedLumis_.empty()) {
497  return;
498  }
499 
500  const double bigNumber = 1000000.;
501  std::sort(processedLumis_.begin(), processedLumis_.end());
502  int firstLumi = *processedLumis_.begin();
503  int lastLumi = *(--processedLumis_.end());
504 
505  for (HistosContainer::iterator itH = histosMap_.begin(); itH != histosMap_.end(); itH++) {
506  for (map<string, map<string, MonitorElement*> >::iterator itHH = itH->second.begin(); itHH != itH->second.end();
507  itHH++) {
508  double min = bigNumber;
509  double max = -bigNumber;
510  double minDelta = bigNumber;
511  double maxDelta = -bigNumber;
512  // double minDeltaProf = bigNumber;
513  // double maxDeltaProf = -bigNumber;
514  if (itHH->first != "run") {
515  for (map<string, MonitorElement*>::iterator itHHH = itHH->second.begin(); itHHH != itHH->second.end();
516  itHHH++) {
517  if (itHHH->second != nullptr) {
518  for (int bin = 1; bin <= itHHH->second->getTH1()->GetNbinsX(); bin++) {
519  if (itHHH->second->getTH1()->GetBinError(bin) != 0 || itHHH->second->getTH1()->GetBinContent(bin) != 0) {
520  if (itHHH->first == "Lumibased BeamSpotFit" || itHHH->first == "Lumibased PrimaryVertex" ||
521  itHHH->first == "Lumibased DataBase" || itHHH->first == "Lumibased Scalers") {
522  if (min > itHHH->second->getTH1()->GetBinContent(bin)) {
523  min = itHHH->second->getTH1()->GetBinContent(bin);
524  }
525  if (max < itHHH->second->getTH1()->GetBinContent(bin)) {
526  max = itHHH->second->getTH1()->GetBinContent(bin);
527  }
528  } else if (itHHH->first == "Lumibased PrimaryVertex-DataBase fit" ||
529  itHHH->first == "Lumibased PrimaryVertex-Scalers fit" ||
530  itHHH->first == "Lumibased Scalers-DataBase fit" ||
531  itHHH->first == "Lumibased PrimaryVertex-DataBase" ||
532  itHHH->first == "Lumibased PrimaryVertex-Scalers") {
533  if (minDelta > itHHH->second->getTH1()->GetBinContent(bin)) {
534  minDelta = itHHH->second->getTH1()->GetBinContent(bin);
535  }
536  if (maxDelta < itHHH->second->getTH1()->GetBinContent(bin)) {
537  maxDelta = itHHH->second->getTH1()->GetBinContent(bin);
538  }
539  } else {
540  LogInfo("AlcaBeamMonitorClient") << "The histosMap_ have a histogram named " << itHHH->first
541  << " that I can't recognize in this loop!";
542  // assert(0);
543  }
544  }
545  }
546  }
547  }
548  for (map<string, MonitorElement*>::iterator itHHH = itHH->second.begin(); itHHH != itHH->second.end();
549  itHHH++) {
550  if (itHHH->second != nullptr) {
551  if (itHHH->first == "Lumibased BeamSpotFit" || itHHH->first == "Lumibased PrimaryVertex" ||
552  itHHH->first == "Lumibased DataBase" || itHHH->first == "Lumibased Scalers") {
553  if ((max == -bigNumber && min == bigNumber) || max - min == 0) {
554  itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum() - 0.01);
555  itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum() + 0.01);
556  } else {
557  itHHH->second->getTH1()->SetMinimum(min - 0.1 * (max - min));
558  itHHH->second->getTH1()->SetMaximum(max + 0.1 * (max - min));
559  }
560  } else if (itHHH->first == "Lumibased PrimaryVertex-DataBase fit" ||
561  itHHH->first == "Lumibased PrimaryVertex-Scalers fit" ||
562  itHHH->first == "Lumibased Scalers-DataBase fit" ||
563  itHHH->first == "Lumibased PrimaryVertex-DataBase" ||
564  itHHH->first == "Lumibased PrimaryVertex-Scalers") {
565  if ((maxDelta == -bigNumber && minDelta == bigNumber) || maxDelta - minDelta == 0) {
566  itHHH->second->getTH1()->SetMinimum(itHHH->second->getTH1()->GetMinimum() - 0.01);
567  itHHH->second->getTH1()->SetMaximum(itHHH->second->getTH1()->GetMaximum() + 0.01);
568  } else {
569  itHHH->second->getTH1()->SetMinimum(minDelta - 2 * (maxDelta - minDelta));
570  itHHH->second->getTH1()->SetMaximum(maxDelta + 2 * (maxDelta - minDelta));
571  }
572  } else {
573  LogInfo("AlcaBeamMonitorClient") << "The histosMap_ have a histogram named " << itHHH->first
574  << " that I can't recognize in this loop!";
575  }
576  itHHH->second->getTH1()->GetXaxis()->SetRangeUser(firstLumi - 0.5, lastLumi + 0.5);
577  }
578  }
579  }
580  }
581  }
582 }
U second(std::pair< T, U > const &p)
std::vector< int > processedLumis_
T min(T a, T b)
Definition: MathUtil.h:58
Log< level::Info, false > LogInfo
HistosContainer histosMap_
void AlcaBeamMonitor::fillDescriptions ( edm::ConfigurationDescriptions iDesc)
static

Definition at line 87 of file AlcaBeamMonitor.cc.

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

87  {
89 
90  ps.addUntracked<std::string>("MonitorName", "YourSubsystemName");
91  ps.addUntracked<edm::InputTag>("PrimaryVertexLabel");
92  ps.addUntracked<edm::InputTag>("TrackLabel");
93  ps.addUntracked<edm::InputTag>("ScalerLabel");
94  ps.addUntracked<bool>("perLSsaving");
95 
98 
99  iDesc.addDefault(ps);
100 }
ParameterDescriptionBase * addUntracked(U const &iLabel, T const &value)
void addDefault(ParameterSetDescription const &psetDescription)
static void fillDescription(edm::ParameterSetDescription &)
Definition: PVFitter.cc:97
static void fillDescription(edm::ParameterSetDescription &)
Definition: BeamFitter.cc:224
std::shared_ptr< alcabeammonitor::NoCache > AlcaBeamMonitor::globalBeginLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
) const
overrideprotected

Definition at line 227 of file AlcaBeamMonitor.cc.

References align::BeamSpot, beamSpotsMap_, beamSpotToken_, cppFunctionSkipper::exception, reco::BeamSpot::Fake, BeamSpotObjects::GetBeamType(), BeamSpotObjects::GetBeamWidthX(), BeamSpotObjects::GetBeamWidthY(), BeamSpotObjects::GetBetaStar(), BeamSpotObjects::GetCovariance(), BeamSpotObjects::Getdxdz(), BeamSpotObjects::Getdydz(), BeamSpotObjects::GetEmittanceX(), BeamSpotObjects::GetEmittanceY(), edm::EventSetup::getHandle(), BeamSpotObjects::GetSigmaZ(), BeamSpotObjects::GetX(), BeamSpotObjects::GetY(), BeamSpotObjects::GetZ(), mps_fire::i, edm::LuminosityBlockBase::id(), edm::ESHandleBase::isValid(), dqmiolumiharvest::j, edm::LuminosityBlockID::luminosityBlock(), makeMuonMisalignmentScenario::matrix, processedLumis_, edm::ESHandle< class >::product(), reco::BeamSpot::setBeamWidthY(), reco::BeamSpot::Tracker, vertices_, and cms::Exception::what().

228  {
229  // Always create a beamspot group for each lumi weather we have results or not! Each Beamspot will be of unknown type!
230 
231  vertices_.clear();
232  beamSpotsMap_.clear();
233  processedLumis_.push_back(iLumi.id().luminosityBlock());
234  //Read BeamSpot from DB
235  ESHandle<BeamSpotObjects> bsDBHandle;
236  try {
237  bsDBHandle = iSetup.getHandle(beamSpotToken_);
238  } catch (cms::Exception& exception) {
239  LogError("AlcaBeamMonitor") << exception.what();
240  return nullptr;
241  }
242  if (bsDBHandle.isValid()) { // check the product
243  const BeamSpotObjects* spotDB = bsDBHandle.product();
244 
245  // translate from BeamSpotObjects to reco::BeamSpot
246  BeamSpot::Point apoint(spotDB->GetX(), spotDB->GetY(), spotDB->GetZ());
247 
249  for (int i = 0; i < 7; ++i) {
250  for (int j = 0; j < 7; ++j) {
251  matrix(i, j) = spotDB->GetCovariance(i, j);
252  }
253  }
254 
255  beamSpotsMap_["DB"] =
256  BeamSpot(apoint, spotDB->GetSigmaZ(), spotDB->Getdxdz(), spotDB->Getdydz(), spotDB->GetBeamWidthX(), matrix);
257 
258  BeamSpot* aSpot = &(beamSpotsMap_["DB"]);
259 
260  aSpot->setBeamWidthY(spotDB->GetBeamWidthY());
261  aSpot->setEmittanceX(spotDB->GetEmittanceX());
262  aSpot->setEmittanceY(spotDB->GetEmittanceY());
263  aSpot->setbetaStar(spotDB->GetBetaStar());
264 
265  if (spotDB->GetBeamType() == 2) {
266  aSpot->setType(reco::BeamSpot::Tracker);
267  } else {
268  aSpot->setType(reco::BeamSpot::Fake);
269  }
270  //LogInfo("AlcaBeamMonitor")
271  // << *aSpot << std::endl;
272  } else {
273  LogInfo("AlcaBeamMonitor") << "Database BeamSpot is not valid at lumi: " << iLumi.id().luminosityBlock();
274  }
275  return nullptr;
276 }
double Getdydz() const
get dydz slope, crossing angle in YZ
LuminosityBlockID id() const
math::Error< dimension >::type CovarianceMatrix
Definition: BeamSpot.h:29
double GetY() const
get Y beam position
double GetSigmaZ() const
get sigma Z, RMS bunch length
double GetBeamWidthX() const
get average transverse beam width
math::XYZPoint Point
point in the space
Definition: BeamSpot.h:27
Log< level::Error, false > LogError
double GetBeamWidthY() const
get average transverse beam width
double GetEmittanceX() const
get emittance
void setBeamWidthY(double v)
Definition: BeamSpot.h:105
int GetBeamType() const
get beam type
BeamSpotContainer beamSpotsMap_
char const * what() const noexceptoverride
Definition: Exception.cc:103
std::vector< int > processedLumis_
double GetZ() const
get Z beam position
double Getdxdz() const
get dxdz slope, crossing angle in XZ
const edm::ESGetToken< BeamSpotObjects, BeamSpotObjectsRcd > beamSpotToken_
Log< level::Info, false > LogInfo
double GetX() const
get X beam position
T const * product() const
Definition: ESHandle.h:86
LuminosityBlockNumber_t luminosityBlock() const
double GetBetaStar() const
get beta star
double GetCovariance(int i, int j) const
get i,j element of the full covariance matrix 7x7
double GetEmittanceY() const
get emittance
ESHandle< T > getHandle(const ESGetToken< T, R > &iToken) const
Definition: EventSetup.h:157
bool isValid() const
Definition: ESHandle.h:44
std::vector< reco::VertexCollection > vertices_
void AlcaBeamMonitor::globalEndLuminosityBlock ( const edm::LuminosityBlock iLumi,
const edm::EventSetup iSetup 
)
overrideprotected

Definition at line 321 of file AlcaBeamMonitor.cc.

References beamSpotsMap_, dqm::impl::MonitorElement::Fill(), first, timingPdfMaker::histo, histoByCategoryNames_, histosMap_, edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), funct::pow(), MetAnalyzer::pv(), edm::second(), dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinError(), mathSSE::sqrt(), theBeamFitter_, thePVFitter_, align::Tracker, varNamesV_, trackerHitRTTI::vector, and vertices_.

321  {
322  if (theBeamFitter_->runPVandTrkFitter()) {
323  beamSpotsMap_["BF"] = theBeamFitter_->getBeamSpot();
324  }
325  theBeamFitter_->resetTrkVector();
326  theBeamFitter_->resetLSRange();
327  theBeamFitter_->resetRefTime();
328  theBeamFitter_->resetPVFitter();
329 
330  if (thePVFitter_->runFitter()) {
331  beamSpotsMap_["PV"] = thePVFitter_->getBeamSpot();
332  }
333  thePVFitter_->resetAll();
334 
335  // "PV,BF..." Value,Error
336  map<std::string, pair<double, double> > resultsMap;
337  vector<pair<double, double> > vertexResults;
338  MonitorElement* histo = nullptr;
339  for (vector<string>::iterator itV = varNamesV_.begin(); itV != varNamesV_.end(); itV++) {
340  resultsMap.clear();
341  for (BeamSpotContainer::iterator itBS = beamSpotsMap_.begin(); itBS != beamSpotsMap_.end(); itBS++) {
342  if (itBS->second.type() == BeamSpot::Tracker) {
343  if (*itV == "x") {
344  resultsMap[itBS->first] = pair<double, double>(itBS->second.x0(), itBS->second.x0Error());
345  } else if (*itV == "y") {
346  resultsMap[itBS->first] = pair<double, double>(itBS->second.y0(), itBS->second.y0Error());
347  } else if (*itV == "z") {
348  resultsMap[itBS->first] = pair<double, double>(itBS->second.z0(), itBS->second.z0Error());
349  } else if (*itV == "sigmaX") {
350  resultsMap[itBS->first] = pair<double, double>(itBS->second.BeamWidthX(), itBS->second.BeamWidthXError());
351  } else if (*itV == "sigmaY") {
352  resultsMap[itBS->first] = pair<double, double>(itBS->second.BeamWidthY(), itBS->second.BeamWidthYError());
353  } else if (*itV == "sigmaZ") {
354  resultsMap[itBS->first] = pair<double, double>(itBS->second.sigmaZ(), itBS->second.sigmaZ0Error());
355  } else {
356  LogInfo("AlcaBeamMonitor") << "The histosMap_ has been built with the name " << *itV
357  << " that I can't recognize!";
358  //assert(0);
359  }
360  }
361  }
362  vertexResults.clear();
363  for (vector<VertexCollection>::iterator itPV = vertices_.begin(); itPV != vertices_.end(); itPV++) {
364  if (!itPV->empty()) {
365  for (VertexCollection::const_iterator pv = itPV->begin(); pv != itPV->end(); pv++) {
366  if (pv->isFake() || pv->tracksSize() < 10)
367  continue;
368  if (*itV == "x") {
369  vertexResults.push_back(pair<double, double>(pv->x(), pv->xError()));
370  } else if (*itV == "y") {
371  vertexResults.push_back(pair<double, double>(pv->y(), pv->yError()));
372  } else if (*itV == "z") {
373  vertexResults.push_back(pair<double, double>(pv->z(), pv->zError()));
374  } else if (*itV != "sigmaX" && *itV != "sigmaY" && *itV != "sigmaZ") {
375  LogInfo("AlcaBeamMonitor") << "The histosMap_ has been built with the name " << *itV
376  << " that I can't recognize!";
377  //assert(0);
378  }
379  }
380  }
381  }
382 
383  for (multimap<string, string>::iterator itM = histoByCategoryNames_.begin(); itM != histoByCategoryNames_.end();
384  itM++) {
385  if ((histo = histosMap_[*itV][itM->first][itM->second]) == nullptr)
386  continue;
387  if (itM->second == "Coordinate") {
388  if (beamSpotsMap_.find("DB") != beamSpotsMap_.end()) {
389  histo->Fill(resultsMap["DB"].first);
390  }
391  } else if (itM->second == "PrimaryVertex fit-DataBase") {
392  if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()) {
393  histo->Fill(resultsMap["PV"].first - resultsMap["DB"].first);
394  }
395  } else if (itM->second == "PrimaryVertex fit-BeamFit") {
396  if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("BF") != resultsMap.end()) {
397  histo->Fill(resultsMap["PV"].first - resultsMap["BF"].first);
398  }
399  } else if (itM->second == "PrimaryVertex fit-Scalers") {
400  if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("SC") != resultsMap.end()) {
401  histo->Fill(resultsMap["PV"].first - resultsMap["SC"].first);
402  }
403  } else if (itM->second == "PrimaryVertex-DataBase") {
404  if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()) {
405  for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
406  itPV++) {
407  histo->Fill(itPV->first - resultsMap["DB"].first);
408  }
409  }
410  } else if (itM->second == "PrimaryVertex-BeamFit") {
411  if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("BF") != resultsMap.end()) {
412  for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
413  itPV++) {
414  histo->Fill(itPV->first - resultsMap["BF"].first);
415  }
416  }
417  } else if (itM->second == "PrimaryVertex-Scalers") {
418  if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("SC") != resultsMap.end()) {
419  for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
420  itPV++) {
421  histo->Fill(itPV->first - resultsMap["SC"].first);
422  }
423  }
424  } else if (itM->second == "Lumibased BeamSpotFit") {
425  if (resultsMap.find("BF") != resultsMap.end()) {
426  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["BF"].first);
427  histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["BF"].second);
428  }
429  } else if (itM->second == "Lumibased PrimaryVertex") {
430  if (resultsMap.find("PV") != resultsMap.end()) {
431  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["PV"].first);
432  histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["PV"].second);
433  }
434  } else if (itM->second == "Lumibased DataBase") {
435  if (resultsMap.find("DB") != resultsMap.end()) {
436  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["DB"].first);
437  histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["DB"].second);
438  }
439  } else if (itM->second == "Lumibased Scalers") {
440  if (resultsMap.find("SC") != resultsMap.end()) {
441  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["SC"].first);
442  histo->setBinError(iLumi.id().luminosityBlock(), resultsMap["SC"].second);
443  }
444  } else if (itM->second == "Lumibased PrimaryVertex-DataBase fit") {
445  if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()) {
446  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["PV"].first - resultsMap["DB"].first);
447  histo->setBinError(iLumi.id().luminosityBlock(),
448  std::sqrt(std::pow(resultsMap["PV"].second, 2) + std::pow(resultsMap["DB"].second, 2)));
449  }
450  } else if (itM->second == "Lumibased PrimaryVertex-Scalers fit") {
451  if (resultsMap.find("PV") != resultsMap.end() && resultsMap.find("SC") != resultsMap.end()) {
452  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["PV"].first - resultsMap["SC"].first);
453  histo->setBinError(iLumi.id().luminosityBlock(),
454  std::sqrt(std::pow(resultsMap["PV"].second, 2) + std::pow(resultsMap["SC"].second, 2)));
455  }
456  } else if (itM->second == "Lumibased Scalers-DataBase fit") {
457  if (resultsMap.find("SC") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()) {
458  histo->setBinContent(iLumi.id().luminosityBlock(), resultsMap["SC"].first - resultsMap["DB"].first);
459  histo->setBinError(iLumi.id().luminosityBlock(),
460  std::sqrt(std::pow(resultsMap["SC"].second, 2) + std::pow(resultsMap["DB"].second, 2)));
461  }
462  } else if (itM->second == "Lumibased PrimaryVertex-DataBase") {
463  if (resultsMap.find("DB") != resultsMap.end() && !vertexResults.empty()) {
464  for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
465  itPV++) {
466  histo->setBinContent(iLumi.id().luminosityBlock(), (*itPV).first - resultsMap["DB"].first);
467  histo->setBinError(iLumi.id().luminosityBlock(),
468  std::sqrt(std::pow((*itPV).second, 2) + std::pow(resultsMap["DB"].second, 2)));
469  }
470  }
471  } else if (itM->second == "Lumibased PrimaryVertex-Scalers") {
472  if (resultsMap.find("SC") != resultsMap.end() && !vertexResults.empty()) {
473  for (vector<pair<double, double> >::iterator itPV = vertexResults.begin(); itPV != vertexResults.end();
474  itPV++) {
475  histo->setBinContent(iLumi.id().luminosityBlock(), (*itPV).first - resultsMap["SC"].first);
476  histo->setBinError(iLumi.id().luminosityBlock(),
477  std::sqrt(std::pow((*itPV).second, 2) + std::pow(resultsMap["SC"].second, 2)));
478  }
479  }
480  }
481  // else if(itM->second == "Lumibased Scalers-DataBase"){
482  // if(resultsMap.find("SC") != resultsMap.end() && resultsMap.find("DB") != resultsMap.end()){
483  // itHHH->second->Fill(bin,resultsMap["SC"].first-resultsMap["DB"].first);
484  // }
485  // }
486  else {
487  LogInfo("AlcaBeamMonitor") << "The histosMap_ have a histogram named " << itM->second
488  << " that I can't recognize in this loop!";
489  //assert(0);
490  }
491  }
492  }
493 }
LuminosityBlockID id() const
std::multimap< std::string, std::string > histoByCategoryNames_
void Fill(long long x)
U second(std::pair< T, U > const &p)
std::vector< std::string > varNamesV_
T sqrt(T t)
Definition: SSEVec.h:19
BeamSpotContainer beamSpotsMap_
Log< level::Info, false > LogInfo
std::unique_ptr< PVFitter > thePVFitter_
std::unique_ptr< BeamFitter > theBeamFitter_
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
HistosContainer histosMap_
LuminosityBlockNumber_t luminosityBlock() const
virtual void setBinError(int binx, double error)
set uncertainty on content of bin (1-D)
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
std::vector< reco::VertexCollection > vertices_

Member Data Documentation

BeamSpotContainer AlcaBeamMonitor::beamSpotsMap_
mutableprivate

Definition at line 77 of file AlcaBeamMonitor.h.

Referenced by analyze(), globalBeginLuminosityBlock(), and globalEndLuminosityBlock().

const edm::ESGetToken<BeamSpotObjects, BeamSpotObjectsRcd> AlcaBeamMonitor::beamSpotToken_
private

Definition at line 61 of file AlcaBeamMonitor.h.

Referenced by globalBeginLuminosityBlock().

MonitorElement* AlcaBeamMonitor::hD0Phi0_
private

Definition at line 72 of file AlcaBeamMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* AlcaBeamMonitor::hDxyBS_
private

Definition at line 73 of file AlcaBeamMonitor.h.

Referenced by analyze(), and bookHistograms().

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

Definition at line 81 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and globalEndLuminosityBlock().

HistosContainer AlcaBeamMonitor::histosMap_
private
std::string AlcaBeamMonitor::monitorName_
private

Definition at line 57 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and bookHistograms().

int AlcaBeamMonitor::numberOfProcessedLumis_
mutableprivate

Definition at line 68 of file AlcaBeamMonitor.h.

int AlcaBeamMonitor::numberOfValuesToSave_
private

Definition at line 65 of file AlcaBeamMonitor.h.

bool AlcaBeamMonitor::perLSsaving_
private

Definition at line 62 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor().

PositionContainer AlcaBeamMonitor::positionsMap_
private

Definition at line 79 of file AlcaBeamMonitor.h.

const edm::EDGetTokenT<reco::VertexCollection> AlcaBeamMonitor::primaryVertexLabel_
private

Definition at line 58 of file AlcaBeamMonitor.h.

Referenced by analyze().

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

Definition at line 69 of file AlcaBeamMonitor.h.

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

const edm::EDGetTokenT<reco::BeamSpot> AlcaBeamMonitor::scalerLabel_
private

Definition at line 60 of file AlcaBeamMonitor.h.

Referenced by analyze().

std::unique_ptr<BeamFitter> AlcaBeamMonitor::theBeamFitter_
private

Definition at line 66 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), analyze(), and globalEndLuminosityBlock().

std::unique_ptr<PVFitter> AlcaBeamMonitor::thePVFitter_
private

Definition at line 67 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), analyze(), and globalEndLuminosityBlock().

const edm::EDGetTokenT<reco::TrackCollection> AlcaBeamMonitor::trackLabel_
private

Definition at line 59 of file AlcaBeamMonitor.h.

Referenced by analyze().

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

Definition at line 80 of file AlcaBeamMonitor.h.

Referenced by AlcaBeamMonitor(), and globalEndLuminosityBlock().

std::vector<reco::VertexCollection> AlcaBeamMonitor::vertices_
mutableprivate

Definition at line 82 of file AlcaBeamMonitor.h.

Referenced by analyze(), globalBeginLuminosityBlock(), and globalEndLuminosityBlock().