CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_2_9/src/DQM/HLTEvF/interface/FourVectorHLT.h

Go to the documentation of this file.
00001 #ifndef FOURVECTORHLT_H
00002 #define FOURVECTORHLT_H
00003 // -*- C++ -*-
00004 //
00005 // Package:    FourVectorHLT
00006 // Class:      FourVectorHLT
00007 // 
00016 //
00017 // Original Author:  Peter Wittich
00018 //         Created:  May 2008
00019 // $Id: FourVectorHLT.h,v 1.6 2009/10/15 11:31:28 fwyzard Exp $
00020 //
00021 //
00022 
00023 
00024 // system include files
00025 #include <memory>
00026 #include <unistd.h>
00027 
00028 
00029 // user include files
00030 #include "FWCore/Framework/interface/Frameworkfwd.h"
00031 #include "FWCore/Framework/interface/EDAnalyzer.h"
00032 
00033 #include "FWCore/Framework/interface/Event.h"
00034 #include "FWCore/Framework/interface/MakerMacros.h"
00035 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00036 
00037 #include "DQMServices/Core/interface/DQMStore.h"
00038 #include "DQMServices/Core/interface/MonitorElement.h"
00039 #include "FWCore/ServiceRegistry/interface/Service.h"
00040 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00041 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00042 #include <iostream>
00043 #include <fstream>
00044 #include <vector>
00045 
00046 //
00047 // class decleration
00048 //
00049 
00050 class FourVectorHLT : public edm::EDAnalyzer {
00051    public:
00052       explicit FourVectorHLT(const edm::ParameterSet&);
00053       ~FourVectorHLT();
00054 
00055 
00056    private:
00057       virtual void beginJob() ;
00058       virtual void analyze(const edm::Event&, const edm::EventSetup&);
00059       virtual void endJob() ;
00060 
00061       // BeginRun
00062       void beginRun(const edm::Run& run, const edm::EventSetup& c);
00063 
00064       // EndRun
00065       void endRun(const edm::Run& run, const edm::EventSetup& c);
00066 
00067 
00068       // ----------member data --------------------------- 
00069       int nev_;
00070       DQMStore * dbe_;
00071 
00072       MonitorElement* total_;
00073 
00074       bool plotAll_;
00075       bool resetMe_;
00076       int currentRun_;
00077  
00078       unsigned int nBins_; 
00079       double ptMin_ ;
00080       double ptMax_ ;
00081       
00082       std::string dirname_;
00083       bool monitorDaemon_;
00084       int theHLTOutputType;
00085       edm::InputTag triggerSummaryLabel_;
00086       edm::InputTag triggerResultLabel_;
00087 
00088       // helper class to store the data
00089       class PathInfo {
00090         PathInfo():
00091           pathIndex_(-1), pathName_("unset"), objectType_(-1)
00092           {};
00093       public:
00094         void setHistos(MonitorElement* const et, MonitorElement* const eta, 
00095                        MonitorElement* const phi, 
00096                        MonitorElement* const etavsphi ) {
00097           et_ = et;
00098           eta_ = eta;
00099           phi_ = phi;
00100           etavsphi_ = etavsphi;
00101         }
00102         MonitorElement * getEtHisto() {
00103           return et_;
00104         }
00105         MonitorElement * getEtaHisto() {
00106           return eta_;
00107         }
00108         MonitorElement * getPhiHisto() {
00109           return phi_;
00110         }
00111         MonitorElement * getEtaVsPhiHisto() {
00112           return etavsphi_;
00113         }
00114         const std::string getName(void ) const {
00115           return pathName_;
00116         }
00117         ~PathInfo() {};
00118         PathInfo(std::string pathName, size_t type, float ptmin, 
00119                  float ptmax):
00120           pathName_(pathName), objectType_(type),
00121           et_(0), eta_(0), phi_(0), etavsphi_(0),
00122           ptmin_(ptmin), ptmax_(ptmax)
00123           {
00124           };
00125           PathInfo(std::string pathName, size_t type,
00126                    MonitorElement *et,
00127                    MonitorElement *eta,
00128                    MonitorElement *phi,
00129                    MonitorElement *etavsphi,
00130                    float ptmin, float ptmax
00131                    ):
00132             pathName_(pathName), objectType_(type),
00133             et_(et), eta_(eta), phi_(phi), etavsphi_(etavsphi),
00134             ptmin_(ptmin), ptmax_(ptmax)
00135             {};
00136             bool operator==(const std::string v) 
00137             {
00138               return v==pathName_;
00139             }
00140       private:
00141           int pathIndex_;
00142           std::string pathName_;
00143           int objectType_;
00144 
00145           // we don't own this data
00146           MonitorElement *et_, *eta_, *phi_, *etavsphi_;
00147 
00148           float ptmin_, ptmax_;
00149 
00150           const int index() { 
00151             return pathIndex_;
00152           }
00153           const int type() { 
00154             return objectType_;
00155           }
00156       public:
00157           float getPtMin() const { return ptmin_; }
00158           float getPtMax() const { return ptmax_; }
00159       };
00160 
00161       // simple collection - just 
00162       class PathInfoCollection: public std::vector<PathInfo> {
00163       public:
00164         PathInfoCollection(): std::vector<PathInfo>() 
00165           {};
00166           std::vector<PathInfo>::iterator find(std::string pathName) {
00167             return std::find(begin(), end(), pathName);
00168           }
00169       };
00170       PathInfoCollection hltPaths_;
00171 
00172 
00173 };
00174 #endif