CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_6_1_1/src/DQMOffline/Trigger/interface/HLTInclusiveVBFSource.h

Go to the documentation of this file.
00001 #ifndef HLTInclusiveVBFSource_H
00002 #define HLTInclusiveVBFSource_H
00003 
00004 // system include files
00005 #include <memory>
00006 #include <unistd.h>
00007 
00008 // user include files
00009 #include "FWCore/Common/interface/TriggerNames.h"
00010 #include "FWCore/Framework/interface/Frameworkfwd.h"
00011 #include "FWCore/Framework/interface/EDAnalyzer.h"
00012 #include "FWCore/Framework/interface/Event.h"
00013 #include "FWCore/Framework/interface/MakerMacros.h"
00014 #include "FWCore/ServiceRegistry/interface/Service.h"
00015 #include "FWCore/MessageLogger/interface/MessageLogger.h"
00016 #include "FWCore/ParameterSet/interface/ParameterSet.h"
00017 
00018 #include "HLTrigger/HLTcore/interface/HLTConfigProvider.h"
00019 
00020 #include "DQMServices/Core/interface/DQMStore.h"
00021 #include "DQMServices/Core/interface/MonitorElement.h"
00022 
00023 #include "DataFormats/Common/interface/TriggerResults.h"
00024 #include "DataFormats/HLTReco/interface/TriggerEvent.h"
00025 #include "DataFormats/HLTReco/interface/TriggerObject.h"
00026 #include "DataFormats/HLTReco/interface/TriggerTypeDefs.h"
00027 #include "DataFormats/JetReco/interface/CaloJetCollection.h"
00028 #include "DataFormats/METReco/interface/CaloMETCollection.h"
00029 #include "DataFormats/METReco/interface/CaloMET.h"
00030 #include "DataFormats/JetReco/interface/CaloJet.h"
00031 #include "DataFormats/JetReco/interface/Jet.h"
00032 #include "DataFormats/JetReco/interface/PFJetCollection.h"
00033 #include "DataFormats/JetReco/interface/PFJet.h"
00034 #include "DataFormats/METReco/interface/PFMETCollection.h"
00035 #include "DataFormats/METReco/interface/PFMET.h"
00036 #include "DataFormats/Math/interface/deltaR.h"
00037 #include "DataFormats/Math/interface/deltaPhi.h"
00038 #include "DataFormats/VertexReco/interface/Vertex.h"
00039 #include "DataFormats/VertexReco/interface/VertexFwd.h"
00040 
00041 //#include "RecoJets/JetProducers/interface/JetIDHelper.h"
00042 
00043 #include <iostream>
00044 #include <fstream>
00045 #include <vector>
00046 #include <string>
00047 
00048 class HLTInclusiveVBFSource : public edm::EDAnalyzer {
00049  public:
00050   explicit HLTInclusiveVBFSource(const edm::ParameterSet&);
00051   ~HLTInclusiveVBFSource();
00052   
00053  private:
00054   virtual void beginJob() ;
00055   virtual void analyze(const edm::Event&, const edm::EventSetup&);
00056   virtual void endJob() ;
00057   
00058   void beginRun(const edm::Run& run, const edm::EventSetup& c);
00059   void endRun(const edm::Run& run, const edm::EventSetup& c);
00060 
00061   void beginLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c);
00062   void endLuminosityBlock(const edm::LuminosityBlock& lumiSeg, const edm::EventSetup& c);
00063   //void histobooking( const edm::EventSetup& c);
00064   
00065   virtual bool isBarrel(double eta);
00066   virtual bool isEndCap(double eta); 
00067   virtual bool isForward(double eta);
00068   virtual bool validPathHLT(std::string path);
00069   virtual bool isHLTPathAccepted(std::string pathName);
00070   virtual bool isTriggerObjectFound(std::string objectName);
00071   //virtual double TriggerPosition(std::string trigName);
00072   
00073   // ----------member data --------------------------- 
00074   int nev_;
00075   int nCount_;
00076   DQMStore * dbe;
00077       
00078   MonitorElement* total_;
00079 
00080   std::vector<int>  prescUsed_;
00081   
00082   std::string dirname_;
00083   std::string processname_;
00084   //reco::helper::JetIDHelper *jetID; // JetID helper (Need to run with RECO, not AOD)
00085   std::vector<std::string> path_;
00086   
00087   bool debug_;
00088   bool isSetup_; 
00089 
00090   double minPtHigh_;
00091   double minPtLow_;
00092   double minDeltaEta_;
00093   double minInvMass_;
00094   double deltaRMatch_;
00095   bool   etaOpposite_; 
00096   
00097   edm::InputTag triggerSummaryLabel_;
00098   edm::Handle<trigger::TriggerEvent> triggerObj_;
00099   edm::InputTag triggerResultsLabel_;
00100   edm::Handle<edm::TriggerResults> triggerResults_; 
00101   edm::TriggerNames triggerNames_; // TriggerNames class
00102   
00103   edm::InputTag caloJetsTag_;
00104   edm::InputTag caloMETTag_;
00105   edm::InputTag pfJetsTag_;
00106   edm::InputTag pfMetTag_;
00107   
00108   edm::Handle<reco::CaloJetCollection> calojetColl_;
00109   edm::Handle<reco::CaloMETCollection> calometColl_; 
00110   edm::Handle<reco::PFJetCollection>   pfjetColl_;
00111   edm::Handle<reco::PFMETCollection>   pfmetColl_; 
00112   
00113   reco::CaloJetCollection calojet; 
00114   reco::PFJetCollection pfjet; 
00115   HLTConfigProvider hltConfig_;
00116 
00117   bool check_mjj650_Pt35_DEta3p5;
00118   bool check_mjj700_Pt35_DEta3p5;
00119   bool check_mjj750_Pt35_DEta3p5;
00120   bool check_mjj800_Pt35_DEta3p5;
00121   bool check_mjj650_Pt40_DEta3p5; 
00122   bool check_mjj700_Pt40_DEta3p5;
00123   bool check_mjj750_Pt40_DEta3p5; 
00124   bool check_mjj800_Pt40_DEta3p5;
00125   
00126   std::string pathname;
00127   std::string filtername;
00128 
00129   double reco_ejet1; 
00130   //double reco_etjet1;
00131   double reco_pxjet1;
00132   double reco_pyjet1;
00133   double reco_pzjet1;
00134   double reco_ptjet1;
00135   double reco_etajet1;
00136   double reco_phijet1;
00137   //
00138   double reco_ejet2;
00139   //double reco_etjet2;
00140   double reco_pxjet2;
00141   double reco_pyjet2;
00142   double reco_pzjet2;
00143   double reco_ptjet2;
00144   double reco_etajet2;
00145   double reco_phijet2;
00146   //  
00147   double hlt_ejet1;
00148   //double hlt_etjet1;
00149   double hlt_pxjet1;
00150   double hlt_pyjet1;
00151   double hlt_pzjet1;
00152   double hlt_ptjet1;
00153   double hlt_etajet1;
00154   double hlt_phijet1;
00155   //
00156   double hlt_ejet2 ;
00157   //double hlt_etjet2;
00158   double hlt_pxjet2;
00159   double hlt_pyjet2;
00160   double hlt_pzjet2;
00161   double hlt_ptjet2;
00162   double hlt_etajet2;
00163   double hlt_phijet2;
00164   //
00165   bool checkOffline;
00166   bool checkHLT;
00167   bool checkHLTIndex;
00168   //
00169   float dR_HLT_RECO_11; 
00170   float dR_HLT_RECO_22;
00171   float dR_HLT_RECO_12; 
00172   float dR_HLT_RECO_21;
00173   bool checkdR_sameOrder;
00174   bool checkdR_crossOrder;
00175   //
00176   double reco_deltaetajet;
00177   double reco_deltaphijet;
00178   double reco_invmassjet;
00179   double hlt_deltaetajet;
00180   double hlt_deltaphijet;
00181   double hlt_invmassjet;
00182   
00183   // data across paths
00184   MonitorElement* scalersSelect;
00185   // helper class to store the data path
00186   
00187   class PathInfo {
00188     PathInfo():
00189       pathIndex_(-1), 
00190       prescaleUsed_(-1), 
00191       pathName_("unset"), 
00192       filterName_("unset"), 
00193       processName_("unset"), 
00194       objectType_(-1), 
00195       triggerType_("unset"){};
00196       //
00197   public:
00198     //
00199     void setHistos(
00200                    MonitorElement* const RECO_deltaEta_DiJet,
00201                    MonitorElement* const RECO_deltaPhi_DiJet,
00202                    MonitorElement* const RECO_invMass_DiJet,
00203                    MonitorElement* const HLT_deltaEta_DiJet,
00204                    MonitorElement* const HLT_deltaPhi_DiJet,
00205                    MonitorElement* const HLT_invMass_DiJet,
00206                    MonitorElement* const RECO_deltaEta_DiJet_Match,
00207                    MonitorElement* const RECO_deltaPhi_DiJet_Match,
00208                    MonitorElement* const RECO_invMass_DiJet_Match,
00209                    MonitorElement* const RECOHLT_deltaEta,
00210                    MonitorElement* const RECOHLT_deltaPhi,
00211                    MonitorElement* const RECOHLT_invMass,
00212                    MonitorElement* const NumberOfMatches,
00213                    MonitorElement* const NumberOfEvents
00214                    )    
00215     { 
00216       RECO_deltaEta_DiJet_       = RECO_deltaEta_DiJet;
00217       RECO_deltaPhi_DiJet_       = RECO_deltaPhi_DiJet;
00218       RECO_invMass_DiJet_        = RECO_invMass_DiJet;
00219       HLT_deltaEta_DiJet_        = HLT_deltaEta_DiJet;
00220       HLT_deltaPhi_DiJet_        = HLT_deltaPhi_DiJet ;
00221       HLT_invMass_DiJet_         = HLT_invMass_DiJet;
00222       RECO_deltaEta_DiJet_Match_ = RECO_deltaEta_DiJet_Match;
00223       RECO_deltaPhi_DiJet_Match_ = RECO_deltaPhi_DiJet_Match;
00224       RECO_invMass_DiJet_Match_  = RECO_invMass_DiJet_Match;
00225       RECOHLT_deltaEta_          = RECOHLT_deltaEta;
00226       RECOHLT_deltaPhi_          = RECOHLT_deltaPhi ;
00227       RECOHLT_invMass_           = RECOHLT_invMass;
00228       NumberOfMatches_           = NumberOfMatches;
00229       NumberOfEvents_            = NumberOfEvents;
00230     };
00231     ~PathInfo() {};
00232     PathInfo(int prescaleUsed, 
00233              std::string pathName,
00234              std::string filterName, 
00235              std::string processName, 
00236              size_t type, 
00237              std::string triggerType):
00238       prescaleUsed_(prescaleUsed), 
00239       pathName_(pathName), 
00240       filterName_(filterName), 
00241       processName_(processName), 
00242       objectType_(type), 
00243       triggerType_(triggerType){};
00244     
00245       MonitorElement * getMEhisto_RECO_deltaEta_DiJet()       { return RECO_deltaEta_DiJet_; }
00246       MonitorElement * getMEhisto_RECO_deltaPhi_DiJet()       { return RECO_deltaPhi_DiJet_; }
00247       MonitorElement * getMEhisto_RECO_invMass_DiJet()        { return RECO_invMass_DiJet_; }
00248       MonitorElement * getMEhisto_HLT_deltaEta_DiJet()        { return HLT_deltaEta_DiJet_; }
00249       MonitorElement * getMEhisto_HLT_deltaPhi_DiJet()        { return HLT_deltaPhi_DiJet_; }
00250       MonitorElement * getMEhisto_HLT_invMass_DiJet()         { return HLT_invMass_DiJet_; }
00251       MonitorElement * getMEhisto_RECO_deltaEta_DiJet_Match() { return RECO_deltaEta_DiJet_Match_; }
00252       MonitorElement * getMEhisto_RECO_deltaPhi_DiJet_Match() { return RECO_deltaPhi_DiJet_Match_; }
00253       MonitorElement * getMEhisto_RECO_invMass_DiJet_Match()  { return RECO_invMass_DiJet_Match_; }
00254       MonitorElement * getMEhisto_RECOHLT_deltaEta()          { return RECOHLT_deltaEta_; }
00255       MonitorElement * getMEhisto_RECOHLT_deltaPhi()          { return RECOHLT_deltaPhi_; }
00256       MonitorElement * getMEhisto_RECOHLT_invMass()           { return RECOHLT_invMass_; }
00257       MonitorElement * getMEhisto_NumberOfMatches()           { return NumberOfMatches_; }
00258       MonitorElement * getMEhisto_NumberOfEvents()            { return NumberOfEvents_; }
00259       
00260       const std::string getLabel(void ) const {
00261         return filterName_;
00262       }
00263       void setLabel(std::string labelName){
00264         filterName_ = labelName;
00265         return;
00266       }
00267       const std::string getPath(void ) const {
00268         return pathName_;
00269       }
00270       const int getprescaleUsed(void) const {
00271         return prescaleUsed_;
00272       }
00273       const std::string getProcess(void ) const {
00274         return processName_;
00275       }
00276       const int getObjectType(void ) const {
00277         return objectType_;
00278       }
00279       const std::string getTriggerType(void ) const {
00280         return triggerType_;
00281       }
00282       const edm::InputTag getTag(void) const{
00283         edm::InputTag tagName(filterName_,"",processName_);
00284         return tagName;
00285       }
00286       bool operator==(const std::string v){
00287         return v==pathName_;
00288       }
00289       
00290   private:
00291       int pathIndex_;
00292       int prescaleUsed_;
00293       std::string pathName_;
00294       std::string filterName_;
00295       std::string processName_;
00296       int objectType_;
00297       std::string triggerType_;
00298 
00299       MonitorElement*  RECO_deltaEta_DiJet_;
00300       MonitorElement*  RECO_deltaPhi_DiJet_;
00301       MonitorElement*  RECO_invMass_DiJet_;
00302       MonitorElement*  HLT_deltaEta_DiJet_;
00303       MonitorElement*  HLT_deltaPhi_DiJet_;
00304       MonitorElement*  HLT_invMass_DiJet_;
00305       MonitorElement*  RECO_deltaEta_DiJet_Match_;
00306       MonitorElement*  RECO_deltaPhi_DiJet_Match_;
00307       MonitorElement*  RECO_invMass_DiJet_Match_;
00308       MonitorElement*  RECOHLT_deltaEta_;
00309       MonitorElement*  RECOHLT_deltaPhi_;
00310       MonitorElement*  RECOHLT_invMass_;
00311       MonitorElement*  NumberOfMatches_;
00312       MonitorElement*  NumberOfEvents_;
00313   };
00314   
00315   // simple collection 
00316   class PathInfoCollection: public std::vector<PathInfo> {
00317   public:
00318     PathInfoCollection(): std::vector<PathInfo>()
00319       {};
00320       std::vector<PathInfo>::iterator find(std::string pathName) {
00321         return std::find(begin(), end(), pathName);
00322       }
00323   };
00324   PathInfoCollection hltPathsAll_;
00325 };
00326 #endif