CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
List of all members | Private Member Functions | Static Private Member Functions
CmsTrackerPhase1DiskBuilder< FilteredView > Class Template Reference

#include <CmsTrackerPhase1DiskBuilder.h>

Inheritance diagram for CmsTrackerPhase1DiskBuilder< FilteredView >:
CmsTrackerLevelBuilder< FilteredView > CmsTrackerAbstractConstruction< FilteredView >

Private Member Functions

void buildComponent (FilteredView &, GeometricDet *, const std::string &) override
 
void PhiPosNegSplit_innerOuter (std::vector< GeometricDet const * >::iterator begin, std::vector< GeometricDet const * >::iterator end)
 
void sortNS (FilteredView &, GeometricDet *) override
 

Static Private Member Functions

static bool PhiSort (const GeometricDet *Panel1, const GeometricDet *Panel2)
 

Additional Inherited Members

- Public Member Functions inherited from CmsTrackerLevelBuilder< FilteredView >
void build (FilteredView &, GeometricDet *, const std::string &) override
 
template<>
void build (DDFilteredView &fv, GeometricDet *tracker, const std::string &attribute)
 
template<>
void build (cms::DDFilteredView &fv, GeometricDet *tracker, const std::string &attribute)
 
 ~CmsTrackerLevelBuilder () override
 
- Public Member Functions inherited from CmsTrackerAbstractConstruction< FilteredView >
virtual ~CmsTrackerAbstractConstruction ()=default
 
- Protected Attributes inherited from CmsTrackerLevelBuilder< FilteredView >
CmsTrackerStringToEnum theCmsTrackerStringToEnum
 

Detailed Description

template<class FilteredView>
class CmsTrackerPhase1DiskBuilder< FilteredView >

Class which contructs PixelForward/Disk.

Definition at line 12 of file CmsTrackerPhase1DiskBuilder.h.

Member Function Documentation

template<class FilteredView >
void CmsTrackerPhase1DiskBuilder< FilteredView >::buildComponent ( FilteredView &  fv,
GeometricDet g,
const std::string &  s 
)
overrideprivatevirtual

Implements CmsTrackerLevelBuilder< FilteredView >.

Definition at line 84 of file CmsTrackerPhase1DiskBuilder.cc.

References GeometricDet::addComponent(), CmsTrackerLevelBuilder< FilteredView >::build(), ExtractStringFromDDD< FilteredView >::getString(), and GeometricDet::panel.

86  {
87  CmsTrackerPanelBuilder<FilteredView> theCmsTrackerPanelBuilder;
88  GeometricDet* subdet = new GeometricDet(&fv,
91 
95  theCmsTrackerPanelBuilder.build(fv, subdet, s);
96  break;
97  default:
98  edm::LogError("CmsTrackerPhase1DiskBuilder")
99  << " ERROR - I was expecting a Panel, I got a " << ExtractStringFromDDD<FilteredView>::getString(s, &fv);
100  }
101  g->addComponent(subdet);
102 }
static std::string getString(const std::string &, FilteredView *)
void addComponent(GeometricDet *)
Log< level::Error, false > LogError
void build(FilteredView &, GeometricDet *, const std::string &) override
template<class FilteredView >
void CmsTrackerPhase1DiskBuilder< FilteredView >::PhiPosNegSplit_innerOuter ( std::vector< GeometricDet const * >::iterator  begin,
std::vector< GeometricDet const * >::iterator  end 
)
private

Definition at line 20 of file CmsTrackerPhase1DiskBuilder.cc.

References SplitLinear::begin, filterCSVwithJSON::copy, dataset::end, SiStripPI::max, SiStripPI::min, and svgfig::rotate().

21  {
22  // first sort in phi, lowest first (-pi to +pi)
23  std::sort(begin, end, PhiSort);
24 
25  // now put positive phi (in order) ahead of negative phi as in std geometry
26  std::vector<const GeometricDet*> theCompsPosNeg;
27  // also find the average radius (used to split inner and outer disk panels)
28  double theRmin = (**begin).rho();
29  double theRmax = theRmin;
30  for (vector<const GeometricDet*>::const_iterator it = begin; it != end; it++) {
31  if ((**it).phi() >= 0)
32  theCompsPosNeg.emplace_back(*it);
33  theRmin = std::min(theRmin, (**it).rho());
34  theRmax = std::max(theRmax, (**it).rho());
35  }
36  for (vector<const GeometricDet*>::const_iterator it = begin; it != end; it++) {
37  if ((**it).phi() < 0)
38  theCompsPosNeg.emplace_back(*it);
39  }
40 
41  // now put inner disk panels first
42  // double radius_split = 0.5 * (theRmin + theRmax);
43  // force the split radius to be 100 mm to be able to deal with disks with only outer ring
44  double radius_split = 100.;
45  std::vector<const GeometricDet*> theCompsInnerOuter;
46  unsigned int num_inner = 0;
47  for (vector<const GeometricDet*>::const_iterator it = theCompsPosNeg.begin(); it != theCompsPosNeg.end(); it++) {
48  if ((**it).rho() <= radius_split) {
49  theCompsInnerOuter.emplace_back(*it);
50  num_inner++;
51  }
52  }
53 
54  for (vector<const GeometricDet*>::const_iterator it = theCompsPosNeg.begin(); it != theCompsPosNeg.end(); it++) {
55  if ((**it).rho() > radius_split)
56  theCompsInnerOuter.emplace_back(*it);
57  }
58  // std::cout << "num of inner = " << num_inner << " with radius less than " << radius_split << std::endl;
59  // now shift outer by one
60 
61  if (num_inner < theCompsInnerOuter.size()) {
62  std::rotate(theCompsInnerOuter.begin() + num_inner, theCompsInnerOuter.end() - 1, theCompsInnerOuter.end());
63  }
64  if (num_inner > 0) {
66  theCompsInnerOuter.begin(), theCompsInnerOuter.begin() + num_inner - 1, theCompsInnerOuter.begin() + num_inner);
67  }
68 
69  if (num_inner == 0) {
71  "CmsTrackerPhase1DiskBuilder. num_inner == 0. The split of modules by radius is probably not doing what you "
72  "expect: inner-radius group is empty.");
73  }
74  if (num_inner == theCompsInnerOuter.size()) {
76  "CmsTrackerPhase1DiskBuilder. num_inner == theCompsInnerOuter.size(). The split of modules by radius is "
77  "probably not doing what you expect: outer-radius group is empty.");
78  }
79 
80  std::copy(theCompsInnerOuter.begin(), theCompsInnerOuter.end(), begin);
81 }
Log< level::Error, false > LogError
static bool PhiSort(const GeometricDet *Panel1, const GeometricDet *Panel2)
def rotate
Definition: svgfig.py:705
string end
Definition: dataset.py:937
template<class FilteredView >
bool CmsTrackerPhase1DiskBuilder< FilteredView >::PhiSort ( const GeometricDet Panel1,
const GeometricDet Panel2 
)
staticprivate

Definition at line 15 of file CmsTrackerPhase1DiskBuilder.cc.

References GeometricDet::phi().

15  {
16  return (Panel1->phi() < Panel2->phi());
17 }
double phi() const
Definition: GeometricDet.h:104
template<class FilteredView >
void CmsTrackerPhase1DiskBuilder< FilteredView >::sortNS ( FilteredView &  fv,
GeometricDet det 
)
overrideprivatevirtual

Reimplemented from CmsTrackerLevelBuilder< FilteredView >.

Definition at line 105 of file CmsTrackerPhase1DiskBuilder.cc.

References funct::abs(), GeometricDet::addComponents(), GeometricDet::clearComponents(), AlCaHLTBitMon_QueryRunRegistry::comp, GeometricDet::component(), GeometricDet::components(), personalPlayback::fn, dqmiolumiharvest::j, GeometricDet::panel, and groupFilesInBlocks::temp.

105  {
107 
108  switch (det->components().front()->type()) {
109  case GeometricDet::panel:
110  PhiPosNegSplit_innerOuter(comp.begin(), comp.end());
111  break;
112  default:
113  edm::LogError("CmsTrackerPhase1DiskBuilder")
114  << "ERROR - wrong SubDet to sort..... " << det->components().front()->type();
115  }
116 
117  GeometricDet::GeometricDetContainer zminpanels; // Here z refers abs(z);
118  GeometricDet::GeometricDetContainer zmaxpanels; // So, zmin panel is always closer to ip.
119 
120  uint32_t totalblade = comp.size() / 2;
121  // std::cout << "pixel_disk " << pixel_disk << endl;
122 
123  zminpanels.reserve(totalblade);
124  zmaxpanels.reserve(totalblade);
125  for (uint32_t j = 0; j < totalblade; j++) {
126  if (std::abs(comp[2 * j]->translation().z()) > std::abs(comp[2 * j + 1]->translation().z())) {
127  zmaxpanels.emplace_back(det->component(2 * j));
128  zminpanels.emplace_back(det->component(2 * j + 1));
129 
130  } else if (std::abs(comp[2 * j]->translation().z()) < std::abs(comp[2 * j + 1]->translation().z())) {
131  zmaxpanels.emplace_back(det->component(2 * j + 1));
132  zminpanels.emplace_back(det->component(2 * j));
133  } else {
134  edm::LogWarning("CmsTrackerPhase1DiskBuilder") << "WARNING - The Z of both panels are equal! ";
135  }
136  }
137 
138  for (uint32_t fn = 0; fn < zminpanels.size(); fn++) {
139  uint32_t blade = fn + 1;
140  uint32_t panel = 2; // though being zmin, it is actually the one facing away the ip
141  uint32_t temp = (blade << 2) | panel;
142  zminpanels[fn]->setGeographicalID(temp);
143  }
144 
145  for (uint32_t bn = 0; bn < zmaxpanels.size(); bn++) {
146  uint32_t blade = bn + 1;
147  uint32_t panel = 1; // though being zmax, it is the one facing the ip
148  uint32_t temp = (blade << 2) | panel;
149  zmaxpanels[bn]->setGeographicalID(temp);
150  }
151 
152  det->clearComponents();
153  det->addComponents(zminpanels);
154  det->addComponents(zmaxpanels);
155 }
std::vector< GeometricDet * > GeometricDetContainer
Definition: GeometricDet.h:35
void clearComponents()
Definition: GeometricDet.h:163
Log< level::Error, false > LogError
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:152
void PhiPosNegSplit_innerOuter(std::vector< GeometricDet const * >::iterator begin, std::vector< GeometricDet const * >::iterator end)
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
GeometricDet * component(size_t index)
Definition: GeometricDet.h:148
std::vector< GeometricDet const * > ConstGeometricDetContainer
Definition: GeometricDet.h:34
void addComponents(GeometricDetContainer const &cont)
Log< level::Warning, false > LogWarning