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