00001 // -*-C++-*- 00002 #ifndef L1TCOMPARE_H 00003 #define L1TCOMPARE_H 00004 00005 /* 00006 * \file L1TCompare.h 00007 * 00008 * $Date: 2009/11/19 14:31:34 $ 00009 * $Revision: 1.4 $ 00010 * \author P. Wittich 00011 * $Id: L1TCompare.h,v 1.4 2009/11/19 14:31:34 puigh Exp $ 00012 * $Log: L1TCompare.h,v $ 00013 * Revision 1.4 2009/11/19 14:31:34 puigh 00014 * modify beginJob 00015 * 00016 * Revision 1.3 2008/03/01 00:40:00 lat 00017 * DQM core migration. 00018 * 00019 * Revision 1.2 2007/06/08 08:37:42 wittich 00020 * Add ECAL TP - RCT comparisons. Lingering problems with 00021 * mismatches right now - still needs work. 00022 * 00023 * 00024 * 00025 * 00026 */ 00027 00028 // system include files 00029 #include <memory> 00030 #include <functional> 00031 #include <unistd.h> 00032 00033 00034 #include <iostream> 00035 #include <fstream> 00036 #include <vector> 00037 00038 00039 // user include files 00040 #include "FWCore/Framework/interface/Frameworkfwd.h" 00041 #include "FWCore/Framework/interface/EDAnalyzer.h" 00042 00043 #include "FWCore/Framework/interface/Event.h" 00044 #include "FWCore/Framework/interface/MakerMacros.h" 00045 00046 #include "FWCore/ParameterSet/interface/ParameterSet.h" 00047 00048 #include "FWCore/ServiceRegistry/interface/Service.h" 00049 #include "FWCore/MessageLogger/interface/MessageLogger.h" 00050 00051 // DQM 00052 #include "DQMServices/Core/interface/DQMStore.h" 00053 #include "DQMServices/Core/interface/MonitorElement.h" 00054 00055 00056 // Trigger Headers 00057 00058 00059 00060 // 00061 // class declaration 00062 // 00063 00064 class L1TCompare : public edm::EDAnalyzer { 00065 00066 public: 00067 00068 // Constructor 00069 L1TCompare(const edm::ParameterSet& ps); 00070 00071 // Destructor 00072 virtual ~L1TCompare(); 00073 00074 protected: 00075 // Analyze 00076 void analyze(const edm::Event& e, const edm::EventSetup& c); 00077 00078 // BeginJob 00079 void beginJob(void); 00080 00081 // EndJob 00082 void endJob(void); 00083 00084 private: 00085 // ----------member data --------------------------- 00086 DQMStore * dbe; 00087 00088 // ++ RCT-GCT 00089 // - iso 00090 MonitorElement* rctGctLeadingIsoEmEta_; 00091 MonitorElement* rctGctLeadingIsoEmPhi_; 00092 MonitorElement* rctGctLeadingIsoEmRank_; 00093 // - non-iso 00094 MonitorElement* rctGctLeadingNonIsoEmEta_; 00095 MonitorElement* rctGctLeadingNonIsoEmPhi_; 00096 MonitorElement* rctGctLeadingNonIsoEmRank_; 00097 00098 // ++ ECAL TPG - RCT 00099 MonitorElement* ecalTpgRctLeadingEmEta_; 00100 MonitorElement* ecalTpgRctLeadingEmEta2_; 00101 MonitorElement* ecalTpgRctLeadingEmPhi_; 00102 MonitorElement* ecalTpgRctLeadingEmRank_; 00103 00104 00105 00106 int nev_; // Number of events processed 00107 std::string outputFile_; //file name for ROOT ouput 00108 bool verbose_; 00109 bool verbose() const { return verbose_; }; 00110 bool monitorDaemon_; 00111 ofstream logFile_; 00112 00113 edm::InputTag rctSource_; 00114 edm::InputTag gctSource_; 00115 edm::InputTag ecalTpgSource_; 00116 00117 class RctObject { 00118 public: 00119 RctObject(int eta, int phi, int rank): 00120 eta_(eta), phi_(phi), rank_(rank) 00121 {} 00122 virtual ~RctObject() {} 00123 int eta_, phi_; 00124 int rank_; 00125 00126 }; 00127 typedef std::vector<L1TCompare::RctObject> RctObjectCollection; 00128 00129 // functor for sorting the above collection based on rank. 00130 // note it's then reverse-sorted (low to high) so you have to use 00131 // the rbegin() and rend() and reverse_iterators. 00132 class RctObjectComp: public std::binary_function<L1TCompare::RctObject, 00133 L1TCompare::RctObject, bool> 00134 { 00135 public: 00136 bool operator()(const RctObject &a, const RctObject &b) const 00137 { 00138 // for equal rank I don't know what the appropriate sorting is. 00139 if ( a.rank_ == b.rank_ ) { 00140 if ( a.eta_ == b.eta_ ) { 00141 return a.phi_ < b.phi_; 00142 } 00143 else { 00144 return a.eta_ < b.eta_; 00145 } 00146 } 00147 else { 00148 return a.rank_ < b.rank_; 00149 } 00150 } 00151 }; 00152 00153 00154 }; 00155 00156 #endif // L1TCOMPARE_H