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::eSector ( handles::const_iterator  begin,
handles::const_iterator  end,
bool  debugFlag = false 
)

Constructor from list of volumes.

Definition at line 21 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.

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

◆ ~eSector()

magneticfield::eSector::~eSector ( )
default

Destructor.

Member Function Documentation

◆ buildMagESector()

MagESector * eSector::buildMagESector ( ) const

Construct the MagESector upon request.

Definition at line 74 of file eSector.cc.

References layers, msector, and theVolumes.

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

Member Data Documentation

◆ debug

const bool magneticfield::eSector::debug
private

◆ layers

std::vector<eLayer> magneticfield::eSector::layers
private

Definition at line 31 of file eSector.h.

Referenced by buildMagESector(), and eSector().

◆ msector

MagESector* magneticfield::eSector::msector
mutableprivate

Definition at line 33 of file eSector.h.

Referenced by buildMagESector().

◆ theVolumes

handles magneticfield::eSector::theVolumes
private

Definition at line 32 of file eSector.h.

Referenced by buildMagESector(), and eSector().