CMS 3D CMS Logo

/data/doxygen/doxygen-1.7.3/gen/CMSSW_4_2_8/src/MagneticField/GeomBuilder/src/eLayer.cc

Go to the documentation of this file.
00001 // #include "Utilities/Configuration/interface/Architecture.h"
00002 
00003 /*
00004  *  See header file for a description of this class.
00005  *
00006  *  $Date: 2007/02/03 16:19:08 $
00007  *  $Revision: 1.3 $
00008  *  \author N. Amapane - INFN Torino
00009  */
00010 
00011 #include "MagneticField/GeomBuilder/src/eLayer.h"
00012 #include "MagneticField/VolumeGeometry/interface/MagVolume6Faces.h"
00013 #include "MagneticField/Layers/interface/MagELayer.h"
00014 
00015 #include "Utilities/General/interface/precomputed_value_sort.h"
00016 
00017 using namespace SurfaceOrientation;
00018 using namespace std;
00019 
00020 //The ctor is in charge of finding sectors inside the layer.
00021 MagGeoBuilderFromDDD::eLayer::eLayer(handles::const_iterator begin,
00022                                         handles::const_iterator end) :
00023   theVolumes(begin,end),
00024   mlayer(0) 
00025 {
00026   //  bool debug=MagGeoBuilderFromDDD::debug;
00027 
00028   // Sort in R  
00029   precomputed_value_sort(theVolumes.begin(), theVolumes.end(), ExtractR());
00030 
00031 //   if (debug) {
00032 //     cout << " elements: " << theVolumes.size() << " unique volumes: ";
00033 //     volumeHandle::printUniqueNames(theVolumes.begin(), theVolumes.end());
00034 //   }
00035 }
00036 
00037 MagGeoBuilderFromDDD::eLayer::~eLayer(){}
00038 
00039 // double MagGeoBuilderFromDDD::eLayer::minR() const {
00040 //   // ASSUMPTION: a layer is only 1 volume thick (by construction). 
00041 //   return theVolumes.front()->minR();
00042 // }
00043 
00044 // double MagGeoBuilderFromDDD::eLayer::maxR() const {
00045 //   // ASSUMPTION: a layer is only 1 volume thick (by construction). 
00046 //   return theVolumes.front()->maxR();
00047 // }
00048 
00049 MagELayer * MagGeoBuilderFromDDD::eLayer::buildMagELayer() const {
00050   if (mlayer==0) {
00051     //FIXME not guaranteed that all volumes in layer have the same zmin
00052     // and zmax!
00053     double zmin = 1e19;
00054     double zmax = -1e19;
00055     vector<MagVolume*> mVols;
00056     for (handles::const_iterator vol = theVolumes.begin();
00057          vol!=theVolumes.end(); ++vol) {
00058       mVols.push_back((*vol)->magVolume);
00059       zmin = min(zmin, (*vol)->minZ());
00060       zmax = max(zmax, (*vol)->maxZ());
00061     }
00062     mlayer = new MagELayer(mVols, zmin, zmax);
00063   }
00064   return mlayer;
00065 }
00066