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)
50 throw cms::Exception(
"fastsim::SimplifiedGeometry::createForwardLayer") <<
" called with forbidden layerType. Allowed layerTypes are NEGFWD and POSFWD";
62 bool isOnPositiveSide =
false;
67 else if(layerType ==
POSFWD)
69 isOnPositiveSide =
true;
83 detLayerName = (isOnPositiveSide ?
"pos" :
"neg") + detLayerName;
94 std::string positionParameterName = (isForward ?
"z" :
"radius");
95 if(cfg.
exists(positionParameterName))
98 if(isForward && !isOnPositiveSide)
112 position =
static_cast<BarrelDetLayer const*
>(detLayer)->specificSurface().radius();
120 throw cms::Exception(
"fastsim::SimplifiedGeometry") <<
"Cannot extract a " 121 << (isForward ?
"position" :
"radius") <<
" for this " 122 << (isForward ?
"forward" :
"barrel") <<
" layer:\n" 130 std::unique_ptr<fastsim::SimplifiedGeometry> layer;
139 layer->detLayer_ = detLayer;
155 <<
"limits must be provided in increasing order. error in:\n" 160 const std::vector<double> & thickness = cfg.
getUntrackedParameter<std::vector<double> >(
"thickness");
162 if(limits.size() < 2 || thickness.size() != limits.size() - 1)
167 <<
"layer thickness and limits not configured properly! error in:" 171 layer->thicknessHist_.reset(
new TH1F(
"h",
"h", limits.size()-1, &limits[0]));
172 layer->thicknessHist_->SetDirectory(
nullptr);
173 for(
unsigned i = 1;
i < limits.size(); ++
i){
174 layer->thicknessHist_->SetBinContent(
i, thickness[
i-1]);
181 layer->nuclearInteractionThicknessFactor_ = cfg.
getUntrackedParameter<
double>(
"nuclearInteractionThicknessFactor",1.);
188 layer->magneticFieldHist_->SetDirectory(
nullptr);
189 for(
int i = 1;
i <= 101;
i++)
193 :
GlobalPoint(position, 0.,layer->magneticFieldHist_->GetXaxis()->GetBinCenter(
i));
201 std::vector<std::string> interactionModelLabels = cfg.
getUntrackedParameter<std::vector<std::string> >(
"interactionModels");
202 for(
const auto &
label : interactionModelLabels)
207 throw cms::Exception(
"fastsim::SimplifiedGeometryFactory") <<
"unknown interaction model '" <<
label <<
"'";
209 layer->interactionModels_.push_back(interactionModel->second);
216 if(cfg.
exists(
"caloType"))
220 if(caloType ==
"PRESHOWER1"){
222 }
else if(caloType ==
"PRESHOWER2"){
224 }
else if(caloType ==
"ECAL"){
226 }
else if(caloType ==
"HCAL"){
228 }
else if(caloType ==
"VFCAL"){
231 throw cms::Exception(
"fastsim::SimplifiedGeometryFactory") <<
"unknown caloType '" << caloType <<
"' (defined PRESHOWER1, PRESHOWER2, ECAL, HCAL, VFCAL)";
246 if(detLayerName.empty())
252 unsigned pos = detLayerName.size();
253 while(isdigit(detLayerName[pos-1]))
257 if(pos == detLayerName.size())
259 throw cms::Exception(
"fastsim::SimplifiedGeometry::getDetLayer") <<
"last part of detLayerName must be index of DetLayer in list. Error in detLayerName" << detLayerName << std::endl;
261 int index = atoi(detLayerName.substr(pos).c_str());
262 std::string detLayerListName = detLayerName.substr(0,pos);
270 return detLayerList->at(index-1);
277 return detLayerList->at(index-1);
282 throw cms::Exception(
"fastsim::SimplifiedGeometry::getDetLayer") <<
" could not find list of detLayers corresponding to detLayerName " << detLayerName << std::endl;
285 catch (
const std::out_of_range&
error)
287 throw cms::Exception(
"fastsim::SimplifiedGeometry::getDetLayer") <<
" 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]
const std::map< std::string, fastsim::InteractionModel * > * interactionModelMap_
Map of interaction models.
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)...
const double magneticFieldHistMaxR_
Limit in R for histogram of magnetic field.