CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_5_3_3/src/DQMOffline/Trigger/interface/TopElectronHLTOfflineSource.h

Go to the documentation of this file.
00001 #ifndef DQMOFFLINE_TRIGGER_TOPELECTRONHLTOFFLINESOURCE
00002 #define DQMOFFLINE_TRIGGER_TOPELECTRONHLTOFFLINESOURCE
00003 
00004 
00005 // Original Author:  Sarah Boutle
00006 //         Created:  Jan 2010
00007 
00008 //#include "DataFormats/HLTReco/interface/TriggerEvent.h"
00009 #include "DataFormats/EgammaCandidates/interface/GsfElectronFwd.h"
00010 
00011 #include "FWCore/Framework/interface/Frameworkfwd.h"
00012 #include "FWCore/Framework/interface/EDAnalyzer.h"
00013 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00014 #include "FWCore/Framework/interface/Event.h"
00015 
00016 #include "DQMServices/Core/interface/DQMStore.h"
00017 #include "DQMServices/Core/interface/MonitorElement.h"
00018 
00019 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00020 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00021 
00022 #include "DataFormats/VertexReco/interface/Vertex.h"
00023 
00024 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00025 
00026 class TopElectronHLTOfflineSource : public edm::EDAnalyzer 
00027 {
00028  public:
00029   TopElectronHLTOfflineSource(const edm::ParameterSet& conf);
00030   virtual ~TopElectronHLTOfflineSource();
00031   
00032   virtual void beginJob();
00033   virtual void endJob();
00034   virtual void beginRun(const edm::Run& run, const edm::EventSetup& c);
00035   virtual void endRun(const edm::Run& run, const edm::EventSetup& c);
00036   //virtual void analyze();  
00037   virtual void analyze(const edm::Event&, const edm::EventSetup&);  
00038 
00039 
00040   class EleMEs
00041     {
00042     public:
00043       struct EleMESet
00044       {
00045         // kinematics
00046         MonitorElement* ele_et;
00047         MonitorElement* ele_eta;
00048         MonitorElement* ele_phi;
00049   
00050         // isolation
00051         MonitorElement* ele_isolEm;
00052         MonitorElement* ele_isolHad;
00053         MonitorElement* ele_minDeltaR;
00054   
00055         // event structure
00056         MonitorElement* global_n30jets;
00057         MonitorElement* global_sumEt;
00058   
00059         // track related
00060         MonitorElement* ele_gsftrack_etaError;
00061         MonitorElement* ele_gsftrack_phiError;
00062         MonitorElement* ele_gsftrack_numberOfValidHits;
00063         MonitorElement* ele_gsftrack_dzPV;
00064       };
00065     public:
00066       EleMEs()
00067         {
00068         }
00069       
00070       EleMEs(DQMStore* dbe, const std::vector<std::string>& eleIdNames, bool addExtraId, const std::string& name)
00071         {
00072           setup(dbe, eleIdNames, addExtraId, name);
00073         }
00074       
00075       void setup(DQMStore* dbe, const std::vector<std::string>&, bool addExtraId, const std::string& name);
00076       void setupMESet(EleMESet& eleSet, DQMStore* dbe, const std::string& name);
00077       void fill(EleMESet& eleMESet, const reco::GsfElectron& ele, float minDeltaR, float sumEt, int n30jets, float dzPV);
00078       
00079 
00080       void addMESets(const std::string& name);
00081 
00082       EleMESet& getMESet(size_t namePos, size_t idPos)
00083       {
00084         return eleMESets_[namePos+idPos*eleMENames_.size()];
00085       }
00086       
00087       const std::vector<EleMESet>& eleMESets()
00088       {
00089         return eleMESets_;
00090       }
00091       
00092       const std::vector<std::string>& eleMENames()
00093       {
00094         return eleMENames_;
00095       }
00096       
00097       const std::vector<std::string>& eleIdNames()
00098       {
00099         return eleIdNames_;
00100       }
00101       
00102       const std::string& name(size_t i)
00103       {
00104         return eleMENames_[i % eleMENames_.size()];
00105       }
00106       
00107       const std::string& idName(size_t i)
00108       {
00109         return eleIdNames_[i / eleMENames_.size()];
00110       }
00111       
00112       const std::string fullName(size_t i)
00113       {
00114         return name(i)+"_"+idName(i);
00115       }
00116      
00117 
00118     private:
00119       
00120       std::vector<EleMESet> eleMESets_;
00121       
00122       std::vector<std::string> eleMENames_;
00123       
00124       std::string name_;
00125       
00126       // add vector of references to electron id's
00127       std::vector<std::string> eleIdNames_;
00128 
00129 
00130     };
00131 
00132   virtual void setupHistos(const std::vector<EleMEs>);
00133   void fill(EleMEs& eleMEs, const edm::Event& iEvent, size_t eleIndex,  const std::vector<const trigger::TriggerObject*>& triggerJets, const std::vector<const trigger::TriggerObject*>& triggerElectrons, const reco::Vertex::Point& vertexPoint);
00134   
00135   
00136  private:
00137   
00138   DQMStore* dbe_; //dbe seems to be the standard name for this, I dont know why. We of course dont own it
00139   
00140   std::string dirName_;
00141   
00142   std::vector<EleMEs> eleMEs_;
00143   
00144   std::vector<std::string> electronIdNames_;
00145   std::string hltTag_;
00146   
00147   std::vector<std::string> superTriggerNames_;
00148   std::vector<std::string> electronTriggerNames_;
00149   
00150   edm::InputTag triggerSummaryLabel_;
00151   edm::InputTag triggerResultsLabel_;
00152   edm::InputTag triggerJetLabel_;
00153   edm::InputTag triggerJetFilterLabel_;
00154   edm::InputTag triggerElectronFilterLabel_;
00155   edm::InputTag electronLabel_;
00156   edm::InputTag primaryVertexLabel_;
00157   
00158   edm::Handle<trigger::TriggerEvent> triggerEvent_;
00159   
00160   edm::Handle<reco::GsfElectronCollection> eleHandle_;
00161 
00162   // exclude jets with deltaR < 0.1 from deltaR calculation
00163   bool excludeCloseJets_;
00164   
00165   bool requireTriggerMatch_;
00166   
00167   double electronMinEt_;
00168   double electronMaxEta_;
00169   
00170   // add extra ID
00171   bool addExtraId_;
00172   
00173   // the extra electron ID cuts
00174   double extraIdCutsSigmaEta_;
00175   double extraIdCutsSigmaPhi_;
00176   double extraIdCutsDzPV_;
00177 
00178   bool hltConfigChanged_;
00179   bool hltConfigValid_;
00180   HLTConfigProvider hltConfig_; 
00181 };
00182 
00183 
00184 #endif