00001 #ifndef HLTriggerOffline_Egamma_EmDQM_H 00002 #define HLTriggerOffline_Egamma_EmDQM_H 00003 00004 00005 // Base Class Headers 00006 #include "DataFormats/Common/interface/Handle.h" 00007 #include "DataFormats/HLTReco/interface/TriggerEventWithRefs.h" 00008 #include "FWCore/Framework/interface/EDAnalyzer.h" 00009 #include "FWCore/Framework/interface/Frameworkfwd.h" 00010 #include "FWCore/Framework/interface/Event.h" 00011 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00012 #include "FWCore/Utilities/interface/InputTag.h" 00013 #include "DataFormats/Common/interface/RefToBase.h" 00014 #include "DQMServices/Core/interface/DQMStore.h" 00015 #include "DQMServices/Core/interface/MonitorElement.h" 00016 #include "DataFormats/HepMCCandidate/interface/GenParticle.h" 00017 #include <vector> 00018 #include "TDirectory.h" 00019 #include "HepMC/GenParticle.h" 00020 #include "CommonTools/Utils/interface/PtComparator.h" 00021 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h" 00022 #include "DataFormats/Common/interface/TriggerResults.h" 00023 00024 class EmDQM : public edm::EDAnalyzer{ 00025 public: 00027 explicit EmDQM(const edm::ParameterSet& pset); 00028 00030 ~EmDQM(); 00031 00032 // Operations 00033 00034 void analyze(const edm::Event & event, const edm::EventSetup&); 00035 void beginJob(); 00036 void endJob(); 00037 00038 void beginRun(edm::Run const&, edm::EventSetup const&); 00039 void endRun(edm::Run const&, edm::EventSetup const&); 00040 00041 private: 00042 00049 bool checkGeneratedParticlesRequirement(const edm::Event &event); 00050 00055 bool checkRecoParticlesRequirement(const edm::Event & event); 00056 00058 HLTConfigProvider hltConf_; 00059 00060 // Input from cfg file 00061 edm::InputTag triggerobjwithrefs; 00062 unsigned int pathIndex; 00063 std::vector<edm::InputTag> theHLTCollectionLabels; 00064 unsigned int numOfHLTCollectionLabels; // Will be size of above vector 00065 bool useHumanReadableHistTitles; 00066 bool mcMatchedOnly; 00067 bool noPhiPlots; 00068 bool noIsolationPlots; 00069 std::vector<std::string> theHLTCollectionHumanNames; // Human-readable names for the collections 00070 edm::InputTag theL1Seed; 00071 std::vector<int> theHLTOutputTypes; 00072 std::vector<bool> plotiso; 00073 std::vector<std::vector<edm::InputTag> > isoNames; // there has to be a better solution 00074 std::vector<std::pair<double,double> > plotBounds; 00075 std::vector<unsigned int> nCandCuts; 00076 std::string theHltName; 00077 unsigned verbosity; 00078 // verbosity levels 00079 static const unsigned OUTPUT_SILENT = 0; 00080 static const unsigned OUTPUT_ERRORS = 1; 00081 static const unsigned OUTPUT_WARNINGS = 2; 00082 static const unsigned OUTPUT_ALL = 3; 00083 00085 // Read from configuration file // 00087 // paramters for generator study 00088 unsigned int reqNum; 00089 int pdgGen; 00090 double genEtaAcc; 00091 double genEtAcc; 00092 // plotting paramters 00093 double plotEtMin; 00094 double plotEtaMax; 00095 double plotPhiMax; 00096 double plotPtMin ; 00097 double plotPtMax ; 00098 unsigned int plotBins ; 00099 unsigned int plotMinEtForEtaEffPlot; 00100 // preselction cuts 00101 00108 edm::InputTag gencutCollection_; 00109 00111 unsigned int gencut_; 00112 00114 std::set<std::string> hltCollectionLabelsFound; 00115 00117 std::set<std::string> hltCollectionLabelsMissed; 00118 00119 00121 // Create Histograms // 00123 // Et & eta distributions 00124 std::vector<MonitorElement*> etahist; 00125 std::vector<MonitorElement*> phihist; 00126 std::vector<MonitorElement*> ethist; 00127 std::vector<MonitorElement*> etahistmatch; 00128 std::vector<MonitorElement*> phihistmatch; 00129 std::vector<MonitorElement*> ethistmatch; 00130 std::vector<MonitorElement*> histEtOfHltObjMatchToGen; 00131 std::vector<MonitorElement*> histEtaOfHltObjMatchToGen; 00132 std::vector<MonitorElement*> histPhiOfHltObjMatchToGen; 00133 // Isolation distributions 00134 std::vector<MonitorElement*> etahistiso; 00135 std::vector<MonitorElement*> phihistiso; 00136 std::vector<MonitorElement*> ethistiso; 00137 std::vector<MonitorElement*> etahistisomatch; 00138 std::vector<MonitorElement*> phihistisomatch; 00139 std::vector<MonitorElement*> ethistisomatch; 00140 std::vector<MonitorElement*> histEtIsoOfHltObjMatchToGen; 00141 std::vector<MonitorElement*> histEtaIsoOfHltObjMatchToGen; 00142 std::vector<MonitorElement*> histPhiIsoOfHltObjMatchToGen; 00143 // Plots of efficiency per step 00144 MonitorElement* total; 00145 MonitorElement* totalmatch; 00146 //generator histograms 00147 MonitorElement* etgen; 00148 MonitorElement* etagen; 00149 MonitorElement* phigen; 00150 00151 // interface to DQM framework 00152 DQMStore * dbe; 00153 std::string dirname_; 00154 00155 template <class T> void fillHistos(edm::Handle<trigger::TriggerEventWithRefs>& ,const edm::Event& ,unsigned int, std::vector<reco::Particle>&, bool & ); 00156 GreaterByPt<reco::Particle> pTComparator_; 00157 GreaterByPt<reco::GenParticle> pTGenComparator_; 00158 00159 }; 00160 #endif