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  * \author N. Amapane - INFN Torino
7  */
8 
13 
14 #include <algorithm>
16 
17 using namespace SurfaceOrientation;
18 using namespace std;
19 
20 // The ctor is in charge of finding layers inside the sector.
22  handles::const_iterator end) :
23  theVolumes(begin,end),
24  msector(0)
25 {
26  //FIXME!!!
27  //precomputed_value_sort(theVolumes.begin(), theVolumes.end(), ExtractAbsZ());
29 
30 
31  // Clusterize in Z
32  const float resolution = 1.; // cm //FIXME ??
33  float zmin = theVolumes.front()->center().z()-resolution;
34  float zmax = theVolumes.back()->center().z()+resolution;
35  ClusterizingHistogram hisZ( int((zmax-zmin)/resolution) + 1, zmin, zmax);
36 
37  if (MagGeoBuilderFromDDD::debug) cout << " Z layers: " << zmin << " " << zmax << endl;
38 
39  handles::const_iterator first = theVolumes.begin();
40  handles::const_iterator last = theVolumes.end();
41 
42  for (handles::const_iterator i=first; i!=last; ++i){
43  hisZ.fill((*i)->center().z());
44  }
45  vector<float> zClust = hisZ.clusterize(resolution);
46 
47  if (MagGeoBuilderFromDDD::debug) cout << " Found " << zClust.size() << " clusters in Z, "
48  << " layers: " << endl;
49 
50  handles::const_iterator layStart = first;
51  handles::const_iterator separ = first;
52 
53  for (unsigned int i=0; i<zClust.size() - 1; ++i) {
54  float zSepar = (zClust[i] + zClust[i+1])/2.f;
55  while ((*separ)->center().z() < zSepar) ++separ;
57  cout << " Layer at: " << zClust[i]
58  << " elements: " << separ-layStart << " unique volumes: ";
59  volumeHandle::printUniqueNames(layStart, separ);
60  }
61 
62  layers.push_back(eLayer(layStart, separ));
63  layStart = separ;
64  }
65  {
67  cout << " Layer at: " << zClust.back() <<" elements: " << last-separ
68  << " unique volumes: ";
70  }
71  layers.push_back(eLayer(separ, last));
72  }
73 
74  // FIXME: Check that all layers have the same dz?.
75 
76 }
77 
78 
80 
81 
83  if (msector==0) {
84  vector<MagELayer*> mLayers;
85  for (vector<eLayer>::const_iterator lay = layers.begin();
86  lay!=layers.end(); ++lay) {
87  mLayers.push_back((*lay).buildMagELayer());
88  }
89  msector = new MagESector(mLayers, theVolumes.front()->minPhi()); //FIXME
90  }
91  return msector;
92 }
std::vector< eLayer > layers
Definition: eSector.h:32
int i
Definition: DBlmapReader.cc:9
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
Definition: LayerTriplets.cc:4
MagESector * buildMagESector() const
Construct the MagESector upon request.
Definition: eSector.cc:82
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:21
double f[11][100]
#define end
Definition: vmac.h:37
bool first
Definition: L1TdeRCT.cc:79
#define begin
Definition: vmac.h:30
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
tuple cout
Definition: gather_cfg.py:121