Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-07-27 14:07:45

0001 #ifndef __L1TMuon_GeometryTranslator_h__
0002 #define __L1TMuon_GeometryTranslator_h__
0003 //
0004 // Class: L1TMuon::GeometryTranslator
0005 //
0006 // Info: This class implements a the translations from packed bits or
0007 //       digi information into local or global CMS coordinates for all
0008 //       types of L1 trigger primitives that we want to consider for
0009 //       use in the integrated muon trigger.
0010 //
0011 // Note: This should be considered as a base class to some sort of global
0012 //       look-up table
0013 //
0014 // Author: L. Gray (FNAL)
0015 // Some pieces of code lifted from: Matt Carver & Bobby Scurlock (UF)
0016 //
0017 
0018 #include <memory>
0019 
0020 #include "FWCore/Framework/interface/ESHandle.h"
0021 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0022 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0023 #include "Geometry/Records/interface/MuonGeometryRecord.h"
0024 
0025 // Forward declarations
0026 namespace edm {
0027   class EventSetup;
0028   class ConsumesCollector;
0029 }  // namespace edm
0030 
0031 class DTGeometry;
0032 class CSCGeometry;
0033 class CSCLayer;
0034 class RPCGeometry;
0035 class GEMGeometry;
0036 class ME0Geometry;
0037 class MagneticField;
0038 
0039 namespace L1TMuon {
0040 
0041   // Forward declaration
0042   class TriggerPrimitive;
0043 
0044   class GeometryTranslator {
0045   public:
0046     GeometryTranslator(edm::ConsumesCollector);
0047     ~GeometryTranslator();
0048 
0049     double calculateGlobalEta(const TriggerPrimitive&) const;
0050     double calculateGlobalPhi(const TriggerPrimitive&) const;
0051     double calculateBendAngle(const TriggerPrimitive&) const;
0052 
0053     GlobalPoint getGlobalPoint(const TriggerPrimitive&) const;
0054 
0055     void checkAndUpdateGeometry(const edm::EventSetup&);
0056 
0057     const DTGeometry& getDTGeometry() const { return *_geodt; }
0058     const CSCGeometry& getCSCGeometry() const { return *_geocsc; }
0059     const RPCGeometry& getRPCGeometry() const { return *_georpc; }
0060     const GEMGeometry& getGEMGeometry() const { return *_geogem; }
0061     const ME0Geometry& getME0Geometry() const { return *_geome0; }
0062 
0063     const MagneticField& getMagneticField() const { return *_magfield; }
0064 
0065   private:
0066     unsigned long long _geom_cache_id;
0067     edm::ESHandle<DTGeometry> _geodt;
0068     edm::ESHandle<CSCGeometry> _geocsc;
0069     edm::ESHandle<RPCGeometry> _georpc;
0070     edm::ESHandle<GEMGeometry> _geogem;
0071     edm::ESHandle<ME0Geometry> _geome0;
0072 
0073     edm::ESGetToken<DTGeometry, MuonGeometryRecord> geodtToken_;
0074     edm::ESGetToken<CSCGeometry, MuonGeometryRecord> geocscToken_;
0075     edm::ESGetToken<RPCGeometry, MuonGeometryRecord> georpcToken_;
0076     edm::ESGetToken<GEMGeometry, MuonGeometryRecord> geogemToken_;
0077     edm::ESGetToken<ME0Geometry, MuonGeometryRecord> geome0Token_;
0078 
0079     unsigned long long _magfield_cache_id;
0080     edm::ESHandle<MagneticField> _magfield;
0081     edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magfieldToken_;
0082 
0083     GlobalPoint getME0SpecificPoint(const TriggerPrimitive&) const;
0084     double calcME0SpecificEta(const TriggerPrimitive&) const;
0085     double calcME0SpecificPhi(const TriggerPrimitive&) const;
0086     double calcME0SpecificBend(const TriggerPrimitive&) const;
0087 
0088     GlobalPoint getGEMSpecificPoint(const TriggerPrimitive&) const;
0089     double calcGEMSpecificEta(const TriggerPrimitive&) const;
0090     double calcGEMSpecificPhi(const TriggerPrimitive&) const;
0091     double calcGEMSpecificBend(const TriggerPrimitive&) const;
0092 
0093     GlobalPoint getRPCSpecificPoint(const TriggerPrimitive&) const;
0094     double calcRPCSpecificEta(const TriggerPrimitive&) const;
0095     double calcRPCSpecificPhi(const TriggerPrimitive&) const;
0096     double calcRPCSpecificBend(const TriggerPrimitive&) const;
0097 
0098     GlobalPoint getCSCSpecificPoint(const TriggerPrimitive&) const;
0099     double calcCSCSpecificEta(const TriggerPrimitive&) const;
0100     double calcCSCSpecificPhi(const TriggerPrimitive&) const;
0101     double calcCSCSpecificBend(const TriggerPrimitive&) const;
0102     bool isCSCCounterClockwise(const std::unique_ptr<const CSCLayer>&) const;
0103 
0104     GlobalPoint calcDTSpecificPoint(const TriggerPrimitive&) const;
0105     double calcDTSpecificEta(const TriggerPrimitive&) const;
0106     double calcDTSpecificPhi(const TriggerPrimitive&) const;
0107     double calcDTSpecificBend(const TriggerPrimitive&) const;
0108   };
0109 
0110 }  // namespace L1TMuon
0111 
0112 #endif