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>(
43 static_cast<fastsim::BarrelSimplifiedGeometry *>(layer.release()));
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>(
54 static_cast<fastsim::ForwardSimplifiedGeometry *>(layer.release()));
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));
98 position = static_cast<ForwardDetLayer const *>(detLayer)->surface().position().z();
100 position = static_cast<BarrelDetLayer const *>(detLayer)->specificSurface().radius();
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) {
154 layer->thicknessHist_->SetBinContent(
i,
thickness[
i - 1]);
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;