CMS 3D CMS Logo

MagGeoBuilderFromDDD.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author N. Amapane - INFN Torino
5  */
6 
7 #include "MagGeoBuilderFromDDD.h"
8 #include "volumeHandle.h"
9 #include "bSlab.h"
10 #include "bRod.h"
11 #include "bSector.h"
12 #include "bLayer.h"
13 #include "eSector.h"
14 #include "eLayer.h"
15 #include "FakeInterpolator.h"
16 
19 
21 
25 
27 
31 
34 
37 
40 
41 #include <string>
42 #include <vector>
43 #include <iostream>
44 #include <sstream>
45 #include <algorithm>
46 #include <iterator>
47 #include <map>
48 #include <set>
49 #include <iomanip>
50 #include <boost/algorithm/string/replace.hpp>
52 
53 using namespace std;
54 using namespace magneticfield;
55 
56 MagGeoBuilderFromDDD::MagGeoBuilderFromDDD(string tableSet_, int geometryVersion_, bool debug_)
57  : tableSet(tableSet_), geometryVersion(geometryVersion_), theGridFiles(nullptr), debug(debug_) {
58  if (debug)
59  cout << "Constructing a MagGeoBuilderFromDDD" << endl;
60 }
61 
63  for (handles::const_iterator i = bVolumes.begin(); i != bVolumes.end(); ++i) {
64  delete (*i);
65  }
66 
67  for (handles::const_iterator i = eVolumes.begin(); i != eVolumes.end(); ++i) {
68  delete (*i);
69  }
70 }
71 
73  // The final countdown.
74  int ivolumes = volumes.size(); // number of volumes
75  int isurfaces = ivolumes * 6; // number of individual surfaces
76  int iassigned = 0; // How many have been assigned
77  int iunique = 0; // number of unique surfaces
78  int iref_ass = 0;
79  int iref_nass = 0;
80 
81  set<const void*> ptrs;
82 
83  handles::const_iterator first = volumes.begin();
84  handles::const_iterator last = volumes.end();
85 
86  for (handles::const_iterator i = first; i != last; ++i) {
87  if (int((*i)->shape()) > 4)
88  continue; // FIXME: implement test for missing shapes...
89  for (int side = 0; side < 6; ++side) {
90  int references = (*i)->references(side);
91  if ((*i)->isPlaneMatched(side)) {
92  ++iassigned;
93  bool firstOcc = (ptrs.insert(&((*i)->surface(side)))).second;
94  if (firstOcc)
95  iref_ass += references;
96  if (references < 2) {
97  cout << "*** Only 1 ref, vol: " << (*i)->volumeno << " # " << (*i)->copyno << " side: " << side << endl;
98  }
99  } else {
100  iref_nass += references;
101  if (references > 1) {
102  cout << "*** Ref_nass >1 " << endl;
103  }
104  }
105  }
106  }
107  iunique = ptrs.size();
108 
109  cout << " volumes " << ivolumes << endl
110  << " surfaces " << isurfaces << endl
111  << " assigned " << iassigned << endl
112  << " unique " << iunique << endl
113  << " iref_ass " << iref_ass << endl
114  << " iref_nass " << iref_nass << endl;
115 }
116 
118  // DDCompactView cpv;
119  DDExpandedView fv(cpva);
120 
121  if (debug)
122  cout << "**********************************************************" << endl;
123 
124  // The actual field interpolators
125  map<string, MagProviderInterpol*> bInterpolators;
126  map<string, MagProviderInterpol*> eInterpolators;
127 
128  // Counter of different volumes
129  int bVolCount = 0;
130  int eVolCount = 0;
131 
132  if (fv.logicalPart().name().name() != "MAGF") {
133  std::string topNodeName(fv.logicalPart().name().name());
134 
135  //see if one of the children is MAGF
136  bool doSubDets = fv.firstChild();
137 
138  bool go = true;
139  while (go && doSubDets) {
140  if (fv.logicalPart().name().name() == "MAGF")
141  break;
142  else
143  go = fv.nextSibling();
144  }
145  if (!go) {
146  throw cms::Exception("NoMAGFinDDD")
147  << " Neither the top node, nor any child node of the DDCompactView is \"MAGF\" but the top node is instead \""
148  << topNodeName << "\"";
149  }
150  }
151  // Loop over MAGF volumes and create volumeHandles.
152  if (debug) {
153  cout << endl
154  << "*** MAGF: " << fv.geoHistory() << endl
155  << "translation: " << fv.translation() << endl
156  << " rotation: " << fv.rotation() << endl;
157  }
158 
159  bool doSubDets = fv.firstChild();
160  while (doSubDets) {
161  string name = fv.logicalPart().name().name();
162  if (debug)
163  cout << endl << "Name: " << name << endl << " " << fv.geoHistory() << endl;
164 
165  // FIXME: single-volyme cylinders - this is feature has been removed
166  // and should be revisited.
167  // bool mergeCylinders=false;
168 
169  // If true, In the barrel, cylinders sectors will be skipped to build full
170  // cylinders out of sector copyno #1.
171  bool expand = false;
172 
173  // if (mergeCylinders) {
174  // if (name == "V_ZN_1"
175  // || name == "V_ZN_2") {
176  // if (debug && fv.logicalPart().solid().shape()!=ddtubs) {
177  // cout << "ERROR: MagGeoBuilderFromDDD::build: volume " << name
178  // << " should be a cylinder" << endl;
179  // }
180  // if(fv.copyno()==1) {
181  // expand = true;
182  // } else {
183  // //cout << "... to be skipped: "
184  // // << name << " " << fv.copyno() << endl;
185  // }
186  // }
187  // }
188 
189  volumeHandle* v = new volumeHandle(fv, expand, debug);
190 
191  if (theGridFiles != nullptr) {
192  int key = (v->volumeno) * 100 + v->copyno;
193  TableFileMap::const_iterator itable = theGridFiles->find(key);
194  if (itable == theGridFiles->end()) {
195  key = (v->volumeno) * 100;
196  itable = theGridFiles->find(key);
197  }
198 
199  if (itable != theGridFiles->end()) {
200  string magFile = (*itable).second.first;
201  stringstream conv;
202  string svol, ssec;
203  conv << setfill('0') << setw(3) << v->volumeno << " " << setw(2)
204  << v->copyno; // volume assumed to have 0s padding to 3 digits; sector assumed to have 0s padding to 2 digits
205  conv >> svol >> ssec;
206  boost::replace_all(magFile, "[v]", svol);
207  boost::replace_all(magFile, "[s]", ssec);
208  int masterSector = (*itable).second.second;
209  if (masterSector == 0)
210  masterSector = v->copyno;
211  v->magFile = magFile;
212  v->masterSector = masterSector;
213  } else {
214  edm::LogError("MagGeoBuilderFromDDDbuild")
215  << "ERROR: no table spec found for V " << v->volumeno << ":" << v->copyno;
216  }
217  }
218 
219  // Select volumes, build volume handles.
220  float Z = v->center().z();
221  float R = v->center().perp();
222 
223  // v 85l: Barrel is everything up to |Z| = 661.0, excluding
224  // volume #7, centered at 6477.5
225  // v 1103l: same numbers work fine. #16 instead of #7, same coords;
226  // see comment below for V6,7
227  //ASSUMPTION: no misalignment is applied to mag volumes.
228  //FIXME: implement barrel/endcap flags as DDD SpecPars.
229  if ((fabs(Z) < 647. || (R > 350. && fabs(Z) < 662.)) &&
230  !(fabs(Z) > 480 && R < 172) // in 1103l we place V_6 and V_7 in the
231  // endcaps to preserve nice layer structure
232  // in the barrel. This does not hurt in v85l
233  // where there is a single V1
234  ) { // Barrel
235  if (debug)
236  cout << " (Barrel)" << endl;
237  bVolumes.push_back(v);
238 
239  // Build the interpolator of the "master" volume (the one which is
240  // not replicated in phi)
241  // ASSUMPTION: copyno == sector.
242  if (v->copyno == v->masterSector) {
243  buildInterpolator(v, bInterpolators);
244  ++bVolCount;
245  }
246  } else { // Endcaps
247  if (debug)
248  cout << " (Endcaps)" << endl;
249  eVolumes.push_back(v);
250  if (v->copyno == v->masterSector) {
251  buildInterpolator(v, eInterpolators);
252  ++eVolCount;
253  }
254  }
255 
256  doSubDets = fv.nextSibling(); // end of loop over MAGF
257  }
258 
259  if (debug) {
260  cout << "Number of volumes (barrel): " << bVolumes.size() << endl
261  << "Number of volumes (endcap): " << eVolumes.size() << endl;
262  cout << "**********************************************************" << endl;
263  }
264 
265  // Now all volumeHandles are there, and parameters for each of the planes
266  // are calculated.
267 
268  //----------------------------------------------------------------------
269  // Print summary information
270 
271  if (debug) {
272  cout << "-----------------------" << endl;
273  cout << "SUMMARY: Barrel " << endl;
274  summary(bVolumes);
275 
276  cout << endl << "SUMMARY: Endcaps " << endl;
277  summary(eVolumes);
278  cout << "-----------------------" << endl;
279  }
280 
281  //----------------------------------------------------------------------
282  // Find barrel layers.
283 
284  vector<bLayer> layers; // the barrel layers
286 
287  // Find the layers (in R)
288  const float resolution = 1.; // cm
289  float rmin = bVolumes.front()->RN() - resolution;
290  float rmax = bVolumes.back()->RN() + resolution;
291  ClusterizingHistogram hisR(int((rmax - rmin) / resolution) + 1, rmin, rmax);
292 
293  if (debug)
294  cout << " R layers: " << rmin << " " << rmax << endl;
295 
296  handles::const_iterator first = bVolumes.begin();
297  handles::const_iterator last = bVolumes.end();
298 
299  for (handles::const_iterator i = first; i != last; ++i) {
300  hisR.fill((*i)->RN());
301  }
302  vector<float> rClust = hisR.clusterize(resolution);
303 
304  handles::const_iterator ringStart = first;
305  handles::const_iterator separ = first;
306 
307  for (unsigned int i = 0; i < rClust.size() - 1; ++i) {
308  if (debug)
309  cout << " Layer at RN = " << rClust[i];
310  float rSepar = (rClust[i] + rClust[i + 1]) / 2.f;
311  while ((*separ)->RN() < rSepar)
312  ++separ;
313 
314  bLayer thislayer(ringStart, separ, debug);
315  layers.push_back(thislayer);
316  ringStart = separ;
317  }
318  {
319  if (debug)
320  cout << " Layer at RN = " << rClust.back();
321  bLayer thislayer(separ, last, debug);
322  layers.push_back(thislayer);
323  }
324 
325  if (debug)
326  cout << "Barrel: Found " << rClust.size() << " clusters in R, " << layers.size() << " layers " << endl << endl;
327 
328  //----------------------------------------------------------------------
329  // Find endcap sectors
330  vector<eSector> sectors; // the endcap sectors
331 
332  // Find the number of sectors (should be 12 or 24 depending on the geometry model)
333  float phireso = 0.05; // rad
334  ClusterizingHistogram hisPhi(int((Geom::ftwoPi()) / phireso) + 1, -Geom::fpi(), Geom::fpi());
335 
336  for (handles::const_iterator i = eVolumes.begin(); i != eVolumes.end(); ++i) {
337  hisPhi.fill((*i)->minPhi());
338  }
339  vector<float> phiClust = hisPhi.clusterize(phireso);
340  int nESectors = phiClust.size();
341  if (debug && (nESectors % 12) != 0)
342  cout << "ERROR: unexpected # of sectors: " << nESectors << endl;
343 
344  //Sort in phi
346 
347  // Handle the -pi/pi boundary: volumes crossing it could be half at the begin and half at end of the sorted list.
348  // So, check if any of the volumes that should belong to the first bin (at -phi) are at the end of the list:
349  float lastBinPhi = phiClust.back();
350  handles::reverse_iterator ri = eVolumes.rbegin();
351  while ((*ri)->center().phi() > lastBinPhi) {
352  ++ri;
353  }
354  if (ri != eVolumes.rbegin()) {
355  // ri points to the first element that is within the last bin.
356  // We need to move the following element (ie ri.base()) to the beginning of the list,
357  handles::iterator newbeg = ri.base();
358  rotate(eVolumes.begin(), newbeg, eVolumes.end());
359  }
360 
361  //Group volumes in sectors
362  int offset = eVolumes.size() / nESectors;
363  for (int i = 0; i < nESectors; ++i) {
364  if (debug) {
365  cout << " Sector at phi = " << (*(eVolumes.begin() + ((i)*offset)))->center().phi() << endl;
366  // Additional x-check: sectors are expected to be made by volumes with the same copyno
367  int secCopyNo = -1;
368  for (handles::const_iterator iv = eVolumes.begin() + ((i)*offset); iv != eVolumes.begin() + ((i + 1) * offset);
369  ++iv) {
370  if (secCopyNo >= 0 && (*iv)->copyno != secCopyNo)
371  cout << "ERROR: volume copyno" << (*iv)->name << ":" << (*iv)->copyno
372  << " differs from others in same sectors " << secCopyNo << endl;
373  secCopyNo = (*iv)->copyno;
374  }
375  }
376 
377  sectors.push_back(eSector(eVolumes.begin() + ((i)*offset), eVolumes.begin() + ((i + 1) * offset), debug));
378  }
379 
380  if (debug)
381  cout << "Endcap: Found " << sectors.size() << " sectors " << endl;
382 
383  //----------------------------------------------------------------------
384  // Match surfaces.
385 
386  // cout << "------------------" << endl << "Now associating planes..." << endl;
387 
388  // // Loop on layers
389  // for (vector<bLayer>::const_iterator ilay = layers.begin();
390  // ilay!= layers.end(); ++ilay) {
391  // cout << "On Layer: " << ilay-layers.begin() << " RN: " << (*ilay).RN()
392  // <<endl;
393 
394  // // Loop on wheels
395  // for (vector<bWheel>::const_iterator iwheel = (*ilay).wheels.begin();
396  // iwheel != (*ilay).wheels.end(); ++iwheel) {
397  // cout << " On Wheel: " << iwheel- (*ilay).wheels.begin()<< " Z: "
398  // << (*iwheel).minZ() << " " << (*iwheel).maxZ() << " "
399  // << ((*iwheel).minZ()+(*iwheel).maxZ())/2. <<endl;
400 
401  // // Loop on sectors.
402  // for (int isector = 0; isector<12; ++isector) {
403  // // FIXME: create new constructor...
404  // bSectorNavigator navy(layers,
405  // ilay-layers.begin(),
406  // iwheel-(*ilay).wheels.begin(),isector);
407 
408  // const bSector & isect = (*iwheel).sector(isector);
409 
410  // isect.matchPlanes(navy); //FIXME refcount
411  // }
412  // }
413  // }
414 
415  //----------------------------------------------------------------------
416  // Build MagVolumes and the MagGeometry hierarchy.
417 
418  //--- Barrel
419 
420  // Build MagVolumes and associate interpolators to them
421  buildMagVolumes(bVolumes, bInterpolators);
422 
423  // Build MagBLayers
424  for (vector<bLayer>::const_iterator ilay = layers.begin(); ilay != layers.end(); ++ilay) {
425  mBLayers.push_back((*ilay).buildMagBLayer());
426  }
427 
428  if (debug) {
429  cout << "*** BARREL ********************************************" << endl
430  << "Number of different volumes = " << bVolCount << endl
431  << "Number of interpolators built = " << bInterpolators.size() << endl
432  << "Number of MagBLayers built = " << mBLayers.size() << endl;
433 
434  testInside(bVolumes); // FIXME: all volumes should be checked in one go.
435  }
436 
437  //--- Endcap
438  // Build MagVolumes and associate interpolators to them
439  buildMagVolumes(eVolumes, eInterpolators);
440 
441  // Build the MagESectors
442  for (vector<eSector>::const_iterator isec = sectors.begin(); isec != sectors.end(); ++isec) {
443  mESectors.push_back((*isec).buildMagESector());
444  }
445 
446  if (debug) {
447  cout << "*** ENDCAP ********************************************" << endl
448  << "Number of different volumes = " << eVolCount << endl
449  << "Number of interpolators built = " << eInterpolators.size() << endl
450  << "Number of MagESector built = " << mESectors.size() << endl;
451 
452  testInside(eVolumes); // FIXME: all volumes should be checked in one go.
453  }
454 }
455 
456 void MagGeoBuilderFromDDD::buildMagVolumes(const handles& volumes, map<string, MagProviderInterpol*>& interpolators) {
457  // Build all MagVolumes setting the MagProviderInterpol
458  for (handles::const_iterator vol = volumes.begin(); vol != volumes.end(); ++vol) {
459  const MagProviderInterpol* mp = nullptr;
460  if (interpolators.find((*vol)->magFile) != interpolators.end()) {
461  mp = interpolators[(*vol)->magFile];
462  } else {
463  edm::LogError("MagGeoBuilder") << "No interpolator found for file " << (*vol)->magFile
464  << " vol: " << (*vol)->volumeno << "\n"
465  << interpolators.size() << endl;
466  }
467 
468  // Search for [volume,sector] in the list of scaling factors; sector = 0 handled as wildcard
469  // ASSUMPTION: copyno == sector.
470  int key = ((*vol)->volumeno) * 100 + (*vol)->copyno;
471  map<int, double>::const_iterator isf = theScalingFactors.find(key);
472  if (isf == theScalingFactors.end()) {
473  key = ((*vol)->volumeno) * 100;
474  isf = theScalingFactors.find(key);
475  }
476 
477  double sf = 1.;
478  if (isf != theScalingFactors.end()) {
479  sf = (*isf).second;
480 
481  edm::LogInfo("MagGeoBuilder") << "Applying scaling factor " << sf << " to " << (*vol)->volumeno << "["
482  << (*vol)->copyno << "] (key:" << key << ")" << endl;
483  }
484 
485  const GloballyPositioned<float>* gpos = (*vol)->placement();
486  (*vol)->magVolume = new MagVolume6Faces(gpos->position(), gpos->rotation(), (*vol)->sides(), mp, sf);
487 
488  if ((*vol)->copyno == (*vol)->masterSector) {
489  (*vol)->magVolume->ownsFieldProvider(true);
490  }
491 
492  (*vol)->magVolume->setIsIron((*vol)->isIron());
493 
494  // The name and sector of the volume are saved for debug purposes only. They may be removed at some point...
495  (*vol)->magVolume->volumeNo = (*vol)->volumeno;
496  (*vol)->magVolume->copyno = (*vol)->copyno;
497  }
498 }
499 
501  map<string, MagProviderInterpol*>& interpolators) {
502  // Phi of the master sector
503  double masterSectorPhi = (vol->masterSector - 1) * Geom::pi() / 6.;
504 
505  if (debug) {
506  cout << "Building interpolator from " << vol->volumeno << " copyno " << vol->copyno << " at " << vol->center()
507  << " phi: " << vol->center().phi() << " file: " << vol->magFile << " master : " << vol->masterSector << endl;
508 
509  if (fabs(vol->center().phi() - masterSectorPhi) > Geom::pi() / 9.) {
510  cout << "***WARNING wrong sector? " << endl;
511  }
512  }
513 
514  if (tableSet == "fake" || vol->magFile == "fake") {
515  interpolators[vol->magFile] = new magneticfield::FakeInterpolator();
516  return;
517  }
518 
519  string fullPath;
520 
521  try {
522  edm::FileInPath mydata("MagneticField/Interpolation/data/" + tableSet + "/" + vol->magFile);
523  fullPath = mydata.fullPath();
524  } catch (edm::Exception& exc) {
525  cerr << "MagGeoBuilderFromDDD: exception in reading table; " << exc.what() << endl;
526  if (!debug)
527  throw;
528  return;
529  }
530 
531  try {
532  if (vol->toExpand()) {
533  //FIXME: see discussion on mergeCylinders above.
534  // interpolators[vol->magFile] =
535  // MFGridFactory::build( fullPath, *(vol->placement()), vol->minPhi(), vol->maxPhi());
536  } else {
537  // If the table is in "local" coordinates, must create a reference
538  // frame that is appropriately rotated along the CMS Z axis.
539 
541 
542  if (vol->masterSector != 1) {
544 
545  GloballyPositioned<float>::RotationType rot(Vector(0, 0, 1), -masterSectorPhi);
546  Vector vpos(vol->placement()->position());
547 
549  vol->placement()->rotation() * rot);
550  }
551 
552  interpolators[vol->magFile] = MFGridFactory::build(fullPath, rf);
553  }
554  } catch (MagException& exc) {
555  cout << exc.what() << endl;
556  interpolators.erase(vol->magFile);
557  if (!debug)
558  throw;
559  return;
560  }
561 
562  if (debug) {
563  // Check that all grid points of the interpolator are inside the volume.
564  const MagVolume6Faces tempVolume(
565  vol->placement()->position(), vol->placement()->rotation(), vol->sides(), interpolators[vol->magFile]);
566 
567  const MFGrid* grid = dynamic_cast<const MFGrid*>(interpolators[vol->magFile]);
568  if (grid != nullptr) {
569  Dimensions sizes = grid->dimensions();
570  cout << "Grid has 3 dimensions "
571  << " number of nodes is " << sizes.w << " " << sizes.h << " " << sizes.d << endl;
572 
573  const double tolerance = 0.03;
574 
575  size_t dumpCount = 0;
576  for (int j = 0; j < sizes.h; j++) {
577  for (int k = 0; k < sizes.d; k++) {
578  for (int i = 0; i < sizes.w; i++) {
579  MFGrid::LocalPoint lp = grid->nodePosition(i, j, k);
580  if (!tempVolume.inside(lp, tolerance)) {
581  if (++dumpCount < 2) {
582  MFGrid::GlobalPoint gp = tempVolume.toGlobal(lp);
583  cout << "GRID ERROR: " << i << " " << j << " " << k << " local: " << lp << " global: " << gp
584  << " R= " << gp.perp() << " phi=" << gp.phi() << endl;
585  }
586  }
587  }
588  }
589  }
590 
591  cout << "Volume:" << vol->volumeno << " : Number of grid points outside the MagVolume: " << dumpCount << "/"
592  << sizes.w * sizes.h * sizes.d << endl;
593  }
594  }
595 }
596 
598  // test inside() for all volumes.
599  cout << "--------------------------------------------------" << endl;
600  cout << " inside(center) test" << endl;
601  for (handles::const_iterator vol = volumes.begin(); vol != volumes.end(); ++vol) {
602  for (handles::const_iterator i = volumes.begin(); i != volumes.end(); ++i) {
603  if ((*i) == (*vol))
604  continue;
605  //if ((*i)->magVolume == 0) continue;
606  if ((*i)->magVolume->inside((*vol)->center())) {
607  cout << "*** ERROR: center of V " << (*vol)->volumeno << ":" << (*vol)->copyno << " is inside V "
608  << (*i)->volumeno << ":" << (*i)->copyno << endl;
609  }
610  }
611 
612  if ((*vol)->magVolume->inside((*vol)->center())) {
613  cout << "V " << (*vol)->volumeno << " OK " << endl;
614  } else {
615  cout << "*** ERROR: center of volume is not inside it, " << (*vol)->volumeno << endl;
616  }
617  }
618  cout << "--------------------------------------------------" << endl;
619 }
620 
621 vector<MagBLayer*> MagGeoBuilderFromDDD::barrelLayers() const { return mBLayers; }
622 
623 vector<MagESector*> MagGeoBuilderFromDDD::endcapSectors() const { return mESectors; }
624 
625 vector<MagVolume6Faces*> MagGeoBuilderFromDDD::barrelVolumes() const {
626  vector<MagVolume6Faces*> v;
627  v.reserve(bVolumes.size());
628  for (handles::const_iterator i = bVolumes.begin(); i != bVolumes.end(); ++i) {
629  v.push_back((*i)->magVolume);
630  }
631  return v;
632 }
633 
634 vector<MagVolume6Faces*> MagGeoBuilderFromDDD::endcapVolumes() const {
635  vector<MagVolume6Faces*> v;
636  v.reserve(eVolumes.size());
637  for (handles::const_iterator i = eVolumes.begin(); i != eVolumes.end(); ++i) {
638  v.push_back((*i)->magVolume);
639  }
640  return v;
641 }
642 
644  //FIXME: should get it from the actual geometry
645  return 900.;
646 }
647 
649  //FIXME: should get it from the actual geometry
650  if (geometryVersion >= 160812)
651  return 2400.;
652  else if (geometryVersion >= 120812)
653  return 2000.;
654  else
655  return 1600.;
656 }
657 
658 void MagGeoBuilderFromDDD::setScaling(const std::vector<int>& keys, const std::vector<double>& values) {
659  if (keys.size() != values.size()) {
660  throw cms::Exception("InvalidParameter")
661  << "Invalid field scaling parameters 'scalingVolumes' and 'scalingFactors' ";
662  }
663  for (unsigned int i = 0; i < keys.size(); ++i) {
665  }
666 }
667 
void summary(magneticfield::handles &volumes)
std::vector< MagVolume6Faces * > barrelVolumes() const
std::vector< MagBLayer * > mBLayers
std::vector< MagESector * > endcapSectors() const
Get endcap layers.
MagGeoBuilderFromDDD::volumeHandle volumeHandle
const DDTranslation & translation() const
The absolute translation of the current node.
int32_t *__restrict__ iv
constexpr float ftwoPi()
Definition: Pi.h:36
std::string fullPath() const
Definition: FileInPath.cc:161
std::vector< MagBLayer * > barrelLayers() const
Get barrel layers.
ROOT::Math::Plane3D::Vector Vector
Definition: EcalHitMaker.cc:29
constexpr float fpi()
Definition: Pi.h:35
const DDLogicalPart & logicalPart() const
The logical-part of the current node in the expanded-view.
magneticfield::handles eVolumes
const double tolerance
Geom::Phi< T > phi() const
Definition: PV3DBase.h:66
std::vector< VolumeSide > sides() const override
The surfaces and they orientation, as required to build a MagVolume.
GloballyPositioned< float >::LocalPoint LocalPoint
Definition: MFGrid.h:31
Log< level::Error, false > LogError
const GlobalPoint & center() const
Return the center of the volume.
Compact representation of the geometrical detector hierarchy.
Definition: DDCompactView.h:81
unsigned short volumeno
volume number
int w
Definition: MFGrid.h:16
unsigned short copyno
copy number
U second(std::pair< T, U > const &p)
virtual ~MagGeoBuilderFromDDD()
Destructor.
virtual void build(const DDCompactView &cpv)
const std::string & name() const
Returns the name.
Definition: DDName.cc:41
std::vector< float > clusterize(float resolution)
void buildMagVolumes(const magneticfield::handles &volumes, std::map< std::string, MagProviderInterpol *> &interpolators)
magneticfield::handles bVolumes
std::vector< BaseVolumeHandle * > handles
const char * what() const override
Definition: MagExceptions.cc:5
int masterSector
The sector for which an interpolator for this class of volumes should be built.
double f[11][100]
static MFGrid * build(const std::string &name, const GloballyPositioned< float > &vol)
Build interpolator for a binary grid file.
Point3DBase< T, GlobalTag > PositionType
MagGeoBuilderFromDDD(std::string tableSet_, int geometryVersion, bool debug=false)
Constructor.
const N & name() const
Definition: DDBase.h:59
Log< level::Info, false > LogInfo
const magneticfield::TableFileMap * theGridFiles
#define debug
Definition: HDRShower.cc:19
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
void buildInterpolator(const volumeHandle *vol, std::map< std::string, MagProviderInterpol *> &interpolators)
const PositionType & position() const
std::vector< MagVolume6Faces * > endcapVolumes() const
bool firstChild()
set the current node to the first child ...
GloballyPositioned< float >::GlobalPoint GlobalPoint
Definition: MFGrid.h:29
bool nextSibling()
set the current node to the next sibling ...
Definition: MFGrid.h:27
void setScaling(const std::vector< int > &keys, const std::vector< double > &values)
int d
Definition: MFGrid.h:18
int h
Definition: MFGrid.h:17
const DDRotationMatrix & rotation() const
The absolute rotation of the current node.
EPOS::IO_EPOS conv
void testInside(magneticfield::handles &volumes)
const RotationType & rotation() const
constexpr double pi()
Definition: Pi.h:31
char const * what() const noexcept override
Definition: Exception.cc:107
std::vector< MagESector * > mESectors
std::map< int, std::pair< std::string, int > > TableFileMap
Provides an exploded view of the detector (tree-view)
std::map< int, double > theScalingFactors
const GloballyPositioned< float > * placement() const
Position and rotation.
def rotate(angle, cx=0, cy=0)
Definition: svgfig.py:705
std::string magFile
Name of magnetic field table file.
void ownsFieldProvider(bool o)
Definition: MagVolume.h:47
void setGridFiles(const magneticfield::TableFileMap &gridFiles)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.