CMS 3D CMS Logo

/afs/cern.ch/work/a/aaltunda/public/www/CMSSW_6_2_5/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 #include "FWCore/Utilities/interface/InputTag.h"
00016 
00017 #include "DQMServices/Core/interface/DQMStore.h"
00018 #include "DQMServices/Core/interface/MonitorElement.h"
00019 
00020 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00021 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00022 
00023 #include "DataFormats/VertexReco/interface/Vertex.h"
00024 
00025 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00026 
00027 class TopElectronHLTOfflineSource : public edm::EDAnalyzer 
00028 {
00029  public:
00030   TopElectronHLTOfflineSource(const edm::ParameterSet& conf);
00031   virtual ~TopElectronHLTOfflineSource();
00032   
00033   virtual void beginJob();
00034   virtual void endJob();
00035   virtual void beginRun(const edm::Run& run, const edm::EventSetup& c);
00036   virtual void endRun(const edm::Run& run, const edm::EventSetup& c);
00037   //virtual void analyze();  
00038   virtual void analyze(const edm::Event&, const edm::EventSetup&);  
00039 
00040 
00041   class EleMEs
00042     {
00043     public:
00044       struct EleMESet
00045       {
00046         // kinematics
00047         MonitorElement* ele_et;
00048         MonitorElement* ele_eta;
00049         MonitorElement* ele_phi;
00050   
00051         // isolation
00052         MonitorElement* ele_isolEm;
00053         MonitorElement* ele_isolHad;
00054         MonitorElement* ele_minDeltaR;
00055   
00056         // event structure
00057         MonitorElement* global_n30jets;
00058         MonitorElement* global_sumEt;
00059   
00060         // track related
00061         MonitorElement* ele_gsftrack_etaError;
00062         MonitorElement* ele_gsftrack_phiError;
00063         MonitorElement* ele_gsftrack_numberOfValidHits;
00064         MonitorElement* ele_gsftrack_dzPV;
00065       };
00066     public:
00067       EleMEs()
00068         {
00069         }
00070       
00071       EleMEs(DQMStore* dbe, const std::vector<std::string>& eleIdNames, bool addExtraId, const std::string& name)
00072         {
00073           setup(dbe, eleIdNames, addExtraId, name);
00074         }
00075       
00076       void setup(DQMStore* dbe, const std::vector<std::string>&, bool addExtraId, const std::string& name);
00077       void setupMESet(EleMESet& eleSet, DQMStore* dbe, const std::string& name);
00078       void fill(EleMESet& eleMESet, const reco::GsfElectron& ele, float minDeltaR, float sumEt, int n30jets, float dzPV);
00079       
00080 
00081       void addMESets(const std::string& name);
00082 
00083       EleMESet& getMESet(size_t namePos, size_t idPos)
00084       {
00085         return eleMESets_[namePos+idPos*eleMENames_.size()];
00086       }
00087       
00088       const std::vector<EleMESet>& eleMESets()
00089       {
00090         return eleMESets_;
00091       }
00092       
00093       const std::vector<std::string>& eleMENames()
00094       {
00095         return eleMENames_;
00096       }
00097       
00098       const std::vector<std::string>& eleIdNames()
00099       {
00100         return eleIdNames_;
00101       }
00102       
00103       const std::string& name(size_t i)
00104       {
00105         return eleMENames_[i % eleMENames_.size()];
00106       }
00107       
00108       const std::string& idName(size_t i)
00109       {
00110         return eleIdNames_[i / eleMENames_.size()];
00111       }
00112       
00113       const std::string fullName(size_t i)
00114       {
00115         return name(i)+"_"+idName(i);
00116       }
00117      
00118 
00119     private:
00120       
00121       std::vector<EleMESet> eleMESets_;
00122       
00123       std::vector<std::string> eleMENames_;
00124       
00125       std::string name_;
00126       
00127       // add vector of references to electron id's
00128       std::vector<std::string> eleIdNames_;
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   edm::InputTag beamSpot_;
00158 
00159   edm::Handle<trigger::TriggerEvent> triggerEvent_;
00160   
00161   edm::Handle<reco::GsfElectronCollection> eleHandle_;
00162 
00163   // exclude jets with deltaR < 0.1 from deltaR calculation
00164   bool excludeCloseJets_;
00165   
00166   bool requireTriggerMatch_;
00167   
00168   double electronMinEt_;
00169   double electronMaxEta_;
00170   
00171   // add extra ID
00172   bool addExtraId_;
00173   
00174   // the extra electron ID cuts
00175   double extraIdCutsSigmaEta_;
00176   double extraIdCutsSigmaPhi_;
00177   double extraIdCutsDzPV_;
00178 
00179   bool hltConfigChanged_;
00180   bool hltConfigValid_;
00181   HLTConfigProvider hltConfig_; 
00182 };
00183 
00184 
00185 #endif