CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Member Functions | Private Attributes
CmsTrackerDiskBuilder Class Reference

#include <CmsTrackerDiskBuilder.h>

Inheritance diagram for CmsTrackerDiskBuilder:
CmsTrackerLevelBuilder CmsTrackerAbstractConstruction

Public Member Functions

 CmsTrackerDiskBuilder (unsigned int totalBlade)
 
- Public Member Functions inherited from CmsTrackerLevelBuilder
virtual void build (DDFilteredView &, GeometricDet *, std::string)
 
virtual ~CmsTrackerLevelBuilder ()
 

Private Member Functions

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

Private Attributes

unsigned int m_totalBlade
 

Additional Inherited Members

- Protected Attributes inherited from CmsTrackerLevelBuilder
CmsTrackerStringToEnum theCmsTrackerStringToEnum
 

Detailed Description

Class which contructs PixelForward/Disk.

Definition at line 11 of file CmsTrackerDiskBuilder.h.

Constructor & Destructor Documentation

CmsTrackerDiskBuilder::CmsTrackerDiskBuilder ( unsigned int  totalBlade)

Definition at line 14 of file CmsTrackerDiskBuilder.cc.

15  : m_totalBlade( totalBlade )
16 {}

Member Function Documentation

void CmsTrackerDiskBuilder::buildComponent ( DDFilteredView fv,
GeometricDet g,
std::string  s 
)
privatevirtual

Implements CmsTrackerLevelBuilder.

Definition at line 71 of file CmsTrackerDiskBuilder.cc.

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

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

Definition at line 25 of file CmsTrackerDiskBuilder.cc.

References begin, filterCSVwithJSON::copy, end, max(), min, PhiSort(), and python.multivaluedict::sort().

Referenced by sortNS().

27 {
28  // first sort in phi, lowest first (-pi to +pi)
30 
31  // now put positive phi (in order) ahead of negative phi as in std geometry
32  std::vector<const GeometricDet*> theCompsPosNeg;
33  theCompsPosNeg.empty();
34  theCompsPosNeg.clear();
35  // also find the average radius (used to split inner and outer disk panels)
36  double theRmin = (**begin).rho();
37  double theRmax = theRmin;
38  for(vector<const GeometricDet*>::const_iterator it=begin;
39  it!=end;it++){
40  if((**it).phi() >= 0) theCompsPosNeg.push_back(*it);
41  theRmin = std::min( theRmin, (**it).rho());
42  theRmax = std::max( theRmax, (**it).rho());
43  }
44  for(vector<const GeometricDet*>::const_iterator it=begin;
45  it!=end;it++){
46  if((**it).phi() < 0) theCompsPosNeg.push_back(*it);
47  }
48 
49  // now put inner disk panels first
50  double radius_split = 0.5 * (theRmin + theRmax);
51  std::vector<const GeometricDet*> theCompsInnerOuter;
52  theCompsInnerOuter.empty();
53  theCompsInnerOuter.clear();
54  //unsigned int num_inner = 0;
55  for(vector<const GeometricDet*>::const_iterator it=theCompsPosNeg.begin();
56  it!=theCompsPosNeg.end();it++){
57  if((**it).rho() <= radius_split) {
58  theCompsInnerOuter.push_back(*it);
59  //num_inner++;
60  }
61  }
62  for(vector<const GeometricDet*>::const_iterator it=theCompsPosNeg.begin();
63  it!=theCompsPosNeg.end();it++){
64  if((**it).rho() > radius_split) theCompsInnerOuter.push_back(*it);
65  }
66  //std::cout << "num of inner = " << num_inner << " with radius less than " << radius_split << std::endl;
67  std::copy(theCompsInnerOuter.begin(), theCompsInnerOuter.end(), begin);
68 }
bool PhiSort(const GeometricDet *Panel1, const GeometricDet *Panel2)
#define min(a, b)
Definition: mlp_lapack.h:161
const T & max(const T &a, const T &b)
#define end
Definition: vmac.h:38
#define begin
Definition: vmac.h:31
void CmsTrackerDiskBuilder::sortNS ( DDFilteredView fv,
GeometricDet det 
)
privatevirtual

Reimplemented from CmsTrackerLevelBuilder.

Definition at line 88 of file CmsTrackerDiskBuilder.cc.

References GeometricDet::addComponents(), GeometricDet::clearComponents(), AlCaHLTBitMon_QueryRunRegistry::comp, GeometricDet::components(), j, m_totalBlade, GeometricDet::panel, PhiPosNegSplit_innerOuter(), groupFilesInBlocks::temp, TrackerStablePhiSort(), and detailsBasic3DVector::z.

89 {
91 
92  switch( det->components().front()->type())
93  {
95  if( m_totalBlade == 24 )
96  TrackerStablePhiSort( comp.begin(), comp.end(), ExtractPhi());
97  else
98  PhiPosNegSplit_innerOuter( comp.begin(), comp.end());
99  break;
100  default:
101  edm::LogError( "CmsTrackerDiskBuilder" ) << "ERROR - wrong SubDet to sort..... " << det->components().front()->type();
102  }
103 
104  GeometricDet::GeometricDetContainer zminpanels; // Here z refers abs(z);
105  GeometricDet::GeometricDetContainer zmaxpanels; // So, zmin panel is always closer to ip.
106 
107  uint32_t totalblade = comp.size()/2;
108  if( totalblade != m_totalBlade )
109  edm::LogError( "CmsTrackerDiskBuilder" ) << "ERROR, The Total Number of Blade in one disk is " << totalblade << "; configured " << m_totalBlade;
110 
111  zminpanels.reserve( totalblade );
112  zmaxpanels.reserve( totalblade );
113  for( uint32_t j = 0; j < totalblade; j++ )
114  {
115  if( fabs( comp[2*j]->translation().z()) > fabs( comp[ 2*j +1 ]->translation().z()))
116  {
117  zmaxpanels.push_back( comp[2*j] );
118  zminpanels.push_back( comp[2*j+1] );
119 
120  }
121  else if( fabs( comp[2*j]->translation().z()) < fabs( comp[ 2*j +1 ]->translation().z()))
122  {
123  zmaxpanels.push_back( comp[2*j+1] );
124  zminpanels.push_back( comp[2*j] );
125  }
126  else
127  {
128  edm::LogWarning( "CmsTrackerDiskBuilder" ) << "WARNING - The Z of both panels are equal! ";
129  }
130  }
131 
132  for( uint32_t fn = 0; fn < zminpanels.size(); fn++ )
133  {
134  uint32_t blade = fn + 1;
135  uint32_t panel = 1;
136  uint32_t temp = ( blade << 2 ) | panel;
137  zminpanels[fn]->setGeographicalID( temp );
138  }
139 
140  for( uint32_t bn = 0; bn < zmaxpanels.size(); bn++)
141  {
142  uint32_t blade = bn + 1;
143  uint32_t panel = 2;
144  uint32_t temp = ( blade << 2) | panel;
145  zmaxpanels[bn]->setGeographicalID( temp );
146  }
147 
148  det->clearComponents();
149  det->addComponents( zminpanels );
150  det->addComponents( zmaxpanels );
151 }
void PhiPosNegSplit_innerOuter(std::vector< GeometricDet const * >::iterator begin, std::vector< GeometricDet const * >::iterator end)
void clearComponents()
Definition: GeometricDet.h:89
float float float z
std::vector< GeometricDet const * > GeometricDetContainer
Definition: GeometricDet.h:36
void TrackerStablePhiSort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr)
int j
Definition: DBlmapReader.cc:9
GeometricDetContainer & components()
Definition: GeometricDet.h:163
void addComponents(GeometricDetContainer const &cont)

Member Data Documentation

unsigned int CmsTrackerDiskBuilder::m_totalBlade
private

Definition at line 22 of file CmsTrackerDiskBuilder.h.

Referenced by sortNS().