CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes
BeamMonitor Class Reference

#include <BeamMonitor.h>

Inheritance diagram for BeamMonitor:
DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks > edm::one::EDProducer< edm::EndRunProducer, edm::one::WatchRuns, edm::Accumulator, Args... > edm::one::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 BeamMonitor (const edm::ParameterSet &)
 
- Public Member Functions inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
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
 
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 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)
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c) override
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context) override
 
void bookHistograms (DQMStore::IBooker &i, const edm::Run &r, const edm::EventSetup &c) override
 
void dqmBeginRun (edm::Run const &, edm::EventSetup const &) override
 
void dqmEndRun (const edm::Run &r, const edm::EventSetup &c) override
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c) override
 
- Protected Member Functions inherited from edm::ProducerBase
template<Transition Tr = Transition::Event>
auto produces (std::string instanceName) noexcept
 declare what type of product will make and with which optional label More...
 
template<Transition B>
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)
 
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 ()
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , BranchType B>
BranchAliasSetterT< ProductType > produces ()
 
template<class ProductType >
BranchAliasSetterT< ProductType > produces (std::string instanceName)
 
template<typename ProductType , Transition B>
BranchAliasSetterT< ProductType > produces ()
 
template<Transition Tr = Transition::Event>
auto produces () noexcept
 
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< Bconsumes (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 ()
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag)
 
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 Member Functions

void FitAndFill (const edm::LuminosityBlock &lumiSeg, int &, int &, int &)
 
void formatFitTime (char *, const std::time_t &)
 
std::string getGMTstring (const std::time_t &)
 
void RestartFitting ()
 
void scrollTH1 (TH1 *, std::time_t)
 
bool testScroll (std::time_t &, std::time_t &)
 

Private Attributes

int beginLumiOfBSFit_
 
int beginLumiOfPVFit_
 
edm::EDGetTokenT< reco::BeamSpotbsSrc_
 
int countEvt_
 
int countGapLumi_
 
int countLumi_
 
MonitorElementcutFlowTable
 
int DBloggerReturn_
 
bool debug_
 
double deltaSigCut_
 
const int dxBin_
 
const double dxMax_
 
const double dxMin_
 
const int dzBin_
 
const double dzMax_
 
const double dzMin_
 
int endLumiOfBSFit_
 
int endLumiOfPVFit_
 
int firstAverageFit_
 
int fitNLumi_
 
int fitPVNLumi_
 
MonitorElementfitResults
 
int frun
 
edm::TimeValue_t ftimestamp
 
MonitorElementh_d0_phi0
 
MonitorElementh_nTrk_lumi
 
MonitorElementh_nVtx
 
MonitorElementh_nVtx_lumi
 
MonitorElementh_nVtx_lumi_all
 
MonitorElementh_nVtx_st
 
MonitorElementh_PVx [2]
 
MonitorElementh_PVxz
 
MonitorElementh_PVy [2]
 
MonitorElementh_PVyz
 
MonitorElementh_PVz [2]
 
MonitorElementh_sigmaX0
 
MonitorElementh_sigmaY0
 
MonitorElementh_sigmaZ0
 
MonitorElementh_trk_z0
 
MonitorElementh_trkPt
 
MonitorElementh_trkVz
 
MonitorElementh_vx_dz
 
MonitorElementh_vx_vy
 
MonitorElementh_vy_dz
 
MonitorElementh_x0
 
MonitorElementh_y0
 
MonitorElementh_z0
 
edm::EDGetTokenT< edm::TriggerResultshltSrc_
 
std::vector< MonitorElement * > hs
 
int intervalInSec_
 
std::vector< std::string > jetTrigger_
 
int lastlumi_
 
int lastNZbin
 
bool loggerActive_
 
bool logToDb_
 
std::map< int, int > mapBeginBSLS
 
std::map< int, std::time_t > mapBeginBSTime
 
std::map< int, int > mapBeginPVLS
 
std::map< int, std::time_t > mapBeginPVTime
 
std::map< int, std::size_t > mapLSBSTrkSize
 
std::map< int, TH1F > mapLSCF
 
std::map< int, size_t > mapLSPVStoreSize
 
std::map< int, std::vector< int > > mapNPV
 
std::map< int, std::vector< float > > mapPVx
 
std::map< int, std::vector< float > > mapPVy
 
std::map< int, std::vector< float > > mapPVz
 
double maxZ_
 
unsigned int min_Ntrks_
 
unsigned int minNrVertices_
 
double minVtxNdf_
 
double minVtxWgt_
 
std::string monitorName_
 
int nAnalyzedLS_
 
int nextlumi_
 
int nFitElements_
 
int nFits_
 
int nLS_for_upload_
 
unsigned int nthBSTrk_
 
edm::Service< cond::service::OnlineDBOutputServiceonlineDbService_
 
bool onlineMode_
 
const int phiBin_
 
const double phiMax_
 
const double phiMin_
 
reco::BeamSpot preBS
 
bool processed_
 
MonitorElementpvResults
 
edm::EDGetTokenT< reco::VertexCollectionpvSrc_
 
std::string recordName_
 
reco::BeamSpot refBS
 
std::time_t refBStime [2]
 
std::time_t refPVtime [2]
 
std::time_t refTime
 
MonitorElementreportSummary
 
Float_t reportSummary_
 
MonitorElementreportSummaryContents [3]
 
MonitorElementreportSummaryMap
 
int resetFitNLumi_
 
bool resetHistos_
 
int resetPVNLumi_
 
bool StartAverage_
 
std::time_t startTime
 
Float_t summaryContent_ [3]
 
Float_t summarySum_
 
edm::EDGetTokenT< TCDSRecordtcdsToken_
 
std::unique_ptr< BeamFittertheBeamFitter
 
std::time_t tmpTime
 
edm::EDGetTokenT< reco::TrackCollectiontracksLabel_
 
bool useLockRecords_
 
const int vxBin_
 
const double vxMax_
 
const double vxMin_
 

Additional Inherited Members

- Public Types inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
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
template<typename T >
using BranchAliasSetterT = ProductRegistryHelper::BranchAliasSetterT< T >
 
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
 
- 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 Attributes inherited from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >
edm::EDPutTokenT< DQMTokenrunToken_
 

Detailed Description

Definition at line 36 of file BeamMonitor.h.

Constructor & Destructor Documentation

◆ BeamMonitor()

BeamMonitor::BeamMonitor ( const edm::ParameterSet ps)

Definition at line 101 of file BeamMonitor.cc.

References beginLumiOfBSFit_, beginLumiOfPVFit_, bsSrc_, edm::EDConsumerBase::consumesCollector(), debug_, deltaSigCut_, endLumiOfBSFit_, endLumiOfPVFit_, fitNLumi_, fitPVNLumi_, edm::ParameterSet::getParameter(), edm::ParameterSet::getUntrackedParameter(), hltSrc_, intervalInSec_, jetTrigger_, lastlumi_, maxZ_, min_Ntrks_, minNrVertices_, minVtxNdf_, minVtxWgt_, monitorName_, nextlumi_, nFits_, nLS_for_upload_, onlineMode_, processed_, pvSrc_, recordName_, refBStime, refPVtime, resetFitNLumi_, resetPVNLumi_, tcdsToken_, theBeamFitter, tracksLabel_, and useLockRecords_.

102  : dxBin_(ps.getParameter<int>("dxBin")),
103  dxMin_(ps.getParameter<double>("dxMin")),
104  dxMax_(ps.getParameter<double>("dxMax")),
105 
106  vxBin_(ps.getParameter<int>("vxBin")),
107  vxMin_(ps.getParameter<double>("vxMin")),
108  vxMax_(ps.getParameter<double>("vxMax")),
109 
110  phiBin_(ps.getParameter<int>("phiBin")),
111  phiMin_(ps.getParameter<double>("phiMin")),
112  phiMax_(ps.getParameter<double>("phiMax")),
113 
114  dzBin_(ps.getParameter<int>("dzBin")),
115  dzMin_(ps.getParameter<double>("dzMin")),
116  dzMax_(ps.getParameter<double>("dzMax")),
117 
118  countEvt_(0),
119  countLumi_(0),
120  nthBSTrk_(0),
121  nFitElements_(3),
122  resetHistos_(false),
123  StartAverage_(false),
124  firstAverageFit_(0),
125  countGapLumi_(0),
126  logToDb_(false),
127  loggerActive_(false) {
128  monitorName_ = ps.getUntrackedParameter<string>("monitorName", "YourSubsystemName");
129  recordName_ = ps.getUntrackedParameter<string>("recordName");
130  bsSrc_ = consumes<reco::BeamSpot>(ps.getUntrackedParameter<InputTag>("beamSpot"));
131  tracksLabel_ = consumes<reco::TrackCollection>(
132  ps.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<InputTag>("TrackCollection"));
133  pvSrc_ = consumes<reco::VertexCollection>(ps.getUntrackedParameter<InputTag>("primaryVertex"));
134  hltSrc_ = consumes<TriggerResults>(ps.getUntrackedParameter<InputTag>("hltResults"));
135  intervalInSec_ = ps.getUntrackedParameter<int>("timeInterval", 920); //40 LS X 23"
136  fitNLumi_ = ps.getUntrackedParameter<int>("fitEveryNLumi", -1);
137  resetFitNLumi_ = ps.getUntrackedParameter<int>("resetEveryNLumi", -1);
138  fitPVNLumi_ = ps.getUntrackedParameter<int>("fitPVEveryNLumi", -1);
139  resetPVNLumi_ = ps.getUntrackedParameter<int>("resetPVEveryNLumi", -1);
140  deltaSigCut_ = ps.getUntrackedParameter<double>("deltaSignificanceCut", 15);
141  debug_ = ps.getUntrackedParameter<bool>("Debug");
142  onlineMode_ = ps.getUntrackedParameter<bool>("OnlineMode");
143  jetTrigger_ = ps.getUntrackedParameter<std::vector<std::string> >("jetTrigger");
144  min_Ntrks_ = ps.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<int>("MinimumInputTracks");
145  maxZ_ = ps.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<double>("MaximumZ");
146  minNrVertices_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit");
147  minVtxNdf_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf");
148  minVtxWgt_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight");
149  useLockRecords_ = ps.getUntrackedParameter<bool>("useLockRecords");
150  nLS_for_upload_ = ps.getUntrackedParameter<int>("nLSForUpload", 5);
151  if (!monitorName_.empty())
152  monitorName_ = monitorName_ + "/";
153 
154  theBeamFitter = std::make_unique<BeamFitter>(ps, consumesCollector());
155  theBeamFitter->resetTrkVector();
156  theBeamFitter->resetLSRange();
157  theBeamFitter->resetRefTime();
158  theBeamFitter->resetPVFitter();
159 
160  if (fitNLumi_ <= 0)
161  fitNLumi_ = 1;
163  refBStime[0] = refBStime[1] = refPVtime[0] = refPVtime[1] = 0;
164  maxZ_ = std::fabs(maxZ_);
165  lastlumi_ = 0;
166  nextlumi_ = 0;
167  processed_ = false;
168 
169  tcdsToken_ = consumes<TCDSRecord>(ps.getUntrackedParameter<InputTag>("tcdsRecord"));
170 }
edm::EDGetTokenT< edm::TriggerResults > hltSrc_
Definition: BeamMonitor.h:82
const double phiMax_
Definition: BeamMonitor.h:72
std::unique_ptr< BeamFitter > theBeamFitter
Definition: BeamMonitor.h:95
bool loggerActive_
Definition: BeamMonitor.h:130
unsigned int minNrVertices_
Definition: BeamMonitor.h:113
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
int nFitElements_
Definition: BeamMonitor.h:108
std::time_t refBStime[2]
Definition: BeamMonitor.h:105
edm::EDGetTokenT< TCDSRecord > tcdsToken_
Definition: BeamMonitor.h:128
int endLumiOfPVFit_
Definition: BeamMonitor.h:102
int resetFitNLumi_
Definition: BeamMonitor.h:88
const double dzMin_
Definition: BeamMonitor.h:75
double minVtxWgt_
Definition: BeamMonitor.h:115
std::string recordName_
Definition: BeamMonitor.h:78
double minVtxNdf_
Definition: BeamMonitor.h:114
bool processed_
Definition: BeamMonitor.h:122
edm::EDGetTokenT< reco::VertexCollection > pvSrc_
Definition: BeamMonitor.h:81
const double phiMin_
Definition: BeamMonitor.h:71
int nLS_for_upload_
Definition: BeamMonitor.h:126
const int dxBin_
Definition: BeamMonitor.h:62
const int vxBin_
Definition: BeamMonitor.h:66
std::vector< std::string > jetTrigger_
Definition: BeamMonitor.h:93
int fitPVNLumi_
Definition: BeamMonitor.h:87
T getUntrackedParameter(std::string const &, T const &) const
const double dzMax_
Definition: BeamMonitor.h:76
int intervalInSec_
Definition: BeamMonitor.h:90
const double dxMin_
Definition: BeamMonitor.h:63
int countGapLumi_
Definition: BeamMonitor.h:120
edm::EDGetTokenT< reco::TrackCollection > tracksLabel_
Definition: BeamMonitor.h:80
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
int endLumiOfBSFit_
Definition: BeamMonitor.h:100
std::time_t refPVtime[2]
Definition: BeamMonitor.h:106
double maxZ_
Definition: BeamMonitor.h:112
const int phiBin_
Definition: BeamMonitor.h:70
bool StartAverage_
Definition: BeamMonitor.h:118
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: BeamMonitor.h:79
const double dxMax_
Definition: BeamMonitor.h:64
const double vxMin_
Definition: BeamMonitor.h:67
int beginLumiOfPVFit_
Definition: BeamMonitor.h:101
const double vxMax_
Definition: BeamMonitor.h:68
int resetPVNLumi_
Definition: BeamMonitor.h:89
const int dzBin_
Definition: BeamMonitor.h:74
bool useLockRecords_
Definition: BeamMonitor.h:123
unsigned int nthBSTrk_
Definition: BeamMonitor.h:107
unsigned int min_Ntrks_
Definition: BeamMonitor.h:111
bool resetHistos_
Definition: BeamMonitor.h:117
double deltaSigCut_
Definition: BeamMonitor.h:110
int firstAverageFit_
Definition: BeamMonitor.h:119
int beginLumiOfBSFit_
Definition: BeamMonitor.h:99
std::string monitorName_
Definition: BeamMonitor.h:77
int countLumi_
Definition: BeamMonitor.h:98
bool onlineMode_
Definition: BeamMonitor.h:92

Member Function Documentation

◆ analyze()

void BeamMonitor::analyze ( const edm::Event e,
const edm::EventSetup c 
)
overrideprotectedvirtual

Reimplemented from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 668 of file BeamMonitor.cc.

References HLT_2023v12_cff::beamMode, bsSrc_, countEvt_, countLumi_, cutFlowTable, dqm::impl::MonitorElement::Fill(), newFWLiteAna::found, BSTRecord::getBeamMode(), TCDSRecord::getBST(), dqm::impl::MonitorElement::getTH1(), h_nVtx, h_nVtx_st, h_PVx, h_PVxz, h_PVy, h_PVyz, h_PVz, h_trkPt, h_trkVz, hltSrc_, mps_fire::i, iEvent, jetTrigger_, logToDb_, mapNPV, mapPVx, mapPVy, mapPVz, minVtxNdf_, minVtxWgt_, dqmiodumpmetadata::n, nextlumi_, onlineMode_, processed_, MetAnalyzer::pv(), L1TEGammaOffline_cfi::PVCollection, pvSrc_, refBS, dqm::impl::MonitorElement::Reset(), resetFitNLumi_, dqm::impl::MonitorElement::setBinLabel(), StartAverage_, AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, tcdsToken_, theBeamFitter, HLT_2023v12_cff::track, pwdgSkimBPark_cfi::tracks, tracksLabel_, triggerResults, cscTnPEfficiencyTask_cfi::trigName, and trigNames.

668  {
669  const TCDSRecord& tcdsData = iEvent.get(tcdsToken_);
670  int beamMode = tcdsData.getBST().getBeamMode();
671 
672  // Check that the beamMode information is available in the event content
673  if (beamMode == BSTRecord::BeamMode::NOMODE)
674  edm::LogError("BeamMonitor") << "No BeamMode identified from BSTRecord!"
675  "Please check that the event content has the raw data from TCDS FEDs (1024,1025)!";
676 
677  // Check if stable beams are present
678  if (beamMode == BSTRecord::BeamMode::STABLE)
679  logToDb_ = true;
680 
681  const int nthlumi = iEvent.luminosityBlock();
682  if (onlineMode_ && (nthlumi < nextlumi_)) {
683  edm::LogInfo("BeamMonitor") << "analyze:: Spilt event from previous lumi section!" << std::endl;
684  return;
685  }
686  if (onlineMode_ && (nthlumi > nextlumi_)) {
687  edm::LogInfo("BeamMonitor") << "analyze:: Spilt event from next lumi section!!!" << std::endl;
688  return;
689  }
690 
691  countEvt_++;
692  theBeamFitter->readEvent(
693  iEvent); //Remember when track fitter read the event in the same place the PVFitter read the events !!!!!!!!!
694 
695  Handle<reco::BeamSpot> recoBeamSpotHandle;
696  iEvent.getByToken(bsSrc_, recoBeamSpotHandle);
697  refBS = *recoBeamSpotHandle;
698 
699  //------Cut Flow Table filled every event!--------------------------------------
700  {
701  // Make a copy of the cut flow table from the beam fitter.
702  auto tmphisto = static_cast<TH1F*>(theBeamFitter->getCutFlow());
703  cutFlowTable->getTH1()->SetBins(
704  tmphisto->GetNbinsX(), tmphisto->GetXaxis()->GetXmin(), tmphisto->GetXaxis()->GetXmax());
705  // Update the bin labels
706  if (countEvt_ == 1) // SetLabel just once
707  for (int n = 0; n < tmphisto->GetNbinsX(); n++)
708  cutFlowTable->setBinLabel(n + 1, tmphisto->GetXaxis()->GetBinLabel(n + 1), 1);
709  cutFlowTable->Reset();
710  cutFlowTable->getTH1()->Add(tmphisto);
711  }
712 
713  //----Reco tracks -------------------------------------
715  iEvent.getByToken(tracksLabel_, TrackCollection);
716  const reco::TrackCollection* tracks = TrackCollection.product();
717  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) {
718  h_trkPt->Fill(track->pt()); //no need to change here for average bs
719  h_trkVz->Fill(track->vz());
720  }
721 
722  //-------HLT Trigger --------------------------------
724  bool JetTrigPass = false;
725  if (iEvent.getByToken(hltSrc_, triggerResults)) {
726  const edm::TriggerNames& trigNames = iEvent.triggerNames(*triggerResults);
727  for (unsigned int i = 0; i < triggerResults->size(); i++) {
728  const std::string& trigName = trigNames.triggerName(i);
729 
730  if (JetTrigPass)
731  continue;
732 
733  for (size_t t = 0; t < jetTrigger_.size(); ++t) {
734  if (JetTrigPass)
735  continue;
736 
737  string string_search(jetTrigger_[t]);
738  size_t found = trigName.find(string_search);
739 
740  if (found != string::npos) {
741  int thisTrigger_ = trigNames.triggerIndex(trigName);
742  if (triggerResults->accept(thisTrigger_))
743  JetTrigPass = true;
744  } //if trigger found
745  } //for(t=0;..)
746  } //for(i=0; ..)
747  } //if trigger colleciton exist)
748 
749  //------ Primary Vertices-------
751 
752  if (iEvent.getByToken(pvSrc_, PVCollection)) {
753  int nPVcount = 0;
754  int nPVcount_ST = 0; //For Single Trigger(hence ST)
755 
756  for (reco::VertexCollection::const_iterator pv = PVCollection->begin(); pv != PVCollection->end(); ++pv) {
757  //--- vertex selection
758  if (pv->isFake() || pv->tracksSize() == 0)
759  continue;
760  nPVcount++; // count non fake pv:
761 
762  if (JetTrigPass)
763  nPVcount_ST++; //non-fake pv with a specific trigger
764 
765  if (pv->ndof() < minVtxNdf_ || (pv->ndof() + 3.) / pv->tracksSize() < 2 * minVtxWgt_)
766  continue;
767 
768  //Fill this map to store xyx for pv so that later we can remove the first one for run aver
769  mapPVx[countLumi_].push_back(pv->x());
770  mapPVy[countLumi_].push_back(pv->y());
771  mapPVz[countLumi_].push_back(pv->z());
772 
773  if (!StartAverage_) { //for first N LS
774  h_PVx[0]->Fill(pv->x());
775  h_PVy[0]->Fill(pv->y());
776  h_PVz[0]->Fill(pv->z());
777  h_PVxz->Fill(pv->z(), pv->x());
778  h_PVyz->Fill(pv->z(), pv->y());
779  } //for first N LiS
780  else {
781  h_PVxz->Fill(pv->z(), pv->x());
782  h_PVyz->Fill(pv->z(), pv->y());
783  }
784 
785  } //loop over pvs
786 
787  h_nVtx->Fill(nPVcount * 1.); //no need to change it for average BS
788 
789  mapNPV[countLumi_].push_back((nPVcount_ST));
790 
791  if (!StartAverage_) {
792  h_nVtx_st->Fill(nPVcount_ST * 1.);
793  }
794 
795  } //if pv collection is availaable
796 
797  if (StartAverage_) {
798  map<int, std::vector<float> >::iterator itpvx = mapPVx.begin();
799  map<int, std::vector<float> >::iterator itpvy = mapPVy.begin();
800  map<int, std::vector<float> >::iterator itpvz = mapPVz.begin();
801 
802  map<int, std::vector<int> >::iterator itbspvinfo = mapNPV.begin();
803 
804  if ((int)mapPVx.size() > resetFitNLumi_) { //sometimes the events is not there but LS is there!
805  mapPVx.erase(itpvx);
806  mapPVy.erase(itpvy);
807  mapPVz.erase(itpvz);
808  mapNPV.erase(itbspvinfo);
809  } //loop over Last N lumi collected
810 
811  } //StartAverage==true
812 
813  processed_ = true;
814 }
edm::EDGetTokenT< edm::TriggerResults > hltSrc_
Definition: BeamMonitor.h:82
std::unique_ptr< BeamFitter > theBeamFitter
Definition: BeamMonitor.h:95
edm::EDGetTokenT< TCDSRecord > tcdsToken_
Definition: BeamMonitor.h:128
int resetFitNLumi_
Definition: BeamMonitor.h:88
MonitorElement * h_nVtx
Definition: BeamMonitor.h:156
double minVtxWgt_
Definition: BeamMonitor.h:115
MonitorElement * cutFlowTable
Definition: BeamMonitor.h:185
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:160
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:167
MonitorElement * h_PVxz
Definition: BeamMonitor.h:161
double minVtxNdf_
Definition: BeamMonitor.h:114
bool processed_
Definition: BeamMonitor.h:122
edm::EDGetTokenT< reco::VertexCollection > pvSrc_
Definition: BeamMonitor.h:81
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
Log< level::Error, false > LogError
std::vector< std::string > jetTrigger_
Definition: BeamMonitor.h:93
Class to contain information from TCDS FED.
Definition: TCDSRecord.h:19
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:167
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:168
void Fill(long long x)
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
int iEvent
Definition: GenABIO.cc:224
edm::EDGetTokenT< reco::TrackCollection > tracksLabel_
Definition: BeamMonitor.h:80
MonitorElement * h_PVyz
Definition: BeamMonitor.h:162
def pv(vc)
Definition: MetAnalyzer.py:7
reco::BeamSpot refBS
Definition: BeamMonitor.h:135
static std::string const triggerResults
Definition: EdmProvDump.cc:47
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
const BSTRecord & getBST() const
Definition: TCDSRecord.h:100
uint16_t const getBeamMode() const
Definition: BSTRecord.h:70
Log< level::Info, false > LogInfo
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
bool StartAverage_
Definition: BeamMonitor.h:118
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: BeamMonitor.h:79
MonitorElement * h_nVtx_st
Definition: BeamMonitor.h:157
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:159
MonitorElement * h_trkPt
Definition: BeamMonitor.h:147
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:158
MonitorElement * h_trkVz
Definition: BeamMonitor.h:148
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:167
int countLumi_
Definition: BeamMonitor.h:98
bool onlineMode_
Definition: BeamMonitor.h:92

◆ beginLuminosityBlock()

void BeamMonitor::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprotected

Definition at line 536 of file BeamMonitor.cc.

References beginLumiOfBSFit_, beginLumiOfPVFit_, edm::LuminosityBlockBase::beginTime(), countLumi_, DBloggerReturn_, debug_, FitAndFill(), edm::LuminosityBlock::getRun(), edm::Service< T >::isAvailable(), lastlumi_, cond::service::PoolDBOutputService::logger(), loggerActive_, cond::persistency::Logger::logInfo(), logToDb_, edm::LuminosityBlockBase::luminosityBlock(), mapBeginBSLS, mapBeginBSTime, mapBeginPVLS, mapBeginPVTime, nAnalyzedLS_, nextlumi_, onlineDbService_, onlineMode_, processed_, refBStime, refPVtime, edm::RunBase::run(), cond::persistency::Logger::start(), StartAverage_, and edm::Timestamp::value().

536  {
537  // start DB logger
538  DBloggerReturn_ = 0;
539  nAnalyzedLS_++;
542  loggerActive_ = true;
543  onlineDbService_->logger().logInfo() << "BeamMonitor::beginLuminosityBlock - LS: " << lumiSeg.luminosityBlock()
544  << " - Run: " << lumiSeg.getRun().run();
545  }
546 
547  int nthlumi = lumiSeg.luminosityBlock();
548  const edm::TimeValue_t fbegintimestamp = lumiSeg.beginTime().value();
549  const std::time_t ftmptime = fbegintimestamp >> 32;
550 
551  if (countLumi_ == 0 && (!processed_)) {
553  refBStime[0] = refPVtime[0] = ftmptime;
554  mapBeginBSLS[countLumi_] = nthlumi;
555  mapBeginPVLS[countLumi_] = nthlumi;
556  mapBeginBSTime[countLumi_] = ftmptime;
557  mapBeginPVTime[countLumi_] = ftmptime;
558  } //for the first record
559 
560  if (nthlumi > nextlumi_) {
561  if (processed_) {
562  countLumi_++;
563  //store here them will need when we remove the first one of Last N LS
564  mapBeginBSLS[countLumi_] = nthlumi;
565  mapBeginPVLS[countLumi_] = nthlumi;
566  mapBeginBSTime[countLumi_] = ftmptime;
567  mapBeginPVTime[countLumi_] = ftmptime;
568  } //processed passed but not the first lumi
569  if ((!processed_) && countLumi_ != 0) {
570  mapBeginBSLS[countLumi_] = nthlumi;
571  mapBeginPVLS[countLumi_] = nthlumi;
572  mapBeginBSTime[countLumi_] = ftmptime;
573  mapBeginPVTime[countLumi_] = ftmptime;
574  } //processed fails for last lumi
575  } //nthLumi > nextlumi
576 
577  if (StartAverage_) {
578  //Just Make sure it get rest
579  refBStime[0] = 0;
580  refPVtime[0] = 0;
581  beginLumiOfPVFit_ = 0;
582  beginLumiOfBSFit_ = 0;
583 
584  if (debug_)
585  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock: Size of mapBeginBSLS before = " << mapBeginBSLS.size()
586  << endl;
587  if (nthlumi >
588  nextlumi_) { //this make sure that it does not take into account this lumi for fitting and only look forward for new lumi
589  //as countLumi also remains the same so map value get overwritten once return to normal running.
590  //even if few LS are misssing and DQM module do not sees them then it catchs up again
591  map<int, int>::iterator itbs = mapBeginBSLS.begin();
592  map<int, int>::iterator itpv = mapBeginPVLS.begin();
593  map<int, std::time_t>::iterator itbstime = mapBeginBSTime.begin();
594  map<int, std::time_t>::iterator itpvtime = mapBeginPVTime.begin();
595 
596  if (processed_) { // otherwise if false then LS range of fit get messed up because we don't remove trk/pvs but we remove LS begin value . This prevent it as it happened if LS is there but no event are processed for some reason
597  mapBeginBSLS.erase(itbs);
598  mapBeginPVLS.erase(itpv);
599  mapBeginBSTime.erase(itbstime);
600  mapBeginPVTime.erase(itpvtime);
601  }
602  /*//not sure if want this or not ??
603  map<int, int>::iterator itgapb=mapBeginBSLS.begin();
604  map<int, int>::iterator itgape=mapBeginBSLS.end(); itgape--;
605  countGapLumi_ = ( (itgape->second) - (itgapb->second) );
606  //if we see Gap more than then 2*resetNFitLumi !!!!!!!
607  //for example if 10-15 is fitted and if 16-25 are missing then we next fit will be for range 11-26 but BS can change in between
608  // so better start as fresh and reset everything like starting in the begining!
609  if(countGapLumi_ >= 2*resetFitNLumi_){RestartFitting(); mapBeginBSLS[countLumi_] = nthlumi;}
610  */
611  }
612 
613  if (debug_)
614  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Size of mapBeginBSLS After = " << mapBeginBSLS.size()
615  << endl;
616 
617  map<int, int>::iterator bbs = mapBeginBSLS.begin();
618  map<int, int>::iterator bpv = mapBeginPVLS.begin();
619  map<int, std::time_t>::iterator bbst = mapBeginBSTime.begin();
620  map<int, std::time_t>::iterator bpvt = mapBeginPVTime.begin();
621 
622  if (beginLumiOfPVFit_ == 0)
623  beginLumiOfPVFit_ = bpv->second; //new begin time after removing the LS
624  if (beginLumiOfBSFit_ == 0)
625  beginLumiOfBSFit_ = bbs->second;
626  if (refBStime[0] == 0)
627  refBStime[0] = bbst->second;
628  if (refPVtime[0] == 0)
629  refPVtime[0] = bpvt->second;
630 
631  } //same logic for average fit as above commented line
632 
633  map<int, std::time_t>::iterator nbbst = mapBeginBSTime.begin();
634  map<int, std::time_t>::iterator nbpvt = mapBeginPVTime.begin();
635 
636  if (onlineMode_ && (nthlumi < nextlumi_))
637  return;
638 
639  if (onlineMode_) {
640  if (nthlumi > nextlumi_) {
641  if (countLumi_ != 0 && processed_)
642  FitAndFill(lumiSeg, lastlumi_, nextlumi_, nthlumi);
643  nextlumi_ = nthlumi;
644  edm::LogInfo("BeamMonitor") << "beginLuminosityBlock:: Next Lumi to Fit: " << nextlumi_ << endl;
645  if ((StartAverage_) && refBStime[0] == 0)
646  refBStime[0] = nbbst->second;
647  if ((StartAverage_) && refPVtime[0] == 0)
648  refPVtime[0] = nbpvt->second;
649  }
650  } else {
651  if (processed_)
652  FitAndFill(lumiSeg, lastlumi_, nextlumi_, nthlumi);
653  nextlumi_ = nthlumi;
654  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Next Lumi to Fit: " << nextlumi_ << endl;
655  if ((StartAverage_) && refBStime[0] == 0)
656  refBStime[0] = nbbst->second;
657  if ((StartAverage_) && refPVtime[0] == 0)
658  refPVtime[0] = nbpvt->second;
659  }
660 
661  //countLumi_++;
662  if (processed_)
663  processed_ = false;
664  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Begin of Lumi: " << nthlumi << endl;
665 }
bool loggerActive_
Definition: BeamMonitor.h:130
std::time_t refBStime[2]
Definition: BeamMonitor.h:105
Run const & getRun() const
bool processed_
Definition: BeamMonitor.h:122
int DBloggerReturn_
Definition: BeamMonitor.h:84
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:171
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:171
RunNumber_t run() const
Definition: RunBase.h:40
cond::persistency::Logger & logger()
std::time_t refPVtime[2]
Definition: BeamMonitor.h:106
unsigned long long TimeValue_t
Definition: Timestamp.h:21
Log< level::Info, false > LogInfo
void FitAndFill(const edm::LuminosityBlock &lumiSeg, int &, int &, int &)
Definition: BeamMonitor.cc:836
bool StartAverage_
Definition: BeamMonitor.h:118
TimeValue_t value() const
Definition: Timestamp.h:38
Timestamp const & beginTime() const
int beginLumiOfPVFit_
Definition: BeamMonitor.h:101
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:170
int nAnalyzedLS_
Definition: BeamMonitor.h:125
bool isAvailable() const
Definition: Service.h:40
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:83
EchoedLogStream< edm::LogInfo > logInfo()
Definition: Logger.cc:157
LuminosityBlockNumber_t luminosityBlock() const
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:170
int beginLumiOfBSFit_
Definition: BeamMonitor.h:99
int countLumi_
Definition: BeamMonitor.h:98
bool onlineMode_
Definition: BeamMonitor.h:92

◆ bookHistograms()

void BeamMonitor::bookHistograms ( DQMStore::IBooker i,
const edm::Run r,
const edm::EventSetup c 
)
overrideprotectedvirtual

Implements DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 225 of file BeamMonitor.cc.

References cms::cuda::assert(), edm::RunBase::beginTime(), dqm::implementation::IBooker::book1D(), dqm::implementation::IBooker::book2D(), dqm::implementation::IBooker::bookFloat(), dqm::implementation::IBooker::bookProfile(), cutFlowTable, Calorimetry_cff::da, debug_, dxBin_, dxMax_, dxMin_, dzBin_, dzMax_, dzMin_, dqm::impl::MonitorElement::Fill(), fitResults, formatFitTime(), frun, ftimestamp, dqm::impl::MonitorElement::getTH1(), h_d0_phi0, h_nTrk_lumi, h_nVtx, h_nVtx_lumi, h_nVtx_lumi_all, h_nVtx_st, h_PVx, h_PVxz, h_PVy, h_PVyz, h_PVz, h_sigmaX0, h_sigmaY0, h_sigmaZ0, h_trk_z0, h_trkPt, h_trkVz, h_vx_dz, h_vx_vy, h_vy_dz, h_x0, h_y0, h_z0, timingPdfMaker::histo, B2GTnPMonitor_cfi::histTitle, hs, mps_fire::i, intervalInSec_, label, monitorName_, dqmiodumpmetadata::n, nFitElements_, AlcaSiPixelAliHarvester0T_cff::options, phiBin_, phiMax_, phiMin_, pvResults, refTime, reportSummary, reportSummaryContents, reportSummaryMap, edm::RunBase::run(), dqm::impl::MonitorElement::setAxisTitle(), dqm::impl::MonitorElement::setBinContent(), dqm::impl::MonitorElement::setBinLabel(), dqm::implementation::NavigatorBase::setCurrentFolder(), dqm::impl::MonitorElement::setOption(), startTime, summaryContent_, tmpTime, edm::Timestamp::value(), vxBin_, vxMax_, vxMin_, compareTotals::xtitle, and compareTotals::ytitle.

225  {
226  frun = iRun.run();
227  ftimestamp = iRun.beginTime().value();
228  tmpTime = ftimestamp >> 32;
230  char eventTime[64];
231  formatFitTime(eventTime, tmpTime);
232  edm::LogInfo("BeamMonitor") << "TimeOffset = " << eventTime << std::endl;
233  TDatime da(eventTime);
234  if (debug_) {
235  edm::LogInfo("BeamMonitor") << "TimeOffset = ";
236  da.Print();
237  }
238  auto daTime = da.Convert(kTRUE);
239 
240  // book some histograms here
241 
242  // create and cd into new folder
243  iBooker.setCurrentFolder(monitorName_ + "Fit");
244 
245  h_nTrk_lumi = iBooker.book1D("nTrk_lumi", "Num. of selected tracks vs lumi (Fit)", 20, 0.5, 20.5);
246  h_nTrk_lumi->setAxisTitle("Lumisection", 1);
247  h_nTrk_lumi->setAxisTitle("Num of Tracks for Fit", 2);
248 
249  //store vtx vs lumi for monitoring why fits fail
250  h_nVtx_lumi = iBooker.book1D("nVtx_lumi", "Num. of selected Vtx vs lumi (Fit)", 20, 0.5, 20.5);
251  h_nVtx_lumi->setAxisTitle("Lumisection", 1);
252  h_nVtx_lumi->setAxisTitle("Num of Vtx for Fit", 2);
253 
254  h_nVtx_lumi_all = iBooker.book1D("nVtx_lumi_all", "Num. of selected Vtx vs lumi (Fit) all", 20, 0.5, 20.5);
255  h_nVtx_lumi_all->getTH1()->SetCanExtend(TH1::kAllAxes);
256  h_nVtx_lumi_all->setAxisTitle("Lumisection", 1);
257  h_nVtx_lumi_all->setAxisTitle("Num of Vtx for Fit", 2);
258 
259  h_d0_phi0 = iBooker.bookProfile(
260  "d0_phi0", "d_{0} vs. #phi_{0} (Selected Tracks)", phiBin_, phiMin_, phiMax_, dxBin_, dxMin_, dxMax_, "");
261  h_d0_phi0->setAxisTitle("#phi_{0} (rad)", 1);
262  h_d0_phi0->setAxisTitle("d_{0} (cm)", 2);
263 
264  h_vx_vy = iBooker.book2D(
265  "trk_vx_vy", "Vertex (PCA) position of selected tracks", vxBin_, vxMin_, vxMax_, vxBin_, vxMin_, vxMax_);
266  h_vx_vy->setOption("COLZ");
267  // h_vx_vy->getTH1()->SetCanExtend(TH1::kAllAxes);
268  h_vx_vy->setAxisTitle("x coordinate of input track at PCA (cm)", 1);
269  h_vx_vy->setAxisTitle("y coordinate of input track at PCA (cm)", 2);
270 
271  {
272  TDatime* da = new TDatime();
273  gStyle->SetTimeOffset(da->Convert(kTRUE));
274  }
275 
276  const int nvar_ = 6;
277  string coord[nvar_] = {"x", "y", "z", "sigmaX", "sigmaY", "sigmaZ"};
278  string label[nvar_] = {
279  "x_{0} (cm)", "y_{0} (cm)", "z_{0} (cm)", "#sigma_{X_{0}} (cm)", "#sigma_{Y_{0}} (cm)", "#sigma_{Z_{0}} (cm)"};
280 
281  hs.reserve(kNumHists);
282  for (int i = 0; i < 4; i++) {
283  iBooker.setCurrentFolder(monitorName_ + "Fit");
284  for (int ic = 0; ic < nvar_; ++ic) {
285  TString histName(coord[ic]);
286  TString histTitle(coord[ic]);
287  string ytitle(label[ic]);
288  string xtitle("");
289  string options("E1");
290  bool createHisto = true;
291  switch (i) {
292  case 1: // BS vs time
293  histName += "0_time";
294  xtitle = "Time [UTC]";
295  if (ic < 3)
296  histTitle += " coordinate of beam spot vs time (Fit)";
297  else
298  histTitle = histTitle.Insert(5, " ") + " of beam spot vs time (Fit)";
299  break;
300  case 2: // PV vs lumi
301  if (ic < 3) {
302  iBooker.setCurrentFolder(monitorName_ + "PrimaryVertex");
303  histName.Insert(0, "PV");
304  histName += "_lumi";
305  histTitle.Insert(0, "Avg. ");
306  histTitle += " position of primary vtx vs lumi";
307  xtitle = "Lumisection";
308  ytitle.insert(0, "PV");
309  ytitle += " #pm #sigma_{PV";
310  ytitle += coord[ic];
311  ytitle += "} (cm)";
312  } else
313  createHisto = false;
314  break;
315  case 3: // PV vs time
316  if (ic < 3) {
317  iBooker.setCurrentFolder(monitorName_ + "PrimaryVertex");
318  histName.Insert(0, "PV");
319  histName += "_time";
320  histTitle.Insert(0, "Avg. ");
321  histTitle += " position of primary vtx vs time";
322  xtitle = "Time [UTC]";
323  ytitle.insert(0, "PV");
324  ytitle += " #pm #sigma_{PV";
325  ytitle += coord[ic];
326  ytitle += "} (cm)";
327  } else
328  createHisto = false;
329  break;
330  default: // BS vs lumi
331  histName += "0_lumi";
332  xtitle = "Lumisection";
333  if (ic < 3)
334  histTitle += " coordinate of beam spot vs lumi (Fit)";
335  else
336  histTitle = histTitle.Insert(5, " ") + " of beam spot vs lumi (Fit)";
337  break;
338  }
339  if (createHisto) {
340  edm::LogInfo("BeamMonitor") << "hitsName = " << histName << "; histTitle = " << histTitle << std::endl;
341  auto tmpHs = iBooker.book1D(histName, histTitle, 40, 0.5, 40.5);
342  hs.push_back(tmpHs);
343  tmpHs->setAxisTitle(xtitle, 1);
344  tmpHs->setAxisTitle(ytitle, 2);
345  tmpHs->getTH1()->SetOption("E1");
346  if (histName.Contains("time")) {
347  //int nbins = (intervalInSec_/23 > 0 ? intervalInSec_/23 : 40);
348  tmpHs->getTH1()->SetBins(intervalInSec_, 0.5, intervalInSec_ + 0.5);
349  tmpHs->setAxisTimeDisplay(1);
350  tmpHs->setAxisTimeFormat("%H:%M:%S", 1);
351  tmpHs->getTH1()->GetXaxis()->SetTimeOffset(daTime);
352  }
353  histName += "_all";
354  histTitle += " all";
355  tmpHs = iBooker.book1D(histName, histTitle, 40, 0.5, 40.5);
356  hs.push_back(tmpHs);
357  tmpHs->getTH1()->SetCanExtend(TH1::kAllAxes);
358  tmpHs->setAxisTitle(xtitle, 1);
359  tmpHs->setAxisTitle(ytitle, 2);
360  tmpHs->getTH1()->SetOption("E1");
361  if (histName.Contains("time")) {
362  //int nbins = (intervalInSec_/23 > 0 ? intervalInSec_/23 : 40);
363  tmpHs->getTH1()->SetBins(intervalInSec_, 0.5, intervalInSec_ + 0.5);
364  tmpHs->setAxisTimeDisplay(1);
365  tmpHs->setAxisTimeFormat("%H:%M:%S", 1);
366  tmpHs->getTH1()->GetXaxis()->SetTimeOffset(daTime);
367  }
368  }
369  }
370  }
371  assert(hs.size() == kNumHists);
372  assert(0 == strcmp(hs[k_sigmaY0_time]->getTH1()->GetName(), "sigmaY0_time"));
373  assert(0 == strcmp(hs[k_PVz_lumi_all]->getTH1()->GetName(), "PVz_lumi_all"));
374 
375  iBooker.setCurrentFolder(monitorName_ + "Fit");
376 
377  h_trk_z0 = iBooker.book1D("trk_z0", "z_{0} of selected tracks", dzBin_, dzMin_, dzMax_);
378  h_trk_z0->setAxisTitle("z_{0} of selected tracks (cm)", 1);
379 
380  h_vx_dz = iBooker.bookProfile(
381  "vx_dz", "v_{x} vs. dz of selected tracks", dzBin_, dzMin_, dzMax_, dxBin_, dxMin_, dxMax_, "");
382  h_vx_dz->setAxisTitle("dz (cm)", 1);
383  h_vx_dz->setAxisTitle("x coordinate of input track at PCA (cm)", 2);
384 
385  h_vy_dz = iBooker.bookProfile(
386  "vy_dz", "v_{y} vs. dz of selected tracks", dzBin_, dzMin_, dzMax_, dxBin_, dxMin_, dxMax_, "");
387  h_vy_dz->setAxisTitle("dz (cm)", 1);
388  h_vy_dz->setAxisTitle("y coordinate of input track at PCA (cm)", 2);
389 
390  h_x0 = iBooker.book1D("BeamMonitorFeedBack_x0", "x coordinate of beam spot (Fit)", 100, -0.01, 0.01);
391  h_x0->setAxisTitle("x_{0} (cm)", 1);
392  h_x0->getTH1()->SetCanExtend(TH1::kAllAxes);
393 
394  h_y0 = iBooker.book1D("BeamMonitorFeedBack_y0", "y coordinate of beam spot (Fit)", 100, -0.01, 0.01);
395  h_y0->setAxisTitle("y_{0} (cm)", 1);
396  h_y0->getTH1()->SetCanExtend(TH1::kAllAxes);
397 
398  h_z0 = iBooker.book1D("BeamMonitorFeedBack_z0", "z coordinate of beam spot (Fit)", dzBin_, dzMin_, dzMax_);
399  h_z0->setAxisTitle("z_{0} (cm)", 1);
400  h_z0->getTH1()->SetCanExtend(TH1::kAllAxes);
401 
402  h_sigmaX0 = iBooker.book1D("BeamMonitorFeedBack_sigmaX0", "sigma x0 of beam spot (Fit)", 100, 0, 0.05);
403  h_sigmaX0->setAxisTitle("#sigma_{X_{0}} (cm)", 1);
404  h_sigmaX0->getTH1()->SetCanExtend(TH1::kAllAxes);
405 
406  h_sigmaY0 = iBooker.book1D("BeamMonitorFeedBack_sigmaY0", "sigma y0 of beam spot (Fit)", 100, 0, 0.05);
407  h_sigmaY0->setAxisTitle("#sigma_{Y_{0}} (cm)", 1);
408  h_sigmaY0->getTH1()->SetCanExtend(TH1::kAllAxes);
409 
410  h_sigmaZ0 = iBooker.book1D("BeamMonitorFeedBack_sigmaZ0", "sigma z0 of beam spot (Fit)", 100, 0, 10);
411  h_sigmaZ0->setAxisTitle("#sigma_{Z_{0}} (cm)", 1);
412  h_sigmaZ0->getTH1()->SetCanExtend(TH1::kAllAxes);
413 
414  // Histograms of all reco tracks (without cuts):
415  h_trkPt = iBooker.book1D("trkPt", "p_{T} of all reco'd tracks (no selection)", 200, 0., 50.);
416  h_trkPt->setAxisTitle("p_{T} (GeV/c)", 1);
417 
418  h_trkVz = iBooker.book1D("trkVz", "Z coordinate of PCA of all reco'd tracks (no selection)", dzBin_, dzMin_, dzMax_);
419  h_trkVz->setAxisTitle("V_{Z} (cm)", 1);
420 
421  cutFlowTable = iBooker.book1D("cutFlowTable", "Cut flow table of track selection", 9, 0, 9);
422 
423  // Results of previous good fit:
424  fitResults = iBooker.book2D("fitResults", "Results of previous good beam fit", 2, 0, 2, 8, 0, 8);
425  fitResults->setAxisTitle("Fitted Beam Spot (cm)", 1);
426  fitResults->setBinLabel(8, "x_{0}", 2);
427  fitResults->setBinLabel(7, "y_{0}", 2);
428  fitResults->setBinLabel(6, "z_{0}", 2);
429  fitResults->setBinLabel(5, "#sigma_{Z}", 2);
430  fitResults->setBinLabel(4, "#frac{dx}{dz} (rad)", 2);
431  fitResults->setBinLabel(3, "#frac{dy}{dz} (rad)", 2);
432  fitResults->setBinLabel(2, "#sigma_{X}", 2);
433  fitResults->setBinLabel(1, "#sigma_{Y}", 2);
434  fitResults->setBinLabel(1, "Mean", 1);
435  fitResults->setBinLabel(2, "Stat. Error", 1);
436  fitResults->getTH1()->SetOption("text");
437 
438  // Histos of PrimaryVertices:
439  iBooker.setCurrentFolder(monitorName_ + "PrimaryVertex");
440 
441  h_nVtx = iBooker.book1D("vtxNbr", "Reconstructed Vertices(non-fake) in all Event", 60, -0.5, 59.5);
442  h_nVtx->setAxisTitle("Num. of reco. vertices", 1);
443 
444  //For one Trigger only
445  h_nVtx_st = iBooker.book1D("vtxNbr_SelectedTriggers", "Reconstructed Vertices(non-fake) in Events", 60, -0.5, 59.5);
446  //h_nVtx_st->setAxisTitle("Num. of reco. vertices for Un-Prescaled Jet Trigger",1);
447 
448  // Monitor only the PV with highest sum pt of assoc. trks:
449  h_PVx[0] = iBooker.book1D("PVX", "x coordinate of Primary Vtx", 50, -0.01, 0.01);
450  h_PVx[0]->setAxisTitle("PVx (cm)", 1);
451  h_PVx[0]->getTH1()->SetCanExtend(TH1::kAllAxes);
452 
453  h_PVy[0] = iBooker.book1D("PVY", "y coordinate of Primary Vtx", 50, -0.01, 0.01);
454  h_PVy[0]->setAxisTitle("PVy (cm)", 1);
455  h_PVy[0]->getTH1()->SetCanExtend(TH1::kAllAxes);
456 
457  h_PVz[0] = iBooker.book1D("PVZ", "z coordinate of Primary Vtx", dzBin_, dzMin_, dzMax_);
458  h_PVz[0]->setAxisTitle("PVz (cm)", 1);
459 
460  h_PVx[1] = iBooker.book1D("PVXFit", "x coordinate of Primary Vtx (Last Fit)", 50, -0.01, 0.01);
461  h_PVx[1]->setAxisTitle("PVx (cm)", 1);
462  h_PVx[1]->getTH1()->SetCanExtend(TH1::kAllAxes);
463 
464  h_PVy[1] = iBooker.book1D("PVYFit", "y coordinate of Primary Vtx (Last Fit)", 50, -0.01, 0.01);
465  h_PVy[1]->setAxisTitle("PVy (cm)", 1);
466  h_PVy[1]->getTH1()->SetCanExtend(TH1::kAllAxes);
467 
468  h_PVz[1] = iBooker.book1D("PVZFit", "z coordinate of Primary Vtx (Last Fit)", dzBin_, dzMin_, dzMax_);
469  h_PVz[1]->setAxisTitle("PVz (cm)", 1);
470 
471  h_PVxz = iBooker.bookProfile("PVxz", "PVx vs. PVz", dzBin_ / 2, dzMin_, dzMax_, dxBin_ / 2, dxMin_, dxMax_, "");
472  h_PVxz->setAxisTitle("PVz (cm)", 1);
473  h_PVxz->setAxisTitle("PVx (cm)", 2);
474 
475  h_PVyz = iBooker.bookProfile("PVyz", "PVy vs. PVz", dzBin_ / 2, dzMin_, dzMax_, dxBin_ / 2, dxMin_, dxMax_, "");
476  h_PVyz->setAxisTitle("PVz (cm)", 1);
477  h_PVyz->setAxisTitle("PVy (cm)", 2);
478 
479  // Results of previous good fit:
480  pvResults = iBooker.book2D("pvResults", "Results of fitting Primary Vertices", 2, 0, 2, 6, 0, 6);
481  pvResults->setAxisTitle("Fitted Primary Vertex (cm)", 1);
482  pvResults->setBinLabel(6, "PVx", 2);
483  pvResults->setBinLabel(5, "PVy", 2);
484  pvResults->setBinLabel(4, "PVz", 2);
485  pvResults->setBinLabel(3, "#sigma_{X}", 2);
486  pvResults->setBinLabel(2, "#sigma_{Y}", 2);
487  pvResults->setBinLabel(1, "#sigma_{Z}", 2);
488  pvResults->setBinLabel(1, "Mean", 1);
489  pvResults->setBinLabel(2, "Stat. Error", 1);
490  pvResults->getTH1()->SetOption("text");
491 
492  // Summary plots:
493  iBooker.setCurrentFolder(monitorName_ + "EventInfo");
494 
495  reportSummary = iBooker.bookFloat("reportSummary");
496  if (reportSummary)
497  reportSummary->Fill(std::numeric_limits<double>::quiet_NaN());
498 
499  char histo[20];
500  iBooker.setCurrentFolder(monitorName_ + "EventInfo/reportSummaryContents");
501  for (int n = 0; n < nFitElements_; n++) {
502  switch (n) {
503  case 0:
504  sprintf(histo, "x0_status");
505  break;
506  case 1:
507  sprintf(histo, "y0_status");
508  break;
509  case 2:
510  sprintf(histo, "z0_status");
511  break;
512  }
513  reportSummaryContents[n] = iBooker.bookFloat(histo);
514  }
515 
516  for (int i = 0; i < nFitElements_; i++) {
517  summaryContent_[i] = 0.;
518  reportSummaryContents[i]->Fill(std::numeric_limits<double>::quiet_NaN());
519  }
520 
521  iBooker.setCurrentFolder(monitorName_ + "EventInfo");
522 
523  reportSummaryMap = iBooker.book2D("reportSummaryMap", "Beam Spot Summary Map", 1, 0, 1, 3, 0, 3);
525  reportSummaryMap->setAxisTitle("Fitted Beam Spot", 2);
526  reportSummaryMap->setBinLabel(1, " ", 1);
527  reportSummaryMap->setBinLabel(1, "x_{0}", 2);
528  reportSummaryMap->setBinLabel(2, "y_{0}", 2);
529  reportSummaryMap->setBinLabel(3, "z_{0}", 2);
530  for (int i = 0; i < nFitElements_; i++) {
531  reportSummaryMap->setBinContent(1, i + 1, -1.);
532  }
533 }
const double phiMax_
Definition: BeamMonitor.h:72
int nFitElements_
Definition: BeamMonitor.h:108
MonitorElement * reportSummary
Definition: BeamMonitor.h:182
MonitorElement * h_nVtx
Definition: BeamMonitor.h:156
const double dzMin_
Definition: BeamMonitor.h:75
MonitorElement * cutFlowTable
Definition: BeamMonitor.h:185
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:160
virtual void setOption(const char *option)
MonitorElement * h_PVxz
Definition: BeamMonitor.h:161
const double phiMin_
Definition: BeamMonitor.h:71
edm::TimeValue_t ftimestamp
Definition: BeamMonitor.h:192
const int dxBin_
Definition: BeamMonitor.h:62
std::vector< MonitorElement * > hs
Definition: BeamMonitor.h:164
MonitorElement * h_sigmaZ0
Definition: BeamMonitor.h:155
MonitorElement * h_nTrk_lumi
Definition: BeamMonitor.h:139
const int vxBin_
Definition: BeamMonitor.h:66
assert(be >=bs)
MonitorElement * fitResults
Definition: BeamMonitor.h:149
MonitorElement * h_sigmaY0
Definition: BeamMonitor.h:154
void Fill(long long x)
const double dzMax_
Definition: BeamMonitor.h:76
char const * label
MonitorElement * h_y0
Definition: BeamMonitor.h:151
int intervalInSec_
Definition: BeamMonitor.h:90
const double dxMin_
Definition: BeamMonitor.h:63
MonitorElement * h_vy_dz
Definition: BeamMonitor.h:146
MonitorElement * h_PVyz
Definition: BeamMonitor.h:162
std::time_t refTime
Definition: BeamMonitor.h:191
void formatFitTime(char *, const std::time_t &)
Definition: BeamMonitor.cc:43
MonitorElement * pvResults
Definition: BeamMonitor.h:163
MonitorElement * h_nVtx_lumi
Definition: BeamMonitor.h:140
virtual void setBinLabel(int bin, const std::string &label, int axis=1)
set bin label for x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * h_nVtx_lumi_all
Definition: BeamMonitor.h:141
Log< level::Info, false > LogInfo
std::time_t startTime
Definition: BeamMonitor.h:190
const int phiBin_
Definition: BeamMonitor.h:70
Float_t summaryContent_[3]
Definition: BeamMonitor.h:181
MonitorElement * h_sigmaX0
Definition: BeamMonitor.h:153
const double dxMax_
Definition: BeamMonitor.h:64
MonitorElement * h_nVtx_st
Definition: BeamMonitor.h:157
const double vxMin_
Definition: BeamMonitor.h:67
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:159
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
MonitorElement * reportSummaryContents[3]
Definition: BeamMonitor.h:183
MonitorElement * h_x0
Definition: BeamMonitor.h:150
MonitorElement * h_trk_z0
Definition: BeamMonitor.h:143
const double vxMax_
Definition: BeamMonitor.h:68
MonitorElement * h_trkPt
Definition: BeamMonitor.h:147
MonitorElement * h_vx_dz
Definition: BeamMonitor.h:145
MonitorElement * h_z0
Definition: BeamMonitor.h:152
const int dzBin_
Definition: BeamMonitor.h:74
std::time_t tmpTime
Definition: BeamMonitor.h:189
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:158
MonitorElement * h_trkVz
Definition: BeamMonitor.h:148
std::string monitorName_
Definition: BeamMonitor.h:77
MonitorElement * h_d0_phi0
Definition: BeamMonitor.h:142
MonitorElement * h_vx_vy
Definition: BeamMonitor.h:144
MonitorElement * reportSummaryMap
Definition: BeamMonitor.h:184
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)

◆ dqmBeginRun()

void BeamMonitor::dqmBeginRun ( edm::Run const &  ,
edm::EventSetup const &   
)
overrideprotectedvirtual

Reimplemented from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 218 of file BeamMonitor.cc.

References edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::lockRecords(), nAnalyzedLS_, onlineDbService_, and useLockRecords_.

218  {
221  }
222  nAnalyzedLS_ = 0;
223 }
int nAnalyzedLS_
Definition: BeamMonitor.h:125
bool useLockRecords_
Definition: BeamMonitor.h:123
bool isAvailable() const
Definition: Service.h:40
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:83

◆ dqmEndRun()

void BeamMonitor::dqmEndRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotectedvirtual

Reimplemented from DQMOneEDAnalyzer< edm::one::WatchLuminosityBlocks >.

Definition at line 1593 of file BeamMonitor.cc.

References debug_, edm::Service< T >::isAvailable(), mapBeginBSLS, mapBeginBSTime, mapBeginPVLS, mapBeginPVTime, mapLSBSTrkSize, mapLSCF, mapLSPVStoreSize, mapNPV, mapPVx, mapPVy, mapPVz, onlineDbService_, cond::service::PoolDBOutputService::releaseLocks(), and useLockRecords_.

1593  {
1594  if (debug_)
1595  edm::LogInfo("BeamMonitor") << "dqmEndRun:: Clearing all the Maps " << endl;
1596  //Clear all the Maps here
1597  mapPVx.clear();
1598  mapPVy.clear();
1599  mapPVz.clear();
1600  mapNPV.clear();
1601  mapBeginBSLS.clear();
1602  mapBeginPVLS.clear();
1603  mapBeginBSTime.clear();
1604  mapBeginPVTime.clear();
1605  mapLSBSTrkSize.clear();
1606  mapLSPVStoreSize.clear();
1607  mapLSCF.clear();
1608 
1611  }
1612 }
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:167
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:173
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:167
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:171
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:168
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:171
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:176
Log< level::Info, false > LogInfo
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:170
bool useLockRecords_
Definition: BeamMonitor.h:123
bool isAvailable() const
Definition: Service.h:40
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:83
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:170
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:167
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:174

◆ endLuminosityBlock()

void BeamMonitor::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
overrideprotected

Definition at line 817 of file BeamMonitor.cc.

References DBloggerReturn_, cond::persistency::Logger::end(), edm::LuminosityBlockBase::endTime(), edm::LuminosityBlockBase::id(), edm::Service< T >::isAvailable(), cond::service::PoolDBOutputService::logger(), loggerActive_, cond::persistency::Logger::logInfo(), logToDb_, edm::LuminosityBlockID::luminosityBlock(), nextlumi_, onlineDbService_, onlineMode_, refBStime, refPVtime, tmpTime, and edm::Timestamp::value().

817  {
818  int nthlumi = lumiSeg.id().luminosityBlock();
819  edm::LogInfo("BeamMonitor") << "endLuminosityBlock:: Lumi of the last event before endLuminosityBlock: " << nthlumi
820  << endl;
821 
822  if (onlineMode_ && nthlumi < nextlumi_)
823  return;
824  const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
825  const std::time_t fendtime = fendtimestamp >> 32;
826  tmpTime = refBStime[1] = refPVtime[1] = fendtime;
827 
828  // end DB logger
830  onlineDbService_->logger().logInfo() << "BeamMonitor::endLuminosityBlock";
832  }
833 }
bool loggerActive_
Definition: BeamMonitor.h:130
LuminosityBlockNumber_t luminosityBlock() const
std::time_t refBStime[2]
Definition: BeamMonitor.h:105
int DBloggerReturn_
Definition: BeamMonitor.h:84
cond::persistency::Logger & logger()
std::time_t refPVtime[2]
Definition: BeamMonitor.h:106
unsigned long long TimeValue_t
Definition: Timestamp.h:21
Log< level::Info, false > LogInfo
LuminosityBlockID id() const
TimeValue_t value() const
Definition: Timestamp.h:38
Timestamp const & endTime() const
bool isAvailable() const
Definition: Service.h:40
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:83
EchoedLogStream< edm::LogInfo > logInfo()
Definition: Logger.cc:157
std::time_t tmpTime
Definition: BeamMonitor.h:189
void end(int retCode)
Definition: Logger.cc:80
bool onlineMode_
Definition: BeamMonitor.h:92

◆ FitAndFill()

void BeamMonitor::FitAndFill ( const edm::LuminosityBlock lumiSeg,
int &  lastlumi,
int &  nextlumi,
int &  nthlumi 
)
private

Definition at line 836 of file BeamMonitor.cc.

References alpha, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthXError(), reco::BeamSpot::BeamWidthY(), reco::BeamSpot::BeamWidthYError(), beginLumiOfBSFit_, beginLumiOfPVFit_, cms::cuda::bs, submitPVResolutionJobs::count, countLumi_, BeamSpotPI::creationTime, DBloggerReturn_, debug_, MillePedeFileConverter_cfg::e, mps_fire::end, endLumiOfBSFit_, endLumiOfPVFit_, BeamSpotOnlineObjects::endTime(), BeamSpotOnlineObjects::endTimeStamp(), cppFunctionSkipper::exception, DeadROC_duringRun::f1, dqm::impl::MonitorElement::Fill(), firstAverageFit_, fitNLumi_, fitPVNLumi_, fitResults, frun, getGMTstring(), dqm::impl::MonitorElement::getMean(), dqm::impl::MonitorElement::getMeanError(), dqm::impl::MonitorElement::getRMS(), dqm::impl::MonitorElement::getRMSError(), dqm::impl::MonitorElement::getTH1(), dqm::impl::MonitorElement::getTH1F(), dqm::impl::MonitorElement::getTProfile(), h_d0_phi0, h_nTrk_lumi, h_nVtx_lumi, h_nVtx_lumi_all, h_nVtx_st, h_PVx, h_PVy, h_PVz, h_sigmaX0, h_sigmaY0, h_sigmaZ0, h_trk_z0, h_vx_dz, h_vx_vy, h_vy_dz, h_x0, h_y0, h_z0, hs, mps_fire::i, cuy::ii, edm::Service< T >::isAvailable(), dqmiolumiharvest::j, cond::persistency::Logger::logError(), cond::service::PoolDBOutputService::logger(), cond::persistency::Logger::logInfo(), logToDb_, genParticles_cff::map, mapLSBSTrkSize, mapLSCF, mapLSPVStoreSize, mapNPV, mapPVx, mapPVy, mapPVz, BeamSpotOnlineObjects::maxPVs(), SiStripPI::mean, BeamSpotOnlineObjects::meanErrorPV(), BeamSpotOnlineObjects::meanPV(), min_Ntrks_, minNrVertices_, dqmiodumpmetadata::n, nAnalyzedLS_, nFitElements_, nFits_, nLS_for_upload_, submitPVValidationJobs::now, nthBSTrk_, onlineDbService_, onlineMode_, preBS, processed_, pvResults, recordName_, refBStime, refPVtime, refTime, reportSummary, reportSummary_, reportSummaryContents, reportSummaryMap, dqm::impl::MonitorElement::Reset(), resetFitNLumi_, resetHistos_, resetPVNLumi_, BeamSpotOnlineObjects::rmsErrorPV(), BeamSpotOnlineObjects::rmsPV(), scrollTH1(), dqm::impl::MonitorElement::setAxisTitle(), BeamSpotObjects::setBeamWidthX(), BeamSpotObjects::setBeamWidthXError(), BeamSpotObjects::setBeamWidthY(), BeamSpotObjects::setBeamWidthYError(), BeamSpotObjects::setBetaStar(), dqm::impl::MonitorElement::setBinContent(), BeamSpotObjects::setCovariance(), BeamSpotOnlineObjects::setCreationTime(), BeamSpotObjects::setdxdz(), BeamSpotObjects::setdydz(), BeamSpotObjects::setEmittanceX(), BeamSpotObjects::setEmittanceY(), BeamSpotOnlineObjects::setEndTime(), BeamSpotOnlineObjects::setEndTimeStamp(), BeamSpotOnlineObjects::setLastAnalyzedFill(), BeamSpotOnlineObjects::setLastAnalyzedLumi(), BeamSpotOnlineObjects::setLastAnalyzedRun(), BeamSpotOnlineObjects::setLumiRange(), BeamSpotOnlineObjects::setMaxPVs(), BeamSpotOnlineObjects::setMeanErrorPV(), BeamSpotOnlineObjects::setMeanPV(), BeamSpotOnlineObjects::setNumPVs(), BeamSpotOnlineObjects::setNumTracks(), BeamSpotObjects::setPosition(), BeamSpotOnlineObjects::setRmsErrorPV(), BeamSpotOnlineObjects::setRmsPV(), BeamSpotObjects::setSigmaZ(), BeamSpotOnlineObjects::setStartTime(), BeamSpotOnlineObjects::setStartTimeStamp(), BeamSpotObjects::setType(), BeamSpotOnlineObjects::setUsedEvents(), dqm::impl::MonitorElement::ShiftFillLast(), mathSSE::sqrt(), StartAverage_, BeamSpotOnlineObjects::startTime(), startTime, BeamSpotOnlineObjects::startTimeStamp(), AlCaHLTBitMon_QueryRunRegistry::string, summaryContent_, summarySum_, testScroll(), theBeamFitter, tmpTime, cond::impl::to_string(), BeamSpotOnlineObjects::usedEvents(), ApeEstimator_cff::width, cond::service::OnlineDBOutputService::writeIOVForNextLumisection(), and HLTMuonOfflineAnalyzer_cfi::z0.

Referenced by beginLuminosityBlock().

836  {
837  if (onlineMode_ && (nthlumi <= nextlumi))
838  return;
839 
840  //set the correct run number when no event in the LS for fake output
841  if ((processed_) && theBeamFitter->getRunNumber() != frun)
842  theBeamFitter->setRun(frun);
843 
844  int currentlumi = nextlumi;
845  edm::LogInfo("BeamMonitor") << "FitAndFill:: Lumi of the current fit: " << currentlumi << endl;
846  lastlumi = currentlumi;
847  endLumiOfBSFit_ = currentlumi;
848  endLumiOfPVFit_ = currentlumi;
849 
850  //---------Fix for Runninv average-------------
851  mapLSPVStoreSize[countLumi_] = theBeamFitter->getPVvectorSize();
852 
853  if (StartAverage_) {
854  std::map<int, std::size_t>::iterator rmLSPVi = mapLSPVStoreSize.begin();
855  size_t SizeToRemovePV = rmLSPVi->second;
856  for (std::map<int, std::size_t>::iterator rmLSPVe = mapLSPVStoreSize.end(); ++rmLSPVi != rmLSPVe;)
857  rmLSPVi->second -= SizeToRemovePV;
858 
859  theBeamFitter->resizePVvector(SizeToRemovePV);
860 
861  map<int, std::size_t>::iterator tmpItpv = mapLSPVStoreSize.begin();
862  mapLSPVStoreSize.erase(tmpItpv);
863  }
864  if (debug_)
865  edm::LogInfo("BeamMonitor") << "FitAndFill:: Size of thePVvector After removing the PVs = "
866  << theBeamFitter->getPVvectorSize() << endl;
867 
868  //lets filt the PV for GUI here: It was in analyzer in preivous versiton but moved here due to absence of event in some lumis, works OK
869  bool resetHistoFlag_ = false;
870  if ((int)mapPVx.size() >= resetFitNLumi_ && (StartAverage_)) {
871  h_PVx[0]->Reset();
872  h_PVy[0]->Reset();
873  h_PVz[0]->Reset();
874  h_nVtx_st->Reset();
875  resetHistoFlag_ = true;
876  }
877 
878  int MaxPVs = 0;
879  int countEvtLastNLS_ = 0;
880  int countTotPV_ = 0;
881 
882  std::map<int, std::vector<int> >::iterator mnpv = mapNPV.begin();
883  std::map<int, std::vector<float> >::iterator mpv2 = mapPVy.begin();
884  std::map<int, std::vector<float> >::iterator mpv3 = mapPVz.begin();
885 
886  for (std::map<int, std::vector<float> >::iterator mpv1 = mapPVx.begin(); mpv1 != mapPVx.end();
887  ++mpv1, ++mpv2, ++mpv3, ++mnpv) {
888  std::vector<float>::iterator mpvs2 = (mpv2->second).begin();
889  std::vector<float>::iterator mpvs3 = (mpv3->second).begin();
890  for (std::vector<float>::iterator mpvs1 = (mpv1->second).begin(); mpvs1 != (mpv1->second).end();
891  ++mpvs1, ++mpvs2, ++mpvs3) {
892  if (resetHistoFlag_) {
893  h_PVx[0]->Fill(*mpvs1); //these histogram are reset after StartAverage_ flag is ON
894  h_PVy[0]->Fill(*mpvs2);
895  h_PVz[0]->Fill(*mpvs3);
896  }
897  } //loop over second
898 
899  //Do the same here for nPV distr.
900  for (std::vector<int>::iterator mnpvs = (mnpv->second).begin(); mnpvs != (mnpv->second).end(); ++mnpvs) {
901  if ((*mnpvs > 0) && (resetHistoFlag_))
902  h_nVtx_st->Fill((*mnpvs) * (1.0));
903  countEvtLastNLS_++;
904  countTotPV_ += (*mnpvs);
905  if ((*mnpvs) > MaxPVs)
906  MaxPVs = (*mnpvs);
907  } //loop over second of mapNPV
908 
909  } //loop over last N lumis
910 
911  char tmpTitlePV[100];
912  sprintf(tmpTitlePV, "%s %i %s %i", "Num. of reco. vertices for LS: ", beginLumiOfPVFit_, " to ", endLumiOfPVFit_);
913  h_nVtx_st->setAxisTitle(tmpTitlePV, 1);
914 
915  std::vector<float> DipPVInfo_;
916  DipPVInfo_.clear();
917 
918  if (countTotPV_ != 0) {
919  DipPVInfo_.push_back((float)countEvtLastNLS_);
920  DipPVInfo_.push_back(h_nVtx_st->getMean());
921  DipPVInfo_.push_back(h_nVtx_st->getMeanError());
922  DipPVInfo_.push_back(h_nVtx_st->getRMS());
923  DipPVInfo_.push_back(h_nVtx_st->getRMSError());
924  DipPVInfo_.push_back((float)MaxPVs);
925  DipPVInfo_.push_back((float)countTotPV_);
926  MaxPVs = 0;
927  } else {
928  for (size_t i = 0; i < 7; i++) {
929  if (i > 0) {
930  DipPVInfo_.push_back(0.);
931  } else {
932  DipPVInfo_.push_back((float)countEvtLastNLS_);
933  }
934  }
935  }
936  theBeamFitter->SetPVInfo(DipPVInfo_);
937  countEvtLastNLS_ = 0;
938 
939  if (onlineMode_) { // filling LS gap
940  // FIXME: need to add protection for the case if the gap is at the resetting LS!
941  const int countLS_bs = hs[k_x0_lumi]->getTH1()->GetEntries();
942  const int countLS_pv = hs[k_PVx_lumi]->getTH1()->GetEntries();
943  edm::LogInfo("BeamMonitor") << "FitAndFill:: countLS_bs = " << countLS_bs << " ; countLS_pv = " << countLS_pv
944  << std::endl;
945  int LSgap_bs = currentlumi / fitNLumi_ - countLS_bs;
946  int LSgap_pv = currentlumi / fitPVNLumi_ - countLS_pv;
947  if (currentlumi % fitNLumi_ == 0)
948  LSgap_bs--;
949  if (currentlumi % fitPVNLumi_ == 0)
950  LSgap_pv--;
951  edm::LogInfo("BeamMonitor") << "FitAndFill:: LSgap_bs = " << LSgap_bs << " ; LSgap_pv = " << LSgap_pv << std::endl;
952  // filling previous fits if LS gap ever exists
953  for (int ig = 0; ig < LSgap_bs; ig++) {
954  hs[k_x0_lumi]->ShiftFillLast(0., 0., fitNLumi_); //x0 , x0err, fitNLumi_; see DQMCore....
955  hs[k_y0_lumi]->ShiftFillLast(0., 0., fitNLumi_);
956  hs[k_z0_lumi]->ShiftFillLast(0., 0., fitNLumi_);
957  hs[k_sigmaX0_lumi]->ShiftFillLast(0., 0., fitNLumi_);
958  hs[k_sigmaY0_lumi]->ShiftFillLast(0., 0., fitNLumi_);
959  hs[k_sigmaZ0_lumi]->ShiftFillLast(0., 0., fitNLumi_);
961  }
962  for (int ig = 0; ig < LSgap_pv; ig++) {
963  hs[k_PVx_lumi]->ShiftFillLast(0., 0., fitPVNLumi_);
964  hs[k_PVy_lumi]->ShiftFillLast(0., 0., fitPVNLumi_);
965  hs[k_PVz_lumi]->ShiftFillLast(0., 0., fitPVNLumi_);
966  }
967  const int previousLS = h_nTrk_lumi->getTH1()->GetEntries();
968  for (int i = 1; i < (currentlumi - previousLS);
969  i++) //if (current-previoius)= 1 then never go inside the for loop!!!!!!!!!!!
971  }
972 
973  edm::LogInfo("BeamMonitor") << "FitAndFill:: Time lapsed since last scroll = " << tmpTime - refTime << std::endl;
974 
975  if (testScroll(tmpTime, refTime)) {
976  scrollTH1(hs[k_x0_time]->getTH1(), refTime);
977  scrollTH1(hs[k_y0_time]->getTH1(), refTime);
978  scrollTH1(hs[k_z0_time]->getTH1(), refTime);
979  scrollTH1(hs[k_sigmaX0_time]->getTH1(), refTime);
980  scrollTH1(hs[k_sigmaY0_time]->getTH1(), refTime);
981  scrollTH1(hs[k_sigmaZ0_time]->getTH1(), refTime);
982  scrollTH1(hs[k_PVx_time]->getTH1(), refTime);
983  scrollTH1(hs[k_PVy_time]->getTH1(), refTime);
984  scrollTH1(hs[k_PVz_time]->getTH1(), refTime);
985  }
986 
987  bool doPVFit = false;
988 
989  if (fitPVNLumi_ > 0) {
990  if (onlineMode_) {
991  if (currentlumi % fitPVNLumi_ == 0)
992  doPVFit = true;
993  } else if (countLumi_ % fitPVNLumi_ == 0)
994  doPVFit = true;
995  } else
996  doPVFit = true;
997 
998  if (doPVFit) {
999  edm::LogInfo("BeamMonitor") << "FitAndFill:: Do PV Fitting for LS = " << beginLumiOfPVFit_ << " to "
1000  << endLumiOfPVFit_ << std::endl;
1001  // Primary Vertex Fit:
1002  if (h_PVx[0]->getTH1()->GetEntries() > minNrVertices_) {
1003  pvResults->Reset();
1004  char tmpTitle[50];
1005  sprintf(
1006  tmpTitle, "%s %i %s %i", "Fitted Primary Vertex (cm) of LS: ", beginLumiOfPVFit_, " to ", endLumiOfPVFit_);
1007  pvResults->setAxisTitle(tmpTitle, 1);
1008 
1009  std::unique_ptr<TF1> fgaus{new TF1("fgaus", "gaus")};
1010  double mean, width, meanErr, widthErr;
1011  fgaus->SetLineColor(4);
1012  h_PVx[0]->getTH1()->Fit(fgaus.get(), "QLM0");
1013  mean = fgaus->GetParameter(1);
1014  width = fgaus->GetParameter(2);
1015  meanErr = fgaus->GetParError(1);
1016  widthErr = fgaus->GetParError(2);
1017 
1018  hs[k_PVx_lumi]->ShiftFillLast(mean, width, fitPVNLumi_);
1019  hs[k_PVx_lumi_all]->setBinContent(currentlumi, mean);
1020  hs[k_PVx_lumi_all]->setBinError(currentlumi, width);
1021  int nthBin = tmpTime - refTime;
1022  if (nthBin < 0)
1023  edm::LogInfo("BeamMonitor") << "FitAndFill:: Event time outside current range of time histograms!"
1024  << std::endl;
1025  if (nthBin > 0) {
1026  hs[k_PVx_time]->setBinContent(nthBin, mean);
1027  hs[k_PVx_time]->setBinError(nthBin, width);
1028  }
1029  int jthBin = tmpTime - startTime;
1030  if (jthBin > 0) {
1031  hs[k_PVx_time_all]->setBinContent(jthBin, mean);
1032  hs[k_PVx_time_all]->setBinError(jthBin, width);
1033  }
1034  pvResults->setBinContent(1, 6, mean);
1035  pvResults->setBinContent(1, 3, width);
1036  pvResults->setBinContent(2, 6, meanErr);
1037  pvResults->setBinContent(2, 3, widthErr);
1038 
1039  {
1040  // snap shot of the fit
1041  auto tmphisto = h_PVx[0]->getTH1F();
1042  h_PVx[1]->getTH1()->SetBins(
1043  tmphisto->GetNbinsX(), tmphisto->GetXaxis()->GetXmin(), tmphisto->GetXaxis()->GetXmax());
1044  h_PVx[1]->Reset();
1045  h_PVx[1]->getTH1()->Add(tmphisto);
1046  h_PVx[1]->getTH1()->Fit(fgaus.get(), "QLM");
1047  }
1048 
1049  h_PVy[0]->getTH1()->Fit(fgaus.get(), "QLM0");
1050  mean = fgaus->GetParameter(1);
1051  width = fgaus->GetParameter(2);
1052  meanErr = fgaus->GetParError(1);
1053  widthErr = fgaus->GetParError(2);
1054  hs[k_PVy_lumi]->ShiftFillLast(mean, width, fitPVNLumi_);
1055  hs[k_PVy_lumi_all]->setBinContent(currentlumi, mean);
1056  hs[k_PVy_lumi_all]->setBinError(currentlumi, width);
1057  if (nthBin > 0) {
1058  hs[k_PVy_time]->setBinContent(nthBin, mean);
1059  hs[k_PVy_time]->setBinError(nthBin, width);
1060  }
1061  if (jthBin > 0) {
1062  hs[k_PVy_time_all]->setBinContent(jthBin, mean);
1063  hs[k_PVy_time_all]->setBinError(jthBin, width);
1064  }
1065  pvResults->setBinContent(1, 5, mean);
1066  pvResults->setBinContent(1, 2, width);
1067  pvResults->setBinContent(2, 5, meanErr);
1068  pvResults->setBinContent(2, 2, widthErr);
1069  // snap shot of the fit
1070  {
1071  auto tmphisto = h_PVy[0]->getTH1F();
1072  h_PVy[1]->getTH1()->SetBins(
1073  tmphisto->GetNbinsX(), tmphisto->GetXaxis()->GetXmin(), tmphisto->GetXaxis()->GetXmax());
1074  h_PVy[1]->Reset();
1075  h_PVy[1]->getTH1()->Add(tmphisto);
1076  h_PVy[1]->getTH1()->Fit(fgaus.get(), "QLM");
1077  }
1078 
1079  h_PVz[0]->getTH1()->Fit(fgaus.get(), "QLM0");
1080  mean = fgaus->GetParameter(1);
1081  width = fgaus->GetParameter(2);
1082  meanErr = fgaus->GetParError(1);
1083  widthErr = fgaus->GetParError(2);
1084  hs[k_PVz_lumi]->ShiftFillLast(mean, width, fitPVNLumi_);
1085  hs[k_PVz_lumi_all]->setBinContent(currentlumi, mean);
1086  hs[k_PVz_lumi_all]->setBinError(currentlumi, width);
1087  if (nthBin > 0) {
1088  hs[k_PVz_time]->setBinContent(nthBin, mean);
1089  hs[k_PVz_time]->setBinError(nthBin, width);
1090  }
1091  if (jthBin > 0) {
1092  hs[k_PVz_time_all]->setBinContent(jthBin, mean);
1093  hs[k_PVz_time_all]->setBinError(jthBin, width);
1094  }
1095  pvResults->setBinContent(1, 4, mean);
1096  pvResults->setBinContent(1, 1, width);
1097  pvResults->setBinContent(2, 4, meanErr);
1098  pvResults->setBinContent(2, 1, widthErr);
1099  {
1100  // snap shot of the fit
1101  auto tmphisto = h_PVz[0]->getTH1F();
1102  h_PVz[1]->getTH1()->SetBins(
1103  tmphisto->GetNbinsX(), tmphisto->GetXaxis()->GetXmin(), tmphisto->GetXaxis()->GetXmax());
1104  h_PVz[1]->Reset();
1105  h_PVz[1]->getTH1()->Add(tmphisto);
1106  h_PVz[1]->getTH1()->Fit(fgaus.get(), "QLM");
1107  }
1108  } //check if found min Vertices
1109  } //do PVfit
1110 
1111  if ((resetPVNLumi_ > 0 && countLumi_ == resetPVNLumi_) || StartAverage_) {
1112  beginLumiOfPVFit_ = 0;
1113  refPVtime[0] = 0;
1114  }
1115 
1116  //---------Readjustment of theBSvector, RefTime, beginLSofFit---------
1117  vector<BSTrkParameters> theBSvector1 = theBeamFitter->getBSvector();
1118  mapLSBSTrkSize[countLumi_] = (theBSvector1.size());
1119  size_t PreviousRecords = 0; //needed to fill nth record of tracks in GUI
1120 
1121  if (StartAverage_) {
1122  size_t SizeToRemove = 0;
1123  std::map<int, std::size_t>::iterator rmls = mapLSBSTrkSize.begin();
1124  SizeToRemove = rmls->second;
1125  if (debug_)
1126  edm::LogInfo("BeamMonitor") << " The size to remove is = " << SizeToRemove << endl;
1127  int changedAfterThis = 0;
1128  for (std::map<int, std::size_t>::iterator rmLS = mapLSBSTrkSize.begin(); rmLS != mapLSBSTrkSize.end();
1129  ++rmLS, ++changedAfterThis) {
1130  if (changedAfterThis > 0) {
1131  (rmLS->second) = (rmLS->second) - SizeToRemove;
1132  if ((mapLSBSTrkSize.size() - (size_t)changedAfterThis) == 2)
1133  PreviousRecords = (rmLS->second);
1134  }
1135  }
1136 
1137  theBeamFitter->resizeBSvector(SizeToRemove);
1138 
1139  map<int, std::size_t>::iterator tmpIt = mapLSBSTrkSize.begin();
1140  mapLSBSTrkSize.erase(tmpIt);
1141 
1142  std::pair<int, int> checkfitLS = theBeamFitter->getFitLSRange();
1143  std::pair<time_t, time_t> checkfitTime = theBeamFitter->getRefTime();
1144  theBeamFitter->setFitLSRange(beginLumiOfBSFit_, checkfitLS.second);
1145  theBeamFitter->setRefTime(refBStime[0], checkfitTime.second);
1146  }
1147 
1148  //Fill the track for this fit
1149  vector<BSTrkParameters> theBSvector = theBeamFitter->getBSvector();
1150  h_nTrk_lumi->ShiftFillLast(theBSvector.size());
1151 
1152  if (debug_)
1153  edm::LogInfo("BeamMonitor") << "FitAndFill:: Size of theBSViector.size() After =" << theBSvector.size() << endl;
1154 
1155  bool countFitting = false;
1156  if (theBSvector.size() >= PreviousRecords && theBSvector.size() >= min_Ntrks_) {
1157  countFitting = true;
1158  }
1159 
1160  //---Fix for Cut Flow Table for Running average in a same way//the previous code has problem for resetting!!!
1161  mapLSCF[countLumi_] = *theBeamFitter->getCutFlow();
1162  if (StartAverage_ && !mapLSCF.empty()) {
1163  const TH1F& cutFlowToSubtract = mapLSCF.begin()->second;
1164  // Subtract the last cut flow from all of the others.
1165  std::map<int, TH1F>::iterator cf = mapLSCF.begin();
1166  // Start on second entry
1167  for (; cf != mapLSCF.end(); ++cf) {
1168  cf->second.Add(&cutFlowToSubtract, -1);
1169  }
1170  theBeamFitter->subtractFromCutFlow(&cutFlowToSubtract);
1171  // Remove the obsolete lumi section
1172  mapLSCF.erase(mapLSCF.begin());
1173  }
1174 
1175  if (resetHistos_) {
1176  h_d0_phi0->Reset();
1177  h_vx_vy->Reset();
1178  h_vx_dz->Reset();
1179  h_vy_dz->Reset();
1180  h_trk_z0->Reset();
1181  resetHistos_ = false;
1182  }
1183 
1184  if (StartAverage_)
1185  nthBSTrk_ = PreviousRecords; //after average proccess is ON//for 2-6 LS fit PreviousRecords is size from 2-5 LS
1186 
1187  edm::LogInfo("BeamMonitor") << " The Previous Recored for this fit is =" << nthBSTrk_ << endl;
1188 
1189  unsigned int itrk = 0;
1190  for (vector<BSTrkParameters>::const_iterator BSTrk = theBSvector.begin(); BSTrk != theBSvector.end();
1191  ++BSTrk, ++itrk) {
1192  if (itrk >= nthBSTrk_) { //fill for this record only !!
1193  h_d0_phi0->Fill(BSTrk->phi0(), BSTrk->d0());
1194  double vx = BSTrk->vx();
1195  double vy = BSTrk->vy();
1196  double z0 = BSTrk->z0();
1197  h_vx_vy->Fill(vx, vy);
1198  h_vx_dz->Fill(z0, vx);
1199  h_vy_dz->Fill(z0, vy);
1200  h_trk_z0->Fill(z0);
1201  }
1202  }
1203 
1204  nthBSTrk_ = theBSvector.size(); // keep track of num of tracks filled so far
1205 
1206  edm::LogInfo("BeamMonitor") << " The Current Recored for this fit is =" << nthBSTrk_ << endl;
1207 
1208  if (countFitting)
1209  edm::LogInfo("BeamMonitor") << "FitAndFill:: Num of tracks collected = " << nthBSTrk_ << endl;
1210 
1211  if (fitNLumi_ > 0) {
1212  if (onlineMode_) {
1213  if (currentlumi % fitNLumi_ != 0) {
1214  // for (std::map<TString,MonitorElement*>::iterator itAll = hs.begin();
1215  // itAll != hs.end(); ++itAll) {
1216  // if ((*itAll).first.Contains("all")) {
1217  // (*itAll).second->setBinContent(currentlumi,0.);
1218  // (*itAll).second->setBinError(currentlumi,0.);
1219  // }
1220  // }
1221  return;
1222  }
1223  } else if (countLumi_ % fitNLumi_ != 0)
1224  return;
1225  }
1226 
1227  edm::LogInfo("BeamMonitor") << "FitAndFill:: [DebugTime] refBStime[0] = " << refBStime[0]
1228  << "; address = " << &refBStime[0] << std::endl;
1229  edm::LogInfo("BeamMonitor") << "FitAndFill:: [DebugTime] refBStime[1] = " << refBStime[1]
1230  << "; address = " << &refBStime[1] << std::endl;
1231 
1232  //Fill for all LS even if fit fails
1233  h_nVtx_lumi->ShiftFillLast((theBeamFitter->getPVvectorSize()), 0., fitNLumi_);
1234  h_nVtx_lumi_all->setBinContent(currentlumi, (theBeamFitter->getPVvectorSize()));
1235 
1236  if (countFitting) {
1237  nFits_++;
1238  std::pair<int, int> fitLS = theBeamFitter->getFitLSRange();
1239  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamFitter] Do BeamSpot Fit for LS = " << fitLS.first << " to "
1240  << fitLS.second << std::endl;
1241  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] Do BeamSpot Fit for LS = " << beginLumiOfBSFit_
1242  << " to " << endLumiOfBSFit_ << std::endl;
1243 
1244  //Now Run the PV and Track Fitter over the collected tracks and pvs
1245  if (theBeamFitter->runPVandTrkFitter()) {
1246  reco::BeamSpot bs = theBeamFitter->getBeamSpot();
1247  if (bs.type() > 0) // with good beamwidth fit
1248  preBS = bs; // cache good fit results
1249 
1250  edm::LogInfo("BeamMonitor") << "\n RESULTS OF DEFAULT FIT:" << endl;
1251  edm::LogInfo("BeamMonitor") << bs << endl;
1252  edm::LogInfo("BeamMonitor") << "[BeamFitter] fitting done \n" << endl;
1253 
1254  hs[k_x0_lumi]->ShiftFillLast(bs.x0(), bs.x0Error(), fitNLumi_);
1255  hs[k_y0_lumi]->ShiftFillLast(bs.y0(), bs.y0Error(), fitNLumi_);
1256  hs[k_z0_lumi]->ShiftFillLast(bs.z0(), bs.z0Error(), fitNLumi_);
1257  hs[k_sigmaX0_lumi]->ShiftFillLast(bs.BeamWidthX(), bs.BeamWidthXError(), fitNLumi_);
1258  hs[k_sigmaY0_lumi]->ShiftFillLast(bs.BeamWidthY(), bs.BeamWidthYError(), fitNLumi_);
1259  hs[k_sigmaZ0_lumi]->ShiftFillLast(bs.sigmaZ(), bs.sigmaZ0Error(), fitNLumi_);
1260  hs[k_x0_lumi_all]->setBinContent(currentlumi, bs.x0());
1261  hs[k_x0_lumi_all]->setBinError(currentlumi, bs.x0Error());
1262  hs[k_y0_lumi_all]->setBinContent(currentlumi, bs.y0());
1263  hs[k_y0_lumi_all]->setBinError(currentlumi, bs.y0Error());
1264  hs[k_z0_lumi_all]->setBinContent(currentlumi, bs.z0());
1265  hs[k_z0_lumi_all]->setBinError(currentlumi, bs.z0Error());
1266  hs[k_sigmaX0_lumi_all]->setBinContent(currentlumi, bs.BeamWidthX());
1267  hs[k_sigmaX0_lumi_all]->setBinError(currentlumi, bs.BeamWidthXError());
1268  hs[k_sigmaY0_lumi_all]->setBinContent(currentlumi, bs.BeamWidthY());
1269  hs[k_sigmaY0_lumi_all]->setBinError(currentlumi, bs.BeamWidthYError());
1270  hs[k_sigmaZ0_lumi_all]->setBinContent(currentlumi, bs.sigmaZ());
1271  hs[k_sigmaZ0_lumi_all]->setBinError(currentlumi, bs.sigmaZ0Error());
1272 
1273  int nthBin = tmpTime - refTime;
1274  if (nthBin > 0) {
1275  hs[k_x0_time]->setBinContent(nthBin, bs.x0());
1276  hs[k_y0_time]->setBinContent(nthBin, bs.y0());
1277  hs[k_z0_time]->setBinContent(nthBin, bs.z0());
1278  hs[k_sigmaX0_time]->setBinContent(nthBin, bs.BeamWidthX());
1279  hs[k_sigmaY0_time]->setBinContent(nthBin, bs.BeamWidthY());
1280  hs[k_sigmaZ0_time]->setBinContent(nthBin, bs.sigmaZ());
1281  hs[k_x0_time]->setBinError(nthBin, bs.x0Error());
1282  hs[k_y0_time]->setBinError(nthBin, bs.y0Error());
1283  hs[k_z0_time]->setBinError(nthBin, bs.z0Error());
1284  hs[k_sigmaX0_time]->setBinError(nthBin, bs.BeamWidthXError());
1285  hs[k_sigmaY0_time]->setBinError(nthBin, bs.BeamWidthYError());
1286  hs[k_sigmaZ0_time]->setBinError(nthBin, bs.sigmaZ0Error());
1287  }
1288 
1289  int jthBin = tmpTime - startTime;
1290  if (jthBin > 0) {
1291  hs[k_x0_time_all]->setBinContent(jthBin, bs.x0());
1292  hs[k_y0_time_all]->setBinContent(jthBin, bs.y0());
1293  hs[k_z0_time_all]->setBinContent(jthBin, bs.z0());
1294  hs[k_sigmaX0_time_all]->setBinContent(jthBin, bs.BeamWidthX());
1295  hs[k_sigmaY0_time_all]->setBinContent(jthBin, bs.BeamWidthY());
1296  hs[k_sigmaZ0_time_all]->setBinContent(jthBin, bs.sigmaZ());
1297  hs[k_x0_time_all]->setBinError(jthBin, bs.x0Error());
1298  hs[k_y0_time_all]->setBinError(jthBin, bs.y0Error());
1299  hs[k_z0_time_all]->setBinError(jthBin, bs.z0Error());
1300  hs[k_sigmaX0_time_all]->setBinError(jthBin, bs.BeamWidthXError());
1301  hs[k_sigmaY0_time_all]->setBinError(jthBin, bs.BeamWidthYError());
1302  hs[k_sigmaZ0_time_all]->setBinError(jthBin, bs.sigmaZ0Error());
1303  }
1304 
1305  h_x0->Fill(bs.x0());
1306  h_y0->Fill(bs.y0());
1307  h_z0->Fill(bs.z0());
1308  if (bs.type() > 0) { // with good beamwidth fit
1309  h_sigmaX0->Fill(bs.BeamWidthX());
1310  h_sigmaY0->Fill(bs.BeamWidthY());
1311  }
1312  h_sigmaZ0->Fill(bs.sigmaZ());
1313 
1314  if (nthBSTrk_ >= 2 * min_Ntrks_) {
1315  double amp = std::sqrt(bs.x0() * bs.x0() + bs.y0() * bs.y0());
1316  double alpha = std::atan2(bs.y0(), bs.x0());
1317  std::unique_ptr<TF1> f1{new TF1("f1", "[0]*sin(x-[1])", -3.14, 3.14)};
1318  f1->SetParameters(amp, alpha);
1319  f1->SetParLimits(0, amp - 0.1, amp + 0.1);
1320  f1->SetParLimits(1, alpha - 0.577, alpha + 0.577);
1321  f1->SetLineColor(4);
1322  h_d0_phi0->getTProfile()->Fit(f1.get(), "QR");
1323 
1324  double mean = bs.z0();
1325  double width = bs.sigmaZ();
1326  std::unique_ptr<TF1> fgaus{new TF1("fgaus", "gaus")};
1327  fgaus->SetParameters(mean, width);
1328  fgaus->SetLineColor(4);
1329  h_trk_z0->getTH1()->Fit(fgaus.get(), "QLRM", "", mean - 3 * width, mean + 3 * width);
1330  }
1331 
1332  fitResults->Reset();
1333  std::pair<int, int> LSRange = theBeamFitter->getFitLSRange();
1334  char tmpTitle[50];
1335  sprintf(tmpTitle, "%s %i %s %i", "Fitted Beam Spot (cm) of LS: ", LSRange.first, " to ", LSRange.second);
1336  fitResults->setAxisTitle(tmpTitle, 1);
1337  fitResults->setBinContent(1, 8, bs.x0());
1338  fitResults->setBinContent(1, 7, bs.y0());
1339  fitResults->setBinContent(1, 6, bs.z0());
1340  fitResults->setBinContent(1, 5, bs.sigmaZ());
1341  fitResults->setBinContent(1, 4, bs.dxdz());
1342  fitResults->setBinContent(1, 3, bs.dydz());
1343  if (bs.type() > 0) { // with good beamwidth fit
1344  fitResults->setBinContent(1, 2, bs.BeamWidthX());
1345  fitResults->setBinContent(1, 1, bs.BeamWidthY());
1346  } else { // fill cached widths
1349  }
1350 
1351  fitResults->setBinContent(2, 8, bs.x0Error());
1352  fitResults->setBinContent(2, 7, bs.y0Error());
1353  fitResults->setBinContent(2, 6, bs.z0Error());
1354  fitResults->setBinContent(2, 5, bs.sigmaZ0Error());
1355  fitResults->setBinContent(2, 4, bs.dxdzError());
1356  fitResults->setBinContent(2, 3, bs.dydzError());
1357  if (bs.type() > 0) { // with good beamwidth fit
1358  fitResults->setBinContent(2, 2, bs.BeamWidthXError());
1359  fitResults->setBinContent(2, 1, bs.BeamWidthYError());
1360  } else { // fill cached width errors
1363  }
1364 
1365  // count good fit
1366  // if (std::fabs(refBS.x0()-bs.x0())/bs.x0Error() < deltaSigCut_) { // disabled temporarily
1367  summaryContent_[0] += 1.;
1368  // }
1369  // if (std::fabs(refBS.y0()-bs.y0())/bs.y0Error() < deltaSigCut_) { // disabled temporarily
1370  summaryContent_[1] += 1.;
1371  // }
1372  // if (std::fabs(refBS.z0()-bs.z0())/bs.z0Error() < deltaSigCut_) { // disabled temporarily
1373  summaryContent_[2] += 1.;
1374  // }
1375 
1376  // Create the BeamSpotOnlineObjects object
1377  BeamSpotOnlineObjects BSOnline;
1378  BSOnline.setLastAnalyzedLumi(LSRange.second);
1379  BSOnline.setLastAnalyzedRun(theBeamFitter->getRunNumber());
1380  BSOnline.setLastAnalyzedFill(0); // To be updated with correct LHC Fill number
1381  BSOnline.setPosition(bs.x0(), bs.y0(), bs.z0());
1382  BSOnline.setSigmaZ(bs.sigmaZ());
1383  BSOnline.setBeamWidthX(bs.BeamWidthX());
1384  BSOnline.setBeamWidthY(bs.BeamWidthY());
1385  BSOnline.setBeamWidthXError(bs.BeamWidthXError());
1386  BSOnline.setBeamWidthYError(bs.BeamWidthYError());
1387  BSOnline.setdxdz(bs.dxdz());
1388  BSOnline.setdydz(bs.dydz());
1389  BSOnline.setType(bs.type());
1390  BSOnline.setEmittanceX(bs.emittanceX());
1391  BSOnline.setEmittanceY(bs.emittanceY());
1392  BSOnline.setBetaStar(bs.betaStar());
1393  for (int i = 0; i < 7; ++i) {
1394  for (int j = 0; j < 7; ++j) {
1395  BSOnline.setCovariance(i, j, bs.covariance(i, j));
1396  }
1397  }
1398  BSOnline.setNumTracks(theBeamFitter->getNTracks());
1399  BSOnline.setNumPVs(theBeamFitter->getNPVs());
1400  BSOnline.setUsedEvents((int)DipPVInfo_[0]);
1401  BSOnline.setMeanPV(DipPVInfo_[1]);
1402  BSOnline.setMeanErrorPV(DipPVInfo_[2]);
1403  BSOnline.setRmsPV(DipPVInfo_[3]);
1404  BSOnline.setRmsErrorPV(DipPVInfo_[4]);
1405  BSOnline.setMaxPVs((int)DipPVInfo_[5]);
1406  auto creationTime =
1407  std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::system_clock::now().time_since_epoch())
1408  .count();
1409  BSOnline.setCreationTime(creationTime);
1410 
1411  std::pair<time_t, time_t> timeForDIP = theBeamFitter->getRefTime();
1412  BSOnline.setStartTimeStamp(timeForDIP.first);
1413  BSOnline.setStartTime(getGMTstring(timeForDIP.first));
1414  BSOnline.setEndTimeStamp(timeForDIP.second);
1415  BSOnline.setEndTime(getGMTstring(timeForDIP.second));
1416 
1417  std::string lumiRangeForDIP = std::to_string(LSRange.first) + " - " + std::to_string(LSRange.second);
1418  BSOnline.setLumiRange(lumiRangeForDIP);
1419 
1420  edm::LogInfo("BeamMonitor") << "FitAndFill::[PayloadCreation] BeamSpotOnline object created: \n" << std::endl;
1421  edm::LogInfo("BeamMonitor") << BSOnline << std::endl;
1422 
1423  // Create the payload for BeamSpotOnlineObjects object
1425  logToDb_) {
1426  edm::LogInfo("BeamMonitor") << "FitAndFill::[PayloadCreation] onlineDbService available \n" << std::endl;
1427  onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - Lumi of the current fit: " << currentlumi;
1429  << "BeamMonitor::FitAndFill - Do PV Fitting for LS = " << beginLumiOfPVFit_ << " to " << endLumiOfPVFit_;
1431  << "BeamMonitor::FitAndFill - [BeamFitter] Do BeamSpot Fit for LS = " << LSRange.first << " to "
1432  << LSRange.second;
1434  << "BeamMonitor::FitAndFill - [BeamMonitor] Do BeamSpot Fit for LS = " << beginLumiOfBSFit_ << " to "
1435  << endLumiOfBSFit_;
1436  onlineDbService_->logger().logInfo() << "BeamMonitor - RESULTS OF DEFAULT FIT:";
1437  onlineDbService_->logger().logInfo() << "\n" << bs;
1439  << "BeamMonitor::FitAndFill - [PayloadCreation] BeamSpotOnline object created:";
1440  onlineDbService_->logger().logInfo() << "\n" << BSOnline;
1441  onlineDbService_->logger().logInfo() << "BeamMonitor - Additional parameters for DIP:";
1442  onlineDbService_->logger().logInfo() << "Events used in the fit: " << BSOnline.usedEvents();
1443  onlineDbService_->logger().logInfo() << "Mean PV : " << BSOnline.meanPV();
1444  onlineDbService_->logger().logInfo() << "Mean PV Error : " << BSOnline.meanErrorPV();
1445  onlineDbService_->logger().logInfo() << "Rms PV : " << BSOnline.rmsPV();
1446  onlineDbService_->logger().logInfo() << "Rms PV Error : " << BSOnline.rmsErrorPV();
1447  onlineDbService_->logger().logInfo() << "Max PVs : " << BSOnline.maxPVs();
1448  onlineDbService_->logger().logInfo() << "StartTime : " << BSOnline.startTime();
1449  onlineDbService_->logger().logInfo() << "StartTimeStamp : " << BSOnline.startTimeStamp();
1450  onlineDbService_->logger().logInfo() << "EndTime : " << BSOnline.endTime();
1451  onlineDbService_->logger().logInfo() << "EndTimeStamp : " << BSOnline.endTimeStamp();
1452  onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - [PayloadCreation] onlineDbService available";
1454  << "BeamMonitor::FitAndFill - [PayloadCreation] SetCreationTime: " << creationTime
1455  << " [epoch in microseconds]";
1456  try {
1459  << "BeamMonitor::FitAndFill - [PayloadCreation] writeIOVForNextLumisection executed correctly";
1460  } catch (const std::exception& e) {
1461  onlineDbService_->logger().logError() << "BeamMonitor - Error writing record: " << recordName_
1462  << " for Run: " << frun << " - Lumi: " << LSRange.second;
1463  onlineDbService_->logger().logError() << "Error is: " << e.what();
1464  onlineDbService_->logger().logError() << "RESULTS OF DEFAULT FIT WAS:";
1465  onlineDbService_->logger().logError() << "\n" << bs;
1466  DBloggerReturn_ = 2;
1467  }
1468  }
1469  edm::LogInfo("BeamMonitor") << "FitAndFill::[PayloadCreation] BeamSpotOnline payload created \n" << std::endl;
1470 
1471  } //if (theBeamFitter->runPVandTrkFitter())
1472  else { // beam fit fails
1473  reco::BeamSpot bs = theBeamFitter->getBeamSpot();
1474  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] Beam fit fails!!! \n" << endl;
1475  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] Output beam spot for DIP \n" << endl;
1476  edm::LogInfo("BeamMonitor") << bs << endl;
1477 
1479  onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - Beam fit fails!!!";
1480  onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - Output beam spot for DIP";
1481  onlineDbService_->logger().logInfo() << "\n" << bs;
1482  DBloggerReturn_ = 2;
1483  }
1484 
1485  hs[k_sigmaX0_lumi]->ShiftFillLast(bs.BeamWidthX(), bs.BeamWidthXError(), fitNLumi_);
1486  hs[k_sigmaY0_lumi]->ShiftFillLast(bs.BeamWidthY(), bs.BeamWidthYError(), fitNLumi_);
1487  hs[k_sigmaZ0_lumi]->ShiftFillLast(bs.sigmaZ(), bs.sigmaZ0Error(), fitNLumi_);
1488  hs[k_x0_lumi]->ShiftFillLast(bs.x0(), bs.x0Error(), fitNLumi_);
1489  hs[k_y0_lumi]->ShiftFillLast(bs.y0(), bs.y0Error(), fitNLumi_);
1490  hs[k_z0_lumi]->ShiftFillLast(bs.z0(), bs.z0Error(), fitNLumi_);
1491  } // end of beam fit fails
1492 
1493  } //-------- end of countFitting------------------------------------------
1494  else { // no fit
1495  // Overwrite Fit LS and fit time when no event processed or no track selected
1497  theBeamFitter->setRefTime(refBStime[0], refBStime[1]);
1498  if (theBeamFitter->runPVandTrkFitter()) {
1499  } // Dump fake beam spot for DIP
1500  reco::BeamSpot bs = theBeamFitter->getBeamSpot();
1501  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] No fitting \n" << endl;
1502  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] Output fake beam spot for DIP \n" << endl;
1503  edm::LogInfo("BeamMonitor") << bs << endl;
1504 
1506  onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - No fitting";
1507  onlineDbService_->logger().logInfo() << "BeamMonitor::FitAndFill - Output fake beam spot for DIP";
1508  onlineDbService_->logger().logInfo() << "\n" << bs;
1509  DBloggerReturn_ = 2;
1510  }
1511 
1512  hs[k_sigmaX0_lumi]->ShiftFillLast(bs.BeamWidthX(), bs.BeamWidthXError(), fitNLumi_);
1513  hs[k_sigmaY0_lumi]->ShiftFillLast(bs.BeamWidthY(), bs.BeamWidthYError(), fitNLumi_);
1514  hs[k_sigmaZ0_lumi]->ShiftFillLast(bs.sigmaZ(), bs.sigmaZ0Error(), fitNLumi_);
1515  hs[k_x0_lumi]->ShiftFillLast(bs.x0(), bs.x0Error(), fitNLumi_);
1516  hs[k_y0_lumi]->ShiftFillLast(bs.y0(), bs.y0Error(), fitNLumi_);
1517  hs[k_z0_lumi]->ShiftFillLast(bs.z0(), bs.z0Error(), fitNLumi_);
1518  }
1519 
1520  // Fill summary report
1521  if (countFitting) {
1522  for (int n = 0; n < nFitElements_; n++) {
1524  }
1525 
1526  summarySum_ = 0;
1527  for (int ii = 0; ii < nFitElements_; ii++) {
1529  }
1531  if (reportSummary)
1533 
1534  for (int bi = 0; bi < nFitElements_; bi++) {
1535  reportSummaryMap->setBinContent(1, bi + 1, summaryContent_[bi] / (float)nFits_);
1536  }
1537  }
1538 
1539  if ((resetFitNLumi_ > 0 &&
1540  ((onlineMode_ &&
1541  countLumi_ == resetFitNLumi_) || //OR it should be currentLumi_ (if in sequence then does not mattar)
1542  (!onlineMode_ && countLumi_ == resetFitNLumi_))) ||
1543  (StartAverage_)) {
1544  edm::LogInfo("BeamMonitor") << "FitAndFill:: The flag is ON for running average Beam Spot fit" << endl;
1545  StartAverage_ = true;
1546  firstAverageFit_++;
1547  resetHistos_ = true;
1548  nthBSTrk_ = 0;
1549  beginLumiOfBSFit_ = 0;
1550  refBStime[0] = 0;
1551  }
1552 }
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:82
void setBeamWidthYError(double val)
set beam width Y error
std::unique_ptr< BeamFitter > theBeamFitter
Definition: BeamMonitor.h:95
float alpha
Definition: AMPTWrapper.h:105
unsigned int minNrVertices_
Definition: BeamMonitor.h:113
void setCovariance(int i, int j, double val)
set i,j element of the full covariance matrix 7x7
int nFitElements_
Definition: BeamMonitor.h:108
std::time_t refBStime[2]
Definition: BeamMonitor.h:105
void setStartTimeStamp(cond::Time_t val)
MonitorElement * reportSummary
Definition: BeamMonitor.h:182
double BeamWidthYError() const
error on beam width Y, assume error in X = Y
Definition: BeamSpot.h:101
int endLumiOfPVFit_
Definition: BeamMonitor.h:102
int resetFitNLumi_
Definition: BeamMonitor.h:88
void setEmittanceY(double val)
set emittance
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:160
bool testScroll(std::time_t &, std::time_t &)
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:167
std::string recordName_
Definition: BeamMonitor.h:78
virtual double getRMSError(int axis=1) const
get RMS uncertainty of histogram along x, y or z axis(axis=1,2,3 respectively)
bool processed_
Definition: BeamMonitor.h:122
void setBetaStar(double val)
set beta star
std::string to_string(const V &value)
Definition: OMSAccess.h:77
std::string endTime() const
int nLS_for_upload_
Definition: BeamMonitor.h:126
void setEndTimeStamp(cond::Time_t val)
std::vector< MonitorElement * > hs
Definition: BeamMonitor.h:164
int DBloggerReturn_
Definition: BeamMonitor.h:84
MonitorElement * h_sigmaZ0
Definition: BeamMonitor.h:155
MonitorElement * h_nTrk_lumi
Definition: BeamMonitor.h:139
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:173
std::string startTime() const
MonitorElement * fitResults
Definition: BeamMonitor.h:149
int fitPVNLumi_
Definition: BeamMonitor.h:87
MonitorElement * h_sigmaY0
Definition: BeamMonitor.h:154
void setType(int type)
set beam type
void setEndTime(std::string val)
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:167
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:168
void Fill(long long x)
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
DQM_DEPRECATED void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
MonitorElement * h_y0
Definition: BeamMonitor.h:151
void setEmittanceX(double val)
set emittance
virtual double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
EchoedLogStream< edm::LogError > logError()
Definition: Logger.cc:165
MonitorElement * h_vy_dz
Definition: BeamMonitor.h:146
std::string getGMTstring(const std::time_t &)
Definition: BeamMonitor.cc:91
cond::persistency::Logger & logger()
T sqrt(T t)
Definition: SSEVec.h:19
Float_t reportSummary_
Definition: BeamMonitor.h:179
std::time_t refTime
Definition: BeamMonitor.h:191
void setdydz(double val)
set dydz slope, crossing angle in XZ
MonitorElement * pvResults
Definition: BeamMonitor.h:163
int endLumiOfBSFit_
Definition: BeamMonitor.h:100
cond::Time_t endTimeStamp() const
std::time_t refPVtime[2]
Definition: BeamMonitor.h:106
MonitorElement * h_nVtx_lumi
Definition: BeamMonitor.h:140
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:84
cond::Time_t writeIOVForNextLumisection(const PayloadType &payload, const std::string &recordName)
virtual TProfile * getTProfile()
void setdxdz(double val)
set dxdz slope, crossing angle
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:176
ii
Definition: cuy.py:589
MonitorElement * h_nVtx_lumi_all
Definition: BeamMonitor.h:141
double BeamWidthXError() const
error on beam width X, assume error in X = Y
Definition: BeamSpot.h:99
Log< level::Info, false > LogInfo
std::time_t startTime
Definition: BeamMonitor.h:190
cond::Time_t startTimeStamp() const
Float_t summaryContent_[3]
Definition: BeamMonitor.h:181
MonitorElement * h_sigmaX0
Definition: BeamMonitor.h:153
bool StartAverage_
Definition: BeamMonitor.h:118
reco::BeamSpot preBS
Definition: BeamMonitor.h:136
MonitorElement * h_nVtx_st
Definition: BeamMonitor.h:157
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:159
virtual void setBinContent(int binx, double content)
set content of bin (1-D)
int beginLumiOfPVFit_
Definition: BeamMonitor.h:101
void setBeamWidthXError(double val)
set beam width X error
MonitorElement * reportSummaryContents[3]
Definition: BeamMonitor.h:183
void setSigmaZ(double val)
set sigma Z, RMS bunch length
void setLumiRange(std::string val)
MonitorElement * h_x0
Definition: BeamMonitor.h:150
MonitorElement * h_trk_z0
Definition: BeamMonitor.h:143
int resetPVNLumi_
Definition: BeamMonitor.h:89
Float_t summarySum_
Definition: BeamMonitor.h:180
virtual double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * h_vx_dz
Definition: BeamMonitor.h:145
int nAnalyzedLS_
Definition: BeamMonitor.h:125
MonitorElement * h_z0
Definition: BeamMonitor.h:152
void setStartTime(std::string val)
void setPosition(double x, double y, double z)
set XYZ position
void setBeamWidthX(double val)
set average transverse beam width X
unsigned int nthBSTrk_
Definition: BeamMonitor.h:107
void setCreationTime(cond::Time_t val)
unsigned int min_Ntrks_
Definition: BeamMonitor.h:111
bool isAvailable() const
Definition: Service.h:40
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:83
bool resetHistos_
Definition: BeamMonitor.h:117
EchoedLogStream< edm::LogInfo > logInfo()
Definition: Logger.cc:157
std::time_t tmpTime
Definition: BeamMonitor.h:189
int firstAverageFit_
Definition: BeamMonitor.h:119
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:158
int beginLumiOfBSFit_
Definition: BeamMonitor.h:99
virtual double getMeanError(int axis=1) const
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:167
MonitorElement * h_d0_phi0
Definition: BeamMonitor.h:142
void setBeamWidthY(double val)
set average transverse beam width Y
MonitorElement * h_vx_vy
Definition: BeamMonitor.h:144
int countLumi_
Definition: BeamMonitor.h:98
void scrollTH1(TH1 *, std::time_t)
MonitorElement * reportSummaryMap
Definition: BeamMonitor.h:184
bool onlineMode_
Definition: BeamMonitor.h:92
virtual void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:174

◆ formatFitTime()

void BeamMonitor::formatFitTime ( char *  ,
const std::time_t &   
)
private

Definition at line 43 of file BeamMonitor.cc.

References b, CEST, plotBeamSpotDB::ptm, submitPVValidationJobs::t, protons_cff::time, and HLT_2023v12_cff::year.

Referenced by bookHistograms(), and scrollTH1().

43  {
44  //constexpr int CET(+1);
45  constexpr int CEST(+2);
46 
47  //tm * ptm;
48  //ptm = gmtime ( &t );
49  //int year = ptm->tm_year;
50 
51  //get correct year from ctime
52  time_t currentTime;
53  struct tm* localTime;
54  time(&currentTime); // Get the current time
55  localTime = localtime(&currentTime); // Convert the current time to the local time
56  int year = localTime->tm_year + 1900;
57 
58  tm* ptm;
59  ptm = gmtime(&t);
60 
61  //check if year is ok
62  if (year <= 37)
63  year += 2000;
64  if (year >= 70 && year <= 137)
65  year += 1900;
66 
67  if (year < 1995) {
68  edm::LogError("BadTimeStamp") << "year reported is " << year << " !!" << std::endl;
69  //year = 2015; //overwritten later by BeamFitter.cc for fits but needed here for TH1
70  //edm::LogError("BadTimeStamp") << "Resetting to " <<year<<std::endl;
71  }
72  sprintf(ts,
73  "%4d-%02d-%02d %02d:%02d:%02d",
74  year,
75  ptm->tm_mon + 1,
76  ptm->tm_mday,
77  (ptm->tm_hour + CEST) % 24,
78  ptm->tm_min,
79  ptm->tm_sec);
80 
81 #ifdef STRIP_TRAILING_BLANKS_IN_TIMEZONE
82  unsigned int b = strlen(ts);
83  while (ts[--b] == ' ') {
84  ts[b] = 0;
85  }
86 #endif
87 }
#define CEST
Log< level::Error, false > LogError
double b
Definition: hdecay.h:118

◆ getGMTstring()

std::string BeamMonitor::getGMTstring ( const std::time_t &  )
private

Definition at line 91 of file BeamMonitor.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by FitAndFill().

91  {
92  char buff[32];
93  std::strftime(buff, sizeof(buff), "%Y.%m.%d %H:%M:%S GMT", gmtime(&timeToConvert));
94  std::string timeStr(buff);
95  return timeStr;
96 }

◆ RestartFitting()

void BeamMonitor::RestartFitting ( )
private

Definition at line 1555 of file BeamMonitor.cc.

References beginLumiOfBSFit_, beginLumiOfPVFit_, countGapLumi_, countLumi_, debug_, h_PVx, h_PVy, h_PVz, mapBeginBSLS, mapBeginBSTime, mapBeginPVLS, mapBeginPVTime, mapLSBSTrkSize, mapLSCF, mapLSPVStoreSize, mapNPV, mapPVx, mapPVy, mapPVz, nthBSTrk_, refBStime, refPVtime, dqm::impl::MonitorElement::Reset(), resetHistos_, StartAverage_, and theBeamFitter.

1555  {
1556  if (debug_)
1557  edm::LogInfo("BeamMonitor")
1558  << " RestartingFitting:: Restart Beami everything to a fresh start !!! because Gap is > 10 LS" << endl;
1559  //track based fit reset here
1560  resetHistos_ = true;
1561  nthBSTrk_ = 0;
1562  theBeamFitter->resetTrkVector();
1563  theBeamFitter->resetLSRange();
1564  theBeamFitter->resetRefTime();
1565  theBeamFitter->resetPVFitter();
1566  theBeamFitter->resetCutFlow();
1567  beginLumiOfBSFit_ = 0;
1568  refBStime[0] = 0;
1569  //pv based fit iis reset here
1570  h_PVx[0]->Reset();
1571  h_PVy[0]->Reset();
1572  h_PVz[0]->Reset();
1573  beginLumiOfPVFit_ = 0;
1574  refPVtime[0] = 0;
1575  //Clear all the Maps here
1576  mapPVx.clear();
1577  mapPVy.clear();
1578  mapPVz.clear();
1579  mapNPV.clear();
1580  mapBeginBSLS.clear();
1581  mapBeginPVLS.clear();
1582  mapBeginBSTime.clear();
1583  mapBeginPVTime.clear();
1584  mapLSBSTrkSize.clear();
1585  mapLSPVStoreSize.clear();
1586  mapLSCF.clear();
1587  countGapLumi_ = 0;
1588  countLumi_ = 0;
1589  StartAverage_ = false;
1590 }
std::unique_ptr< BeamFitter > theBeamFitter
Definition: BeamMonitor.h:95
std::time_t refBStime[2]
Definition: BeamMonitor.h:105
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:160
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:167
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:173
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:167
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:171
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:168
virtual void Reset()
Remove all data from the ME, keept the empty histogram with all its settings.
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:171
int countGapLumi_
Definition: BeamMonitor.h:120
std::time_t refPVtime[2]
Definition: BeamMonitor.h:106
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:176
Log< level::Info, false > LogInfo
bool StartAverage_
Definition: BeamMonitor.h:118
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:159
int beginLumiOfPVFit_
Definition: BeamMonitor.h:101
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:170
unsigned int nthBSTrk_
Definition: BeamMonitor.h:107
bool resetHistos_
Definition: BeamMonitor.h:117
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:158
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:170
int beginLumiOfBSFit_
Definition: BeamMonitor.h:99
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:167
int countLumi_
Definition: BeamMonitor.h:98
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:174

◆ scrollTH1()

void BeamMonitor::scrollTH1 ( TH1 *  ,
std::time_t   
)
private

Definition at line 1614 of file BeamMonitor.cc.

References newFWLiteAna::bin, buffTime, Calorimetry_cff::da, formatFitTime(), h, lastNZbin, and heppy_batch::val.

Referenced by FitAndFill().

1614  {
1615  char offsetTime[64];
1616  formatFitTime(offsetTime, ref);
1617  TDatime da(offsetTime);
1618  if (lastNZbin > 0) {
1619  double val = h->GetBinContent(lastNZbin);
1620  double valErr = h->GetBinError(lastNZbin);
1621  h->Reset();
1622  h->GetXaxis()->SetTimeOffset(da.Convert(kTRUE));
1623  int bin = (lastNZbin > buffTime ? buffTime : 1);
1624  h->SetBinContent(bin, val);
1625  h->SetBinError(bin, valErr);
1626  } else {
1627  h->Reset();
1628  h->GetXaxis()->SetTimeOffset(da.Convert(kTRUE));
1629  }
1630 }
void formatFitTime(char *, const std::time_t &)
Definition: BeamMonitor.cc:43
static constexpr int buffTime
Definition: BeamMonitor.cc:89
The Signals That Services Can Subscribe To This is based on ActivityRegistry h
Helper function to determine trigger accepts.
Definition: Activities.doc:4

◆ testScroll()

bool BeamMonitor::testScroll ( std::time_t &  ,
std::time_t &   
)
private

Definition at line 1634 of file BeamMonitor.cc.

References newFWLiteAna::bin, buffTime, hs, intervalInSec_, lastNZbin, and hltrates_dqm_sourceclient-live_cfg::offset.

Referenced by FitAndFill().

1634  {
1635  bool scroll_ = false;
1636  if (tmpTime_ - refTime_ >= intervalInSec_) {
1637  scroll_ = true;
1638  edm::LogInfo("BeamMonitor") << "testScroll:: Reset Time Offset" << std::endl;
1640  for (int bin = intervalInSec_; bin >= 1; bin--) {
1641  if (hs[k_x0_time]->getBinContent(bin) > 0) {
1642  lastNZbin = bin;
1643  break;
1644  }
1645  }
1646  edm::LogInfo("BeamMonitor") << "testScroll:: Last non zero bin = " << lastNZbin << std::endl;
1647  if (tmpTime_ - refTime_ >= intervalInSec_ + lastNZbin) {
1648  edm::LogInfo("BeamMonitor") << "testScroll:: Time difference too large since last readout" << std::endl;
1649  lastNZbin = 0;
1650  refTime_ = tmpTime_ - buffTime;
1651  } else {
1652  edm::LogInfo("BeamMonitor") << "testScroll:: Offset to last record" << std::endl;
1653  int offset = ((lastNZbin > buffTime) ? (lastNZbin - buffTime) : (lastNZbin - 1));
1654  refTime_ += offset;
1655  }
1656  }
1657  return scroll_;
1658 }
std::vector< MonitorElement * > hs
Definition: BeamMonitor.h:164
int intervalInSec_
Definition: BeamMonitor.h:90
static constexpr int buffTime
Definition: BeamMonitor.cc:89
Log< level::Info, false > LogInfo

Member Data Documentation

◆ beginLumiOfBSFit_

int BeamMonitor::beginLumiOfBSFit_
private

Definition at line 99 of file BeamMonitor.h.

Referenced by BeamMonitor(), beginLuminosityBlock(), FitAndFill(), and RestartFitting().

◆ beginLumiOfPVFit_

int BeamMonitor::beginLumiOfPVFit_
private

Definition at line 101 of file BeamMonitor.h.

Referenced by BeamMonitor(), beginLuminosityBlock(), FitAndFill(), and RestartFitting().

◆ bsSrc_

edm::EDGetTokenT<reco::BeamSpot> BeamMonitor::bsSrc_
private

Definition at line 79 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

◆ countEvt_

int BeamMonitor::countEvt_
private

Definition at line 97 of file BeamMonitor.h.

Referenced by analyze().

◆ countGapLumi_

int BeamMonitor::countGapLumi_
private

Definition at line 120 of file BeamMonitor.h.

Referenced by RestartFitting().

◆ countLumi_

int BeamMonitor::countLumi_
private

Definition at line 98 of file BeamMonitor.h.

Referenced by analyze(), beginLuminosityBlock(), FitAndFill(), and RestartFitting().

◆ cutFlowTable

MonitorElement* BeamMonitor::cutFlowTable
private

Definition at line 185 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ DBloggerReturn_

int BeamMonitor::DBloggerReturn_
private

Definition at line 84 of file BeamMonitor.h.

Referenced by beginLuminosityBlock(), endLuminosityBlock(), and FitAndFill().

◆ debug_

bool BeamMonitor::debug_
private

◆ deltaSigCut_

double BeamMonitor::deltaSigCut_
private

Definition at line 110 of file BeamMonitor.h.

Referenced by BeamMonitor().

◆ dxBin_

const int BeamMonitor::dxBin_
private

Definition at line 62 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ dxMax_

const double BeamMonitor::dxMax_
private

Definition at line 64 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ dxMin_

const double BeamMonitor::dxMin_
private

Definition at line 63 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ dzBin_

const int BeamMonitor::dzBin_
private

Definition at line 74 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ dzMax_

const double BeamMonitor::dzMax_
private

Definition at line 76 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ dzMin_

const double BeamMonitor::dzMin_
private

Definition at line 75 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ endLumiOfBSFit_

int BeamMonitor::endLumiOfBSFit_
private

Definition at line 100 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ endLumiOfPVFit_

int BeamMonitor::endLumiOfPVFit_
private

Definition at line 102 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ firstAverageFit_

int BeamMonitor::firstAverageFit_
private

Definition at line 119 of file BeamMonitor.h.

Referenced by FitAndFill().

◆ fitNLumi_

int BeamMonitor::fitNLumi_
private

Definition at line 86 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ fitPVNLumi_

int BeamMonitor::fitPVNLumi_
private

Definition at line 87 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ fitResults

MonitorElement* BeamMonitor::fitResults
private

Definition at line 149 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ frun

int BeamMonitor::frun
private

Definition at line 194 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ ftimestamp

edm::TimeValue_t BeamMonitor::ftimestamp
private

Definition at line 192 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ h_d0_phi0

MonitorElement* BeamMonitor::h_d0_phi0
private

Definition at line 142 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_nTrk_lumi

MonitorElement* BeamMonitor::h_nTrk_lumi
private

Definition at line 139 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_nVtx

MonitorElement* BeamMonitor::h_nVtx
private

Definition at line 156 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ h_nVtx_lumi

MonitorElement* BeamMonitor::h_nVtx_lumi
private

Definition at line 140 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_nVtx_lumi_all

MonitorElement* BeamMonitor::h_nVtx_lumi_all
private

Definition at line 141 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_nVtx_st

MonitorElement* BeamMonitor::h_nVtx_st
private

Definition at line 157 of file BeamMonitor.h.

Referenced by analyze(), bookHistograms(), and FitAndFill().

◆ h_PVx

MonitorElement* BeamMonitor::h_PVx[2]
private

Definition at line 158 of file BeamMonitor.h.

Referenced by analyze(), bookHistograms(), FitAndFill(), and RestartFitting().

◆ h_PVxz

MonitorElement* BeamMonitor::h_PVxz
private

Definition at line 161 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ h_PVy

MonitorElement* BeamMonitor::h_PVy[2]
private

Definition at line 159 of file BeamMonitor.h.

Referenced by analyze(), bookHistograms(), FitAndFill(), and RestartFitting().

◆ h_PVyz

MonitorElement* BeamMonitor::h_PVyz
private

Definition at line 162 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ h_PVz

MonitorElement* BeamMonitor::h_PVz[2]
private

Definition at line 160 of file BeamMonitor.h.

Referenced by analyze(), bookHistograms(), FitAndFill(), and RestartFitting().

◆ h_sigmaX0

MonitorElement* BeamMonitor::h_sigmaX0
private

Definition at line 153 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_sigmaY0

MonitorElement* BeamMonitor::h_sigmaY0
private

Definition at line 154 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_sigmaZ0

MonitorElement* BeamMonitor::h_sigmaZ0
private

Definition at line 155 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_trk_z0

MonitorElement* BeamMonitor::h_trk_z0
private

Definition at line 143 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_trkPt

MonitorElement* BeamMonitor::h_trkPt
private

Definition at line 147 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ h_trkVz

MonitorElement* BeamMonitor::h_trkVz
private

Definition at line 148 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

◆ h_vx_dz

MonitorElement* BeamMonitor::h_vx_dz
private

Definition at line 145 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_vx_vy

MonitorElement* BeamMonitor::h_vx_vy
private

Definition at line 144 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_vy_dz

MonitorElement* BeamMonitor::h_vy_dz
private

Definition at line 146 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_x0

MonitorElement* BeamMonitor::h_x0
private

Definition at line 150 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_y0

MonitorElement* BeamMonitor::h_y0
private

Definition at line 151 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ h_z0

MonitorElement* BeamMonitor::h_z0
private

Definition at line 152 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ hltSrc_

edm::EDGetTokenT<edm::TriggerResults> BeamMonitor::hltSrc_
private

Definition at line 82 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

◆ hs

std::vector<MonitorElement*> BeamMonitor::hs
private

Definition at line 164 of file BeamMonitor.h.

Referenced by bookHistograms(), FitAndFill(), and testScroll().

◆ intervalInSec_

int BeamMonitor::intervalInSec_
private

Definition at line 90 of file BeamMonitor.h.

Referenced by BeamMonitor(), bookHistograms(), and testScroll().

◆ jetTrigger_

std::vector<std::string> BeamMonitor::jetTrigger_
private

Definition at line 93 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

◆ lastlumi_

int BeamMonitor::lastlumi_
private

Definition at line 103 of file BeamMonitor.h.

Referenced by BeamMonitor(), and beginLuminosityBlock().

◆ lastNZbin

int BeamMonitor::lastNZbin
private

Definition at line 195 of file BeamMonitor.h.

Referenced by scrollTH1(), and testScroll().

◆ loggerActive_

bool BeamMonitor::loggerActive_
private

Definition at line 130 of file BeamMonitor.h.

Referenced by beginLuminosityBlock(), and endLuminosityBlock().

◆ logToDb_

bool BeamMonitor::logToDb_
private

Definition at line 129 of file BeamMonitor.h.

Referenced by analyze(), beginLuminosityBlock(), endLuminosityBlock(), and FitAndFill().

◆ mapBeginBSLS

std::map<int, int> BeamMonitor::mapBeginBSLS
private

Definition at line 170 of file BeamMonitor.h.

Referenced by beginLuminosityBlock(), dqmEndRun(), and RestartFitting().

◆ mapBeginBSTime

std::map<int, std::time_t> BeamMonitor::mapBeginBSTime
private

Definition at line 171 of file BeamMonitor.h.

Referenced by beginLuminosityBlock(), dqmEndRun(), and RestartFitting().

◆ mapBeginPVLS

std::map<int, int> BeamMonitor::mapBeginPVLS
private

Definition at line 170 of file BeamMonitor.h.

Referenced by beginLuminosityBlock(), dqmEndRun(), and RestartFitting().

◆ mapBeginPVTime

std::map<int, std::time_t> BeamMonitor::mapBeginPVTime
private

Definition at line 171 of file BeamMonitor.h.

Referenced by beginLuminosityBlock(), dqmEndRun(), and RestartFitting().

◆ mapLSBSTrkSize

std::map<int, std::size_t> BeamMonitor::mapLSBSTrkSize
private

Definition at line 173 of file BeamMonitor.h.

Referenced by dqmEndRun(), FitAndFill(), and RestartFitting().

◆ mapLSCF

std::map<int, TH1F> BeamMonitor::mapLSCF
private

Definition at line 176 of file BeamMonitor.h.

Referenced by dqmEndRun(), FitAndFill(), and RestartFitting().

◆ mapLSPVStoreSize

std::map<int, size_t> BeamMonitor::mapLSPVStoreSize
private

Definition at line 174 of file BeamMonitor.h.

Referenced by dqmEndRun(), FitAndFill(), and RestartFitting().

◆ mapNPV

std::map<int, std::vector<int> > BeamMonitor::mapNPV
private

Definition at line 168 of file BeamMonitor.h.

Referenced by analyze(), dqmEndRun(), FitAndFill(), and RestartFitting().

◆ mapPVx

std::map<int, std::vector<float> > BeamMonitor::mapPVx
private

Definition at line 167 of file BeamMonitor.h.

Referenced by analyze(), dqmEndRun(), FitAndFill(), and RestartFitting().

◆ mapPVy

std::map<int, std::vector<float> > BeamMonitor::mapPVy
private

Definition at line 167 of file BeamMonitor.h.

Referenced by analyze(), dqmEndRun(), FitAndFill(), and RestartFitting().

◆ mapPVz

std::map<int, std::vector<float> > BeamMonitor::mapPVz
private

Definition at line 167 of file BeamMonitor.h.

Referenced by analyze(), dqmEndRun(), FitAndFill(), and RestartFitting().

◆ maxZ_

double BeamMonitor::maxZ_
private

Definition at line 112 of file BeamMonitor.h.

Referenced by BeamMonitor().

◆ min_Ntrks_

unsigned int BeamMonitor::min_Ntrks_
private

Definition at line 111 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ minNrVertices_

unsigned int BeamMonitor::minNrVertices_
private

Definition at line 113 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ minVtxNdf_

double BeamMonitor::minVtxNdf_
private

Definition at line 114 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

◆ minVtxWgt_

double BeamMonitor::minVtxWgt_
private

Definition at line 115 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

◆ monitorName_

std::string BeamMonitor::monitorName_
private

Definition at line 77 of file BeamMonitor.h.

Referenced by BeamMonitor(), and bookHistograms().

◆ nAnalyzedLS_

int BeamMonitor::nAnalyzedLS_
private

Definition at line 125 of file BeamMonitor.h.

Referenced by beginLuminosityBlock(), dqmBeginRun(), and FitAndFill().

◆ nextlumi_

int BeamMonitor::nextlumi_
private

Definition at line 104 of file BeamMonitor.h.

Referenced by analyze(), BeamMonitor(), beginLuminosityBlock(), and endLuminosityBlock().

◆ nFitElements_

int BeamMonitor::nFitElements_
private

Definition at line 108 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ nFits_

int BeamMonitor::nFits_
private

Definition at line 109 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ nLS_for_upload_

int BeamMonitor::nLS_for_upload_
private

Definition at line 126 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ nthBSTrk_

unsigned int BeamMonitor::nthBSTrk_
private

Definition at line 107 of file BeamMonitor.h.

Referenced by FitAndFill(), and RestartFitting().

◆ onlineDbService_

edm::Service<cond::service::OnlineDBOutputService> BeamMonitor::onlineDbService_
private

◆ onlineMode_

bool BeamMonitor::onlineMode_
private

◆ phiBin_

const int BeamMonitor::phiBin_
private

Definition at line 70 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ phiMax_

const double BeamMonitor::phiMax_
private

Definition at line 72 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ phiMin_

const double BeamMonitor::phiMin_
private

Definition at line 71 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ preBS

reco::BeamSpot BeamMonitor::preBS
private

Definition at line 136 of file BeamMonitor.h.

Referenced by FitAndFill().

◆ processed_

bool BeamMonitor::processed_
private

Definition at line 122 of file BeamMonitor.h.

Referenced by analyze(), BeamMonitor(), beginLuminosityBlock(), and FitAndFill().

◆ pvResults

MonitorElement* BeamMonitor::pvResults
private

Definition at line 163 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ pvSrc_

edm::EDGetTokenT<reco::VertexCollection> BeamMonitor::pvSrc_
private

Definition at line 81 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

◆ recordName_

std::string BeamMonitor::recordName_
private

Definition at line 78 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ refBS

reco::BeamSpot BeamMonitor::refBS
private

Definition at line 135 of file BeamMonitor.h.

Referenced by analyze().

◆ refBStime

std::time_t BeamMonitor::refBStime[2]
private

◆ refPVtime

std::time_t BeamMonitor::refPVtime[2]
private

◆ refTime

std::time_t BeamMonitor::refTime
private

Definition at line 191 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ reportSummary

MonitorElement* BeamMonitor::reportSummary
private

Definition at line 182 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ reportSummary_

Float_t BeamMonitor::reportSummary_
private

Definition at line 179 of file BeamMonitor.h.

Referenced by FitAndFill().

◆ reportSummaryContents

MonitorElement* BeamMonitor::reportSummaryContents[3]
private

Definition at line 183 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ reportSummaryMap

MonitorElement* BeamMonitor::reportSummaryMap
private

Definition at line 184 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ resetFitNLumi_

int BeamMonitor::resetFitNLumi_
private

Definition at line 88 of file BeamMonitor.h.

Referenced by analyze(), BeamMonitor(), and FitAndFill().

◆ resetHistos_

bool BeamMonitor::resetHistos_
private

Definition at line 117 of file BeamMonitor.h.

Referenced by FitAndFill(), and RestartFitting().

◆ resetPVNLumi_

int BeamMonitor::resetPVNLumi_
private

Definition at line 89 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

◆ StartAverage_

bool BeamMonitor::StartAverage_
private

Definition at line 118 of file BeamMonitor.h.

Referenced by analyze(), beginLuminosityBlock(), FitAndFill(), and RestartFitting().

◆ startTime

std::time_t BeamMonitor::startTime
private

Definition at line 190 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ summaryContent_

Float_t BeamMonitor::summaryContent_[3]
private

Definition at line 181 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

◆ summarySum_

Float_t BeamMonitor::summarySum_
private

Definition at line 180 of file BeamMonitor.h.

Referenced by FitAndFill().

◆ tcdsToken_

edm::EDGetTokenT<TCDSRecord> BeamMonitor::tcdsToken_
private

Definition at line 128 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

◆ theBeamFitter

std::unique_ptr<BeamFitter> BeamMonitor::theBeamFitter
private

Definition at line 95 of file BeamMonitor.h.

Referenced by analyze(), BeamMonitor(), FitAndFill(), and RestartFitting().

◆ tmpTime

std::time_t BeamMonitor::tmpTime
private

Definition at line 189 of file BeamMonitor.h.

Referenced by bookHistograms(), endLuminosityBlock(), and FitAndFill().

◆ tracksLabel_

edm::EDGetTokenT<reco::TrackCollection> BeamMonitor::tracksLabel_
private

Definition at line 80 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

◆ useLockRecords_

bool BeamMonitor::useLockRecords_
private

Definition at line 123 of file BeamMonitor.h.

Referenced by BeamMonitor(), dqmBeginRun(), and dqmEndRun().

◆ vxBin_

const int BeamMonitor::vxBin_
private

Definition at line 66 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ vxMax_

const double BeamMonitor::vxMax_
private

Definition at line 68 of file BeamMonitor.h.

Referenced by bookHistograms().

◆ vxMin_

const double BeamMonitor::vxMin_
private

Definition at line 67 of file BeamMonitor.h.

Referenced by bookHistograms().