Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-08-09 03:15:12

0001 #ifndef __L1Trigger_L1THGCal_HGCalTriggerGeometryBase_h__
0002 #define __L1Trigger_L1THGCal_HGCalTriggerGeometryBase_h__
0003 
0004 #include <iostream>
0005 #include <unordered_map>
0006 #include <unordered_set>
0007 
0008 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0009 
0010 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0011 #include "Geometry/CaloTopology/interface/HGCalTopology.h"
0012 #include "Geometry/HGCalGeometry/interface/HGCalGeometry.h"
0013 
0014 // Pure virtual trigger geometry class
0015 // Provides the interface to access trigger cell and module mappings
0016 class HGCalTriggerGeometryBase {
0017 public:
0018   typedef std::unordered_map<unsigned, unsigned> geom_map;
0019   typedef std::unordered_set<unsigned> geom_set;
0020   typedef std::set<unsigned> geom_ordered_set;
0021 
0022   HGCalTriggerGeometryBase(const edm::ParameterSet& conf);
0023   virtual ~HGCalTriggerGeometryBase() {}
0024 
0025   const std::string& name() const { return name_; }
0026 
0027   bool isWithNoseGeometry() const { return isNose_; }
0028 
0029   const HGCalGeometry* noseGeometry() const { return hgc_nose_geometry_; }
0030   const HGCalGeometry* eeGeometry() const { return hgc_ee_geometry_; }
0031   const HGCalGeometry* fhGeometry() const { return hgc_hsi_geometry_; }
0032   const HGCalGeometry* hsiGeometry() const { return fhGeometry(); }
0033   const HGCalGeometry* hscGeometry() const { return hgc_hsc_geometry_; }
0034   const HGCalTopology& noseTopology() const { return noseGeometry()->topology(); }
0035   const HGCalTopology& eeTopology() const { return eeGeometry()->topology(); }
0036   const HGCalTopology& fhTopology() const { return fhGeometry()->topology(); }
0037   const HGCalTopology& hsiTopology() const { return hsiGeometry()->topology(); }
0038   const HGCalTopology& hscTopology() const { return hscGeometry()->topology(); }
0039 
0040   void setWithNoseGeometry(const bool isNose) { isNose_ = isNose; }
0041 
0042   // non-const access to the geometry class
0043   virtual void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) = 0;
0044   virtual void initialize(const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*, const HGCalGeometry*) = 0;
0045   virtual void reset();
0046 
0047   // const access to the geometry class
0048   virtual unsigned getTriggerCellFromCell(const unsigned cell_det_id) const = 0;
0049   virtual unsigned getModuleFromCell(const unsigned cell_det_id) const = 0;
0050   virtual unsigned getModuleFromTriggerCell(const unsigned trigger_cell_det_id) const = 0;
0051 
0052   virtual geom_set getCellsFromTriggerCell(const unsigned cell_det_id) const = 0;
0053   virtual geom_set getCellsFromModule(const unsigned cell_det_id) const = 0;
0054   virtual geom_set getTriggerCellsFromModule(const unsigned trigger_cell_det_id) const = 0;
0055 
0056   virtual geom_set getStage1FpgasFromStage2Fpga(const unsigned stage2_id) const = 0;
0057   virtual geom_set getStage2FpgasFromStage1Fpga(const unsigned stage1_id) const = 0;
0058 
0059   virtual geom_set getStage1LinksFromStage2Fpga(const unsigned) const = 0;
0060   virtual unsigned getStage1FpgaFromStage1Link(const unsigned) const = 0;
0061   virtual unsigned getStage2FpgaFromStage1Link(const unsigned) const = 0;
0062   virtual geom_set getStage1LinksFromStage1Fpga(const unsigned) const = 0;
0063   virtual geom_set getLpgbtsFromStage1Fpga(const unsigned stage1_id) const = 0;
0064   virtual unsigned getStage1FpgaFromLpgbt(const unsigned lpgbt_id) const = 0;
0065   virtual geom_set getModulesFromLpgbt(const unsigned lpgbt_id) const = 0;
0066   virtual geom_set getLpgbtsFromModule(const unsigned module_id) const = 0;
0067   virtual unsigned getStage1FpgaFromModule(const unsigned module_id) const = 0;
0068 
0069   virtual geom_ordered_set getOrderedCellsFromModule(const unsigned cell_det_id) const = 0;
0070   virtual geom_ordered_set getOrderedTriggerCellsFromModule(const unsigned trigger_cell_det_id) const = 0;
0071 
0072   virtual geom_set getNeighborsFromTriggerCell(const unsigned trigger_cell_det_id) const = 0;
0073 
0074   virtual unsigned getLinksInModule(const unsigned module_id) const = 0;
0075   virtual unsigned getModuleSize(const unsigned module_id) const = 0;
0076 
0077   virtual GlobalPoint getTriggerCellPosition(const unsigned trigger_cell_det_id) const = 0;
0078   virtual GlobalPoint getModulePosition(const unsigned module_det_id) const = 0;
0079 
0080   virtual bool validCell(const unsigned cell_id) const = 0;
0081   virtual bool validTriggerCell(const unsigned trigger_cell_id) const = 0;
0082   virtual bool disconnectedModule(const unsigned module_id) const = 0;
0083   virtual unsigned lastTriggerLayer() const = 0;
0084   virtual unsigned triggerLayer(const unsigned id) const = 0;
0085 
0086 protected:
0087   void setEEGeometry(const HGCalGeometry* geom) { hgc_ee_geometry_ = geom; }
0088   void setHSiGeometry(const HGCalGeometry* geom) { hgc_hsi_geometry_ = geom; }
0089   void setHScGeometry(const HGCalGeometry* geom) { hgc_hsc_geometry_ = geom; }
0090   void setNoseGeometry(const HGCalGeometry* geom) { hgc_nose_geometry_ = geom; }
0091 
0092 private:
0093   const std::string name_;
0094 
0095   bool isNose_ = false;
0096   const HGCalGeometry* hgc_ee_geometry_ = nullptr;
0097   const HGCalGeometry* hgc_hsi_geometry_ = nullptr;
0098   const HGCalGeometry* hgc_hsc_geometry_ = nullptr;
0099   const HGCalGeometry* hgc_nose_geometry_ = nullptr;
0100 };
0101 
0102 #include "FWCore/PluginManager/interface/PluginFactory.h"
0103 typedef edmplugin::PluginFactory<HGCalTriggerGeometryBase*(const edm::ParameterSet&)> HGCalTriggerGeometryFactory;
0104 
0105 #endif