CMS 3D CMS Logo

List of all members | Public Member Functions | Private Attributes
magneticfield::eSector Class Reference

#include <eSector.h>

Public Member Functions

MagESectorbuildMagESector () const
 Construct the MagESector upon request. More...
 
 eSector (handles::const_iterator begin, handles::const_iterator end, bool debugFlag=false)
 Constructor from list of volumes. More...
 
 ~eSector ()=default
 Destructor. More...
 

Private Attributes

const bool debug
 
std::vector< eLayerlayers
 
MagESectormsector
 
handles theVolumes
 

Detailed Description

Definition at line 16 of file eSector.h.

Constructor & Destructor Documentation

eSector::eSector ( handles::const_iterator  begin,
handles::const_iterator  end,
bool  debugFlag = false 
)

Constructor from list of volumes.

Definition at line 22 of file eSector.cc.

References ClusterizingHistogram::clusterize(), gather_cfg::cout, debug, f, ClusterizingHistogram::fill(), dqmdumpme::first, mps_fire::i, dqmdumpme::last, layers, precomputed_value_sort(), magneticfield::printUniqueNames(), L1TObjectsTimingClient_cff::resolution, theVolumes, SiStripMonitorCluster_cfi::zmax, and SiStripMonitorCluster_cfi::zmin.

23  : theVolumes(begin, end), msector(nullptr), debug(debugFlag) {
24  //FIXME!!!
25  //precomputed_value_sort(theVolumes.begin(), theVolumes.end(), ExtractAbsZ());
27 
28  // Clusterize in Z
29  const float resolution = 1.; // cm //FIXME ??
30  float zmin = theVolumes.front()->center().z() - resolution;
31  float zmax = theVolumes.back()->center().z() + resolution;
32  ClusterizingHistogram hisZ(int((zmax - zmin) / resolution) + 1, zmin, zmax);
33 
34  if (debug)
35  cout << " Z layers: " << zmin << " " << zmax << endl;
36 
37  handles::const_iterator first = theVolumes.begin();
38  handles::const_iterator last = theVolumes.end();
39 
40  for (handles::const_iterator i = first; i != last; ++i) {
41  hisZ.fill((*i)->center().z());
42  }
43  vector<float> zClust = hisZ.clusterize(resolution);
44 
45  if (debug)
46  cout << " Found " << zClust.size() << " clusters in Z, "
47  << " layers: " << endl;
48 
49  handles::const_iterator layStart = first;
50  handles::const_iterator separ = first;
51 
52  for (unsigned int i = 0; i < zClust.size() - 1; ++i) {
53  float zSepar = (zClust[i] + zClust[i + 1]) / 2.f;
54  while ((*separ)->center().z() < zSepar)
55  ++separ;
56  if (debug) {
57  cout << " Layer at: " << zClust[i] << " elements: " << separ - layStart << " unique volumes: ";
58  printUniqueNames(layStart, separ);
59  }
60 
61  layers.push_back(eLayer(layStart, separ));
62  layStart = separ;
63  }
64  {
65  if (debug) {
66  cout << " Layer at: " << zClust.back() << " elements: " << last - separ << " unique volumes: ";
67  printUniqueNames(separ, last);
68  }
69  layers.push_back(eLayer(separ, last));
70  }
71 
72  // FIXME: Check that all layers have the same dz?.
73 }
void printUniqueNames(handles::const_iterator begin, handles::const_iterator end, bool uniq=true)
Just for debugging...
double f[11][100]
#define end
Definition: vmac.h:39
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
#define begin
Definition: vmac.h:32
const bool debug
Definition: eSector.h:34
std::vector< eLayer > layers
Definition: eSector.h:31
MagESector * msector
Definition: eSector.h:33
magneticfield::eSector::~eSector ( )
default

Destructor.

Member Function Documentation

MagESector * eSector::buildMagESector ( ) const

Construct the MagESector upon request.

Definition at line 75 of file eSector.cc.

References layers, msector, and theVolumes.

75  {
76  if (msector == nullptr) {
77  vector<MagELayer*> mLayers;
78  for (vector<eLayer>::const_iterator lay = layers.begin(); lay != layers.end(); ++lay) {
79  mLayers.push_back((*lay).buildMagELayer());
80  }
81  msector = new MagESector(mLayers, theVolumes.front()->minPhi()); //FIXME
82  }
83  return msector;
84 }
std::vector< eLayer > layers
Definition: eSector.h:31
MagESector * msector
Definition: eSector.h:33

Member Data Documentation

const bool magneticfield::eSector::debug
private
std::vector<eLayer> magneticfield::eSector::layers
private

Definition at line 31 of file eSector.h.

Referenced by buildMagESector(), and eSector().

MagESector* magneticfield::eSector::msector
mutableprivate

Definition at line 33 of file eSector.h.

Referenced by buildMagESector().

handles magneticfield::eSector::theVolumes
private

Definition at line 32 of file eSector.h.

Referenced by buildMagESector(), and eSector().