Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-12-31 23:13:57

0001 // -*-C++-*-
0002 #ifndef L1TCOMPARE_H
0003 #define L1TCOMPARE_H
0004 
0005 /*
0006  * \file L1TCompare.h
0007  *
0008  * \author P. Wittich
0009  *
0010  * Revision 1.2  2007/06/08 08:37:42  wittich
0011  * Add ECAL TP - RCT comparisons. Lingering problems with
0012  * mismatches right now - still needs work.
0013  *
0014  *
0015  *
0016  *
0017 */
0018 
0019 // system include files
0020 #include <memory>
0021 #include <unistd.h>
0022 
0023 #include <iostream>
0024 #include <fstream>
0025 #include <vector>
0026 
0027 // user include files
0028 #include "FWCore/Framework/interface/Frameworkfwd.h"
0029 
0030 #include "FWCore/Framework/interface/Event.h"
0031 #include "FWCore/Framework/interface/MakerMacros.h"
0032 
0033 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0034 
0035 #include "FWCore/ServiceRegistry/interface/Service.h"
0036 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0037 
0038 // GCT and RCT data formats
0039 #include "DataFormats/L1GlobalCaloTrigger/interface/L1GctCollections.h"
0040 #include "DataFormats/L1CaloTrigger/interface/L1CaloCollections.h"
0041 #include "DataFormats/L1CaloTrigger/interface/L1CaloRegionDetId.h"
0042 
0043 // L1Extra
0044 #include "DataFormats/L1Trigger/interface/L1EmParticleFwd.h"
0045 #include "DataFormats/L1Trigger/interface/L1JetParticleFwd.h"
0046 #include "DataFormats/L1Trigger/interface/L1EtMissParticleFwd.h"
0047 
0048 // Ecal
0049 #include "DataFormats/EcalDigi/interface/EcalDigiCollections.h"
0050 
0051 // DQM
0052 #include "DQMServices/Core/interface/DQMStore.h"
0053 
0054 #include "DQMServices/Core/interface/DQMEDAnalyzer.h"
0055 // Trigger Headers
0056 
0057 //
0058 // class declaration
0059 //
0060 
0061 class L1TCompare : public DQMEDAnalyzer {
0062 public:
0063   // Constructor
0064   L1TCompare(const edm::ParameterSet& ps);
0065 
0066   // Destructor
0067   ~L1TCompare() override;
0068 
0069 protected:
0070   // Analyze
0071   void analyze(const edm::Event& e, const edm::EventSetup& c) override;
0072 
0073   // BeginRun
0074   void bookHistograms(DQMStore::IBooker& ibooker, edm::Run const&, edm::EventSetup const&) override;
0075   void dqmBeginRun(edm::Run const&, edm::EventSetup const&) override;
0076 
0077 private:
0078   // ----------member data ---------------------------
0079 
0080   // ++ RCT-GCT
0081   // - iso
0082   MonitorElement* rctGctLeadingIsoEmEta_;
0083   MonitorElement* rctGctLeadingIsoEmPhi_;
0084   MonitorElement* rctGctLeadingIsoEmRank_;
0085   // - non-iso
0086   MonitorElement* rctGctLeadingNonIsoEmEta_;
0087   MonitorElement* rctGctLeadingNonIsoEmPhi_;
0088   MonitorElement* rctGctLeadingNonIsoEmRank_;
0089 
0090   // ++ ECAL TPG - RCT
0091   MonitorElement* ecalTpgRctLeadingEmEta_;
0092   MonitorElement* ecalTpgRctLeadingEmEta2_;
0093   MonitorElement* ecalTpgRctLeadingEmPhi_;
0094   MonitorElement* ecalTpgRctLeadingEmRank_;
0095 
0096   int nev_;                 // Number of events processed
0097   std::string outputFile_;  //file name for ROOT ouput
0098   bool verbose_;
0099   bool verbose() const { return verbose_; };
0100   bool monitorDaemon_;
0101   std::ofstream logFile_;
0102 
0103   edm::EDGetTokenT<L1CaloEmCollection> rctSourceEm_token_;
0104   edm::EDGetTokenT<L1CaloRegionCollection> rctSourceRctEmRgn_token_;
0105   edm::InputTag rctSource_;
0106   edm::InputTag gctSource_;
0107   edm::InputTag ecalTpgSource_;
0108   edm::EDGetTokenT<EcalTrigPrimDigiCollection> ecalTpgSource_token_;
0109 
0110   //define Token(-s)
0111   edm::EDGetTokenT<L1GctJetCandCollection> gctCenJetsToken_;
0112   edm::EDGetTokenT<L1GctEmCandCollection> gctIsoEmCandsToken_;
0113   edm::EDGetTokenT<L1GctEmCandCollection> gctNonIsoEmCandsToken_;
0114 
0115   class RctObject {
0116   public:
0117     RctObject(int eta, int phi, int rank) : eta_(eta), phi_(phi), rank_(rank) {}
0118     virtual ~RctObject() {}
0119     int eta_, phi_;
0120     int rank_;
0121   };
0122   typedef std::vector<L1TCompare::RctObject> RctObjectCollection;
0123 
0124   // function for sorting the above collection based on rank.
0125   // note it's then reverse-sorted (low to high) so you have to use
0126   // the rbegin() and rend() and reverse_iterators.
0127   static bool rctObjectComp(const RctObject& a, const RctObject& b) {
0128     // for equal rank I don't know what the appropriate sorting is.
0129     if (a.rank_ == b.rank_) {
0130       if (a.eta_ == b.eta_) {
0131         return a.phi_ < b.phi_;
0132       } else {
0133         return a.eta_ < b.eta_;
0134       }
0135     } else {
0136       return a.rank_ < b.rank_;
0137     }
0138   }
0139 };
0140 
0141 #endif  // L1TCOMPARE_H