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 &)
 
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 26 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 910 of file HGCalGeomParameters.cc.

References funct::abs().

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

912  {
913 
914  if (itrf == wafers.end()) {
915  for (std::vector<HGCalGeomParameters::cellParameters>::const_iterator itr = wafers.begin();
916  itr != wafers.end(); ++itr) {
917  if (itr->wafer == wafer) {
918  itrf = itr;
919  break;
920  }
921  }
922  }
923  double dx(0), dy(0);
924  if (itrf != wafers.end()) {
925  dx = (xx - itrf->xyz.x());
926  if (std::abs(dx) < 0.001) dx = 0;
927  dy = (yy - itrf->xyz.y());
928  if (std::abs(dy) < 0.001) dy = 0;
929  }
930  return std::pair<double,double>(dx,dy);
931 }
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 873 of file HGCalGeomParameters.cc.

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

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

875  {
876  DDValue value(str);
877  if (DDfetch(&sv,value)) {
878  const std::vector<double> & fvec = value.doubles();
879  int nval = fvec.size();
880  if (nmin > 0) {
881  if (nval < nmin) {
882  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
883  << " bins " << nval << " < " << nmin
884  << " ==> illegal";
885  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
886  }
887  } else {
888  if (nval < 1 && nmin == 0) {
889  edm::LogError("HGCalGeom") << "HGCalGeomParameters : # of " << str
890  << " bins " << nval << " < 1 ==> illegal"
891  << " (nmin=" << nmin << ")";
892  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
893  }
894  }
895  nmin = nval;
896  return fvec;
897  } else {
898  if (nmin >= 0) {
899  edm::LogError("HGCalGeom") << "HGCalGeomParameters: cannot get array "
900  << str;
901  throw cms::Exception("DDException") << "HGCalGeomParameters: cannot get array " << str;
902  }
903  std::vector<double> fvec;
904  nmin = 0;
905  return fvec;
906  }
907 }
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 845 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().

846  {
847 
848  //Special parameters for cell parameters
849  std::string attribute = "OnlyForHGCalNumbering";
850  DDSpecificsHasNamedValueFilter filter1{attribute};
851  DDFilteredView fv1(*cpv,filter1);
852  bool ok = fv1.firstChild();
853 
854  if (ok) {
855  php.cellFine_ = dbl_to_int(DDVectorGetter::get("waferFine"));
856  php.cellCoarse_ = dbl_to_int(DDVectorGetter::get("waferCoarse"));
857  }
858 
859 #ifdef EDM_ML_DEBUG
860  std::cout << "HGCalLoadCellPars: " << php.cellFine_.size()
861  << " rows for fine cells\n";
862  for (unsigned int k=0; k<php.cellFine_.size(); ++k)
863  std::cout << k << ":" << php.cellFine_[k] << " ";
864  std::cout << std::endl;
865  std::cout << "HGCalLoadCellPars: " <<php.cellCoarse_.size()
866  << " rows for coarse cells\n";
867  for (unsigned int k=0; k<php.cellCoarse_.size(); ++k)
868  std::cout << k << ":" << php.cellCoarse_[k] << " ";
869  std::cout << std::endl;
870 #endif
871 }
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 
)

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, 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, geometryCSVtoXML::xx, geometryCSVtoXML::xy, y, geometryCSVtoXML::yy, z, HGCalParameters::zLayerHex_, HGCalParameters::hgtrform::zp, and DDPolyhedra::zVec().

Referenced by HGCalParametersFromDD::build().

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

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

613  {
614 
616  //Granularity in x-y plane
617  php.nCells_ = 0;
618  php.cellSize_ = getDDDArray("Granularity",sv,php.nCells_);
619 #ifdef EDM_ML_DEBUG
620  std::cout << "HGCalGeomParameters: " << php.nCells_
621  << " entries for cellSize_" << std::endl;
622  for (int i=0; i<php.nCells_; i++) {
623  std::cout << " [" << i << "] = " << php.cellSize_[i] << std::endl;
624  }
625 #endif
626 
627  //Grouping in the detector plane
628  php.cellFactor_ = dbl_to_int(getDDDArray("GroupingXY",sv,php.nCells_));
629  int nmin = 1;
630  std::vector<double> slp = getDDDArray("Slope",sv,nmin);
631  php.slopeMin_ = slp[0];
632 #ifdef EDM_ML_DEBUG
633  std::cout << "HGCalGeomParameters: minimum slope " << php.slopeMin_
634  << " and " << php.nCells_ << " entries for cellFactor_\n";
635  for (int i=0; i<php.nCells_; i++) {
636  std::cout << " [" << i << "] = " << php.cellFactor_[i] << std::endl;
637  }
638 #endif
639 
640  //Grouping of layers
641  php.layerGroup_ = dbl_to_int(getDDDArray("GroupingZ",sv,php.nCells_));
642 #ifdef EDM_ML_DEBUG
643  std::cout << "HGCalGeomParameters: " << php.nCells_
644  << " entries for layerGroup_" << std::endl;
645  for (int i=0; i<php.nCells_; i++) {
646  std::cout << " [" << i << "] = " << php.layerGroup_[i] << std::endl;
647  }
648 #endif
649 }
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 729 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().

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