CMS 3D CMS Logo

List of all members | Private Member Functions | Static Private Member Functions
CmsTrackerPhase1DiskBuilder Class Reference

#include <CmsTrackerPhase1DiskBuilder.h>

Inheritance diagram for CmsTrackerPhase1DiskBuilder:
CmsTrackerLevelBuilder CmsTrackerAbstractConstruction

Private Member Functions

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

Static Private Member Functions

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

Additional Inherited Members

- Public Member Functions inherited from CmsTrackerLevelBuilder
void build (DDFilteredView &, GeometricDet *, std::string) override
 
 ~CmsTrackerLevelBuilder () override
 
- Public Member Functions inherited from CmsTrackerAbstractConstruction
virtual ~CmsTrackerAbstractConstruction ()=default
 
- Protected Attributes inherited from CmsTrackerLevelBuilder
CmsTrackerStringToEnum theCmsTrackerStringToEnum
 

Detailed Description

Class which contructs PixelForward/Disk.

Definition at line 11 of file CmsTrackerPhase1DiskBuilder.h.

Member Function Documentation

void CmsTrackerPhase1DiskBuilder::buildComponent ( DDFilteredView fv,
GeometricDet g,
std::string  s 
)
overrideprivatevirtual

Implements CmsTrackerLevelBuilder.

Definition at line 75 of file CmsTrackerPhase1DiskBuilder.cc.

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

76 {
77  CmsTrackerPanelBuilder theCmsTrackerPanelBuilder;
79 
81  {
83  theCmsTrackerPanelBuilder.build( fv, subdet, s );
84  break;
85  default:
86  edm::LogError( "CmsTrackerPhase1DiskBuilder" ) << " ERROR - I was expecting a Panel, I got a " << ExtractStringFromDDD::getString( s, &fv );
87  }
88  g->addComponent( subdet );
89 }
static std::string getString(std::string const &, DDFilteredView *)
void addComponent(GeometricDet *)
void build(DDFilteredView &, GeometricDet *, std::string) override
GeometricDet::GeometricEnumType type(std::string const &) const
CmsTrackerStringToEnum theCmsTrackerStringToEnum
void CmsTrackerPhase1DiskBuilder::PhiPosNegSplit_innerOuter ( std::vector< GeometricDet const * >::iterator  begin,
std::vector< GeometricDet const * >::iterator  end 
)
private

Definition at line 22 of file CmsTrackerPhase1DiskBuilder.cc.

References begin, popcon2dropbox::copy(), end, hpstanc_transforms::max, min(), and svgfig::rotate().

24 {
25  // first sort in phi, lowest first (-pi to +pi)
26  std::sort( begin, end, PhiSort );
27 
28  // now put positive phi (in order) ahead of negative phi as in std geometry
29  std::vector<const GeometricDet*> theCompsPosNeg;
30  theCompsPosNeg.empty();
31  theCompsPosNeg.clear();
32  // also find the average radius (used to split inner and outer disk panels)
33  double theRmin = (**begin).rho();
34  double theRmax = theRmin;
35  for(vector<const GeometricDet*>::const_iterator it=begin;
36  it!=end;it++){
37  if((**it).phi() >= 0) theCompsPosNeg.emplace_back(*it);
38  theRmin = std::min( theRmin, (**it).rho());
39  theRmax = std::max( theRmax, (**it).rho());
40  }
41  for(vector<const GeometricDet*>::const_iterator it=begin;
42  it!=end;it++){
43  if((**it).phi() < 0) theCompsPosNeg.emplace_back(*it);
44  }
45 
46  // now put inner disk panels first
47  // double radius_split = 0.5 * (theRmin + theRmax);
48  // force the split radius to be 100 mm to be able to deal with disks with only outer ring
49  double radius_split = 100.;
50  std::vector<const GeometricDet*> theCompsInnerOuter;
51  theCompsInnerOuter.empty();
52  theCompsInnerOuter.clear();
53  unsigned int num_inner = 0;
54  for(vector<const GeometricDet*>::const_iterator it=theCompsPosNeg.begin();
55  it!=theCompsPosNeg.end();it++){
56  if((**it).rho() <= radius_split) {
57  theCompsInnerOuter.emplace_back(*it);
58  num_inner++;
59  }
60  }
61 
62  for(vector<const GeometricDet*>::const_iterator it=theCompsPosNeg.begin();
63  it!=theCompsPosNeg.end();it++){
64  if((**it).rho() > radius_split) theCompsInnerOuter.emplace_back(*it);
65  }
66  // std::cout << "num of inner = " << num_inner << " with radius less than " << radius_split << std::endl;
67  // now shift outer by one
68 
69  std::rotate(theCompsInnerOuter.begin()+num_inner,theCompsInnerOuter.end()-1,theCompsInnerOuter.end());
70  std::rotate(theCompsInnerOuter.begin(),theCompsInnerOuter.begin()+num_inner-1,theCompsInnerOuter.begin()+num_inner);
71  std::copy(theCompsInnerOuter.begin(), theCompsInnerOuter.end(), begin);
72 }
#define end
Definition: vmac.h:37
T min(T a, T b)
Definition: MathUtil.h:58
static bool PhiSort(const GeometricDet *Panel1, const GeometricDet *Panel2)
#define begin
Definition: vmac.h:30
def rotate(angle, cx=0, cy=0)
Definition: svgfig.py:704
bool CmsTrackerPhase1DiskBuilder::PhiSort ( const GeometricDet Panel1,
const GeometricDet Panel2 
)
staticprivate

Definition at line 16 of file CmsTrackerPhase1DiskBuilder.cc.

References GeometricDet::phi().

17 {
18  return( Panel1->phi() < Panel2->phi());
19 }
double phi() const
Definition: GeometricDet.h:129
void CmsTrackerPhase1DiskBuilder::sortNS ( DDFilteredView fv,
GeometricDet det 
)
overrideprivatevirtual

Reimplemented from CmsTrackerLevelBuilder.

Definition at line 92 of file CmsTrackerPhase1DiskBuilder.cc.

References GeometricDet::addComponents(), GeometricDet::clearComponents(), AlCaHLTBitMon_QueryRunRegistry::comp, GeometricDet::component(), GeometricDet::components(), GeometricDet::panel, and groupFilesInBlocks::temp.

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