CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
eSector.cc
Go to the documentation of this file.
1 // #include "Utilities/Configuration/interface/Architecture.h"
2 
3 /*
4  * See header file for a description of this class.
5  *
6  * $Date: 2007/02/03 16:19:08 $
7  * $Revision: 1.4 $
8  * \author N. Amapane - INFN Torino
9  */
10 
15 
16 #include <algorithm>
18 
19 using namespace SurfaceOrientation;
20 using namespace std;
21 
22 // The ctor is in charge of finding layers inside the sector.
24  handles::const_iterator end) :
25  theVolumes(begin,end),
26  msector(0)
27 {
28  //FIXME!!!
29  //precomputed_value_sort(theVolumes.begin(), theVolumes.end(), ExtractAbsZ());
31 
32 
33  // Clusterize in Z
34  const float resolution = 1.; // cm //FIXME ??
35  float zmin = theVolumes.front()->center().z()-resolution;
36  float zmax = theVolumes.back()->center().z()+resolution;
37  ClusterizingHistogram hisZ( int((zmax-zmin)/resolution) + 1, zmin, zmax);
38 
39  if (MagGeoBuilderFromDDD::debug) cout << " Z layers: " << zmin << " " << zmax << endl;
40 
41  handles::const_iterator first = theVolumes.begin();
42  handles::const_iterator last = theVolumes.end();
43 
44  for (handles::const_iterator i=first; i!=last; ++i){
45  hisZ.fill((*i)->center().z());
46  }
47  vector<float> zClust = hisZ.clusterize(resolution);
48 
49  if (MagGeoBuilderFromDDD::debug) cout << " Found " << zClust.size() << " clusters in Z, "
50  << " layers: " << endl;
51 
52  handles::const_iterator layStart = first;
53  handles::const_iterator separ = first;
54 
55  for (unsigned int i=0; i<zClust.size() - 1; ++i) {
56  float zSepar = (zClust[i] + zClust[i+1])/2.f;
57  while ((*separ)->center().z() < zSepar) ++separ;
59  cout << " Layer at: " << zClust[i]
60  << " elements: " << separ-layStart << " unique volumes: ";
61  volumeHandle::printUniqueNames(layStart, separ);
62  }
63 
64  layers.push_back(eLayer(layStart, separ));
65  layStart = separ;
66  }
67  {
69  cout << " Layer at: " << zClust.back() <<" elements: " << last-separ
70  << " unique volumes: ";
72  }
73  layers.push_back(eLayer(separ, last));
74  }
75 
76  // FIXME: Check that all layers have the same dz?.
77 
78 }
79 
80 
82 
83 
85  if (msector==0) {
86  vector<MagELayer*> mLayers;
87  for (vector<eLayer>::const_iterator lay = layers.begin();
88  lay!=layers.end(); ++lay) {
89  mLayers.push_back((*lay).buildMagELayer());
90  }
91  msector = new MagESector(mLayers, theVolumes.front()->minPhi()); //FIXME
92  }
93  return msector;
94 }
std::vector< eLayer > layers
Definition: eSector.h:34
int i
Definition: DBlmapReader.cc:9
MagESector * buildMagESector() const
Construct the MagESector upon request.
Definition: eSector.cc:84
static void printUniqueNames(handles::const_iterator begin, handles::const_iterator end)
Just for debugging...
std::vector< float > clusterize(float resolution)
eSector(handles::const_iterator begin, handles::const_iterator end)
Constructor from list of volumes.
Definition: eSector.cc:23
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