File indexing completed on 2024-04-06 12:06:52
0001 #ifndef DQM_BeamMonitor_OnlineBeamMonitor_h
0002 #define DQM_BeamMonitor_OnlineBeamMonitor_h
0003
0004
0005
0006
0007
0008
0009 #include <map>
0010 #include <vector>
0011 #include <string>
0012 #include <fstream>
0013
0014 #include "FWCore/Framework/interface/Frameworkfwd.h"
0015 #include "FWCore/Framework/interface/Event.h"
0016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0017 #include "FWCore/Utilities/interface/ESGetToken.h"
0018 #include "DQMServices/Core/interface/DQMStore.h"
0019 #include "DQMServices/Core/interface/DQMOneEDAnalyzer.h"
0020 #include "DataFormats/Provenance/interface/LuminosityBlockID.h"
0021 #include "DataFormats/BeamSpot/interface/BeamSpot.h"
0022 #include "CondFormats/BeamSpotObjects/interface/BeamSpotObjects.h"
0023 #include "CondFormats/BeamSpotObjects/interface/BeamSpotOnlineObjects.h"
0024 #include "CondFormats/DataRecord/interface/BeamSpotOnlineLegacyObjectsRcd.h"
0025 #include "CondFormats/DataRecord/interface/BeamSpotOnlineHLTObjectsRcd.h"
0026 #include "CondFormats/DataRecord/interface/BeamSpotTransientObjectsRcd.h"
0027
0028 namespace onlinebeammonitor {
0029 struct BeamSpotInfo {
0030 typedef std::map<std::string, reco::BeamSpot> BeamSpotContainer;
0031 BeamSpotContainer beamSpotsMap_;
0032 };
0033 }
0034
0035 class OnlineBeamMonitor : public DQMOneEDAnalyzer<edm::LuminosityBlockCache<onlinebeammonitor::BeamSpotInfo>> {
0036 public:
0037 OnlineBeamMonitor(const edm::ParameterSet&);
0038 static void fillDescriptions(edm::ConfigurationDescriptions&);
0039
0040 protected:
0041 void bookHistograms(DQMStore::IBooker&, edm::Run const&, edm::EventSetup const&) override;
0042 std::shared_ptr<onlinebeammonitor::BeamSpotInfo> globalBeginLuminosityBlock(
0043 const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) const override;
0044 void globalEndLuminosityBlock(const edm::LuminosityBlock& iLumi, const edm::EventSetup& iSetup) override;
0045 void dqmEndRun(edm::Run const&, edm::EventSetup const&) override;
0046
0047 private:
0048
0049
0050 typedef std::map<std::string, reco::BeamSpot> BeamSpotContainer;
0051
0052 typedef std::map<std::string, std::map<std::string, std::map<std::string, MonitorElement*>>> HistosContainer;
0053
0054 typedef std::map<std::string, std::map<std::string, std::map<std::string, int>>> PositionContainer;
0055
0056
0057 std::string monitorName_;
0058 edm::ESGetToken<BeamSpotObjects, BeamSpotTransientObjectsRcd> bsTransientToken_;
0059 edm::ESGetToken<BeamSpotOnlineObjects, BeamSpotOnlineHLTObjectsRcd> bsHLTToken_;
0060 edm::ESGetToken<BeamSpotOnlineObjects, BeamSpotOnlineLegacyObjectsRcd> bsLegacyToken_;
0061 std::ofstream fasciiDIP;
0062
0063
0064 int numberOfValuesToSave_;
0065 std::vector<int> processedLumis_;
0066
0067 MonitorElement* bsChoice_;
0068
0069
0070 HistosContainer histosMap_;
0071 PositionContainer positionsMap_;
0072 std::vector<std::string> varNamesV_;
0073 std::multimap<std::string, std::string> histoByCategoryNames_;
0074
0075
0076 bool appendRunTxt_;
0077 bool writeDIPTxt_;
0078 std::string outputDIPTxt_;
0079 };
0080
0081 #endif