Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:30:42

0001 #ifndef L1Trigger_TrackFindingTMTT_TrackerModule_h
0002 #define L1Trigger_TrackFindingTMTT_TrackerModule_h
0003 
0004 #include "DataFormats/DetId/interface/DetId.h"
0005 #include "DataFormats/Common/interface/Ref.h"
0006 #include "DataFormats/Common/interface/DetSetVector.h"
0007 #include "FWCore/Framework/interface/Frameworkfwd.h"
0008 
0009 #include <vector>
0010 #include <set>
0011 #include <array>
0012 #include <map>
0013 #include <cmath>
0014 
0015 class TrackerGeometry;
0016 class TrackerTopology;
0017 class PixelGeomDetUnit;
0018 class PixelTopology;
0019 
0020 namespace tmtt {
0021 
0022   //=== Get info about tracker module
0023 
0024   class TrackerModule {
0025   public:
0026     enum BarrelModuleType { tiltedMinusZ = 1, tiltedPlusZ = 2, flat = 3 };
0027 
0028     // Info used to define firmware module type.
0029     struct ModuleTypeCfg {
0030       std::vector<double> pitchVsType;
0031       std::vector<double> spaceVsType;
0032       std::vector<bool> barrelVsType;
0033       std::vector<bool> psVsType;
0034       std::vector<bool> tiltedVsType;
0035     };
0036 
0037     // Here detId is ID of lower sensor in stacked module.
0038     TrackerModule(const TrackerGeometry* trackerGeometry,
0039                   const TrackerTopology* trackerTopology,
0040                   const ModuleTypeCfg& moduleTypeCfg,
0041                   const DetId& detId);
0042 
0043     // Det ID of lower sensor in stacked module.
0044     const DetId& detId() const { return detId_; }
0045     unsigned int rawDetId() const { return detId_.rawId(); }
0046     // Det ID of stacked module.
0047     const DetId& stackedDetId() const { return stackedDetId_; }
0048     unsigned int rawStackedDetId() const { return stackedDetId_.rawId(); }
0049     // Tracker specific DetUnit & topology.
0050     const PixelGeomDetUnit* specDet() const { return specDet_; }
0051     const PixelTopology* specTopol() const { return specTopol_; }
0052     // Coordinates of centre of two sensors in (r,phi,z)
0053     float minR() const { return moduleMinR_; }
0054     float maxR() const { return moduleMaxR_; }
0055     float minPhi() const { return moduleMinPhi_; }
0056     float maxPhi() const { return moduleMaxPhi_; }
0057     float minZ() const { return moduleMinZ_; }
0058     float maxZ() const { return moduleMaxZ_; }
0059     // Polar angle of module.
0060     float theta() const { return atan2(moduleMinR_, moduleMinZ_); }
0061     // Which of two sensors in module is furthest from beam-line?
0062     bool outerModuleAtSmallerR() const { return outerModuleAtSmallerR_; }
0063     // Module type: PS or 2S?
0064     bool psModule() const { return psModule_; }
0065     bool barrel() const { return barrel_; }
0066     // Tracker layer ID number (1-6 = barrel layer; 11-15 = endcap A disk; 21-25 = endcap B disk)
0067     unsigned int layerId() const { return layerId_; }
0068     // Reduced layer ID (in range 1-7), for  packing into 3 bits to simplify the firmware.
0069     unsigned int layerIdReduced() const { return layerIdReduced_; }
0070     // Endcap ring of module (returns zero in case of barrel)
0071     unsigned int endcapRing() const { return endcapRing_; }
0072     // True if stub is in tilted barrel module.
0073     bool tiltedBarrel() const { return tiltedBarrel_; }
0074     // Angle between normal to module and beam-line along +ve z axis. (In range -PI/2 to +PI/2).
0075     float tiltAngle() const { return tiltAngle_; }
0076     // Width of sensitive region of sensor.
0077     float sensorWidth() const { return sensorWidth_; }
0078     // Sensor spacing in module
0079     float sensorSpacing() const { return sensorSpacing_; }
0080     // No. of strips in sensor.
0081     unsigned int nStrips() const { return nStrips_; }
0082     // Strip pitch (or pixel pitch along shortest axis).
0083     float stripPitch() const { return stripPitch_; }
0084     // Strip length (or pixel pitch along longest axis).
0085     float stripLength() const { return stripLength_; }
0086     // Hit resolution perpendicular to strip (or to longest pixel axis). Measures phi.
0087     float sigmaPerp() const { return invRoot12 * stripPitch_; }
0088     // Hit resolution parallel to strip (or to longest pixel axis). Measures r or z.
0089     float sigmaPar() const { return invRoot12 * stripLength_; }
0090     // Sensor pitch over separation.
0091     float pitchOverSep() const { return stripPitch_ / sensorSpacing_; }
0092     // "B" parameter correction for module tilt.
0093     float paramB() const { return std::abs(cos(theta() - tiltAngle()) / sin(theta())); }
0094     // Module type ID defined by firmware.
0095     unsigned int moduleTypeID() const { return moduleTypeID_; }
0096 
0097     //--- Utilties
0098 
0099     // Calculate reduced layer ID (in range 1-7), for  packing into 3 bits to simplify the firmware.
0100     static unsigned int calcLayerIdReduced(unsigned int layerId);
0101 
0102     // Get module type ID defined by firmware.
0103     unsigned int calcModuleType(float pitch, float space, bool barrel, bool tiltedBarrel, bool psModule) const;
0104 
0105   private:
0106     DetId detId_;
0107     DetId stackedDetId_;
0108     const PixelGeomDetUnit* specDet_;
0109     const PixelTopology* specTopol_;
0110     float moduleMinR_;
0111     float moduleMaxR_;
0112     float moduleMinPhi_;
0113     float moduleMaxPhi_;
0114     float moduleMinZ_;
0115     float moduleMaxZ_;
0116     bool outerModuleAtSmallerR_;
0117     bool psModule_;
0118     bool barrel_;
0119     unsigned int layerId_;
0120     unsigned int layerIdReduced_;
0121     unsigned int endcapRing_;
0122     bool tiltedBarrel_;
0123     float tiltAngle_;
0124     float sensorWidth_;
0125     float sensorSpacing_;
0126     unsigned int nStrips_;
0127     float stripPitch_;
0128     float stripLength_;
0129     unsigned int moduleTypeID_;
0130 
0131     ModuleTypeCfg moduleTypeCfg_;
0132 
0133     static const float invRoot12;
0134   };
0135 
0136 }  // namespace tmtt
0137 #endif