CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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:
edm::EDAnalyzer edm::EDConsumerBase

Public Member Functions

 BeamMonitor (const edm::ParameterSet &)
 
 ~BeamMonitor ()
 
- Public Member Functions inherited from edm::EDAnalyzer
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
 EDAnalyzer ()
 
ModuleDescription const & moduleDescription () const
 
std::string workerType () const
 
virtual ~EDAnalyzer ()
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Protected Member Functions

void analyze (const edm::Event &e, const edm::EventSetup &c)
 
void beginJob ()
 
void beginLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &context)
 
void beginRun (const edm::Run &r, const edm::EventSetup &c)
 
void endJob (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
 
void endLuminosityBlock (const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
 
void endRun (const edm::Run &r, const edm::EventSetup &c)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
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 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)
 

Private Member Functions

void FitAndFill (const edm::LuminosityBlock &lumiSeg, int &, int &, int &)
 
const char * formatFitTime (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
 
DQMStoredbe_
 
bool debug_
 
double deltaSigCut_
 
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::map< TString,
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 nextlumi_
 
int nFitElements_
 
int nFits_
 
unsigned int nthBSTrk_
 
bool onlineMode_
 
edm::ParameterSet parameters_
 
reco::BeamSpot preBS
 
bool processed_
 
MonitorElementpvResults
 
edm::EDGetTokenT
< reco::VertexCollection
pvSrc_
 
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_
 
BeamFittertheBeamFitter
 
std::time_t tmpTime
 
edm::EDGetTokenT
< reco::TrackCollection
tracksLabel_
 

Additional Inherited Members

- Public Types inherited from edm::EDAnalyzer
typedef EDAnalyzer ModuleType
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Static Public Member Functions inherited from edm::EDAnalyzer
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 

Detailed Description

Definition at line 33 of file BeamMonitor.h.

Constructor & Destructor Documentation

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

Definition at line 76 of file BeamMonitor.cc.

References beam_dqm_sourceclient-live_cfg::BeamFitter, beginLumiOfBSFit_, beginLumiOfPVFit_, bsSrc_, edm::EDConsumerBase::consumesCollector(), dbe_, 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_, onlineMode_, cppFunctionSkipper::operator, parameters_, processed_, pvSrc_, refBStime, refPVtime, resetFitNLumi_, BeamFitter::resetLSRange(), BeamFitter::resetPVFitter(), resetPVNLumi_, BeamFitter::resetRefTime(), BeamFitter::resetTrkVector(), theBeamFitter, and tracksLabel_.

76  :
78 
79  parameters_ = ps;
80  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","YourSubsystemName");
81  bsSrc_ = consumes<reco::BeamSpot>(
83  tracksLabel_ = consumes<reco::TrackCollection>(
85  .getUntrackedParameter<InputTag>("TrackCollection"));
86  pvSrc_ = consumes<reco::VertexCollection>(
87  parameters_.getUntrackedParameter<InputTag>("primaryVertex"));
88  hltSrc_ = consumes<TriggerResults>(
89  parameters_.getParameter<InputTag>("hltResults"));
90  intervalInSec_ = parameters_.getUntrackedParameter<int>("timeInterval",920);//40 LS X 23"
91  fitNLumi_ = parameters_.getUntrackedParameter<int>("fitEveryNLumi",-1);
92  resetFitNLumi_ = parameters_.getUntrackedParameter<int>("resetEveryNLumi",-1);
93  fitPVNLumi_ = parameters_.getUntrackedParameter<int>("fitPVEveryNLumi",-1);
94  resetPVNLumi_ = parameters_.getUntrackedParameter<int>("resetPVEveryNLumi",-1);
95  deltaSigCut_ = parameters_.getUntrackedParameter<double>("deltaSignificanceCut",15);
96  debug_ = parameters_.getUntrackedParameter<bool>("Debug");
97  onlineMode_ = parameters_.getUntrackedParameter<bool>("OnlineMode");
98  jetTrigger_ = parameters_.getUntrackedParameter<std::vector<std::string> >("jetTrigger");
99  min_Ntrks_ = parameters_.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<int>("MinimumInputTracks");
100  maxZ_ = parameters_.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<double>("MaximumZ");
101  minNrVertices_ = parameters_.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit");
102  minVtxNdf_ = parameters_.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf");
103  minVtxWgt_ = parameters_.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight");
104 
106 
107  if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
108 
114 
115  if (fitNLumi_ <= 0) fitNLumi_ = 1;
117  refBStime[0] = refBStime[1] = refPVtime[0] = refPVtime[1] = 0;
118  maxZ_ = std::fabs(maxZ_);
119  lastlumi_ = 0;
120  nextlumi_ = 0;
121  processed_ = false;
122 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edm::TriggerResults > hltSrc_
Definition: BeamMonitor.h:71
T getUntrackedParameter(std::string const &, T const &) const
unsigned int minNrVertices_
Definition: BeamMonitor.h:101
int nFitElements_
Definition: BeamMonitor.h:96
std::time_t refBStime[2]
Definition: BeamMonitor.h:93
tuple BeamFitter
SETUP TRACKING RECONSTRUCTION ####.
int endLumiOfPVFit_
Definition: BeamMonitor.h:90
int resetFitNLumi_
Definition: BeamMonitor.h:75
double minVtxWgt_
Definition: BeamMonitor.h:103
double minVtxNdf_
Definition: BeamMonitor.h:102
bool processed_
Definition: BeamMonitor.h:110
edm::EDGetTokenT< reco::VertexCollection > pvSrc_
Definition: BeamMonitor.h:70
void resetTrkVector()
Definition: BeamFitter.h:53
std::vector< std::string > jetTrigger_
Definition: BeamMonitor.h:80
int fitPVNLumi_
Definition: BeamMonitor.h:74
int intervalInSec_
Definition: BeamMonitor.h:77
int countGapLumi_
Definition: BeamMonitor.h:108
edm::EDGetTokenT< reco::TrackCollection > tracksLabel_
Definition: BeamMonitor.h:69
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
int endLumiOfBSFit_
Definition: BeamMonitor.h:88
std::time_t refPVtime[2]
Definition: BeamMonitor.h:94
void resetLSRange()
Definition: BeamFitter.h:55
DQMStore * dbe_
Definition: BeamMonitor.h:82
double maxZ_
Definition: BeamMonitor.h:100
bool StartAverage_
Definition: BeamMonitor.h:106
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: BeamMonitor.h:68
int beginLumiOfPVFit_
Definition: BeamMonitor.h:89
int resetPVNLumi_
Definition: BeamMonitor.h:76
edm::ParameterSet parameters_
Definition: BeamMonitor.h:66
void resetPVFitter()
Definition: BeamFitter.h:69
unsigned int nthBSTrk_
Definition: BeamMonitor.h:95
unsigned int min_Ntrks_
Definition: BeamMonitor.h:99
bool resetHistos_
Definition: BeamMonitor.h:105
double deltaSigCut_
Definition: BeamMonitor.h:98
int firstAverageFit_
Definition: BeamMonitor.h:107
BeamFitter * theBeamFitter
Definition: BeamMonitor.h:83
int beginLumiOfBSFit_
Definition: BeamMonitor.h:87
std::string monitorName_
Definition: BeamMonitor.h:67
int countLumi_
Definition: BeamMonitor.h:86
bool onlineMode_
Definition: BeamMonitor.h:79
void resetRefTime()
Definition: BeamFitter.h:56
BeamMonitor::~BeamMonitor ( )

Definition at line 125 of file BeamMonitor.cc.

References theBeamFitter.

125  {
126  delete theBeamFitter;
127 }
BeamFitter * theBeamFitter
Definition: BeamMonitor.h:83

Member Function Documentation

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

Implements edm::EDAnalyzer.

Definition at line 559 of file BeamMonitor.cc.

References bsSrc_, countEvt_, countLumi_, cutFlowTable, dbe_, MonitorElement::Fill(), newFWLiteAna::found, edm::Event::getByToken(), BeamFitter::getCutFlow(), MonitorElement::getName(), MonitorElement::getTH1(), h_nVtx, h_nVtx_st, h_PVx, h_PVxz, h_PVy, h_PVyz, h_PVz, h_trkPt, h_trkVz, hltSrc_, i, jetTrigger_, edm::EventBase::luminosityBlock(), mapNPV, mapPVx, mapPVy, mapPVz, minVtxNdf_, minVtxWgt_, monitorName_, gen::n, nextlumi_, onlineMode_, processed_, edm::Handle< T >::product(), MetAnalyzer::pv(), pvSrc_, BeamFitter::readEvent(), refBS, resetFitNLumi_, MonitorElement::setBinLabel(), StartAverage_, AlCaHLTBitMon_QueryRunRegistry::string, lumiQTWidget::t, theBeamFitter, testEve_cfg::tracks, tracksLabel_, edm::TriggerNames::triggerIndex(), edm::TriggerNames::triggerName(), edm::Event::triggerNames(), triggerResults, and trigNames.

560  {
561  const int nthlumi = iEvent.luminosityBlock();
562  if (onlineMode_ && (nthlumi < nextlumi_)) {
563  edm::LogInfo("BeamMonitor") << "analyze:: Spilt event from previous lumi section!" << std::endl;
564  return;
565  }
566  if (onlineMode_ && (nthlumi > nextlumi_)) {
567  edm::LogInfo("BeamMonitor") << "analyze:: Spilt event from next lumi section!!!" << std::endl;
568  return;
569  }
570 
571  countEvt_++;
572  theBeamFitter->readEvent(iEvent); //Remember when track fitter read the event in the same place the PVFitter read the events !!!!!!!!!
573 
574  Handle<reco::BeamSpot> recoBeamSpotHandle;
575  iEvent.getByToken(bsSrc_,recoBeamSpotHandle);
576  refBS = *recoBeamSpotHandle;
577 
578  dbe_->setCurrentFolder(monitorName_+"Fit/");
579 
580  //------Cut Flow Table filled every event!--------------------------------------
581  std::string cutFlowTableName = cutFlowTable->getName();
582  // Make a copy of the cut flow table from the beam fitter.
583  TH1F * tmphisto =
584  static_cast<TH1F*>((theBeamFitter->getCutFlow())->Clone("tmphisto"));
585  cutFlowTable->getTH1()->SetBins(
586  tmphisto->GetNbinsX(),
587  tmphisto->GetXaxis()->GetXmin(),
588  tmphisto->GetXaxis()->GetXmax());
589  // Update the bin labels
590  if (countEvt_ == 1) // SetLabel just once
591  for(int n=0; n < tmphisto->GetNbinsX(); n++)
592  cutFlowTable->setBinLabel(n+1,tmphisto->GetXaxis()->GetBinLabel(n+1),1);
593  cutFlowTable = dbe_->book1D(cutFlowTableName, tmphisto);
594  delete tmphisto;
595 
596  //----Reco tracks -------------------------------------
598  iEvent.getByToken(tracksLabel_, TrackCollection);
599  const reco::TrackCollection *tracks = TrackCollection.product();
600  for ( reco::TrackCollection::const_iterator track = tracks->begin();
601  track != tracks->end(); ++track ) {
602  h_trkPt->Fill(track->pt()); //no need to change here for average bs
603  h_trkVz->Fill(track->vz());
604  }
605 
606  //-------HLT Trigger --------------------------------
608  bool JetTrigPass= false;
609  if(iEvent.getByToken(hltSrc_, triggerResults)){
610  const edm::TriggerNames & trigNames = iEvent.triggerNames(*triggerResults);
611  for (unsigned int i=0; i< triggerResults->size(); i++){
612  std::string trigName = trigNames.triggerName(i);
613 
614  if(JetTrigPass) continue;
615 
616  for(size_t t=0; t <jetTrigger_.size(); ++t){
617 
618  if(JetTrigPass) continue;
619 
620  string string_search (jetTrigger_[t]);
621  size_t found = trigName.find(string_search);
622 
623  if(found != string::npos){
624  int thisTrigger_ = trigNames.triggerIndex(trigName);
625  if(triggerResults->accept(thisTrigger_))JetTrigPass = true;
626  }//if trigger found
627  }//for(t=0;..)
628  }//for(i=0; ..)
629  }//if trigger colleciton exist)
630 
631  //------ Primary Vertices-------
633 
634  if (iEvent.getByToken(pvSrc_, PVCollection )) {
635  int nPVcount = 0;
636  int nPVcount_ST =0; //For Single Trigger(hence ST)
637 
638  for (reco::VertexCollection::const_iterator pv = PVCollection->begin(); pv != PVCollection->end(); ++pv) {
639  //--- vertex selection
640  if (pv->isFake() || pv->tracksSize()==0) continue;
641  nPVcount++; // count non fake pv:
642 
643  if(JetTrigPass)nPVcount_ST++; //non-fake pv with a specific trigger
644 
645  if (pv->ndof() < minVtxNdf_ || (pv->ndof()+3.)/pv->tracksSize() < 2*minVtxWgt_) continue;
646 
647  //Fill this map to store xyx for pv so that later we can remove the first one for run aver
648  mapPVx[countLumi_].push_back(pv->x());
649  mapPVy[countLumi_].push_back(pv->y());
650  mapPVz[countLumi_].push_back(pv->z());
651 
652  if(!StartAverage_){//for first N LS
653  h_PVx[0]->Fill(pv->x());
654  h_PVy[0]->Fill(pv->y());
655  h_PVz[0]->Fill(pv->z());
656  h_PVxz->Fill(pv->z(),pv->x());
657  h_PVyz->Fill(pv->z(),pv->y());
658  }//for first N LiS
659  else{
660  h_PVxz->Fill(pv->z(),pv->x());
661  h_PVyz->Fill(pv->z(),pv->y());}
662 
663  }//loop over pvs
664 
665 
666  h_nVtx->Fill(nPVcount*1.); //no need to change it for average BS
667 
668  mapNPV[countLumi_].push_back((nPVcount_ST));
669 
670  if(!StartAverage_){ h_nVtx_st->Fill(nPVcount_ST*1.);}
671 
672  }//if pv collection is availaable
673 
674 
675  if(StartAverage_)
676  {
677  map<int, std::vector<float> >::iterator itpvx=mapPVx.begin();
678  map<int, std::vector<float> >::iterator itpvy=mapPVy.begin();
679  map<int, std::vector<float> >::iterator itpvz=mapPVz.begin();
680 
681  map<int, std::vector<int> >::iterator itbspvinfo=mapNPV.begin();
682 
683  if( (int)mapPVx.size() > resetFitNLumi_){ //sometimes the events is not there but LS is there!
684  mapPVx.erase(itpvx);
685  mapPVy.erase(itpvy);
686  mapPVz.erase(itpvz);
687  mapNPV.erase(itbspvinfo);
688  }//loop over Last N lumi collected
689 
690  }//StartAverage==true
691 
692  processed_ = true;
693 }
edm::EDGetTokenT< edm::TriggerResults > hltSrc_
Definition: BeamMonitor.h:71
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
int resetFitNLumi_
Definition: BeamMonitor.h:75
MonitorElement * h_nVtx
Definition: BeamMonitor.h:136
double minVtxWgt_
Definition: BeamMonitor.h:103
MonitorElement * cutFlowTable
Definition: BeamMonitor.h:165
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:140
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:147
MonitorElement * h_PVxz
Definition: BeamMonitor.h:141
double minVtxNdf_
Definition: BeamMonitor.h:102
bool processed_
Definition: BeamMonitor.h:110
edm::EDGetTokenT< reco::VertexCollection > pvSrc_
Definition: BeamMonitor.h:70
std::vector< Track > TrackCollection
collection of Tracks
Definition: TrackFwd.h:14
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)
std::vector< std::string > jetTrigger_
Definition: BeamMonitor.h:80
void readEvent(const edm::Event &iEvent)
Definition: BeamFitter.cc:215
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:147
void Fill(long long x)
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:148
int iEvent
Definition: GenABIO.cc:230
unsigned int triggerIndex(std::string const &name) const
Definition: TriggerNames.cc:32
edm::EDGetTokenT< reco::TrackCollection > tracksLabel_
Definition: BeamMonitor.h:69
MonitorElement * h_PVyz
Definition: BeamMonitor.h:142
reco::BeamSpot refBS
Definition: BeamMonitor.h:115
TH1 * getTH1(void) const
static std::string const triggerResults
Definition: EdmProvDump.cc:40
DQMStore * dbe_
Definition: BeamMonitor.h:82
static const char *const trigNames[]
Definition: EcalDumpRaw.cc:74
bool StartAverage_
Definition: BeamMonitor.h:106
edm::EDGetTokenT< reco::BeamSpot > bsSrc_
Definition: BeamMonitor.h:68
MonitorElement * h_nVtx_st
Definition: BeamMonitor.h:137
T const * product() const
Definition: Handle.h:81
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:139
tuple tracks
Definition: testEve_cfg.py:39
std::string const & triggerName(unsigned int index) const
Definition: TriggerNames.cc:27
TH1F * getCutFlow()
Definition: BeamFitter.h:97
MonitorElement * h_trkPt
Definition: BeamMonitor.h:127
BeamFitter * theBeamFitter
Definition: BeamMonitor.h:83
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:138
MonitorElement * h_trkVz
Definition: BeamMonitor.h:128
std::string monitorName_
Definition: BeamMonitor.h:67
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:147
int countLumi_
Definition: BeamMonitor.h:86
bool onlineMode_
Definition: BeamMonitor.h:79
void BeamMonitor::beginJob ( void  )
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 131 of file BeamMonitor.cc.

References cutFlowTable, pyrootRender::da, dbe_, objects.IsoTrackAnalyzer::dzMax, MonitorElement::Fill(), fitResults, MonitorElement::getName(), edm::ParameterSet::getParameter(), MonitorElement::getTH1(), MonitorElement::getTH2F(), 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, i, intervalInSec_, diffTwoXMLs::label, monitorName_, gen::n, nFitElements_, AlCaHLTBitMon_ParallelJobs::options, parameters_, pvResults, reportSummary, reportSummaryContents, reportSummaryMap, MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), MonitorElement::setBinLabel(), and summaryContent_.

131  {
132 
133 
134  // book some histograms here
135  const int dxBin = parameters_.getParameter<int>("dxBin");
136  const double dxMin = parameters_.getParameter<double>("dxMin");
137  const double dxMax = parameters_.getParameter<double>("dxMax");
138 
139  const int vxBin = parameters_.getParameter<int>("vxBin");
140  const double vxMin = parameters_.getParameter<double>("vxMin");
141  const double vxMax = parameters_.getParameter<double>("vxMax");
142 
143  const int phiBin = parameters_.getParameter<int>("phiBin");
144  const double phiMin = parameters_.getParameter<double>("phiMin");
145  const double phiMax = parameters_.getParameter<double>("phiMax");
146 
147  const int dzBin = parameters_.getParameter<int>("dzBin");
148  const double dzMin = parameters_.getParameter<double>("dzMin");
149  const double dzMax = parameters_.getParameter<double>("dzMax");
150 
151  // create and cd into new folder
152  dbe_->setCurrentFolder(monitorName_+"Fit");
153 
154  h_nTrk_lumi=dbe_->book1D("nTrk_lumi","Num. of selected tracks vs lumi (Fit)",20,0.5,20.5);
155  h_nTrk_lumi->setAxisTitle("Lumisection",1);
156  h_nTrk_lumi->setAxisTitle("Num of Tracks for Fit",2);
157 
158  //store vtx vs lumi for monitoring why fits fail
159  h_nVtx_lumi=dbe_->book1D("nVtx_lumi","Num. of selected Vtx vs lumi (Fit)",20,0.5,20.5);
160  h_nVtx_lumi->setAxisTitle("Lumisection",1);
161  h_nVtx_lumi->setAxisTitle("Num of Vtx for Fit",2);
162 
163  h_nVtx_lumi_all=dbe_->book1D("nVtx_lumi_all","Num. of selected Vtx vs lumi (Fit) all",20,0.5,20.5);
164  h_nVtx_lumi_all->getTH1()->SetCanExtend(TH1::kAllAxes);
165  h_nVtx_lumi_all->setAxisTitle("Lumisection",1);
166  h_nVtx_lumi_all->setAxisTitle("Num of Vtx for Fit",2);
167 
168  h_d0_phi0 = dbe_->bookProfile("d0_phi0","d_{0} vs. #phi_{0} (Selected Tracks)",phiBin,phiMin,phiMax,dxBin,dxMin,dxMax,"");
169  h_d0_phi0->setAxisTitle("#phi_{0} (rad)",1);
170  h_d0_phi0->setAxisTitle("d_{0} (cm)",2);
171 
172  h_vx_vy = dbe_->book2D("trk_vx_vy","Vertex (PCA) position of selected tracks",vxBin,vxMin,vxMax,vxBin,vxMin,vxMax);
173  h_vx_vy->getTH2F()->SetOption("COLZ");
174  // h_vx_vy->getTH1()->SetCanExtend(TH1::kAllAxes);
175  h_vx_vy->setAxisTitle("x coordinate of input track at PCA (cm)",1);
176  h_vx_vy->setAxisTitle("y coordinate of input track at PCA (cm)",2);
177 
178  TDatime *da = new TDatime();
179  gStyle->SetTimeOffset(da->Convert(kTRUE));
180 
181  const int nvar_ = 6;
182  string coord[nvar_] = {"x","y","z","sigmaX","sigmaY","sigmaZ"};
183  string label[nvar_] = {"x_{0} (cm)","y_{0} (cm)","z_{0} (cm)",
184  "#sigma_{X_{0}} (cm)","#sigma_{Y_{0}} (cm)","#sigma_{Z_{0}} (cm)"};
185  for (int i = 0; i < 4; i++) {
186  dbe_->setCurrentFolder(monitorName_+"Fit");
187  for (int ic=0; ic<nvar_; ++ic) {
188  TString histName(coord[ic]);
189  TString histTitle(coord[ic]);
190  string ytitle(label[ic]);
191  string xtitle("");
192  string options("E1");
193  bool createHisto = true;
194  switch(i) {
195  case 1: // BS vs time
196  histName += "0_time";
197  xtitle = "Time [UTC]";
198  if (ic < 3)
199  histTitle += " coordinate of beam spot vs time (Fit)";
200  else
201  histTitle = histTitle.Insert(5," ") + " of beam spot vs time (Fit)";
202  break;
203  case 2: // PV vs lumi
204  if (ic < 3) {
205  dbe_->setCurrentFolder(monitorName_+"PrimaryVertex");
206  histName.Insert(0,"PV");
207  histName += "_lumi";
208  histTitle.Insert(0,"Avg. ");
209  histTitle += " position of primary vtx vs lumi";
210  xtitle = "Lumisection";
211  ytitle.insert(0,"PV");
212  ytitle += " #pm #sigma_{PV";
213  ytitle += coord[ic];
214  ytitle += "} (cm)";
215  }
216  else createHisto = false;
217  break;
218  case 3: // PV vs time
219  if (ic < 3) {
220  dbe_->setCurrentFolder(monitorName_+"PrimaryVertex");
221  histName.Insert(0,"PV");
222  histName += "_time";
223  histTitle.Insert(0,"Avg. ");
224  histTitle += " position of primary vtx vs time";
225  xtitle = "Time [UTC]";
226  ytitle.insert(0,"PV");
227  ytitle += " #pm #sigma_{PV";
228  ytitle += coord[ic];
229  ytitle += "} (cm)";
230  }
231  else createHisto = false;
232  break;
233  default: // BS vs lumi
234  histName += "0_lumi";
235  xtitle = "Lumisection";
236  if (ic < 3)
237  histTitle += " coordinate of beam spot vs lumi (Fit)";
238  else
239  histTitle = histTitle.Insert(5," ") + " of beam spot vs lumi (Fit)";
240  break;
241  }
242  if (createHisto) {
243  edm::LogInfo("BeamMonitor") << "hitsName = " << histName << "; histTitle = " << histTitle << std::endl;
244  hs[histName] = dbe_->book1D(histName,histTitle,40,0.5,40.5);
245  hs[histName]->setAxisTitle(xtitle,1);
246  hs[histName]->setAxisTitle(ytitle,2);
247  hs[histName]->getTH1()->SetOption("E1");
248  if (histName.Contains("time")) {
249  //int nbins = (intervalInSec_/23 > 0 ? intervalInSec_/23 : 40);
250  hs[histName]->getTH1()->SetBins(intervalInSec_,0.5,intervalInSec_+0.5);
251  hs[histName]->setAxisTimeDisplay(1);
252  hs[histName]->setAxisTimeFormat("%H:%M:%S",1);
253  }
254  histName += "_all";
255  histTitle += " all";
256  hs[histName] = dbe_->book1D(histName,histTitle,40,0.5,40.5);
257  hs[histName]->getTH1()->SetCanExtend(TH1::kAllAxes);
258  hs[histName]->setAxisTitle(xtitle,1);
259  hs[histName]->setAxisTitle(ytitle,2);
260  hs[histName]->getTH1()->SetOption("E1");
261  if (histName.Contains("time")) {
262  //int nbins = (intervalInSec_/23 > 0 ? intervalInSec_/23 : 40);
263  hs[histName]->getTH1()->SetBins(intervalInSec_,0.5,intervalInSec_+0.5);
264  hs[histName]->setAxisTimeDisplay(1);
265  hs[histName]->setAxisTimeFormat("%H:%M:%S",1);
266  }
267  }
268  }
269  }
270  dbe_->setCurrentFolder(monitorName_+"Fit");
271 
272  h_trk_z0 = dbe_->book1D("trk_z0","z_{0} of selected tracks",dzBin,dzMin,dzMax);
273  h_trk_z0->setAxisTitle("z_{0} of selected tracks (cm)",1);
274 
275  h_vx_dz = dbe_->bookProfile("vx_dz","v_{x} vs. dz of selected tracks",dzBin,dzMin,dzMax,dxBin,dxMin,dxMax,"");
276  h_vx_dz->setAxisTitle("dz (cm)",1);
277  h_vx_dz->setAxisTitle("x coordinate of input track at PCA (cm)",2);
278 
279  h_vy_dz = dbe_->bookProfile("vy_dz","v_{y} vs. dz of selected tracks",dzBin,dzMin,dzMax,dxBin,dxMin,dxMax,"");
280  h_vy_dz->setAxisTitle("dz (cm)",1);
281  h_vy_dz->setAxisTitle("y coordinate of input track at PCA (cm)",2);
282 
283  h_x0 = dbe_->book1D("BeamMonitorFeedBack_x0","x coordinate of beam spot (Fit)",100,-0.01,0.01);
284  h_x0->setAxisTitle("x_{0} (cm)",1);
285  h_x0->getTH1()->SetCanExtend(TH1::kAllAxes);
286 
287  h_y0 = dbe_->book1D("BeamMonitorFeedBack_y0","y coordinate of beam spot (Fit)",100,-0.01,0.01);
288  h_y0->setAxisTitle("y_{0} (cm)",1);
289  h_y0->getTH1()->SetCanExtend(TH1::kAllAxes);
290 
291  h_z0 = dbe_->book1D("BeamMonitorFeedBack_z0","z coordinate of beam spot (Fit)",dzBin,dzMin,dzMax);
292  h_z0->setAxisTitle("z_{0} (cm)",1);
293  h_z0->getTH1()->SetCanExtend(TH1::kAllAxes);
294 
295  h_sigmaX0 = dbe_->book1D("BeamMonitorFeedBack_sigmaX0","sigma x0 of beam spot (Fit)",100,0,0.05);
296  h_sigmaX0->setAxisTitle("#sigma_{X_{0}} (cm)",1);
297  h_sigmaX0->getTH1()->SetCanExtend(TH1::kAllAxes);
298 
299  h_sigmaY0 = dbe_->book1D("BeamMonitorFeedBack_sigmaY0","sigma y0 of beam spot (Fit)",100,0,0.05);
300  h_sigmaY0->setAxisTitle("#sigma_{Y_{0}} (cm)",1);
301  h_sigmaY0->getTH1()->SetCanExtend(TH1::kAllAxes);
302 
303  h_sigmaZ0 = dbe_->book1D("BeamMonitorFeedBack_sigmaZ0","sigma z0 of beam spot (Fit)",100,0,10);
304  h_sigmaZ0->setAxisTitle("#sigma_{Z_{0}} (cm)",1);
305  h_sigmaZ0->getTH1()->SetCanExtend(TH1::kAllAxes);
306 
307  // Histograms of all reco tracks (without cuts):
308  h_trkPt=dbe_->book1D("trkPt","p_{T} of all reco'd tracks (no selection)",200,0.,50.);
309  h_trkPt->setAxisTitle("p_{T} (GeV/c)",1);
310 
311  h_trkVz=dbe_->book1D("trkVz","Z coordinate of PCA of all reco'd tracks (no selection)",dzBin,dzMin,dzMax);
312  h_trkVz->setAxisTitle("V_{Z} (cm)",1);
313 
314  cutFlowTable = dbe_->book1D("cutFlowTable","Cut flow table of track selection", 9, 0, 9 );
315 
316  // Results of previous good fit:
317  fitResults=dbe_->book2D("fitResults","Results of previous good beam fit",2,0,2,8,0,8);
318  fitResults->setAxisTitle("Fitted Beam Spot (cm)",1);
319  fitResults->setBinLabel(8,"x_{0}",2);
320  fitResults->setBinLabel(7,"y_{0}",2);
321  fitResults->setBinLabel(6,"z_{0}",2);
322  fitResults->setBinLabel(5,"#sigma_{Z}",2);
323  fitResults->setBinLabel(4,"#frac{dx}{dz} (rad)",2);
324  fitResults->setBinLabel(3,"#frac{dy}{dz} (rad)",2);
325  fitResults->setBinLabel(2,"#sigma_{X}",2);
326  fitResults->setBinLabel(1,"#sigma_{Y}",2);
327  fitResults->setBinLabel(1,"Mean",1);
328  fitResults->setBinLabel(2,"Stat. Error",1);
329  fitResults->getTH1()->SetOption("text");
330 
331  // Histos of PrimaryVertices:
332  dbe_->setCurrentFolder(monitorName_+"PrimaryVertex");
333 
334  h_nVtx = dbe_->book1D("vtxNbr","Reconstructed Vertices(non-fake) in all Event",60,-0.5,59.5);
335  h_nVtx->setAxisTitle("Num. of reco. vertices",1);
336 
337  //For one Trigger only
338  h_nVtx_st = dbe_->book1D("vtxNbr_SelectedTriggers","Reconstructed Vertices(non-fake) in Events",60,-0.5,59.5);
339  //h_nVtx_st->setAxisTitle("Num. of reco. vertices for Un-Prescaled Jet Trigger",1);
340 
341  // Monitor only the PV with highest sum pt of assoc. trks:
342  h_PVx[0] = dbe_->book1D("PVX","x coordinate of Primary Vtx",50,-0.01,0.01);
343  h_PVx[0]->setAxisTitle("PVx (cm)",1);
344  h_PVx[0]->getTH1()->SetCanExtend(TH1::kAllAxes);
345 
346  h_PVy[0] = dbe_->book1D("PVY","y coordinate of Primary Vtx",50,-0.01,0.01);
347  h_PVy[0]->setAxisTitle("PVy (cm)",1);
348  h_PVy[0]->getTH1()->SetCanExtend(TH1::kAllAxes);
349 
350  h_PVz[0] = dbe_->book1D("PVZ","z coordinate of Primary Vtx",dzBin,dzMin,dzMax);
351  h_PVz[0]->setAxisTitle("PVz (cm)",1);
352 
353  h_PVx[1] = dbe_->book1D("PVXFit","x coordinate of Primary Vtx (Last Fit)",50,-0.01,0.01);
354  h_PVx[1]->setAxisTitle("PVx (cm)",1);
355  h_PVx[1]->getTH1()->SetCanExtend(TH1::kAllAxes);
356 
357  h_PVy[1] = dbe_->book1D("PVYFit","y coordinate of Primary Vtx (Last Fit)",50,-0.01,0.01);
358  h_PVy[1]->setAxisTitle("PVy (cm)",1);
359  h_PVy[1]->getTH1()->SetCanExtend(TH1::kAllAxes);
360 
361  h_PVz[1] = dbe_->book1D("PVZFit","z coordinate of Primary Vtx (Last Fit)",dzBin,dzMin,dzMax);
362  h_PVz[1]->setAxisTitle("PVz (cm)",1);
363 
364  h_PVxz = dbe_->bookProfile("PVxz","PVx vs. PVz",dzBin/2,dzMin,dzMax,dxBin/2,dxMin,dxMax,"");
365  h_PVxz->setAxisTitle("PVz (cm)",1);
366  h_PVxz->setAxisTitle("PVx (cm)",2);
367 
368  h_PVyz = dbe_->bookProfile("PVyz","PVy vs. PVz",dzBin/2,dzMin,dzMax,dxBin/2,dxMin,dxMax,"");
369  h_PVyz->setAxisTitle("PVz (cm)",1);
370  h_PVyz->setAxisTitle("PVy (cm)",2);
371 
372  // Results of previous good fit:
373  pvResults=dbe_->book2D("pvResults","Results of fitting Primary Vertices",2,0,2,6,0,6);
374  pvResults->setAxisTitle("Fitted Primary Vertex (cm)",1);
375  pvResults->setBinLabel(6,"PVx",2);
376  pvResults->setBinLabel(5,"PVy",2);
377  pvResults->setBinLabel(4,"PVz",2);
378  pvResults->setBinLabel(3,"#sigma_{X}",2);
379  pvResults->setBinLabel(2,"#sigma_{Y}",2);
380  pvResults->setBinLabel(1,"#sigma_{Z}",2);
381  pvResults->setBinLabel(1,"Mean",1);
382  pvResults->setBinLabel(2,"Stat. Error",1);
383  pvResults->getTH1()->SetOption("text");
384 
385  // Summary plots:
386  dbe_->setCurrentFolder(monitorName_+"EventInfo");
387  reportSummary = dbe_->get(monitorName_+"EventInfo/reportSummary");
388  if (reportSummary) dbe_->removeElement(reportSummary->getName());
389 
390  reportSummary = dbe_->bookFloat("reportSummary");
391  if(reportSummary) reportSummary->Fill(std::numeric_limits<double>::quiet_NaN());
392 
393  char histo[20];
394  dbe_->setCurrentFolder(monitorName_+"EventInfo/reportSummaryContents");
395  for (int n = 0; n < nFitElements_; n++) {
396  switch(n){
397  case 0 : sprintf(histo,"x0_status"); break;
398  case 1 : sprintf(histo,"y0_status"); break;
399  case 2 : sprintf(histo,"z0_status"); break;
400  }
401  reportSummaryContents[n] = dbe_->bookFloat(histo);
402  }
403 
404  for (int i = 0; i < nFitElements_; i++) {
405  summaryContent_[i] = 0.;
406  reportSummaryContents[i]->Fill(std::numeric_limits<double>::quiet_NaN());
407  }
408 
409  dbe_->setCurrentFolder(monitorName_+"EventInfo");
410 
411  reportSummaryMap = dbe_->get(monitorName_+"EventInfo/reportSummaryMap");
412  if (reportSummaryMap) dbe_->removeElement(reportSummaryMap->getName());
413 
414  reportSummaryMap = dbe_->book2D("reportSummaryMap", "Beam Spot Summary Map", 1, 0, 1, 3, 0, 3);
416  reportSummaryMap->setAxisTitle("Fitted Beam Spot",2);
417  reportSummaryMap->setBinLabel(1," ",1);
418  reportSummaryMap->setBinLabel(1,"x_{0}",2);
419  reportSummaryMap->setBinLabel(2,"y_{0}",2);
420  reportSummaryMap->setBinLabel(3,"z_{0}",2);
421  for (int i = 0; i < nFitElements_; i++) {
422  reportSummaryMap->setBinContent(1,i+1,-1.);
423  }
424 }
T getParameter(std::string const &) const
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
void setBinContent(int binx, double content)
set content of bin (1-D)
int nFitElements_
Definition: BeamMonitor.h:96
MonitorElement * reportSummary
Definition: BeamMonitor.h:162
MonitorElement * h_nVtx
Definition: BeamMonitor.h:136
MonitorElement * cutFlowTable
Definition: BeamMonitor.h:165
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:140
MonitorElement * h_PVxz
Definition: BeamMonitor.h:141
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_sigmaZ0
Definition: BeamMonitor.h:135
MonitorElement * h_nTrk_lumi
Definition: BeamMonitor.h:119
MonitorElement * fitResults
Definition: BeamMonitor.h:129
MonitorElement * h_sigmaY0
Definition: BeamMonitor.h:134
void Fill(long long x)
MonitorElement * h_y0
Definition: BeamMonitor.h:131
int intervalInSec_
Definition: BeamMonitor.h:77
MonitorElement * h_vy_dz
Definition: BeamMonitor.h:126
MonitorElement * h_PVyz
Definition: BeamMonitor.h:142
MonitorElement * pvResults
Definition: BeamMonitor.h:143
MonitorElement * h_nVtx_lumi
Definition: BeamMonitor.h:120
TH1 * getTH1(void) const
MonitorElement * h_nVtx_lumi_all
Definition: BeamMonitor.h:121
DQMStore * dbe_
Definition: BeamMonitor.h:82
Float_t summaryContent_[3]
Definition: BeamMonitor.h:161
MonitorElement * h_sigmaX0
Definition: BeamMonitor.h:133
MonitorElement * h_nVtx_st
Definition: BeamMonitor.h:137
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:139
MonitorElement * reportSummaryContents[3]
Definition: BeamMonitor.h:163
MonitorElement * h_x0
Definition: BeamMonitor.h:130
MonitorElement * h_trk_z0
Definition: BeamMonitor.h:123
edm::ParameterSet parameters_
Definition: BeamMonitor.h:66
MonitorElement * h_trkPt
Definition: BeamMonitor.h:127
MonitorElement * h_vx_dz
Definition: BeamMonitor.h:125
MonitorElement * h_z0
Definition: BeamMonitor.h:132
TH2F * getTH2F(void) const
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:138
MonitorElement * h_trkVz
Definition: BeamMonitor.h:128
std::string monitorName_
Definition: BeamMonitor.h:67
MonitorElement * h_d0_phi0
Definition: BeamMonitor.h:122
MonitorElement * h_vx_vy
Definition: BeamMonitor.h:124
MonitorElement * reportSummaryMap
Definition: BeamMonitor.h:164
std::map< TString, MonitorElement * > hs
Definition: BeamMonitor.h:144
void BeamMonitor::beginLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup context 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 448 of file BeamMonitor.cc.

References beginLumiOfBSFit_, beginLumiOfPVFit_, edm::LuminosityBlockBase::beginTime(), countLumi_, debug_, FitAndFill(), lastlumi_, edm::LuminosityBlockBase::luminosityBlock(), mapBeginBSLS, mapBeginBSTime, mapBeginPVLS, mapBeginPVTime, nextlumi_, onlineMode_, processed_, refBStime, refPVtime, StartAverage_, and edm::Timestamp::value().

449  {
450  int nthlumi = lumiSeg.luminosityBlock();
451  const edm::TimeValue_t fbegintimestamp = lumiSeg.beginTime().value();
452  const std::time_t ftmptime = fbegintimestamp >> 32;
453 
454 
455  if (countLumi_ == 0 && (!processed_)) {
457  refBStime[0] = refPVtime[0] = ftmptime;
458  mapBeginBSLS[countLumi_] = nthlumi;
459  mapBeginPVLS[countLumi_] = nthlumi;
460  mapBeginBSTime[countLumi_] = ftmptime;
461  mapBeginPVTime[countLumi_] = ftmptime;
462  }//for the first record
463 
464 if(nthlumi > nextlumi_){
465  if(processed_){ countLumi_++;
466  //store here them will need when we remove the first one of Last N LS
467  mapBeginBSLS[countLumi_] = nthlumi;
468  mapBeginPVLS[countLumi_] = nthlumi;
469  mapBeginBSTime[countLumi_] = ftmptime;
470  mapBeginPVTime[countLumi_] = ftmptime;
471  }//processed passed but not the first lumi
472  if((!processed_) && countLumi_ !=0){
473  mapBeginBSLS[countLumi_] = nthlumi;
474  mapBeginPVLS[countLumi_] = nthlumi;
475  mapBeginBSTime[countLumi_] = ftmptime;
476  mapBeginPVTime[countLumi_] = ftmptime;
477  }//processed fails for last lumi
478  }//nthLumi > nextlumi
479 
480 
481  if(StartAverage_ ){
482  //Just Make sure it get rest
483  refBStime[0] =0;
484  refPVtime[0] =0;
487 
488  if(debug_)edm::LogInfo("BeamMonitor") << " beginLuminosityBlock: Size of mapBeginBSLS before = "<< mapBeginBSLS.size()<<endl;
489  if(nthlumi> nextlumi_){ //this make sure that it does not take into account this lumi for fitting and only look forward for new lumi
490  //as countLumi also remains the same so map value get overwritten once return to normal running.
491  //even if few LS are misssing and DQM module do not sees them then it catchs up again
492  map<int, int>::iterator itbs=mapBeginBSLS.begin();
493  map<int, int>::iterator itpv=mapBeginPVLS.begin();
494  map<int, std::time_t>::iterator itbstime=mapBeginBSTime.begin();
495  map<int, std::time_t>::iterator itpvtime=mapBeginPVTime.begin();
496 
497  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
498  mapBeginBSLS.erase(itbs);
499  mapBeginPVLS.erase(itpv);
500  mapBeginBSTime.erase(itbstime);
501  mapBeginPVTime.erase(itpvtime);
502  }
503  /*//not sure if want this or not ??
504  map<int, int>::iterator itgapb=mapBeginBSLS.begin();
505  map<int, int>::iterator itgape=mapBeginBSLS.end(); itgape--;
506  countGapLumi_ = ( (itgape->second) - (itgapb->second) );
507  //if we see Gap more than then 2*resetNFitLumi !!!!!!!
508  //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
509  // so better start as fresh and reset everything like starting in the begining!
510  if(countGapLumi_ >= 2*resetFitNLumi_){RestartFitting(); mapBeginBSLS[countLumi_] = nthlumi;}
511  */
512  }
513 
514  if(debug_) edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Size of mapBeginBSLS After = "<< mapBeginBSLS.size()<<endl;
515 
516  map<int, int>::iterator bbs = mapBeginBSLS.begin();
517  map<int, int>::iterator bpv = mapBeginPVLS.begin();
518  map<int, std::time_t>::iterator bbst = mapBeginBSTime.begin();
519  map<int, std::time_t>::iterator bpvt = mapBeginPVTime.begin();
520 
521 
522  if (beginLumiOfPVFit_ == 0) beginLumiOfPVFit_ = bpv->second; //new begin time after removing the LS
523  if (beginLumiOfBSFit_ == 0) beginLumiOfBSFit_ = bbs->second;
524  if (refBStime[0] == 0) refBStime[0] = bbst->second;
525  if (refPVtime[0] == 0) refPVtime[0] = bpvt->second;
526 
527  }//same logic for average fit as above commented line
528 
529 
530  map<int, std::time_t>::iterator nbbst = mapBeginBSTime.begin();
531  map<int, std::time_t>::iterator nbpvt = mapBeginPVTime.begin();
532 
533 
534  if (onlineMode_ && (nthlumi < nextlumi_)) return;
535 
536  if (onlineMode_) {
537  if (nthlumi > nextlumi_) {
538  if (countLumi_ != 0 && processed_) FitAndFill(lumiSeg,lastlumi_,nextlumi_,nthlumi);
539  nextlumi_ = nthlumi;
540  edm::LogInfo("BeamMonitor") << "beginLuminosityBlock:: Next Lumi to Fit: " << nextlumi_ << endl;
541  if((StartAverage_) && refBStime[0] == 0) refBStime[0] = nbbst->second;
542  if((StartAverage_) && refPVtime[0] == 0) refPVtime[0] = nbpvt->second;
543  }
544  }
545  else{
546  if (processed_) FitAndFill(lumiSeg,lastlumi_,nextlumi_,nthlumi);
547  nextlumi_ = nthlumi;
548  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Next Lumi to Fit: " << nextlumi_ << endl;
549  if ((StartAverage_) && refBStime[0] == 0) refBStime[0] = nbbst->second;
550  if ((StartAverage_) && refPVtime[0] == 0) refPVtime[0] = nbpvt->second;
551  }
552 
553  //countLumi_++;
554  if (processed_) processed_ = false;
555  edm::LogInfo("BeamMonitor") << " beginLuminosityBlock:: Begin of Lumi: " << nthlumi << endl;
556 }
std::time_t refBStime[2]
Definition: BeamMonitor.h:93
bool processed_
Definition: BeamMonitor.h:110
Timestamp const & beginTime() const
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:151
LuminosityBlockNumber_t luminosityBlock() const
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:151
std::time_t refPVtime[2]
Definition: BeamMonitor.h:94
unsigned long long TimeValue_t
Definition: Timestamp.h:28
void FitAndFill(const edm::LuminosityBlock &lumiSeg, int &, int &, int &)
Definition: BeamMonitor.cc:709
bool StartAverage_
Definition: BeamMonitor.h:106
int beginLumiOfPVFit_
Definition: BeamMonitor.h:89
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:150
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:150
int beginLumiOfBSFit_
Definition: BeamMonitor.h:87
TimeValue_t value() const
Definition: Timestamp.h:56
int countLumi_
Definition: BeamMonitor.h:86
bool onlineMode_
Definition: BeamMonitor.h:79
void BeamMonitor::beginRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 427 of file BeamMonitor.cc.

References edm::RunBase::beginTime(), gather_cfg::cout, pyrootRender::da, debug_, formatFitTime(), frun, ftimestamp, hs, refTime, edm::RunBase::run(), startTime, tmpTime, and edm::Timestamp::value().

427  {
428 
429  frun = r.run();
430  ftimestamp = r.beginTime().value();
431  tmpTime = ftimestamp >> 32;
433  const char* eventTime = formatFitTime(tmpTime);
434  std::cout << "TimeOffset = " << eventTime << std::endl;
435  TDatime da(eventTime);
436  if (debug_) {
437  edm::LogInfo("BeamMonitor") << "TimeOffset = ";
438  da.Print();
439  }
440  for (std::map<TString,MonitorElement*>::iterator it = hs.begin();
441  it != hs.end(); ++it) {
442  if ((*it).first.Contains("time"))
443  (*it).second->getTH1()->GetXaxis()->SetTimeOffset(da.Convert(kTRUE));
444  }
445 }
const char * formatFitTime(const std::time_t &)
Definition: BeamMonitor.cc:44
RunNumber_t run() const
Definition: RunBase.h:42
edm::TimeValue_t ftimestamp
Definition: BeamMonitor.h:172
std::time_t refTime
Definition: BeamMonitor.h:171
std::time_t startTime
Definition: BeamMonitor.h:170
Timestamp const & beginTime() const
Definition: RunBase.h:43
tuple cout
Definition: gather_cfg.py:121
std::time_t tmpTime
Definition: BeamMonitor.h:169
TimeValue_t value() const
Definition: Timestamp.h:56
std::map< TString, MonitorElement * > hs
Definition: BeamMonitor.h:144
void BeamMonitor::endJob ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
protected

Definition at line 1376 of file BeamMonitor.cc.

References endLuminosityBlock(), and onlineMode_.

1377  {
1378  if (!onlineMode_) endLuminosityBlock(lumiSeg, iSetup);
1379 }
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
Definition: BeamMonitor.cc:697
bool onlineMode_
Definition: BeamMonitor.h:79
void BeamMonitor::endLuminosityBlock ( const edm::LuminosityBlock lumiSeg,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 697 of file BeamMonitor.cc.

References edm::LuminosityBlockBase::endTime(), edm::LuminosityBlockBase::id(), edm::LuminosityBlockID::luminosityBlock(), nextlumi_, onlineMode_, refBStime, refPVtime, tmpTime, and edm::Timestamp::value().

Referenced by endJob().

698  {
699  int nthlumi = lumiSeg.id().luminosityBlock();
700  edm::LogInfo("BeamMonitor") << "endLuminosityBlock:: Lumi of the last event before endLuminosityBlock: " << nthlumi << endl;
701 
702  if (onlineMode_ && nthlumi < nextlumi_) return;
703  const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
704  const std::time_t fendtime = fendtimestamp >> 32;
705  tmpTime = refBStime[1] = refPVtime[1] = fendtime;
706 }
LuminosityBlockID id() const
std::time_t refBStime[2]
Definition: BeamMonitor.h:93
Timestamp const & endTime() const
std::time_t refPVtime[2]
Definition: BeamMonitor.h:94
unsigned long long TimeValue_t
Definition: Timestamp.h:28
LuminosityBlockNumber_t luminosityBlock() const
std::time_t tmpTime
Definition: BeamMonitor.h:169
TimeValue_t value() const
Definition: Timestamp.h:56
bool onlineMode_
Definition: BeamMonitor.h:79
void BeamMonitor::endRun ( const edm::Run r,
const edm::EventSetup c 
)
protectedvirtual

Reimplemented from edm::EDAnalyzer.

Definition at line 1356 of file BeamMonitor.cc.

References debug_, mapBeginBSLS, mapBeginBSTime, mapBeginPVLS, mapBeginPVTime, mapLSBSTrkSize, mapLSCF, mapLSPVStoreSize, mapNPV, mapPVx, mapPVy, and mapPVz.

1356  {
1357 
1358 if(debug_)edm::LogInfo("BeamMonitor") << "endRun:: Clearing all the Maps "<<endl;
1359 //Clear all the Maps here
1360 mapPVx.clear();
1361 mapPVy.clear();
1362 mapPVz.clear();
1363 mapNPV.clear();
1364 mapBeginBSLS.clear();
1365 mapBeginPVLS.clear();
1366 mapBeginBSTime.clear();
1367 mapBeginPVTime.clear();
1368 mapLSBSTrkSize.clear();
1369 mapLSPVStoreSize.clear();
1370 mapLSCF.clear();
1371 
1372 
1373 }
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:147
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:153
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:147
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:151
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:148
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:151
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:156
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:150
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:150
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:147
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:154
void BeamMonitor::FitAndFill ( const edm::LuminosityBlock lumiSeg,
int &  lastlumi,
int &  nextlumi,
int &  nthlumi 
)
private

Definition at line 709 of file BeamMonitor.cc.

References alpha, reco::BeamSpot::BeamWidthX(), reco::BeamSpot::BeamWidthXError(), reco::BeamSpot::BeamWidthY(), reco::BeamSpot::BeamWidthYError(), begin, beginLumiOfBSFit_, beginLumiOfPVFit_, countLumi_, dbe_, debug_, reco::BeamSpot::dxdz(), reco::BeamSpot::dxdzError(), reco::BeamSpot::dydz(), reco::BeamSpot::dydzError(), end, endLumiOfBSFit_, endLumiOfPVFit_, python.connectstrParser::f1, MonitorElement::Fill(), firstAverageFit_, fitNLumi_, fitPVNLumi_, fitResults, frun, BeamFitter::getBeamSpot(), BeamFitter::getBSvector(), BeamFitter::getCutFlow(), BeamFitter::getFitLSRange(), MonitorElement::getMean(), MonitorElement::getMeanError(), MonitorElement::getName(), BeamFitter::getPVvectorSize(), BeamFitter::getRefTime(), MonitorElement::getRMS(), MonitorElement::getRMSError(), BeamFitter::getRunNumber(), MonitorElement::getTH1(), getTH1F(), MonitorElement::getTProfile(), h_d0_phi0, h_nTrk_lumi, h_nVtx_lumi, h_nVtx_lumi_all, h_nVtx_st, h_PVx, h_PVy, h_PVz, h_sigmaX0, h_sigmaY0, h_sigmaZ0, h_trk_z0, h_vx_dz, h_vx_vy, h_vy_dz, h_x0, h_y0, h_z0, hs, i, cuy::ii, python.multivaluedict::map(), mapLSBSTrkSize, mapLSCF, mapLSPVStoreSize, mapNPV, mapPVx, mapPVy, mapPVz, timingPdfMaker::mean, min_Ntrks_, minNrVertices_, monitorName_, gen::n, nFitElements_, nFits_, nthBSTrk_, onlineMode_, preBS, processed_, pvResults, refBStime, refPVtime, refTime, reportSummary, reportSummary_, reportSummaryContents, reportSummaryMap, MonitorElement::Reset(), resetFitNLumi_, resetHistos_, resetPVNLumi_, BeamFitter::resizeBSvector(), BeamFitter::resizePVvector(), BeamFitter::runPVandTrkFitter(), scrollTH1(), MonitorElement::setAxisTitle(), MonitorElement::setBinContent(), BeamFitter::setFitLSRange(), BeamFitter::SetPVInfo(), BeamFitter::setRefTime(), BeamFitter::setRun(), MonitorElement::ShiftFillLast(), reco::BeamSpot::sigmaZ(), reco::BeamSpot::sigmaZ0Error(), mathSSE::sqrt(), StartAverage_, startTime, BeamFitter::subtractFromCutFlow(), summaryContent_, summarySum_, testScroll(), theBeamFitter, createPayload::tmpfile, tmpTime, reco::BeamSpot::type(), MonitorElement::update(), create_public_lumi_plots::width, reco::BeamSpot::x0(), reco::BeamSpot::x0Error(), reco::BeamSpot::y0(), reco::BeamSpot::y0Error(), reco::BeamSpot::z0(), and reco::BeamSpot::z0Error().

Referenced by beginLuminosityBlock().

709  {
710  if (onlineMode_ && (nthlumi <= nextlumi)) return;
711 
712  //set the correct run number when no event in the LS for fake output
714 
715  int currentlumi = nextlumi;
716  edm::LogInfo("BeamMonitor") << "FitAndFill:: Lumi of the current fit: " << currentlumi << endl;
717  lastlumi = currentlumi;
718  endLumiOfBSFit_ = currentlumi;
719  endLumiOfPVFit_ = currentlumi;
720 
721 
722  //---------Fix for Runninv average-------------
724 
725  if(StartAverage_)
726  {
727  std::map<int, std::size_t>::iterator rmLSPVi = mapLSPVStoreSize.begin();
728  size_t SizeToRemovePV= rmLSPVi->second;
729  for(std::map<int, std::size_t>::iterator rmLSPVe = mapLSPVStoreSize.end(); ++rmLSPVi != rmLSPVe;)
730  rmLSPVi->second -= SizeToRemovePV;
731 
732  theBeamFitter->resizePVvector(SizeToRemovePV);
733 
734  map<int, std::size_t >::iterator tmpItpv=mapLSPVStoreSize.begin();
735  mapLSPVStoreSize.erase(tmpItpv);
736  }
737  if(debug_)edm::LogInfo("BeamMonitor") << "FitAndFill:: Size of thePVvector After removing the PVs = " << theBeamFitter->getPVvectorSize()<<endl;
738 
739 
740  //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
741  bool resetHistoFlag_=false;
742  if((int)mapPVx.size() >= resetFitNLumi_ && (StartAverage_)){
743  h_PVx[0]->Reset();
744  h_PVy[0]->Reset();
745  h_PVz[0]->Reset();
746  h_nVtx_st->Reset();
747  resetHistoFlag_ = true;
748  }
749 
750  int MaxPVs = 0;
751  int countEvtLastNLS_=0;
752  int countTotPV_= 0;
753 
754  std::map< int, std::vector<int> >::iterator mnpv=mapNPV.begin();
755  std::map< int, std::vector<float> >::iterator mpv2=mapPVy.begin();
756  std::map< int, std::vector<float> >::iterator mpv3=mapPVz.begin();
757 
758  for(std::map< int, std::vector<float> >::iterator mpv1=mapPVx.begin(); mpv1 != mapPVx.end(); ++mpv1, ++mpv2, ++mpv3, ++mnpv)
759  {
760  std::vector<float>::iterator mpvs2 = (mpv2->second).begin();
761  std::vector<float>::iterator mpvs3 = (mpv3->second).begin();
762  for(std::vector<float>::iterator mpvs1=(mpv1->second).begin(); mpvs1 !=(mpv1->second).end(); ++mpvs1, ++mpvs2, ++mpvs3){
763  if(resetHistoFlag_)
764  {h_PVx[0]->Fill( *mpvs1 ); //these histogram are reset after StartAverage_ flag is ON
765  h_PVy[0]->Fill( *mpvs2 );
766  h_PVz[0]->Fill( *mpvs3 );
767  }
768  }//loop over second
769 
770  //Do the same here for nPV distr.
771  for(std::vector<int>::iterator mnpvs = (mnpv->second).begin(); mnpvs != (mnpv->second).end(); ++mnpvs){
772  if((*mnpvs > 0) && (resetHistoFlag_) )h_nVtx_st->Fill( (*mnpvs)*(1.0) );
773  countEvtLastNLS_++;
774  countTotPV_ += (*mnpvs);
775  if((*mnpvs) > MaxPVs) MaxPVs = (*mnpvs);
776  }//loop over second of mapNPV
777 
778  }//loop over last N lumis
779 
780  char tmpTitlePV[100];
781  sprintf(tmpTitlePV,"%s %i %s %i","Num. of reco. vertices for LS: ",beginLumiOfPVFit_," to ",endLumiOfPVFit_);
782  h_nVtx_st->setAxisTitle(tmpTitlePV,1);
783 
784  std::vector<float> DipPVInfo_;
785  DipPVInfo_.clear();
786 
787  if(countTotPV_ != 0 ){
788  DipPVInfo_.push_back((float)countEvtLastNLS_);
789  DipPVInfo_.push_back(h_nVtx_st->getMean());
790  DipPVInfo_.push_back(h_nVtx_st->getMeanError());
791  DipPVInfo_.push_back(h_nVtx_st->getRMS());
792  DipPVInfo_.push_back(h_nVtx_st->getRMSError());
793  DipPVInfo_.push_back((float)MaxPVs);
794  DipPVInfo_.push_back((float)countTotPV_);
795  MaxPVs =0;
796  }
797  else{ for(size_t i= 0; i < 7; i++){if(i>0)DipPVInfo_.push_back(0.);
798  else DipPVInfo_.push_back((float)countEvtLastNLS_);}
799  }
800  theBeamFitter->SetPVInfo(DipPVInfo_);
801  countEvtLastNLS_=0;
802 
803 
804 
805  if (onlineMode_) { // filling LS gap
806  // FIXME: need to add protection for the case if the gap is at the resetting LS!
807  const int countLS_bs = hs["x0_lumi"]->getTH1()->GetEntries();
808  const int countLS_pv = hs["PVx_lumi"]->getTH1()->GetEntries();
809  edm::LogInfo("BeamMonitor") << "FitAndFill:: countLS_bs = " << countLS_bs << " ; countLS_pv = " << countLS_pv << std::endl;
810  int LSgap_bs = currentlumi/fitNLumi_ - countLS_bs;
811  int LSgap_pv = currentlumi/fitPVNLumi_ - countLS_pv;
812  if (currentlumi%fitNLumi_ == 0)
813  LSgap_bs--;
814  if (currentlumi%fitPVNLumi_ == 0)
815  LSgap_pv--;
816  edm::LogInfo("BeamMonitor") << "FitAndFill:: LSgap_bs = " << LSgap_bs << " ; LSgap_pv = " << LSgap_pv << std::endl;
817  // filling previous fits if LS gap ever exists
818  for (int ig = 0; ig < LSgap_bs; ig++) {
819  hs["x0_lumi"]->ShiftFillLast( 0., 0., fitNLumi_ );//x0 , x0err, fitNLumi_; see DQMCore....
820  hs["y0_lumi"]->ShiftFillLast( 0., 0., fitNLumi_ );
821  hs["z0_lumi"]->ShiftFillLast( 0., 0., fitNLumi_ );
822  hs["sigmaX0_lumi"]->ShiftFillLast( 0., 0., fitNLumi_ );
823  hs["sigmaY0_lumi"]->ShiftFillLast( 0., 0., fitNLumi_ );
824  hs["sigmaZ0_lumi"]->ShiftFillLast( 0., 0., fitNLumi_ );
825  h_nVtx_lumi->ShiftFillLast( 0., 0., fitNLumi_ );
826  }
827  for (int ig = 0; ig < LSgap_pv; ig++) {
828  hs["PVx_lumi"]->ShiftFillLast( 0., 0., fitPVNLumi_ );
829  hs["PVy_lumi"]->ShiftFillLast( 0., 0., fitPVNLumi_ );
830  hs["PVz_lumi"]->ShiftFillLast( 0., 0., fitPVNLumi_ );
831  }
832  const int previousLS = h_nTrk_lumi->getTH1()->GetEntries();
833  for (int i=1;i < (currentlumi - previousLS);i++)//if (current-previoius)= 1 then never go inside the for loop!!!!!!!!!!!
835  }
836 
837  edm::LogInfo("BeamMonitor") << "FitAndFill:: Time lapsed since last scroll = " << tmpTime - refTime << std:: endl;
838 
839  if (testScroll(tmpTime,refTime)) {
840  scrollTH1(hs["x0_time"]->getTH1(),refTime);
841  scrollTH1(hs["y0_time"]->getTH1(),refTime);
842  scrollTH1(hs["z0_time"]->getTH1(),refTime);
843  scrollTH1(hs["sigmaX0_time"]->getTH1(),refTime);
844  scrollTH1(hs["sigmaY0_time"]->getTH1(),refTime);
845  scrollTH1(hs["sigmaZ0_time"]->getTH1(),refTime);
846  scrollTH1(hs["PVx_time"]->getTH1(),refTime);
847  scrollTH1(hs["PVy_time"]->getTH1(),refTime);
848  scrollTH1(hs["PVz_time"]->getTH1(),refTime);
849  }
850 
851  bool doPVFit = false;
852 
853  if (fitPVNLumi_ > 0) {
854  if (onlineMode_) {
855  if (currentlumi%fitPVNLumi_ == 0)
856  doPVFit = true;
857  }
858  else
859  if (countLumi_%fitPVNLumi_ == 0)
860  doPVFit = true;
861  }
862  else
863  doPVFit = true;
864 
865 
866  if (doPVFit) {
867  edm::LogInfo("BeamMonitor") << "FitAndFill:: Do PV Fitting for LS = " << beginLumiOfPVFit_ << " to " << endLumiOfPVFit_ << std::endl;
868  // Primary Vertex Fit:
869  if (h_PVx[0]->getTH1()->GetEntries() > minNrVertices_) {
870 
871  pvResults->Reset();
872  char tmpTitle[50];
873  sprintf(tmpTitle,"%s %i %s %i","Fitted Primary Vertex (cm) of LS: ",beginLumiOfPVFit_," to ",endLumiOfPVFit_);
874  pvResults->setAxisTitle(tmpTitle,1);
875 
876  std::unique_ptr<TF1> fgaus{ new TF1("fgaus","gaus") };
877  double mean,width,meanErr,widthErr;
878  fgaus->SetLineColor(4);
879  h_PVx[0]->getTH1()->Fit(fgaus.get(),"QLM0");
880  mean = fgaus->GetParameter(1);
881  width = fgaus->GetParameter(2);
882  meanErr = fgaus->GetParError(1);
883  widthErr = fgaus->GetParError(2);
884 
885 
886  hs["PVx_lumi"]->ShiftFillLast(mean,width,fitPVNLumi_);
887  hs["PVx_lumi_all"]->setBinContent(currentlumi,mean);
888  hs["PVx_lumi_all"]->setBinError(currentlumi,width);
889  int nthBin = tmpTime - refTime;
890  if (nthBin < 0)
891  edm::LogInfo("BeamMonitor") << "FitAndFill:: Event time outside current range of time histograms!" << std::endl;
892  if (nthBin > 0) {
893  hs["PVx_time"]->setBinContent(nthBin,mean);
894  hs["PVx_time"]->setBinError(nthBin,width);
895  }
896  int jthBin = tmpTime - startTime;
897  if (jthBin > 0) {
898  hs["PVx_time_all"]->setBinContent(jthBin,mean);
899  hs["PVx_time_all"]->setBinError(jthBin,width);
900  }
901  pvResults->setBinContent(1,6,mean);
902  pvResults->setBinContent(1,3,width);
903  pvResults->setBinContent(2,6,meanErr);
904  pvResults->setBinContent(2,3,widthErr);
905 
906  dbe_->setCurrentFolder(monitorName_+"PrimaryVertex/");
907  const char* tmpfile;
908  TH1D * tmphisto;
909  // snap shot of the fit
910  tmpfile= (h_PVx[1]->getName()).c_str();
911  tmphisto = static_cast<TH1D *>((h_PVx[0]->getTH1())->Clone("tmphisto"));
912  h_PVx[1]->getTH1()->SetBins(tmphisto->GetNbinsX(),tmphisto->GetXaxis()->GetXmin(),tmphisto->GetXaxis()->GetXmax());
913  h_PVx[1] = dbe_->book1D(tmpfile,h_PVx[0]->getTH1F());
914  h_PVx[1]->getTH1()->Fit(fgaus.get(),"QLM");
915 
916 
917  h_PVy[0]->getTH1()->Fit(fgaus.get(),"QLM0");
918  mean = fgaus->GetParameter(1);
919  width = fgaus->GetParameter(2);
920  meanErr = fgaus->GetParError(1);
921  widthErr = fgaus->GetParError(2);
922  hs["PVy_lumi"]->ShiftFillLast(mean,width,fitPVNLumi_);
923  hs["PVy_lumi_all"]->setBinContent(currentlumi,mean);
924  hs["PVy_lumi_all"]->setBinError(currentlumi,width);
925  if (nthBin > 0) {
926  hs["PVy_time"]->setBinContent(nthBin,mean);
927  hs["PVy_time"]->setBinError(nthBin,width);
928  }
929  if (jthBin > 0) {
930  hs["PVy_time_all"]->setBinContent(jthBin,mean);
931  hs["PVy_time_all"]->setBinError(jthBin,width);
932  }
933  pvResults->setBinContent(1,5,mean);
934  pvResults->setBinContent(1,2,width);
935  pvResults->setBinContent(2,5,meanErr);
936  pvResults->setBinContent(2,2,widthErr);
937  // snap shot of the fit
938  tmpfile= (h_PVy[1]->getName()).c_str();
939  tmphisto = static_cast<TH1D *>((h_PVy[0]->getTH1())->Clone("tmphisto"));
940  h_PVy[1]->getTH1()->SetBins(tmphisto->GetNbinsX(),tmphisto->GetXaxis()->GetXmin(),tmphisto->GetXaxis()->GetXmax());
941  h_PVy[1]->update();
942  h_PVy[1] = dbe_->book1D(tmpfile,h_PVy[0]->getTH1F());
943  h_PVy[1]->getTH1()->Fit(fgaus.get(),"QLM");
944 
945 
946  h_PVz[0]->getTH1()->Fit(fgaus.get(),"QLM0");
947  mean = fgaus->GetParameter(1);
948  width = fgaus->GetParameter(2);
949  meanErr = fgaus->GetParError(1);
950  widthErr = fgaus->GetParError(2);
951  hs["PVz_lumi"]->ShiftFillLast(mean,width,fitPVNLumi_);
952  hs["PVz_lumi_all"]->setBinContent(currentlumi,mean);
953  hs["PVz_lumi_all"]->setBinError(currentlumi,width);
954  if (nthBin > 0) {
955  hs["PVz_time"]->setBinContent(nthBin,mean);
956  hs["PVz_time"]->setBinError(nthBin,width);
957  }
958  if (jthBin > 0) {
959  hs["PVz_time_all"]->setBinContent(jthBin,mean);
960  hs["PVz_time_all"]->setBinError(jthBin,width);
961  }
962  pvResults->setBinContent(1,4,mean);
963  pvResults->setBinContent(1,1,width);
964  pvResults->setBinContent(2,4,meanErr);
965  pvResults->setBinContent(2,1,widthErr);
966  // snap shot of the fit
967  tmpfile= (h_PVz[1]->getName()).c_str();
968  tmphisto = static_cast<TH1D *>((h_PVz[0]->getTH1())->Clone("tmphisto"));
969  h_PVz[1]->getTH1()->SetBins(tmphisto->GetNbinsX(),tmphisto->GetXaxis()->GetXmin(),tmphisto->GetXaxis()->GetXmax());
970  h_PVz[1]->update();
971  h_PVz[1] = dbe_->book1D(tmpfile,h_PVz[0]->getTH1F());
972  h_PVz[1]->getTH1()->Fit(fgaus.get(),"QLM");
973  delete tmphisto;
974 
975  }//check if found min Vertices
976  }//do PVfit
977 
980  refPVtime[0] = 0;
981  }
982 
983 
984 
985 
986  //---------Readjustment of theBSvector, RefTime, beginLSofFit---------
987  vector<BSTrkParameters> theBSvector1 = theBeamFitter->getBSvector();
988  mapLSBSTrkSize[countLumi_]= (theBSvector1.size());
989  size_t PreviousRecords=0; //needed to fill nth record of tracks in GUI
990 
991  if(StartAverage_){
992  size_t SizeToRemove=0;
993  std::map<int, std::size_t>::iterator rmls=mapLSBSTrkSize.begin();
994  SizeToRemove = rmls->second;
995  if(debug_)edm::LogInfo("BeamMonitor")<< " The size to remove is = "<< SizeToRemove << endl;
996  int changedAfterThis=0;
997  for(std::map<int, std::size_t>::iterator rmLS = mapLSBSTrkSize.begin(); rmLS!=mapLSBSTrkSize.end(); ++rmLS, ++changedAfterThis){
998  if(changedAfterThis > 0 ){(rmLS->second) = (rmLS->second)-SizeToRemove;
999  if((mapLSBSTrkSize.size()- (size_t)changedAfterThis) == 2 )PreviousRecords = (rmLS->second);
1000  } }
1001 
1002  theBeamFitter->resizeBSvector(SizeToRemove);
1003 
1004  map<int, std::size_t >::iterator tmpIt=mapLSBSTrkSize.begin();
1005  mapLSBSTrkSize.erase(tmpIt);
1006 
1007  std::pair<int,int> checkfitLS = theBeamFitter->getFitLSRange();
1008  std::pair<time_t,time_t> checkfitTime =theBeamFitter->getRefTime();
1009  theBeamFitter->setFitLSRange(beginLumiOfBSFit_, checkfitLS.second);
1010  theBeamFitter->setRefTime(refBStime[0], checkfitTime.second);
1011  }
1012 
1013  //Fill the track for this fit
1014  vector<BSTrkParameters> theBSvector = theBeamFitter->getBSvector();
1015  h_nTrk_lumi->ShiftFillLast( theBSvector.size() );
1016 
1017  if(debug_)edm::LogInfo("BeamMonitor")<< "FitAndFill:: Size of theBSViector.size() After =" << theBSvector.size() << endl;
1018 
1019 
1020 
1021  bool countFitting = false;
1022  if (theBSvector.size() >= PreviousRecords && theBSvector.size() >= min_Ntrks_) {
1023  countFitting = true;
1024  }
1025 
1026 
1027  //---Fix for Cut Flow Table for Running average in a same way//the previous code has problem for resetting!!!
1029  if(StartAverage_ && mapLSCF.size()){
1030  const TH1F& cutFlowToSubtract = mapLSCF.begin()->second;
1031  // Subtract the last cut flow from all of the others.
1032  std::map<int, TH1F>::iterator cf = mapLSCF.begin();
1033  // Start on second entry
1034  for(; cf != mapLSCF.end(); ++cf) {
1035  cf->second.Add(&cutFlowToSubtract, -1);
1036  }
1037  theBeamFitter->subtractFromCutFlow(&cutFlowToSubtract);
1038  // Remove the obsolete lumi section
1039  mapLSCF.erase(mapLSCF.begin());
1040  }
1041 
1042  if (resetHistos_) {
1043  h_d0_phi0->Reset();
1044  h_vx_vy->Reset();
1045  h_vx_dz->Reset();
1046  h_vy_dz->Reset();
1047  h_trk_z0->Reset();
1048  resetHistos_ = false;
1049  }
1050 
1051  if(StartAverage_) nthBSTrk_ = PreviousRecords; //after average proccess is ON//for 2-6 LS fit PreviousRecords is size from 2-5 LS
1052 
1053  edm::LogInfo("BeamMonitor")<<" The Previous Recored for this fit is ="<<nthBSTrk_<<endl;
1054 
1055  unsigned int itrk = 0;
1056  for (vector<BSTrkParameters>::const_iterator BSTrk = theBSvector.begin();
1057  BSTrk != theBSvector.end(); ++BSTrk, ++itrk){
1058  if (itrk >= nthBSTrk_){//fill for this record only !!
1059  h_d0_phi0->Fill( BSTrk->phi0(), BSTrk->d0() );
1060  double vx = BSTrk->vx();
1061  double vy = BSTrk->vy();
1062  double z0 = BSTrk->z0();
1063  h_vx_vy->Fill( vx, vy );
1064  h_vx_dz->Fill( z0, vx );
1065  h_vy_dz->Fill( z0, vy );
1066  h_trk_z0->Fill( z0 );
1067  }
1068  }
1069 
1070 
1071  nthBSTrk_ = theBSvector.size(); // keep track of num of tracks filled so far
1072 
1073  edm::LogInfo("BeamMonitor")<<" The Current Recored for this fit is ="<<nthBSTrk_<<endl;
1074 
1075  if (countFitting) edm::LogInfo("BeamMonitor") << "FitAndFill:: Num of tracks collected = " << nthBSTrk_ << endl;
1076 
1077 
1078  if (fitNLumi_ > 0) {
1079  if (onlineMode_){
1080  if (currentlumi%fitNLumi_!=0) {
1081 // for (std::map<TString,MonitorElement*>::iterator itAll = hs.begin();
1082 // itAll != hs.end(); ++itAll) {
1083 // if ((*itAll).first.Contains("all")) {
1084 // (*itAll).second->setBinContent(currentlumi,0.);
1085 // (*itAll).second->setBinError(currentlumi,0.);
1086 // }
1087 // }
1088  return;
1089  }
1090  }
1091  else
1092  if (countLumi_%fitNLumi_!=0) return;
1093  }
1094 
1095  edm::LogInfo("BeamMonitor") << "FitAndFill:: [DebugTime] refBStime[0] = " << refBStime[0]
1096  << "; address = " << &refBStime[0] << std::endl;
1097  edm::LogInfo("BeamMonitor") << "FitAndFill:: [DebugTime] refBStime[1] = " << refBStime[1]
1098  << "; address = " << &refBStime[1] << std::endl;
1099 
1100  //Fill for all LS even if fit fails
1103 
1104  if (countFitting) {
1105  nFits_++;
1106  std::pair<int,int> fitLS = theBeamFitter->getFitLSRange();
1107  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamFitter] Do BeamSpot Fit for LS = " << fitLS.first << " to " << fitLS.second << std::endl;
1108  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] Do BeamSpot Fit for LS = " << beginLumiOfBSFit_ << " to " << endLumiOfBSFit_ << std::endl;
1109 
1110  //Now Run the PV and Track Fitter over the collected tracks and pvs
1113  if (bs.type() > 0) // with good beamwidth fit
1114  preBS = bs; // cache good fit results
1115 
1116  edm::LogInfo("BeamMonitor") << "\n RESULTS OF DEFAULT FIT:" << endl;
1117  edm::LogInfo("BeamMonitor") << bs << endl;
1118  edm::LogInfo("BeamMonitor") << "[BeamFitter] fitting done \n" << endl;
1119 
1120  hs["x0_lumi"]->ShiftFillLast( bs.x0(), bs.x0Error(), fitNLumi_ );
1121  hs["y0_lumi"]->ShiftFillLast( bs.y0(), bs.y0Error(), fitNLumi_ );
1122  hs["z0_lumi"]->ShiftFillLast( bs.z0(), bs.z0Error(), fitNLumi_ );
1123  hs["sigmaX0_lumi"]->ShiftFillLast( bs.BeamWidthX(), bs.BeamWidthXError(), fitNLumi_ );
1124  hs["sigmaY0_lumi"]->ShiftFillLast( bs.BeamWidthY(), bs.BeamWidthYError(), fitNLumi_ );
1125  hs["sigmaZ0_lumi"]->ShiftFillLast( bs.sigmaZ(), bs.sigmaZ0Error(), fitNLumi_ );
1126  hs["x0_lumi_all"]->setBinContent(currentlumi,bs.x0());
1127  hs["x0_lumi_all"]->setBinError(currentlumi,bs.x0Error());
1128  hs["y0_lumi_all"]->setBinContent(currentlumi,bs.y0());
1129  hs["y0_lumi_all"]->setBinError(currentlumi,bs.y0Error());
1130  hs["z0_lumi_all"]->setBinContent(currentlumi,bs.z0());
1131  hs["z0_lumi_all"]->setBinError(currentlumi,bs.z0Error());
1132  hs["sigmaX0_lumi_all"]->setBinContent(currentlumi, bs.BeamWidthX());
1133  hs["sigmaX0_lumi_all"]->setBinError(currentlumi, bs.BeamWidthXError());
1134  hs["sigmaY0_lumi_all"]->setBinContent(currentlumi, bs.BeamWidthY());
1135  hs["sigmaY0_lumi_all"]->setBinError(currentlumi, bs.BeamWidthYError());
1136  hs["sigmaZ0_lumi_all"]->setBinContent(currentlumi, bs.sigmaZ());
1137  hs["sigmaZ0_lumi_all"]->setBinError(currentlumi, bs.sigmaZ0Error());
1138 
1139  int nthBin = tmpTime - refTime;
1140  if (nthBin > 0) {
1141  hs["x0_time"]->setBinContent(nthBin, bs.x0());
1142  hs["y0_time"]->setBinContent(nthBin, bs.y0());
1143  hs["z0_time"]->setBinContent(nthBin, bs.z0());
1144  hs["sigmaX0_time"]->setBinContent(nthBin, bs.BeamWidthX());
1145  hs["sigmaY0_time"]->setBinContent(nthBin, bs.BeamWidthY());
1146  hs["sigmaZ0_time"]->setBinContent(nthBin, bs.sigmaZ());
1147  hs["x0_time"]->setBinError(nthBin, bs.x0Error());
1148  hs["y0_time"]->setBinError(nthBin, bs.y0Error());
1149  hs["z0_time"]->setBinError(nthBin, bs.z0Error());
1150  hs["sigmaX0_time"]->setBinError(nthBin, bs.BeamWidthXError());
1151  hs["sigmaY0_time"]->setBinError(nthBin, bs.BeamWidthYError());
1152  hs["sigmaZ0_time"]->setBinError(nthBin, bs.sigmaZ0Error());
1153  }
1154 
1155  int jthBin = tmpTime - startTime;
1156  if (jthBin > 0) {
1157  hs["x0_time_all"]->setBinContent(jthBin, bs.x0());
1158  hs["y0_time_all"]->setBinContent(jthBin, bs.y0());
1159  hs["z0_time_all"]->setBinContent(jthBin, bs.z0());
1160  hs["sigmaX0_time_all"]->setBinContent(jthBin, bs.BeamWidthX());
1161  hs["sigmaY0_time_all"]->setBinContent(jthBin, bs.BeamWidthY());
1162  hs["sigmaZ0_time_all"]->setBinContent(jthBin, bs.sigmaZ());
1163  hs["x0_time_all"]->setBinError(jthBin, bs.x0Error());
1164  hs["y0_time_all"]->setBinError(jthBin, bs.y0Error());
1165  hs["z0_time_all"]->setBinError(jthBin, bs.z0Error());
1166  hs["sigmaX0_time_all"]->setBinError(jthBin, bs.BeamWidthXError());
1167  hs["sigmaY0_time_all"]->setBinError(jthBin, bs.BeamWidthYError());
1168  hs["sigmaZ0_time_all"]->setBinError(jthBin, bs.sigmaZ0Error());
1169  }
1170 
1171  h_x0->Fill( bs.x0());
1172  h_y0->Fill( bs.y0());
1173  h_z0->Fill( bs.z0());
1174  if (bs.type() > 0) { // with good beamwidth fit
1175  h_sigmaX0->Fill( bs.BeamWidthX());
1176  h_sigmaY0->Fill( bs.BeamWidthY());
1177  }
1178  h_sigmaZ0->Fill( bs.sigmaZ());
1179 
1180  if (nthBSTrk_ >= 2*min_Ntrks_) {
1181  double amp = std::sqrt(bs.x0()*bs.x0()+bs.y0()*bs.y0());
1182  double alpha = std::atan2(bs.y0(),bs.x0());
1183  std::unique_ptr<TF1> f1{ new TF1("f1","[0]*sin(x-[1])",-3.14,3.14) };
1184  f1->SetParameters(amp,alpha);
1185  f1->SetParLimits(0,amp-0.1,amp+0.1);
1186  f1->SetParLimits(1,alpha-0.577,alpha+0.577);
1187  f1->SetLineColor(4);
1188  h_d0_phi0->getTProfile()->Fit(f1.get(),"QR");
1189 
1190  double mean = bs.z0();
1191  double width = bs.sigmaZ();
1192  std::unique_ptr<TF1> fgaus{ new TF1("fgaus","gaus") };
1193  fgaus->SetParameters(mean,width);
1194  fgaus->SetLineColor(4);
1195  h_trk_z0->getTH1()->Fit(fgaus.get(),"QLRM","",mean-3*width,mean+3*width);
1196  }
1197 
1198  fitResults->Reset();
1199  std::pair<int,int> LSRange = theBeamFitter->getFitLSRange();
1200  char tmpTitle[50];
1201  sprintf(tmpTitle,"%s %i %s %i","Fitted Beam Spot (cm) of LS: ",LSRange.first," to ",LSRange.second);
1202  fitResults->setAxisTitle(tmpTitle,1);
1203  fitResults->setBinContent(1,8,bs.x0());
1204  fitResults->setBinContent(1,7,bs.y0());
1205  fitResults->setBinContent(1,6,bs.z0());
1206  fitResults->setBinContent(1,5,bs.sigmaZ());
1207  fitResults->setBinContent(1,4,bs.dxdz());
1208  fitResults->setBinContent(1,3,bs.dydz());
1209  if (bs.type() > 0) { // with good beamwidth fit
1210  fitResults->setBinContent(1,2,bs.BeamWidthX());
1211  fitResults->setBinContent(1,1,bs.BeamWidthY());
1212  }
1213  else { // fill cached widths
1216  }
1217 
1218  fitResults->setBinContent(2,8,bs.x0Error());
1219  fitResults->setBinContent(2,7,bs.y0Error());
1220  fitResults->setBinContent(2,6,bs.z0Error());
1222  fitResults->setBinContent(2,4,bs.dxdzError());
1223  fitResults->setBinContent(2,3,bs.dydzError());
1224  if (bs.type() > 0) { // with good beamwidth fit
1227  }
1228  else { // fill cached width errors
1231  }
1232 
1233  // count good fit
1234  // if (std::fabs(refBS.x0()-bs.x0())/bs.x0Error() < deltaSigCut_) { // disabled temporarily
1235  summaryContent_[0] += 1.;
1236  // }
1237  // if (std::fabs(refBS.y0()-bs.y0())/bs.y0Error() < deltaSigCut_) { // disabled temporarily
1238  summaryContent_[1] += 1.;
1239  // }
1240  // if (std::fabs(refBS.z0()-bs.z0())/bs.z0Error() < deltaSigCut_) { // disabled temporarily
1241  summaryContent_[2] += 1.;
1242  // }
1243 
1244  } //if (theBeamFitter->runPVandTrkFitter())
1245  else { // beam fit fails
1247  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] Beam fit fails!!! \n" << endl;
1248  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] Output beam spot for DIP \n" << endl;
1249  edm::LogInfo("BeamMonitor") << bs << endl;
1250 
1251  hs["sigmaX0_lumi"]->ShiftFillLast( bs.BeamWidthX(), bs.BeamWidthXError(), fitNLumi_ );
1252  hs["sigmaY0_lumi"]->ShiftFillLast( bs.BeamWidthY(), bs.BeamWidthYError(), fitNLumi_ );
1253  hs["sigmaZ0_lumi"]->ShiftFillLast( bs.sigmaZ(), bs.sigmaZ0Error(), fitNLumi_ );
1254  hs["x0_lumi"]->ShiftFillLast( bs.x0(), bs.x0Error(), fitNLumi_ );
1255  hs["y0_lumi"]->ShiftFillLast( bs.y0(), bs.y0Error(), fitNLumi_ );
1256  hs["z0_lumi"]->ShiftFillLast( bs.z0(), bs.z0Error(), fitNLumi_ );
1257  } // end of beam fit fails
1258 
1259 
1260  } //-------- end of countFitting------------------------------------------
1261  else { // no fit
1262  // Overwrite Fit LS and fit time when no event processed or no track selected
1265  if (theBeamFitter->runPVandTrkFitter()) {} // Dump fake beam spot for DIP
1267  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] No fitting \n" << endl;
1268  edm::LogInfo("BeamMonitor") << "FitAndFill:: [BeamMonitor] Output fake beam spot for DIP \n" << endl;
1269  edm::LogInfo("BeamMonitor") << bs << endl;
1270 
1271  hs["sigmaX0_lumi"]->ShiftFillLast( bs.BeamWidthX(), bs.BeamWidthXError(), fitNLumi_ );
1272  hs["sigmaY0_lumi"]->ShiftFillLast( bs.BeamWidthY(), bs.BeamWidthYError(), fitNLumi_ );
1273  hs["sigmaZ0_lumi"]->ShiftFillLast( bs.sigmaZ(), bs.sigmaZ0Error(), fitNLumi_ );
1274  hs["x0_lumi"]->ShiftFillLast( bs.x0(), bs.x0Error(), fitNLumi_ );
1275  hs["y0_lumi"]->ShiftFillLast( bs.y0(), bs.y0Error(), fitNLumi_ );
1276  hs["z0_lumi"]->ShiftFillLast( bs.z0(), bs.z0Error(), fitNLumi_ );
1277  }
1278 
1279 
1280 
1281  // Fill summary report
1282  if (countFitting) {
1283  for (int n = 0; n < nFitElements_; n++) {
1285  }
1286 
1287  summarySum_ = 0;
1288  for (int ii = 0; ii < nFitElements_; ii++) {
1290  }
1291  reportSummary_ = summarySum_ / (nFitElements_ * nFits_);
1293 
1294  for ( int bi = 0; bi < nFitElements_ ; bi++) {
1295  reportSummaryMap->setBinContent(1,bi+1,summaryContent_[bi] / (float)nFits_);
1296  }
1297  }
1298 
1299 
1300 
1301 
1302  if ( ( resetFitNLumi_ > 0 &&
1303  ((onlineMode_ && countLumi_==resetFitNLumi_ ) || //OR it should be currentLumi_ (if in sequence then does not mattar)
1305  ) || (StartAverage_) ){
1306 
1307  edm::LogInfo("BeamMonitor") << "FitAndFill:: The flag is ON for running average Beam Spot fit"<<endl;
1308  StartAverage_ = true;
1309  firstAverageFit_++;
1310  resetHistos_ = true;
1311  nthBSTrk_ = 0;
1312  beginLumiOfBSFit_= 0;
1313  refBStime[0] = 0;
1314 
1315  }
1316 
1317 
1318 
1319 }
double z0() const
z coordinate
Definition: BeamSpot.h:68
const std::string & getName(void) const
get name of ME
int i
Definition: DBlmapReader.cc:9
float alpha
Definition: AMPTWrapper.h:95
unsigned int minNrVertices_
Definition: BeamMonitor.h:101
void setBinContent(int binx, double content)
set content of bin (1-D)
double sigmaZ0Error() const
error on sigma z
Definition: BeamSpot.h:96
int nFitElements_
Definition: BeamMonitor.h:96
std::time_t refBStime[2]
Definition: BeamMonitor.h:93
MonitorElement * reportSummary
Definition: BeamMonitor.h:162
int endLumiOfPVFit_
Definition: BeamMonitor.h:90
int resetFitNLumi_
Definition: BeamMonitor.h:75
bool runPVandTrkFitter()
Definition: BeamFitter.cc:397
double dydzError() const
error on dydz
Definition: BeamSpot.h:100
void setRun(int run)
Definition: BeamFitter.h:124
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:140
bool testScroll(std::time_t &, std::time_t &)
std::vector< BSTrkParameters > getBSvector()
Definition: BeamFitter.h:96
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:147
void subtractFromCutFlow(const TH1F *toSubtract)
Definition: BeamFitter.h:98
bool processed_
Definition: BeamMonitor.h:110
std::size_t getPVvectorSize()
Definition: BeamFitter.h:72
void update(void)
Mark the object updated.
MonitorElement * h_sigmaZ0
Definition: BeamMonitor.h:135
MonitorElement * h_nTrk_lumi
Definition: BeamMonitor.h:119
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:153
double getMean(int axis=1) const
get mean value of histogram along x, y or z axis (axis=1, 2, 3 respectively)
int ii
Definition: cuy.py:588
MonitorElement * fitResults
Definition: BeamMonitor.h:129
int fitPVNLumi_
Definition: BeamMonitor.h:74
MonitorElement * h_sigmaY0
Definition: BeamMonitor.h:134
double getMeanError(int axis=1) const
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:147
void Fill(long long x)
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:148
double dydz() const
dydz slope
Definition: BeamSpot.h:84
MonitorElement * h_y0
Definition: BeamMonitor.h:131
void ShiftFillLast(double y, double ye=0., int32_t xscale=1)
double dxdzError() const
error on dxdz
Definition: BeamSpot.h:98
MonitorElement * h_vy_dz
Definition: BeamMonitor.h:126
T sqrt(T t)
Definition: SSEVec.h:48
Float_t reportSummary_
Definition: BeamMonitor.h:159
std::time_t refTime
Definition: BeamMonitor.h:171
MonitorElement * pvResults
Definition: BeamMonitor.h:143
int endLumiOfBSFit_
Definition: BeamMonitor.h:88
std::time_t refPVtime[2]
Definition: BeamMonitor.h:94
MonitorElement * h_nVtx_lumi
Definition: BeamMonitor.h:120
TH1 * getTH1(void) const
double BeamWidthX() const
beam width X
Definition: BeamSpot.h:86
void setFitLSRange(int ls0, int ls1)
Definition: BeamFitter.h:120
TH1F * getTH1F(std::string name, std::string process, std::string rootfolder, DQMStore *dbe_, bool verb, bool clone)
std::pair< time_t, time_t > getRefTime()
Definition: BeamFitter.h:65
#define end
Definition: vmac.h:37
double BeamWidthYError() const
error on beam width Y, assume error in X = Y
Definition: BeamSpot.h:105
double BeamWidthXError() const
error on beam width X, assume error in X = Y
Definition: BeamSpot.h:103
double z0Error() const
error on z
Definition: BeamSpot.h:94
double dxdz() const
dxdz slope
Definition: BeamSpot.h:82
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:156
void SetPVInfo(const std::vector< float > &v1_)
Definition: BeamFitter.h:84
double x0Error() const
error on x
Definition: BeamSpot.h:90
double y0Error() const
error on y
Definition: BeamSpot.h:92
MonitorElement * h_nVtx_lumi_all
Definition: BeamMonitor.h:121
DQMStore * dbe_
Definition: BeamMonitor.h:82
int getRunNumber()
Definition: BeamFitter.h:113
std::time_t startTime
Definition: BeamMonitor.h:170
double getRMSError(int axis=1) const
get RMS uncertainty of histogram along x, y or z axis(axis=1,2,3 respectively)
Float_t summaryContent_[3]
Definition: BeamMonitor.h:161
MonitorElement * h_sigmaX0
Definition: BeamMonitor.h:133
bool StartAverage_
Definition: BeamMonitor.h:106
reco::BeamSpot preBS
Definition: BeamMonitor.h:116
MonitorElement * h_nVtx_st
Definition: BeamMonitor.h:137
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:139
void resizeBSvector(unsigned int nsize)
Definition: BeamFitter.h:74
int beginLumiOfPVFit_
Definition: BeamMonitor.h:89
MonitorElement * reportSummaryContents[3]
Definition: BeamMonitor.h:163
double sigmaZ() const
sigma z
Definition: BeamSpot.h:80
double BeamWidthY() const
beam width Y
Definition: BeamSpot.h:88
MonitorElement * h_x0
Definition: BeamMonitor.h:130
MonitorElement * h_trk_z0
Definition: BeamMonitor.h:123
int resetPVNLumi_
Definition: BeamMonitor.h:76
Float_t summarySum_
Definition: BeamMonitor.h:160
TH1F * getCutFlow()
Definition: BeamFitter.h:97
#define begin
Definition: vmac.h:30
MonitorElement * h_vx_dz
Definition: BeamMonitor.h:125
double getRMS(int axis=1) const
get RMS of histogram along x, y or z axis (axis=1, 2, 3 respectively)
MonitorElement * h_z0
Definition: BeamMonitor.h:132
void resizePVvector(unsigned int npvsize)
Definition: BeamFitter.h:79
TProfile * getTProfile(void) const
double y0() const
y coordinate
Definition: BeamSpot.h:66
unsigned int nthBSTrk_
Definition: BeamMonitor.h:95
unsigned int min_Ntrks_
Definition: BeamMonitor.h:99
void setRefTime(time_t t0, time_t t1)
Definition: BeamFitter.h:57
bool resetHistos_
Definition: BeamMonitor.h:105
std::time_t tmpTime
Definition: BeamMonitor.h:169
int firstAverageFit_
Definition: BeamMonitor.h:107
BeamFitter * theBeamFitter
Definition: BeamMonitor.h:83
void setAxisTitle(const std::string &title, int axis=1)
set x-, y- or z-axis title (axis=1, 2, 3 respectively)
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:138
std::pair< int, int > getFitLSRange()
Definition: BeamFitter.h:117
void Reset(void)
reset ME (ie. contents, errors, etc)
int beginLumiOfBSFit_
Definition: BeamMonitor.h:87
std::string monitorName_
Definition: BeamMonitor.h:67
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:147
MonitorElement * h_d0_phi0
Definition: BeamMonitor.h:122
reco::BeamSpot getBeamSpot()
Definition: BeamFitter.h:94
MonitorElement * h_vx_vy
Definition: BeamMonitor.h:124
int countLumi_
Definition: BeamMonitor.h:86
void scrollTH1(TH1 *, std::time_t)
BeamType type() const
return beam type
Definition: BeamSpot.h:129
MonitorElement * reportSummaryMap
Definition: BeamMonitor.h:164
bool onlineMode_
Definition: BeamMonitor.h:79
double x0() const
x coordinate
Definition: BeamSpot.h:64
std::map< TString, MonitorElement * > hs
Definition: BeamMonitor.h:144
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:154
const char * BeamMonitor::formatFitTime ( const std::time_t &  )
private

Definition at line 44 of file BeamMonitor.cc.

References b, CEST, plotBeamSpotDB::ptm, and create_public_lumi_plots::year.

Referenced by beginRun(), and scrollTH1().

44  {
45 #define CET (+1)
46 #define CEST (+2)
47 
48  static char ts[] = "yyyy-Mm-dd hh:mm:ss";
49  tm * ptm;
50  ptm = gmtime ( &t );
51  int year = ptm->tm_year;
52  //check if year is ok
53  if (year <= 37) year += 2000;
54  if (year >= 70 && year <= 137) year += 1900;
55 
56  if (year < 1995){
57  edm::LogError("BadTimeStamp") << "year reported is " << year <<" !!"<<std::endl;
58  year = 2015; //overwritten later by BeamFitter.cc for fits but needed here for TH1
59  edm::LogError("BadTimeStamp") << "Resetting to " <<year<<std::endl;
60  }
61  sprintf( ts, "%4d-%02d-%02d %02d:%02d:%02d", year,ptm->tm_mon+1,ptm->tm_mday,(ptm->tm_hour+CEST)%24, ptm->tm_min, ptm->tm_sec);
62 
63 #ifdef STRIP_TRAILING_BLANKS_IN_TIMEZONE
64  unsigned int b = strlen(ts);
65  while (ts[--b] == ' ') {ts[b] = 0;}
66 #endif
67  return ts;
68 
69 }
#define CEST
double b
Definition: hdecay.h:120
void BeamMonitor::RestartFitting ( )
private

Definition at line 1322 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, MonitorElement::Reset(), BeamFitter::resetCutFlow(), resetHistos_, BeamFitter::resetLSRange(), BeamFitter::resetPVFitter(), BeamFitter::resetRefTime(), BeamFitter::resetTrkVector(), StartAverage_, and theBeamFitter.

1322  {
1323  if(debug_)edm::LogInfo("BeamMonitor") << " RestartingFitting:: Restart Beami everything to a fresh start !!! because Gap is > 10 LS" <<endl;
1324  //track based fit reset here
1325  resetHistos_ = true;
1326  nthBSTrk_ = 0;
1332  beginLumiOfBSFit_ = 0;
1333  refBStime[0] = 0;
1334  //pv based fit iis reset here
1335  h_PVx[0]->Reset();
1336  h_PVy[0]->Reset();
1337  h_PVz[0]->Reset();
1338  beginLumiOfPVFit_ = 0;
1339  refPVtime[0] = 0;
1340  //Clear all the Maps here
1341  mapPVx.clear();
1342  mapPVy.clear();
1343  mapPVz.clear();
1344  mapNPV.clear();
1345  mapBeginBSLS.clear();
1346  mapBeginPVLS.clear();
1347  mapBeginBSTime.clear();
1348  mapBeginPVTime.clear();
1349  mapLSBSTrkSize.clear();
1350  mapLSPVStoreSize.clear();
1351  mapLSCF.clear(); countGapLumi_=0; countLumi_=0; StartAverage_=false;
1352 
1353 }
std::time_t refBStime[2]
Definition: BeamMonitor.h:93
MonitorElement * h_PVz[2]
Definition: BeamMonitor.h:140
std::map< int, std::vector< float > > mapPVx
Definition: BeamMonitor.h:147
void resetTrkVector()
Definition: BeamFitter.h:53
std::map< int, std::size_t > mapLSBSTrkSize
Definition: BeamMonitor.h:153
std::map< int, std::vector< float > > mapPVz
Definition: BeamMonitor.h:147
std::map< int, std::time_t > mapBeginPVTime
Definition: BeamMonitor.h:151
std::map< int, std::vector< int > > mapNPV
Definition: BeamMonitor.h:148
std::map< int, std::time_t > mapBeginBSTime
Definition: BeamMonitor.h:151
int countGapLumi_
Definition: BeamMonitor.h:108
std::time_t refPVtime[2]
Definition: BeamMonitor.h:94
void resetLSRange()
Definition: BeamFitter.h:55
std::map< int, TH1F > mapLSCF
Definition: BeamMonitor.h:156
bool StartAverage_
Definition: BeamMonitor.h:106
MonitorElement * h_PVy[2]
Definition: BeamMonitor.h:139
int beginLumiOfPVFit_
Definition: BeamMonitor.h:89
std::map< int, int > mapBeginBSLS
Definition: BeamMonitor.h:150
void resetPVFitter()
Definition: BeamFitter.h:69
void resetCutFlow()
Definition: BeamFitter.h:105
unsigned int nthBSTrk_
Definition: BeamMonitor.h:95
bool resetHistos_
Definition: BeamMonitor.h:105
BeamFitter * theBeamFitter
Definition: BeamMonitor.h:83
MonitorElement * h_PVx[2]
Definition: BeamMonitor.h:138
void Reset(void)
reset ME (ie. contents, errors, etc)
std::map< int, int > mapBeginPVLS
Definition: BeamMonitor.h:150
int beginLumiOfBSFit_
Definition: BeamMonitor.h:87
std::map< int, std::vector< float > > mapPVy
Definition: BeamMonitor.h:147
int countLumi_
Definition: BeamMonitor.h:86
std::map< int, size_t > mapLSPVStoreSize
Definition: BeamMonitor.h:154
void resetRefTime()
Definition: BeamFitter.h:56
void BeamMonitor::scrollTH1 ( TH1 *  ,
std::time_t   
)
private

Definition at line 1382 of file BeamMonitor.cc.

References newFWLiteAna::bin, buffTime, pyrootRender::da, formatFitTime(), and lastNZbin.

Referenced by FitAndFill().

1382  {
1383  const char* offsetTime = formatFitTime(ref);
1384  TDatime da(offsetTime);
1385  if (lastNZbin > 0) {
1386  double val = h->GetBinContent(lastNZbin);
1387  double valErr = h->GetBinError(lastNZbin);
1388  h->Reset();
1389  h->GetXaxis()->SetTimeOffset(da.Convert(kTRUE));
1390  int bin = (lastNZbin > buffTime ? buffTime : 1);
1391  h->SetBinContent(bin,val);
1392  h->SetBinError(bin,valErr);
1393  }
1394  else {
1395  h->Reset();
1396  h->GetXaxis()->SetTimeOffset(da.Convert(kTRUE));
1397  }
1398 }
const char * formatFitTime(const std::time_t &)
Definition: BeamMonitor.cc:44
#define buffTime
Definition: BeamMonitor.cc:71
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 1402 of file BeamMonitor.cc.

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

Referenced by FitAndFill().

1402  {
1403  bool scroll_ = false;
1404  if (tmpTime_ - refTime_ >= intervalInSec_) {
1405  scroll_ = true;
1406  edm::LogInfo("BeamMonitor") << "testScroll:: Reset Time Offset" << std::endl;
1408  for (int bin = intervalInSec_; bin >= 1; bin--) {
1409  if (hs["x0_time"]->getBinContent(bin) > 0) {
1410  lastNZbin = bin;
1411  break;
1412  }
1413  }
1414  edm::LogInfo("BeamMonitor") << "testScroll:: Last non zero bin = " << lastNZbin << std::endl;
1415  if (tmpTime_ - refTime_ >= intervalInSec_ + lastNZbin) {
1416  edm::LogInfo("BeamMonitor") << "testScroll:: Time difference too large since last readout" << std::endl;
1417  lastNZbin = 0;
1418  refTime_ = tmpTime_ - buffTime;
1419  }
1420  else{
1421  edm::LogInfo("BeamMonitor") << "testScroll:: Offset to last record" << std::endl;
1422  int offset = ((lastNZbin > buffTime) ? (lastNZbin - buffTime) : (lastNZbin - 1));
1423  refTime_ += offset;
1424  }
1425  }
1426  return scroll_;
1427 }
#define buffTime
Definition: BeamMonitor.cc:71
int intervalInSec_
Definition: BeamMonitor.h:77
std::map< TString, MonitorElement * > hs
Definition: BeamMonitor.h:144

Member Data Documentation

int BeamMonitor::beginLumiOfBSFit_
private

Definition at line 87 of file BeamMonitor.h.

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

int BeamMonitor::beginLumiOfPVFit_
private

Definition at line 89 of file BeamMonitor.h.

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

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

Definition at line 68 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

int BeamMonitor::countEvt_
private

Definition at line 85 of file BeamMonitor.h.

Referenced by analyze().

int BeamMonitor::countGapLumi_
private

Definition at line 108 of file BeamMonitor.h.

Referenced by RestartFitting().

int BeamMonitor::countLumi_
private

Definition at line 86 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::cutFlowTable
private

Definition at line 165 of file BeamMonitor.h.

Referenced by analyze(), and beginJob().

DQMStore* BeamMonitor::dbe_
private

Definition at line 82 of file BeamMonitor.h.

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

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

Definition at line 98 of file BeamMonitor.h.

Referenced by BeamMonitor().

int BeamMonitor::endLumiOfBSFit_
private

Definition at line 88 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

int BeamMonitor::endLumiOfPVFit_
private

Definition at line 90 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

int BeamMonitor::firstAverageFit_
private

Definition at line 107 of file BeamMonitor.h.

Referenced by FitAndFill().

int BeamMonitor::fitNLumi_
private

Definition at line 73 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

int BeamMonitor::fitPVNLumi_
private

Definition at line 74 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

MonitorElement* BeamMonitor::fitResults
private

Definition at line 129 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

int BeamMonitor::frun
private

Definition at line 174 of file BeamMonitor.h.

Referenced by beginRun(), and FitAndFill().

edm::TimeValue_t BeamMonitor::ftimestamp
private

Definition at line 172 of file BeamMonitor.h.

Referenced by beginRun().

MonitorElement* BeamMonitor::h_d0_phi0
private

Definition at line 122 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_nTrk_lumi
private

Definition at line 119 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_nVtx
private

Definition at line 136 of file BeamMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* BeamMonitor::h_nVtx_lumi
private

Definition at line 120 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_nVtx_lumi_all
private

Definition at line 121 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_nVtx_st
private

Definition at line 137 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::h_PVx[2]
private

Definition at line 138 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::h_PVxz
private

Definition at line 141 of file BeamMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* BeamMonitor::h_PVy[2]
private

Definition at line 139 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::h_PVyz
private

Definition at line 142 of file BeamMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* BeamMonitor::h_PVz[2]
private

Definition at line 140 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::h_sigmaX0
private

Definition at line 133 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_sigmaY0
private

Definition at line 134 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_sigmaZ0
private

Definition at line 135 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_trk_z0
private

Definition at line 123 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_trkPt
private

Definition at line 127 of file BeamMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* BeamMonitor::h_trkVz
private

Definition at line 128 of file BeamMonitor.h.

Referenced by analyze(), and beginJob().

MonitorElement* BeamMonitor::h_vx_dz
private

Definition at line 125 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_vx_vy
private

Definition at line 124 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_vy_dz
private

Definition at line 126 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_x0
private

Definition at line 130 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_y0
private

Definition at line 131 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::h_z0
private

Definition at line 132 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

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

Definition at line 71 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

std::map<TString, MonitorElement*> BeamMonitor::hs
private

Definition at line 144 of file BeamMonitor.h.

Referenced by beginJob(), beginRun(), FitAndFill(), and testScroll().

int BeamMonitor::intervalInSec_
private

Definition at line 77 of file BeamMonitor.h.

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

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

Definition at line 80 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

int BeamMonitor::lastlumi_
private

Definition at line 91 of file BeamMonitor.h.

Referenced by BeamMonitor(), and beginLuminosityBlock().

int BeamMonitor::lastNZbin
private

Definition at line 175 of file BeamMonitor.h.

Referenced by scrollTH1(), and testScroll().

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

Definition at line 150 of file BeamMonitor.h.

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

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

Definition at line 151 of file BeamMonitor.h.

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

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

Definition at line 150 of file BeamMonitor.h.

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

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

Definition at line 151 of file BeamMonitor.h.

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

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

Definition at line 153 of file BeamMonitor.h.

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

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

Definition at line 156 of file BeamMonitor.h.

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

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

Definition at line 154 of file BeamMonitor.h.

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

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

Definition at line 148 of file BeamMonitor.h.

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

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

Definition at line 147 of file BeamMonitor.h.

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

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

Definition at line 147 of file BeamMonitor.h.

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

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

Definition at line 147 of file BeamMonitor.h.

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

double BeamMonitor::maxZ_
private

Definition at line 100 of file BeamMonitor.h.

Referenced by BeamMonitor().

unsigned int BeamMonitor::min_Ntrks_
private

Definition at line 99 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

unsigned int BeamMonitor::minNrVertices_
private

Definition at line 101 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

double BeamMonitor::minVtxNdf_
private

Definition at line 102 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

double BeamMonitor::minVtxWgt_
private

Definition at line 103 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

std::string BeamMonitor::monitorName_
private

Definition at line 67 of file BeamMonitor.h.

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

int BeamMonitor::nextlumi_
private

Definition at line 92 of file BeamMonitor.h.

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

int BeamMonitor::nFitElements_
private

Definition at line 96 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

int BeamMonitor::nFits_
private

Definition at line 97 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

unsigned int BeamMonitor::nthBSTrk_
private

Definition at line 95 of file BeamMonitor.h.

Referenced by FitAndFill(), and RestartFitting().

bool BeamMonitor::onlineMode_
private
edm::ParameterSet BeamMonitor::parameters_
private
reco::BeamSpot BeamMonitor::preBS
private

Definition at line 116 of file BeamMonitor.h.

Referenced by FitAndFill().

bool BeamMonitor::processed_
private

Definition at line 110 of file BeamMonitor.h.

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

MonitorElement* BeamMonitor::pvResults
private

Definition at line 143 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

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

Definition at line 70 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().

reco::BeamSpot BeamMonitor::refBS
private

Definition at line 115 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 171 of file BeamMonitor.h.

Referenced by beginRun(), and FitAndFill().

MonitorElement* BeamMonitor::reportSummary
private

Definition at line 162 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

Float_t BeamMonitor::reportSummary_
private

Definition at line 159 of file BeamMonitor.h.

Referenced by FitAndFill().

MonitorElement* BeamMonitor::reportSummaryContents[3]
private

Definition at line 163 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

MonitorElement* BeamMonitor::reportSummaryMap
private

Definition at line 164 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

int BeamMonitor::resetFitNLumi_
private

Definition at line 75 of file BeamMonitor.h.

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

bool BeamMonitor::resetHistos_
private

Definition at line 105 of file BeamMonitor.h.

Referenced by FitAndFill(), and RestartFitting().

int BeamMonitor::resetPVNLumi_
private

Definition at line 76 of file BeamMonitor.h.

Referenced by BeamMonitor(), and FitAndFill().

bool BeamMonitor::StartAverage_
private

Definition at line 106 of file BeamMonitor.h.

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

std::time_t BeamMonitor::startTime
private

Definition at line 170 of file BeamMonitor.h.

Referenced by beginRun(), and FitAndFill().

Float_t BeamMonitor::summaryContent_[3]
private

Definition at line 161 of file BeamMonitor.h.

Referenced by beginJob(), and FitAndFill().

Float_t BeamMonitor::summarySum_
private

Definition at line 160 of file BeamMonitor.h.

Referenced by FitAndFill().

BeamFitter* BeamMonitor::theBeamFitter
private

Definition at line 83 of file BeamMonitor.h.

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

std::time_t BeamMonitor::tmpTime
private

Definition at line 169 of file BeamMonitor.h.

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

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

Definition at line 69 of file BeamMonitor.h.

Referenced by analyze(), and BeamMonitor().