CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_9_patch3/src/DQM/BeamMonitor/plugins/BeamMonitor.h

Go to the documentation of this file.
00001 #ifndef BeamMonitor_H
00002 #define BeamMonitor_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/BSTrkParameters.h"
00022 #include "RecoVertex/BeamSpotProducer/interface/BeamFitter.h"
00023 #include <fstream>
00024 
00025 
00026 //
00027 // class declaration
00028 //
00029 
00030 class BeamMonitor : public edm::EDAnalyzer {
00031   public:
00032 
00033     BeamMonitor( const edm::ParameterSet& );
00034     ~BeamMonitor();
00035 
00036   protected:
00037 
00038     // BeginJob
00039     void beginJob();
00040 
00041     // BeginRun
00042     void beginRun(const edm::Run& r, const edm::EventSetup& c);
00043 
00044     void analyze(const edm::Event& e, const edm::EventSetup& c) ;
00045 
00046     void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00047         const edm::EventSetup& context) ;
00048 
00049     void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg,
00050         const edm::EventSetup& c);
00051     // EndRun
00052     void endRun(const edm::Run& r, const edm::EventSetup& c);
00053     // Endjob
00054     void endJob(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c);
00055 
00056   private:
00057 
00058     void FitAndFill(const edm::LuminosityBlock& lumiSeg,int&,int&,int&);
00059     void RestartFitting();
00060     void scrollTH1(TH1 *, std::time_t);
00061     bool testScroll(std::time_t &, std::time_t &);
00062     const char * formatFitTime( const std::time_t &);
00063     edm::ParameterSet parameters_;
00064     std::string monitorName_;
00065     edm::InputTag bsSrc_; // beam spot
00066     edm::InputTag tracksLabel_;
00067     edm::InputTag pvSrc_; // primary vertex
00068     edm::InputTag hltSrc_;//hlt collection
00069 
00070     int fitNLumi_;
00071     int fitPVNLumi_;
00072     int resetFitNLumi_;
00073     int resetPVNLumi_;
00074     int intervalInSec_;
00075     bool debug_;
00076     bool onlineMode_;
00077     std::vector<std::string> jetTrigger_;
00078 
00079     DQMStore* dbe_;
00080     BeamFitter * theBeamFitter;
00081 
00082     int countEvt_;       //counter
00083     int countLumi_;      //counter
00084     int beginLumiOfBSFit_;
00085     int endLumiOfBSFit_;
00086     int beginLumiOfPVFit_;
00087     int endLumiOfPVFit_;
00088     int lastlumi_; // previous LS processed
00089     int nextlumi_; // next LS of Fit
00090     std::time_t refBStime[2];
00091     std::time_t refPVtime[2];
00092     unsigned int nthBSTrk_;
00093     int nFitElements_;
00094     int nFits_;
00095     double deltaSigCut_;
00096     unsigned int min_Ntrks_;
00097     double maxZ_;
00098     unsigned int minNrVertices_;
00099     double minVtxNdf_;
00100     double minVtxWgt_;
00101 
00102     bool resetHistos_;
00103     bool StartAverage_;
00104     int firstAverageFit_;
00105     int countGapLumi_;
00106 
00107     bool processed_;
00108    
00109     // ----------member data ---------------------------
00110 
00111     //   std::vector<BSTrkParameters> fBSvector;
00112     reco::BeamSpot refBS;
00113     reco::BeamSpot preBS;
00114 
00115     // MonitorElements:
00116     MonitorElement * h_nTrk_lumi;
00117     MonitorElement * h_d0_phi0;
00118     MonitorElement * h_trk_z0;
00119     MonitorElement * h_vx_vy;
00120     MonitorElement * h_vx_dz;
00121     MonitorElement * h_vy_dz;
00122     MonitorElement * h_trkPt;
00123     MonitorElement * h_trkVz;
00124     MonitorElement * fitResults;
00125     MonitorElement * h_x0;
00126     MonitorElement * h_y0;
00127     MonitorElement * h_z0;
00128     MonitorElement * h_sigmaX0;
00129     MonitorElement * h_sigmaY0;
00130     MonitorElement * h_sigmaZ0;
00131     MonitorElement * h_nVtx;
00132     MonitorElement * h_nVtx_st;
00133     MonitorElement * h_PVx[2];
00134     MonitorElement * h_PVy[2];
00135     MonitorElement * h_PVz[2];
00136     MonitorElement * h_PVxz;
00137     MonitorElement * h_PVyz;
00138     MonitorElement * pvResults;
00139     std::map<TString, MonitorElement*> hs;
00140 
00141     // The histo of the primary vertex for  DQM gui
00142     std::map<int, std::vector<float> > mapPVx,mapPVy,mapPVz;
00143     std::map<int, std::vector<int> > mapNPV;
00144     //keep track of beginLuminosity block and time
00145     std::map<int, int> mapBeginBSLS,mapBeginPVLS;
00146     std::map<int, std::time_t> mapBeginBSTime, mapBeginPVTime;
00147     //these maps are needed to keep track of size of theBSvector and pvStore
00148     std::map<int, std::size_t> mapLSBSTrkSize;
00149     std::map<int, size_t>mapLSPVStoreSize;
00150     //to correct the cutFlot Table
00151     std::map<int, TH1F> mapLSCF;
00152 
00153     // Summary:
00154     Float_t reportSummary_;
00155     Float_t summarySum_;
00156     Float_t summaryContent_[3];
00157     MonitorElement * reportSummary;
00158     MonitorElement * reportSummaryContents[3];
00159     MonitorElement * reportSummaryMap;
00160     MonitorElement * cutFlowTable;
00161     // variables for beam fit
00162 
00163     //
00164     std::time_t tmpTime;
00165     std::time_t startTime;
00166     std::time_t refTime;
00167     edm::TimeValue_t ftimestamp;
00168     // Current run
00169     int frun;
00170     int lastNZbin; // last non zero bin of time histos
00171 };
00172 
00173 #endif
00174