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 28 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:18
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 1188 of file HGCalGeomParameters.cc.

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

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

1190  {
1191 
1192  if (itrf == wafers.end()) {
1193  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin();
1194  itr != wafers.end(); ++itr) {
1195  if (itr->wafer == wafer) {
1196  itrf = itr;
1197  break;
1198  }
1199  }
1200  }
1201  double dx(0), dy(0);
1202  if (itrf != wafers.end()) {
1203  dx = (xx - itrf->xyz.x());
1204  if (std::abs(dx) < tolerance) dx = 0;
1205  dy = (yy - itrf->xyz.y());
1206  if (std::abs(dy) < tolerance) dy = 0;
1207  }
1208  return std::pair<double,double>(dx,dy);
1209 }
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 1153 of file HGCalGeomParameters.cc.

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

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

1155  {
1156  DDValue value(str);
1157  if (DDfetch(&sv,value)) {
1158  const std::vector<double> & fvec = value.doubles();
1159  int nval = fvec.size();
1160  if (nmin > 0) {
1161  if (nval < nmin) {
1162  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
1163  << " bins " << nval << " < " << nmin
1164  << " ==> illegal";
1165  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1166  }
1167  } else {
1168  if (nval < 1 && nmin == 0) {
1169  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
1170  << " bins " << nval << " < 1 ==> illegal"
1171  << " (nmin=" << nmin << ")";
1172  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1173  }
1174  }
1175  return fvec;
1176  } else {
1177  if (nmin >= 0) {
1178  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array "
1179  << str;
1180  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
1181  }
1182  std::vector<double> fvec;
1183  return fvec;
1184  }
1185 }
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 1060 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().

1061  {
1062 
1063  //Special parameters for cell parameters
1064  std::string attribute = "OnlyForHGCalNumbering";
1065  DDSpecificsHasNamedValueFilter filter1{attribute};
1066  DDFilteredView fv1(*cpv,filter1);
1067  bool ok = fv1.firstChild();
1068 
1069  if (ok) {
1070  php.cellFine_ = dbl_to_int(DDVectorGetter::get("waferFine"));
1071  php.cellCoarse_ = dbl_to_int(DDVectorGetter::get("waferCoarse"));
1072  }
1073 
1074 #ifdef EDM_ML_DEBUG
1075  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: "
1076  << php.cellFine_.size()
1077  << " rows for fine cells";
1078  for (unsigned int k=0; k<php.cellFine_.size(); ++k)
1079  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellFine_[k];
1080  edm::LogVerbatim("HGCalGeom") << "HGCalLoadCellPars: "
1081  << php.cellCoarse_.size()
1082  << " rows for coarse cells";
1083  for (unsigned int k=0; k<php.cellCoarse_.size(); ++k)
1084  edm::LogVerbatim("HGCalGeom") << "[" << k << "]: " << php.cellCoarse_[k];
1085 #endif
1086 }
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 1088 of file HGCalGeomParameters.cc.

References HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::dPhiEtaBH_, HGCalParameters::hgtrap::dz, ALCARECOTkAlBeamHalo_cff::etaMax, ALCARECOTkAlBeamHalo_cff::etaMin, HGCalParameters::etaMinBH_, JetChargeProducer_cfi::exp, HGCalParameters::fillModule(), HGCalParameters::firstLayer_, HGCalParameters::firstModule_, HGCalParameters::hgtrap::h, HGCalParameters::iEtaMinBH_, gen::k, HGCalParameters::k_ScaleFromDDD, HGCalParameters::k_ScaleToDDD, HGCalParameters::lastModule_, HGCalParameters::hgtrap::lay, cmsBatch::log, HGCalParameters::nSectors_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, funct::tan(), HGCalParameters::hgtrap::tl, HGCalParameters::waferThick_, HGCalParameters::waferUVMax_, and HGCalParameters::zLayerHex_.

Referenced by HGCalParametersFromDD::build().

1088  {
1089  // Find eta ranges in each layer
1090  std::vector<double> etaMin, etaMax;
1091  for (unsigned k=0; k<php.zLayerHex_.size(); ++k) {
1092  double eta1 = -std::log(std::tan(0.5*std::atan(php.rMaxLayHex_[k]/php.zLayerHex_[k])));
1093  double eta2 = -std::log(std::tan(0.5*std::atan(php.rMinLayHex_[k]/php.zLayerHex_[k])));
1094  etaMin.emplace_back(eta1); etaMax.emplace_back(eta2);
1095  if (eta1 < php.etaMinBH_)
1096  edm::LogWarning("HGCalGeom") << "HGCalGeomParameters::Check Etamin "
1097  << php.etaMinBH_ << " > " << eta1
1098  << " for layer " << k+php.firstLayer_;
1099  }
1100 #ifdef EDM_ML_DEBUG
1101  for (unsigned k=0; k<etaMin.size(); ++k)
1102  edm::LogVerbatim("HGCalGeom") << "Layer " << k+php.firstLayer_ << " Eta "
1103  << etaMin[k] << ":" << etaMax[k];
1104 #endif
1105  // Now define the volumes
1106  int im(0);
1107  php.waferUVMax_ = 0;
1109  mytr.alpha = 0.0;
1110  for (unsigned int k=0; k<etaMin.size(); ++k) {
1111  int ietaMin = ((etaMin[k]-php.etaMinBH_)/php.dPhiEtaBH_[k]);
1112  int ietaMax = 1 + ((etaMax[k]-php.etaMinBH_)/php.dPhiEtaBH_[k]);
1113  php.iEtaMinBH_.emplace_back(ietaMin);
1114  if (ietaMax > php.waferUVMax_) php.waferUVMax_ = ietaMax;
1115 #ifdef EDM_ML_DEBUG
1116  edm::LogVerbatim("HGCalGeom") << "Eta " << ietaMin << ":" << ietaMax
1117  <<" "<<php.etaMinBH_+ietaMin*php.dPhiEtaBH_[k]
1118  <<":"<<php.etaMinBH_+ietaMax*php.dPhiEtaBH_[k]
1119  << " vs " << etaMin[k] << ":" << etaMax[k];
1120 #endif
1121  mytr.lay = php.firstLayer_ + k;
1122  for (int ieta=ietaMin; ieta<=ietaMax; ++ ieta) {
1123  double etal= ieta*php.dPhiEtaBH_[k];
1124  double etah= etal+php.dPhiEtaBH_[k];
1125  double rmin= (php.zLayerHex_[k])*std::tan(2.0*std::atan(std::exp(-etah)));
1126  double rmax= (php.zLayerHex_[k])*std::tan(2.0*std::atan(std::exp(-etal)));
1127  mytr.bl = 0.5*rmin*php.dPhiEtaBH_[k];
1128  mytr.tl = 0.5*rmax*php.dPhiEtaBH_[k];
1129  mytr.h = 0.5*(rmax-rmin);
1130  mytr.dz = 0.5*php.waferThick_;
1131  mytr.cellSize = 0.5*(rmax+rmin)*php.dPhiEtaBH_[k];
1132  php.fillModule(mytr,true);
1138  php.fillModule(mytr, false);
1139  if (ieta == ietaMin) php.firstModule_.emplace_back(im);
1140  ++im;
1141  if (ieta == ietaMax-1) php.lastModule_.emplace_back(im);
1142  }
1143  }
1144  php.nSectors_ = php.waferUVMax_;
1145 #ifdef EDM_ML_DEBUG
1146  for (unsigned int k=0; k< php.firstModule_.size(); ++k)
1147  edm::LogVerbatim("HGCalGeom") << "Layer " << k+php.firstLayer_
1148  << " Modules " << php.firstModule_[k]
1149  << ":" << php.lastModule_[k];
1150 #endif
1151 }
std::vector< int > iEtaMinBH_
std::vector< int > firstModule_
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< double > dPhiEtaBH_
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::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, 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_, 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_, idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), HGCalParameters::scaleTrForm(), 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().

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

Definition at line 475 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(), DDFilteredView::logicalPart(), dataset::name, DDBase< N, C >::name(), DDFilteredView::next(), DDTubs::rIn(), HGCalParameters::rLimit_, HGCalParameters::rMaxLayHex_, HGCalParameters::rMinLayHex_, idealTransformation::rotation, DDFilteredView::rotation(), DDTubs::rOut(), DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, 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().

477  {
478 
479  DDFilteredView fv = _fv;
480  bool dodet(true);
481  std::map<int,HGCalGeomParameters::layerParameters> layers;
482  std::map<std::pair<int,int>,HGCalParameters::hgtrform> trforms;
483 
484  while (dodet) {
485  const DDSolid & sol = fv.logicalPart().solid();
486  std::string name = sol.name();
487  // Layers first
488  std::vector<int> copy = fv.copyNumbers();
489  int nsiz = (int)(copy.size());
490  int lay = (nsiz > 0) ? copy[nsiz-1] : 0;
491  int zside= (nsiz > 3) ? copy[3] : -1;
492  if (zside != 1) zside = -1;
493  if (lay == 0) {
494  edm::LogError("HGCalGeom") << "Funny layer # " << lay << " zp "
495  << zside << " in " << nsiz << " components";
496  throw cms::Exception("DDException") << "Funny layer # " << lay;
497  } else {
498  if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
499  php.layer_.end()) php.layer_.emplace_back(lay);
500  auto itr = layers.find(lay);
501  if (itr == layers.end()) {
502  const DDTubs & tube = static_cast<DDTubs>(sol);
503  double rin = HGCalParameters::k_ScaleFromDDD*tube.rIn();
504  double rout= HGCalParameters::k_ScaleFromDDD*tube.rOut();
505  double zp = HGCalParameters::k_ScaleFromDDD*fv.translation().Z();
506  HGCalGeomParameters::layerParameters laypar(rin,rout,zp);
507  layers[lay] = laypar;
508  }
509  if (trforms.find(std::make_pair(lay,zside)) == trforms.end()) {
510  DD3Vector x, y, z;
511  fv.rotation().GetComponents( x, y, z ) ;
512  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
513  x.Y(), y.Y(), z.Y(),
514  x.Z(), y.Z(), z.Z() );
515  const CLHEP::HepRotation hr ( rotation );
516  double xx = ((std::abs(fv.translation().X()) < tolerance) ? 0 :
517  fv.translation().X());
518  double yy = ((std::abs(fv.translation().Y()) < tolerance) ? 0 :
519  fv.translation().Y());
520  const CLHEP::Hep3Vector h3v (xx, yy, fv.translation().Z());
522  mytrf.zp = zside;
523  mytrf.lay = lay;
524  mytrf.sec = 0;
525  mytrf.subsec= 0;
526  mytrf.h3v = h3v;
527  mytrf.hr = hr;
528  trforms[std::make_pair(lay,zside)] = mytrf;
529  }
530  }
531  dodet = fv.next();
532  }
533 
534  double rmin(0), rmax(0);
535  for (unsigned int i=0; i<layers.size(); ++i) {
536  for (auto & layer : layers) {
537  if (layer.first == (int)(i+firstLayer)) {
538  php.layerIndex_.emplace_back(i);
539  php.rMinLayHex_.emplace_back(layer.second.rmin);
540  php.rMaxLayHex_.emplace_back(layer.second.rmax);
541  php.zLayerHex_.emplace_back(layer.second.zpos);
542  if (i == 0) {
543  rmin = layer.second.rmin; rmax = layer.second.rmax;
544  } else {
545  if (rmin > layer.second.rmin) rmin = layer.second.rmin;
546  if (rmax < layer.second.rmax) rmax = layer.second.rmax;
547  }
548  break;
549  }
550  }
551  }
552  php.rLimit_.emplace_back(rmin);
553  php.rLimit_.emplace_back(rmax);
554  php.depth_ = php.layer_;
555  php.depthIndex_ = php.layerIndex_;
556  php.depthLayerF_= php.layerIndex_;
557 
558  for (unsigned int i=0; i<php.layer_.size(); ++i) {
559  for (auto & trform : trforms) {
560  if (trform.first.first == (int)(i+firstLayer)) {
561  trform.second.h3v *= HGCalParameters::k_ScaleFromDDD;
562  php.fillTrForm(trform.second);
563  }
564  }
565  }
566 #ifdef EDM_ML_DEBUG
567  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Minimum/maximum R "
568  << php.rLimit_[0] << ":" << php.rLimit_[1];
569  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters finds "
570  << php.zLayerHex_.size() << " layers";
571  for (unsigned int i=0; i<php.zLayerHex_.size(); ++i) {
572  int k = php.layerIndex_[i];
573  edm::LogVerbatim("HGCalGeom") << "Layer[" << i << ":" << k << ":"
574  << php.layer_[k] << "] with r = "
575  << php.rMinLayHex_[i] << ":"
576  << php.rMaxLayHex_[i] << " at z = "
577  << php.zLayerHex_[i];
578  }
579  edm::LogVerbatim("HGCalGeom") << "Obtained " << php.trformIndex_.size()
580  << " transformation matrices";
581  for (unsigned int k=0; k<php.trformIndex_.size(); ++k) {
582  edm::LogVerbatim("HGCalGeom") << "Matrix[" << k << "] (" << std::hex
583  << php.trformIndex_[k]
584  << std::dec << ") Translation ("
585  << php.trformTranX_[k] << ", "
586  << php.trformTranY_[k] << ", "
587  << php.trformTranZ_[k] << " Rotation ("
588  << php.trformRotXX_[k] << ", "
589  << php.trformRotYX_[k] << ", "
590  << php.trformRotZX_[k] << ", "
591  << php.trformRotXY_[k] << ", "
592  << php.trformRotYY_[k] << ", "
593  << php.trformRotZY_[k] << ", "
594  << php.trformRotXZ_[k] << ", "
595  << php.trformRotYZ_[k] << ", "
596  << php.trformRotZZ_[k] << ")";
597  }
598 #endif
599 }
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
const N & name() const
Definition: DDBase.h:78
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:38
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< 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 601 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().

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

Referenced by HGCalParametersFromDD::build().

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

Definition at line 752 of file HGCalGeomParameters.cc.

References HGCalParameters::cellSize_, dbl_to_int(), HGCalParameters::dPhiEtaBH_, DDVectorGetter::get(), getDDDArray(), gen::k, HGCalParameters::k_ScaleFromDDD, M_PI, DDFilteredView::mergedSpecifics(), gen::n, HGCalParameters::nCellsCoarse_, HGCalParameters::nCellsFine_, HGCalParameters::nPhiBinBH_, HGCalParameters::radiusMixBoundary_, HGCalParameters::rMaxFront_, HGCalParameters::slopeMin_, HGCalParameters::slopeTop_, pfDeepBoostedJetPreprocessParams_cfi::sv, HGCalParameters::zFront_, and HGCalParameters::zRanges_.

Referenced by HGCalParametersFromDD::build().

753  {
754 
756  php.radiusMixBoundary_ = DDVectorGetter::get("RadiusMixBoundary");
757  std::for_each(php.radiusMixBoundary_.begin(), php.radiusMixBoundary_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
758  php.nPhiBinBH_ = dbl_to_int(DDVectorGetter::get("NPhiBinBH"));
759  php.dPhiEtaBH_.clear();
760  php.nCellsFine_ = php.nPhiBinBH_[0];
761  php.nCellsCoarse_ = php.nPhiBinBH_[0];
762  for (auto const & nbin : php.nPhiBinBH_) {
763  php.dPhiEtaBH_.emplace_back(2.0*M_PI/nbin);
764  if (nbin > php.nCellsFine_) php.nCellsFine_ = nbin;
765  if (nbin < php.nCellsCoarse_) php.nCellsCoarse_ = nbin;
766  }
767  php.cellSize_.emplace_back(2.0*M_PI/php.nCellsFine_);
768  php.cellSize_.emplace_back(2.0*M_PI/php.nCellsCoarse_);
769 #ifdef EDM_ML_DEBUG
770  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters:nCells "
771  << php.nCellsFine_ << ":" << php.nCellsCoarse_
772  << " cellSize: " << php.cellSize_[0] << ":"
773  << php.cellSize_[1];
774  for (unsigned int k = 0; k < php.radiusMixBoundary_.size(); ++k)
775  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Mix[" << k
776  << "] R = " << php.radiusMixBoundary_[k]
777  << " NphiBin = " << php.nPhiBinBH_[k]
778  << " dPhiEta = " << php.dPhiEtaBH_[k];
779 #endif
780  const auto & dummy2 = getDDDArray("SlopeBottom",sv,0);
781  php.slopeMin_ = dummy2[0];
782 #ifdef EDM_ML_DEBUG
783  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: SlopeBottom "
784  << php.slopeMin_;
785 #endif
786  php.slopeTop_ = getDDDArray("SlopeTop",sv,0);
787  php.zFront_ = getDDDArray("ZFront",sv,0);
788  std::for_each(php.zFront_.begin(), php.zFront_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
789  php.rMaxFront_ = getDDDArray("RMaxFront",sv,0);
790  std::for_each(php.rMaxFront_.begin(), php.rMaxFront_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
791 #ifdef EDM_ML_DEBUG
792  for (unsigned int k = 0; k < php.zFront_.size(); ++k)
793  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Boundary[" << k
794  << "] Z = " << php.zFront_[k] << " Slope = "
795  << php.slopeTop_[k] << " rMax = "
796  << php.rMaxFront_[k];
797 #endif
798  php.zRanges_ = DDVectorGetter::get("ZRanges");
799  std::for_each(php.zRanges_.begin(), php.zRanges_.end(), [](double &n){ n*=HGCalParameters::k_ScaleFromDDD; });
800 #ifdef EDM_ML_DEBUG
801  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Z-Boundary "
802  << php.zRanges_[0] << ":" << php.zRanges_[1]
803  << ":" << php.zRanges_[2] << ":"
804  << php.zRanges_[3];
805 #endif
806 }
std::vector< int > nPhiBinBH_
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_
std::vector< std::pair< unsigned int, DDValue > > DDsvalues_type
std::maps an index to a DDValue. The index corresponds to the index assigned to the name of the std::...
Definition: DDsvalues.h:20
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 > radiusMixBoundary_
DDsvalues_type mergedSpecifics() const
std::vector< double > dPhiEtaBH_
std::vector< double > zFront_
void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 808 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_, HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypeT_, and HGCalParameters::waferUVMax_.

Referenced by HGCalParametersFromDD::build().

808  {
809 
811  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
812 #ifdef EDM_ML_DEBUG
813  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":"
814  << rmin << " R Limits: " << rin << ":"
815  << rout << " Fine " << rMaxFine;
816 #endif
817  // Clear the vectors
818  php.waferCopy_.clear();
819  php.waferTypeL_.clear();
820  php.waferTypeT_.clear();
821  php.waferPosX_.clear();
822  php.waferPosY_.clear();
823  double dx = 0.5*waferW;
824  double dy = 3.0*dx*tan(30.0*CLHEP::deg);
825  double rr = 2.0*dx*tan(30.0*CLHEP::deg);
826  int ncol = (int)(2.0*rout/waferW) + 1;
827  int nrow = (int)(rout/(waferW*tan(30.0*CLHEP::deg))) + 1;
828  int incm(0), inrm(0), kount(0), ntot(0);
830  HGCalParameters::layer_map copiesInLayers(php.layer_.size()+1);
831 #ifdef EDM_ML_DEBUG
832  edm::LogVerbatim("HGCalGeom") << "Row " << nrow << " Column " << ncol;
833 #endif
834  for (int nr=-nrow; nr <= nrow; ++nr) {
835  int inr = (nr >= 0) ? nr : -nr;
836  for (int nc=-ncol; nc <= ncol; ++nc) {
837  int inc = (nc >= 0) ? nc : -nc;
838  if (inr%2 == inc%2) {
839  double xpos = nc*dx;
840  double ypos = nr*dy;
841  xc[0] = xpos+dx; yc[0] = ypos-0.5*rr;
842  xc[1] = xpos+dx; yc[1] = ypos+0.5*rr;
843  xc[2] = xpos; yc[2] = ypos+rr;
844  xc[3] = xpos-dx; yc[3] = ypos+0.5*rr;
845  xc[4] = xpos+dx; yc[4] = ypos-0.5*rr;
846  xc[5] = xpos; yc[5] = ypos-rr;
847  bool cornerOne(false);
848  for (unsigned int k=0; k<HGCalParameters::k_CornerSize; ++k) {
849  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
850  if (rpos >= rin && rpos <= rout) cornerOne = true;
851  }
852  double rpos = std::sqrt(xpos*xpos+ypos*ypos);
853  int typet = (rpos < rMaxFine) ? 1 : 2;
854  int typel(3);
855  for (int k=1; k<4; ++k) {
856  if ((rpos+rmin)<=php.boundR_[k]) {
857  typel = k; break;
858  }
859  }
860  ++ntot;
861  if (cornerOne) {
862  int copy = inr*100 + inc;
863  if (nc < 0) copy += 10000;
864  if (nr < 0) copy += 100000;
865  if (inc > incm) incm = inc;
866  if (inr > inrm) inrm = inr;
867  kount++;
868 #ifdef EDM_ML_DEBUG
869  edm::LogVerbatim("HGCalGeom") << kount << ":" << ntot << " Copy "
870  << copy << " Type " << typel << ":"
871  << typet << " Location " << cornerOne
872  << " Position " << xpos << ":" << ypos
873  << " Layers " << php.layer_.size();
874 #endif
875  php.waferCopy_.emplace_back(copy);
876  php.waferTypeL_.emplace_back(typel);
877  php.waferTypeT_.emplace_back(typet);
878  php.waferPosX_.emplace_back(xpos);
879  php.waferPosY_.emplace_back(ypos);
880  for (unsigned int il=0; il<php.layer_.size(); ++il) {
881  bool corner(false), cornerAll(true);
882  for (unsigned int k=0; k<HGCalParameters::k_CornerSize; ++k) {
883  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
884  if (rpos >= php.rMinLayHex_[il] &&
885  rpos <= php.rMaxLayHex_[il]) corner = true;
886  else cornerAll = false;
887  }
888  if (corner) {
889  auto cpy = copiesInLayers[php.layer_[il]].find(copy);
890  if (cpy == copiesInLayers[php.layer_[il]].end())
891  copiesInLayers[php.layer_[il]][copy] = cornerAll ? php.waferCopy_.size() : -1;
892  }
893  }
894  }
895  }
896  }
897  }
898  php.copiesInLayers_ = copiesInLayers;
899  php.nSectors_ = (int)(php.waferCopy_.size());
900  php.waferUVMax_ = 0;
901 #ifdef EDM_ML_DEBUG
902  edm::LogVerbatim("HGCalGeom") << "HGCalWaferHexagon: # of columns "
903  << incm << " # of rows " << inrm << " and "
904  << kount << ":" << ntot << " wafers; R "
905  << rin << ":" << rout;
906  edm::LogVerbatim("HGCalGeom") << "Dump copiesInLayers for "
907  << php.copiesInLayers_.size() << " layers";
908  for (unsigned int k=0; k<copiesInLayers.size(); ++k) {
909  const auto& theModules = copiesInLayers[k];
910  edm::LogVerbatim("HGCalGeom") << "Layer " << k << ":" <<theModules.size();
911  int k2(0);
912  for (std::unordered_map<int, int>::const_iterator itr=theModules.begin();
913  itr != theModules.end(); ++itr,++k2) {
914  edm::LogVerbatim("HGCalGeom") << "[" << k2 << "] " << itr->first << ":"
915  << itr->second;
916  }
917  }
918 #endif
919 }
std::vector< double > waferPosY_
std::vector< int > layer_
layer_map copiesInLayers_
def copy(args, dbName)
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< std::unordered_map< int32_t, int32_t > > layer_map
std::vector< double > rMinLayHex_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
std::vector< int > waferCopy_
std::vector< double > rLimit_
std::vector< int > waferTypeT_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_
void HGCalGeomParameters::loadWaferHexagon8 ( HGCalParameters php)

Definition at line 921 of file HGCalGeomParameters.cc.

References funct::abs(), HGCalParameters::hgtrap::alpha, HGCalParameters::hgtrap::bl, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellThickness_, HGCalParameters::choiceType_, 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::sensorSeparation_, mathSSE::sqrt(), sqrt3_, HGCalParameters::hgtrap::tl, HGCalParameters::typesInLayers_, findQualityFiles::v, HGCalParameters::waferCopy_, HGCalWaferIndex::waferIndex(), HGCalWaferIndex::waferLayer(), HGCalParameters::waferPosX_, HGCalParameters::waferPosY_, HGCalParameters::waferR_, HGCalParameters::wafersInLayers_, HGCalParameters::waferSize_, HGCalParameters::waferTypeL_, HGCalParameters::waferTypeT_, HGCalWaferIndex::waferU(), HGCalParameters::waferUVMax_, HGCalParameters::waferUVMaxLayer_, HGCalWaferIndex::waferV(), HGCalParameters::zLayerHex_, and HGCalParameters::zMinForRad_.

Referenced by HGCalParametersFromDD::build().

921  {
922 
923  double waferW(php.waferSize_);
924  double waferS(php.sensorSeparation_);
925  auto wType = std::make_unique<HGCalWaferType>(php.radius100to200_,
926  php.radius200to300_,
927  HGCalParameters::k_ScaleToDDD*(waferW+waferS),
929  php.choiceType_,
930  php.nCornerCut_,
931  php.fracAreaMin_);
932 
933  double rout(php.rLimit_[1]);
934 #ifdef EDM_ML_DEBUG
935  edm::LogVerbatim("HGCalGeom") << "Input waferWidth " << waferW << ":"
936  << waferS << " R Max: " << rout;
937 #endif
938  // Clear the vectors
939  php.waferCopy_.clear();
940  php.waferTypeL_.clear();
941  php.waferTypeT_.clear();
942  php.waferPosX_.clear();
943  php.waferPosY_.clear();
944  double r = 0.5*(waferW+waferS);
945  double R = 2.0*r/sqrt3_;
946  double dy = 0.75*R;
947  int N = (r == 0) ? 3 : ((int)(0.5*rout/r) + 3);
948  int ns1 = (2*N+1)*(2*N+1);
949  int ns2 = ns1*php.zLayerHex_.size();
950 #ifdef EDM_ML_DEBUG
951  edm::LogVerbatim("HGCalGeom") << "r " << r << " dy " << dy << " N " << N
952  << " sizes " << ns1 << ":" << ns2;
953  std::vector<int> indtypes(ns1+1);
954  indtypes.clear();
955 #endif
956  HGCalParameters::wafer_map wafersInLayers(ns1+1);
957  HGCalParameters::wafer_map typesInLayers(ns2+1);
958  int ipos(0), lpos(0), uvmax(0);
959  std::vector<int> uvmx(php.zLayerHex_.size(),0);
961  for (int v = -N; v <= N; ++v) {
962  for (int u = -N; u <= N; ++u) {
963  int nr = 2*v;
964  int nc =-2*u+v;
965  double xpos = nc*r;
966  double ypos = nr*dy;
967  int indx = HGCalWaferIndex::waferIndex(0,u,v);
968  php.waferCopy_.emplace_back(indx);
969  php.waferPosX_.emplace_back(xpos);
970  php.waferPosY_.emplace_back(ypos);
971  wafersInLayers[indx] = ipos;
972  ++ipos;
973  xc[0] = xpos+r; yc[0] = ypos+0.5*R;
974  xc[1] = xpos; yc[1] = ypos+R;
975  xc[2] = xpos-r; yc[2] = ypos+0.5*R;
976  xc[3] = xpos-r; yc[3] = ypos-0.5*R;
977  xc[4] = xpos; yc[4] = ypos-R;
978  xc[5] = xpos+r; yc[5] = ypos-0.5*R;
979  bool cornerOne(false), cornerAll(true);
980  for (unsigned int k=0; k<HGCalParameters::k_CornerSize; ++k) {
981  double rpos = sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
982  if (rpos <= rout) cornerOne = true;
983  else cornerAll = false;
984  }
985  if ((cornerAll) || (cornerOne && php.defineFull_)) {
986  uvmax = std::max(uvmax,std::max(std::abs(u),std::abs(v)));
987  }
988  for (unsigned int i=0; i<php.zLayerHex_.size(); ++i) {
989  int lay = php.layer_[php.layerIndex_[i]];
990  double zpos = php.zLayerHex_[i];
992  php.waferTypeL_.emplace_back(type);
993  int kndx = HGCalWaferIndex::waferIndex(lay,u,v);
994  typesInLayers[kndx] = lpos;
995  ++lpos;
996 #ifdef EDM_ML_DEBUG
997  indtypes.emplace_back(kndx);
998 #endif
999  bool cornerOne(false), cornerAll(true);
1000  for (unsigned int k=0; k<HGCalParameters::k_CornerSize; ++k) {
1001  double rpos = sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
1002  if (rpos <= php.rMaxLayHex_[i]) cornerOne = true;
1003  else cornerAll = false;
1004  }
1005  if ((cornerAll) || (cornerOne && php.defineFull_)) {
1006  uvmx[i] = std::max(uvmx[i],std::max(std::abs(u),std::abs(v)));
1007  }
1008  }
1009  }
1010  }
1011  php.waferUVMax_ = uvmax;
1012  php.waferUVMaxLayer_= uvmx;
1013  php.wafersInLayers_ = wafersInLayers;
1014  php.typesInLayers_ = typesInLayers;
1015  php.nSectors_ = (int)(php.waferCopy_.size());
1017  mytr.lay = 1; mytr.bl = php.waferR_;
1018  mytr.tl = php.waferR_; mytr.h = php.waferR_;
1019  mytr.alpha = 0.0; mytr.cellSize = HGCalParameters::k_ScaleToDDD*php.waferSize_;
1020  for (auto const & dz : php.cellThickness_) {
1021  mytr.dz = 0.5*HGCalParameters::k_ScaleToDDD*dz;
1022  php.fillModule(mytr,false);
1023  }
1024  for (unsigned k=0; k<php.cellThickness_.size(); ++k) {
1025  HGCalParameters::hgtrap mytr = php.getModule(k, false);
1031  php.fillModule(mytr, true);
1032  }
1033 #ifdef EDM_ML_DEBUG
1034  edm::LogVerbatim("HGCalGeom") << "HGCalGeomParameters: Total of "
1035  << php.waferCopy_.size() << " wafers";
1036  for (unsigned int k=0; k<php.waferCopy_.size(); ++k) {
1037  int id = php.waferCopy_[k];
1038  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << std::hex << id
1039  << std::dec << ":" << HGCalWaferIndex::waferLayer(id)
1040  << ":" << HGCalWaferIndex::waferU(id) << ":"
1041  << HGCalWaferIndex::waferV(id) << " x "
1042  << php.waferPosX_[k] << " y "
1043  << php.waferPosY_[k] << " index "
1044  << php.wafersInLayers_[id];
1045  }
1046  edm::LogVerbatim("HGCalGeom") << "HGCalParameters: Total of "
1047  << php.waferTypeL_.size() << " wafer types";
1048  for (unsigned int k=0; k<php.waferTypeL_.size(); ++k) {
1049  int id = indtypes[k];
1050  edm::LogVerbatim("HGCalGeom") << "[" << k << "] " << php.typesInLayers_[id]
1051  << ":" << php.waferTypeL_[k]
1052  << " ID " << std::hex << id << std::dec
1053  << ":" << HGCalWaferIndex::waferLayer(id) << ":"
1054  << HGCalWaferIndex::waferU(id) << ":"
1055  << HGCalWaferIndex::waferV(id);
1056  }
1057 #endif
1058 }
std::vector< double > waferPosY_
type
Definition: HCALResponse.h:21
std::vector< int > layer_
static int32_t waferV(const int32_t index)
static int32_t waferIndex(int32_t layer, int32_t waferU, int32_t waferV)
wafer_map wafersInLayers_
std::vector< int > waferUVMaxLayer_
std::vector< int > layerIndex_
T sqrt(T t)
Definition: SSEVec.h:18
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)
void fillModule(const hgtrap &mytr, bool reco)
static int32_t waferLayer(const int32_t index)
std::vector< double > zLayerHex_
int k[5][pyjets_maxn]
std::vector< double > rMaxLayHex_
static uint32_t k_CornerSize
#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 71 of file HGCalGeomParameters.h.

Referenced by loadWaferHexagon8().

double HGCalGeomParameters::waferSize_
private