16 const std::map<std::string, fastsim::InteractionModel *> &interactionModelMap,
17 double magneticFieldHistMaxR,
18 double magneticFieldHistMaxZ)
19 : geometricSearchTracker_(geometricSearchTracker),
21 interactionModelMap_(&interactionModelMap),
22 magneticFieldHistMaxR_(magneticFieldHistMaxR),
23 magneticFieldHistMaxZ_(magneticFieldHistMaxZ) {
40 std::unique_ptr<fastsim::SimplifiedGeometry> layer = createSimplifiedGeometry(
BARREL,
cfg);
41 return std::unique_ptr<fastsim::BarrelSimplifiedGeometry>(
42 static_cast<fastsim::BarrelSimplifiedGeometry *>(layer.release()));
47 if (layerType != NEGFWD && layerType != POSFWD) {
48 throw cms::Exception(
"fastsim::SimplifiedGeometry::createForwardLayer")
49 <<
" called with forbidden layerType. Allowed layerTypes are NEGFWD and POSFWD";
51 std::unique_ptr<fastsim::SimplifiedGeometry> layer = createSimplifiedGeometry(layerType,
cfg);
52 return std::unique_ptr<fastsim::ForwardSimplifiedGeometry>(
53 static_cast<fastsim::ForwardSimplifiedGeometry *>(layer.release()));
60 bool isOnPositiveSide =
false;
63 }
else if (layerType == POSFWD) {
64 isOnPositiveSide =
true;
74 if (!detLayerName.empty() && geometricSearchTracker_) {
76 detLayerName = (isOnPositiveSide ?
"pos" :
"neg") + detLayerName;
78 detLayer =
getDetLayer(detLayerName, *geometricSearchTracker_);
88 if (
cfg.exists(positionParameterName)) {
89 position = fabs(
cfg.getUntrackedParameter<
double>(positionParameterName));
97 position = static_cast<ForwardDetLayer const *>(detLayer)->surface().position().z();
99 position = static_cast<BarrelDetLayer const *>(detLayer)->specificSurface().radius();
105 cfg.allToString(cfgString);
107 <<
"Cannot extract a " << (
isForward ?
"position" :
"radius") <<
" for this "
108 << (
isForward ?
"forward" :
"barrel") <<
" layer:\n"
116 std::unique_ptr<fastsim::SimplifiedGeometry> layer;
122 layer->detLayer_ = detLayer;
129 const std::vector<double> &
limits =
cfg.getUntrackedParameter<std::vector<double> >(
"limits");
134 cfg.allToString(cfgString);
136 <<
"limits must be provided in increasing order. error in:\n"
141 const std::vector<double> &
thickness =
cfg.getUntrackedParameter<std::vector<double> >(
"thickness");
145 cfg.allToString(cfgString);
147 <<
"layer thickness and limits not configured properly! error in:" << cfgString;
150 layer->thicknessHist_.reset(
new TH1F(
"h",
"h",
limits.size() - 1, &
limits[0]));
151 layer->thicknessHist_->SetDirectory(
nullptr);
152 for (
unsigned i = 1;
i <
limits.size(); ++
i) {
153 layer->thicknessHist_->SetBinContent(
i,
thickness[
i - 1]);
160 layer->nuclearInteractionThicknessFactor_ =
161 cfg.getUntrackedParameter<
double>(
"nuclearInteractionThicknessFactor", 1.);
167 layer->magneticFieldHist_.reset(
168 new TH1F(
"h",
"h", 100, 0.,
isForward ? magneticFieldHistMaxR_ : magneticFieldHistMaxZ_));
169 layer->magneticFieldHist_->SetDirectory(
nullptr);
170 for (
int i = 1;
i <= 101;
i++) {
173 layer->magneticFieldHist_->SetBinContent(
i, magneticField_->inTesla(
point).z());
180 std::vector<std::string> interactionModelLabels =
181 cfg.getUntrackedParameter<std::vector<std::string> >(
"interactionModels");
182 for (
const auto &
label : interactionModelLabels) {
183 std::map<std::string, fastsim::InteractionModel *>::const_iterator interactionModel =
184 interactionModelMap_->find(
label);
185 if (interactionModel == interactionModelMap_->end()) {
186 throw cms::Exception(
"fastsim::SimplifiedGeometryFactory") <<
"unknown interaction model '" <<
label <<
"'";
188 layer->interactionModels_.push_back(interactionModel->second);
195 if (
cfg.exists(
"caloType")) {
200 }
else if (
caloType ==
"PRESHOWER2") {
210 <<
"unknown caloType '" <<
caloType <<
"' (defined PRESHOWER1, PRESHOWER2, ECAL, HCAL, VFCAL)";
223 if (detLayerName.empty()) {
228 unsigned pos = detLayerName.size();
229 while (isdigit(detLayerName[
pos - 1])) {
232 if (
pos == detLayerName.size()) {
234 <<
"last part of detLayerName must be index of DetLayer in list. Error in detLayerName" << detLayerName
237 int index = atoi(detLayerName.substr(
pos).c_str());
242 if (barrelDetLayersMap_.find(detLayerListName) != barrelDetLayersMap_.end()) {
243 auto detLayerList = barrelDetLayersMap_.find(detLayerListName)->second;
244 return detLayerList->at(
index - 1);
248 else if (forwardDetLayersMap_.find(detLayerListName) != forwardDetLayersMap_.end()) {
249 auto detLayerList = forwardDetLayersMap_.find(detLayerListName)->second;
250 return detLayerList->at(
index - 1);
255 <<
" could not find list of detLayers corresponding to detLayerName " << detLayerName << std::endl;
257 }
catch (
const std::out_of_range &
error) {
259 <<
" index out of range for detLayerName: " << detLayerName <<
" " <<
error.what() << std::endl;