Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-05-12 01:51:33

0001 #ifndef Phase2L1Trigger_DTTrigger_RPCIntegrator_h
0002 #define Phase2L1Trigger_DTTrigger_RPCIntegrator_h
0003 
0004 #include "FWCore/Framework/interface/Event.h"
0005 #include "FWCore/Framework/interface/Frameworkfwd.h"
0006 #include "FWCore/Framework/interface/EventSetup.h"
0007 #include "FWCore/Framework/interface/Run.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/Framework/interface/ConsumesCollector.h"
0010 
0011 #include "DataFormats/MuonDetId/interface/DTChamberId.h"
0012 #include "DataFormats/MuonDetId/interface/DTSuperLayerId.h"
0013 #include "DataFormats/MuonDetId/interface/DTLayerId.h"
0014 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0015 #include "DataFormats/DTDigi/interface/DTDigiCollection.h"
0016 #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhContainer.h"
0017 #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTPhDigi.h"
0018 #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThContainer.h"
0019 #include "DataFormats/L1DTTrackFinder/interface/L1Phase2MuDTThDigi.h"
0020 
0021 #include "DataFormats/RPCRecHit/interface/RPCRecHitCollection.h"
0022 #include <DataFormats/MuonDetId/interface/RPCDetId.h>
0023 #include "Geometry/RPCGeometry/interface/RPCGeometry.h"
0024 
0025 //DT geometry
0026 #include <Geometry/Records/interface/MuonGeometryRecord.h>
0027 #include "Geometry/DTGeometry/interface/DTGeometry.h"
0028 #include "Geometry/DTGeometry/interface/DTLayer.h"
0029 #include "DataFormats/MuonDetId/interface/DTWireId.h"
0030 #include "DQM/DTMonitorModule/interface/DTTrigGeomUtils.h"
0031 
0032 #include "L1Trigger/DTTriggerPhase2/interface/constants.h"
0033 
0034 struct RPCMetaprimitive {
0035   RPCDetId rpc_id;
0036   const RPCRecHit* rpc_cluster;
0037   GlobalPoint global_position;
0038   int rpcFlag;
0039   int rpc_bx;
0040   double rpc_t0;
0041   RPCMetaprimitive(RPCDetId rpc_id_construct,
0042                    const RPCRecHit* rpc_cluster_construct,
0043                    GlobalPoint global_position_construct,
0044                    int rpcFlag_construct,
0045                    int rpc_bx_construct,
0046                    double rpc_t0_construct)
0047       : rpc_id(rpc_id_construct),
0048         rpc_cluster(rpc_cluster_construct),
0049         global_position(global_position_construct),
0050         rpcFlag(rpcFlag_construct),
0051         rpc_bx(rpc_bx_construct),
0052         rpc_t0(rpc_t0_construct) {}
0053 };
0054 
0055 class RPCIntegrator {
0056 public:
0057   RPCIntegrator(const edm::ParameterSet& pset, edm::ConsumesCollector& iC);
0058   ~RPCIntegrator();
0059 
0060   void initialise(const edm::EventSetup& iEventSetup, double shift_back_fromDT);
0061   void finish();
0062 
0063   void prepareMetaPrimitives(edm::Handle<RPCRecHitCollection> rpcRecHits);
0064   void matchWithDTAndUseRPCTime(std::vector<cmsdt::metaPrimitive>& dt_metaprimitives);
0065   void makeRPCOnlySegments();
0066   void storeRPCSingleHits();
0067   void removeRPCHitsUsed();
0068 
0069   RPCMetaprimitive* matchDTwithRPC(cmsdt::metaPrimitive* dt_metaprimitive);
0070   L1Phase2MuDTPhDigi createL1Phase2MuDTPhDigi(
0071       RPCDetId rpcDetId, int rpc_bx, double rpc_time, double rpc_global_phi, double phiB, int rpc_flag);
0072 
0073   double phiBending(RPCMetaprimitive* rpc_hit_1, RPCMetaprimitive* rpc_hit_2);
0074   int phiInDTTPFormat(double rpc_global_phi, int rpcSector);
0075   GlobalPoint RPCGlobalPosition(RPCDetId rpcId, const RPCRecHit& rpcIt) const;
0076   double phi_DT_MP_conv(double rpc_global_phi, int rpcSector);
0077   bool hasPosRF_rpc(int wh, int sec) const;
0078 
0079   std::vector<L1Phase2MuDTPhDigi> rpcRecHits_translated_;
0080   std::vector<RPCMetaprimitive> RPCMetaprimitives_;
0081 
0082 private:
0083   const bool m_debug_;
0084   int m_max_quality_to_overwrite_t0_;
0085   int m_bx_window_;
0086   double m_phi_window_;
0087   bool m_storeAllRPCHits_;
0088   edm::ESGetToken<DTGeometry, MuonGeometryRecord> dtGeomH_;
0089   edm::ESGetToken<RPCGeometry, MuonGeometryRecord> rpcGeomH_;
0090 
0091   DTGeometry const* dtGeo_;
0092   RPCGeometry const* rpcGeo_;
0093 
0094   // Constant geometry values
0095   //R[stat][layer] - radius of rpc station/layer from center of CMS
0096   static constexpr double R_[2][2] = {{410.0, 444.8}, {492.7, 527.3}};
0097   static constexpr double distance_between_two_rpc_layers_ = 35;  // in cm
0098 
0099   double shift_back_;
0100 };
0101 #endif