17 const std::map<std::string, fastsim::InteractionModel *> &interactionModelMap,
18 double magneticFieldHistMaxR,
19 double magneticFieldHistMaxZ)
20 : geometricSearchTracker_(geometricSearchTracker),
21 magneticField_(&magneticField),
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_);
88 std::string positionParameterName = (isForward ?
"z" :
"radius");
89 if (cfg.
exists(positionParameterName)) {
91 if (isForward && !isOnPositiveSide) {
100 position =
static_cast<BarrelDetLayer const *
>(detLayer)->specificSurface().radius();
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;
137 <<
"limits must be provided in increasing order. error in:\n"
144 if (limits.size() < 2 || thickness.size() != limits.size() - 1) {
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_ =
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++) {
173 :
GlobalPoint(position, 0., layer->magneticFieldHist_->GetXaxis()->GetBinCenter(
i));
174 layer->magneticFieldHist_->SetBinContent(
i, magneticField_->inTesla(point).z());
181 std::vector<std::string> interactionModelLabels =
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")) {
199 if (caloType ==
"PRESHOWER1") {
201 }
else if (caloType ==
"PRESHOWER2") {
203 }
else if (caloType ==
"ECAL") {
205 }
else if (caloType ==
"HCAL") {
207 }
else if (caloType ==
"VFCAL") {
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());
239 std::string detLayerListName = detLayerName.substr(0, pos);
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;
T getUntrackedParameter(std::string const &, T const &) const
Implementation of a forward detector layer (disk).
std::map< std::string, const std::vector< BarrelDetLayer const * > * > barrelDetLayersMap_
A map of strings and pointers to detLayers.
DetLayer getDetLayer(DetId detId, const TrackerTopology *tTopo)
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 & posPixelForwardLayers() const
Global3DPoint GlobalPoint
bool isForward(DetId const &)
bool exists(std::string const ¶meterName) const
checks if a parameter exists
Implementation of a barrel detector layer (cylindrical).
std::vector< BarrelDetLayer const * > const & tobLayers() const
constexpr std::array< uint8_t, layerIndexSize > layer
SimplifiedGeometryFactory(const GeometricSearchTracker *geometricSearchTracker, const MagneticField &magneticField, const std::map< std::string, fastsim::InteractionModel * > &interactionModelMap, double magneticFieldHistMaxR, double magneticFieldHistMaxZ)
Constructor.
std::vector< ForwardDetLayer const * > const & negPixelForwardLayers() const
std::vector< BarrelDetLayer const * > const & pixelBarrelLayers() const
const GeometricSearchTracker *const geometricSearchTracker_
The full tracker geometry.
std::vector< BarrelDetLayer const * > const & tibLayers() const
virtual const Surface::PositionType & position() const
Returns position of the surface.
std::vector< ForwardDetLayer const * > const & posTecLayers() const
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 & negTidLayers() const
std::map< std::string, const std::vector< ForwardDetLayer const * > * > forwardDetLayersMap_
A map of strings and pointers to detLayers.
void allToString(std::string &result) const
std::vector< ForwardDetLayer const * > const & posTidLayers() const
static int position[264][3]
std::unique_ptr< ForwardSimplifiedGeometry > createForwardSimplifiedGeometry(LayerType type, const edm::ParameterSet &cfg) const
Helper method for createSimplifiedGeometry(..) to create a forward layer (ForwardSimplifiedGeometry)...
std::unique_ptr< BarrelSimplifiedGeometry > createBarrelSimplifiedGeometry(const edm::ParameterSet &cfg) const
Helper method for createSimplifiedGeometry(..) to create a barrel layer (BarrelSimplifiedGeometry).
std::vector< ForwardDetLayer const * > const & negTecLayers() const
*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)...