CMS 3D CMS Logo

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

#include <bRod.h>

Public Member Functions

 bRod (handles::const_iterator begin, handles::const_iterator end, bool debugVal=false)
 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 ()=default
 Destructor. More...
 

Private Attributes

bool debug
 
MagBRodmrod
 
std::vector< bSlabslabs
 
handles volumes
 

Detailed Description

Definition at line 17 of file bRod.h.

Constructor & Destructor Documentation

◆ bRod()

bRod::bRod ( handles::const_iterator  begin,
handles::const_iterator  end,
bool  debugVal = false 
)

Constructor from list of volumes.

Definition at line 19 of file bRod.cc.

20  : volumes(begin, end), mrod(nullptr), debug(debugVal) {
22 
23  // Clusterize in Z
24  const float resolution = 5.; // cm
25  float zmin = volumes.front()->center().z() - resolution;
26  float zmax = volumes.back()->center().z() + resolution;
27  ClusterizingHistogram hisZ(int((zmax - zmin) / resolution) + 1, zmin, zmax);
28 
29  if (debug)
30  std::cout << " Z slabs: " << zmin << " " << zmax << std::endl;
31 
32  handles::const_iterator first = volumes.begin();
33  handles::const_iterator last = volumes.end();
34 
35  for (handles::const_iterator i = first; i != last; ++i) {
36  hisZ.fill((*i)->center().z());
37  }
38  std::vector<float> zClust = hisZ.clusterize(resolution);
39 
40  if (debug)
41  std::cout << " Found " << zClust.size() << " clusters in Z, "
42  << " slabs: " << std::endl;
43 
44  handles::const_iterator slabStart = first;
45  handles::const_iterator separ = first;
46 
47  for (unsigned int i = 0; i < zClust.size() - 1; ++i) {
48  float zSepar = (zClust[i] + zClust[i + 1]) / 2.f;
49  while ((*separ)->center().z() < zSepar)
50  ++separ;
51  if (debug) {
52  std::cout << " Slab at: " << zClust[i] << " elements: " << separ - slabStart << " unique volumes: ";
53  printUniqueNames(slabStart, separ);
54  }
55 
56  slabs.push_back(bSlab(slabStart, separ, debug));
57  slabStart = separ;
58  }
59  {
60  if (debug) {
61  std::cout << " Slab at: " << zClust.back() << " elements: " << last - separ << " unique volumes: ";
62  printUniqueNames(separ, last);
63  }
64  slabs.push_back(bSlab(separ, last, debug));
65  }
66 
67  // Check that all slabs have the same dphi.
68  std::vector<bSlab>::const_iterator i = slabs.begin();
69  Geom::Phi<float> phimax = (*i).maxPhi();
70  Geom::Phi<float> phimin = (*i).minPhi();
71  for (++i; i != slabs.end(); ++i) {
72  if (fabs(phimax - (*i).maxPhi()) > 0.001 || fabs(phimin - (*i).minPhi()) > 0.001) {
73  if (debug) {
74  std::cout << "*** WARNING: slabs in this rod have different dphi! minphi " << phimin;
75  std::cout << " != " << (*i).minPhi() << " or maxphi " << phimax << " != " << (*i).maxPhi() << std::endl;
76  }
77  }
78  }
79 }

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

◆ ~bRod()

magneticfield::bRod::~bRod ( )
default

Destructor.

Member Function Documentation

◆ buildMagBRod()

MagBRod * bRod::buildMagBRod ( ) const

Construct the MagBRod upon request.

Definition at line 81 of file bRod.cc.

81  {
82  if (mrod == nullptr) {
83  std::vector<MagBSlab*> mSlabs;
84  for (std::vector<bSlab>::const_iterator slab = slabs.begin(); slab != slabs.end(); ++slab) {
85  mSlabs.push_back((*slab).buildMagBSlab());
86  }
87  mrod = new MagBRod(mSlabs, slabs.front().minPhi()); //FIXME
88  }
89  return mrod;
90 }

References mrod, and slabs.

◆ RN()

const float magneticfield::bRod::RN ( ) const
inline

Distance from center along sector normal.

Definition at line 26 of file bRod.h.

26 { return volumes.front()->RN(); }

References volumes.

Member Data Documentation

◆ debug

bool magneticfield::bRod::debug
private

◆ mrod

MagBRod* magneticfield::bRod::mrod
mutableprivate

Definition at line 34 of file bRod.h.

Referenced by buildMagBRod().

◆ slabs

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

Definition at line 32 of file bRod.h.

Referenced by bRod(), and buildMagBRod().

◆ volumes

handles magneticfield::bRod::volumes
private

Definition at line 33 of file bRod.h.

Referenced by bRod(), and RN().

mps_fire.i
i
Definition: mps_fire.py:428
f
double f[11][100]
Definition: MuScleFitUtils.cc:78
phimin
float phimin
Definition: ReggeGribovPartonMCHadronizer.h:107
gather_cfg.cout
cout
Definition: gather_cfg.py:144
magneticfield::printUniqueNames
void printUniqueNames(handles::const_iterator begin, handles::const_iterator end, bool uniq=true)
Just for debugging...
Definition: printUniqueNames.cc:9
magneticfield::bRod::debug
bool debug
Definition: bRod.h:35
magneticfield::bRod::slabs
std::vector< bSlab > slabs
Definition: bRod.h:32
SiStripMonitorCluster_cfi.zmin
zmin
Definition: SiStripMonitorCluster_cfi.py:200
magneticfield::ExtractZ
Definition: BaseVolumeHandle.h:159
dqmdumpme.last
last
Definition: dqmdumpme.py:56
magneticfield::bSlab
Definition: bSlab.h:23
SiStripMonitorCluster_cfi.zmax
zmax
Definition: SiStripMonitorCluster_cfi.py:201
mps_fire.end
end
Definition: mps_fire.py:242
L1TObjectsTimingClient_cff.resolution
resolution
Definition: L1TObjectsTimingClient_cff.py:52
first
auto first
Definition: CAHitNtupletGeneratorKernelsImpl.h:125
Geom::Phi< float >
phimax
float phimax
Definition: ReggeGribovPartonMCHadronizer.h:106
magneticfield::bRod::volumes
handles volumes
Definition: bRod.h:33
MagBRod
Definition: MagBRod.h:25
precomputed_value_sort
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
Definition: precomputed_value_sort.h:17
magneticfield::bRod::mrod
MagBRod * mrod
Definition: bRod.h:34
ClusterizingHistogram
Definition: ClusterizingHistogram.h:13