File indexing completed on 2024-04-06 12:11:20
0001 #ifndef FASTSIM_GEOMETRY_H
0002 #define FASTSIM_GEOMETRY_H
0003
0004 #include "DataFormats/Math/interface/LorentzVector.h"
0005 #include "FastSimulation/SimplifiedGeometryPropagator/interface/ForwardSimplifiedGeometry.h"
0006 #include "FastSimulation/SimplifiedGeometryPropagator/interface/BarrelSimplifiedGeometry.h"
0007 #include "FWCore/Framework/interface/FrameworkfwdMostUsed.h"
0008 #include "FWCore/ParameterSet/interface/ParameterSet.h"
0009 #include "FWCore/Utilities/interface/ESGetToken.h"
0010 #include "MagneticField/Engine/interface/MagneticField.h"
0011 #include "MagneticField/Records/interface/IdealMagneticFieldRecord.h"
0012 #include "RecoTracker/Record/interface/TrackerRecoGeometryRecord.h"
0013 #include "RecoTracker/TkDetLayers/interface/GeometricSearchTracker.h"
0014
0015
0016
0017
0018
0019
0020 #include <vector>
0021
0022 namespace fastsim {
0023 class InteractionModel;
0024
0025
0026
0027
0028
0029
0030 class Geometry {
0031 public:
0032
0033 Geometry(const edm::ParameterSet&, edm::ConsumesCollector&&);
0034
0035
0036 ~Geometry();
0037
0038
0039
0040
0041
0042
0043
0044
0045 void update(const edm::EventSetup& iSetup, const std::map<std::string, InteractionModel*>& interactionModelMap);
0046
0047
0048
0049
0050
0051
0052
0053 double getMagneticFieldZ(const math::XYZTLorentzVector& position) const;
0054
0055
0056
0057
0058
0059
0060 const std::vector<std::unique_ptr<BarrelSimplifiedGeometry>>& barrelLayers() const { return barrelLayers_; }
0061
0062
0063
0064
0065
0066
0067 const std::vector<std::unique_ptr<ForwardSimplifiedGeometry>>& forwardLayers() const { return forwardLayers_; }
0068
0069
0070
0071
0072
0073
0074 double getMaxRadius() { return maxRadius_; }
0075
0076
0077
0078
0079
0080
0081 double getMaxZ() { return maxZ_; }
0082
0083
0084 friend std::ostream& operator<<(std::ostream& o, const fastsim::Geometry& geometry);
0085
0086
0087
0088
0089
0090
0091
0092 const BarrelSimplifiedGeometry* nextLayer(const BarrelSimplifiedGeometry* layer) const {
0093 if (layer == nullptr) {
0094 return nullptr;
0095 }
0096 unsigned nextLayerIndex = layer->index() + 1;
0097 return nextLayerIndex < barrelLayers_.size() ? barrelLayers_[nextLayerIndex].get() : nullptr;
0098 }
0099
0100
0101
0102
0103
0104
0105
0106 const ForwardSimplifiedGeometry* nextLayer(const ForwardSimplifiedGeometry* layer) const {
0107 if (layer == nullptr) {
0108 return nullptr;
0109 }
0110 unsigned nextLayerIndex = layer->index() + 1;
0111 return nextLayerIndex < forwardLayers_.size() ? forwardLayers_[nextLayerIndex].get() : nullptr;
0112 }
0113
0114
0115
0116
0117
0118
0119
0120 const BarrelSimplifiedGeometry* previousLayer(const BarrelSimplifiedGeometry* layer) const {
0121 if (layer == nullptr) {
0122 return barrelLayers_.back().get();
0123 }
0124 return layer->index() > 0 ? barrelLayers_[layer->index() - 1].get() : nullptr;
0125 }
0126
0127
0128
0129
0130
0131
0132
0133 const ForwardSimplifiedGeometry* previousLayer(const ForwardSimplifiedGeometry* layer) const {
0134 if (layer == nullptr) {
0135 return forwardLayers_.back().get();
0136 }
0137 return layer->index() > 0 ? forwardLayers_[layer->index() - 1].get() : nullptr;
0138 }
0139
0140 private:
0141 std::vector<std::unique_ptr<BarrelSimplifiedGeometry>>
0142 barrelLayers_;
0143 std::vector<std::unique_ptr<ForwardSimplifiedGeometry>>
0144 forwardLayers_;
0145 std::unique_ptr<MagneticField>
0146 ownedMagneticField_;
0147
0148 unsigned long long cacheIdentifierTrackerRecoGeometry_;
0149 unsigned long long cacheIdentifierIdealMagneticField_;
0150
0151 const GeometricSearchTracker* geometricSearchTracker_;
0152 const MagneticField* magneticField_;
0153 const bool useFixedMagneticFieldZ_;
0154 const double fixedMagneticFieldZ_;
0155 const bool
0156 useTrackerRecoGeometryRecord_;
0157 const std::string trackerAlignmentLabel_;
0158 const std::vector<edm::ParameterSet>
0159 barrelLayerCfg_;
0160 const std::vector<edm::ParameterSet>
0161 forwardLayerCfg_;
0162 const double maxRadius_;
0163 const double maxZ_;
0164
0165 const bool barrelBoundary_;
0166 const bool forwardBoundary_;
0167 const edm::ParameterSet trackerBarrelBoundaryCfg_;
0168 const edm::ParameterSet trackerForwardBoundaryCfg_;
0169
0170 edm::ESGetToken<GeometricSearchTracker, TrackerRecoGeometryRecord> geometricSearchTrackerESToken_;
0171 edm::ESGetToken<MagneticField, IdealMagneticFieldRecord> magneticFieldESToken_;
0172 };
0173 std::ostream& operator<<(std::ostream& os, const fastsim::Geometry& geometry);
0174 }
0175
0176 #endif