CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_10_patch1/src/DQM/BeamMonitor/plugins/BeamMonitorBx.h

Go to the documentation of this file.
00001 #ifndef BeamMonitorBx_H
00002 #define BeamMonitorBx_H
00003 
00012 // C++
00013 #include <string>
00014 // CMS
00015 #include "FWCore/Framework/interface/Frameworkfwd.h"
00016 #include "FWCore/Framework/interface/EDAnalyzer.h"
00017 #include "FWCore/Framework/interface/Event.h"
00018 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00019 #include "DQMServices/Core/interface/DQMStore.h"
00020 #include "DQMServices/Core/interface/MonitorElement.h"
00021 #include "RecoVertex/BeamSpotProducer/interface/BeamFitter.h"
00022 #include <fstream>
00023 
00024 
00025 //
00026 // class declaration
00027 //
00028 
00029 class BeamMonitorBx : public edm::EDAnalyzer {
00030  public:
00031   BeamMonitorBx( const edm::ParameterSet& );
00032   ~BeamMonitorBx();
00033 
00034   typedef int BxNum;
00035   typedef std::map<BxNum,reco::BeamSpot> BeamSpotMapBx;
00036 
00037  protected:
00038    
00039   // BeginJob
00040   void beginJob();
00041 
00042   // BeginRun
00043   void beginRun(const edm::Run& r, const edm::EventSetup& c);
00044   
00045   void analyze(const edm::Event& e, const edm::EventSetup& c) ;
00046   
00047   void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00048                             const edm::EventSetup& context) ;
00049   
00050   void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, 
00051                           const edm::EventSetup& c);
00052   // EndRun
00053   void endRun(const edm::Run& r, const edm::EventSetup& c);
00054   // Endjob
00055   void endJob(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c);
00056   
00057  private:
00058 
00059   void FitAndFill(const edm::LuminosityBlock& lumiSeg, int&, int&, int&);
00060   void BookTables(int, std::map<std::string,std::string>&,std::string);
00061   void BookTrendHistos(bool, int, std::map<std::string,std::string>&, 
00062                        std::string, TString, TString);
00063   void FillTables(int, int, std::map<std::string,std::string>&,
00064                   reco::BeamSpot&, std::string);
00065   void FillTrendHistos(int, int, std::map<std::string,std::string>&,
00066                        reco::BeamSpot&, TString);
00067   void weight(BeamSpotMapBx&, const BeamSpotMapBx&);
00068   void weight(double& mean,double& meanError,const double& val,const double& valError);
00069   const char * formatFitTime( const std::time_t&);
00070 
00071   edm::ParameterSet parameters_;
00072   std::string monitorName_;
00073   edm::InputTag bsSrc_; // beam spot
00074 
00075   int fitNLumi_;
00076   int resetFitNLumi_;
00077   bool debug_;
00078   
00079   DQMStore* dbe_;
00080   BeamFitter * theBeamFitter;
00081   
00082   unsigned int countBx_;
00083   int countEvt_;       //counter
00084   int countLumi_;      //counter
00085   int beginLumiOfBSFit_;
00086   int endLumiOfBSFit_;
00087   int lastlumi_; // previous LS processed
00088   int nextlumi_; // next LS of Fit
00089   int firstlumi_; // first LS with good fit
00090   int countGoodFit_;
00091   std::time_t refBStime[2];
00092 
00093   bool resetHistos_;
00094   bool processed_;
00095   // ----------member data ---------------------------
00096   BeamSpotMapBx fbspotMap;//for weighted beam spots of each bunch
00097   std::map<std::string, std::string> varMap;
00098   std::map<std::string, std::string> varMap1;
00099   // MonitorElements:
00100   std::map<TString, MonitorElement*> hs; // Tables
00101   std::map<TString, MonitorElement*> hst; // Trending Histos
00102 
00103   //Test
00104   //  MonitorElement * h_x0;
00105 
00106   //
00107   std::time_t tmpTime;
00108   std::time_t refTime;
00109   std::time_t startTime;
00110   edm::TimeValue_t ftimestamp;
00111 
00112 };
00113 
00114 #endif
00115