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 loadCellTrapezoid (HGCalParameters &php)
 
void loadGeometryHexagon (const DDFilteredView &, HGCalParameters &, const std::string &, const DDCompactView *, const std::string &, const std::string &, HGCalGeometryMode::WaferMode)
 
void loadGeometryHexagon8 (const DDFilteredView &, HGCalParameters &, int)
 
void loadSpecParsHexagon (const DDFilteredView &, HGCalParameters &, const DDCompactView *, const std::string &, const std::string &)
 
void loadSpecParsHexagon8 (const DDFilteredView &, HGCalParameters &)
 
void loadSpecParsTrapezoid (const DDFilteredView &, HGCalParameters &)
 
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)
 

Private Attributes

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 27 of file HGCalGeomParameters.h.

Constructor & Destructor Documentation

HGCalGeomParameters::HGCalGeomParameters ( )

Definition at line 29 of file HGCalGeomParameters.cc.

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

Definition at line 36 of file HGCalGeomParameters.cc.

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

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 1284 of file HGCalGeomParameters.cc.

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

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

1287  {
1288  if (itrf == wafers.end()) {
1289  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr =
1290  wafers.begin();
1291  itr != wafers.end(); ++itr) {
1292  if (itr->wafer == wafer) {
1293  itrf = itr;
1294  break;
1295  }
1296  }
1297  }
1298  double dx(0), dy(0);
1299  if (itrf != wafers.end()) {
1300  dx = (xx - itrf->xyz.x());
1301  if (std::abs(dx) < tolerance) dx = 0;
1302  dy = (yy - itrf->xyz.y());
1303  if (std::abs(dy) < tolerance) dy = 0;
1304  }
1305  return std::make_pair(dx, dy);
1306 }
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 1247 of file HGCalGeomParameters.cc.

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

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

1249  {
1250  DDValue value(str);
1251  if (DDfetch(&sv, value)) {
1252  const std::vector<double>& fvec = value.doubles();
1253  int nval = fvec.size();
1254  if (nmin > 0) {
1255  if (nval < nmin) {
1256  edm::LogError("HGCalGeom")
1257  << "HGCalGeomParameters : # of " << str << " bins " << nval << " < "
1258  << nmin << " ==> illegal";
1259  throw cms::Exception("DDException")
1260  << "HGCalGeomParameters: cannot get array " << str;
1261  }
1262  } else {
1263  if (nval < 1 && nmin == 0) {
1264  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
1265  << " bins " << nval << " < 1 ==> illegal"
1266  << " (nmin=" << nmin << ")";
1267  throw cms::Exception("DDException")
1268  << "HGCalGeomParameters: cannot get array " << str;
1269  }
1270  }
1271  return fvec;
1272  } else {
1273  if (nmin >= 0) {
1274  edm::LogError("HGCalGeom")
1275  << "HGCalGeomParameters: cannot get array " << str;
1276  throw cms::Exception("DDException")
1277  << "HGCalGeomParameters: cannot get array " << str;
1278  }
1279  std::vector<double> fvec;
1280  return fvec;
1281  }
1282 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:81
Definition: value.py:1
#define str(s)
void HGCalGeomParameters::loadCellParsHexagon ( const DDCompactView cpv,
HGCalParameters php 
)

Definition at line 1086 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

1087  {
1088  // Special parameters for cell parameters
1089  std::string attribute = "OnlyForHGCalNumbering";
1090  DDSpecificsHasNamedValueFilter filter1{attribute};
1091  DDFilteredView fv1(*cpv, filter1);
1092  bool ok = fv1.firstChild();
1093 
1094  if (ok) {
1095  php.cellFine_ = dbl_to_int(DDVectorGetter::get("waferFine"));
1096  php.cellCoarse_ = dbl_to_int(DDVectorGetter::get("waferCoarse"));
1097  }
1098 
1099 #ifdef EDM_ML_DEBUG
1100  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: " << php.cellFine_.size()
1101  << " rows for fine cells";
1102  for (unsigned int k = 0; k < php.cellFine_.size(); ++k)
1103  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
1104  edm::LogVerbatim("HGCalGeom")
1105  << "HGCalLoadCellPars: " << php.cellCoarse_.size()
1106  << " rows for coarse cells";
1107  for (unsigned int k = 0; k < php.cellCoarse_.size(); ++k)
1108  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
1109 #endif
1110 }
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_
std::vector< double > get(const std::string &)
int k[5][pyjets_maxn]
void HGCalGeomParameters::loadCellTrapezoid ( HGCalParameters php)

Definition at line 1112 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, createfilelist::int, HGCalParameters::iradMaxBH_, HGCalParameters::iradMinBH_, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, GetRecoTauVFromDQM_MC_cff::kk, HGCalParameters::lastModule_, HGCalParameters::hgtrap::lay, HGCalParameters::layerFrontBH_, cmsBatch::log, 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_.

Referenced by HGCalParametersFromDD::build().

1112  {
1113  // Find the radius of each eta-partitions
1114  for (unsigned k = 0; k < 2; ++k) {
1115  double rmax =
1116  ((k == 0)
1117  ? (php.rMaxLayHex_[php.layerFrontBH_[1] - php.firstLayer_] - 1)
1118  : (php.rMaxLayHex_[php.rMaxLayHex_.size() - 1]));
1119  double rv = php.rMinLayerBH_[k];
1120  double zv =
1121  ((k == 0) ? (php.zLayerHex_[php.layerFrontBH_[1] - php.firstLayer_])
1122  : (php.zLayerHex_[php.zLayerHex_.size() - 1]));
1123  php.radiusLayer_[k].emplace_back(rv);
1124 #ifdef EDM_ML_DEBUG
1125  double eta = -(std::log(std::tan(0.5 * std::atan(rv / zv))));
1126  edm::LogVerbatim("HGCalGeom")
1127  << "[" << k << "] rmax " << rmax << " Z = " << zv
1128  << " dEta = " << php.cellSize_[k] << "\n[0] new R = " << rv
1129  << " Eta = " << eta;
1130  int kount(1);
1131 #endif
1132  while (rv < rmax) {
1133  double eta =
1134  -(php.cellSize_[k] + std::log(std::tan(0.5 * std::atan(rv / zv))));
1135  rv = zv * std::tan(2.0 * std::atan(std::exp(-eta)));
1136  php.radiusLayer_[k].emplace_back(rv);
1137 #ifdef EDM_ML_DEBUG
1138  edm::LogVerbatim("HGCalGeom")
1139  << "[" << kount << "] new R = " << rv << " Eta = " << eta;
1140  ++kount;
1141 #endif
1142  }
1143  }
1144 
1145  // Find minimum and maximum radius index for each layer
1146  for (unsigned k = 0; k < php.zLayerHex_.size(); ++k) {
1147  int kk = php.scintType(php.firstLayer_ + (int)(k));
1148  std::vector<double>::iterator low, high;
1149  low = std::lower_bound(php.radiusLayer_[kk].begin(),
1150  php.radiusLayer_[kk].end(), php.rMinLayHex_[k]);
1151 #ifdef EDM_ML_DEBUG
1152  edm::LogVerbatim("HGCalGeom")
1153  << "[" << k << "] RLow = " << php.rMinLayHex_[k] << " pos "
1154  << (int)(low - php.radiusLayer_[kk].begin());
1155 #endif
1156  if (low == php.radiusLayer_[kk].begin()) ++low;
1157  int irlow = (int)(low - php.radiusLayer_[kk].begin());
1158  double drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
1159 #ifdef EDM_ML_DEBUG
1160  edm::LogVerbatim("HGCalGeom")
1161  << "irlow " << irlow << " dr " << drlow << " min " << php.minTileSize_;
1162 #endif
1163  if (drlow < php.minTileSize_) {
1164  ++irlow;
1165 #ifdef EDM_ML_DEBUG
1166  drlow = php.radiusLayer_[kk][irlow] - php.rMinLayHex_[k];
1167  edm::LogVerbatim("HGCalGeom")
1168  << "Modified irlow " << irlow << " dr " << drlow;
1169 #endif
1170  }
1171  high = std::lower_bound(php.radiusLayer_[kk].begin(),
1172  php.radiusLayer_[kk].end(), php.rMaxLayHex_[k]);
1173 #ifdef EDM_ML_DEBUG
1174  edm::LogVerbatim("HGCalGeom")
1175  << "[" << k << "] RHigh = " << php.rMaxLayHex_[k] << " pos "
1176  << (int)(high - php.radiusLayer_[kk].begin());
1177 #endif
1178  if (high == php.radiusLayer_[kk].end()) --high;
1179  int irhigh = (int)(high - php.radiusLayer_[kk].begin());
1180  double drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
1181 #ifdef EDM_ML_DEBUG
1182  edm::LogVerbatim("HGCalGeom") << "irhigh " << irhigh << " dr " << drhigh
1183  << " min " << php.minTileSize_;
1184 #endif
1185  if (drhigh < php.minTileSize_) {
1186  --irhigh;
1187 #ifdef EDM_ML_DEBUG
1188  drhigh = php.rMaxLayHex_[k] - php.radiusLayer_[kk][irhigh - 1];
1189  edm::LogVerbatim("HGCalGeom")
1190  << "Modified irhigh " << irhigh << " dr " << drhigh;
1191 #endif
1192  }
1193  php.iradMinBH_.emplace_back(irlow);
1194  php.iradMaxBH_.emplace_back(irhigh);
1195 #ifdef EDM_ML_DEBUG
1196  edm::LogVerbatim("HGcalGeom")
1197  << "Layer " << k << " Type " << kk << " Low edge " << irlow << ":"
1198  << drlow << " Top edge " << irhigh << ":" << drhigh;
1199 #endif
1200  }
1201 
1202  // Now define the volumes
1203  int im(0);
1204  php.waferUVMax_ = 0;
1206  mytr.alpha = 0.0;
1207  for (unsigned int k = 0; k < php.zLayerHex_.size(); ++k) {
1208  if (php.iradMaxBH_[k] > php.waferUVMax_)
1209  php.waferUVMax_ = php.iradMaxBH_[k];
1210  int kk = ((php.firstLayer_ + (int)(k)) < php.layerFrontBH_[1]) ? 0 : 1;
1211 #ifdef EDM_ML_DEBUG
1212  edm::LogVerbatim("HGCalGeom")
1213  << "Layer " << php.firstLayer_ + k << ":" << kk << " Radius range "
1214  << php.iradMinBH_[k] << ":" << php.iradMaxBH_[k];
1215 #endif
1216  mytr.lay = php.firstLayer_ + k;
1217  for (int irad = php.iradMinBH_[k]; irad <= php.iradMaxBH_[k]; ++irad) {
1218  double rmin = php.radiusLayer_[kk][irad - 1];
1219  double rmax = php.radiusLayer_[kk][irad];
1220  mytr.bl = 0.5 * rmin * php.scintCellSize(mytr.lay);
1221  mytr.tl = 0.5 * rmax * php.scintCellSize(mytr.lay);
1222  mytr.h = 0.5 * (rmax - rmin);
1223  mytr.dz = 0.5 * php.waferThick_;
1224  mytr.cellSize = 0.5 * (rmax + rmin) * php.scintCellSize(mytr.lay);
1225  php.fillModule(mytr, true);
1231  php.fillModule(mytr, false);
1232  if (irad == php.iradMinBH_[k]) php.firstModule_.emplace_back(im);
1233  ++im;
1234  if (irad == php.iradMaxBH_[k] - 1) php.lastModule_.emplace_back(im);
1235  }
1236  }
1237  php.nSectors_ = php.waferUVMax_;
1238 #ifdef EDM_ML_DEBUG
1239  edm::LogVerbatim("HGCalGeom") << "Maximum radius index " << php.waferUVMax_;
1240  for (unsigned int k = 0; k < php.firstModule_.size(); ++k)
1241  edm::LogVerbatim("HGCalGeom")
1242  << "Layer " << k + php.firstLayer_ << " Modules " << php.firstModule_[k]
1243  << ":" << php.lastModule_[k];
1244 #endif
1245 }
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_
int k[5][pyjets_maxn]
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 42 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::addTrForm(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::boundR_, HGCalParameters::cellCoarseHalf_, HGCalParameters::cellCoarseX_, HGCalParameters::cellCoarseY_, HGCalParameters::cellFineHalf_, HGCalParameters::cellFineX_, HGCalParameters::cellFineY_, cellPosition(), HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, HGCalParameters::copiesInLayers_, popcon2dropbox::copy(), DDFilteredView::copyNumbers(), funct::cos(), SimDataFormats::CaloAnalysis::cp, ddpolyhedra_rrz, ddpolyhedra_rz, ddtubs, TauDecayModes::dec, egammaForCoreTracking_cff::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, PVValHelper::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), spr::find(), plotBeamSpotDB::first, DDFilteredView::firstChild(), HGCalParameters::firstLayer_, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, AnalysisDataFormats_SUSYBSMObjects::hr, mps_fire::i, createfilelist::int, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, HGCalParameters::layerGroup_, HGCalParameters::layerIndex_, LayerTriplets::layers(), DDFilteredView::logicalPart(), HGCalParameters::moduleAlphaR_, HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlR_, HGCalParameters::moduleBlS_, HGCalParameters::moduleDzR_, HGCalParameters::moduleDzS_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, HGCalParameters::moduleLayR_, HGCalParameters::moduleLayS_, HGCalParameters::moduleTlR_, HGCalParameters::moduleTlS_, DDName::name(), dataset::name, DDBase< N, C >::name(), names, DDFilteredView::next(), HGCalParameters::nSectors_, convertSQLiteXML::ok, AlCaHLTBitMon_ParallelJobs::p, p1, p2, HGCalGeometryMode::Polyhedra, alignCSCRings::r, DDTubs::rIn(), HGCalParameters::rMaxLayHex_, DDPolyhedra::rMaxVec(), HGCalParameters::rMinLayHex_, DDPolyhedra::rMinVec(), idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), HGCalParameters::scaleTrForm(), DDSolid::shape(), DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrap::tl, tolerance, DDFilteredView::translation(), 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_, waferSize_, HGCalParameters::waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypeT_, x, DDExtrudedPolygon::xVec(), geometryCSVtoXML::xx, geometryCSVtoXML::xy, y, geometryCSVtoXML::yy, z, HGCalParameters::zLayerHex_, HGCalParameters::hgtrform::zp, DDPolyhedra::zVec(), and DDExtrudedPolygon::zVec().

Referenced by HGCalParametersFromDD::build().

45  {
46  DDFilteredView fv = _fv;
47  bool dodet(true);
48  std::map<int, HGCalGeomParameters::layerParameters> layers;
49  std::vector<HGCalParameters::hgtrform> trforms;
50  std::vector<bool> trformUse;
51 
52  while (dodet) {
53  const DDSolid& sol = fv.logicalPart().solid();
54  // Layers first
55  std::vector<int> copy = fv.copyNumbers();
56  int nsiz = (int)(copy.size());
57  int lay = (nsiz > 0) ? copy[nsiz - 1] : 0;
58  int zp = (nsiz > 2) ? copy[nsiz - 3] : -1;
59  if (zp != 1) zp = -1;
60  if (lay == 0) {
61  throw cms::Exception("DDException")
62  << "Funny layer # " << lay << " zp " << zp << " in " << nsiz
63  << " components";
64  } else {
65  if (std::find(php.layer_.begin(), php.layer_.end(), lay) ==
66  php.layer_.end())
67  php.layer_.emplace_back(lay);
68  auto itr = layers.find(lay);
69  if (itr == layers.end()) {
70  double rin(0), rout(0);
71  if ((sol.shape() == DDSolidShape::ddpolyhedra_rz) ||
73  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
74  const std::vector<double>& rmin = polyhedra.rMinVec();
75  const std::vector<double>& rmax = polyhedra.rMaxVec();
76  rin = 0.5 * HGCalParameters::k_ScaleFromDDD * (rmin[0] + rmin[1]);
77  rout = 0.5 * HGCalParameters::k_ScaleFromDDD * (rmax[0] + rmax[1]);
78  } else if (sol.shape() == DDSolidShape::ddtubs) {
79  const DDTubs& tube = static_cast<DDTubs>(sol);
80  rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
81  rout = HGCalParameters::k_ScaleFromDDD * tube.rOut();
82  }
83  double zp = HGCalParameters::k_ScaleFromDDD * fv.translation().Z();
84  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
85  layers[lay] = laypar;
86  }
87  DD3Vector x, y, z;
88  fv.rotation().GetComponents(x, y, z);
89  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(), z.Y(),
90  x.Z(), y.Z(), z.Z());
91  const CLHEP::HepRotation hr(rotation);
93  if (std::abs(xx) < tolerance) xx = 0;
95  if (std::abs(yy) < tolerance) yy = 0;
96  const CLHEP::Hep3Vector h3v(xx, yy, fv.translation().Z());
98  mytrf.zp = zp;
99  mytrf.lay = lay;
100  mytrf.sec = 0;
101  mytrf.subsec = 0;
102  mytrf.h3v = h3v;
103  mytrf.hr = hr;
104  trforms.emplace_back(mytrf);
105  trformUse.emplace_back(false);
106  }
107  dodet = fv.next();
108  }
109 
110  // Then wafers
111  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they
112  // were) to ensure that new copy numbers are always added to the end of the
113  // list.
114  std::unordered_map<int32_t, int32_t> copies;
115  HGCalParameters::layer_map copiesInLayers(layers.size() + 1);
116  std::vector<int32_t> wafer2copy;
117  std::vector<HGCalGeomParameters::cellParameters> wafers;
118  std::string attribute = "Volume";
119  DDValue val1(attribute, sdTag2, 0.0);
120  DDSpecificsMatchesValueFilter filter1{val1};
121  DDFilteredView fv1(*cpv, filter1);
122  bool ok = fv1.firstChild();
123  if (!ok) {
124  edm::LogError("HGCalGeom")
125  << " Attribute " << val1 << " not found but needed.";
126  throw cms::Exception("DDException")
127  << "Attribute " << val1 << " not found but needed.";
128  } else {
129  dodet = true;
130  std::unordered_set<std::string> names;
131  while (dodet) {
132  const DDSolid& sol = fv1.logicalPart().solid();
133  const std::string& name = fv1.logicalPart().name().name();
134  std::vector<int> copy = fv1.copyNumbers();
135  int nsiz = (int)(copy.size());
136  int wafer = (nsiz > 0) ? copy[nsiz - 1] : 0;
137  int layer = (nsiz > 1) ? copy[nsiz - 2] : 0;
138  if (nsiz < 2) {
139  edm::LogError("HGCalGeom")
140  << "Funny wafer # " << wafer << " in " << nsiz << " components";
141  throw cms::Exception("DDException") << "Funny wafer # " << wafer;
142  } else if (layer > (int)(layers.size())) {
143  edm::LogWarning("HGCalGeom")
144  << "Funny wafer # " << wafer << " Layer " << layer << ":"
145  << layers.size() << " among " << nsiz << " components";
146  } else {
147  auto itr = copies.find(wafer);
148  auto cpy = copiesInLayers[layer].find(wafer);
149  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
150  copiesInLayers[layer][wafer] = itr->second;
151  }
152  if (itr == copies.end()) {
153  copies[wafer] = wafer2copy.size();
154  copiesInLayers[layer][wafer] = wafer2copy.size();
155  double xx = HGCalParameters::k_ScaleFromDDD * fv1.translation().X();
156  if (std::abs(xx) < tolerance) xx = 0;
157  double yy = HGCalParameters::k_ScaleFromDDD * fv1.translation().Y();
158  if (std::abs(yy) < tolerance) yy = 0;
159  wafer2copy.emplace_back(wafer);
160  GlobalPoint p(
161  xx, yy, HGCalParameters::k_ScaleFromDDD * fv1.translation().Z());
162  HGCalGeomParameters::cellParameters cell(false, wafer, p);
163  wafers.emplace_back(cell);
164  if (names.count(name) == 0) {
165  std::vector<double> zv, rv;
167  const DDPolyhedra& polyhedra = static_cast<DDPolyhedra>(sol);
168  zv = polyhedra.zVec();
169  rv = polyhedra.rMaxVec();
170  } else {
171  const DDExtrudedPolygon& polygon =
172  static_cast<DDExtrudedPolygon>(sol);
173  zv = polygon.zVec();
174  rv = polygon.xVec();
175  }
176  php.waferR_ = rv[0] / std::cos(30._deg);
178  double dz = 0.5 * (zv[1] - zv[0]);
179 #ifdef EDM_ML_DEBUG
180  edm::LogVerbatim("HGCalGeom")
181  << "Mode " << mode << " R " << php.waferSize_ << ":"
182  << php.waferR_ << " z " << dz;
183 #endif
185  mytr.lay = 1;
186  mytr.bl = php.waferR_;
187  mytr.tl = php.waferR_;
188  mytr.h = php.waferR_;
189  mytr.dz = dz;
190  mytr.alpha = 0.0;
191  mytr.cellSize = waferSize_;
192  php.fillModule(mytr, false);
193  names.insert(name);
194  }
195  }
196  }
197  dodet = fv1.next();
198  }
199  }
200 
201  // Finally the cells
202  std::map<int, int> wafertype;
203  std::map<int, HGCalGeomParameters::cellParameters> cellsf, cellsc;
204  DDValue val2(attribute, sdTag3, 0.0);
205  DDSpecificsMatchesValueFilter filter2{val2};
206  DDFilteredView fv2(*cpv, filter2);
207  ok = fv2.firstChild();
208  if (!ok) {
209  edm::LogError("HGCalGeom")
210  << " Attribute " << val2 << " not found but needed.";
211  throw cms::Exception("DDException")
212  << "Attribute " << val2 << " not found but needed.";
213  } else {
214  dodet = true;
215  while (dodet) {
216  const DDSolid& sol = fv2.logicalPart().solid();
217  const std::string& name = sol.name().name();
218  std::vector<int> copy = fv2.copyNumbers();
219  int nsiz = (int)(copy.size());
220  int cellx = (nsiz > 0) ? copy[nsiz - 1] : 0;
221  int wafer = (nsiz > 1) ? copy[nsiz - 2] : 0;
222  int cell = cellx % 1000;
223  int type = cellx / 1000;
224  if (type != 1 && type != 2) {
225  edm::LogError("HGCalGeom") << "Funny cell # " << cell << " type "
226  << type << " in " << nsiz << " components";
227  throw cms::Exception("DDException") << "Funny cell # " << cell;
228  } else {
229  auto ktr = wafertype.find(wafer);
230  if (ktr == wafertype.end()) wafertype[wafer] = type;
231  bool newc(false);
232  std::map<int, HGCalGeomParameters::cellParameters>::iterator itr;
233  double cellsize = php.cellSize_[0];
234  if (type == 1) {
235  itr = cellsf.find(cell);
236  newc = (itr == cellsf.end());
237  } else {
238  itr = cellsc.find(cell);
239  newc = (itr == cellsc.end());
240  cellsize = php.cellSize_[1];
241  }
242  if (newc) {
243  bool half = (name.find("Half") != std::string::npos);
244  double xx = HGCalParameters::k_ScaleFromDDD * fv2.translation().X();
245  double yy = HGCalParameters::k_ScaleFromDDD * fv2.translation().Y();
246  if (half) {
247  math::XYZPointD p1(-2.0 * cellsize / 9.0, 0, 0);
248  math::XYZPointD p2 = fv2.rotation()(p1);
249  xx += (HGCalParameters::k_ScaleFromDDD * (p2.X()));
250  yy += (HGCalParameters::k_ScaleFromDDD * (p2.Y()));
251 #ifdef EDM_ML_DEBUG
252  edm::LogVerbatim("HGCalGeom")
253  << "Type " << type << " Cell " << cellx << " local " << xx
254  << ":" << yy << " new " << p1 << ":" << p2;
255 #endif
256  }
258  GlobalPoint(xx, yy, 0));
259  if (type == 1) {
260  cellsf[cell] = cp;
261  } else {
262  cellsc[cell] = cp;
263  }
264  }
265  }
266  dodet = fv2.next();
267  }
268  }
269 
270  if (((cellsf.size() + cellsc.size()) == 0) || (wafers.empty()) ||
271  (layers.empty())) {
272  edm::LogError("HGCalGeom")
273  << "HGCalGeomParameters : number of cells " << cellsf.size() << ":"
274  << cellsc.size() << " wafers " << wafers.size() << " layers "
275  << layers.size() << " illegal";
276  throw cms::Exception("DDException")
277  << "HGCalGeomParameters: mismatch between geometry and specpar: cells "
278  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
279  << " layers " << layers.size();
280  }
281 
282  for (unsigned int i = 0; i < layers.size(); ++i) {
283  for (auto& layer : layers) {
284  if (layer.first == (int)(i + php.firstLayer_)) {
285  php.layerIndex_.emplace_back(i);
286  php.rMinLayHex_.emplace_back(layer.second.rmin);
287  php.rMaxLayHex_.emplace_back(layer.second.rmax);
288  php.zLayerHex_.emplace_back(layer.second.zpos);
289  break;
290  }
291  }
292  }
293  for (unsigned int i = 0; i < php.layer_.size(); ++i) {
294  for (unsigned int i1 = 0; i1 < trforms.size(); ++i1) {
295  if (!trformUse[i1] &&
296  php.layerGroup_[trforms[i1].lay - 1] == (int)(i + 1)) {
297  trforms[i1].h3v *= HGCalParameters::k_ScaleFromDDD;
298  trforms[i1].lay = (i + 1);
299  trformUse[i1] = true;
300  php.fillTrForm(trforms[i1]);
301  int nz(1);
302  for (unsigned int i2 = i1 + 1; i2 < trforms.size(); ++i2) {
303  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
304  php.layerGroup_[trforms[i2].lay - 1] == (int)(i + 1)) {
305  php.addTrForm(HGCalParameters::k_ScaleFromDDD * trforms[i2].h3v);
306  nz++;
307  trformUse[i2] = true;
308  }
309  }
310  if (nz > 0) {
311  php.scaleTrForm(double(1.0 / nz));
312  }
313  }
314  }
315  }
316 
317  double rmin = HGCalParameters::k_ScaleFromDDD * php.waferR_;
318  for (unsigned i = 0; i < wafer2copy.size(); ++i) {
319  php.waferCopy_.emplace_back(wafer2copy[i]);
320  php.waferPosX_.emplace_back(wafers[i].xyz.x());
321  php.waferPosY_.emplace_back(wafers[i].xyz.y());
322  auto ktr = wafertype.find(wafer2copy[i]);
323  int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
324  php.waferTypeT_.emplace_back(typet);
325  double r = wafers[i].xyz.perp();
326  int type(3);
327  for (int k = 1; k < 4; ++k) {
328  if ((r + rmin) <= php.boundR_[k]) {
329  type = k;
330  break;
331  }
332  }
333  php.waferTypeL_.emplace_back(type);
334  }
335  php.copiesInLayers_ = copiesInLayers;
336  php.nSectors_ = (int)(php.waferCopy_.size());
337 
338  std::vector<HGCalGeomParameters::cellParameters>::const_iterator itrf =
339  wafers.end();
340  for (unsigned int i = 0; i < cellsf.size(); ++i) {
341  auto itr = cellsf.find(i);
342  if (itr == cellsf.end()) {
343  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
344  << " fine cell number " << i;
345  throw cms::Exception("DDException")
346  << "HGCalGeomParameters: missing info for fine cell number " << i;
347  } else {
348  double xx = (itr->second).xyz.x();
349  double yy = (itr->second).xyz.y();
350  int waf = (itr->second).wafer;
351  std::pair<double, double> xy = cellPosition(wafers, itrf, waf, xx, yy);
352  php.cellFineX_.emplace_back(xy.first);
353  php.cellFineY_.emplace_back(xy.second);
354  php.cellFineHalf_.emplace_back((itr->second).half);
355  }
356  }
357  itrf = wafers.end();
358  for (unsigned int i = 0; i < cellsc.size(); ++i) {
359  auto itr = cellsc.find(i);
360  if (itr == cellsc.end()) {
361  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
362  << " coarse cell number " << i;
363  throw cms::Exception("DDException")
364  << "HGCalGeomParameters: missing info for coarse cell number " << i;
365  } else {
366  double xx = (itr->second).xyz.x();
367  double yy = (itr->second).xyz.y();
368  int waf = (itr->second).wafer;
369  std::pair<double, double> xy = cellPosition(wafers, itrf, waf, xx, yy);
370  php.cellCoarseX_.emplace_back(xy.first);
371  php.cellCoarseY_.emplace_back(xy.second);
372  php.cellCoarseHalf_.emplace_back((itr->second).half);
373  }
374  }
375  int depth(0);
376  for (unsigned int i = 0; i < php.layerGroup_.size(); ++i) {
377  bool first(true);
378  for (unsigned int k = 0; k < php.layerGroup_.size(); ++k) {
379  if (php.layerGroup_[k] == (int)(i + 1)) {
380  if (first) {
381  php.depth_.emplace_back(i + 1);
382  php.depthIndex_.emplace_back(depth);
383  php.depthLayerF_.emplace_back(k);
384  ++depth;
385  first = false;
386  }
387  }
388  }
389  }
390  HGCalParameters::hgtrap mytr = php.getModule(0, false);
396  double dz = mytr.dz;
397  php.fillModule(mytr, true);
398  mytr.dz = 2 * dz;
399  php.fillModule(mytr, true);
400  mytr.dz = 3 * dz;
401  php.fillModule(mytr, true);
402 #ifdef EDM_ML_DEBUG
403  edm::LogVerbatim("HGCalGeom")
404  << "HGCalGeomParameters finds " << php.zLayerHex_.size() << " layers";
405  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
406  int k = php.layerIndex_[i];
407  edm::LogVerbatim("HGCalGeom")
408  << "Layer[" << i << ":" << k << ":" << php.layer_[k]
409  << "] with r = " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
410  << " at z = " << php.zLayerHex_[i];
411  }
412  edm::LogVerbatim("HGCalGeom")
413  << "HGCalGeomParameters has " << php.depthIndex_.size() << " depths";
414  for (unsigned int i = 0; i < php.depthIndex_.size(); ++i) {
415  int k = php.depthIndex_[i];
416  edm::LogVerbatim("HGCalGeom")
417  << "Reco Layer[" << i << ":" << k << "] First Layer "
418  << php.depthLayerF_[i] << " Depth " << php.depth_[k];
419  }
420  edm::LogVerbatim("HGCalGeom")
421  << "HGCalGeomParameters finds " << php.nSectors_ << " wafers";
422  for (unsigned int i = 0; i < php.waferCopy_.size(); ++i)
423  edm::LogVerbatim("HGCalGeom")
424  << "Wafer[" << i << ": " << php.waferCopy_[i] << "] type "
425  << php.waferTypeL_[i] << ":" << php.waferTypeT_[i] << " at ("
426  << php.waferPosX_[i] << "," << php.waferPosY_[i] << ",0)";
427  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: wafer radius "
428  << php.waferR_ << " and dimensions of the "
429  << "wafers:";
430  edm::LogVerbatim("HGCalGeom")
431  << "Sim[0] " << php.moduleLayS_[0] << " dx " << php.moduleBlS_[0] << ":"
432  << php.moduleTlS_[0] << " dy " << php.moduleHS_[0] << " dz "
433  << php.moduleDzS_[0] << " alpha " << php.moduleAlphaS_[0];
434  for (unsigned int k = 0; k < php.moduleLayR_.size(); ++k)
435  edm::LogVerbatim("HGCalGeom")
436  << "Rec[" << k << "] " << php.moduleLayR_[k] << " dx "
437  << php.moduleBlR_[k] << ":" << php.moduleTlR_[k] << " dy "
438  << php.moduleHR_[k] << " dz " << php.moduleDzR_[k] << " alpha "
439  << php.moduleAlphaR_[k];
440  edm::LogVerbatim("HGCalGeom")
441  << "HGCalGeomParameters finds " << php.cellFineX_.size()
442  << " fine cells in a wafer";
443  for (unsigned int i = 0; i < php.cellFineX_.size(); ++i)
444  edm::LogVerbatim("HGCalGeom")
445  << "Fine Cell[" << i << "] at (" << php.cellFineX_[i] << ","
446  << php.cellFineY_[i] << ",0)";
447  edm::LogVerbatim("HGCalGeom")
448  << "HGCalGeomParameters finds " << php.cellCoarseX_.size()
449  << " coarse cells in a wafer";
450  for (unsigned int i = 0; i < php.cellCoarseX_.size(); ++i)
451  edm::LogVerbatim("HGCalGeom")
452  << "Coarse Cell[" << i << "] at (" << php.cellCoarseX_[i] << ","
453  << php.cellCoarseY_[i] << ",0)";
454  edm::LogVerbatim("HGCalGeom")
455  << "Obtained " << php.trformIndex_.size() << " transformation matrices";
456  for (unsigned int k = 0; k < php.trformIndex_.size(); ++k) {
457  edm::LogVerbatim("HGCalGeom")
458  << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k]
459  << std::dec << ") Translation (" << php.trformTranX_[k] << ", "
460  << php.trformTranY_[k] << ", " << php.trformTranZ_[k] << " Rotation ("
461  << php.trformRotXX_[k] << ", " << php.trformRotYX_[k] << ", "
462  << php.trformRotZX_[k] << ", " << php.trformRotXY_[k] << ", "
463  << php.trformRotYY_[k] << ", " << php.trformRotZY_[k] << ", "
464  << php.trformRotXZ_[k] << ", " << php.trformRotYZ_[k] << ", "
465  << php.trformRotZZ_[k] << ")";
466  }
467  edm::LogVerbatim("HGCalGeom")
468  << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
469  for (unsigned int k = 0; k < php.copiesInLayers_.size(); ++k) {
470  const auto& theModules = php.copiesInLayers_[k];
471  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
472  int k2(0);
473  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin();
474  itr != theModules.end(); ++itr, ++k2) {
475  edm::LogVerbatim("HGCalGeom")
476  << "[" << k2 << "] " << itr->first << ":" << itr->second;
477  }
478  }
479 #endif
480 }
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_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
layer_map copiesInLayers_
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
const N & name() const
Definition: DDBase.h:74
std::vector< bool > cellCoarseHalf_
std::vector< bool > cellFineHalf_
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:430
def copy(args, dbName)
std::vector< int > moduleLayR_
nav_type copyNumbers() const
return the stack of copy numbers
const double tolerance
std::vector< double > moduleHS_
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
std::vector< double > trformTranY_
Global3DPoint GlobalPoint
Definition: GlobalPoint.h:10
std::vector< double > cellFineY_
std::vector< double > trformRotZY_
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
std::vector< uint32_t > trformIndex_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const std::string names[nVars_]
std::vector< double > trformRotXX_
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > xVec(void) const
Definition: DDSolid.cc:473
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 > cellSize_
ROOT::Math::DisplacementVector3D< ROOT::Math::Cartesian3D< double > > DD3Vector
A DD Translation is currently implemented with Root Vector3D.
Definition: DDTranslation.h:6
std::vector< double > moduleDzS_
bool next()
set current node to the next node in the filtered tree
std::vector< int > layerIndex_
std::vector< double > moduleAlphaR_
susybsm::HSCParticleRef hr
Definition: classes.h:26
static double k_ScaleFromDDD
std::vector< double > trformRotXY_
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::vector< double > trformRotYX_
hgtrap getModule(unsigned int k, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDSolidShape shape(void) const
The type of the solid.
Definition: DDSolid.cc:138
std::vector< double > moduleBlR_
std::vector< double > rMinLayHex_
void fillModule(const hgtrap &mytr, bool reco)
double p2[4]
Definition: TauolaWrapper.h:90
std::vector< double > moduleTlS_
std::vector< double > rMinVec(void) const
Definition: DDSolid.cc:422
double rOut(void) const
Definition: DDSolid.cc:584
std::vector< double > zLayerHex_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
std::vector< double > trformTranX_
std::vector< double > zVec(void) const
Definition: DDSolid.cc:487
std::vector< double > trformRotXZ_
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:414
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_
double p1[4]
Definition: TauolaWrapper.h:89
std::vector< int > waferCopy_
std::vector< int > depthIndex_
std::vector< int > waferTypeT_
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< double > cellCoarseY_
std::vector< int > moduleLayS_
std::vector< double > trformTranZ_
double rIn(void) const
Definition: DDSolid.cc:581
std::vector< double > waferPosX_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
std::vector< int > waferTypeL_
const std::string & name() const
Returns the name.
Definition: DDName.cc:53
std::vector< std::unordered_map< int32_t, int32_t > > layer_map
void HGCalGeomParameters::loadGeometryHexagon8 ( const DDFilteredView _fv,
HGCalParameters php,
int  firstLayer 
)

Definition at line 482 of file HGCalGeomParameters.cc.

References funct::abs(), popcon2dropbox::copy(), DDFilteredView::copyNumbers(), TauDecayModes::dec, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, Exception, HGCalParameters::fillTrForm(), spr::find(), AnalysisDataFormats_SUSYBSMObjects::hr, mps_fire::i, createfilelist::int, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, HGCalParameters::layerIndex_, LayerTriplets::layers(), HGCalParameters::levelT_, HGCalParameters::levelZSide_, DDFilteredView::logicalPart(), SiStripPI::max, DDFilteredView::next(), DDTubs::rIn(), HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), DDLogicalPart::solid(), tolerance, DDFilteredView::translation(), 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_, x, geometryCSVtoXML::xx, y, geometryCSVtoXML::yy, z, HGCalParameters::zLayerHex_, HGCalParameters::hgtrform::zp, and ecaldqm::zside().

Referenced by HGCalParametersFromDD::build().

484  {
485  DDFilteredView fv = _fv;
486  bool dodet(true);
487  std::map<int, HGCalGeomParameters::layerParameters> layers;
488  std::map<std::pair<int, int>, HGCalParameters::hgtrform> trforms;
489  int levelTop = 3 + std::max(php.levelT_[0], php.levelT_[1]);
490  while (dodet) {
491  const DDSolid& sol = fv.logicalPart().solid();
492  // Layers first
493  std::vector<int> copy = fv.copyNumbers();
494  int nsiz = (int)(copy.size());
495  int lay = (nsiz > levelTop) ? copy[nsiz - 4] : copy[nsiz - 1];
496  int zside = (nsiz > php.levelZSide_) ? copy[php.levelZSide_] : -1;
497  if (zside != 1) zside = -1;
498  if (lay == 0) {
499  edm::LogError("HGCalGeom") << "Funny layer # " << lay << " zp " << zside
500  << " in " << nsiz << " components";
501  throw cms::Exception("DDException") << "Funny layer # " << lay;
502  } else {
503  if (std::find(php.layer_.begin(), php.layer_.end(), lay) ==
504  php.layer_.end())
505  php.layer_.emplace_back(lay);
506  auto itr = layers.find(lay);
507  if (itr == layers.end()) {
508  const DDTubs& tube = static_cast<DDTubs>(sol);
509  double rin = HGCalParameters::k_ScaleFromDDD * tube.rIn();
510  double rout = HGCalParameters::k_ScaleFromDDD * tube.rOut();
511  double zp = HGCalParameters::k_ScaleFromDDD * fv.translation().Z();
512  HGCalGeomParameters::layerParameters laypar(rin, rout, zp);
513  layers[lay] = laypar;
514  }
515  if (trforms.find(std::make_pair(lay, zside)) == trforms.end()) {
516  DD3Vector x, y, z;
517  fv.rotation().GetComponents(x, y, z);
518  const CLHEP::HepRep3x3 rotation(x.X(), y.X(), z.X(), x.Y(), y.Y(),
519  z.Y(), x.Z(), y.Z(), z.Z());
520  const CLHEP::HepRotation hr(rotation);
521  double xx = ((std::abs(fv.translation().X()) < tolerance)
522  ? 0
523  : fv.translation().X());
524  double yy = ((std::abs(fv.translation().Y()) < tolerance)
525  ? 0
526  : fv.translation().Y());
527  const CLHEP::Hep3Vector h3v(xx, yy, fv.translation().Z());
529  mytrf.zp = zside;
530  mytrf.lay = lay;
531  mytrf.sec = 0;
532  mytrf.subsec = 0;
533  mytrf.h3v = h3v;
534  mytrf.hr = hr;
535  trforms[std::make_pair(lay, zside)] = mytrf;
536  }
537  }
538  dodet = fv.next();
539  }
540 
541  double rmin(0), rmax(0);
542  for (unsigned int i = 0; i < layers.size(); ++i) {
543  for (auto& layer : layers) {
544  if (layer.first == (int)(i + firstLayer)) {
545  php.layerIndex_.emplace_back(i);
546  php.rMinLayHex_.emplace_back(layer.second.rmin);
547  php.rMaxLayHex_.emplace_back(layer.second.rmax);
548  php.zLayerHex_.emplace_back(layer.second.zpos);
549  if (i == 0) {
550  rmin = layer.second.rmin;
551  rmax = layer.second.rmax;
552  } else {
553  if (rmin > layer.second.rmin) rmin = layer.second.rmin;
554  if (rmax < layer.second.rmax) rmax = layer.second.rmax;
555  }
556  break;
557  }
558  }
559  }
560  php.rLimit_.emplace_back(rmin);
561  php.rLimit_.emplace_back(rmax);
562  php.depth_ = php.layer_;
563  php.depthIndex_ = php.layerIndex_;
564  php.depthLayerF_ = php.layerIndex_;
565 
566  for (unsigned int i = 0; i < php.layer_.size(); ++i) {
567  for (auto& trform : trforms) {
568  if (trform.first.first == (int)(i + firstLayer)) {
569  trform.second.h3v *= HGCalParameters::k_ScaleFromDDD;
570  php.fillTrForm(trform.second);
571  }
572  }
573  }
574 #ifdef EDM_ML_DEBUG
575  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R "
576  << php.rLimit_[0] << ":" << php.rLimit_[1];
577  edm::LogVerbatim("HGCalGeom")
578  << "HGCalGeomParameters finds " << php.zLayerHex_.size() << " layers";
579  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
580  int k = php.layerIndex_[i];
581  edm::LogVerbatim("HGCalGeom")
582  << "Layer[" << i << ":" << k << ":" << php.layer_[k]
583  << "] with r = " << php.rMinLayHex_[i] << ":" << php.rMaxLayHex_[i]
584  << " at z = " << php.zLayerHex_[i];
585  }
586  edm::LogVerbatim("HGCalGeom")
587  << "Obtained " << php.trformIndex_.size() << " transformation matrices";
588  for (unsigned int k = 0; k < php.trformIndex_.size(); ++k) {
589  edm::LogVerbatim("HGCalGeom")
590  << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k]
591  << std::dec << ") Translation (" << php.trformTranX_[k] << ", "
592  << php.trformTranY_[k] << ", " << php.trformTranZ_[k] << " Rotation ("
593  << php.trformRotXX_[k] << ", " << php.trformRotYX_[k] << ", "
594  << php.trformRotZX_[k] << ", " << php.trformRotXY_[k] << ", "
595  << php.trformRotYY_[k] << ", " << php.trformRotZY_[k] << ", "
596  << php.trformRotXZ_[k] << ", " << php.trformRotYZ_[k] << ", "
597  << php.trformRotZZ_[k] << ")";
598  }
599 #endif
600 }
std::vector< int > layer_
std::vector< int > depthLayerF_
std::vector< int > depth_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
def copy(args, dbName)
nav_type copyNumbers() const
return the stack of copy numbers
const double tolerance
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
std::vector< double > trformTranY_
std::vector< double > trformRotZY_
int zside(DetId const &)
const DDSolid & solid(void) const
Returns a reference object of the solid being the shape of this LogicalPart.
std::vector< uint32_t > trformIndex_
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
std::vector< double > trformRotXX_
A DDSolid represents the shape of a part.
Definition: DDSolid.h:39
void fillTrForm(const hgtrform &mytr)
std::vector< double > trformRotZX_
std::vector< double > trformRotYZ_
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
std::vector< int > layerIndex_
susybsm::HSCParticleRef hr
Definition: classes.h:26
static double k_ScaleFromDDD
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > rMinLayHex_
double rOut(void) const
Definition: DDSolid.cc:584
std::vector< double > zLayerHex_
int k[5][pyjets_maxn]
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_
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< int > levelT_
std::vector< double > trformTranZ_
double rIn(void) const
Definition: DDSolid.cc:581
void HGCalGeomParameters::loadSpecParsHexagon ( const DDFilteredView fv,
HGCalParameters php,
const DDCompactView cpv,
const std::string &  sdTag1,
const std::string &  sdTag2 
)

Definition at line 602 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

606  {
608  php.boundR_ = getDDDArray("RadiusBound", sv, 4);
609  std::for_each(php.boundR_.begin(), php.boundR_.end(),
610  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
611 #ifdef EDM_ML_DEBUG
612  edm::LogVerbatim("HGCalGeom")
613  << "HGCalGeomParameters: wafer radius ranges"
614  << " for cell grouping " << php.boundR_[0] << ":" << php.boundR_[1] << ":"
615  << php.boundR_[2] << ":" << php.boundR_[3];
616 #endif
617  php.rLimit_ = getDDDArray("RadiusLimits", sv, 2);
618  std::for_each(php.rLimit_.begin(), php.rLimit_.end(),
619  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
620 #ifdef EDM_ML_DEBUG
621  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R "
622  << php.rLimit_[0] << ":" << php.rLimit_[1];
623 #endif
624  php.levelT_ = dbl_to_int(getDDDArray("LevelTop", sv, 0));
625 #ifdef EDM_ML_DEBUG
626  edm::LogVerbatim("HGCalGeom")
627  << "HGCalGeomParameters: LevelTop " << php.levelT_[0];
628 #endif
629 
630  // Grouping of layers
631  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZFine", sv, 0));
632  php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid", sv, 0));
633  php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut", sv, 0));
634  php.slopeMin_ = getDDDArray("Slope", sv, 1);
635 #ifdef EDM_ML_DEBUG
636  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: minimum slope "
637  << php.slopeMin_[0] << " and layer groupings "
638  << "for the 3 ranges:";
639  for (unsigned int k = 0; k < php.layerGroup_.size(); ++k)
640  edm::LogVerbatim("HGCalGeom")
641  << "[" << k << "] " << php.layerGroup_[k] << ":" << php.layerGroupM_[k]
642  << ":" << php.layerGroupO_[k];
643 #endif
644 
645  // Wafer size
646  std::string attribute = "Volume";
647  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, sdTag1, 0.0)};
648  DDFilteredView fv1(*cpv, filter1);
649  if (fv1.firstChild()) {
650  DDsvalues_type sv(fv1.mergedSpecifics());
651  const auto& dummy = getDDDArray("WaferSize", sv, 0);
652  waferSize_ = dummy[0];
653  }
654 #ifdef EDM_ML_DEBUG
655  edm::LogVerbatim("HGCalGeom")
656  << "HGCalGeomParameters: Wafer Size: " << waferSize_;
657 #endif
658 
659  // Cell size
660  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, sdTag2, 0.0)};
661  DDFilteredView fv2(*cpv, filter2);
662  if (fv2.firstChild()) {
663  DDsvalues_type sv(fv2.mergedSpecifics());
664  php.cellSize_ = getDDDArray("CellSize", sv, 0);
665  }
666 #ifdef EDM_ML_DEBUG
667  edm::LogVerbatim("HGCalGeom")
668  << "HGCalGeomParameters: " << php.cellSize_.size() << " cells of sizes:";
669  for (unsigned int k = 0; k < php.cellSize_.size(); ++k)
670  edm::LogVerbatim("HGCalGeom") << " [" << k << "] " << php.cellSize_[k];
671 #endif
672 }
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_ScaleFromDDD
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
int k[5][pyjets_maxn]
std::vector< double > slopeMin_
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
std::vector< int > layerGroupO_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > rLimit_
std::vector< int > levelT_
void HGCalGeomParameters::loadSpecParsHexagon8 ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 674 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

675  {
677  php.cellThickness_ = getDDDArray("CellThickness", sv, 3);
678  std::for_each(php.cellThickness_.begin(), php.cellThickness_.end(),
679  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
680 #ifdef EDM_ML_DEBUG
681  edm::LogVerbatim("HGCalGeom")
682  << "HGCalGeomParameters: cell Thickness " << php.cellThickness_[0] << ":"
683  << php.cellThickness_[1] << ":" << php.cellThickness_[2];
684 #endif
685  php.radius100to200_ = getDDDArray("Radius100to200", sv, 5);
686 #ifdef EDM_ML_DEBUG
687  edm::LogVerbatim("HGCalGeom")
688  << "HGCalGeomParameters: Polynomial "
689  << "parameters for 120 to 200 micron "
690  << "transition " << php.radius100to200_[0] << ":"
691  << php.radius100to200_[1] << ":" << php.radius100to200_[2] << ":"
692  << php.radius100to200_[3] << ":" << php.radius100to200_[4];
693 #endif
694  php.radius200to300_ = getDDDArray("Radius200to300", sv, 5);
695 #ifdef EDM_ML_DEBUG
696  edm::LogVerbatim("HGCalGeom")
697  << "HGCalGeomParameters: Polynomial "
698  << "parameters for 200 to 300 micron "
699  << "transition " << php.radius200to300_[0] << ":"
700  << php.radius200to300_[1] << ":" << php.radius200to300_[2] << ":"
701  << php.radius200to300_[3] << ":" << php.radius200to300_[4];
702 #endif
703  const auto& dummy = getDDDArray("RadiusCuts", sv, 4);
704  php.choiceType_ = (int)(dummy[0]);
705  php.nCornerCut_ = (int)(dummy[1]);
706  php.fracAreaMin_ = dummy[2];
708 #ifdef EDM_ML_DEBUG
709  edm::LogVerbatim("HGCalGeom")
710  << "HGCalGeomParameters: Parameters for the"
711  << " transition " << php.choiceType_ << ":" << php.nCornerCut_ << ":"
712  << php.fracAreaMin_ << ":" << php.zMinForRad_;
713 #endif
714  php.radiusMixBoundary_ = DDVectorGetter::get("RadiusMixBoundary");
715  std::for_each(php.radiusMixBoundary_.begin(), php.radiusMixBoundary_.end(),
716  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
717 #ifdef EDM_ML_DEBUG
718  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k)
719  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Mix[" << k
720  << "] R = " << php.radiusMixBoundary_[k];
721 #endif
722  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
723  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
724  std::for_each(php.zFrontMin_.begin(), php.zFrontMin_.end(),
725  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
726  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
727  std::for_each(php.rMinFront_.begin(), php.rMinFront_.end(),
728  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
729 #ifdef EDM_ML_DEBUG
730  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
731  edm::LogVerbatim("HGCalGeom")
732  << "HGCalParameters: Boundary[" << k
733  << "] Bottom Z = " << php.zFrontMin_[k]
734  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
735 #endif
736  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
737  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
738  std::for_each(php.zFrontTop_.begin(), php.zFrontTop_.end(),
739  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
740  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
741  std::for_each(php.rMaxFront_.begin(), php.rMaxFront_.end(),
742  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
743 #ifdef EDM_ML_DEBUG
744  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
745  edm::LogVerbatim("HGCalGeom")
746  << "HGCalParameters: Boundary[" << k
747  << "] Top Z = " << php.zFrontTop_[k] << " Slope = " << php.slopeTop_[k]
748  << " rMax = " << php.rMaxFront_[k];
749 #endif
750  php.zRanges_ = DDVectorGetter::get("ZRanges");
751  std::for_each(php.zRanges_.begin(), php.zRanges_.end(),
752  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
753 #ifdef EDM_ML_DEBUG
754  edm::LogVerbatim("HGCalGeom")
755  << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":"
756  << php.zRanges_[1] << ":" << php.zRanges_[2] << ":" << php.zRanges_[3];
757 #endif
758 }
std::vector< double > zFrontMin_
static double k_ScaleFromDDD
std::vector< double > rMaxFront_
std::vector< double > slopeTop_
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
std::vector< double > get(const std::string &)
int k[5][pyjets_maxn]
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< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< double > zFrontTop_
void HGCalGeomParameters::loadSpecParsTrapezoid ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 760 of file HGCalGeomParameters.cc.

References HGCalParameters::cellSize_, dbl_to_int(), HGCalParameters::firstLayer_, DDVectorGetter::get(), getDDDArray(), gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layerFrontBH_, M_PI, DDFilteredView::mergedSpecifics(), gen::n, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::nPhiBinBH_, HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::rMinFront_, HGCalParameters::rMinLayerBH_, HGCalParameters::scintCells(), HGCalParameters::scintCellSize(), HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalParameters::zFrontMin_, HGCalParameters::zFrontTop_, and HGCalParameters::zRanges_.

Referenced by HGCalParametersFromDD::build().

761  {
763  php.radiusMixBoundary_ = DDVectorGetter::get("RadiusMixBoundary");
764  std::for_each(php.radiusMixBoundary_.begin(), php.radiusMixBoundary_.end(),
765  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
766  php.nPhiBinBH_ = dbl_to_int(getDDDArray("NPhiBinBH", sv, 0));
767  php.layerFrontBH_ = dbl_to_int(getDDDArray("LayerFrontBH", sv, 0));
768  php.rMinLayerBH_ = getDDDArray("RMinLayerBH", sv, 0);
769  std::for_each(php.rMinLayerBH_.begin(), php.rMinLayerBH_.end(),
770  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
771  php.nCellsFine_ = php.nPhiBinBH_[0];
772  php.nCellsCoarse_ = php.nPhiBinBH_[1];
773  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsFine_);
774  php.cellSize_.emplace_back(2.0 * M_PI / php.nCellsCoarse_);
775 #ifdef EDM_ML_DEBUG
776  edm::LogVerbatim("HGCalGeom")
777  << "HGCalGeomParameters:nCells " << php.nCellsFine_ << ":"
778  << php.nCellsCoarse_ << " cellSize: " << php.cellSize_[0] << ":"
779  << php.cellSize_[1];
780  for (unsigned int k = 0; k < php.layerFrontBH_.size(); ++k)
781  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Type[" << k
782  << "] Front Layer = " << php.layerFrontBH_[k]
783  << " rMin = " << php.rMinLayerBH_[k];
784  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k) {
785  edm::LogVerbatim("HGCalGeom")
786  << "HGCalGeomParameters: Mix[" << k
787  << "] R = " << php.radiusMixBoundary_[k]
788  << " Nphi = " << php.scintCells(k + php.firstLayer_)
789  << " dPhi = " << php.scintCellSize(k + php.firstLayer_);
790  }
791 #endif
792  php.slopeMin_ = getDDDArray("SlopeBottom", sv, 0);
793  php.zFrontMin_ = getDDDArray("ZFrontBottom", sv, 0);
794  std::for_each(php.zFrontMin_.begin(), php.zFrontMin_.end(),
795  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
796  php.rMinFront_ = getDDDArray("RMinFront", sv, 0);
797  std::for_each(php.rMinFront_.begin(), php.rMinFront_.end(),
798  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
799 #ifdef EDM_ML_DEBUG
800  for (unsigned int k = 0; k < php.zFrontMin_.size(); ++k)
801  edm::LogVerbatim("HGCalGeom")
802  << "HGCalParameters: Boundary[" << k
803  << "] Bottom Z = " << php.zFrontMin_[k]
804  << " Slope = " << php.slopeMin_[k] << " rMax = " << php.rMinFront_[k];
805 #endif
806  php.slopeTop_ = getDDDArray("SlopeTop", sv, 0);
807  php.zFrontTop_ = getDDDArray("ZFrontTop", sv, 0);
808  std::for_each(php.zFrontTop_.begin(), php.zFrontTop_.end(),
809  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
810  php.rMaxFront_ = getDDDArray("RMaxFront", sv, 0);
811  std::for_each(php.rMaxFront_.begin(), php.rMaxFront_.end(),
812  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
813 #ifdef EDM_ML_DEBUG
814  for (unsigned int k = 0; k < php.zFrontTop_.size(); ++k)
815  edm::LogVerbatim("HGCalGeom")
816  << "HGCalParameters: Boundary[" << k
817  << "] Top Z = " << php.zFrontTop_[k] << " Slope = " << php.slopeTop_[k]
818  << " rMax = " << php.rMaxFront_[k];
819 #endif
820  php.zRanges_ = DDVectorGetter::get("ZRanges");
821  std::for_each(php.zRanges_.begin(), php.zRanges_.end(),
822  [](double& n) { n *= HGCalParameters::k_ScaleFromDDD; });
823 #ifdef EDM_ML_DEBUG
824  edm::LogVerbatim("HGCalGeom")
825  << "HGCalParameters: Z-Boundary " << php.zRanges_[0] << ":"
826  << php.zRanges_[1] << ":" << php.zRanges_[2] << ":" << php.zRanges_[3];
827 #endif
828 }
std::vector< double > zFrontMin_
double scintCellSize(const int layer) const
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_
static double k_ScaleFromDDD
std::vector< double > rMaxFront_
int scintCells(const int layer) const
std::vector< double > slopeTop_
std::vector< double > getDDDArray(const std::string &, const DDsvalues_type &, const int)
std::vector< double > get(const std::string &)
#define M_PI
int k[5][pyjets_maxn]
std::vector< double > zRanges_
std::vector< double > slopeMin_
std::vector< double > radiusMixBoundary_
DDsvalues_type mergedSpecifics() const
std::vector< double > rMinFront_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
Definition: DDsvalues.h:12
std::vector< int > layerFrontBH_
std::vector< double > zFrontTop_
void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 830 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::copiesInLayers_, popcon2dropbox::copy(), TCMET_cfi::corner, PVValHelper::dx, PVValHelper::dy, createfilelist::int, gen::k, HGCalParameters::k_CornerSize, HGCalParameters::k_ScaleFromDDD, HGCalParameters::layer_, create_public_lumi_plots::ncol, 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_, and HGCalParameters::waferUVMax_.

Referenced by HGCalParametersFromDD::build().

830  {
833  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
834 #ifdef EDM_ML_DEBUG
835  edm::LogVerbatim("HGCalGeom")
836  << "Input waferWidth " << waferW << ":" << rmin << " R Limits: " << rin
837  << ":" << rout << " Fine " << rMaxFine;
838 #endif
839  // Clear the vectors
840  php.waferCopy_.clear();
841  php.waferTypeL_.clear();
842  php.waferTypeT_.clear();
843  php.waferPosX_.clear();
844  php.waferPosY_.clear();
845  double dx = 0.5 * waferW;
846  double dy = 3.0 * dx * tan(30._deg);
847  double rr = 2.0 * dx * tan(30._deg);
848  int ncol = (int)(2.0 * rout / waferW) + 1;
849  int nrow = (int)(rout / (waferW * tan(30._deg))) + 1;
850  int ns2 = (2 * ncol + 1) * (2 * nrow + 1) * php.layer_.size();
851  int incm(0), inrm(0), kount(0), ntot(0);
852  HGCalParameters::layer_map copiesInLayers(php.layer_.size() + 1);
853  HGCalParameters::waferT_map waferTypes(ns2 + 1);
854 #ifdef EDM_ML_DEBUG
855  edm::LogVerbatim("HGCalGeom") << "Row " << nrow << " Column " << ncol;
856 #endif
857  for (int nr = -nrow; nr <= nrow; ++nr) {
858  int inr = (nr >= 0) ? nr : -nr;
859  for (int nc = -ncol; nc <= ncol; ++nc) {
860  int inc = (nc >= 0) ? nc : -nc;
861  if (inr % 2 == inc % 2) {
862  double xpos = nc * dx;
863  double ypos = nr * dy;
864  std::pair<int, int> corner =
865  HGCalGeomTools::waferCorner(xpos, ypos, dx, rr, rin, rout, true);
866  double rpos = std::sqrt(xpos * xpos + ypos * ypos);
867  int typet = (rpos < rMaxFine) ? 1 : 2;
868  int typel(3);
869  for (int k = 1; k < 4; ++k) {
870  if ((rpos + rmin) <= php.boundR_[k]) {
871  typel = k;
872  break;
873  }
874  }
875  ++ntot;
876  if (corner.first > 0) {
877  int copy = inr * 100 + inc;
878  if (nc < 0) copy += 10000;
879  if (nr < 0) copy += 100000;
880  if (inc > incm) incm = inc;
881  if (inr > inrm) inrm = inr;
882  kount++;
883 #ifdef EDM_ML_DEBUG
884  edm::LogVerbatim("HGCalGeom")
885  << kount << ":" << ntot << " Copy " << copy << " Type " << typel
886  << ":" << typet << " Location " << corner.first << " Position "
887  << xpos << ":" << ypos << " Layers " << php.layer_.size();
888 #endif
889  php.waferCopy_.emplace_back(copy);
890  php.waferTypeL_.emplace_back(typel);
891  php.waferTypeT_.emplace_back(typet);
892  php.waferPosX_.emplace_back(xpos);
893  php.waferPosY_.emplace_back(ypos);
894  for (unsigned int il = 0; il < php.layer_.size(); ++il) {
895  std::pair<int, int> corner = HGCalGeomTools::waferCorner(
896  xpos, ypos, dx, rr, php.rMinLayHex_[il], php.rMaxLayHex_[il],
897  true);
898  if (corner.first > 0) {
899  auto cpy = copiesInLayers[php.layer_[il]].find(copy);
900  if (cpy == copiesInLayers[php.layer_[il]].end())
901  copiesInLayers[php.layer_[il]][copy] =
902  ((corner.first == (int)(HGCalParameters::k_CornerSize))
903  ? php.waferCopy_.size()
904  : -1);
905  }
906  if ((corner.first > 0) &&
907  (corner.first < (int)(HGCalParameters::k_CornerSize))) {
908  int wl =
909  HGCalWaferIndex::waferIndex(php.layer_[il], copy, 0, true);
910  waferTypes[wl] = std::make_pair(corner.first, corner.second);
911  }
912  }
913  }
914  }
915  }
916  }
917  php.copiesInLayers_ = copiesInLayers;
918  php.waferTypes_ = waferTypes;
919  php.nSectors_ = (int)(php.waferCopy_.size());
920  php.waferUVMax_ = 0;
921 #ifdef EDM_ML_DEBUG
922  edm::LogVerbatim("HGCalGeom")
923  << "HGCalWaferHexagon: # of columns " << incm << " # of rows " << inrm
924  << " and " << kount << ":" << ntot << " wafers; R " << rin << ":" << rout;
925  edm::LogVerbatim("HGCalGeom")
926  << "Dump copiesInLayers for " << php.copiesInLayers_.size() << " layers";
927  for (unsigned int k = 0; k < copiesInLayers.size(); ++k) {
928  const auto& theModules = copiesInLayers[k];
929  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" << theModules.size();
930  int k2(0);
931  for (std::unordered_map<int, int>::const_iterator itr = theModules.begin();
932  itr != theModules.end(); ++itr, ++k2) {
933  edm::LogVerbatim("HGCalGeom")
934  << "[" << k2 << "] " << itr->first << ":" << itr->second;
935  }
936  }
937 #endif
938 }
std::vector< double > waferPosY_
std::vector< int > layer_
layer_map copiesInLayers_
def copy(args, dbName)
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:18
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_
int k[5][pyjets_maxn]
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 940 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, TCMET_cfi::corner, TauDecayModes::dec, HGCalParameters::defineFull_, PVValHelper::dy, HGCalParameters::hgtrap::dz, PVValHelper::dz, HGCalParameters::fillModule(), HGCalParameters::fracAreaMin_, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, mps_fire::i, triggerObjects_cff::id, createfilelist::int, gen::k, HGCalParameters::k_CornerSize, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, HGCalParameters::layerIndex_, SiStripPI::max, N, HGCalParameters::nCornerCut_, HGCalParameters::nSectors_, dttmaxenums::R, alignCSCRings::r, HGCalParameters::radius100to200_, HGCalParameters::radius200to300_, HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, HGCalParameters::sensorSeparation_, 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(), HGCalParameters::zLayerHex_, and HGCalParameters::zMinForRad_.

Referenced by HGCalParametersFromDD::build().

940  {
941  double waferW(php.waferSize_);
942  double waferS(php.sensorSeparation_);
943  auto wType = std::make_unique<HGCalWaferType>(
945  HGCalParameters::k_ScaleToDDD * (waferW + waferS),
947  php.nCornerCut_, php.fracAreaMin_);
948 
949  double rout(php.rLimit_[1]);
950 #ifdef EDM_ML_DEBUG
951  edm::LogVerbatim("HGCalGeom")
952  << "Input waferWidth " << waferW << ":" << waferS << " R Max: " << rout;
953 #endif
954  // Clear the vectors
955  php.waferCopy_.clear();
956  php.waferTypeL_.clear();
957  php.waferTypeT_.clear();
958  php.waferPosX_.clear();
959  php.waferPosY_.clear();
960  double r = 0.5 * (waferW + waferS);
961  double R = 2.0 * r / sqrt3_;
962  double dy = 0.75 * R;
963  int N = (r == 0) ? 3 : ((int)(0.5 * rout / r) + 3);
964  int ns1 = (2 * N + 1) * (2 * N + 1);
965  int ns2 = ns1 * php.zLayerHex_.size();
966 #ifdef EDM_ML_DEBUG
967  edm::LogVerbatim("HGCalGeom") << "r " << r << " dy " << dy << " N " << N
968  << " sizes " << ns1 << ":" << ns2;
969  std::vector<int> indtypes(ns1 + 1);
970  indtypes.clear();
971 #endif
972  HGCalParameters::wafer_map wafersInLayers(ns1 + 1);
973  HGCalParameters::wafer_map typesInLayers(ns2 + 1);
974  HGCalParameters::waferT_map waferTypes(ns2 + 1);
975  int ipos(0), lpos(0), uvmax(0);
976  std::vector<int> uvmx(php.zLayerHex_.size(), 0);
977  for (int v = -N; v <= N; ++v) {
978  for (int u = -N; u <= N; ++u) {
979  int nr = 2 * v;
980  int nc = -2 * u + v;
981  double xpos = nc * r;
982  double ypos = nr * dy;
983  int indx = HGCalWaferIndex::waferIndex(0, u, v);
984  php.waferCopy_.emplace_back(indx);
985  php.waferPosX_.emplace_back(xpos);
986  php.waferPosY_.emplace_back(ypos);
987  wafersInLayers[indx] = ipos;
988  ++ipos;
989  std::pair<int, int> corner =
990  HGCalGeomTools::waferCorner(xpos, ypos, r, R, 0, rout, false);
991  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) ||
992  ((corner.first > 0) && php.defineFull_)) {
993  uvmax = std::max(uvmax, std::max(std::abs(u), std::abs(v)));
994  }
995  for (unsigned int i = 0; i < php.zLayerHex_.size(); ++i) {
996  int lay = php.layer_[php.layerIndex_[i]];
997  double zpos = php.zLayerHex_[i];
998  int type = wType->getType(HGCalParameters::k_ScaleToDDD * xpos,
1001  php.waferTypeL_.emplace_back(type);
1002  int kndx = HGCalWaferIndex::waferIndex(lay, u, v);
1003  typesInLayers[kndx] = lpos;
1004  ++lpos;
1005 #ifdef EDM_ML_DEBUG
1006  indtypes.emplace_back(kndx);
1007 #endif
1008  std::pair<int, int> corner = HGCalGeomTools::waferCorner(
1009  xpos, ypos, r, R, php.rMinLayHex_[i], php.rMaxLayHex_[i], false);
1010 #ifdef EDM_ML_DEBUG
1011  if (((corner.first == 0) && std::abs(u) < 5 && std::abs(v) < 5) ||
1012  (std::abs(u) < 2 && std::abs(v) < 2)) {
1013  edm::LogVerbatim("HGCalGeom")
1014  << "Layer " << lay << " R " << php.rMinLayHex_[i] << ":"
1015  << php.rMaxLayHex_[i] << " u " << u << " v " << v << " with "
1016  << corner.first << " corners";
1017  }
1018 #endif
1019  if ((corner.first == (int)(HGCalParameters::k_CornerSize)) ||
1020  ((corner.first > 0) && php.defineFull_)) {
1021  uvmx[i] = std::max(uvmx[i], std::max(std::abs(u), std::abs(v)));
1022  }
1023  if ((corner.first < (int)(HGCalParameters::k_CornerSize)) &&
1024  (corner.first > 0)) {
1025 #ifdef EDM_ML_DEBUG
1026  edm::LogVerbatim("HGCalGeom")
1027  << "Layer " << lay << " u|v " << u << ":" << v << " with "
1028  << corner.first << " corners First " << corner.second;
1029 #endif
1030  int wl = HGCalWaferIndex::waferIndex(lay, u, v);
1031  waferTypes[wl] = std::make_pair(corner.first, corner.second);
1032  }
1033  }
1034  }
1035  }
1036  php.waferUVMax_ = uvmax;
1037  php.waferUVMaxLayer_ = uvmx;
1038  php.wafersInLayers_ = wafersInLayers;
1039  php.typesInLayers_ = typesInLayers;
1040  php.waferTypes_ = waferTypes;
1041  php.nSectors_ = (int)(php.waferCopy_.size());
1043  mytr.lay = 1;
1044  mytr.bl = php.waferR_;
1045  mytr.tl = php.waferR_;
1046  mytr.h = php.waferR_;
1047  mytr.alpha = 0.0;
1049  for (auto const& dz : php.cellThickness_) {
1050  mytr.dz = 0.5 * HGCalParameters::k_ScaleToDDD * dz;
1051  php.fillModule(mytr, false);
1052  }
1053  for (unsigned k = 0; k < php.cellThickness_.size(); ++k) {
1054  HGCalParameters::hgtrap mytr = php.getModule(k, false);
1060  php.fillModule(mytr, true);
1061  }
1062 #ifdef EDM_ML_DEBUG
1063  edm::LogVerbatim("HGCalGeom")
1064  << "HGCalGeomParameters: Total of " << php.waferCopy_.size() << " wafers";
1065  for (unsigned int k = 0; k < php.waferCopy_.size(); ++k) {
1066  int id = php.waferCopy_[k];
1067  edm::LogVerbatim("HGCalGeom")
1068  << "[" << k << "] " << std::hex << id << std::dec << ":"
1070  << ":" << HGCalWaferIndex::waferV(id) << " x " << php.waferPosX_[k]
1071  << " y " << php.waferPosY_[k] << " index " << php.wafersInLayers_[id];
1072  }
1073  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Total of "
1074  << php.waferTypeL_.size() << " wafer types";
1075  for (unsigned int k = 0; k < php.waferTypeL_.size(); ++k) {
1076  int id = indtypes[k];
1077  edm::LogVerbatim("HGCalGeom")
1078  << "[" << k << "] " << php.typesInLayers_[id] << ":"
1079  << php.waferTypeL_[k] << " ID " << std::hex << id << std::dec << ":"
1081  << ":" << HGCalWaferIndex::waferV(id);
1082  }
1083 #endif
1084 }
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_
static double k_ScaleFromDDD
hgtrap getModule(unsigned int k, bool reco) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
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_
int k[5][pyjets_maxn]
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_

Member Data Documentation

const double HGCalGeomParameters::sqrt3_
private

Definition at line 68 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

double HGCalGeomParameters::waferSize_
private