CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_0/src/DQM/BeamMonitor/plugins/Vx3DHLTAnalyzer.h

Go to the documentation of this file.
00001 #ifndef Vx3DHLTAnalyzer_H
00002 #define Vx3DHLTAnalyzer_H
00003 
00004 // -*- C++ -*-
00005 //
00006 // Package:    Vx3DHLTAnalyzer
00007 // Class:      Vx3DHLTAnalyzer
00008 // 
00016 //
00017 // Original Author:  Mauro Dinardo,28 S-020,+41227673777,
00018 //         Created:  Tue Feb 23 13:15:31 CET 2010
00019 // $Id: Vx3DHLTAnalyzer.h,v 1.14 2010/10/14 23:05:23 wmtan Exp $
00020 //
00021 //
00022 
00023 
00024 // system include files
00025 #include <memory>
00026 
00027 // user include files
00028 #include "FWCore/Framework/interface/Frameworkfwd.h"
00029 #include "FWCore/Framework/interface/EDAnalyzer.h"
00030 #include "FWCore/Framework/interface/Event.h"
00031 #include "FWCore/Framework/interface/MakerMacros.h"
00032 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00033 #include "FWCore/Utilities/interface/InputTag.h"
00034 
00035 #include "DQMServices/Core/interface/DQMStore.h"
00036 #include "DQMServices/Core/interface/MonitorElement.h"
00037 
00038 #include <TF3.h>
00039 
00040 #include <iostream>
00041 #include <fstream>
00042 #include <vector>
00043 
00044 
00045 // #################
00046 // # Fit variables #
00047 // #################
00048 #define DIM 3
00049 void Gauss3DFunc(int& /*npar*/, double* /*gin*/, double& fval, double* par, int /*iflag*/);
00050 typedef struct
00051 {
00052   double x;
00053   double y;
00054   double z;
00055   double Covariance[DIM][DIM];
00056 } VertexType;
00057 std::vector<VertexType> Vertices;
00058 bool considerVxCovariance;
00059 unsigned int counterVx; // Counts the number of vertices taken into account for the fit
00060 double maxTransRadius;  // Max transverse radius in which the vertices must be [cm]
00061 double maxLongLength;   // Max longitudinal length in which the vertices must be [cm]
00062 double xPos,yPos,zPos;  // x,y,z approximate positions of the beam spot
00063 double pi;
00064 // ######################
00065 // # cfg file parameter #
00066 // ######################
00067 double VxErrCorr;       // Coefficient to compensate the under-estimation of the vertex errors
00068 
00069 
00070 class Vx3DHLTAnalyzer : public edm::EDAnalyzer {
00071    public:
00072       explicit Vx3DHLTAnalyzer(const edm::ParameterSet&);
00073       ~Vx3DHLTAnalyzer();
00074 
00075 
00076    private:
00077       virtual void beginJob();
00078       virtual void analyze(const edm::Event&, const edm::EventSetup&);
00079       virtual unsigned int HitCounter(const edm::Event& iEvent);
00080       virtual char* formatTime(const time_t& t);
00081       virtual int MyFit(std::vector<double>* vals);
00082       virtual void reset(std::string ResetType);
00083       virtual void writeToFile(std::vector<double>* vals,
00084                                edm::TimeValue_t BeginTimeOfFit,
00085                                edm::TimeValue_t EndTimeOfFit,
00086                                unsigned int BeginLumiOfFit,
00087                                unsigned int EndLumiOfFit,
00088                                int dataType);
00089       virtual void beginLuminosityBlock(const edm::LuminosityBlock& lumiBlock, 
00090                                         const edm::EventSetup& iSetup);
00091       virtual void endLuminosityBlock(const edm::LuminosityBlock& lumiBlock,
00092                                       const edm::EventSetup& iSetup);
00093       virtual void endJob();
00094 
00095 
00096       // #######################
00097       // # cfg file parameters #
00098       // #######################
00099       edm::InputTag vertexCollection;
00100       bool debugMode;
00101       unsigned int nLumiReset;
00102       bool dataFromFit;
00103       unsigned int minNentries;
00104       double xRange;
00105       double xStep;
00106       double yRange;
00107       double yStep;
00108       double zRange;
00109       double zStep;
00110       std::string fileName;
00111 
00112 
00113       // ##############
00114       // # Histograms #
00115       // ##############
00116       MonitorElement* mXlumi;
00117       MonitorElement* mYlumi;
00118       MonitorElement* mZlumi;
00119       
00120       MonitorElement* sXlumi;
00121       MonitorElement* sYlumi;
00122       MonitorElement* sZlumi;
00123       
00124       MonitorElement* dxdzlumi;
00125       MonitorElement* dydzlumi;
00126 
00127       MonitorElement* Vx_X;
00128       MonitorElement* Vx_Y;
00129       MonitorElement* Vx_Z;
00130       
00131       MonitorElement* Vx_ZX;
00132       MonitorElement* Vx_ZY;
00133       MonitorElement* Vx_XY;
00134       
00135       MonitorElement* goodVxCounter;
00136       MonitorElement* goodVxCountHistory;
00137 
00138       MonitorElement* hitCounter;
00139       MonitorElement* hitCountHistory;
00140 
00141       MonitorElement* reportSummary;
00142       MonitorElement* reportSummaryMap;
00143       
00144       MonitorElement* fitResults;
00145 
00146       // ######################
00147       // # Internal variables #
00148       // ######################
00149       ofstream outputFile;
00150       ofstream outputDebugFile;
00151       edm::TimeValue_t beginTimeOfFit;
00152       edm::TimeValue_t endTimeOfFit;
00153       unsigned int nBinsHistoricalPlot;
00154       unsigned int nBinsWholeHistory;
00155       unsigned int runNumber;
00156       unsigned int lumiCounter;
00157       unsigned int lumiCounterHisto;
00158       unsigned int totalHits;
00159       unsigned int maxLumiIntegration;
00160       unsigned int prescaleHistory;
00161       unsigned int numberGoodFits;
00162       unsigned int numberFits;
00163       unsigned int beginLumiOfFit;
00164       unsigned int endLumiOfFit;
00165       unsigned int lastLumiOfFit;
00166       double minVxDoF;
00167       bool internalDebug;
00168 };
00169 
00170 #endif