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 &)
 
void formatFitTime (char *, 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 73 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_.

73  :
75 
76  parameters_ = ps;
77  monitorName_ = parameters_.getUntrackedParameter<string>("monitorName","YourSubsystemName");
78  bsSrc_ = consumes<reco::BeamSpot>(
80  tracksLabel_ = consumes<reco::TrackCollection>(
82  .getUntrackedParameter<InputTag>("TrackCollection"));
83  pvSrc_ = consumes<reco::VertexCollection>(
84  parameters_.getUntrackedParameter<InputTag>("primaryVertex"));
85  hltSrc_ = consumes<TriggerResults>(
86  parameters_.getParameter<InputTag>("hltResults"));
87  intervalInSec_ = parameters_.getUntrackedParameter<int>("timeInterval",920);//40 LS X 23"
88  fitNLumi_ = parameters_.getUntrackedParameter<int>("fitEveryNLumi",-1);
89  resetFitNLumi_ = parameters_.getUntrackedParameter<int>("resetEveryNLumi",-1);
90  fitPVNLumi_ = parameters_.getUntrackedParameter<int>("fitPVEveryNLumi",-1);
91  resetPVNLumi_ = parameters_.getUntrackedParameter<int>("resetPVEveryNLumi",-1);
92  deltaSigCut_ = parameters_.getUntrackedParameter<double>("deltaSignificanceCut",15);
93  debug_ = parameters_.getUntrackedParameter<bool>("Debug");
94  onlineMode_ = parameters_.getUntrackedParameter<bool>("OnlineMode");
95  jetTrigger_ = parameters_.getUntrackedParameter<std::vector<std::string> >("jetTrigger");
96  min_Ntrks_ = parameters_.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<int>("MinimumInputTracks");
97  maxZ_ = parameters_.getParameter<ParameterSet>("BeamFitter").getUntrackedParameter<double>("MaximumZ");
98  minNrVertices_ = parameters_.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<unsigned int>("minNrVerticesForFit");
99  minVtxNdf_ = parameters_.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexNdf");
100  minVtxWgt_ = parameters_.getParameter<ParameterSet>("PVFitter").getUntrackedParameter<double>("minVertexMeanWeight");
101 
103 
104  if (monitorName_ != "" ) monitorName_ = monitorName_+"/" ;
105 
111 
112  if (fitNLumi_ <= 0) fitNLumi_ = 1;
114  refBStime[0] = refBStime[1] = refPVtime[0] = refPVtime[1] = 0;
115  maxZ_ = std::fabs(maxZ_);
116  lastlumi_ = 0;
117  nextlumi_ = 0;
118  processed_ = false;
119 }
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 122 of file BeamMonitor.cc.

References theBeamFitter.

122  {
123  delete theBeamFitter;
124 }
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 558 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, tree::t, theBeamFitter, testEve_cfg::tracks, tracksLabel_, edm::TriggerNames::triggerIndex(), edm::TriggerNames::triggerName(), edm::Event::triggerNames(), triggerResults, and trigNames.

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

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

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

424  {
425 
426  frun = r.run();
427  ftimestamp = r.beginTime().value();
428  tmpTime = ftimestamp >> 32;
430  char eventTime[64];
431  formatFitTime(eventTime, tmpTime);
432  std::cout << "TimeOffset = " << eventTime << std::endl;
433  TDatime da(eventTime);
434  if (debug_) {
435  edm::LogInfo("BeamMonitor") << "TimeOffset = ";
436  da.Print();
437  }
438  for (std::map<TString,MonitorElement*>::iterator it = hs.begin();
439  it != hs.end(); ++it) {
440  if ((*it).first.Contains("time"))
441  (*it).second->getTH1()->GetXaxis()->SetTimeOffset(da.Convert(kTRUE));
442  }
443 }
RunNumber_t run() const
Definition: RunBase.h:42
edm::TimeValue_t ftimestamp
Definition: BeamMonitor.h:172
std::time_t refTime
Definition: BeamMonitor.h:171
void formatFitTime(char *, const std::time_t &)
Definition: BeamMonitor.cc:44
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 1375 of file BeamMonitor.cc.

References endLuminosityBlock(), and onlineMode_.

1376  {
1377  if (!onlineMode_) endLuminosityBlock(lumiSeg, iSetup);
1378 }
void endLuminosityBlock(const edm::LuminosityBlock &lumiSeg, const edm::EventSetup &c)
Definition: BeamMonitor.cc:696
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 696 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().

697  {
698  int nthlumi = lumiSeg.id().luminosityBlock();
699  edm::LogInfo("BeamMonitor") << "endLuminosityBlock:: Lumi of the last event before endLuminosityBlock: " << nthlumi << endl;
700 
701  if (onlineMode_ && nthlumi < nextlumi_) return;
702  const edm::TimeValue_t fendtimestamp = lumiSeg.endTime().value();
703  const std::time_t fendtime = fendtimestamp >> 32;
704  tmpTime = refBStime[1] = refPVtime[1] = fendtime;
705 }
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 1355 of file BeamMonitor.cc.

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

1355  {
1356 
1357 if(debug_)edm::LogInfo("BeamMonitor") << "endRun:: Clearing all the Maps "<<endl;
1358 //Clear all the Maps here
1359 mapPVx.clear();
1360 mapPVy.clear();
1361 mapPVz.clear();
1362 mapNPV.clear();
1363 mapBeginBSLS.clear();
1364 mapBeginPVLS.clear();
1365 mapBeginBSTime.clear();
1366 mapBeginPVTime.clear();
1367 mapLSBSTrkSize.clear();
1368 mapLSPVStoreSize.clear();
1369 mapLSCF.clear();
1370 
1371 
1372 }
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 708 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().

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

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

1321  {
1322  if(debug_)edm::LogInfo("BeamMonitor") << " RestartingFitting:: Restart Beami everything to a fresh start !!! because Gap is > 10 LS" <<endl;
1323  //track based fit reset here
1324  resetHistos_ = true;
1325  nthBSTrk_ = 0;
1331  beginLumiOfBSFit_ = 0;
1332  refBStime[0] = 0;
1333  //pv based fit iis reset here
1334  h_PVx[0]->Reset();
1335  h_PVy[0]->Reset();
1336  h_PVz[0]->Reset();
1337  beginLumiOfPVFit_ = 0;
1338  refPVtime[0] = 0;
1339  //Clear all the Maps here
1340  mapPVx.clear();
1341  mapPVy.clear();
1342  mapPVz.clear();
1343  mapNPV.clear();
1344  mapBeginBSLS.clear();
1345  mapBeginPVLS.clear();
1346  mapBeginBSTime.clear();
1347  mapBeginPVTime.clear();
1348  mapLSBSTrkSize.clear();
1349  mapLSPVStoreSize.clear();
1350  mapLSCF.clear(); countGapLumi_=0; countLumi_=0; StartAverage_=false;
1351 
1352 }
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 1381 of file BeamMonitor.cc.

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

Referenced by FitAndFill().

1381  {
1382  char offsetTime[64];
1383  formatFitTime(offsetTime, 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 }
#define buffTime
Definition: BeamMonitor.cc:68
void formatFitTime(char *, const std::time_t &)
Definition: BeamMonitor.cc:44
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:68
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().