16 const std::map<std::string, fastsim::InteractionModel *> &interactionModelMap,
17 double magneticFieldHistMaxR,
18 double magneticFieldHistMaxZ)
19 : geometricSearchTracker_(geometricSearchTracker),
20 magneticField_(&magneticField),
21 interactionModelMap_(&interactionModelMap),
22 magneticFieldHistMaxR_(magneticFieldHistMaxR),
23 magneticFieldHistMaxZ_(magneticFieldHistMaxZ) {
41 return std::unique_ptr<fastsim::BarrelSimplifiedGeometry>(
48 throw cms::Exception(
"fastsim::SimplifiedGeometry::createForwardLayer")
49 <<
" called with forbidden layerType. Allowed layerTypes are NEGFWD and POSFWD";
52 return std::unique_ptr<fastsim::ForwardSimplifiedGeometry>(
60 bool isOnPositiveSide =
false;
63 }
else if (layerType ==
POSFWD) {
64 isOnPositiveSide =
true;
76 detLayerName = (isOnPositiveSide ?
"pos" :
"neg") + detLayerName;
87 std::string positionParameterName = (isForward ?
"z" :
"radius");
88 if (cfg.
exists(positionParameterName)) {
90 if (isForward && !isOnPositiveSide) {
99 position =
static_cast<BarrelDetLayer const *
>(detLayer)->specificSurface().radius();
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;
136 <<
"limits must be provided in increasing order. error in:\n" 143 if (limits.size() < 2 || thickness.size() != limits.size() - 1) {
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_ =
167 layer->magneticFieldHist_.reset(
169 layer->magneticFieldHist_->SetDirectory(
nullptr);
170 for (
int i = 1;
i <= 101;
i++) {
172 :
GlobalPoint(position, 0., layer->magneticFieldHist_->GetXaxis()->GetBinCenter(
i));
180 std::vector<std::string> interactionModelLabels =
182 for (
const auto &
label : interactionModelLabels) {
183 std::map<std::string, fastsim::InteractionModel *>::const_iterator interactionModel =
186 throw cms::Exception(
"fastsim::SimplifiedGeometryFactory") <<
"unknown interaction model '" <<
label <<
"'";
188 layer->interactionModels_.push_back(interactionModel->second);
195 if (cfg.
exists(
"caloType")) {
198 if (caloType ==
"PRESHOWER1") {
200 }
else if (caloType ==
"PRESHOWER2") {
202 }
else if (caloType ==
"ECAL") {
204 }
else if (caloType ==
"HCAL") {
206 }
else if (caloType ==
"VFCAL") {
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());
238 std::string detLayerListName = detLayerName.substr(0, pos);
244 return detLayerList->at(index - 1);
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;
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.
const double magneticFieldHistMaxZ_
Limit in +-Z for histogram of magnetic field.
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
const MagneticField *const magneticField_
The full magnetic field.
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
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.
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
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).
const std::map< std::string, fastsim::InteractionModel * > * interactionModelMap_
Map of interaction models.
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)...
const double magneticFieldHistMaxR_
Limit in R for histogram of magnetic field.