CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes
MagGeoBuilderFromDDD::bRod Class Reference

#include <bRod.h>

Public Member Functions

 bRod (handles::const_iterator begin, handles::const_iterator end)
 Constructor from list of volumes. More...
 
MagBRodbuildMagBRod () const
 Construct the MagBRod upon request. More...
 
const float RN () const
 Distance from center along sector normal. More...
 
 ~bRod ()
 Destructor. More...
 

Private Attributes

MagBRodmrod
 
std::vector< bSlabslabs
 
handles volumes
 

Detailed Description

A rod of volumes in a barrel sector. A rod is made of several "slabs".

Date:
2005/09/06 15:48:28
Revision:
1.1
Author
N. Amapane - INFN Torino

Definition at line 19 of file bRod.h.

Constructor & Destructor Documentation

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(), gather_cfg::cout, MagGeoBuilderFromDDD::debug, f, ClusterizingHistogram::fill(), first, i, prof2calltree::last, precomputed_value_sort(), MagGeoBuilderFromDDD::volumeHandle::printUniqueNames(), slabs, and volumes.

23  :
24  volumes(begin,end),
25  mrod(0)
26 {
27  precomputed_value_sort(volumes.begin(), volumes.end(), ExtractZ());
28 
29  // Clusterize in Z
30  const float resolution = 5.; // cm
31  float zmin = volumes.front()->center().z()-resolution;
32  float zmax = volumes.back()->center().z()+resolution;
33  ClusterizingHistogram hisZ( int((zmax-zmin)/resolution) + 1, zmin, zmax);
34 
35  if (MagGeoBuilderFromDDD::debug) std::cout << " Z slabs: " << zmin << " " << zmax << std::endl;
36 
37  handles::const_iterator first = volumes.begin();
38  handles::const_iterator last = volumes.end();
39 
40  for (handles::const_iterator i=first; i!=last; ++i){
41  hisZ.fill((*i)->center().z());
42  }
43  std::vector<float> zClust = hisZ.clusterize(resolution);
44 
45  if (MagGeoBuilderFromDDD::debug) std::cout << " Found " << zClust.size() << " clusters in Z, "
46  << " slabs: " << std::endl;
47 
48  handles::const_iterator slabStart = first;
49  handles::const_iterator separ = first;
50 
51  for (unsigned int i=0; i<zClust.size() - 1; ++i) {
52  float zSepar = (zClust[i] + zClust[i+1])/2.f;
53  while ((*separ)->center().z() < zSepar) ++separ;
55  std::cout << " Slab at: " << zClust[i]
56  << " elements: " << separ-slabStart << " unique volumes: ";
57  volumeHandle::printUniqueNames(slabStart, separ);
58  }
59 
60  slabs.push_back(bSlab(slabStart, separ));
61  slabStart = separ;
62  }
63  {
65  std::cout << " Slab at: " << zClust.back() <<" elements: " << last-separ
66  << " unique volumes: ";
68  }
69  slabs.push_back(bSlab(separ, last));
70  }
71 
72  // Check that all slabs have the same dphi.
73  std::vector<bSlab>::const_iterator i = slabs.begin();
74  Geom::Phi<float> phimax = (*i).maxPhi();
75  Geom::Phi<float> phimin = (*i).minPhi();
76  for (++i; i!= slabs.end(); ++i) {
77  if(fabs(phimax - (*i).maxPhi()) > 0.001 ||
78  fabs(phimin - (*i).minPhi()) > 0.001){
79  if (MagGeoBuilderFromDDD::debug) std::cout << "*** WARNING: slabs in this rod have different dphi!" <<std::endl;
80  }
81  }
82 }
int i
Definition: DBlmapReader.cc:9
static void printUniqueNames(handles::const_iterator begin, handles::const_iterator end)
Just for debugging...
std::vector< bSlab > slabs
Definition: bRod.h:36
double f[11][100]
#define end
Definition: vmac.h:38
bool first
Definition: L1TdeRCT.cc:79
#define begin
Definition: vmac.h:31
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
tuple cout
Definition: gather_cfg.py:41
MagGeoBuilderFromDDD::bRod::~bRod ( )

Destructor.

Definition at line 19 of file bRod.cc.

19 {}

Member Function Documentation

MagBRod * MagGeoBuilderFromDDD::bRod::buildMagBRod ( ) const

Construct the MagBRod upon request.

Definition at line 86 of file bRod.cc.

86  {
87  if (mrod==0) {
88  std::vector<MagBSlab*> mSlabs;
89  for (std::vector<bSlab>::const_iterator slab = slabs.begin();
90  slab!=slabs.end(); ++slab) {
91  mSlabs.push_back((*slab).buildMagBSlab());
92  }
93  mrod = new MagBRod(mSlabs,slabs.front().minPhi()); //FIXME
94  }
95  return mrod;
96 }
std::vector< bSlab > slabs
Definition: bRod.h:36
const float MagGeoBuilderFromDDD::bRod::RN ( ) const
inline

Distance from center along sector normal.

Definition at line 28 of file bRod.h.

References volumes.

28  {
29  return volumes.front()->RN();
30  }

Member Data Documentation

MagBRod* MagGeoBuilderFromDDD::bRod::mrod
mutableprivate

Definition at line 38 of file bRod.h.

std::vector<bSlab> MagGeoBuilderFromDDD::bRod::slabs
private

Definition at line 36 of file bRod.h.

Referenced by bRod().

handles MagGeoBuilderFromDDD::bRod::volumes
private

Definition at line 37 of file bRod.h.

Referenced by bRod(), and RN().