Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:21:38

0001 // -*- C++ -*-
0002 //
0003 // Package:    RPCTechnicalTrigger
0004 // Class:      RPCTechnicalTrigger
0005 //
0006 /**\class RPCTechnicalTrigger RPCTechnicalTrigger.cc L1Trigger/RPCTechnicalTrigger/interface/RPCTechnicalTrigger.cc
0007 
0008 Description: Implementation of the RPC Technical Trigger Emulator
0009 
0010 Implementation:
0011 
0012 
0013 */
0014 //
0015 // Original Author:  Andres Osorio
0016 //         Created:  Tue Mar 10 13:59:40 CET 2009
0017 //
0018 //
0019 //
0020 //
0021 // $Id:
0022 //
0023 //
0024 
0025 #ifndef RPCTECHNICALTRIGGER_H
0026 #define RPCTECHNICALTRIGGER_H 1
0027 
0028 // system include files
0029 #include <memory>
0030 #include <bitset>
0031 #include <array>
0032 
0033 // Include files From CMSSW
0034 
0035 #include "FWCore/Framework/interface/Frameworkfwd.h"
0036 #include "FWCore/Framework/interface/stream/EDProducer.h"
0037 #include "FWCore/Framework/interface/Event.h"
0038 #include "FWCore/Framework/interface/MakerMacros.h"
0039 #include "FWCore/Framework/interface/ESHandle.h"
0040 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0041 #include "FWCore/ServiceRegistry/interface/Service.h"
0042 #include "FWCore/Utilities/interface/ESGetToken.h"
0043 
0044 #include "Geometry/RPCGeometry/interface/RPCRoll.h"
0045 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
0046 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0047 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
0048 
0049 #include "DataFormats/RPCDigi/interface/RPCDigi.h"
0050 #include "DataFormats/RPCDigi/interface/RPCDigiCollection.h"
0051 #include "DataFormats/MuonDetId/interface/RPCDetId.h"
0052 
0053 // Local to project
0054 #include "L1Trigger/RPCTechnicalTrigger/interface/ProcessInputSignal.h"
0055 #include "L1Trigger/RPCTechnicalTrigger/interface/TTUEmulator.h"
0056 #include "L1Trigger/RPCTechnicalTrigger/interface/TTUConfigurator.h"
0057 
0058 #include "CondFormats/RPCObjects/interface/RBCBoardSpecs.h"
0059 #include "CondFormats/DataRecord/interface/RBCBoardSpecsRcd.h"
0060 #include "CondFormats/RPCObjects/interface/TTUBoardSpecs.h"
0061 #include "CondFormats/DataRecord/interface/TTUBoardSpecsRcd.h"
0062 
0063 //Technical trigger bits
0064 #include "DataFormats/L1GlobalTrigger/interface/L1GtTechnicalTrigger.h"
0065 #include "DataFormats/L1GlobalTrigger/interface/L1GtTechnicalTriggerRecord.h"
0066 
0067 //...........................................................................
0068 
0069 class RPCTechnicalTrigger : public edm::stream::EDProducer<> {
0070 public:
0071   explicit RPCTechnicalTrigger(const edm::ParameterSet&);
0072   ~RPCTechnicalTrigger() override;
0073 
0074 private:
0075   //virtual void beginJob() ;
0076   void beginRun(edm::Run const&, const edm::EventSetup&) final;
0077   void produce(edm::Event&, const edm::EventSetup&) override;
0078 
0079   //...........................................................................
0080 
0081   void printinfo() const;
0082 
0083   static constexpr int kMaxTtuBoards = 3;
0084   std::array<TTUEmulator, kMaxTtuBoards> m_ttu;
0085 
0086   std::array<TTUEmulator, kMaxTtuBoards> m_ttuRbcLine;
0087 
0088   const int m_verbosity;
0089   const int m_useEventSetup;
0090   std::string m_configFile;
0091   const std::vector<unsigned> m_ttBits;
0092   const std::vector<std::string> m_ttNames;
0093   const edm::InputTag m_rpcDigiLabel;
0094   const edm::EDGetTokenT<RPCDigiCollection> m_rpcDigiToken;
0095 
0096   const int m_useRPCSimLink;
0097 
0098   std::unique_ptr<TTUConfigurator> m_readConfig;
0099   const TTUBoardSpecs* m_ttuspecs;
0100   const RBCBoardSpecs* m_rbcspecs;
0101 
0102   bool m_hasConfig;
0103 
0104   class TTUResults {
0105   public:
0106     TTUResults() = default;
0107     TTUResults(const TTUResults&) = default;
0108     TTUResults(TTUResults&&) = default;
0109     TTUResults& operator=(TTUResults const&) = default;
0110     TTUResults& operator=(TTUResults&&) = default;
0111 
0112     TTUResults(int idx, int bx, int wh1, int wh2) : m_ttuidx(idx), m_bx(bx), m_trigWheel1(wh1), m_trigWheel2(wh2) { ; }
0113 
0114     TTUResults(int idx, int bx, int wh1, int wh2, int wdg)
0115         : m_ttuidx(idx), m_bx(bx), m_trigWheel1(wh1), m_trigWheel2(wh2), m_wedge(wdg) {
0116       ;
0117     }
0118 
0119     int m_ttuidx;
0120     int m_bx;
0121     int m_trigWheel1;
0122     int m_trigWheel2;
0123     int m_wedge;
0124 
0125     int getTriggerForWheel(int wheel) const {
0126       if (abs(wheel) > 1)
0127         return m_trigWheel2;
0128       else
0129         return m_trigWheel1;
0130     }
0131   };
0132 
0133   std::map<int, TTUResults*> convertToMap(const std::vector<std::unique_ptr<TTUResults>>&) const;
0134 
0135   bool searchCoincidence(int, int, std::map<int, TTUResults*> const& ttuResultsByQuandrant) const;
0136 
0137   edm::ESGetToken<RPCGeometry, MuonGeometryRecord> m_rpcGeometryToken;
0138   edm::ESGetToken<RBCBoardSpecs, RBCBoardSpecsRcd> m_pRBCSpecsToken;
0139   edm::ESGetToken<TTUBoardSpecs, TTUBoardSpecsRcd> m_pTTUSpecsToken;
0140 };
0141 
0142 #endif  // RPCTECHNICALTRIGGER_H