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 loadGeometryHexagon (const DDFilteredView &, HGCalParameters &, const std::string &, const DDCompactView *, const std::string &, const std::string &, HGCalGeometryMode::WaferMode)
 
void loadGeometrySquare (const DDFilteredView &, HGCalParameters &, const std::string &)
 
void loadSpecParsHexagon (const DDFilteredView &, HGCalParameters &, const DDCompactView *, const std::string &, const std::string &)
 
void loadSpecParsSquare (const DDFilteredView &, HGCalParameters &)
 
void loadWaferHexagon (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 &, int &)
 

Private Attributes

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

References gather_cfg::cout.

25  {
26 #ifdef EDM_ML_DEBUG
27  std::cout << "HGCalGeomParameters::HGCalGeomParameters() constructor\n";
28 #endif
29 }
HGCalGeomParameters::~HGCalGeomParameters ( )

Definition at line 31 of file HGCalGeomParameters.cc.

References gather_cfg::cout.

31  {
32 #ifdef EDM_ML_DEBUG
33  std::cout << "HGCalGeomParameters::destructed!!!\n";
34 #endif
35 }

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

References funct::abs().

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

924  {
925 
926  if (itrf == wafers.end()) {
927  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin();
928  itr != wafers.end(); ++itr) {
929  if (itr->wafer == wafer) {
930  itrf = itr;
931  break;
932  }
933  }
934  }
935  double dx(0), dy(0);
936  if (itrf != wafers.end()) {
937  dx = (xx - itrf->xyz.x());
938  if (std::abs(dx) < 0.001) dx = 0;
939  dy = (yy - itrf->xyz.y());
940  if (std::abs(dy) < 0.001) dy = 0;
941  }
942  return std::pair<double,double>(dx,dy);
943 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< double > HGCalGeomParameters::getDDDArray ( const std::string &  str,
const DDsvalues_type sv,
int &  nmin 
)
private

Definition at line 885 of file HGCalGeomParameters.cc.

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

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

887  {
888  DDValue value(str);
889  if (DDfetch(&sv,value)) {
890  const std::vector<double> & fvec = value.doubles();
891  int nval = fvec.size();
892  if (nmin > 0) {
893  if (nval < nmin) {
894  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
895  << " bins " << nval << " < " << nmin
896  << " ==> illegal";
897  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
898  }
899  } else {
900  if (nval < 1 && nmin == 0) {
901  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
902  << " bins " << nval << " < 1 ==> illegal"
903  << " (nmin=" << nmin << ")";
904  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
905  }
906  }
907  nmin = nval;
908  return fvec;
909  } else {
910  if (nmin >= 0) {
911  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array "
912  << str;
913  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
914  }
915  std::vector<double> fvec;
916  nmin = 0;
917  return fvec;
918  }
919 }
bool DDfetch(const DDsvalues_type *, DDValue &)
helper for retrieving DDValues from DDsvalues_type *.
Definition: DDsvalues.cc:80
Definition: value.py:1
void HGCalGeomParameters::loadCellParsHexagon ( const DDCompactView cpv,
HGCalParameters php 
)

Definition at line 857 of file HGCalGeomParameters.cc.

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

Referenced by HGCalParametersFromDD::build().

858  {
859 
860  //Special parameters for cell parameters
861  std::string attribute = "OnlyForHGCalNumbering";
862  DDSpecificsHasNamedValueFilter filter1{attribute};
863  DDFilteredView fv1(*cpv,filter1);
864  bool ok = fv1.firstChild();
865 
866  if (ok) {
867  php.cellFine_ = dbl_to_int(DDVectorGetter::get("waferFine"));
868  php.cellCoarse_ = dbl_to_int(DDVectorGetter::get("waferCoarse"));
869  }
870 
871 #ifdef EDM_ML_DEBUG
872  std::cout << "HGCalLoadCellPars: " << php.cellFine_.size()
873  << " rows for fine cells\n";
874  for (unsigned int k=0; k<php.cellFine_.size(); ++k)
875  std::cout << k << ":" << php.cellFine_[k] << " ";
876  std::cout << std::endl;
877  std::cout << "HGCalLoadCellPars: " <<php.cellCoarse_.size()
878  << " rows for coarse cells\n";
879  for (unsigned int k=0; k<php.cellCoarse_.size(); ++k)
880  std::cout << k << ":" << php.cellCoarse_[k] << " ";
881  std::cout << std::endl;
882 #endif
883 }
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::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 212 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(), gather_cfg::cout, SimDataFormats::CaloAnalysis::cp, TauDecayModes::dec, particleFlowClusterECALTimeSelected_cfi::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, allConversions_cfi::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), spr::find(), plotBeamSpotDB::first, DDFilteredView::firstChild(), HGCalParameters::getModule(), HGCalParameters::hgtrap::h, AnalysisDataFormats_SUSYBSMObjects::hr, mps_fire::i, createfilelist::int, gen::k, 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(), cscdqm::h::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, 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::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().

218  {
219 
220  DDFilteredView fv = _fv;
221  bool dodet(true);
222  std::map<int,HGCalGeomParameters::layerParameters> layers;
223  std::vector<HGCalParameters::hgtrform> trforms;
224  std::vector<bool> trformUse;
225 
226  while (dodet) {
227  const DDSolid & sol = fv.logicalPart().solid();
228  std::string name = sol.name();
229  // Layers first
230  std::vector<int> copy = fv.copyNumbers();
231  int nsiz = (int)(copy.size());
232  int lay = (nsiz > 0) ? copy[nsiz-1] : 0;
233  int zp = (nsiz > 2) ? copy[nsiz-3] : -1;
234  if (zp != 1) zp = -1;
235  if (lay == 0) {
236  edm::LogError("HGCalGeom") << "Funny layer # " << lay << " zp "
237  << zp << " in " << nsiz << " components";
238  throw cms::Exception("DDException") << "Funny layer # " << lay;
239  } else {
240  if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
241  php.layer_.end()) php.layer_.push_back(lay);
242  std::map<int,HGCalGeomParameters::layerParameters>::iterator itr = layers.find(lay);
243  if (itr == layers.end()) {
244  const DDTubs & tube = static_cast<DDTubs>(sol);
245  double rin = k_ScaleFromDDD*tube.rIn();
246  double rout= k_ScaleFromDDD*tube.rOut();
247  double zp = k_ScaleFromDDD*fv.translation().Z();
248  HGCalGeomParameters::layerParameters laypar(rin,rout,zp);
249  layers[lay] = laypar;
250  }
251  DD3Vector x, y, z;
252  fv.rotation().GetComponents( x, y, z ) ;
253  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
254  x.Y(), y.Y(), z.Y(),
255  x.Z(), y.Z(), z.Z() );
256  const CLHEP::HepRotation hr ( rotation );
257  double xx = k_ScaleFromDDD*fv.translation().X();
258  if (std::abs(xx) < 0.001) xx = 0;
259  double yy = k_ScaleFromDDD*fv.translation().Y();
260  if (std::abs(yy) < 0.001) yy = 0;
261  const CLHEP::Hep3Vector h3v ( xx, yy, fv.translation().Z() );
263  mytrf.zp = zp;
264  mytrf.lay = lay;
265  mytrf.sec = 0;
266  mytrf.subsec= 0;
267  mytrf.h3v = h3v;
268  mytrf.hr = hr;
269  trforms.push_back(mytrf);
270  trformUse.push_back(false);
271  }
272  dodet = fv.next();
273  }
274 
275  // Then wafers
276  // This assumes layers are build starting from 1 (which on 25 Jan 2016, they were)
277  // to ensure that new copy numbers are always added
278  // to the end of the list.
279  std::unordered_map<int32_t,int32_t> copies;
280  HGCalParameters::layer_map copiesInLayers(layers.size()+1);
281  std::vector<int32_t> wafer2copy;
282  std::vector<HGCalGeomParameters::cellParameters> wafers;
283  std::string attribute = "Volume";
284  DDValue val1(attribute, sdTag2, 0.0);
285  DDSpecificsMatchesValueFilter filter1{val1};
286  DDFilteredView fv1(*cpv,filter1);
287  bool ok = fv1.firstChild();
288  if (!ok) {
289  edm::LogError("HGCalGeom") << " Attribute " << val1
290  << " not found but needed.";
291  throw cms::Exception("DDException") << "Attribute " << val1
292  << " not found but needed.";
293  } else {
294  dodet = true;
295  std::unordered_set<std::string> names;
296  while (dodet) {
297  const DDSolid & sol = fv1.logicalPart().solid();
298  std::string name = fv1.logicalPart().name();
299  std::vector<int> copy = fv1.copyNumbers();
300  int nsiz = (int)(copy.size());
301  int wafer = (nsiz > 0) ? copy[nsiz-1] : 0;
302  int layer = (nsiz > 1) ? copy[nsiz-2] : 0;
303  if (nsiz < 2) {
304  edm::LogError("HGCalGeom") << "Funny wafer # " << wafer << " in "
305  << nsiz << " components";
306  throw cms::Exception("DDException") << "Funny wafer # " << wafer;
307  } else {
308  std::unordered_map<int32_t,int32_t>::iterator itr = copies.find(wafer);
309  std::unordered_map<int32_t,int32_t>::iterator cpy =
310  copiesInLayers[layer].find(wafer);
311  if (itr != copies.end() && cpy == copiesInLayers[layer].end()) {
312  copiesInLayers[layer][wafer] = itr->second;
313  }
314  if (itr == copies.end()) {
315  copies[wafer] = wafer2copy.size();
316  copiesInLayers[layer][wafer] = wafer2copy.size();
317  double xx = k_ScaleFromDDD*fv1.translation().X();
318  if (std::abs(xx) < 0.001) xx = 0;
319  double yy = k_ScaleFromDDD*fv1.translation().Y();
320  if (std::abs(yy) < 0.001) yy = 0;
321  wafer2copy.emplace_back(wafer);
322  GlobalPoint p(xx,yy,k_ScaleFromDDD*fv1.translation().Z());
323  HGCalGeomParameters::cellParameters cell(false,wafer,p);
324  wafers.emplace_back(cell);
325  if ( names.count(name) == 0 ) {
326  std::vector<double> zv, rv;
328  const DDPolyhedra & polyhedra = static_cast<DDPolyhedra>(sol);
329  zv = polyhedra.zVec();
330  rv = polyhedra.rMaxVec();
331  } else {
332  const DDExtrudedPolygon & polygon = static_cast<DDExtrudedPolygon>(sol);
333  zv = polygon.zVec();
334  rv = polygon.xVec();
335  }
336  php.waferR_ = rv[0]/std::cos(30.0*CLHEP::deg);
337  double dz = 0.5*(zv[1]-zv[0]);
338 #ifdef EDM_ML_DEBUG
339  std::cout << "Mode " << mode << " R " << php.waferR_ << " z " << dz
340  << std::endl;
341 #endif
343  mytr.lay = 1; mytr.bl = php.waferR_;
344  mytr.tl = php.waferR_; mytr.h = php.waferR_;
345  mytr.dz = dz; mytr.alpha = 0.0;
346  mytr.cellSize = waferSize_;
347  php.fillModule(mytr,false);
348  names.insert(name);
349  }
350  }
351  }
352  dodet = fv1.next();
353  }
354  }
355 
356  // Finally the cells
357  std::map<int,int> wafertype;
358  std::map<int,HGCalGeomParameters::cellParameters> cellsf, cellsc;
359  DDValue val2(attribute, sdTag3, 0.0);
360  DDSpecificsMatchesValueFilter filter2{val2};
361  DDFilteredView fv2(*cpv,filter2);
362  ok = fv2.firstChild();
363  if (!ok) {
364  edm::LogError("HGCalGeom") << " Attribute " << val2
365  << " not found but needed.";
366  throw cms::Exception("DDException") << "Attribute " << val2
367  << " not found but needed.";
368  } else {
369  dodet = true;
370  while (dodet) {
371  const DDSolid & sol = fv2.logicalPart().solid();
372  std::string name = sol.name();
373  std::vector<int> copy = fv2.copyNumbers();
374  int nsiz = (int)(copy.size());
375  int cellx= (nsiz > 0) ? copy[nsiz-1] : 0;
376  int wafer= (nsiz > 1) ? copy[nsiz-2] : 0;
377  int cell = cellx%1000;
378  int type = cellx/1000;
379  if (type != 1 && type != 2) {
380  edm::LogError("HGCalGeom") << "Funny cell # " << cell << " type "
381  << type << " in " << nsiz << " components";
382  throw cms::Exception("DDException") << "Funny cell # " << cell;
383  } else {
384  std::map<int,int>::iterator ktr = wafertype.find(wafer);
385  if (ktr == wafertype.end()) wafertype[wafer] = type;
386  bool newc(false);
387  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr;
388  double cellsize = php.cellSize_[0];
389  if (type == 1) {
390  itr = cellsf.find(cell);
391  newc= (itr == cellsf.end());
392  } else {
393  itr = cellsc.find(cell);
394  newc= (itr == cellsc.end());
395  cellsize = php.cellSize_[1];
396  }
397  if (newc) {
398  bool half = (name.find("Half") != std::string::npos);
399  double xx = k_ScaleFromDDD*fv2.translation().X();
400  double yy = k_ScaleFromDDD*fv2.translation().Y();
401  if (half) {
402  math::XYZPointD p1(-2.0*cellsize/9.0,0,0);
403  math::XYZPointD p2 = fv2.rotation()(p1);
404  xx += (k_ScaleFromDDD*(p2.X()));
405  yy += (k_ScaleFromDDD*(p2.Y()));
406 #ifdef EDM_ML_DEBUG
407  std::cout << "Type " << type << " Cell " << cellx << " local "
408  << xx << ":" << yy << " new " << p1 << ":" << p2 <<"\n";
409 #endif
410  }
412  if (type == 1) {
413  cellsf[cell] = cp;
414  } else {
415  cellsc[cell] = cp;
416  }
417  }
418  }
419  dodet = fv2.next();
420  }
421  }
422 
423  if (((cellsf.size()+cellsc.size())==0) || (wafers.size()==0) ||
424  (layers.size()==0)) {
425  edm::LogError("HGCalGeom") << "HGCalGeomParameters : number of cells "
426  << cellsf.size() << ":" << cellsc.size()
427  << " wafers " << wafers.size() << " layers "
428  << layers.size() << " illegal";
429  throw cms::Exception("DDException")
430  << "HGCalGeomParameters: mismatch between geometry and specpar: cells "
431  << cellsf.size() << ":" << cellsc.size() << " wafers " << wafers.size()
432  << " layers " << layers.size();
433  }
434 
435  for (unsigned int i=0; i<layers.size(); ++i) {
436  for (std::map<int,HGCalGeomParameters::layerParameters>::iterator itr = layers.begin();
437  itr != layers.end(); ++itr) {
438  if (itr->first == (int)(i+1)) {
439  php.layerIndex_.push_back(i);
440  php.rMinLayHex_.push_back(itr->second.rmin);
441  php.rMaxLayHex_.push_back(itr->second.rmax);
442  php.zLayerHex_.push_back(itr->second.zpos);
443  break;
444  }
445  }
446  }
447  for (unsigned int i=0; i<php.layer_.size(); ++i) {
448  for (unsigned int i1=0; i1<trforms.size(); ++i1) {
449  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay-1] ==
450  (int)(i+1)) {
451  trforms[i1].h3v *= k_ScaleFromDDD;
452  trforms[i1].lay = (i+1);
453  trformUse[i1] = true;
454  php.fillTrForm(trforms[i1]);
455  int nz(1);
456  for (unsigned int i2=i1+1; i2<trforms.size(); ++i2) {
457  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
458  php.layerGroup_[trforms[i2].lay-1] == (int)(i+1)) {
459  php.addTrForm(k_ScaleFromDDD*trforms[i2].h3v);
460  nz++;
461  trformUse[i2] = true;
462  }
463  }
464  if (nz > 0) {
465  php.scaleTrForm(double(1.0/nz));
466  }
467  }
468  }
469  }
470 
471  double rmin = k_ScaleFromDDD*php.waferR_;
472  for (unsigned i = 0; i < wafer2copy.size(); ++i ) {
473  php.waferCopy_.push_back(wafer2copy[i]);
474  php.waferPosX_.push_back(wafers[i].xyz.x());
475  php.waferPosY_.push_back(wafers[i].xyz.y());
476  std::map<int,int>::iterator ktr = wafertype.find(wafer2copy[i]);
477  int typet = (ktr == wafertype.end()) ? 0 : (ktr->second);
478  php.waferTypeT_.push_back(typet);
479  double r = wafers[i].xyz.perp();
480  int type(3);
481  for (int k=1; k<4; ++k) {
482  if ((r+rmin)<=php.boundR_[k]) {
483  type = k; break;
484  }
485  }
486  php.waferTypeL_.push_back(type);
487  }
488  php.copiesInLayers_ = copiesInLayers;
489  php.nSectors_ = (int)(php.waferCopy_.size());
490 
491  std::vector<HGCalGeomParameters::cellParameters>::const_iterator itrf = wafers.end();
492  for (unsigned int i=0; i<cellsf.size(); ++i) {
493  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr = cellsf.find(i);
494  if (itr == cellsf.end()) {
495  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
496  << " fine cell number " << i;
497  throw cms::Exception("DDException")
498  << "HGCalGeomParameters: missing info for fine cell number " << i;
499  } else {
500  double xx = (itr->second).xyz.x();
501  double yy = (itr->second).xyz.y();
502  int waf= (itr->second).wafer;
503  std::pair<double,double> xy = cellPosition(wafers,itrf,waf,xx,yy);
504  php.cellFineX_.push_back(xy.first);
505  php.cellFineY_.push_back(xy.second);
506  php.cellFineHalf_.push_back((itr->second).half);
507  }
508  }
509  itrf = wafers.end();
510  for (unsigned int i=0; i<cellsc.size(); ++i) {
511  std::map<int,HGCalGeomParameters::cellParameters>::iterator itr = cellsc.find(i);
512  if (itr == cellsc.end()) {
513  edm::LogError("HGCalGeom") << "HGCalGeomParameters: missing info for"
514  << " coarse cell number " << i;
515  throw cms::Exception("DDException")
516  << "HGCalGeomParameters: missing info for coarse cell number " << i;
517  } else {
518  double xx = (itr->second).xyz.x();
519  double yy = (itr->second).xyz.y();
520  int waf= (itr->second).wafer;
521  std::pair<double,double> xy = cellPosition(wafers,itrf,waf,xx,yy);
522  php.cellCoarseX_.push_back(xy.first);
523  php.cellCoarseY_.push_back(xy.second);
524  php.cellCoarseHalf_.push_back((itr->second).half);
525  }
526  }
527  int depth(0);
528  for (unsigned int i=0; i<php.layerGroup_.size(); ++i) {
529  bool first(true);
530  for (unsigned int k=0; k<php.layerGroup_.size(); ++k) {
531  if (php.layerGroup_[k] == (int)(i+1)) {
532  if (first) {
533  php.depth_.push_back(i+1);
534  php.depthIndex_.push_back(depth);
535  php.depthLayerF_.push_back(k);
536  ++depth;
537  first = false;
538  }
539  }
540  }
541  }
542  HGCalParameters::hgtrap mytr = php.getModule(0, false);
543  mytr.bl *= k_ScaleFromDDD;
544  mytr.tl *= k_ScaleFromDDD;
545  mytr.h *= k_ScaleFromDDD;
546  mytr.dz *= k_ScaleFromDDD;
547  double dz = mytr.dz;
548  php.fillModule(mytr, true);
549  mytr.dz = 2*dz;
550  php.fillModule(mytr, true);
551  mytr.dz = 3*dz;
552  php.fillModule(mytr, true);
553 #ifdef EDM_ML_DEBUG
554  std::cout << "HGCalGeomParameters finds " << php.zLayerHex_.size()
555  << " layers" << std::endl;
556  for (unsigned int i=0; i<php.zLayerHex_.size(); ++i) {
557  int k = php.layerIndex_[i];
558  std::cout << "Layer[" << i << ":" << k << ":" << php.layer_[k]
559  << "] with r = " << php.rMinLayHex_[i] << ":"
560  << php.rMaxLayHex_[i] << " at z = " << php.zLayerHex_[i]
561  << std::endl;
562  }
563  std::cout << "HGCalGeomParameters has " << php.depthIndex_.size()
564  << " depths" <<std::endl;
565  for (unsigned int i=0; i<php.depthIndex_.size(); ++i) {
566  int k = php.depthIndex_[i];
567  std::cout << "Reco Layer[" << i << ":" << k << "] First Layer "
568  << php.depthLayerF_[i] << " Depth " << php.depth_[k] <<std::endl;
569  }
570  std::cout << "HGCalGeomParameters finds " << php.nSectors_ << " wafers\n";
571  for (unsigned int i=0; i<php.waferCopy_.size(); ++i)
572  std::cout << "Wafer[" << i << ": " << php.waferCopy_[i] << "] type "
573  << php.waferTypeL_[i] << ":" << php.waferTypeT_[i] << " at ("
574  << php.waferPosX_[i] << "," << php.waferPosY_[i] << ",0)\n";
575  std::cout << "HGCalGeomParameters: wafer radius " << php.waferR_
576  << " and dimensions of the wafers:" << std::endl;
577  std::cout << "Sim[0] " << php.moduleLayS_[0] << " dx " << php.moduleBlS_[0]
578  << ":" << php.moduleTlS_[0] << " dy " << php.moduleHS_[0] << " dz "
579  << php.moduleDzS_[0] << " alpha " << php.moduleAlphaS_[0] << "\n";
580  for (unsigned int k=0; k<php.moduleLayR_.size(); ++k)
581  std::cout << "Rec[" << k << "] " << php.moduleLayR_[k] << " dx "
582  << php.moduleBlR_[k] << ":" << php.moduleTlR_[k] << " dy "
583  << php.moduleHR_[k] << " dz " << php.moduleDzR_[k] << " alpha "
584  << php.moduleAlphaR_[k] << std::endl;
585  std::cout << "HGCalGeomParameters finds " << php.cellFineX_.size()
586  << " fine cells in a wafer" << std::endl;
587  for (unsigned int i=0; i<php.cellFineX_.size(); ++i)
588  std::cout << "Fine Cell[" << i << "] at (" << php.cellFineX_[i] << ","
589  << php.cellFineY_[i] << ",0)" << std::endl;
590  std::cout << "HGCalGeomParameters finds " << php.cellCoarseX_.size()
591  << " coarse cells in a wafer" << std::endl;
592  for (unsigned int i=0; i<php.cellCoarseX_.size(); ++i)
593  std::cout << "Coarse Cell[" << i << "] at (" << php.cellCoarseX_[i]
594  << "," << php.cellCoarseY_[i] << ",0)" << std::endl;
595  std::cout << "Obtained " << php.trformIndex_.size()
596  << " transformation matrices" << std::endl;
597  for (unsigned int k=0; k<php.trformIndex_.size(); ++k) {
598  std::cout << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k]
599  << std::dec << ") Trnaslation (" << php.trformTranX_[k]
600  << ", " << php.trformTranY_[k] << ", " << php.trformTranZ_[k]
601  << " Rotation (" << php.trformRotXX_[k] << ", "
602  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", "
603  << php.trformRotXY_[k] << ", " << php.trformRotYY_[k] << ", "
604  << php.trformRotZY_[k] << ", " << php.trformRotXZ_[k] << ", "
605  << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k] << ")\n";
606  }
607  std::cout << "Dump copiesInLayers for " << php.copiesInLayers_.size()
608  << " layers\n";
609  for (unsigned int k=0; k<php.copiesInLayers_.size(); ++k) {
610  const auto& theModules = php.copiesInLayers_[k];
611  std::cout << "Layer " << k << ":" << theModules.size() << std::endl;
612  int k2(0);
613  for (std::unordered_map<int, int>::const_iterator itr=theModules.begin();
614  itr != theModules.end(); ++itr) {
615  std::cout << " " << itr->first << ":" << itr->second;
616  ++k2;
617  if (k2 > 9) { std::cout << std::endl; k2 = 0; }
618  }
619  if (k2 > 0) std::cout << std::endl;
620  }
621 #endif
622 }
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_
static const HistoName names[]
std::vector< bool > cellFineHalf_
std::vector< double > rMaxVec(void) const
Definition: DDSolid.cc:454
std::vector< int > moduleLayR_
nav_type copyNumbers() const
return the stack of copy numbers
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
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:497
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
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:608
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:511
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:438
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_
const double k_ScaleFromDDD
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:605
std::vector< double > waferPosX_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
std::vector< int > waferTypeL_
void HGCalGeomParameters::loadGeometrySquare ( const DDFilteredView _fv,
HGCalParameters php,
const std::string &  sdTag 
)

Definition at line 37 of file HGCalGeomParameters.cc.

References HGCalParameters::addTrForm(), HGCalParameters::hgtrap::alpha, DDTrap::alpha1(), HGCalParameters::hgtrap::bl, HGCalParameters::cellFactor_, HGCalParameters::hgtrap::cellSize, HGCalParameters::cellSize_, popcon2dropbox::copy(), DDFilteredView::copyNumbers(), gather_cfg::cout, TauDecayModes::dec, particleFlowClusterECALTimeSelected_cfi::depth, HGCalParameters::depth_, HGCalParameters::depthIndex_, HGCalParameters::depthLayerF_, HGCalParameters::hgtrap::dz, allConversions_cfi::dz, Exception, HGCalParameters::fillModule(), HGCalParameters::fillTrForm(), spr::find(), plotBeamSpotDB::first, HGCalParameters::getModule(), HGCalParameters::hgtrap::h, DDTrap::halfZ(), AnalysisDataFormats_SUSYBSMObjects::hr, mps_fire::i, createfilelist::int, gen::k, k_ScaleFromDDD, HGCalParameters::hgtrap::lay, HGCalParameters::layer_, HGCalParameters::layerGroup_, HGCalParameters::layerIndex_, DDFilteredView::logicalPart(), HGCalParameters::moduleAlphaR_, HGCalParameters::moduleAlphaS_, HGCalParameters::moduleBlR_, HGCalParameters::moduleBlS_, HGCalParameters::moduleCellR_, HGCalParameters::moduleCellS_, HGCalParameters::moduleDzR_, HGCalParameters::moduleDzS_, HGCalParameters::moduleHR_, HGCalParameters::moduleHS_, HGCalParameters::moduleLayR_, HGCalParameters::moduleLayS_, HGCalParameters::moduleTlR_, HGCalParameters::moduleTlS_, dataset::name, DDBase< N, C >::name(), DDFilteredView::next(), HGCalParameters::nSectors_, idealTransformation::rotation, DDFilteredView::rotation(), HGCalParameters::scaleTrForm(), DDLogicalPart::solid(), AlCaHLTBitMon_QueryRunRegistry::string, HGCalParameters::hgtrap::tl, 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, DDTrap::x1(), DDTrap::x2(), y, DDTrap::y1(), DDTrap::y2(), z, and HGCalParameters::hgtrform::zp.

Referenced by HGCalParametersFromDD::build().

39  {
40 
41  DDFilteredView fv = _fv;
42  bool dodet(true), first(true);
43  int zpFirst(0);
44  std::vector<HGCalParameters::hgtrform> trforms;
45  std::vector<bool> trformUse;
46 
47  while (dodet) {
48  const DDSolid & sol = fv.logicalPart().solid();
49  std::string name = sol.name();
50  int isd = (name.find(sdTag) == std::string::npos) ? -1 : 1;
51  if (isd > 0) {
52  std::vector<int> copy = fv.copyNumbers();
53  int nsiz = (int)(copy.size());
54  int lay = (nsiz > 0) ? copy[nsiz-1] : -1;
55  int sec = (nsiz > 1) ? copy[nsiz-2] : -1;
56  int zp = (nsiz > 3) ? copy[nsiz-4] : -1;
57  if (zp !=1 ) zp = -1;
58  if (first) {first = false; zpFirst = zp;}
59  const DDTrap & trp = static_cast<DDTrap>(sol);
61  mytr.lay = lay; mytr.bl = trp.x1(); mytr.tl = trp.x2();
62  mytr.h = 0.5*(trp.y1()+trp.y2()); mytr.dz = trp.halfZ();
63  mytr.alpha = trp.alpha1(); mytr.cellSize = 0;
64  int subs = (trp.alpha1()>0 ? 1 : 0);
65  if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
66  php.layer_.end()) {
67  for (unsigned int k=0; k<php.cellSize_.size(); ++k) {
68  if (lay == (int)(k+1)) {
69  mytr.cellSize = php.cellSize_[k];
70  break;
71  }
72  }
73  php.fillModule(mytr,false);
74  if (php.layer_.size() == 0) php.nSectors_ = 1;
75  php.layer_.push_back(lay);
76  } else if (std::find(php.layer_.begin(),php.layer_.end(),lay) ==
77  php.layer_.begin()) {
78  if (zp == zpFirst) ++(php.nSectors_);
79  }
80  DD3Vector x, y, z;
81  fv.rotation().GetComponents( x, y, z ) ;
82  const CLHEP::HepRep3x3 rotation ( x.X(), y.X(), z.X(),
83  x.Y(), y.Y(), z.Y(),
84  x.Z(), y.Z(), z.Z() );
85  const CLHEP::HepRotation hr ( rotation );
86  const CLHEP::Hep3Vector h3v ( fv.translation().X(),
87  fv.translation().Y(),
88  fv.translation().Z() );
90  mytrf.zp = zp;
91  mytrf.lay = lay;
92  mytrf.sec = sec;
93  mytrf.subsec= subs;
94  mytrf.h3v = h3v;
95  mytrf.hr = hr;
96  trforms.push_back(mytrf);
97  trformUse.push_back(false);
98  }
99  dodet = fv.next();
100  }
101  if (php.layer_.size() != php.cellSize_.size()) {
102  edm::LogError("HGCalGeom") << "HGCalGeomParameters : mismatch in # of bins "
103  << php.layer_.size() << ":" << php.cellSize_.size()
104  << " between geometry and specpar";
105  throw cms::Exception("DDException") << "HGCalGeomParameters: mismatch between geometry and specpar";
106  }
107  for (unsigned int i=0; i<php.layer_.size(); ++i) {
108  for (unsigned int k=0; k<php.layer_.size(); ++k) {
109  if (php.layer_[k] == (int)(i+1)) {
110  php.layerIndex_.push_back(k);
111  break;
112  }
113  }
114  }
115 #ifdef EDM_ML_DEBUG
116  std::cout << "HGCalGeomParameters finds " << php.layerIndex_.size()
117  << " modules for " << sdTag << " with " << php.nSectors_
118  << " sectors and " << trforms.size() << " transformation matrices"
119  << std::endl;
120  for (unsigned int i=0; i<php.layerIndex_.size(); ++i) {
121  int k = php.layerIndex_[i];
122  std::cout << "Module[" << i << ":" << k << "] Layer " << php.layer_[k]
123  << ":" << php.moduleLayS_[k] << " dx " << php.moduleBlS_[k]
124  << ":" << php.moduleTlS_[k] << " dy "<< php.moduleHS_[k]
125  << " dz " << php.moduleDzS_[k] << " alpha "
126  << php.moduleAlphaS_[k] << " cell " << php.moduleCellS_[k]
127  << std::endl;
128  }
129 #endif
130  int depth(0);
131  for (unsigned int i=0; i<php.layer_.size(); ++i) {
132  bool first(true);
133  float dz(0);
134  for (unsigned int k=0; k<php.layerGroup_.size(); ++k) {
135  if (php.layerGroup_[k] == (int)(i+1)) {
136  if (first) {
137  php.depth_.push_back(i+1);
138  php.depthIndex_.push_back(depth);
139  php.depthLayerF_.push_back(k);
140  ++depth;
141  HGCalParameters::hgtrap mytr = php.getModule(k,false);
142  mytr.lay = depth;
143  mytr.bl *= k_ScaleFromDDD;
144  mytr.tl *= k_ScaleFromDDD;
145  mytr.h *= k_ScaleFromDDD;
146  mytr.dz *= k_ScaleFromDDD;
147  mytr.cellSize *= (k_ScaleFromDDD*php.cellFactor_[k]);
148  php.fillModule(mytr, true);
149  dz = mytr.dz;
150  first = false;
151  } else {
152  dz += (k_ScaleFromDDD*php.moduleDzS_[k]);
153  php.moduleDzR_.back() = dz;
154  }
155  }
156  }
157  }
158 #ifdef EDM_ML_DEBUG
159  std::cout << "HGCalGeomParameters has " << php.depthIndex_.size()
160  << " depths" << std::endl;
161  for (unsigned int i=0; i<php.depthIndex_.size(); ++i) {
162  int k = php.depthIndex_[i];
163  std::cout << "Module[" << i << ":" << k <<"] First Layer "
164  << php.depthLayerF_[i] << " Depth " << php.depth_[k] << ":"
165  << php.moduleLayR_[k] << " dx " << php.moduleBlR_[k] << ":"
166  << php.moduleTlR_[k] << " dy " <<php.moduleHR_[k] << " dz "
167  << php.moduleDzR_[k] << " alpha " << php.moduleAlphaR_[k]
168  << " cellSize " << php.moduleCellR_[k] << std::endl;
169  }
170 #endif
171  for (unsigned int i=0; i<php.layer_.size(); ++i) {
172  for (unsigned int i1=0; i1<trforms.size(); ++i1) {
173  if (!trformUse[i1] && php.layerGroup_[trforms[i1].lay-1] ==
174  (int)(i+1)) {
175  trforms[i1].h3v *= k_ScaleFromDDD;
176  trforms[i1].lay = (i+1);
177  trformUse[i1] = true;
178  php.fillTrForm(trforms[i1]);
179  int nz(1);
180  for (unsigned int i2=i1+1; i2<trforms.size(); ++i2) {
181  if (!trformUse[i2] && trforms[i2].zp == trforms[i1].zp &&
182  php.layerGroup_[trforms[i2].lay-1] == (int)(i+1) &&
183  trforms[i2].sec == trforms[i1].sec &&
184  trforms[i2].subsec == trforms[i1].subsec) {
185  php.addTrForm(k_ScaleFromDDD*trforms[i2].h3v);
186  nz++;
187  trformUse[i2] = true;
188  }
189  }
190  if (nz > 0) {
191  php.scaleTrForm(double(1.0/nz));
192  }
193  }
194  }
195  }
196 #ifdef EDM_ML_DEBUG
197  std::cout << "Obtained " << php.trformIndex_.size()
198  << " transformation matrices" << std::endl;
199  for (unsigned int k=0; k<php.trformIndex_.size(); ++k) {
200  std::cout << "Matrix[" << k << "] (" << std::hex << php.trformIndex_[k]
201  << std::dec << ") Trnaslation (" << php.trformTranX_[k]
202  << ", " << php.trformTranY_[k] << ", " << php.trformTranZ_[k]
203  << ") Rotation (" << php.trformRotXX_[k] << ", "
204  << php.trformRotYX_[k] << ", " << php.trformRotZX_[k] << ", "
205  << php.trformRotXY_[k] << ", " << php.trformRotYY_[k] << ", "
206  << php.trformRotZY_[k] << ", " << php.trformRotXZ_[k] << ", "
207  << php.trformRotYZ_[k] << ", " << php.trformRotZZ_[k] << ")\n";
208  }
209 #endif
210 }
std::vector< int > layer_
std::vector< double > moduleDzR_
std::vector< int > depthLayerF_
double halfZ(void) const
half of the z-Axis
Definition: DDSolid.cc:162
std::vector< int > depth_
std::vector< double > moduleCellR_
std::vector< double > moduleHR_
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the filtered-view.
double x1(void) const
Half-length along x of the side at y=-pDy1 of the face at -pDz.
Definition: DDSolid.cc:174
const N & name() const
Definition: DDBase.h:78
std::vector< int > moduleLayR_
nav_type copyNumbers() const
return the stack of copy numbers
std::vector< double > moduleHS_
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
std::vector< double > trformTranY_
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
std::vector< int > cellFactor_
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_
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
std::vector< double > trformRotXY_
std::vector< double > trformRotYX_
hgtrap getModule(unsigned int k, bool reco) const
Interface to a Trapezoid.
Definition: DDSolid.h:79
double y1(void) const
Half-length along y of the face at -pDz.
Definition: DDSolid.cc:171
std::vector< double > moduleBlR_
void fillModule(const hgtrap &mytr, bool reco)
std::vector< double > moduleTlS_
int k[5][pyjets_maxn]
std::vector< double > trformTranX_
std::vector< double > trformRotXZ_
void scaleTrForm(double)
std::vector< int > layerGroup_
std::vector< double > moduleCellS_
double alpha1(void) const
Angle with respect to the y axis from the centre of the side at y=-pDy1 to the centre at y=+pDy1 of t...
Definition: DDSolid.cc:180
std::vector< double > trformRotYY_
double x2(void) const
Half-length along x of the side at y=+pDy1 of the face at -pDz.
Definition: DDSolid.cc:177
std::vector< double > trformRotZZ_
std::vector< double > moduleAlphaS_
std::vector< double > moduleBlS_
double y2(void) const
Half-length along y of the face at +pDz.
Definition: DDSolid.cc:183
const double k_ScaleFromDDD
std::vector< int > depthIndex_
const DDTranslation & translation() const
The absolute translation of the current node.
std::vector< int > moduleLayS_
std::vector< double > trformTranZ_
void addTrForm(const CLHEP::Hep3Vector &h3v)
std::vector< double > moduleTlR_
void HGCalGeomParameters::loadSpecParsHexagon ( const DDFilteredView fv,
HGCalParameters php,
const DDCompactView cpv,
const std::string &  sdTag1,
const std::string &  sdTag2 
)

Definition at line 663 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, gather_cfg::cout, dbl_to_int(), EDM_ML_DEBUG, DDFilteredView::firstChild(), getDDDArray(), gen::k, k_ScaleFromDDD, HGCalParameters::layerGroup_, HGCalParameters::layerGroupM_, HGCalParameters::layerGroupO_, HGCalParameters::levelT_, DDFilteredView::mergedSpecifics(), HGCalParameters::rLimit_, HGCalParameters::slopeMin_, AlCaHLTBitMon_QueryRunRegistry::string, and waferSize_.

Referenced by HGCalParametersFromDD::build().

667  {
668 
670  int nmin(4);
671  php.boundR_ = getDDDArray("RadiusBound",sv,nmin);
672  for (unsigned int k=0; k<php.boundR_.size(); ++k)
673  php.boundR_[k] *= k_ScaleFromDDD;
674 #ifdef EDM_ML_DEBUG
675  std::cout << "HGCalGeomParameters: wafer radius ranges for cell grouping "
676  << php.boundR_[0] << ":" << php.boundR_[1] << ":"
677  << php.boundR_[2] << ":" << php.boundR_[3] << std::endl;
678 #endif
679  nmin = 2;
680  php.rLimit_ = getDDDArray("RadiusLimits",sv,nmin);
681  for (unsigned int k=0; k<php.rLimit_.size(); ++k)
682  php.rLimit_[k] *= k_ScaleFromDDD;
683 #ifdef EDM_ML_DEBUG
684  std::cout << "HGCalGeomParameters: Minimum/maximum R "
685  << php.rLimit_[0] << ":" << php.rLimit_[1] << "\n";
686 #endif
687  nmin = 0;
688  std::vector<int> ndummy = dbl_to_int(getDDDArray("LevelTop",sv,nmin));
689  php.levelT_ = ndummy[0];
690 #ifdef EDM_ML_DEBUG
691  std::cout << "HGCalGeomParameters: LevelTop " << php.levelT_ << "\n";
692 #endif
693 
694  //Grouping of layers
695  nmin = 0;
696  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZFine",sv,nmin));
697  php.layerGroupM_ = dbl_to_int(getDDDArray("GroupingZMid",sv,nmin));
698  php.layerGroupO_ = dbl_to_int(getDDDArray("GroupingZOut",sv,nmin));
699  nmin = 1;
700  std::vector<double> slp = getDDDArray("Slope",sv,nmin);
701  php.slopeMin_ = slp[0];
702 #ifdef EDM_ML_DEBUG
703  std::cout << "HGCalGeomParameters: minimum slope " << php.slopeMin_
704  << " and layer groupings for the 3 ranges:" << std::endl;
705  for (int k=0; k<nmin; ++k)
706  std::cout << "[" << k << "] " << php.layerGroup_[k] << ":"
707  << php.layerGroupM_[k] << ":" << php.layerGroupO_[k] << "\n";
708 #endif
709 
710  //Wafer size
711  std::string attribute = "Volume";
712  DDSpecificsMatchesValueFilter filter1{DDValue(attribute, sdTag1, 0.0)};
713  DDFilteredView fv1(*cpv,filter1);
714  if (fv1.firstChild()) {
715  DDsvalues_type sv(fv1.mergedSpecifics());
716  int nmin(0);
717  std::vector<double> dummy = getDDDArray("WaferSize",sv,nmin);
718  waferSize_ = dummy[0];
719  }
720 #ifdef EDM_ML_DEBUG
721  std::cout << "HGCalGeomParameters: Wafer Size: " << waferSize_ << std::endl;
722 #endif
723 
724  //Cell size
725  DDSpecificsMatchesValueFilter filter2{DDValue(attribute, sdTag2, 0.0)};
726  DDFilteredView fv2(*cpv,filter2);
727  if (fv2.firstChild()) {
728  DDsvalues_type sv(fv2.mergedSpecifics());
729  int nmin(0);
730  php.cellSize_ = getDDDArray("CellSize",sv,nmin);
731  }
732 #ifdef EDM_ML_DEBUG
733  std::cout << "HGCalGeomParameters: " << php.cellSize_.size()
734  << " cells of sizes:\n";
735  for (unsigned int k=0; k<php.cellSize_.size(); ++k)
736  std::cout << " [" << k << "] " << php.cellSize_[k] << "\n";
737 #endif
738 
739 }
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
#define EDM_ML_DEBUG
Definition: MPUnpacker.cc:1
std::vector< double > boundR_
std::vector< double > cellSize_
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 &, int &)
int k[5][pyjets_maxn]
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
std::vector< int > layerGroupO_
const double k_ScaleFromDDD
std::vector< double > rLimit_
void HGCalGeomParameters::loadSpecParsSquare ( const DDFilteredView fv,
HGCalParameters php 
)

Definition at line 624 of file HGCalGeomParameters.cc.

References HGCalParameters::cellFactor_, HGCalParameters::cellSize_, gather_cfg::cout, dbl_to_int(), getDDDArray(), mps_fire::i, HGCalParameters::layerGroup_, DDFilteredView::mergedSpecifics(), HGCalParameters::nCells_, and HGCalParameters::slopeMin_.

Referenced by HGCalParametersFromDD::build().

625  {
626 
628  //Granularity in x-y plane
629  php.nCells_ = 0;
630  php.cellSize_ = getDDDArray("Granularity",sv,php.nCells_);
631 #ifdef EDM_ML_DEBUG
632  std::cout << "HGCalGeomParameters: " << php.nCells_
633  << " entries for cellSize_" << std::endl;
634  for (int i=0; i<php.nCells_; i++) {
635  std::cout << " [" << i << "] = " << php.cellSize_[i] << std::endl;
636  }
637 #endif
638 
639  //Grouping in the detector plane
640  php.cellFactor_ = dbl_to_int(getDDDArray("GroupingXY",sv,php.nCells_));
641  int nmin = 1;
642  std::vector<double> slp = getDDDArray("Slope",sv,nmin);
643  php.slopeMin_ = slp[0];
644 #ifdef EDM_ML_DEBUG
645  std::cout << "HGCalGeomParameters: minimum slope " << php.slopeMin_
646  << " and " << php.nCells_ << " entries for cellFactor_\n";
647  for (int i=0; i<php.nCells_; i++) {
648  std::cout << " [" << i << "] = " << php.cellFactor_[i] << std::endl;
649  }
650 #endif
651 
652  //Grouping of layers
653  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZ",sv,php.nCells_));
654 #ifdef EDM_ML_DEBUG
655  std::cout << "HGCalGeomParameters: " << php.nCells_
656  << " entries for layerGroup_" << std::endl;
657  for (int i=0; i<php.nCells_; i++) {
658  std::cout << " [" << i << "] = " << php.layerGroup_[i] << std::endl;
659  }
660 #endif
661 }
std::vector< int > cellFactor_
std::vector< int > dbl_to_int(const std::vector< double > &vecdbl)
Converts a std::vector of doubles to a std::vector of int.
Definition: DDutils.h:7
std::vector< double > cellSize_
std::vector< 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 &, int &)
std::vector< int > layerGroup_
DDsvalues_type mergedSpecifics() const
void HGCalGeomParameters::loadWaferHexagon ( HGCalParameters php)

Definition at line 741 of file HGCalGeomParameters.cc.

References HGCalParameters::boundR_, HGCalParameters::copiesInLayers_, popcon2dropbox::copy(), TCMET_cfi::corner, gather_cfg::cout, createfilelist::int, gen::k, 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_, and HGCalParameters::waferTypeT_.

Referenced by HGCalParametersFromDD::build().

741  {
742 
743  double waferW(k_ScaleFromDDD*waferSize_), rmin(k_ScaleFromDDD*php.waferR_);
744  double rin(php.rLimit_[0]), rout(php.rLimit_[1]), rMaxFine(php.boundR_[1]);
745 #ifdef EDM_ML_DEBUG
746  std::cout << "Input waferWidth " << waferW << ":" << rmin
747  << " R Limits: " << rin << ":" << rout
748  << " Fine " << rMaxFine << "\n";
749 #endif
750  // Clear the vectors
751  php.waferCopy_.clear();
752  php.waferTypeL_.clear();
753  php.waferTypeT_.clear();
754  php.waferPosX_.clear();
755  php.waferPosY_.clear();
756  double dx = 0.5*waferW;
757  double dy = 3.0*dx*tan(30.0*CLHEP::deg);
758  double rr = 2.0*dx*tan(30.0*CLHEP::deg);
759  int ncol = (int)(2.0*rout/waferW) + 1;
760  int nrow = (int)(rout/(waferW*tan(30.0*CLHEP::deg))) + 1;
761  int incm(0), inrm(0), kount(0), ntot(0);
762  double xc[6], yc[6];
763  HGCalParameters::layer_map copiesInLayers(php.layer_.size()+1);
764 #ifdef EDM_ML_DEBUG
765  std::cout << "Row " << nrow << " Column " << ncol << std::endl;
766 #endif
767  for (int nr=-nrow; nr <= nrow; ++nr) {
768  int inr = (nr >= 0) ? nr : -nr;
769  for (int nc=-ncol; nc <= ncol; ++nc) {
770  int inc = (nc >= 0) ? nc : -nc;
771  if (inr%2 == inc%2) {
772  double xpos = nc*dx;
773  double ypos = nr*dy;
774  xc[0] = xpos+dx; yc[0] = ypos-0.5*rr;
775  xc[1] = xpos+dx; yc[1] = ypos+0.5*rr;
776  xc[2] = xpos; yc[2] = ypos+rr;
777  xc[3] = xpos-dx; yc[3] = ypos+0.5*rr;
778  xc[4] = xpos+dx; yc[4] = ypos-0.5*rr;
779  xc[5] = xpos; yc[5] = ypos-rr;
780  bool cornerOne(false);
781  bool cornerAll(true);
782  for (int k=0; k<6; ++k) {
783  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
784  if (rpos >= rin && rpos <= rout) cornerOne = true;
785  else cornerAll = false;
786  }
787  double rpos = std::sqrt(xpos*xpos+ypos*ypos);
788  int typet = (rpos < rMaxFine) ? 1 : 2;
789  int typel(3);
790  for (int k=1; k<4; ++k) {
791  if ((rpos+rmin)<=php.boundR_[k]) {
792  typel = k; break;
793  }
794  }
795  ++ntot;
796  if (cornerOne) {
797  int copy = inr*100 + inc;
798  if (nc < 0) copy += 10000;
799  if (nr < 0) copy += 100000;
800  if (inc > incm) incm = inc;
801  if (inr > inrm) inrm = inr;
802  kount++;
803 #ifdef EDM_ML_DEBUG
804  std::cout << kount << ":" << ntot << " Copy " << copy
805  << " Type " << typel << ":" << typet
806  << " Location " << cornerOne << ":" << cornerAll
807  << " Position " << xpos << ":" << ypos << "\n";
808 #endif
809  php.waferCopy_.push_back(copy);
810  php.waferTypeL_.push_back(typel);
811  php.waferTypeT_.push_back(typet);
812  php.waferPosX_.push_back(xpos);
813  php.waferPosY_.push_back(ypos);
814  for (unsigned int il=0; il<php.layer_.size(); ++il) {
815  bool corner(false);
816  cornerAll = true;
817  for (int k=0; k<6; ++k) {
818  double rpos = std::sqrt(xc[k]*xc[k]+yc[k]*yc[k]);
819  if (rpos >= php.rMinLayHex_[il] &&
820  rpos <= php.rMaxLayHex_[il]) corner = true;
821  else cornerAll = false;
822  }
823  if (corner) {
824  std::unordered_map<int32_t,int32_t>::iterator cpy =
825  copiesInLayers[php.layer_[il]].find(copy);
826  if (cpy == copiesInLayers[php.layer_[il]].end())
827  copiesInLayers[php.layer_[il]][copy] = cornerAll ? php.waferCopy_.size() : -1;
828  }
829  }
830  }
831  }
832  }
833  }
834  php.copiesInLayers_ = copiesInLayers;
835  php.nSectors_ = (int)(php.waferCopy_.size());
836 #ifdef EDM_ML_DEBUG
837  std::cout << "HGCalWaferHexagon: # of columns " << incm << " # of rows "
838  << inrm << " and " << kount << ":" << ntot << " wafers; R "
839  << rin << ":" << rout << std::endl;
840  std::cout << "Dump copiesInLayers for " << php.copiesInLayers_.size()
841  << " layers\n";
842  for (unsigned int k=0; k<copiesInLayers.size(); ++k) {
843  const auto& theModules = copiesInLayers[k];
844  std::cout << "Layer " << k << ":" << theModules.size() << std::endl;
845  int k2(0);
846  for (std::unordered_map<int, int>::const_iterator itr=theModules.begin();
847  itr != theModules.end(); ++itr) {
848  std::cout << " " << itr->first << ":" << itr->second;
849  ++k2;
850  if (k2 > 9) { std::cout << std::endl; k2 = 0; }
851  }
852  if (k2 > 0) std::cout << std::endl;
853  }
854 #endif
855 }
std::vector< double > waferPosY_
std::vector< int > layer_
layer_map copiesInLayers_
std::vector< double > boundR_
T sqrt(T t)
Definition: SSEVec.h:18
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_
std::vector< int > waferCopy_
const double k_ScaleFromDDD
std::vector< double > rLimit_
std::vector< int > waferTypeT_
std::vector< double > waferPosX_
std::vector< int > waferTypeL_

Member Data Documentation

double HGCalGeomParameters::waferSize_
private