#include <MagneticField/GeomBuilder/src/bRod.h>
Public Member Functions | |
bRod (handles::const_iterator begin, handles::const_iterator end) | |
Constructor from list of volumes. | |
MagBRod * | buildMagBRod () const |
Construct the MagBRod upon request. | |
const float | RN () const |
Distance from center along sector normal. | |
~bRod () | |
Destructor. | |
Private Attributes | |
MagBRod * | mrod |
std::vector< bSlab > | slabs |
handles | volumes |
A rod is made of several "slabs".
Definition at line 19 of file bRod.h.
MagGeoBuilderFromDDD::bRod::bRod | ( | handles::const_iterator | begin, | |
handles::const_iterator | end | |||
) |
Constructor from list of volumes.
Definition at line 22 of file bRod.cc.
References ClusterizingHistogram::clusterize(), GenMuonPlsPt100GeV_cfg::cout, MagGeoBuilderFromDDD::debug, lat::endl(), f, ClusterizingHistogram::fill(), first, i, prof2calltree::last, precomputed_value_sort(), MagGeoBuilderFromDDD::volumeHandle::printUniqueNames(), slabs, and volumes.
00023 : 00024 volumes(begin,end), 00025 mrod(0) 00026 { 00027 precomputed_value_sort(volumes.begin(), volumes.end(), ExtractZ()); 00028 00029 // Clusterize in Z 00030 const float resolution = 5.; // cm 00031 float zmin = volumes.front()->center().z()-resolution; 00032 float zmax = volumes.back()->center().z()+resolution; 00033 ClusterizingHistogram hisZ( int((zmax-zmin)/resolution) + 1, zmin, zmax); 00034 00035 if (MagGeoBuilderFromDDD::debug) std::cout << " Z slabs: " << zmin << " " << zmax << std::endl; 00036 00037 handles::const_iterator first = volumes.begin(); 00038 handles::const_iterator last = volumes.end(); 00039 00040 for (handles::const_iterator i=first; i!=last; ++i){ 00041 hisZ.fill((*i)->center().z()); 00042 } 00043 std::vector<float> zClust = hisZ.clusterize(resolution); 00044 00045 if (MagGeoBuilderFromDDD::debug) std::cout << " Found " << zClust.size() << " clusters in Z, " 00046 << " slabs: " << std::endl; 00047 00048 handles::const_iterator slabStart = first; 00049 handles::const_iterator separ = first; 00050 00051 for (unsigned int i=0; i<zClust.size() - 1; ++i) { 00052 float zSepar = (zClust[i] + zClust[i+1])/2.f; 00053 while ((*separ)->center().z() < zSepar) ++separ; 00054 if (MagGeoBuilderFromDDD::debug) { 00055 std::cout << " Slab at: " << zClust[i] 00056 << " elements: " << separ-slabStart << " unique volumes: "; 00057 volumeHandle::printUniqueNames(slabStart, separ); 00058 } 00059 00060 slabs.push_back(bSlab(slabStart, separ)); 00061 slabStart = separ; 00062 } 00063 { 00064 if (MagGeoBuilderFromDDD::debug) { 00065 std::cout << " Slab at: " << zClust.back() <<" elements: " << last-separ 00066 << " unique volumes: "; 00067 volumeHandle::printUniqueNames(separ,last); 00068 } 00069 slabs.push_back(bSlab(separ, last)); 00070 } 00071 00072 // Check that all slabs have the same dphi. 00073 std::vector<bSlab>::const_iterator i = slabs.begin(); 00074 Geom::Phi<float> phimax = (*i).maxPhi(); 00075 Geom::Phi<float> phimin = (*i).minPhi(); 00076 for (++i; i!= slabs.end(); ++i) { 00077 if(fabs(phimax - (*i).maxPhi()) > 0.001 || 00078 fabs(phimin - (*i).minPhi()) > 0.001){ 00079 if (MagGeoBuilderFromDDD::debug) std::cout << "*** WARNING: slabs in this rod have different dphi!" <<std::endl; 00080 } 00081 } 00082 }
MagBRod * MagGeoBuilderFromDDD::bRod::buildMagBRod | ( | ) | const |
Construct the MagBRod upon request.
Definition at line 86 of file bRod.cc.
00086 { 00087 if (mrod==0) { 00088 std::vector<MagBSlab*> mSlabs; 00089 for (std::vector<bSlab>::const_iterator slab = slabs.begin(); 00090 slab!=slabs.end(); ++slab) { 00091 mSlabs.push_back((*slab).buildMagBSlab()); 00092 } 00093 mrod = new MagBRod(mSlabs,slabs.front().minPhi()); //FIXME 00094 } 00095 return mrod; 00096 }
const float MagGeoBuilderFromDDD::bRod::RN | ( | ) | const [inline] |
MagBRod* MagGeoBuilderFromDDD::bRod::mrod [mutable, private] |
std::vector<bSlab> MagGeoBuilderFromDDD::bRod::slabs [private] |
handles MagGeoBuilderFromDDD::bRod::volumes [private] |