CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Public Member Functions | 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
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
std::vector< ESProxyIndex > const & esGetTokenIndicesVector (edm::Transition iTrans) const
 
std::vector< ESRecordIndex >
const & 
esGetTokenRecordIndicesVector (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector
< ProductResolverIndexAndSkipBit >
const & 
itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::array< std::vector< ModuleDescription const * > *, NumBranchTypes > &modulesAll, std::vector< ModuleProcessName > &modulesInPreviousProcesses, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void selectInputProcessBlocks (ProductRegistry const &productRegistry, ProcessBlockHelperBase const &processBlockHelperBase)
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

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
ProducesCollector producesCollector ()
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
template<BranchType B = InEvent>
EDConsumerBaseAdaptor< B > consumes (edm::InputTag tag) noexcept
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<Transition Tr = Transition::Event>
constexpr auto esConsumes () noexcept
 
template<Transition Tr = Transition::Event>
auto esConsumes (ESInputTag tag) noexcept
 
template<Transition Tr = Transition::Event>
ESGetTokenGeneric esConsumes (eventsetup::EventSetupRecordKey const &iRecord, eventsetup::DataKey const &iKey)
 Used with EventSetupRecord::doGet. More...
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
void resetItemsToGetFrom (BranchType iType)
 

Private 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::TriggerResults
hltSrc_
 
std::vector< MonitorElement * > hs
 
int intervalInSec_
 
std::vector< std::string > jetTrigger_
 
int lastlumi_
 
int lastNZbin
 
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::OnlineDBOutputService
onlineDbService_
 
bool onlineMode_
 
const int phiBin_
 
const double phiMax_
 
const double phiMin_
 
reco::BeamSpot preBS
 
bool processed_
 
MonitorElementpvResults
 
edm::EDGetTokenT
< reco::VertexCollection
pvSrc_
 
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_
 
std::unique_ptr< BeamFittertheBeamFitter
 
std::time_t tmpTime
 
edm::EDGetTokenT
< reco::TrackCollection
tracksLabel_
 
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
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 34 of file BeamMonitor.h.

Constructor & Destructor Documentation

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_, 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  monitorName_ = ps.getUntrackedParameter<string>("monitorName", "YourSubsystemName");
127  recordName_ = ps.getUntrackedParameter<string>("recordName");
128  bsSrc_ = consumes<reco::BeamSpot>(ps.getUntrackedParameter<InputTag>("beamSpot"));
129  tracksLabel_ = consumes<reco::TrackCollection>(
130  ps.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<InputTag>("TrackCollection"));
131  pvSrc_ = consumes<reco::VertexCollection>(ps.getUntrackedParameter<InputTag>("primaryVertex"));
132  hltSrc_ = consumes<TriggerResults>(ps.getParameter<InputTag>("hltResults"));
133  intervalInSec_ = ps.getUntrackedParameter<int>("timeInterval", 920); //40 LS X 23"
134  fitNLumi_ = ps.getUntrackedParameter<int>("fitEveryNLumi", -1);
135  resetFitNLumi_ = ps.getUntrackedParameter<int>("resetEveryNLumi", -1);
136  fitPVNLumi_ = ps.getUntrackedParameter<int>("fitPVEveryNLumi", -1);
137  resetPVNLumi_ = ps.getUntrackedParameter<int>("resetPVEveryNLumi", -1);
138  deltaSigCut_ = ps.getUntrackedParameter<double>("deltaSignificanceCut", 15);
139  debug_ = ps.getUntrackedParameter<bool>("Debug");
140  onlineMode_ = ps.getUntrackedParameter<bool>("OnlineMode");
141  jetTrigger_ = ps.getUntrackedParameter<std::vector<std::string> >("jetTrigger");
142  min_Ntrks_ = ps.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<int>("MinimumInputTracks");
143  maxZ_ = ps.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<double>("MaximumZ");
144  minNrVertices_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit");
145  minVtxNdf_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf");
146  minVtxWgt_ = ps.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight");
147  useLockRecords_ = ps.getUntrackedParameter<bool>("useLockRecords");
148  nLS_for_upload_ = ps.getUntrackedParameter<int>("nLSForUpload", 5);
149  if (!monitorName_.empty())
150  monitorName_ = monitorName_ + "/";
151 
152  theBeamFitter = std::make_unique<BeamFitter>(ps, consumesCollector());
153  theBeamFitter->resetTrkVector();
154  theBeamFitter->resetLSRange();
155  theBeamFitter->resetRefTime();
156  theBeamFitter->resetPVFitter();
157 
158  if (fitNLumi_ <= 0)
159  fitNLumi_ = 1;
161  refBStime[0] = refBStime[1] = refPVtime[0] = refPVtime[1] = 0;
162  maxZ_ = std::fabs(maxZ_);
163  lastlumi_ = 0;
164  nextlumi_ = 0;
165  processed_ = false;
166 }
edm::EDGetTokenT< edm::TriggerResults > hltSrc_
Definition: BeamMonitor.h:80
const double phiMax_
Definition: BeamMonitor.h:70
std::unique_ptr< BeamFitter > theBeamFitter
Definition: BeamMonitor.h:93
T getUntrackedParameter(std::string const &, T const &) const
unsigned int minNrVertices_
Definition: BeamMonitor.h:111
int nFitElements_
Definition: BeamMonitor.h:106
std::time_t refBStime[2]
Definition: BeamMonitor.h:103
int endLumiOfPVFit_
Definition: BeamMonitor.h:100
int resetFitNLumi_
Definition: BeamMonitor.h:86
const double dzMin_
Definition: BeamMonitor.h:73
double minVtxWgt_
Definition: BeamMonitor.h:113
std::string recordName_
Definition: BeamMonitor.h:76
double minVtxNdf_
Definition: BeamMonitor.h:112
bool processed_
Definition: BeamMonitor.h:120
edm::EDGetTokenT< reco::VertexCollection > pvSrc_
Definition: BeamMonitor.h:79
const double phiMin_
Definition: BeamMonitor.h:69
int nLS_for_upload_
Definition: BeamMonitor.h:124
const int dxBin_
Definition: BeamMonitor.h:60
const int vxBin_
Definition: BeamMonitor.h:64
std::vector< std::string > jetTrigger_
Definition: BeamMonitor.h:91
int fitPVNLumi_
Definition: BeamMonitor.h:85
const double dzMax_
Definition: BeamMonitor.h:74
int intervalInSec_
Definition: BeamMonitor.h:88
const double dxMin_
Definition: BeamMonitor.h:61
int countGapLumi_
Definition: BeamMonitor.h:118
edm::EDGetTokenT< reco::TrackCollection > tracksLabel_
Definition: BeamMonitor.h:78
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
int endLumiOfBSFit_
Definition: BeamMonitor.h:98
std::time_t refPVtime[2]
Definition: BeamMonitor.h:104
double maxZ_
Definition: BeamMonitor.h:110
const int phiBin_
Definition: BeamMonitor.h:68
bool StartAverage_
Definition: BeamMonitor.h:116
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: BeamMonitor.h:77
const double dxMax_
Definition: BeamMonitor.h:62
const double vxMin_
Definition: BeamMonitor.h:65
int beginLumiOfPVFit_
Definition: BeamMonitor.h:99
T getParameter(std::string const &) const
Definition: ParameterSet.h:303
const double vxMax_
Definition: BeamMonitor.h:66
int resetPVNLumi_
Definition: BeamMonitor.h:87
const int dzBin_
Definition: BeamMonitor.h:72
bool useLockRecords_
Definition: BeamMonitor.h:121
unsigned int nthBSTrk_
Definition: BeamMonitor.h:105
unsigned int min_Ntrks_
Definition: BeamMonitor.h:109
bool resetHistos_
Definition: BeamMonitor.h:115
double deltaSigCut_
Definition: BeamMonitor.h:108
int firstAverageFit_
Definition: BeamMonitor.h:117
int beginLumiOfBSFit_
Definition: BeamMonitor.h:97
std::string monitorName_
Definition: BeamMonitor.h:75
int countLumi_
Definition: BeamMonitor.h:96
bool onlineMode_
Definition: BeamMonitor.h:90

Member Function Documentation

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

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

Definition at line 663 of file BeamMonitor.cc.

References bsSrc_, countEvt_, countLumi_, cutFlowTable, dqm::impl::MonitorElement::Fill(), newFWLiteAna::found, edm::Event::getByToken(), 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, jetTrigger_, edm::EventBase::luminosityBlock(), mapNPV, mapPVx, mapPVy, mapPVz, minVtxNdf_, minVtxWgt_, dqmiodumpmetadata::n, nextlumi_, onlineMode_, processed_, edm::Handle< T >::product(), MetAnalyzer::pv(), pvSrc_, refBS, dqm::impl::MonitorElement::Reset(), resetFitNLumi_, dqm::impl::MonitorElement::setBinLabel(), StartAverage_, AlCaHLTBitMon_QueryRunRegistry::string, submitPVValidationJobs::t, theBeamFitter, HLT_FULL_cff::track, tracks, tracksLabel_, edm::TriggerNames::triggerIndex(), edm::TriggerNames::triggerName(), edm::Event::triggerNames(), triggerResults, and trigNames.

663  {
664  const int nthlumi = iEvent.luminosityBlock();
665  if (onlineMode_ && (nthlumi < nextlumi_)) {
666  edm::LogInfo("BeamMonitor") << "analyze:: Spilt event from previous lumi section!" << std::endl;
667  return;
668  }
669  if (onlineMode_ && (nthlumi > nextlumi_)) {
670  edm::LogInfo("BeamMonitor") << "analyze:: Spilt event from next lumi section!!!" << std::endl;
671  return;
672  }
673 
674  countEvt_++;
675  theBeamFitter->readEvent(
676  iEvent); //Remember when track fitter read the event in the same place the PVFitter read the events !!!!!!!!!
677 
678  Handle<reco::BeamSpot> recoBeamSpotHandle;
679  iEvent.getByToken(bsSrc_, recoBeamSpotHandle);
680  refBS = *recoBeamSpotHandle;
681 
682  //------Cut Flow Table filled every event!--------------------------------------
683  {
684  // Make a copy of the cut flow table from the beam fitter.
685  auto tmphisto = static_cast<TH1F*>(theBeamFitter->getCutFlow());
686  cutFlowTable->getTH1()->SetBins(
687  tmphisto->GetNbinsX(), tmphisto->GetXaxis()->GetXmin(), tmphisto->GetXaxis()->GetXmax());
688  // Update the bin labels
689  if (countEvt_ == 1) // SetLabel just once
690  for (int n = 0; n < tmphisto->GetNbinsX(); n++)
691  cutFlowTable->setBinLabel(n + 1, tmphisto->GetXaxis()->GetBinLabel(n + 1), 1);
692  cutFlowTable->Reset();
693  cutFlowTable->getTH1()->Add(tmphisto);
694  }
695 
696  //----Reco tracks -------------------------------------
698  iEvent.getByToken(tracksLabel_, TrackCollection);
699  const reco::TrackCollection* tracks = TrackCollection.product();
700  for (reco::TrackCollection::const_iterator track = tracks->begin(); track != tracks->end(); ++track) {
701  h_trkPt->Fill(track->pt()); //no need to change here for average bs
702  h_trkVz->Fill(track->vz());
703  }
704 
705  //-------HLT Trigger --------------------------------
707  bool JetTrigPass = false;
708  if (iEvent.getByToken(hltSrc_, triggerResults)) {
709  const edm::TriggerNames& trigNames = iEvent.triggerNames(*triggerResults);
710  for (unsigned int i = 0; i < triggerResults->size(); i++) {
711  const std::string& trigName = trigNames.triggerName(i);
712 
713  if (JetTrigPass)
714  continue;
715 
716  for (size_t t = 0; t < jetTrigger_.size(); ++t) {
717  if (JetTrigPass)
718  continue;
719 
720  string string_search(jetTrigger_[t]);
721  size_t found = trigName.find(string_search);
722 
723  if (found != string::npos) {
724  int thisTrigger_ = trigNames.triggerIndex(trigName);
725  if (triggerResults->accept(thisTrigger_))
726  JetTrigPass = true;
727  } //if trigger found
728  } //for(t=0;..)
729  } //for(i=0; ..)
730  } //if trigger colleciton exist)
731 
732  //------ Primary Vertices-------
734 
735  if (iEvent.getByToken(pvSrc_, PVCollection)) {
736  int nPVcount = 0;
737  int nPVcount_ST = 0; //For Single Trigger(hence ST)
738 
739  for (reco::VertexCollection::const_iterator pv = PVCollection->begin(); pv != PVCollection->end(); ++pv) {
740  //--- vertex selection
741  if (pv->isFake() || pv->tracksSize() == 0)
742  continue;
743  nPVcount++; // count non fake pv:
744 
745  if (JetTrigPass)
746  nPVcount_ST++; //non-fake pv with a specific trigger
747 
748  if (pv->ndof() < minVtxNdf_ || (pv->ndof() + 3.) / pv->tracksSize() < 2 * minVtxWgt_)
749  continue;
750 
751  //Fill this map to store xyx for pv so that later we can remove the first one for run aver
752  mapPVx[countLumi_].push_back(pv->x());
753  mapPVy[countLumi_].push_back(pv->y());
754  mapPVz[countLumi_].push_back(pv->z());
755 
756  if (!StartAverage_) { //for first N LS
757  h_PVx[0]->Fill(pv->x());
758  h_PVy[0]->Fill(pv->y());
759  h_PVz[0]->Fill(pv->z());
760  h_PVxz->Fill(pv->z(), pv->x());
761  h_PVyz->Fill(pv->z(), pv->y());
762  } //for first N LiS
763  else {
764  h_PVxz->Fill(pv->z(), pv->x());
765  h_PVyz->Fill(pv->z(), pv->y());
766  }
767 
768  } //loop over pvs
769 
770  h_nVtx->Fill(nPVcount * 1.); //no need to change it for average BS
771 
772  mapNPV[countLumi_].push_back((nPVcount_ST));
773 
774  if (!StartAverage_) {
775  h_nVtx_st->Fill(nPVcount_ST * 1.);
776  }
777 
778  } //if pv collection is availaable
779 
780  if (StartAverage_) {
781  map<int, std::vector<float> >::iterator itpvx = mapPVx.begin();
782  map<int, std::vector<float> >::iterator itpvy = mapPVy.begin();
783  map<int, std::vector<float> >::iterator itpvz = mapPVz.begin();
784 
785  map<int, std::vector<int> >::iterator itbspvinfo = mapNPV.begin();
786 
787  if ((int)mapPVx.size() > resetFitNLumi_) { //sometimes the events is not there but LS is there!
788  mapPVx.erase(itpvx);
789  mapPVy.erase(itpvy);
790  mapPVz.erase(itpvz);
791  mapNPV.erase(itbspvinfo);
792  } //loop over Last N lumi collected
793 
794  } //StartAverage==true
795 
796  processed_ = true;
797 }
edm::EDGetTokenT< edm::TriggerResults > hltSrc_
Definition: BeamMonitor.h:80
std::unique_ptr< BeamFitter > theBeamFitter
Definition: BeamMonitor.h:93
int resetFitNLumi_
Definition: BeamMonitor.h:86
MonitorElement * h_nVtx
Definition: BeamMonitor.h:149
double minVtxWgt_
Definition: BeamMonitor.h:113
MonitorElement * cutFlowTable
Definition: BeamMonitor.h:178
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:153
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:160
MonitorElement * h_PVxz
Definition: BeamMonitor.h:154
double minVtxNdf_
Definition: BeamMonitor.h:112
bool processed_
Definition: BeamMonitor.h:120
edm::EDGetTokenT< reco::VertexCollection > pvSrc_
Definition: BeamMonitor.h:79
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
unsigned int triggerIndex(std::string_view name) const
Definition: TriggerNames.cc:52
auto const & tracks
cannot be loose
std::vector< std::string > jetTrigger_
Definition: BeamMonitor.h:91
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:160
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:161
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:78
MonitorElement * h_PVyz
Definition: BeamMonitor.h:155
reco::BeamSpot refBS
Definition: BeamMonitor.h:128
static std::string const triggerResults
Definition: EdmProvDump.cc:44
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)
Log< level::Info, false > LogInfo
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:57
bool StartAverage_
Definition: BeamMonitor.h:116
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: BeamMonitor.h:77
MonitorElement * h_nVtx_st
Definition: BeamMonitor.h:150
T const * product() const
Definition: Handle.h:70
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:152
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:50
MonitorElement * h_trkPt
Definition: BeamMonitor.h:140
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:151
MonitorElement * h_trkVz
Definition: BeamMonitor.h:141
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:160
int countLumi_
Definition: BeamMonitor.h:96
bool onlineMode_
Definition: BeamMonitor.h:90
void BeamMonitor::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
overrideprotected

Definition at line 532 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(), cond::persistency::Logger::logInfo(), 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().

532  {
533  // start DB logger
534  DBloggerReturn_ = 0;
535  nAnalyzedLS_++;
538  onlineDbService_->logger().logInfo() << "BeamMonitor::beginLuminosityBlock - LS: " << lumiSeg.luminosityBlock()
539  << " - Run: " << lumiSeg.getRun().run();
540  }
541 
542  int nthlumi = lumiSeg.luminosityBlock();
543  const edm::TimeValue_t fbegintimestamp = lumiSeg.beginTime().value();
544  const std::time_t ftmptime = fbegintimestamp >> 32;
545 
546  if (countLumi_ == 0 && (!processed_)) {
548  refBStime[0] = refPVtime[0] = ftmptime;
549  mapBeginBSLS[countLumi_] = nthlumi;
550  mapBeginPVLS[countLumi_] = nthlumi;
551  mapBeginBSTime[countLumi_] = ftmptime;
552  mapBeginPVTime[countLumi_] = ftmptime;
553  } //for the first record
554 
555  if (nthlumi > nextlumi_) {
556  if (processed_) {
557  countLumi_++;
558  //store here them will need when we remove the first one of Last N LS
559  mapBeginBSLS[countLumi_] = nthlumi;
560  mapBeginPVLS[countLumi_] = nthlumi;
561  mapBeginBSTime[countLumi_] = ftmptime;
562  mapBeginPVTime[countLumi_] = ftmptime;
563  } //processed passed but not the first lumi
564  if ((!processed_) && countLumi_ != 0) {
565  mapBeginBSLS[countLumi_] = nthlumi;
566  mapBeginPVLS[countLumi_] = nthlumi;
567  mapBeginBSTime[countLumi_] = ftmptime;
568  mapBeginPVTime[countLumi_] = ftmptime;
569  } //processed fails for last lumi
570  } //nthLumi > nextlumi
571 
572  if (StartAverage_) {
573  //Just Make sure it get rest
574  refBStime[0] = 0;
575  refPVtime[0] = 0;
576  beginLumiOfPVFit_ = 0;
577  beginLumiOfBSFit_ = 0;
578 
579  if (debug_)
580  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock: Size of mapBeginBSLS before = " << mapBeginBSLS.size()
581  << endl;
582  if (nthlumi >
583  nextlumi_) { //this make sure that it does not take into account this lumi for fitting and only look forward for new lumi
584  //as countLumi also remains the same so map value get overwritten once return to normal running.
585  //even if few LS are misssing and DQM module do not sees them then it catchs up again
586  map<int, int>::iterator itbs = mapBeginBSLS.begin();
587  map<int, int>::iterator itpv = mapBeginPVLS.begin();
588  map<int, std::time_t>::iterator itbstime = mapBeginBSTime.begin();
589  map<int, std::time_t>::iterator itpvtime = mapBeginPVTime.begin();
590 
591  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
592  mapBeginBSLS.erase(itbs);
593  mapBeginPVLS.erase(itpv);
594  mapBeginBSTime.erase(itbstime);
595  mapBeginPVTime.erase(itpvtime);
596  }
597  /*//not sure if want this or not ??
598  map<int, int>::iterator itgapb=mapBeginBSLS.begin();
599  map<int, int>::iterator itgape=mapBeginBSLS.end(); itgape--;
600  countGapLumi_ = ( (itgape->second) - (itgapb->second) );
601  //if we see Gap more than then 2*resetNFitLumi !!!!!!!
602  //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
603  // so better start as fresh and reset everything like starting in the begining!
604  if(countGapLumi_ >= 2*resetFitNLumi_){RestartFitting(); mapBeginBSLS[countLumi_] = nthlumi;}
605  */
606  }
607 
608  if (debug_)
609  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Size of mapBeginBSLS After = " << mapBeginBSLS.size()
610  << endl;
611 
612  map<int, int>::iterator bbs = mapBeginBSLS.begin();
613  map<int, int>::iterator bpv = mapBeginPVLS.begin();
614  map<int, std::time_t>::iterator bbst = mapBeginBSTime.begin();
615  map<int, std::time_t>::iterator bpvt = mapBeginPVTime.begin();
616 
617  if (beginLumiOfPVFit_ == 0)
618  beginLumiOfPVFit_ = bpv->second; //new begin time after removing the LS
619  if (beginLumiOfBSFit_ == 0)
620  beginLumiOfBSFit_ = bbs->second;
621  if (refBStime[0] == 0)
622  refBStime[0] = bbst->second;
623  if (refPVtime[0] == 0)
624  refPVtime[0] = bpvt->second;
625 
626  } //same logic for average fit as above commented line
627 
628  map<int, std::time_t>::iterator nbbst = mapBeginBSTime.begin();
629  map<int, std::time_t>::iterator nbpvt = mapBeginPVTime.begin();
630 
631  if (onlineMode_ && (nthlumi < nextlumi_))
632  return;
633 
634  if (onlineMode_) {
635  if (nthlumi > nextlumi_) {
636  if (countLumi_ != 0 && processed_)
637  FitAndFill(lumiSeg, lastlumi_, nextlumi_, nthlumi);
638  nextlumi_ = nthlumi;
639  edm::LogInfo("BeamMonitor") << "beginLuminosityBlock:: Next Lumi to Fit: " << nextlumi_ << endl;
640  if ((StartAverage_) && refBStime[0] == 0)
641  refBStime[0] = nbbst->second;
642  if ((StartAverage_) && refPVtime[0] == 0)
643  refPVtime[0] = nbpvt->second;
644  }
645  } else {
646  if (processed_)
647  FitAndFill(lumiSeg, lastlumi_, nextlumi_, nthlumi);
648  nextlumi_ = nthlumi;
649  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Next Lumi to Fit: " << nextlumi_ << endl;
650  if ((StartAverage_) && refBStime[0] == 0)
651  refBStime[0] = nbbst->second;
652  if ((StartAverage_) && refPVtime[0] == 0)
653  refPVtime[0] = nbpvt->second;
654  }
655 
656  //countLumi_++;
657  if (processed_)
658  processed_ = false;
659  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Begin of Lumi: " << nthlumi << endl;
660 }
std::time_t refBStime[2]
Definition: BeamMonitor.h:103
RunNumber_t run() const
Definition: RunBase.h:40
bool processed_
Definition: BeamMonitor.h:120
Timestamp const & beginTime() const
int DBloggerReturn_
Definition: BeamMonitor.h:82
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:164
LuminosityBlockNumber_t luminosityBlock() const
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:164
cond::persistency::Logger & logger()
bool isAvailable() const
Definition: Service.h:40
std::time_t refPVtime[2]
Definition: BeamMonitor.h:104
unsigned long long TimeValue_t
Definition: Timestamp.h:28
Log< level::Info, false > LogInfo
void FitAndFill(const edm::LuminosityBlock &lumiSeg, int &, int &, int &)
Definition: BeamMonitor.cc:819
bool StartAverage_
Definition: BeamMonitor.h:116
int beginLumiOfPVFit_
Definition: BeamMonitor.h:99
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:163
int nAnalyzedLS_
Definition: BeamMonitor.h:123
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:81
EchoedLogStream< edm::LogInfo > logInfo()
Definition: Logger.cc:157
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:163
int beginLumiOfBSFit_
Definition: BeamMonitor.h:97
TimeValue_t value() const
Definition: Timestamp.h:45
int countLumi_
Definition: BeamMonitor.h:96
bool onlineMode_
Definition: BeamMonitor.h:90
Run const & getRun() const
void BeamMonitor::bookHistograms ( DQMStore::IBooker i,
const edm::Run r,
const edm::EventSetup c 
)
overrideprotectedvirtual

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

Definition at line 221 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, plotBeamSpotDB::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, hs, mps_fire::i, intervalInSec_, label, monitorName_, dqmiodumpmetadata::n, nFitElements_, AlCaHLTBitMon_ParallelJobs::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_, and vxMin_.

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

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

Definition at line 214 of file BeamMonitor.cc.

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

214  {
217  }
218  nAnalyzedLS_ = 0;
219 }
bool isAvailable() const
Definition: Service.h:40
int nAnalyzedLS_
Definition: BeamMonitor.h:123
bool useLockRecords_
Definition: BeamMonitor.h:121
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:81
void BeamMonitor::dqmEndRun ( const edm::Run r,
const edm::EventSetup c 
)
overrideprotectedvirtual

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

Definition at line 1572 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_.

1572  {
1573  if (debug_)
1574  edm::LogInfo("BeamMonitor") << "dqmEndRun:: Clearing all the Maps " << endl;
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 
1590  }
1591 }
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:160
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:166
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:160
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:164
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:161
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:164
bool isAvailable() const
Definition: Service.h:40
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:169
Log< level::Info, false > LogInfo
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:163
bool useLockRecords_
Definition: BeamMonitor.h:121
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:81
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:163
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:160
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:167
void BeamMonitor::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
overrideprotected

Definition at line 800 of file BeamMonitor.cc.

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

800  {
801  int nthlumi = lumiSeg.id().luminosityBlock();
802  edm::LogInfo("BeamMonitor") << "endLuminosityBlock:: Lumi of the last event before endLuminosityBlock: " << nthlumi
803  << endl;
804 
805  if (onlineMode_ && nthlumi < nextlumi_)
806  return;
807  const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
808  const std::time_t fendtime = fendtimestamp >> 32;
809  tmpTime = refBStime[1] = refPVtime[1] = fendtime;
810 
811  // end DB logger
813  onlineDbService_->logger().logInfo() << "BeamMonitor::endLuminosityBlock";
815  }
816 }
LuminosityBlockID id() const
std::time_t refBStime[2]
Definition: BeamMonitor.h:103
int DBloggerReturn_
Definition: BeamMonitor.h:82
cond::persistency::Logger & logger()
Timestamp const & endTime() const
bool isAvailable() const
Definition: Service.h:40
std::time_t refPVtime[2]
Definition: BeamMonitor.h:104
unsigned long long TimeValue_t
Definition: Timestamp.h:28
Log< level::Info, false > LogInfo
LuminosityBlockNumber_t luminosityBlock() const
edm::Service< cond::service::OnlineDBOutputService > onlineDbService_
Definition: BeamMonitor.h:81
EchoedLogStream< edm::LogInfo > logInfo()
Definition: Logger.cc:157
std::time_t tmpTime
Definition: BeamMonitor.h:182
void end(int retCode)
Definition: Logger.cc:80
TimeValue_t value() const
Definition: Timestamp.h:45
bool onlineMode_
Definition: BeamMonitor.h:90
void BeamMonitor::FitAndFill ( const edm::LuminosityBlock lumiSeg,
int &  lastlumi,
int &  nextlumi,
int &  nthlumi 
)
private

Definition at line 819 of file BeamMonitor.cc.

References alpha, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthXError(), reco::BeamSpot::BeamWidthY(), reco::BeamSpot::BeamWidthYError(), SplitLinear::begin, beginLumiOfBSFit_, beginLumiOfPVFit_, reco::BeamSpot::betaStar(), cms::cuda::bs, submitPVResolutionJobs::count, countLumi_, reco::BeamSpot::covariance(), BeamSpotPI::creationTime, DBloggerReturn_, debug_, reco::BeamSpot::dxdz(), reco::BeamSpot::dxdzError(), reco::BeamSpot::dydz(), reco::BeamSpot::dydzError(), alignCSCRings::e, reco::BeamSpot::emittanceX(), reco::BeamSpot::emittanceY(), dataset::end, endLumiOfBSFit_, endLumiOfPVFit_, cppFunctionSkipper::exception, validate-o2o-wbm::f1, dqm::impl::MonitorElement::Fill(), firstAverageFit_, fitNLumi_, fitPVNLumi_, fitResults, frun, BeamSpotOnlineObjects::GetEndTime(), BeamSpotOnlineObjects::GetEndTimeStamp(), getGMTstring(), BeamSpotOnlineObjects::GetMaxPVs(), dqm::impl::MonitorElement::getMean(), dqm::impl::MonitorElement::getMeanError(), BeamSpotOnlineObjects::GetMeanErrorPV(), BeamSpotOnlineObjects::GetMeanPV(), dqm::impl::MonitorElement::getRMS(), dqm::impl::MonitorElement::getRMSError(), BeamSpotOnlineObjects::GetRmsErrorPV(), BeamSpotOnlineObjects::GetRmsPV(), BeamSpotOnlineObjects::GetStartTime(), BeamSpotOnlineObjects::GetStartTimeStamp(), dqm::impl::MonitorElement::getTH1(), dqm::impl::MonitorElement::getTH1F(), dqm::impl::MonitorElement::getTProfile(), BeamSpotOnlineObjects::GetUsedEvents(), 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(), mapLSBSTrkSize, mapLSCF, mapLSPVStoreSize, mapNPV, mapPVx, mapPVy, mapPVz, SiStripPI::mean, 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_, 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::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(), reco::BeamSpot::sigmaZ(), reco::BeamSpot::sigmaZ0Error(), mathSSE::sqrt(), StartAverage_, startTime, summaryContent_, summarySum_, testScroll(), theBeamFitter, tmpTime, reco::BeamSpot::type(), cond::service::OnlineDBOutputService::writeIOVForNextLumisection(), reco::BeamSpot::x0(), reco::BeamSpot::x0Error(), reco::BeamSpot::y0(), reco::BeamSpot::y0Error(), reco::BeamSpot::z0(), and reco::BeamSpot::z0Error().

Referenced by beginLuminosityBlock().

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

Definition at line 43 of file BeamMonitor.cc.

References b, CEST, and plotBeamSpotDB::ptm.

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
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 }
void BeamMonitor::RestartFitting ( )
private

Definition at line 1534 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.

1534  {
1535  if (debug_)
1536  edm::LogInfo("BeamMonitor")
1537  << " RestartingFitting:: Restart Beami everything to a fresh start !!! because Gap is > 10 LS" << endl;
1538  //track based fit reset here
1539  resetHistos_ = true;
1540  nthBSTrk_ = 0;
1541  theBeamFitter->resetTrkVector();
1542  theBeamFitter->resetLSRange();
1543  theBeamFitter->resetRefTime();
1544  theBeamFitter->resetPVFitter();
1545  theBeamFitter->resetCutFlow();
1546  beginLumiOfBSFit_ = 0;
1547  refBStime[0] = 0;
1548  //pv based fit iis reset here
1549  h_PVx[0]->Reset();
1550  h_PVy[0]->Reset();
1551  h_PVz[0]->Reset();
1552  beginLumiOfPVFit_ = 0;
1553  refPVtime[0] = 0;
1554  //Clear all the Maps here
1555  mapPVx.clear();
1556  mapPVy.clear();
1557  mapPVz.clear();
1558  mapNPV.clear();
1559  mapBeginBSLS.clear();
1560  mapBeginPVLS.clear();
1561  mapBeginBSTime.clear();
1562  mapBeginPVTime.clear();
1563  mapLSBSTrkSize.clear();
1564  mapLSPVStoreSize.clear();
1565  mapLSCF.clear();
1566  countGapLumi_ = 0;
1567  countLumi_ = 0;
1568  StartAverage_ = false;
1569 }
std::unique_ptr< BeamFitter > theBeamFitter
Definition: BeamMonitor.h:93
std::time_t refBStime[2]
Definition: BeamMonitor.h:103
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:153
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:160
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:166
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:160
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:164
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:161
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:164
int countGapLumi_
Definition: BeamMonitor.h:118
std::time_t refPVtime[2]
Definition: BeamMonitor.h:104
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:169
Log< level::Info, false > LogInfo
bool StartAverage_
Definition: BeamMonitor.h:116
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:152
int beginLumiOfPVFit_
Definition: BeamMonitor.h:99
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:163
unsigned int nthBSTrk_
Definition: BeamMonitor.h:105
bool resetHistos_
Definition: BeamMonitor.h:115
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:151
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:163
int beginLumiOfBSFit_
Definition: BeamMonitor.h:97
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:160
int countLumi_
Definition: BeamMonitor.h:96
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:167
void BeamMonitor::scrollTH1 ( TH1 *  ,
std::time_t   
)
private

Definition at line 1593 of file BeamMonitor.cc.

References newFWLiteAna::bin, buffTime, plotBeamSpotDB::da, formatFitTime(), lastNZbin, and hgcalPerformanceValidation::val.

Referenced by FitAndFill().

1593  {
1594  char offsetTime[64];
1595  formatFitTime(offsetTime, ref);
1596  TDatime da(offsetTime);
1597  if (lastNZbin > 0) {
1598  double val = h->GetBinContent(lastNZbin);
1599  double valErr = h->GetBinError(lastNZbin);
1600  h->Reset();
1601  h->GetXaxis()->SetTimeOffset(da.Convert(kTRUE));
1602  int bin = (lastNZbin > buffTime ? buffTime : 1);
1603  h->SetBinContent(bin, val);
1604  h->SetBinError(bin, valErr);
1605  } else {
1606  h->Reset();
1607  h->GetXaxis()->SetTimeOffset(da.Convert(kTRUE));
1608  }
1609 }
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
bool BeamMonitor::testScroll ( std::time_t &  ,
std::time_t &   
)
private

Definition at line 1613 of file BeamMonitor.cc.

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

Referenced by FitAndFill().

1613  {
1614  bool scroll_ = false;
1615  if (tmpTime_ - refTime_ >= intervalInSec_) {
1616  scroll_ = true;
1617  edm::LogInfo("BeamMonitor") << "testScroll:: Reset Time Offset" << std::endl;
1619  for (int bin = intervalInSec_; bin >= 1; bin--) {
1620  if (hs[k_x0_time]->getBinContent(bin) > 0) {
1621  lastNZbin = bin;
1622  break;
1623  }
1624  }
1625  edm::LogInfo("BeamMonitor") << "testScroll:: Last non zero bin = " << lastNZbin << std::endl;
1626  if (tmpTime_ - refTime_ >= intervalInSec_ + lastNZbin) {
1627  edm::LogInfo("BeamMonitor") << "testScroll:: Time difference too large since last readout" << std::endl;
1628  lastNZbin = 0;
1629  refTime_ = tmpTime_ - buffTime;
1630  } else {
1631  edm::LogInfo("BeamMonitor") << "testScroll:: Offset to last record" << std::endl;
1632  int offset = ((lastNZbin > buffTime) ? (lastNZbin - buffTime) : (lastNZbin - 1));
1633  refTime_ += offset;
1634  }
1635  }
1636  return scroll_;
1637 }
std::vector< MonitorElement * > hs
Definition: BeamMonitor.h:157
int intervalInSec_
Definition: BeamMonitor.h:88
static constexpr int buffTime
Definition: BeamMonitor.cc:89
Log< level::Info, false > LogInfo

Member Data Documentation

int BeamMonitor::beginLumiOfBSFit_
private

Definition at line 97 of file BeamMonitor.h.

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

int BeamMonitor::beginLumiOfPVFit_
private

Definition at line 99 of file BeamMonitor.h.

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

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

Definition at line 77 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

int BeamMonitor::countEvt_
private

Definition at line 95 of file BeamMonitor.h.

Referenced by analyze().

int BeamMonitor::countGapLumi_
private

Definition at line 118 of file BeamMonitor.h.

Referenced by RestartFitting().

int BeamMonitor::countLumi_
private

Definition at line 96 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::cutFlowTable
private

Definition at line 178 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

int BeamMonitor::DBloggerReturn_
private

Definition at line 82 of file BeamMonitor.h.

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

bool BeamMonitor::debug_
private
double BeamMonitor::deltaSigCut_
private

Definition at line 108 of file BeamMonitor.h.

Referenced by BeamMonitor().

const int BeamMonitor::dxBin_
private

Definition at line 60 of file BeamMonitor.h.

Referenced by bookHistograms().

const double BeamMonitor::dxMax_
private

Definition at line 62 of file BeamMonitor.h.

Referenced by bookHistograms().

const double BeamMonitor::dxMin_
private

Definition at line 61 of file BeamMonitor.h.

Referenced by bookHistograms().

const int BeamMonitor::dzBin_
private

Definition at line 72 of file BeamMonitor.h.

Referenced by bookHistograms().

const double BeamMonitor::dzMax_
private

Definition at line 74 of file BeamMonitor.h.

Referenced by bookHistograms().

const double BeamMonitor::dzMin_
private

Definition at line 73 of file BeamMonitor.h.

Referenced by bookHistograms().

int BeamMonitor::endLumiOfBSFit_
private

Definition at line 98 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

int BeamMonitor::endLumiOfPVFit_
private

Definition at line 100 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

int BeamMonitor::firstAverageFit_
private

Definition at line 117 of file BeamMonitor.h.

Referenced by FitAndFill().

int BeamMonitor::fitNLumi_
private

Definition at line 84 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

int BeamMonitor::fitPVNLumi_
private

Definition at line 85 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

MonitorElement* BeamMonitor::fitResults
private

Definition at line 142 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

int BeamMonitor::frun
private

Definition at line 187 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

edm::TimeValue_t BeamMonitor::ftimestamp
private

Definition at line 185 of file BeamMonitor.h.

Referenced by bookHistograms().

MonitorElement* BeamMonitor::h_d0_phi0
private

Definition at line 135 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_nTrk_lumi
private

Definition at line 132 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_nVtx
private

Definition at line 149 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* BeamMonitor::h_nVtx_lumi
private

Definition at line 133 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_nVtx_lumi_all
private

Definition at line 134 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_nVtx_st
private

Definition at line 150 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::h_PVx[2]
private

Definition at line 151 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::h_PVxz
private

Definition at line 154 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* BeamMonitor::h_PVy[2]
private

Definition at line 152 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::h_PVyz
private

Definition at line 155 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* BeamMonitor::h_PVz[2]
private

Definition at line 153 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::h_sigmaX0
private

Definition at line 146 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_sigmaY0
private

Definition at line 147 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_sigmaZ0
private

Definition at line 148 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_trk_z0
private

Definition at line 136 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_trkPt
private

Definition at line 140 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* BeamMonitor::h_trkVz
private

Definition at line 141 of file BeamMonitor.h.

Referenced by analyze(), and bookHistograms().

MonitorElement* BeamMonitor::h_vx_dz
private

Definition at line 138 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_vx_vy
private

Definition at line 137 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_vy_dz
private

Definition at line 139 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_x0
private

Definition at line 143 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_y0
private

Definition at line 144 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::h_z0
private

Definition at line 145 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

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

Definition at line 80 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

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

Definition at line 157 of file BeamMonitor.h.

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

int BeamMonitor::intervalInSec_
private

Definition at line 88 of file BeamMonitor.h.

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

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

Definition at line 91 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

int BeamMonitor::lastlumi_
private

Definition at line 101 of file BeamMonitor.h.

Referenced by BeamMonitor(), and beginLuminosityBlock().

int BeamMonitor::lastNZbin
private

Definition at line 188 of file BeamMonitor.h.

Referenced by scrollTH1(), and testScroll().

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

Definition at line 163 of file BeamMonitor.h.

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

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

Definition at line 164 of file BeamMonitor.h.

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

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

Definition at line 163 of file BeamMonitor.h.

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

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

Definition at line 164 of file BeamMonitor.h.

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

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

Definition at line 166 of file BeamMonitor.h.

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

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

Definition at line 169 of file BeamMonitor.h.

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

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

Definition at line 167 of file BeamMonitor.h.

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

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

Definition at line 161 of file BeamMonitor.h.

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

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

Definition at line 160 of file BeamMonitor.h.

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

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

Definition at line 160 of file BeamMonitor.h.

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

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

Definition at line 160 of file BeamMonitor.h.

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

double BeamMonitor::maxZ_
private

Definition at line 110 of file BeamMonitor.h.

Referenced by BeamMonitor().

unsigned int BeamMonitor::min_Ntrks_
private

Definition at line 109 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

unsigned int BeamMonitor::minNrVertices_
private

Definition at line 111 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

double BeamMonitor::minVtxNdf_
private

Definition at line 112 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

double BeamMonitor::minVtxWgt_
private

Definition at line 113 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

std::string BeamMonitor::monitorName_
private

Definition at line 75 of file BeamMonitor.h.

Referenced by BeamMonitor(), and bookHistograms().

int BeamMonitor::nAnalyzedLS_
private

Definition at line 123 of file BeamMonitor.h.

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

int BeamMonitor::nextlumi_
private

Definition at line 102 of file BeamMonitor.h.

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

int BeamMonitor::nFitElements_
private

Definition at line 106 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

int BeamMonitor::nFits_
private

Definition at line 107 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

int BeamMonitor::nLS_for_upload_
private

Definition at line 124 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

unsigned int BeamMonitor::nthBSTrk_
private

Definition at line 105 of file BeamMonitor.h.

Referenced by FitAndFill(), and RestartFitting().

edm::Service<cond::service::OnlineDBOutputService> BeamMonitor::onlineDbService_
private
bool BeamMonitor::onlineMode_
private
const int BeamMonitor::phiBin_
private

Definition at line 68 of file BeamMonitor.h.

Referenced by bookHistograms().

const double BeamMonitor::phiMax_
private

Definition at line 70 of file BeamMonitor.h.

Referenced by bookHistograms().

const double BeamMonitor::phiMin_
private

Definition at line 69 of file BeamMonitor.h.

Referenced by bookHistograms().

reco::BeamSpot BeamMonitor::preBS
private

Definition at line 129 of file BeamMonitor.h.

Referenced by FitAndFill().

bool BeamMonitor::processed_
private

Definition at line 120 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::pvResults
private

Definition at line 156 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

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

Definition at line 79 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

std::string BeamMonitor::recordName_
private

Definition at line 76 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

reco::BeamSpot BeamMonitor::refBS
private

Definition at line 128 of file BeamMonitor.h.

Referenced by analyze().

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

Definition at line 184 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::reportSummary
private

Definition at line 175 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

Float_t BeamMonitor::reportSummary_
private

Definition at line 172 of file BeamMonitor.h.

Referenced by FitAndFill().

MonitorElement* BeamMonitor::reportSummaryContents[3]
private

Definition at line 176 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

MonitorElement* BeamMonitor::reportSummaryMap
private

Definition at line 177 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

int BeamMonitor::resetFitNLumi_
private

Definition at line 86 of file BeamMonitor.h.

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

bool BeamMonitor::resetHistos_
private

Definition at line 115 of file BeamMonitor.h.

Referenced by FitAndFill(), and RestartFitting().

int BeamMonitor::resetPVNLumi_
private

Definition at line 87 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

bool BeamMonitor::StartAverage_
private

Definition at line 116 of file BeamMonitor.h.

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

std::time_t BeamMonitor::startTime
private

Definition at line 183 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

Float_t BeamMonitor::summaryContent_[3]
private

Definition at line 174 of file BeamMonitor.h.

Referenced by bookHistograms(), and FitAndFill().

Float_t BeamMonitor::summarySum_
private

Definition at line 173 of file BeamMonitor.h.

Referenced by FitAndFill().

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

Definition at line 93 of file BeamMonitor.h.

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

std::time_t BeamMonitor::tmpTime
private

Definition at line 182 of file BeamMonitor.h.

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

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

Definition at line 78 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

bool BeamMonitor::useLockRecords_
private

Definition at line 121 of file BeamMonitor.h.

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

const int BeamMonitor::vxBin_
private

Definition at line 64 of file BeamMonitor.h.

Referenced by bookHistograms().

const double BeamMonitor::vxMax_
private

Definition at line 66 of file BeamMonitor.h.

Referenced by bookHistograms().

const double BeamMonitor::vxMin_
private

Definition at line 65 of file BeamMonitor.h.

Referenced by bookHistograms().