CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
HGCalGeomParameters Class Reference

#include <HGCalGeomParameters.h>

Classes

struct  cellParameters
 
struct  layerParameters
 

Public Member Functions

 HGCalGeomParameters ()
 
void loadCellParsHexagon (const DDCompactView *cpv, HGCalParameters &php)
 
void loadCellParsHexagon (const cms::DDVectorsMap &, HGCalParameters &php)
 
void loadCellParsHexagon (const HGCalParameters &php)
 
void loadCellTrapezoid (HGCalParameters &php)
 
void loadGeometryHexagon (const DDFilteredView &, HGCalParameters &, const std::string &, const DDCompactView *, const std::string &, const std::string &, HGCalGeometryMode::WaferMode)
 
void loadGeometryHexagon (const cms::DDFilteredView &, HGCalParameters &, const std::string &, const cms::DDCompactView *, const std::string &, const std::string &, HGCalGeometryMode::WaferMode)
 
void loadGeometryHexagon8 (const DDFilteredView &, HGCalParameters &, int)
 
void loadGeometryHexagon8 (const cms::DDFilteredView &, HGCalParameters &, int)
 
void loadSpecParsHexagon (const DDFilteredView &, HGCalParameters &, const DDCompactView *, const std::string &, const std::string &)
 
void loadSpecParsHexagon (const cms::DDFilteredView &, HGCalParameters &, const cms::DDCompactView *, const std::string &, const std::string &, const std::string &, const std::string &)
 
void loadSpecParsHexagon8 (const DDFilteredView &, HGCalParameters &)
 
void loadSpecParsHexagon8 (const cms::DDFilteredView &, const cms::DDVectorsMap &, HGCalParameters &, const std::string &)
 
void loadSpecParsTrapezoid (const DDFilteredView &, HGCalParameters &)
 
void loadSpecParsTrapezoid (const cms::DDFilteredView &, const cms::DDVectorsMap &, HGCalParameters &, const std::string &)
 
void loadWaferHexagon (HGCalParameters &php)
 
void loadWaferHexagon8 (HGCalParameters &php)
 
 ~HGCalGeomParameters ()
 

Private Member Functions

std::pair< double, double > cellPosition (const std::vector< cellParameters > &wafers, std::vector< cellParameters >::const_iterator &itrf, int wafer, double xx, double yy)
 
std::vector< double > getDDDArray (const std::string &, const DDsvalues_type &, const int)
 
void loadGeometryHexagon (const std::map< int, HGCalGeomParameters::layerParameters > &layers, std::vector< HGCalParameters::hgtrform > &trforms, std::vector< bool > &trformUse, const std::unordered_map< int32_t, int32_t > &copies, const HGCalParameters::layer_map &copiesInLayers, const std::vector< int32_t > &wafer2copy, const std::vector< HGCalGeomParameters::cellParameters > &wafers, const std::map< int, int > &wafertype, const std::map< int, HGCalGeomParameters::cellParameters > &cellsf, const std::map< int, HGCalGeomParameters::cellParameters > &cellsc, HGCalParameters &php)
 
void loadGeometryHexagon8 (const std::map< int, HGCalGeomParameters::layerParameters > &layers, std::map< std::pair< int, int >, HGCalParameters::hgtrform > &trforms, const int &firstLayer, HGCalParameters &php)
 
void loadSpecParsHexagon (const HGCalParameters &php)
 
void loadSpecParsHexagon8 (const HGCalParameters &php)
 
void loadSpecParsTrapezoid (const HGCalParameters &php)
 
void rescale (std::vector< double > &, const double s)
 

Private Attributes

HGCalGeomTools geomTools_
 
const double sqrt3_
 
double waferSize_
 

Detailed Description

this class extracts some geometry constants from CompactView to be used by Reco Geometry/Topology

Date
2015/06/25 00:06:50
Author
Sunanda Banerjee, Fermilab sunan.nosp@m.da.b.nosp@m.anerj.nosp@m.ee@c.nosp@m.ern.c.nosp@m.h
Lindsey Gray, Fermilab lagra.nosp@m.y@fn.nosp@m.al.go.nosp@m.v (for fixes)

Definition at line 29 of file HGCalGeomParameters.h.

Constructor & Destructor Documentation

HGCalGeomParameters::HGCalGeomParameters ( )

Definition at line 27 of file HGCalGeomParameters.cc.

27  : sqrt3_(std::sqrt(3.0)) {
28 #ifdef EDM_ML_DEBUG
29  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters::HGCalGeomParameters "
30  << "constructor";
31 #endif
32 }
T sqrt(T t)
Definition: SSEVec.h:19
HGCalGeomParameters::~HGCalGeomParameters ( )

Definition at line 34 of file HGCalGeomParameters.cc.

34  {
35 #ifdef EDM_ML_DEBUG
36  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters::destructed!!!";
37 #endif
38 }

Member Function Documentation

std::pair< double, double > HGCalGeomParameters::cellPosition ( const std::vector< cellParameters > &  wafers,
std::vector< cellParameters >::const_iterator &  itrf,
int  wafer,
double  xx,
double  yy 
)
private

Definition at line 1367 of file HGCalGeomParameters.cc.

References funct::abs(), PVValHelper::dx, PVValHelper::dy, and tolerance.

Referenced by HGCalGeomParameters::cellParameters::cellParameters(), and loadGeometryHexagon().

1372  {
1373  if (itrf == wafers.end()) {
1374  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin(); itr != wafers.end();
1375  ++itr) {
1376  if (itr->wafer == wafer) {
1377  itrf = itr;
1378  break;
1379  }
1380  }
1381  }
1382  double dx(0), dy(0);
1383  if (itrf != wafers.end()) {
1384  dx = (xx - itrf->xyz.x());
1385  if (std::abs(dx) < tolerance)
1386  dx = 0;
1387  dy = (yy - itrf->xyz.y());
1388  if (std::abs(dy) < tolerance)
1389  dy = 0;
1390  }
1391  return std::make_pair(dx, dy);
1392 }
const double tolerance
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > HGCalGeomParameters::getDDDArray ( const std::string &  str,
const DDsvalues_type sv,
const int  nmin 
)
private

Definition at line 1338 of file HGCalGeomParameters.cc.

References DDfetch(), DDValue::doubles(), Exception, str, and relativeConstraints::value.

Referenced by HGCalGeomParameters::cellParameters::cellParameters(), loadSpecParsHexagon(), loadSpecParsHexagon8(), and loadSpecParsTrapezoid().

1338  {
1339  DDValue value(str);
1340  if (DDfetch(&sv, value)) {
1341  const std::vector<double>& fvec = value.doubles();
1342  int nval = fvec.size();
1343  if (nmin > 0) {
1344  if (nval < nmin) {
1345  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str << " bins " << nval << " < " << nmin
1346  << " ==> illegal";
1347  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1348  }
1349  } else {
1350  if (nval < 1 && nmin == 0) {
1351  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str << " bins " << nval << " < 1 ==> illegal"
1352  << " (nmin=" << nmin << ")";
1353  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1354  }
1355  }
1356  return fvec;
1357  } else {
1358  if (nmin >= 0) {
1359  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array " << str;
1360  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1361  }
1362  std::vector<double> fvec;
1363  return fvec;
1364  }
1365 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:79
Definition: value.py:1
#define str(s)
void HGCalGeomParameters::loadCellParsHexagon ( const DDCompactView cpv,
HGCalParameters php 
)

Definition at line 1177 of file HGCalGeomParameters.cc.

References HGCalParameters::cellCoarse_, HGCalParameters::cellFine_, dbl_to_int(), DDFilteredView::firstChild(), DDVectorGetter::get(), convertSQLiteXML::ok, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by loadCellParsHexagon().

1177  {
1178  // Special parameters for cell parameters
1179  std::string attribute = "OnlyForHGCalNumbering";
1180  DDSpecificsHasNamedValueFilter filter1{attribute};
1181  DDFilteredView fv1(*cpv, filter1);
1182  bool ok = fv1.firstChild();
1183 
1184  if (ok) {
1185  php.cellFine_ = dbl_to_int(DDVectorGetter::get("waferFine"));
1186  php.cellCoarse_ = dbl_to_int(DDVectorGetter::get("waferCoarse"));
1187  }
1188 
1189  loadCellParsHexagon(php);
1190 }
std::vector< int > cellFine_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< int > cellCoarse_
void loadCellParsHexagon(const DDCompactView *cpv, HGCalParameters &php)
std::vector< double > get(const std::string &)
void HGCalGeomParameters::loadCellParsHexagon ( const cms::DDVectorsMap vmap,
HGCalParameters php 
)

Definition at line 1192 of file HGCalGeomParameters.cc.

References HGCalParameters::cellCoarse_, HGCalParameters::cellFine_, cms::dd::compareEqual(), mps_fire::i, loadCellParsHexagon(), and cms::dd::noNamespace().

1192  {
1193  for (auto const& it : vmap) {
1194  if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), "waferFine")) {
1195  for (const auto& i : it.second)
1196  php.cellFine_.emplace_back(std::round(i));
1197  } else if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), "waferCoarse")) {
1198  for (const auto& i : it.second)
1199  php.cellCoarse_.emplace_back(std::round(i));
1200  }
1201  }
1202 
1203  loadCellParsHexagon(php);
1204 }
std::vector< int > cellFine_
std::string_view noNamespace(std::string_view)
Definition: Filter.cc:61
std::vector< int > cellCoarse_
void loadCellParsHexagon(const DDCompactView *cpv, HGCalParameters &php)
bool compareEqual(std::string_view, std::string_view)
void HGCalGeomParameters::loadCellParsHexagon ( const HGCalParameters php)

Definition at line 1206 of file HGCalGeomParameters.cc.

References HGCalParameters::cellCoarse_, HGCalParameters::cellFine_, and dqmdumpme::k.

1206  {
1207 #ifdef EDM_ML_DEBUG
1208  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellFine_.size() << " rows for fine cells";
1209  for (unsigned int k = 0; k < php.cellFine_.size(); ++k)
1210  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
1211  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellCoarse_.size() << " rows for coarse cells";
1212  for (unsigned int k = 0; k < php.cellCoarse_.size(); ++k)
1213  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
1214 #endif
1215 }
std::vector< int > cellFine_
std::vector< int > cellCoarse_
void HGCalGeomParameters::loadCellTrapezoid ( HGCalParameters php)

Definition at line 1217 of file HGCalGeomParameters.cc.

References HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, HGCalParameters::hgtrap::dz, PVValHelper::eta, JetChargeProducer_cfi::exp, HGCalParameters::fillModule(), HGCalParameters::firstLayer_, HGCalParameters::firstModule_, HGCalParameters::hgtrap::h, LaserClient_cfi::high, createfilelist::int, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, GetRecoTauVFromDQM_MC_cff::kk, HGCalParameters::lastModule_, HGCalParameters::hgtrap::lay, HGCalParameters::layerFrontBH_, dqm-mbProfile::log, LaserClient_cfi::low, HGCalParameters::minTileSize_, HGCalParameters::nSectors_, HGCalParameters::radiusLayer_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayerBH_, HGCalParameters::rMinLayHex_, HGCalParameters::scintCellSize(), HGCalParameters::scintType(), funct::tan(), HGCalParameters::hgtrap::tl, HGCalParameters::waferThick_, HGCalParameters::waferUVMax_, and HGCalParameters::zLayerHex_.

1217  {
1218  // Find the radius of each eta-partitions
1219  for (unsigned k = 0; k < 2; ++k) {
1220  double rmax = ((k == 0) ? (php.rMaxLayHex_[php.layerFrontBH_[1] - php.firstLayer_] - 1)
1221  : (php.rMaxLayHex_[php.rMaxLayHex_.size() - 1]));
1222  double rv = php.rMinLayerBH_[k];
1223  double zv = ((k == 0) ? (php.zLayerHex_[php.layerFrontBH_[1] - php.firstLayer_])
1224  : (php.zLayerHex_[php.zLayerHex_.size() - 1]));
1225  php.radiusLayer_[k].emplace_back(rv);
1226 #ifdef EDM_ML_DEBUG
1227  double eta = -(std::log(std::tan(0.5 * std::atan(rv / zv))));
1228  edm::LogVerbatim("HGCalGeom") << "[" << k << "] rmax " << rmax << " Z = " << zv << " dEta = " << php.cellSize_[k]
1229  << "\n[0] new R = " << rv << " Eta = " << eta;
1230  int kount(1);
1231 #endif
1232  while (rv < rmax) {
1233  double eta = -(php.cellSize_[k] + std::log(std::tan(0.5 * std::atan(rv / zv))));
1234  rv = zv * std::tan(2.0 * std::atan(std::exp(-eta)));
1235  php.radiusLayer_[k].emplace_back(rv);
1236 #ifdef EDM_ML_DEBUG
1237  edm::LogVerbatim("HGCalGeom") << "[" << kount << "] new R = " << rv << " Eta = " << eta;
1238  ++kount;
1239 #endif
1240  }
1241  }
1242 
1243  // Find minimum and maximum radius index for each layer
1244  for (unsigned k = 0; k < php.zLayerHex_.size(); ++k) {
1245  int kk = php.scintType(php.firstLayer_ + (int)(k));
1246  std::vector<double>::iterator low, high;
1247  low = std::lower_bound(php.radiusLayer_[kk].begin(), php.radiusLayer_[kk].end(), php.rMinLayHex_[k]);
1248 #ifdef EDM_ML_DEBUG
1249  edm::LogVerbatim("HGCalGeom") << "[" << k << "] RLow = " << php.rMinLayHex_[k] << " pos "
1250  << (int)(low - php.radiusLayer_[kk].begin());
1251 #endif
1252  if (low == php.radiusLayer_[kk].begin())
1253  ++low;
1254  int irlow = (int)(low - php.radiusLayer_[kk].begin());
1255  double drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
1256 #ifdef EDM_ML_DEBUG
1257  edm::LogVerbatim("HGCalGeom") << "irlow " << irlow << " dr " << drlow << " min " << php.minTileSize_;
1258 #endif
1259  if (drlow < php.minTileSize_) {
1260  ++irlow;
1261 #ifdef EDM_ML_DEBUG
1262  drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
1263  edm::LogVerbatim("HGCalGeom") << "Modified irlow " << irlow << " dr " << drlow;
1264 #endif
1265  }
1266  high = std::lower_bound(php.radiusLayer_[kk].begin(), php.radiusLayer_[kk].end(), php.rMaxLayHex_[k]);
1267 #ifdef EDM_ML_DEBUG
1268  edm::LogVerbatim("HGCalGeom") << "[" << k << "] RHigh = " << php.rMaxLayHex_[k] << " pos "
1269  << (int)(high - php.radiusLayer_[kk].begin());
1270 #endif
1271  if (high == php.radiusLayer_[kk].end())
1272  --high;
1273  int irhigh = (int)(high - php.radiusLayer_[kk].begin());
1274  double drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
1275 #ifdef EDM_ML_DEBUG
1276  edm::LogVerbatim("HGCalGeom") << "irhigh " << irhigh << " dr " << drhigh << " min " << php.minTileSize_;
1277 #endif
1278  if (drhigh < php.minTileSize_) {
1279  --irhigh;
1280 #ifdef EDM_ML_DEBUG
1281  drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
1282  edm::LogVerbatim("HGCalGeom") << "Modified irhigh " << irhigh << " dr " << drhigh;
1283 #endif
1284  }
1285  php.iradMinBH_.emplace_back(irlow);
1286  php.iradMaxBH_.emplace_back(irhigh);
1287 #ifdef EDM_ML_DEBUG
1288  edm::LogVerbatim("HGcalGeom") << "Layer " << k << " Type " << kk << " Low edge " << irlow << ":" << drlow
1289  << " Top edge " << irhigh << ":" << drhigh;
1290 #endif
1291  }
1292 
1293  // Now define the volumes
1294  int im(0);
1295  php.waferUVMax_ = 0;
1297  mytr.alpha = 0.0;
1298  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
1299  if (php.iradMaxBH_[k] > php.waferUVMax_)
1300  php.waferUVMax_ = php.iradMaxBH_[k];
1301  int kk = ((php.firstLayer_ + (int)(k)) < php.layerFrontBH_[1]) ? 0 : 1;
1302 #ifdef EDM_ML_DEBUG
1303  edm::LogVerbatim("HGCalGeom") << "Layer " << php.firstLayer_ + k << ":" << kk << " Radius range "
1304  << php.iradMinBH_[k] << ":" << php.iradMaxBH_[k];
1305 #endif
1306  mytr.lay = php.firstLayer_ + k;
1307  for (int irad = php.iradMinBH_[k]; irad <= php.iradMaxBH_[k]; ++irad) {
1308  double rmin = php.radiusLayer_[kk][irad - 1];
1309  double rmax = php.radiusLayer_[kk][irad];
1310  mytr.bl = 0.5 * rmin * php.scintCellSize(mytr.lay);
1311  mytr.tl = 0.5 * rmax * php.scintCellSize(mytr.lay);
1312  mytr.h = 0.5 * (rmax - rmin);
1313  mytr.dz = 0.5 * php.waferThick_;
1314  mytr.cellSize = 0.5 * (rmax + rmin) * php.scintCellSize(mytr.lay);
1315  php.fillModule(mytr, true);
1321  php.fillModule(mytr, false);
1322  if (irad == php.iradMinBH_[k])
1323  php.firstModule_.emplace_back(im);
1324  ++im;
1325  if (irad == php.iradMaxBH_[k] - 1)
1326  php.lastModule_.emplace_back(im);
1327  }
1328  }
1329  php.nSectors_ = php.waferUVMax_;
1330 #ifdef EDM_ML_DEBUG
1331  edm::LogVerbatim("HGCalGeom") << "Maximum radius index " << php.waferUVMax_;
1332  for (unsigned int k = 0; k < php.firstModule_.size(); ++k)
1333  edm::LogVerbatim("HGCalGeom") << "Layer " << k + php.firstLayer_ << " Modules " << php.firstModule_[k] << ":"
1334  << php.lastModule_[k];
1335 #endif
1336 }
std::vector< int > iradMaxBH_
int scintType(const int layer) const
double scintCellSize(const int layer) const
std::vector< double > rMinLayerBH_
std::vector< int > firstModule_
std::vector< double > cellSize_
static double k_ScaleFromDDD
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > rMinLayHex_
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< int > lastModule_
static double k_ScaleToDDD
std::vector< int > iradMinBH_
std::vector< int > layerFrontBH_
std::vector< double > radiusLayer_[2]
void HGCalGeomParameters::loadGeometryHexagon ( const DDFilteredView _fv,
HGCalParameters php,
const std::string &  sdTag1,
const DDCompactView cpv,
const std::string &  sdTag2,
const std::string &  sdTag3,
HGCalGeometryMode::WaferMode  mode 
)

Definition at line 40 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), funct::cos(), SimDataFormats::CaloAnalysis::cp, ddpolyhedra_rrz, ddpolyhedra_rz, ddtubs, HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), spr::find(), DDFilteredView::firstChild(), HGCalParameters::hgtrap::h, AnalysisDataFormats_SUSYBSMObjects::hr, createfilelist::int, HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, hgcalTopologyTester_cfi::layers, DDFilteredView::logicalPart(), Skims_PA_cff::name, DDName::name(), DDBase< N, C >::name(), names, DDFilteredView::next(), convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, p1, p2, HGCalGeometryMode::Polyhedra, DDTubs::rIn(), DDPolyhedra::rMaxVec(), DDPolyhedra::rMinVec(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), DDSolid::shape(), DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrap::tl, tolerance, DDFilteredView::translation(), HGCalParameters::waferR_, waferSize_, HGCalParameters::waferSize_, x, DDExtrudedPolygon::xVec(), geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, DDPolyhedra::zVec(), and DDExtrudedPolygon::zVec().

Referenced by HGCalGeomParameters::cellParameters::cellParameters().

46  {
47  DDFilteredView fv = _fv;
48  bool dodet(true);
49  std::map<int, HGCalGeomParameters::layerParameters> layers;
50  std::vector<HGCalParameters::hgtrform> trforms;
51  std::vector<bool> trformUse;
52 
53  while (dodet) {
54  const DDSolid& sol = fv.logicalPart().solid();
55  // Layers first
56  std::vector<int> copy = fv.copyNumbers();
57  int nsiz = (int)(copy.size());
58  int lay = (nsiz > 0) ? copy[nsiz - 1] : 0;
59  int zp = (nsiz > 2) ? copy[nsiz - 3] : -1;
60  if (zp != 1)
61  zp = -1;
62  if (lay == 0) {
63  throw cms::Exception("DDException") << "Funny layer # " << lay << " zp " << zp << " in " << nsiz << " components";
64  } else {
65  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
66  php.layer_.emplace_back(lay);
67  auto itr = layers.find(lay);
68  if (itr == layers.end()) {
69  double rin(0), rout(0);
71  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
72  const std::vector<double>& rmin = polyhedra.rMinVec();
73  const std::vector<double>& rmax = polyhedra.rMaxVec();
74  rin = 0.5 * HGCalParameters::k_ScaleFromDDD * (rmin[0] + rmin[1]);
75  rout = 0.5 * HGCalParameters::k_ScaleFromDDD * (rmax[0] + rmax[1]);
76  } else if (sol.shape() == DDSolidShape::ddtubs) {
77  const DDTubs& tube = static_cast<DDTubs>(sol);
78  rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
79  rout = HGCalParameters::k_ScaleFromDDD * tube.rOut();
80  }
81  double zp = HGCalParameters::k_ScaleFromDDD * fv.translation().Z();
82  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
83  layers[lay] = laypar;
84  }
85  DD3Vector x, y, z;
86  fv.rotation().GetComponents(x, y, z);
87  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
88  const CLHEP::HepRotation hr(rotation);
90  if (std::abs(xx) < tolerance)
91  xx = 0;
93  if (std::abs(yy) < tolerance)
94  yy = 0;
95  const CLHEP::Hep3Vector h3v(xx, yy, fv.translation().Z());
97  mytrf.zp = zp;
98  mytrf.lay = lay;
99  mytrf.sec = 0;
100  mytrf.subsec = 0;
101  mytrf.h3v = h3v;
102  mytrf.hr = hr;
103  trforms.emplace_back(mytrf);
104  trformUse.emplace_back(false);
105  }
106  dodet = fv.next();
107  }
108 
109  // Then wafers
110  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they
111  // were) to ensure that new copy numbers are always added to the end of the
112  // list.
113  std::unordered_map<int32_t, int32_t> copies;
114  HGCalParameters::layer_map copiesInLayers(layers.size() + 1);
115  std::vector<int32_t> wafer2copy;
116  std::vector<HGCalGeomParameters::cellParameters> wafers;
117  std::string attribute = "Volume";
118  DDValue val1(attribute, sdTag2, 0.0);
119  DDSpecificsMatchesValueFilter filter1{val1};
120  DDFilteredView fv1(*cpv, filter1);
121  bool ok = fv1.firstChild();
122  if (!ok) {
123  edm::LogError("HGCalGeom") << " Attribute " << val1 << " not found but needed.";
124  throw cms::Exception("DDException") << "Attribute " << val1 << " not found but needed.";
125  } else {
126  dodet = true;
127  std::unordered_set<std::string> names;
128  while (dodet) {
129  const DDSolid& sol = fv1.logicalPart().solid();
130  const std::string& name = fv1.logicalPart().name().name();
131  std::vector<int> copy = fv1.copyNumbers();
132  int nsiz = (int)(copy.size());
133  int wafer = (nsiz > 0) ? copy[nsiz - 1] : 0;
134  int layer = (nsiz > 1) ? copy[nsiz - 2] : 0;
135  if (nsiz < 2) {
136  edm::LogError("HGCalGeom") << "Funny wafer # " << wafer << " in " << nsiz << " components";
137  throw cms::Exception("DDException") << "Funny wafer # " << wafer;
138  } else if (layer > (int)(layers.size())) {
139  edm::LogWarning("HGCalGeom") << "Funny wafer # " << wafer << " Layer " << layer << ":" << layers.size()
140  << " among " << nsiz << " components";
141  } else {
142  auto itr = copies.find(wafer);
143  auto cpy = copiesInLayers[layer].find(wafer);
144  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
145  copiesInLayers[layer][wafer] = itr->second;
146  }
147  if (itr == copies.end()) {
148  copies[wafer] = wafer2copy.size();
149  copiesInLayers[layer][wafer] = wafer2copy.size();
150  double xx = HGCalParameters::k_ScaleFromDDD * fv1.translation().X();
151  if (std::abs(xx) < tolerance)
152  xx = 0;
153  double yy = HGCalParameters::k_ScaleFromDDD * fv1.translation().Y();
154  if (std::abs(yy) < tolerance)
155  yy = 0;
156  wafer2copy.emplace_back(wafer);
157  GlobalPoint p(xx, yy, HGCalParameters::k_ScaleFromDDD * fv1.translation().Z());
158  HGCalGeomParameters::cellParameters cell(false, wafer, p);
159  wafers.emplace_back(cell);
160  if (names.count(name) == 0) {
161  std::vector<double> zv, rv;
163  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
164  zv = polyhedra.zVec();
165  rv = polyhedra.rMaxVec();
166  } else {
167  const DDExtrudedPolygon& polygon = static_cast<DDExtrudedPolygon>(sol);
168  zv = polygon.zVec();
169  rv = polygon.xVec();
170  }
171  php.waferR_ = rv[0] / std::cos(30._deg);
173  double dz = 0.5 * (zv[1] - zv[0]);
174 #ifdef EDM_ML_DEBUG
175  edm::LogVerbatim("HGCalGeom")
176  << "Mode " << mode << " R " << php.waferSize_ << ":" << php.waferR_ << " z " << dz;
177 #endif
179  mytr.lay = 1;
180  mytr.bl = php.waferR_;
181  mytr.tl = php.waferR_;
182  mytr.h = php.waferR_;
183  mytr.dz = dz;
184  mytr.alpha = 0.0;
185  mytr.cellSize = waferSize_;
186  php.fillModule(mytr, false);
187  names.insert(name);
188  }
189  }
190  }
191  dodet = fv1.next();
192  }
193  }
194 
195  // Finally the cells
196  std::map<int, int> wafertype;
197  std::map<int, HGCalGeomParameters::cellParameters> cellsf, cellsc;
198  DDValue val2(attribute, sdTag3, 0.0);
199  DDSpecificsMatchesValueFilter filter2{val2};
200  DDFilteredView fv2(*cpv, filter2);
201  ok = fv2.firstChild();
202  if (!ok) {
203  edm::LogError("HGCalGeom") << " Attribute " << val2 << " not found but needed.";
204  throw cms::Exception("DDException") << "Attribute " << val2 << " not found but needed.";
205  } else {
206  dodet = true;
207  while (dodet) {
208  const DDSolid& sol = fv2.logicalPart().solid();
209  const std::string& name = sol.name().name();
210  std::vector<int> copy = fv2.copyNumbers();
211  int nsiz = (int)(copy.size());
212  int cellx = (nsiz > 0) ? copy[nsiz - 1] : 0;
213  int wafer = (nsiz > 1) ? copy[nsiz - 2] : 0;
214  int cell = cellx % 1000;
215  int type = cellx / 1000;
216  if (type != 1 && type != 2) {
217  edm::LogError("HGCalGeom") << "Funny cell # " << cell << " type " << type << " in " << nsiz << " components";
218  throw cms::Exception("DDException") << "Funny cell # " << cell;
219  } else {
220  auto ktr = wafertype.find(wafer);
221  if (ktr == wafertype.end())
222  wafertype[wafer] = type;
223  bool newc(false);
224  std::map<int, HGCalGeomParameters::cellParameters>::iterator itr;
225  double cellsize = php.cellSize_[0];
226  if (type == 1) {
227  itr = cellsf.find(cell);
228  newc = (itr == cellsf.end());
229  } else {
230  itr = cellsc.find(cell);
231  newc = (itr == cellsc.end());
232  cellsize = php.cellSize_[1];
233  }
234  if (newc) {
235  bool half = (name.find("Half") != std::string::npos);
236  double xx = HGCalParameters::k_ScaleFromDDD * fv2.translation().X();
237  double yy = HGCalParameters::k_ScaleFromDDD * fv2.translation().Y();
238  if (half) {
239  math::XYZPointD p1(-2.0 * cellsize / 9.0, 0, 0);
240  math::XYZPointD p2 = fv2.rotation()(p1);
241  xx += (HGCalParameters::k_ScaleFromDDD * (p2.X()));
242  yy += (HGCalParameters::k_ScaleFromDDD * (p2.Y()));
243 #ifdef EDM_ML_DEBUG
244  edm::LogVerbatim("HGCalGeom")
245  << "Type " << type << " Cell " << cellx << " local " << xx << ":" << yy << " new " << p1 << ":" << p2;
246 #endif
247  }
248  HGCalGeomParameters::cellParameters cp(half, wafer, GlobalPoint(xx, yy, 0));
249  if (type == 1) {
250  cellsf[cell] = cp;
251  } else {
252  cellsc[cell] = cp;
253  }
254  }
255  }
256  dodet = fv2.next();
257  }
258  }
259 
261  layers, trforms, trformUse, copies, copiesInLayers, wafer2copy, wafers, wafertype, cellsf, cellsc, php);
262 }
type
Definition: HCALResponse.h:21
std::vector< int > layer_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
const N & name() const
Definition: DDBase.h:59
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:338
nav_type copyNumbers() const
return the stack of copy numbers
const double tolerance
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
const std::string names[nVars_]
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
std::vector< double > xVec(void) const
Definition: DDSolid.cc:374
std::vector< double > cellSize_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
bool next()
set current node to the next node in the filtered tree
susybsm::HSCParticleRef hr
Definition: classes.h:26
static double k_ScaleFromDDD
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:119
void fillModule(const hgtrap &mytr, bool reco)
double p2[4]
Definition: TauolaWrapper.h:90
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:331
double rOut(void) const
Definition: DDSolid.cc:454
std::vector< double > zVec(void) const
Definition: DDSolid.cc:383
ROOT::Math::PositionVector3D< ROOT::Math::Cartesian3D< double > > XYZPointD
point in space with cartesian internal representation
Definition: Point3D.h:8
std::vector< double > zVec(void) const
Definition: DDSolid.cc:324
double p1[4]
Definition: TauolaWrapper.h:89
const DDTranslation & translation() const
The absolute translation of the current node.
double rIn(void) const
Definition: DDSolid.cc:452
const std::string & name() const
Returns the name.
Definition: DDName.cc:40
void loadGeometryHexagon(const DDFilteredView &, HGCalParameters &, const std::string &, const DDCompactView *, const std::string &, const std::string &, HGCalGeometryMode::WaferMode)
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
void HGCalGeomParameters::loadGeometryHexagon ( const cms::DDFilteredView fv,
HGCalParameters php,
const std::string &  sdTag1,
const cms::DDCompactView cpv,
const std::string &  sdTag2,
const std::string &  sdTag3,
HGCalGeometryMode::WaferMode  mode 
)

Definition at line 264 of file HGCalGeomParameters.cc.

270  {}
void HGCalGeomParameters::loadGeometryHexagon ( const std::map< int, HGCalGeomParameters::layerParameters > &  layers,
std::vector< HGCalParameters::hgtrform > &  trforms,
std::vector< bool > &  trformUse,
const std::unordered_map< int32_t, int32_t > &  copies,
const HGCalParameters::layer_map copiesInLayers,
const std::vector< int32_t > &  wafer2copy,
const std::vector< HGCalGeomParameters::cellParameters > &  wafers,
const std::map< int, int > &  wafertype,
const std::map< int, HGCalGeomParameters::cellParameters > &  cellsf,
const std::map< int, HGCalGeomParameters::cellParameters > &  cellsc,
HGCalParameters php 
)
private

Definition at line 272 of file HGCalGeomParameters.cc.

References HGCalParameters::addTrForm(), HGCalParameters::hgtrap::bl, HGCalParameters::boundR_, HGCalParameters::cellCoarseHalf_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineHalf_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellPosition(), HGCalParameters::hgtrap::cellSize, HGCalParameters::copiesInLayers_, TauDecayModes::dec, LEDCalibrationChannels::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), dqmdumpme::first, HGCalParameters::firstLayer_, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, mps_fire::i, testProducerWithPsetDescEmpty_cfi::i1, testProducerWithPsetDescEmpty_cfi::i2, createfilelist::int, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, HGCalParameters::layerGroup_, HGCalParameters::layerIndex_, HGCalParameters::moduleAlphaR_, HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlR_, HGCalParameters::moduleBlS_, HGCalParameters::moduleDzR_, HGCalParameters::moduleDzS_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, HGCalParameters::moduleLayR_, HGCalParameters::moduleLayS_, HGCalParameters::moduleTlR_, HGCalParameters::moduleTlS_, HGCalParameters::nSectors_, alignCSCRings::r, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalParameters::scaleTrForm(), HGCalParameters::hgtrap::tl, HGCalParameters::trformIndex_, HGCalParameters::trformRotXX_, HGCalParameters::trformRotXY_, HGCalParameters::trformRotXZ_, HGCalParameters::trformRotYX_, HGCalParameters::trformRotYY_, HGCalParameters::trformRotYZ_, HGCalParameters::trformRotZX_, HGCalParameters::trformRotZY_, HGCalParameters::trformRotZZ_, HGCalParameters::trformTranX_, HGCalParameters::trformTranY_, HGCalParameters::trformTranZ_, HGCalParameters::waferCopy_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypeT_, geometryCSVtoXML::xx, geometryCSVtoXML::xy, geometryCSVtoXML::yy, and HGCalParameters::zLayerHex_.

282  {
283  if (((cellsf.size() + cellsc.size()) == 0) || (wafers.empty()) || (layers.empty())) {
284  edm::LogError("HGCalGeom") << "HGCalGeomParameters : number of cells " << cellsf.size() << ":" << cellsc.size()
285  << " wafers " << wafers.size() << " layers " << layers.size() << " illegal";
286  throw cms::Exception("DDException") << "HGCalGeomParameters: mismatch between geometry and specpar: cells "
287  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
288  << " layers " << layers.size();
289  }
290 
291  for (unsigned int i = 0; i < layers.size(); ++i) {
292  for (auto& layer : layers) {
293  if (layer.first == (int)(i + php.firstLayer_)) {
294  php.layerIndex_.emplace_back(i);
295  php.rMinLayHex_.emplace_back(layer.second.rmin);
296  php.rMaxLayHex_.emplace_back(layer.second.rmax);
297  php.zLayerHex_.emplace_back(layer.second.zpos);
298  break;
299  }
300  }
301  }
302  for (unsigned int i = 0; i < php.layer_.size(); ++i) {
303  for (unsigned int i1 = 0; i1 < trforms.size(); ++i1) {
304  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay - 1] == (int)(i + 1)) {
305  trforms[i1].h3v *= static_cast<double>(HGCalParameters::k_ScaleFromDDD);
306  trforms[i1].lay = (i + 1);
307  trformUse[i1] = true;
308  php.fillTrForm(trforms[i1]);
309  int nz(1);
310  for (unsigned int i2 = i1 + 1; i2 < trforms.size(); ++i2) {
311  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
312  php.layerGroup_[trforms[i2].lay - 1] == (int)(i + 1)) {
313  php.addTrForm(HGCalParameters::k_ScaleFromDDD * trforms[i2].h3v);
314  nz++;
315  trformUse[i2] = true;
316  }
317  }
318  if (nz > 0) {
319  php.scaleTrForm(double(1.0 / nz));
320  }
321  }
322  }
323  }
324 
325  double rmin = HGCalParameters::k_ScaleFromDDD * php.waferR_;
326  for (unsigned i = 0; i < wafer2copy.size(); ++i) {
327  php.waferCopy_.emplace_back(wafer2copy[i]);
328  php.waferPosX_.emplace_back(wafers[i].xyz.x());
329  php.waferPosY_.emplace_back(wafers[i].xyz.y());
330  auto ktr = wafertype.find(wafer2copy[i]);
331  int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
332  php.waferTypeT_.emplace_back(typet);
333  double r = wafers[i].xyz.perp();
334  int type(3);
335  for (int k = 1; k < 4; ++k) {
336  if ((r + rmin) <= php.boundR_[k]) {
337  type = k;
338  break;
339  }
340  }
341  php.waferTypeL_.emplace_back(type);
342  }
343  php.copiesInLayers_ = copiesInLayers;
344  php.nSectors_ = (int)(php.waferCopy_.size());
345 
346  std::vector<HGCalGeomParameters::cellParameters>::const_iterator itrf = wafers.end();
347  for (unsigned int i = 0; i < cellsf.size(); ++i) {
348  auto itr = cellsf.find(i);
349  if (itr == cellsf.end()) {
350  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
351  << " fine cell number " << i;
352  throw cms::Exception("DDException") << "HGCalGeomParameters: missing info for fine cell number " << i;
353  } else {
354  double xx = (itr->second).xyz.x();
355  double yy = (itr->second).xyz.y();
356  int waf = (itr->second).wafer;
357  std::pair<double, double> xy = cellPosition(wafers, itrf, waf, xx, yy);
358  php.cellFineX_.emplace_back(xy.first);
359  php.cellFineY_.emplace_back(xy.second);
360  php.cellFineHalf_.emplace_back((itr->second).half);
361  }
362  }
363  itrf = wafers.end();
364  for (unsigned int i = 0; i < cellsc.size(); ++i) {
365  auto itr = cellsc.find(i);
366  if (itr == cellsc.end()) {
367  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
368  << " coarse cell number " << i;
369  throw cms::Exception("DDException") << "HGCalGeomParameters: missing info for coarse cell number " << i;
370  } else {
371  double xx = (itr->second).xyz.x();
372  double yy = (itr->second).xyz.y();
373  int waf = (itr->second).wafer;
374  std::pair<double, double> xy = cellPosition(wafers, itrf, waf, xx, yy);
375  php.cellCoarseX_.emplace_back(xy.first);
376  php.cellCoarseY_.emplace_back(xy.second);
377  php.cellCoarseHalf_.emplace_back((itr->second).half);
378  }
379  }
380  int depth(0);
381  for (unsigned int i = 0; i < php.layerGroup_.size(); ++i) {
382  bool first(true);
383  for (unsigned int k = 0; k < php.layerGroup_.size(); ++k) {
384  if (php.layerGroup_[k] == (int)(i + 1)) {
385  if (first) {
386  php.depth_.emplace_back(i + 1);
387  php.depthIndex_.emplace_back(depth);
388  php.depthLayerF_.emplace_back(k);
389  ++depth;
390  first = false;
391  }
392  }
393  }
394  }
395  HGCalParameters::hgtrap mytr = php.getModule(0, false);
401  double dz = mytr.dz;
402  php.fillModule(mytr, true);
403  mytr.dz = 2 * dz;
404  php.fillModule(mytr, true);
405  mytr.dz = 3 * dz;
406  php.fillModule(mytr, true);
407 #ifdef EDM_ML_DEBUG
408  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.zLayerHex_.size() << " layers";
409  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
410  int k = php.layerIndex_[i];
411  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":" << php.layer_[k]
412  << "] with r = " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
413  << " at z = " << php.zLayerHex_[i];
414  }
415  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters has " << php.depthIndex_.size() << " depths";
416  for (unsigned int i = 0; i < php.depthIndex_.size(); ++i) {
417  int k = php.depthIndex_[i];
418  edm::LogVerbatim("HGCalGeom") << "Reco Layer[" << i << ":" << k << "] First Layer " << php.depthLayerF_[i]
419  << " Depth " << php.depth_[k];
420  }
421  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.nSectors_ << " wafers";
422  for (unsigned int i = 0; i < php.waferCopy_.size(); ++i)
423  edm::LogVerbatim("HGCalGeom") << "Wafer[" << i << ": " << php.waferCopy_[i] << "] type " << php.waferTypeL_[i]
424  << ":" << php.waferTypeT_[i] << " at (" << php.waferPosX_[i] << ","
425  << php.waferPosY_[i] << ",0)";
426  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer radius " << php.waferR_ << " and dimensions of the "
427  << "wafers:";
428  edm::LogVerbatim("HGCalGeom") << "Sim[0] " << php.moduleLayS_[0] << " dx " << php.moduleBlS_[0] << ":"
429  << php.moduleTlS_[0] << " dy " << php.moduleHS_[0] << " dz " << php.moduleDzS_[0]
430  << " alpha " << php.moduleAlphaS_[0];
431  for (unsigned int k = 0; k < php.moduleLayR_.size(); ++k)
432  edm::LogVerbatim("HGCalGeom") << "Rec[" << k << "] " << php.moduleLayR_[k] << " dx " << php.moduleBlR_[k] << ":"
433  << php.moduleTlR_[k] << " dy " << php.moduleHR_[k] << " dz " << php.moduleDzR_[k]
434  << " alpha " << php.moduleAlphaR_[k];
435  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.cellFineX_.size() << " fine cells in a wafer";
436  for (unsigned int i = 0; i < php.cellFineX_.size(); ++i)
437  edm::LogVerbatim("HGCalGeom") << "Fine Cell[" << i << "] at (" << php.cellFineX_[i] << "," << php.cellFineY_[i]
438  << ",0)";
439  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.cellCoarseX_.size()
440  << " coarse cells in a wafer";
441  for (unsigned int i = 0; i < php.cellCoarseX_.size(); ++i)
442  edm::LogVerbatim("HGCalGeom") << "Coarse Cell[" << i << "] at (" << php.cellCoarseX_[i] << ","
443  << php.cellCoarseY_[i] << ",0)";
444  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size() << " transformation matrices";
445  for (unsigned int k = 0; k < php.trformIndex_.size(); ++k) {
446  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k] << std::dec
447  << ") Translation (" << php.trformTranX_[k] << ", " << php.trformTranY_[k] << ", "
448  << php.trformTranZ_[k] << " Rotation (" << php.trformRotXX_[k] << ", "
449  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", " << php.trformRotXY_[k]
450  << ", " << php.trformRotYY_[k] << ", " << php.trformRotZY_[k] << ", "
451  << php.trformRotXZ_[k] << ", " << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k]
452  << ")";
453  }
454  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
455  for (unsigned int k = 0; k < php.copiesInLayers_.size(); ++k) {
456  const auto& theModules = php.copiesInLayers_[k];
457  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
458  int k2(0);
459  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
460  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
461  }
462  }
463 #endif
464 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
std::vector< int > layer_
std::vector< double > moduleDzR_
std::vector< int > depthLayerF_
std::vector< int > depth_
std::vector< double > moduleHR_
layer_map copiesInLayers_
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
std::vector< int > moduleLayR_
std::vector< double > moduleHS_
std::vector< double > trformTranY_
std::vector< double > cellFineY_
std::vector< double > trformRotZY_
std::vector< uint32_t > trformIndex_
std::vector< double > trformRotXX_
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > cellCoarseX_
std::vector< double > trformRotYZ_
std::pair< double, double > cellPosition(const std::vector< cellParameters > &wafers, std::vector< cellParameters >::const_iterator &itrf, int wafer, double xx, double yy)
std::vector< double > boundR_
std::vector< double > moduleDzS_
std::vector< int > layerIndex_
std::vector< double > moduleAlphaR_
static double k_ScaleFromDDD
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
hgtrap getModule(unsigned int k, bool reco) const
std::vector< double > moduleBlR_
std::vector< double > rMinLayHex_
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > moduleTlS_
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
void scaleTrForm(double)
std::vector< int > layerGroup_
std::vector< double > trformRotYY_
std::vector< double > cellFineX_
std::vector< double > trformRotZZ_
std::vector< double > moduleAlphaS_
std::vector< double > moduleBlS_
std::vector< int > waferCopy_
std::vector< int > depthIndex_
std::vector< int > waferTypeT_
std::vector< double > cellCoarseY_
std::vector< int > moduleLayS_
std::vector< double > trformTranZ_
std::vector< double > waferPosX_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
std::vector< int > waferTypeL_
void HGCalGeomParameters::loadGeometryHexagon8 ( const DDFilteredView _fv,
HGCalParameters php,
int  firstLayer 
)

Definition at line 466 of file HGCalGeomParameters.cc.

References funct::abs(), filterCSVwithJSON::copy, DDFilteredView::copyNumbers(), Exception, spr::find(), AnalysisDataFormats_SUSYBSMObjects::hr, createfilelist::int, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, hgcalTopologyTester_cfi::layers, HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::logicalPart(), SiStripPI::max, DDFilteredView::next(), DDTubs::rIn(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), DDLogicalPart::solid(), tolerance, DDFilteredView::translation(), x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::hgtrform::zp, and ecaldqm::zside().

Referenced by HGCalGeomParameters::cellParameters::cellParameters().

466  {
467  DDFilteredView fv = _fv;
468  bool dodet(true);
469  std::map<int, HGCalGeomParameters::layerParameters> layers;
470  std::map<std::pair<int, int>, HGCalParameters::hgtrform> trforms;
471  int levelTop = 3 + std::max(php.levelT_[0], php.levelT_[1]);
472  while (dodet) {
473  const DDSolid& sol = fv.logicalPart().solid();
474  // Layers first
475  std::vector<int> copy = fv.copyNumbers();
476  int nsiz = (int)(copy.size());
477  int lay = (nsiz > levelTop) ? copy[nsiz - 4] : copy[nsiz - 1];
478  int zside = (nsiz > php.levelZSide_) ? copy[php.levelZSide_] : -1;
479  if (zside != 1)
480  zside = -1;
481  if (lay == 0) {
482  edm::LogError("HGCalGeom") << "Funny layer # " << lay << " zp " << zside << " in " << nsiz << " components";
483  throw cms::Exception("DDException") << "Funny layer # " << lay;
484  } else {
485  if (std::find(php.layer_.begin(), php.layer_.end(), lay) == php.layer_.end())
486  php.layer_.emplace_back(lay);
487  auto itr = layers.find(lay);
488  if (itr == layers.end()) {
489  const DDTubs& tube = static_cast<DDTubs>(sol);
490  double rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
491  double rout = HGCalParameters::k_ScaleFromDDD * tube.rOut();
492  double zp = HGCalParameters::k_ScaleFromDDD * fv.translation().Z();
493  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
494  layers[lay] = laypar;
495  }
496  if (trforms.find(std::make_pair(lay, zside)) == trforms.end()) {
497  DD3Vector x, y, z;
498  fv.rotation().GetComponents(x, y, z);
499  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(), x.Z(), y.Z(), z.Z());
500  const CLHEP::HepRotation hr(rotation);
501  double xx = ((std::abs(fv.translation().X()) < tolerance) ? 0 : fv.translation().X());
502  double yy = ((std::abs(fv.translation().Y()) < tolerance) ? 0 : fv.translation().Y());
503  const CLHEP::Hep3Vector h3v(xx, yy, fv.translation().Z());
505  mytrf.zp = zside;
506  mytrf.lay = lay;
507  mytrf.sec = 0;
508  mytrf.subsec = 0;
509  mytrf.h3v = h3v;
510  mytrf.hr = hr;
511  trforms[std::make_pair(lay, zside)] = mytrf;
512  }
513  }
514  dodet = fv.next();
515  }
516 
517  loadGeometryHexagon8(layers, trforms, firstLayer, php);
518 }
std::vector< int > layer_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
nav_type copyNumbers() const
return the stack of copy numbers
const double tolerance
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
int zside(DetId const &)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
bool next()
set current node to the next node in the filtered tree
susybsm::HSCParticleRef hr
Definition: classes.h:26
static double k_ScaleFromDDD
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void loadGeometryHexagon8(const DDFilteredView &, HGCalParameters &, int)
double rOut(void) const
Definition: DDSolid.cc:454
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< int > levelT_
double rIn(void) const
Definition: DDSolid.cc:452
void HGCalGeomParameters::loadGeometryHexagon8 ( const cms::DDFilteredView _fv,
HGCalParameters php,
int  firstLayer 
)

Definition at line 520 of file HGCalGeomParameters.cc.

520 {}
void HGCalGeomParameters::loadGeometryHexagon8 ( const std::map< int, HGCalGeomParameters::layerParameters > &  layers,
std::map< std::pair< int, int >, HGCalParameters::hgtrform > &  trforms,
const int &  firstLayer,
HGCalParameters php 
)
private

Definition at line 522 of file HGCalGeomParameters.cc.

References TauDecayModes::dec, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::fillTrForm(), mps_fire::i, dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, HGCalParameters::layerIndex_, HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalParameters::trformIndex_, HGCalParameters::trformRotXX_, HGCalParameters::trformRotXY_, HGCalParameters::trformRotXZ_, HGCalParameters::trformRotYX_, HGCalParameters::trformRotYY_, HGCalParameters::trformRotYZ_, HGCalParameters::trformRotZX_, HGCalParameters::trformRotZY_, HGCalParameters::trformRotZZ_, HGCalParameters::trformTranX_, HGCalParameters::trformTranY_, HGCalParameters::trformTranZ_, and HGCalParameters::zLayerHex_.

525  {
526  double rmin(0), rmax(0);
527  for (unsigned int i = 0; i < layers.size(); ++i) {
528  for (auto& layer : layers) {
529  if (layer.first == (int)(i + firstLayer)) {
530  php.layerIndex_.emplace_back(i);
531  php.rMinLayHex_.emplace_back(layer.second.rmin);
532  php.rMaxLayHex_.emplace_back(layer.second.rmax);
533  php.zLayerHex_.emplace_back(layer.second.zpos);
534  if (i == 0) {
535  rmin = layer.second.rmin;
536  rmax = layer.second.rmax;
537  } else {
538  if (rmin > layer.second.rmin)
539  rmin = layer.second.rmin;
540  if (rmax < layer.second.rmax)
541  rmax = layer.second.rmax;
542  }
543  break;
544  }
545  }
546  }
547  php.rLimit_.emplace_back(rmin);
548  php.rLimit_.emplace_back(rmax);
549  php.depth_ = php.layer_;
550  php.depthIndex_ = php.layerIndex_;
551  php.depthLayerF_ = php.layerIndex_;
552 
553  for (unsigned int i = 0; i < php.layer_.size(); ++i) {
554  for (auto& trform : trforms) {
555  if (trform.first.first == (int)(i + firstLayer)) {
556  trform.second.h3v *= HGCalParameters::k_ScaleFromDDD;
557  php.fillTrForm(trform.second);
558  }
559  }
560  }
561 
562 #ifdef EDM_ML_DEBUG
563  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R " << php.rLimit_[0] << ":" << php.rLimit_[1];
564  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds " << php.zLayerHex_.size() << " layers";
565  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
566  int k = php.layerIndex_[i];
567  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":" << php.layer_[k]
568  << "] with r = " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
569  << " at z = " << php.zLayerHex_[i];
570  }
571  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size() << " transformation matrices";
572  for (unsigned int k = 0; k < php.trformIndex_.size(); ++k) {
573  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k] << std::dec
574  << ") Translation (" << php.trformTranX_[k] << ", " << php.trformTranY_[k] << ", "
575  << php.trformTranZ_[k] << " Rotation (" << php.trformRotXX_[k] << ", "
576  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", " << php.trformRotXY_[k]
577  << ", " << php.trformRotYY_[k] << ", " << php.trformRotZY_[k] << ", "
578  << php.trformRotXZ_[k] << ", " << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k]
579  << ")";
580  }
581 #endif
582 }
std::vector< int > layer_
std::vector< int > depthLayerF_
std::vector< int > depth_
std::vector< double > trformTranY_
std::vector< double > trformRotZY_
std::vector< uint32_t > trformIndex_
std::vector< double > trformRotXX_
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > trformRotYZ_
std::vector< int > layerIndex_
static double k_ScaleFromDDD
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
std::vector< double > rMinLayHex_
std::vector< double > zLayerHex_
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
std::vector< double > trformRotYY_
std::vector< double > trformRotZZ_
std::vector< int > depthIndex_
std::vector< double > rLimit_
std::vector< double > trformTranZ_
void HGCalGeomParameters::loadSpecParsHexagon ( const DDFilteredView fv,
HGCalParameters php,
const DDCompactView cpv,
const std::string &  sdTag1,
const std::string &  sdTag2 
)

Definition at line 584 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::cellSize_, dbl_to_int(), DDFilteredView::firstChild(), getDDDArray(), HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, HGCalParameters::levelT_, DDFilteredView::mergedSpecifics(), rescale(), HGCalParameters::rLimit_, HGCalParameters::slopeMin_, AlCaHLTBitMon_QueryRunRegistry::string, pfDeepBoostedJetPreprocessParams_cfi::sv, and waferSize_.

Referenced by HGCalGeomParameters::cellParameters::cellParameters(), and loadSpecParsHexagon().

588  {
590  php.boundR_ = getDDDArray("RadiusBound", sv, 4);
592  php.rLimit_ = getDDDArray("RadiusLimits", sv, 2);
594  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv, 0));
595 
596  // Grouping of layers
597  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZFine", sv, 0));
598  php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid", sv, 0));
599  php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut", sv, 0));
600  php.slopeMin_ = getDDDArray("Slope", sv, 1);
601 
602  // Wafer size
603  std::string attribute = "Volume";
604  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, sdTag1, 0.0)};
605  DDFilteredView fv1(*cpv, filter1);
606  if (fv1.firstChild()) {
607  DDsvalues_type sv(fv1.mergedSpecifics());
608  const auto& dummy = getDDDArray("WaferSize", sv, 0);
609  waferSize_ = dummy[0];
610  }
611 
612  // Cell size
613  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, sdTag2, 0.0)};
614  DDFilteredView fv2(*cpv, filter2);
615  if (fv2.firstChild()) {
616  DDsvalues_type sv(fv2.mergedSpecifics());
617  php.cellSize_ = getDDDArray("CellSize", sv, 0);
618  }
619 
620  loadSpecParsHexagon(php);
621 }
void loadSpecParsHexagon(const DDFilteredView &, HGCalParameters &, const DDCompactView *, const std::string &, const std::string &)
void rescale(std::vector< double > &, const double s)
std::vector< int > layerGroupM_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > boundR_
std::vector< double > cellSize_
static double k_ScaleFromDDD
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
std::vector< double > slopeMin_
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
std::vector< int > layerGroupO_
std::vector< double > rLimit_
std::vector< int > levelT_
void HGCalGeomParameters::loadSpecParsHexagon ( const cms::DDFilteredView fv,
HGCalParameters php,
const cms::DDCompactView cpv,
const std::string &  sdTag1,
const std::string &  sdTag2,
const std::string &  sdTag3,
const std::string &  sdTag4 
)

Definition at line 623 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::cellSize_, dbl_to_int(), cms::DDFilteredView::get(), HGCalParameters::k_ScaleFromDD4Hep, HGCalParameters::k_ScaleFromDD4HepToG4, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, HGCalParameters::levelT_, loadSpecParsHexagon(), rescale(), HGCalParameters::rLimit_, HGCalParameters::slopeMin_, and waferSize_.

629  {
630  php.boundR_ = fv.get<std::vector<double> >(sdTag4, "RadiusBound");
632  php.rLimit_ = fv.get<std::vector<double> >(sdTag4, "RadiusLimits");
634  php.levelT_ = dbl_to_int(fv.get<std::vector<double> >(sdTag4, "LevelTop"));
635 
636  // Grouping of layers
637  php.layerGroup_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZFine"));
638  php.layerGroupM_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZMid"));
639  php.layerGroupO_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "GroupingZOut"));
640  php.slopeMin_ = fv.get<std::vector<double> >(sdTag4, "Slope");
641 
642  // Wafer size
643  const auto& dummy = fv.get<std::vector<double> >(sdTag2, "WaferSize");
645 
646  // Cell size
647  php.cellSize_ = fv.get<std::vector<double> >(sdTag3, "CellSize");
648  rescale(php.cellSize_, HGCalParameters::k_ScaleFromDD4HepToG4);
649 
650  loadSpecParsHexagon(php);
651 }
void loadSpecParsHexagon(const DDFilteredView &, HGCalParameters &, const DDCompactView *, const std::string &, const std::string &)
void rescale(std::vector< double > &, const double s)
std::vector< int > layerGroupM_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< double > boundR_
std::vector< double > cellSize_
static double k_ScaleFromDD4HepToG4
T get(const std::string &) const
extract attribute value
std::vector< double > slopeMin_
std::vector< int > layerGroup_
static double k_ScaleFromDD4Hep
std::vector< int > layerGroupO_
std::vector< double > rLimit_
std::vector< int > levelT_
void HGCalGeomParameters::loadSpecParsHexagon ( const HGCalParameters php)
private

Definition at line 653 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::cellSize_, dqmdumpme::k, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, HGCalParameters::levelT_, HGCalParameters::rLimit_, HGCalParameters::slopeMin_, and waferSize_.

653  {
654 #ifdef EDM_ML_DEBUG
655  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer radius ranges"
656  << " for cell grouping " << php.boundR_[0] << ":" << php.boundR_[1] << ":"
657  << php.boundR_[2] << ":" << php.boundR_[3];
658  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R " << php.rLimit_[0] << ":" << php.rLimit_[1];
659  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: LevelTop " << php.levelT_[0];
660  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: minimum slope " << php.slopeMin_[0] << " and layer groupings "
661  << "for the 3 ranges:";
662  for (unsigned int k = 0; k < php.layerGroup_.size(); ++k)
663  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerGroup_[k] << ":" << php.layerGroupM_[k] << ":"
664  << php.layerGroupO_[k];
665  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Wafer Size: " << waferSize_;
666  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: " << php.cellSize_.size() << " cells of sizes:";
667  for (unsigned int k = 0; k < php.cellSize_.size(); ++k)
668  edm::LogVerbatim("HGCalGeom") << " [" << k << "] " << php.cellSize_[k];
669 #endif
670 }
std::vector< int > layerGroupM_
std::vector< double > boundR_
std::vector< double > cellSize_
std::vector< double > slopeMin_
std::vector< int > layerGroup_
std::vector< int > layerGroupO_
std::vector< double > rLimit_
std::vector< int > levelT_
void HGCalGeomParameters::loadSpecParsHexagon8 ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 672 of file HGCalGeomParameters.cc.

References HGCalParameters::cellThickness_, HGCalParameters::choiceType_, dbl_to_int(), HGCalParameters::fracAreaMin_, DDVectorGetter::get(), getDDDArray(), createfilelist::int, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerCenter_, HGCalParameters::layerOffset_, DDFilteredView::mergedSpecifics(), HGCalParameters::nCornerCut_, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zMinForRad_, and HGCalParameters::zRanges_.

Referenced by HGCalGeomParameters::cellParameters::cellParameters(), and loadSpecParsHexagon8().

672  {
674  php.cellThickness_ = getDDDArray("CellThickness", sv, 3);
676 
677  php.radius100to200_ = getDDDArray("Radius100to200", sv, 5);
678  php.radius200to300_ = getDDDArray("Radius200to300", sv, 5);
679 
680  const auto& dummy = getDDDArray("RadiusCuts", sv, 4);
681  php.choiceType_ = (int)(dummy[0]);
682  php.nCornerCut_ = (int)(dummy[1]);
683  php.fracAreaMin_ = dummy[2];
685 
686  php.radiusMixBoundary_ = DDVectorGetter::get("RadiusMixBoundary");
688 
689  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
690  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
692  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
694 
695  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
696  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
698  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
700 
701  php.zRanges_ = DDVectorGetter::get("ZRanges");
703 
704  const auto& dummy2 = getDDDArray("LayerOffset", sv, 1);
705  php.layerOffset_ = dummy2[0];
706  php.layerCenter_ = dbl_to_int(DDVectorGetter::get("LayerCenter"));
707 
709 }
std::vector< double > zFrontMin_
void rescale(std::vector< double > &, const double s)
void loadSpecParsHexagon8(const DDFilteredView &, HGCalParameters &)
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
static double k_ScaleFromDDD
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
std::vector< double > get(const std::string &)
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > cellThickness_
std::vector< double > radius200to300_
std::vector< double > radius100to200_
DDsvalues_type mergedSpecifics() const
std::vector< double > rMinFront_
std::vector< double > zFrontTop_
void HGCalGeomParameters::loadSpecParsHexagon8 ( const cms::DDFilteredView fv,
const cms::DDVectorsMap vmap,
HGCalParameters php,
const std::string &  sdTag1 
)

Definition at line 711 of file HGCalGeomParameters.cc.

References HGCalParameters::cellThickness_, HGCalParameters::choiceType_, cms::dd::compareEqual(), HGCalParameters::fracAreaMin_, cms::DDFilteredView::get(), mps_fire::i, HGCalParameters::k_ScaleFromDD4Hep, HGCalParameters::k_ScaleFromDD4HepToG4, HGCalParameters::layerCenter_, HGCalParameters::layerOffset_, loadSpecParsHexagon8(), HGCalParameters::nCornerCut_, cms::dd::noNamespace(), HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zMinForRad_, and HGCalParameters::zRanges_.

714  {
715  php.cellThickness_ = fv.get<std::vector<double> >(sdTag1, "CellThickness");
717 
718  php.radius100to200_ = fv.get<std::vector<double> >(sdTag1, "Radius100to200");
719  php.radius200to300_ = fv.get<std::vector<double> >(sdTag1, "Radius200to300");
722 
723  const auto& dummy = fv.get<std::vector<double> >(sdTag1, "RadiusCuts");
724  php.choiceType_ = static_cast<int>(dummy[0]);
725  php.nCornerCut_ = static_cast<int>(dummy[1]);
728 
729  php.slopeMin_ = fv.get<std::vector<double> >(sdTag1, "SlopeBottom");
730  php.zFrontMin_ = fv.get<std::vector<double> >(sdTag1, "ZFrontBottom");
732  php.rMinFront_ = fv.get<std::vector<double> >(sdTag1, "RMinFront");
734 
735  php.slopeTop_ = fv.get<std::vector<double> >(sdTag1, "SlopeTop");
736  php.zFrontTop_ = fv.get<std::vector<double> >(sdTag1, "ZFrontTop");
738  php.rMaxFront_ = fv.get<std::vector<double> >(sdTag1, "RMaxFront");
740 
741  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
742  php.layerOffset_ = dummy2[0];
743 
744  for (auto const& it : vmap) {
745  if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), "RadiusMixBoundary")) {
746  for (const auto& i : it.second)
748  } else if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), "zRanges")) {
749  for (const auto& i : it.second)
750  php.zRanges_.emplace_back(HGCalParameters::k_ScaleFromDD4Hep * i);
751  } else if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), "LayerCenter")) {
752  for (const auto& i : it.second)
753  php.layerCenter_.emplace_back(std::round(i));
754  }
755  }
756 
758 }
std::vector< double > zFrontMin_
void rescale(std::vector< double > &, const double s)
std::string_view noNamespace(std::string_view)
Definition: Filter.cc:61
void loadSpecParsHexagon8(const DDFilteredView &, HGCalParameters &)
static double k_ScaleFromDD4HepToG4
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
T get(const std::string &) const
extract attribute value
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > cellThickness_
bool compareEqual(std::string_view, std::string_view)
std::vector< double > radius200to300_
std::vector< double > radius100to200_
std::vector< double > rMinFront_
static double k_ScaleFromDD4Hep
std::vector< double > zFrontTop_
void HGCalGeomParameters::loadSpecParsHexagon8 ( const HGCalParameters php)
private

Definition at line 760 of file HGCalGeomParameters.cc.

References HGCalParameters::cellThickness_, HGCalParameters::choiceType_, HGCalParameters::fracAreaMin_, dqmdumpme::k, HGCalParameters::layerCenter_, HGCalParameters::layerOffset_, HGCalParameters::nCornerCut_, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zMinForRad_, and HGCalParameters::zRanges_.

760  {
761 #ifdef EDM_ML_DEBUG
762  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: cell Thickness " << php.cellThickness_[0] << ":"
763  << php.cellThickness_[1] << ":" << php.cellThickness_[2];
764  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
765  << "parameters for 120 to 200 micron "
766  << "transition " << php.radius100to200_[0] << ":" << php.radius100to200_[1] << ":"
767  << php.radius100to200_[2] << ":" << php.radius100to200_[3] << ":"
768  << php.radius100to200_[4];
769  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Polynomial "
770  << "parameters for 200 to 300 micron "
771  << "transition " << php.radius200to300_[0] << ":" << php.radius200to300_[1] << ":"
772  << php.radius200to300_[2] << ":" << php.radius200to300_[3] << ":"
773  << php.radius200to300_[4];
774  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Parameters for the"
775  << " transition " << php.choiceType_ << ":" << php.nCornerCut_ << ":"
776  << php.fracAreaMin_ << ":" << php.zMinForRad_;
777  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k)
778  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Mix[" << k << "] R = " << php.radiusMixBoundary_[k];
779  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
780  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Bottom Z = " << php.zFrontMin_[k]
781  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
782  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
783  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Top Z = " << php.zFrontTop_[k]
784  << " Slope = " << php.slopeTop_[k] << " rMax = " << php.rMaxFront_[k];
785  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":" << php.zRanges_[1] << ":"
786  << php.zRanges_[2] << ":" << php.zRanges_[3];
787  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: LayerOffset " << php.layerOffset_ << " in array of size "
788  << php.layerCenter_.size();
789  for (unsigned int k = 0; k < php.layerCenter_.size(); ++k)
790  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerCenter_[k];
791 #endif
792 }
std::vector< double > zFrontMin_
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > cellThickness_
std::vector< double > radius200to300_
std::vector< double > radius100to200_
std::vector< double > rMinFront_
std::vector< double > zFrontTop_
void HGCalGeomParameters::loadSpecParsTrapezoid ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 794 of file HGCalGeomParameters.cc.

References HGCalParameters::cellSize_, dbl_to_int(), DDVectorGetter::get(), getDDDArray(), dqmdumpme::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerCenter_, HGCalParameters::layerFrontBH_, HGCalParameters::layerOffset_, M_PI, DDFilteredView::mergedSpecifics(), HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::nPhiBinBH_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::rMinLayerBH_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalParameters::xLayerHex_, HGCalParameters::yLayerHex_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zLayerHex_, and HGCalParameters::zRanges_.

Referenced by HGCalGeomParameters::cellParameters::cellParameters(), and loadSpecParsTrapezoid().

794  {
796  php.radiusMixBoundary_ = DDVectorGetter::get("RadiusMixBoundary");
798 
799  php.nPhiBinBH_ = dbl_to_int(getDDDArray("NPhiBinBH", sv, 0));
800  php.layerFrontBH_ = dbl_to_int(getDDDArray("LayerFrontBH", sv, 0));
801  php.rMinLayerBH_ = getDDDArray("RMinLayerBH", sv, 0);
803  php.nCellsFine_ = php.nPhiBinBH_[0];
804  php.nCellsCoarse_ = php.nPhiBinBH_[1];
805  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
806  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
807 
808  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
809  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
811  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
813 
814  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
815  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
817  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
819 
820  php.zRanges_ = DDVectorGetter::get("ZRanges");
822 
823  // Offsets
824  const auto& dummy2 = getDDDArray("LayerOffset", sv, 1);
825  php.layerOffset_ = dummy2[0];
826  php.layerCenter_ = dbl_to_int(DDVectorGetter::get("LayerCenter"));
827 
828  php.xLayerHex_.clear();
829  php.yLayerHex_.clear();
830  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
831  php.xLayerHex_.emplace_back(0);
832  php.yLayerHex_.emplace_back(0);
833  }
834 
836 }
std::vector< double > zFrontMin_
void rescale(std::vector< double > &, const double s)
std::vector< int > nPhiBinBH_
std::vector< double > rMinLayerBH_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > cellSize_
std::vector< double > yLayerHex_
static double k_ScaleFromDDD
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
void loadSpecParsTrapezoid(const DDFilteredView &, HGCalParameters &)
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
std::vector< double > zLayerHex_
std::vector< double > get(const std::string &)
#define M_PI
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
DDsvalues_type mergedSpecifics() const
std::vector< double > rMinFront_
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
std::vector< double > xLayerHex_
void HGCalGeomParameters::loadSpecParsTrapezoid ( const cms::DDFilteredView fv,
const cms::DDVectorsMap vmap,
HGCalParameters php,
const std::string &  sdTag1 
)

Definition at line 838 of file HGCalGeomParameters.cc.

References HGCalParameters::cellSize_, cms::dd::compareEqual(), dbl_to_int(), cms::DDFilteredView::get(), mps_fire::i, dqmdumpme::k, HGCalParameters::k_ScaleFromDD4Hep, HGCalParameters::layerCenter_, HGCalParameters::layerFrontBH_, HGCalParameters::layerOffset_, loadSpecParsTrapezoid(), M_PI, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, cms::dd::noNamespace(), HGCalParameters::nPhiBinBH_, HGCalParameters::radiusMixBoundary_, rescale(), HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::rMinLayerBH_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalParameters::xLayerHex_, HGCalParameters::yLayerHex_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zLayerHex_, and HGCalParameters::zRanges_.

841  {
842  for (auto const& it : vmap) {
843  if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), "RadiusMixBoundary")) {
844  for (const auto& i : it.second)
846  } else if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), "zRanges")) {
847  for (const auto& i : it.second)
848  php.zRanges_.emplace_back(HGCalParameters::k_ScaleFromDD4Hep * i);
849  } else if (cms::dd::compareEqual(cms::dd::noNamespace(it.first), "LayerCenter")) {
850  for (const auto& i : it.second)
851  php.layerCenter_.emplace_back(std::round(i));
852  }
853  }
854 
855  php.nPhiBinBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "NPhiBinBH"));
856  php.layerFrontBH_ = dbl_to_int(fv.get<std::vector<double> >(sdTag1, "LayerFrontBH"));
857  php.rMinLayerBH_ = fv.get<std::vector<double> >(sdTag1, "RMinLayerBH");
859  php.nCellsFine_ = php.nPhiBinBH_[0];
860  php.nCellsCoarse_ = php.nPhiBinBH_[1];
861  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
862  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
863 
864  php.slopeMin_ = fv.get<std::vector<double> >(sdTag1, "SlopeBottom");
865  php.zFrontMin_ = fv.get<std::vector<double> >(sdTag1, "ZFrontBottom");
867  php.rMinFront_ = fv.get<std::vector<double> >(sdTag1, "RMinFront");
869 
870  php.slopeTop_ = fv.get<std::vector<double> >(sdTag1, "SlopeTop");
871  php.zFrontTop_ = fv.get<std::vector<double> >(sdTag1, "ZFrontTop");
873  php.rMaxFront_ = fv.get<std::vector<double> >(sdTag1, "RMaxFront");
875 
876  const auto& dummy2 = fv.get<std::vector<double> >(sdTag1, "LayerOffset");
877  php.layerOffset_ = dummy2[0];
878 
879  php.xLayerHex_.clear();
880  php.yLayerHex_.clear();
881  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
882  php.xLayerHex_.emplace_back(0);
883  php.yLayerHex_.emplace_back(0);
884  }
885 
887 }
std::vector< double > zFrontMin_
void rescale(std::vector< double > &, const double s)
std::string_view noNamespace(std::string_view)
Definition: Filter.cc:61
std::vector< int > nPhiBinBH_
std::vector< double > rMinLayerBH_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< double > cellSize_
std::vector< double > yLayerHex_
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< int > layerCenter_
void loadSpecParsTrapezoid(const DDFilteredView &, HGCalParameters &)
T get(const std::string &) const
extract attribute value
std::vector< double > zLayerHex_
#define M_PI
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
bool compareEqual(std::string_view, std::string_view)
std::vector< double > rMinFront_
static double k_ScaleFromDD4Hep
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
std::vector< double > xLayerHex_
void HGCalGeomParameters::loadSpecParsTrapezoid ( const HGCalParameters php)
private

Definition at line 889 of file HGCalGeomParameters.cc.

References HGCalParameters::cellSize_, HGCalParameters::firstLayer_, dqmdumpme::k, HGCalParameters::layerCenter_, HGCalParameters::layerFrontBH_, HGCalParameters::layerOffset_, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::rMinLayerBH_, HGCalParameters::scintCells(), HGCalParameters::scintCellSize(), HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, HGCalParameters::xLayerHex_, HGCalParameters::yLayerHex_, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, HGCalParameters::zLayerHex_, and HGCalParameters::zRanges_.

889  {
890 #ifdef EDM_ML_DEBUG
891  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters:nCells " << php.nCellsFine_ << ":" << php.nCellsCoarse_
892  << " cellSize: " << php.cellSize_[0] << ":" << php.cellSize_[1];
893  for (unsigned int k = 0; k < php.layerFrontBH_.size(); ++k)
894  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Type[" << k << "] Front Layer = " << php.layerFrontBH_[k]
895  << " rMin = " << php.rMinLayerBH_[k];
896  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k) {
897  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Mix[" << k << "] R = " << php.radiusMixBoundary_[k]
898  << " Nphi = " << php.scintCells(k + php.firstLayer_)
899  << " dPhi = " << php.scintCellSize(k + php.firstLayer_);
900  }
901 
902  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
903  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Bottom Z = " << php.zFrontMin_[k]
904  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
905 
906  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
907  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k << "] Top Z = " << php.zFrontTop_[k]
908  << " Slope = " << php.slopeTop_[k] << " rMax = " << php.rMaxFront_[k];
909 
910  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":" << php.zRanges_[1] << ":"
911  << php.zRanges_[2] << ":" << php.zRanges_[3];
912 
913  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: LayerOffset " << php.layerOffset_ << " in array of size "
914  << php.layerCenter_.size();
915  for (unsigned int k = 0; k < php.layerCenter_.size(); ++k)
916  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.layerCenter_[k];
917 
918  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k)
919  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Shift " << php.xLayerHex_[k] << ":" << php.yLayerHex_[k];
920 #endif
921 }
std::vector< double > zFrontMin_
double scintCellSize(const int layer) const
std::vector< double > rMinLayerBH_
std::vector< double > cellSize_
std::vector< double > yLayerHex_
std::vector< double > rMaxFront_
int scintCells(const int layer) const
std::vector< double > slopeTop_
std::vector< int > layerCenter_
std::vector< double > zLayerHex_
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
std::vector< double > rMinFront_
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
std::vector< double > xLayerHex_
void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 923 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::copiesInLayers_, filterCSVwithJSON::copy, distTCMET_cfi::corner, PVValHelper::dx, PVValHelper::dy, createfilelist::int, dqmdumpme::k, HGCalParameters::k_CornerSize, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, EgHLTOffHistBins_cfi::nr, HGCalParameters::nSectors_, HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, findQualityFiles::rr, mathSSE::sqrt(), funct::tan(), HGCalParameters::waferCopy_, HGCalGeomTools::waferCorner(), HGCalWaferIndex::waferIndex(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypes_, HGCalParameters::waferTypeT_, HGCalParameters::waferUVMax_, and LaserClient_cfi::wl.

923  {
925  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
926 #ifdef EDM_ML_DEBUG
927  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << rmin << " R Limits: " << rin << ":" << rout
928  << " Fine " << rMaxFine;
929 #endif
930  // Clear the vectors
931  php.waferCopy_.clear();
932  php.waferTypeL_.clear();
933  php.waferTypeT_.clear();
934  php.waferPosX_.clear();
935  php.waferPosY_.clear();
936  double dx = 0.5 * waferW;
937  double dy = 3.0 * dx * tan(30._deg);
938  double rr = 2.0 * dx * tan(30._deg);
939  int ncol = (int)(2.0 * rout / waferW) + 1;
940  int nrow = (int)(rout / (waferW * tan(30._deg))) + 1;
941  int ns2 = (2 * ncol + 1) * (2 * nrow + 1) * php.layer_.size();
942  int incm(0), inrm(0), kount(0), ntot(0);
943  HGCalParameters::layer_map copiesInLayers(php.layer_.size() + 1);
944  HGCalParameters::waferT_map waferTypes(ns2 + 1);
945 #ifdef EDM_ML_DEBUG
946  edm::LogVerbatim("HGCalGeom") << "Row " << nrow << " Column " << ncol;
947 #endif
948  for (int nr = -nrow; nr <= nrow; ++nr) {
949  int inr = (nr >= 0) ? nr : -nr;
950  for (int nc = -ncol; nc <= ncol; ++nc) {
951  int inc = (nc >= 0) ? nc : -nc;
952  if (inr % 2 == inc % 2) {
953  double xpos = nc * dx;
954  double ypos = nr * dy;
955  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
956  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
957  int typet = (rpos < rMaxFine) ? 1 : 2;
958  int typel(3);
959  for (int k = 1; k < 4; ++k) {
960  if ((rpos + rmin) <= php.boundR_[k]) {
961  typel = k;
962  break;
963  }
964  }
965  ++ntot;
966  if (corner.first > 0) {
967  int copy = inr * 100 + inc;
968  if (nc < 0)
969  copy += 10000;
970  if (nr < 0)
971  copy += 100000;
972  if (inc > incm)
973  incm = inc;
974  if (inr > inrm)
975  inrm = inr;
976  kount++;
977 #ifdef EDM_ML_DEBUG
978  edm::LogVerbatim("HGCalGeom") << kount << ":" << ntot << " Copy " << copy << " Type " << typel << ":" << typet
979  << " Location " << corner.first << " Position " << xpos << ":" << ypos
980  << " Layers " << php.layer_.size();
981 #endif
982  php.waferCopy_.emplace_back(copy);
983  php.waferTypeL_.emplace_back(typel);
984  php.waferTypeT_.emplace_back(typet);
985  php.waferPosX_.emplace_back(xpos);
986  php.waferPosY_.emplace_back(ypos);
987  for (unsigned int il = 0; il < php.layer_.size(); ++il) {
988  std::pair<int, int> corner =
989  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, php.rMinLayHex_[il], php.rMaxLayHex_[il], true);
990  if (corner.first > 0) {
991  auto cpy = copiesInLayers[php.layer_[il]].find(copy);
992  if (cpy == copiesInLayers[php.layer_[il]].end())
993  copiesInLayers[php.layer_[il]][copy] =
994  ((corner.first == (int)(HGCalParameters::k_CornerSize)) ? php.waferCopy_.size() : -1);
995  }
996  if ((corner.first > 0) && (corner.first < (int)(HGCalParameters::k_CornerSize))) {
997  int wl = HGCalWaferIndex::waferIndex(php.layer_[il], copy, 0, true);
998  waferTypes[wl] = std::make_pair(corner.first, corner.second);
999  }
1000  }
1001  }
1002  }
1003  }
1004  }
1005  php.copiesInLayers_ = copiesInLayers;
1006  php.waferTypes_ = waferTypes;
1007  php.nSectors_ = (int)(php.waferCopy_.size());
1008  php.waferUVMax_ = 0;
1009 #ifdef EDM_ML_DEBUG
1010  edm::LogVerbatim("HGCalGeom") << "HGCalWaferHexagon: # of columns " << incm << " # of rows " << inrm << " and "
1011  << kount << ":" << ntot << " wafers; R " << rin << ":" << rout;
1012  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
1013  for (unsigned int k = 0; k < copiesInLayers.size(); ++k) {
1014  const auto& theModules = copiesInLayers[k];
1015  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
1016  int k2(0);
1017  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin(); itr != theModules.end(); ++itr, ++k2) {
1018  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":" << itr->second;
1019  }
1020  }
1021 #endif
1022 }
std::vector< double > waferPosY_
std::vector< int > layer_
layer_map copiesInLayers_
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
std::vector< double > boundR_
T sqrt(T t)
Definition: SSEVec.h:19
static double k_ScaleFromDDD
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
std::vector< double > rMinLayHex_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
waferT_map waferTypes_
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
std::unordered_map< int32_t, std::pair< int32_t, int32_t > > waferT_map
std::vector< int > waferCopy_
std::vector< double > rLimit_
std::vector< int > waferTypeT_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
void HGCalGeomParameters::loadWaferHexagon8 ( HGCalParameters php)

Definition at line 1024 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, filterCSVwithJSON::copy, distTCMET_cfi::corner, TauDecayModes::dec, HGCalParameters::defineFull_, PVValHelper::dy, HGCalParameters::hgtrap::dz, PVValHelper::dz, HGCalParameters::fillModule(), HGCalParameters::fracAreaMin_, geomTools_, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, mps_fire::i, triggerObjects_cff::id, createfilelist::int, dqmdumpme::k, HGCalParameters::k_CornerSize, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, HGCalParameters::layerCenter_, HGCalParameters::layerIndex_, HGCalParameters::layerOffset_, SiStripPI::max, N, HGCalParameters::nCornerCut_, EgHLTOffHistBins_cfi::nr, HGCalParameters::nSectors_, dttmaxenums::R, alignCSCRings::r, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalParameters::sensorSeparation_, HGCalGeomTools::shiftXY(), sqrt3_, HGCalParameters::hgtrap::tl, HGCalParameters::typesInLayers_, findQualityFiles::v, HGCalParameters::waferCopy_, HGCalGeomTools::waferCorner(), HGCalWaferIndex::waferIndex(), HGCalWaferIndex::waferLayer(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, HGCalParameters::wafersInLayers_, HGCalParameters::waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypes_, HGCalParameters::waferTypeT_, HGCalWaferIndex::waferU(), HGCalParameters::waferUVMax_, HGCalParameters::waferUVMaxLayer_, HGCalWaferIndex::waferV(), LaserClient_cfi::wl, HGCalParameters::xLayerHex_, HGCalParameters::yLayerHex_, HGCalParameters::zLayerHex_, and HGCalParameters::zMinForRad_.

1024  {
1025  double waferW(php.waferSize_);
1026  double waferS(php.sensorSeparation_);
1027  auto wType = std::make_unique<HGCalWaferType>(php.radius100to200_,
1028  php.radius200to300_,
1029  HGCalParameters::k_ScaleToDDD * (waferW + waferS),
1031  php.choiceType_,
1032  php.nCornerCut_,
1033  php.fracAreaMin_);
1034 
1035  double rout(php.rLimit_[1]);
1036 #ifdef EDM_ML_DEBUG
1037  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":" << waferS << " R Max: " << rout;
1038 #endif
1039  // Clear the vectors
1040  php.waferCopy_.clear();
1041  php.waferTypeL_.clear();
1042  php.waferTypeT_.clear();
1043  php.waferPosX_.clear();
1044  php.waferPosY_.clear();
1045  double r = 0.5 * (waferW + waferS);
1046  double R = 2.0 * r / sqrt3_;
1047  double dy = 0.75 * R;
1048  int N = (r == 0) ? 3 : ((int)(0.5 * rout / r) + 3);
1049  int ns1 = (2 * N + 1) * (2 * N + 1);
1050  int ns2 = ns1 * php.zLayerHex_.size();
1051 #ifdef EDM_ML_DEBUG
1052  edm::LogVerbatim("HGCalGeom") << "r " << r << " dy " << dy << " N " << N << " sizes " << ns1 << ":" << ns2;
1053  std::vector<int> indtypes(ns1 + 1);
1054  indtypes.clear();
1055 #endif
1056  HGCalParameters::wafer_map wafersInLayers(ns1 + 1);
1057  HGCalParameters::wafer_map typesInLayers(ns2 + 1);
1058  HGCalParameters::waferT_map waferTypes(ns2 + 1);
1059  int ipos(0), lpos(0), uvmax(0);
1060  std::vector<int> uvmx(php.zLayerHex_.size(), 0);
1061  for (int v = -N; v <= N; ++v) {
1062  for (int u = -N; u <= N; ++u) {
1063  int nr = 2 * v;
1064  int nc = -2 * u + v;
1065  double xpos = nc * r;
1066  double ypos = nr * dy;
1067  int indx = HGCalWaferIndex::waferIndex(0, u, v);
1068  php.waferCopy_.emplace_back(indx);
1069  php.waferPosX_.emplace_back(xpos);
1070  php.waferPosY_.emplace_back(ypos);
1071  wafersInLayers[indx] = ipos;
1072  ++ipos;
1073  std::pair<int, int> corner = HGCalGeomTools::waferCorner(xpos, ypos, r, R, 0, rout, false);
1074  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) || ((corner.first > 0) && php.defineFull_)) {
1075  uvmax = std::max(uvmax, std::max(std::abs(u), std::abs(v)));
1076  }
1077  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
1078  int copy = i + php.layerOffset_;
1079  std::pair<double, double> xyoff = geomTools_.shiftXY(php.layerCenter_[copy], (waferW + waferS));
1080  int lay = php.layer_[php.layerIndex_[i]];
1081  double zpos = php.zLayerHex_[i];
1082  int type = wType->getType(HGCalParameters::k_ScaleToDDD * (xpos + xyoff.first),
1083  HGCalParameters::k_ScaleToDDD * (ypos + xyoff.second),
1085  php.waferTypeL_.emplace_back(type);
1086  int kndx = HGCalWaferIndex::waferIndex(lay, u, v);
1087  typesInLayers[kndx] = lpos;
1088  ++lpos;
1089 #ifdef EDM_ML_DEBUG
1090  indtypes.emplace_back(kndx);
1091 #endif
1092  std::pair<int, int> corner =
1093  HGCalGeomTools::waferCorner(xpos, ypos, r, R, php.rMinLayHex_[i], php.rMaxLayHex_[i], false);
1094 #ifdef EDM_ML_DEBUG
1095  if (((corner.first == 0) && std::abs(u) < 5 && std::abs(v) < 5) || (std::abs(u) < 2 && std::abs(v) < 2)) {
1096  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " R " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
1097  << " u " << u << " v " << v << " with " << corner.first << " corners";
1098  }
1099 #endif
1100  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) || ((corner.first > 0) && php.defineFull_)) {
1101  uvmx[i] = std::max(uvmx[i], std::max(std::abs(u), std::abs(v)));
1102  }
1103  if ((corner.first < (int)(HGCalParameters::k_CornerSize)) && (corner.first > 0)) {
1104 #ifdef EDM_ML_DEBUG
1105  edm::LogVerbatim("HGCalGeom") << "Layer " << lay << " u|v " << u << ":" << v << " with " << corner.first
1106  << " corners First " << corner.second;
1107 #endif
1108  int wl = HGCalWaferIndex::waferIndex(lay, u, v);
1109  waferTypes[wl] = std::make_pair(corner.first, corner.second);
1110  }
1111  }
1112  }
1113  }
1114  php.waferUVMax_ = uvmax;
1115  php.waferUVMaxLayer_ = uvmx;
1116  php.wafersInLayers_ = wafersInLayers;
1117  php.typesInLayers_ = typesInLayers;
1118  php.waferTypes_ = waferTypes;
1119  php.nSectors_ = (int)(php.waferCopy_.size());
1121  mytr.lay = 1;
1122  mytr.bl = php.waferR_;
1123  mytr.tl = php.waferR_;
1124  mytr.h = php.waferR_;
1125  mytr.alpha = 0.0;
1127  for (auto const& dz : php.cellThickness_) {
1128  mytr.dz = 0.5 * HGCalParameters::k_ScaleToDDD * dz;
1129  php.fillModule(mytr, false);
1130  }
1131  for (unsigned k = 0; k < php.cellThickness_.size(); ++k) {
1132  HGCalParameters::hgtrap mytr = php.getModule(k, false);
1138  php.fillModule(mytr, true);
1139  }
1140 #ifdef EDM_ML_DEBUG
1141  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Total of " << php.waferCopy_.size() << " wafers";
1142  for (unsigned int k = 0; k < php.waferCopy_.size(); ++k) {
1143  int id = php.waferCopy_[k];
1144  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << std::hex << id << std::dec << ":"
1145  << HGCalWaferIndex::waferLayer(id) << ":" << HGCalWaferIndex::waferU(id) << ":"
1146  << HGCalWaferIndex::waferV(id) << " x " << php.waferPosX_[k] << " y "
1147  << php.waferPosY_[k] << " index " << php.wafersInLayers_[id];
1148  }
1149  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Total of " << php.waferTypeL_.size() << " wafer types";
1150  for (unsigned int k = 0; k < php.waferTypeL_.size(); ++k) {
1151  int id = indtypes[k];
1152  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.typesInLayers_[id] << ":" << php.waferTypeL_[k] << " ID "
1153  << std::hex << id << std::dec << ":" << HGCalWaferIndex::waferLayer(id) << ":"
1154  << HGCalWaferIndex::waferU(id) << ":" << HGCalWaferIndex::waferV(id);
1155  }
1156 #endif
1157 
1158  //Wafer offset
1159  php.xLayerHex_.clear();
1160  php.yLayerHex_.clear();
1161  double waferSize = php.waferSize_ + php.sensorSeparation_;
1162 #ifdef EDM_ML_DEBUG
1163  edm::LogVerbatim("HGCalGeom") << "WaferSize " << waferSize;
1164 #endif
1165  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
1166  int copy = k + php.layerOffset_;
1167  std::pair<double, double> xyoff = geomTools_.shiftXY(php.layerCenter_[copy], waferSize);
1168  php.xLayerHex_.emplace_back(xyoff.first);
1169  php.yLayerHex_.emplace_back(xyoff.second);
1170 #ifdef EDM_ML_DEBUG
1171  edm::LogVerbatim("HGCalGeom") << "Layer[" << k << "] Off " << copy << ":" << php.layerCenter_[copy] << " Shift "
1172  << xyoff.first << ":" << xyoff.second;
1173 #endif
1174  }
1175 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
std::vector< int > layer_
static int32_t waferV(const int32_t index)
wafer_map wafersInLayers_
static std::pair< int32_t, int32_t > waferCorner(double xpos, double ypos, double r, double R, double rMin, double rMax, bool oldBug=false)
std::vector< int > waferUVMaxLayer_
std::vector< int > layerIndex_
std::vector< double > yLayerHex_
static double k_ScaleFromDDD
hgtrap getModule(unsigned int k, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< int > layerCenter_
static int32_t waferU(const int32_t index)
std::vector< double > rMinLayHex_
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV, bool old=false)
void fillModule(const hgtrap &mytr, bool reco)
static int32_t waferLayer(const int32_t index)
std::vector< double > zLayerHex_
waferT_map waferTypes_
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
std::unordered_map< int32_t, std::pair< int32_t, int32_t > > waferT_map
#define N
Definition: blowfish.cc:9
std::vector< double > cellThickness_
std::unordered_map< int32_t, int32_t > wafer_map
static double k_ScaleToDDD
std::vector< double > radius200to300_
std::vector< double > radius100to200_
wafer_map typesInLayers_
std::vector< int > waferCopy_
std::vector< double > rLimit_
std::vector< int > waferTypeT_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_
std::vector< double > xLayerHex_
std::pair< double, double > shiftXY(int waferPosition, double waferSize)
void HGCalGeomParameters::rescale ( std::vector< double > &  v,
const double  s 
)
private

Member Data Documentation

HGCalGeomTools HGCalGeomParameters::geomTools_
private

Definition at line 107 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

const double HGCalGeomParameters::sqrt3_
private

Definition at line 108 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

double HGCalGeomParameters::waferSize_
private