17 const std::map<std::string, fastsim::InteractionModel *> &interactionModelMap,
18 double magneticFieldHistMaxR,
19 double magneticFieldHistMaxZ)
20 : geometricSearchTracker_(geometricSearchTracker),
22 interactionModelMap_(&interactionModelMap),
23 magneticFieldHistMaxR_(magneticFieldHistMaxR),
24 magneticFieldHistMaxZ_(magneticFieldHistMaxZ) {
41 std::unique_ptr<fastsim::SimplifiedGeometry>
layer = createSimplifiedGeometry(
BARREL,
cfg);
42 return std::unique_ptr<fastsim::BarrelSimplifiedGeometry>(
48 if (layerType != NEGFWD && layerType != POSFWD) {
49 throw cms::Exception(
"fastsim::SimplifiedGeometry::createForwardLayer")
50 <<
" called with forbidden layerType. Allowed layerTypes are NEGFWD and POSFWD";
52 std::unique_ptr<fastsim::SimplifiedGeometry>
layer = createSimplifiedGeometry(layerType,
cfg);
53 return std::unique_ptr<fastsim::ForwardSimplifiedGeometry>(
61 bool isOnPositiveSide =
false;
64 }
else if (layerType == POSFWD) {
65 isOnPositiveSide =
true;
75 if (!detLayerName.empty() && geometricSearchTracker_) {
77 detLayerName = (isOnPositiveSide ?
"pos" :
"neg") + detLayerName;
79 detLayer =
getDetLayer(detLayerName, *geometricSearchTracker_);
89 if (
cfg.exists(positionParameterName)) {
90 position = fabs(
cfg.getUntrackedParameter<
double>(positionParameterName));
106 cfg.allToString(cfgString);
108 <<
"Cannot extract a " << (
isForward ?
"position" :
"radius") <<
" for this " 109 << (
isForward ?
"forward" :
"barrel") <<
" layer:\n" 117 std::unique_ptr<fastsim::SimplifiedGeometry>
layer;
119 layer = std::make_unique<fastsim::ForwardSimplifiedGeometry>(
position);
121 layer = std::make_unique<fastsim::BarrelSimplifiedGeometry>(
position);
123 layer->detLayer_ = detLayer;
130 const std::vector<double> &
limits =
cfg.getUntrackedParameter<std::vector<double> >(
"limits");
135 cfg.allToString(cfgString);
137 <<
"limits must be provided in increasing order. error in:\n" 142 const std::vector<double> &
thickness =
cfg.getUntrackedParameter<std::vector<double> >(
"thickness");
146 cfg.allToString(cfgString);
148 <<
"layer thickness and limits not configured properly! error in:" << cfgString;
151 layer->thicknessHist_ = std::make_unique<TH1F>(
"h",
"h",
limits.size() - 1, &
limits[0]);
152 layer->thicknessHist_->SetDirectory(
nullptr);
153 for (
unsigned i = 1;
i <
limits.size(); ++
i) {
161 layer->nuclearInteractionThicknessFactor_ =
162 cfg.getUntrackedParameter<
double>(
"nuclearInteractionThicknessFactor", 1.);
168 layer->magneticFieldHist_ =
169 std::make_unique<TH1F>(
"h",
"h", 100, 0.,
isForward ? magneticFieldHistMaxR_ : magneticFieldHistMaxZ_);
170 layer->magneticFieldHist_->SetDirectory(
nullptr);
171 for (
int i = 1;
i <= 101;
i++) {
174 layer->magneticFieldHist_->SetBinContent(
i, magneticField_->inTesla(
point).z());
181 std::vector<std::string> interactionModelLabels =
182 cfg.getUntrackedParameter<std::vector<std::string> >(
"interactionModels");
183 for (
const auto &
label : interactionModelLabels) {
184 std::map<std::string, fastsim::InteractionModel *>::const_iterator interactionModel =
185 interactionModelMap_->find(
label);
186 if (interactionModel == interactionModelMap_->end()) {
187 throw cms::Exception(
"fastsim::SimplifiedGeometryFactory") <<
"unknown interaction model '" <<
label <<
"'";
189 layer->interactionModels_.push_back(interactionModel->second);
196 if (
cfg.exists(
"caloType")) {
201 }
else if (
caloType ==
"PRESHOWER2") {
211 <<
"unknown caloType '" <<
caloType <<
"' (defined PRESHOWER1, PRESHOWER2, ECAL, HCAL, VFCAL)";
224 if (detLayerName.empty()) {
229 unsigned pos = detLayerName.size();
230 while (isdigit(detLayerName[
pos - 1])) {
233 if (
pos == detLayerName.size()) {
235 <<
"last part of detLayerName must be index of DetLayer in list. Error in detLayerName" << detLayerName
238 int index = atoi(detLayerName.substr(
pos).c_str());
243 if (barrelDetLayersMap_.find(detLayerListName) != barrelDetLayersMap_.end()) {
244 auto detLayerList = barrelDetLayersMap_.find(detLayerListName)->second;
245 return detLayerList->at(
index - 1);
249 else if (forwardDetLayersMap_.find(detLayerListName) != forwardDetLayersMap_.end()) {
250 auto detLayerList = forwardDetLayersMap_.find(detLayerListName)->second;
251 return detLayerList->at(
index - 1);
256 <<
" could not find list of detLayers corresponding to detLayerName " << detLayerName << std::endl;
258 }
catch (
const std::out_of_range &
error) {
260 <<
" index out of range for detLayerName: " << detLayerName <<
" " <<
error.what() << std::endl;
Implementation of a forward detector layer (disk).
std::vector< ForwardDetLayer const * > const & posTecLayers() const
std::map< std::string, const std::vector< BarrelDetLayer const * > * > barrelDetLayersMap_
A map of strings and pointers to detLayers.
virtual const Surface::PositionType & position() const
Returns position of the surface.
Global3DPoint GlobalPoint
bool isForward(DetId const &)
Implementation of a barrel detector layer (cylindrical).
std::vector< ForwardDetLayer const * > const & posPixelForwardLayers() const
constexpr std::array< uint8_t, layerIndexSize > layer
std::unique_ptr< ForwardSimplifiedGeometry > createForwardSimplifiedGeometry(LayerType type, const edm::ParameterSet &cfg) const
Helper method for createSimplifiedGeometry(..) to create a forward layer (ForwardSimplifiedGeometry)...
const DetLayer * getDetLayer(const std::string &detLayerName, const GeometricSearchTracker &geometricSearchTracker) const
Method returns a pointer to a DetLayer according to the string that was passed.
std::vector< ForwardDetLayer const * > const & negPixelForwardLayers() const
DetLayer getDetLayer(DetId detId, const TrackerTopology *tTopo)
const GeometricSearchTracker *const geometricSearchTracker_
The full tracker geometry.
std::vector< ForwardDetLayer const * > const & negTidLayers() const
std::vector< BarrelDetLayer const * > const & pixelBarrelLayers() const
std::vector< ForwardDetLayer const * > const & posTidLayers() const
std::vector< BarrelDetLayer const * > const & tibLayers() const
std::map< std::string, const std::vector< ForwardDetLayer const * > * > forwardDetLayersMap_
A map of strings and pointers to detLayers.
static int position[264][3]
std::vector< BarrelDetLayer const * > const & tobLayers() const
std::unique_ptr< BarrelSimplifiedGeometry > createBarrelSimplifiedGeometry(const edm::ParameterSet &cfg) const
Helper method for createSimplifiedGeometry(..) to create a barrel layer (BarrelSimplifiedGeometry).
std::unique_ptr< SimplifiedGeometry > createSimplifiedGeometry(LayerType type, const edm::ParameterSet &cfg) const
Main method of this class. Creates a new detector layer (SimplifiedGeometry).
std::vector< ForwardDetLayer const * > const & negTecLayers() const
SimplifiedGeometryFactory(const GeometricSearchTracker *geometricSearchTracker, const MagneticField &magneticField, const std::map< std::string, fastsim::InteractionModel *> &interactionModelMap, double magneticFieldHistMaxR, double magneticFieldHistMaxZ)
Constructor.
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
LayerType
Each layer is either a barrel layer, or a forward layer (either at ppositive or negative Z)...