Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:15:15

0001 // Author: Aurora Perego, Fabio Cossutti - aurora.perego@cern.ch, fabio.cossutti@ts.infn.it
0002 // Date: 05/2023
0003 
0004 #ifndef __RecoLocalFastTime_FTLCommonAlgos_MTDGeomUtil_h__
0005 #define __RecoLocalFastTime_FTLCommonAlgos_MTDGeomUtil_h__
0006 
0007 #include "DataFormats/GeometryVector/interface/GlobalPoint.h"
0008 #include "DataFormats/GeometryVector/interface/LocalPoint.h"
0009 #include "DataFormats/ForwardDetId/interface/BTLDetId.h"
0010 #include "DataFormats/ForwardDetId/interface/ETLDetId.h"
0011 
0012 #include "Geometry/MTDGeometryBuilder/interface/MTDGeometry.h"
0013 #include "Geometry/MTDGeometryBuilder/interface/ProxyMTDTopology.h"
0014 #include "Geometry/MTDGeometryBuilder/interface/RectangularMTDTopology.h"
0015 #include "Geometry/MTDNumberingBuilder/interface/MTDTopology.h"
0016 
0017 namespace edm {
0018   class Event;
0019   class EventSetup;
0020 }  // namespace edm
0021 
0022 namespace mtd {
0023   class MTDGeomUtil {
0024   public:
0025     MTDGeomUtil() : geom_(nullptr), topology_(nullptr) {}
0026     ~MTDGeomUtil() {}
0027 
0028     void setGeometry(MTDGeometry const* geom);
0029     void setTopology(MTDTopology const* topo);
0030 
0031     bool isETL(const DetId&) const;
0032     bool isBTL(const DetId&) const;
0033 
0034     std::pair<LocalPoint, GlobalPoint> position(const DetId& id, int row = 0, int column = 0) const;
0035     GlobalPoint globalPosition(const DetId& id, const LocalPoint& local_point) const;
0036 
0037     // zside returns +/- 1
0038     int zside(const DetId& id) const;
0039 
0040     unsigned int layer(const DetId&) const;
0041     int module(const DetId&) const;
0042     std::pair<float, float> pixelInModule(const DetId& id, const int row, const int column) const;
0043     std::pair<uint8_t, uint8_t> pixelInModule(const DetId& id, const LocalPoint& local_point) const;
0044     int crystalInModule(const DetId&) const;
0045 
0046     uint32_t sensorModuleId(const DetId& id) const;
0047 
0048     // 4-vector helper functions using GlobalPoint
0049     float eta(const GlobalPoint& position, const float& vertex_z = 0.) const;
0050     float phi(const GlobalPoint& position) const;
0051     float pt(const GlobalPoint& position, const float& hitEnergy, const float& vertex_z = 0.) const;
0052 
0053     // 4-vector helper functions using DetId
0054     float eta(const DetId& id, const LocalPoint& local_point, const float& vertex_z = 0.) const;
0055     float phi(const DetId& id, const LocalPoint& local_point) const;
0056     float pt(const DetId& id, const LocalPoint& local_point, const float& hitEnergy, const float& vertex_z = 0.) const;
0057 
0058     inline const MTDGeometry* geometry() const { return geom_; };
0059     inline const MTDTopology* topology() const { return topology_; };
0060 
0061   private:
0062     const MTDGeometry* geom_;
0063     const MTDTopology* topology_;
0064   };
0065 }  // namespace mtd
0066 
0067 #endif