CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes
CmsTrackerLevelBuilder Class Referenceabstract

#include <CmsTrackerLevelBuilder.h>

Inheritance diagram for CmsTrackerLevelBuilder:
CmsTrackerAbstractConstruction CmsDetConstruction CmsTrackerBuilder CmsTrackerDiskBuilder CmsTrackerLadderBuilder CmsTrackerLayerBuilder CmsTrackerOTDiscBuilder CmsTrackerOTLayerBuilder CmsTrackerOTRingBuilder CmsTrackerPanelBuilder CmsTrackerPetalBuilder CmsTrackerPhase1DiskBuilder CmsTrackerPhase2TPDiskBuilder CmsTrackerPixelPhase1EndcapBuilder CmsTrackerPixelPhase2DiskBuilder CmsTrackerPixelPhase2EndcapBuilder CmsTrackerPixelPhase2RingBuilder CmsTrackerRingBuilder CmsTrackerRodBuilder CmsTrackerStringBuilder CmsTrackerSubStrctBuilder CmsTrackerWheelBuilder

Public Member Functions

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

Static Public Member Functions

static double getPhi (const GeometricDet *a)
 
static double getPhiGluedModule (const GeometricDet *a)
 
static double getPhiGluedModuleMirror (const GeometricDet *a)
 
static double getPhiMirror (const GeometricDet *a)
 
static double getPhiModule (const GeometricDet *a)
 
static double getPhiModuleMirror (const GeometricDet *a)
 
static bool isLessModZ (const GeometricDet *a, const GeometricDet *b)
 
static bool isLessR (const GeometricDet *a, const GeometricDet *b)
 
static bool isLessRModule (const GeometricDet *a, const GeometricDet *b)
 
static bool isLessZ (const GeometricDet *a, const GeometricDet *b)
 
static bool phiSortNP (const GeometricDet *a, const GeometricDet *b)
 
static bool subDetByType (const GeometricDet *a, const GeometricDet *b)
 

Protected Attributes

CmsTrackerStringToEnum theCmsTrackerStringToEnum
 

Private Member Functions

virtual void buildComponent (DDFilteredView &, GeometricDet *, std::string)=0
 
virtual void sortNS (DDFilteredView &, GeometricDet *)
 

Private Attributes

CmsTrackerStringToEnum _CmsTrackerStringToEnum
 

Detailed Description

Abstract Class to construct a Level in the hierarchy

Definition at line 15 of file CmsTrackerLevelBuilder.h.

Constructor & Destructor Documentation

CmsTrackerLevelBuilder::~CmsTrackerLevelBuilder ( )
inlineoverride

Definition at line 31 of file CmsTrackerLevelBuilder.h.

References buildComponent(), and AlCaHLTBitMon_QueryRunRegistry::string.

31 {}

Member Function Documentation

void CmsTrackerLevelBuilder::build ( DDFilteredView fv,
GeometricDet tracker,
std::string  attribute 
)
overridevirtual

Implements CmsTrackerAbstractConstruction.

Definition at line 153 of file CmsTrackerLevelBuilder.cc.

References buildComponent(), DDFilteredView::firstChild(), ExtractStringFromDDD::getString(), DDFilteredView::history(), LogTrace, GeometricDet::name(), DDFilteredView::nextSibling(), DDFilteredView::parent(), sortNS(), AlCaHLTBitMon_QueryRunRegistry::string, and GeometricDet::type().

Referenced by CmsTrackerLayerBuilder::buildComponent(), CmsTrackerOTLayerBuilder::buildComponent(), CmsTrackerPetalBuilder::buildComponent(), CmsTrackerWheelBuilder::buildComponent(), CmsTrackerPhase2TPDiskBuilder::buildComponent(), CmsTrackerOTDiscBuilder::buildComponent(), CmsTrackerPixelPhase2DiskBuilder::buildComponent(), CmsTrackerDiskBuilder::buildComponent(), CmsTrackerPhase1DiskBuilder::buildComponent(), CmsTrackerPixelPhase1EndcapBuilder::buildComponent(), CmsTrackerPixelPhase2EndcapBuilder::buildComponent(), CmsTrackerSubStrctBuilder::buildComponent(), CmsTrackerBuilder::buildComponent(), and DDDCmsTrackerContruction::construct().

154 {
155 
156  LogTrace("GeometricDetBuilding") << std::string(3 * fv.history().size(), '-') << "+ "
157  << ExtractStringFromDDD::getString(attribute, &fv) << " " << tracker->type() << " "
158  << tracker->name() << std::endl;
159 
160  bool doLayers = fv.firstChild(); // descend to the first Layer
161 
162  while (doLayers) {
163  buildComponent(fv, tracker, attribute);
164  doLayers = fv.nextSibling(); // go to next layer
165  }
166 
167  fv.parent();
168 
169  sortNS(fv, tracker);
170 }
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
virtual void sortNS(DDFilteredView &, GeometricDet *)
const std::vector< DDGeoHistory > & history() const
DDName const & name() const
Definition: GeometricDet.h:146
static std::string getString(std::string const &, DDFilteredView *)
#define LogTrace(id)
bool firstChild()
set the current node to the first child ...
GeometricEnumType type() const
Definition: GeometricDet.h:142
virtual void buildComponent(DDFilteredView &, GeometricDet *, std::string)=0
virtual void CmsTrackerLevelBuilder::buildComponent ( DDFilteredView ,
GeometricDet ,
std::string   
)
privatepure virtual
double CmsTrackerLevelBuilder::getPhi ( const GeometricDet a)
static

Definition at line 45 of file CmsTrackerLevelBuilder.cc.

References M_PI, phi, and GeometricDet::phi().

Referenced by CmsTrackerLayerBuilder::sortNS(), CmsTrackerRingBuilder::sortNS(), CmsTrackerPixelPhase2RingBuilder::sortNS(), and CmsTrackerOTLayerBuilder::sortNS().

46 {
47  double phi = a->phi();
48  return (phi >= 0 ? phi : phi + 2 * M_PI);
49 }
#define M_PI
double phi() const
Definition: GeometricDet.h:129
double CmsTrackerLevelBuilder::getPhiGluedModule ( const GeometricDet a)
static

Definition at line 86 of file CmsTrackerLevelBuilder.cc.

References funct::abs(), AlCaHLTBitMon_QueryRunRegistry::comp, GeometricDet::deepComponents(), objects.autophobj::float, mps_fire::i, M_PI, phi, and groupFilesInBlocks::temp.

Referenced by getPhiGluedModuleMirror(), CmsTrackerRingBuilder::sortNS(), and CmsTrackerOTRingBuilder::sortNS().

87 {
88  std::vector<const GeometricDet*> comp;
89  a->deepComponents(comp);
90  float phi = 0.;
91  bool sum = true;
92 
93  for (auto& i : comp) {
94  if (std::abs(i->phi()) > M_PI / 2.) {
95  sum = false;
96  break;
97  }
98  }
99 
100  if (sum) {
101  for (auto& i : comp) {
102  phi += i->phi();
103  }
104 
105  double temp = phi / float(comp.size()) < 0. ? 2 * M_PI + phi / float(comp.size()) : phi / float(comp.size());
106  return temp;
107 
108  } else {
109  for (auto& i : comp) {
110  double phi1 = i->phi() >= 0 ? i->phi() : i->translation().phi() + 2 * M_PI;
111  phi += phi1;
112  }
113 
114  double com = comp.front()->phi() >= 0 ? comp.front()->phi() : 2 * M_PI + comp.front()->phi();
115  double temp
116  = std::abs(phi / float(comp.size()) - com) > 2. ? M_PI - phi / float(comp.size()) : phi / float(comp.size());
117  temp = temp >= 0 ? temp : 2 * M_PI + temp;
118  return temp;
119  }
120 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
ConstGeometricDetContainer deepComponents() const
double CmsTrackerLevelBuilder::getPhiGluedModuleMirror ( const GeometricDet a)
static

Definition at line 136 of file CmsTrackerLevelBuilder.cc.

References getPhiGluedModule(), M_PI, and phi.

Referenced by CmsTrackerRingBuilder::sortNS().

137 {
138  double phi = getPhiGluedModule(a); // [0,2pi)
139  phi = (phi <= M_PI ? phi : phi - 2 * M_PI); // (-pi,pi]
140  return (M_PI - phi);
141 }
#define M_PI
static double getPhiGluedModule(const GeometricDet *a)
double CmsTrackerLevelBuilder::getPhiMirror ( const GeometricDet a)
static

Definition at line 122 of file CmsTrackerLevelBuilder.cc.

References M_PI, phi, and GeometricDet::phi().

Referenced by CmsTrackerRingBuilder::sortNS().

123 {
124  double phi = a->phi();
125  phi = (phi >= 0 ? phi : phi + 2 * M_PI); // (-pi,pi] --> [0,2pi)
126  return ((M_PI - phi) >= 0 ? (M_PI - phi) : (M_PI - phi) + 2 * M_PI); // (-pi,pi] --> [0,2pi)
127 }
#define M_PI
double phi() const
Definition: GeometricDet.h:129
double CmsTrackerLevelBuilder::getPhiModule ( const GeometricDet a)
static

Definition at line 51 of file CmsTrackerLevelBuilder.cc.

References funct::abs(), AlCaHLTBitMon_QueryRunRegistry::comp, GeometricDet::components(), objects.autophobj::float, mps_fire::i, M_PI, phi, and groupFilesInBlocks::temp.

Referenced by getPhiModuleMirror(), and CmsTrackerWheelBuilder::sortNS().

52 {
53  std::vector<const GeometricDet*> const& comp = a->components().back()->components();
54  float phi = 0.;
55  bool sum = true;
56 
57  for (auto i : comp) {
58  if (std::abs(i->phi()) > M_PI / 2.) {
59  sum = false;
60  break;
61  }
62  }
63 
64  if (sum) {
65  for (auto i : comp) {
66  phi += i->phi();
67  }
68 
69  double temp = phi / float(comp.size()) < 0. ? 2 * M_PI + phi / float(comp.size()) : phi / float(comp.size());
70  return temp;
71 
72  } else {
73  for (auto i : comp) {
74  double phi1 = i->phi() >= 0 ? i->phi() : i->phi() + 2 * M_PI;
75  phi += phi1;
76  }
77 
78  double com = comp.front()->phi() >= 0 ? comp.front()->phi() : 2 * M_PI + comp.front()->phi();
79  double temp
80  = std::abs(phi / float(comp.size()) - com) > 2. ? M_PI - phi / float(comp.size()) : phi / float(comp.size());
81  temp = temp >= 0 ? temp : 2 * M_PI + temp;
82  return temp;
83  }
84 }
ConstGeometricDetContainer & components()
Definition: GeometricDet.h:176
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
double CmsTrackerLevelBuilder::getPhiModuleMirror ( const GeometricDet a)
static

Definition at line 129 of file CmsTrackerLevelBuilder.cc.

References getPhiModule(), M_PI, and phi.

130 {
131  double phi = getPhiModule(a); // [0,2pi)
132  phi = (phi <= M_PI ? phi : phi - 2 * M_PI); // (-pi,pi]
133  return (M_PI - phi);
134 }
static double getPhiModule(const GeometricDet *a)
#define M_PI
bool CmsTrackerLevelBuilder::isLessModZ ( const GeometricDet a,
const GeometricDet b 
)
static
bool CmsTrackerLevelBuilder::isLessR ( const GeometricDet a,
const GeometricDet b 
)
static

Definition at line 148 of file CmsTrackerLevelBuilder.cc.

References GeometricDet::rho().

Referenced by CmsTrackerPanelBuilder::sortNS(), and CmsTrackerSubStrctBuilder::sortNS().

149 {
150  return a->rho() < b->rho();
151 }
double rho() const
Definition: GeometricDet.h:133
bool CmsTrackerLevelBuilder::isLessRModule ( const GeometricDet a,
const GeometricDet b 
)
static

Definition at line 143 of file CmsTrackerLevelBuilder.cc.

References GeometricDet::deepComponents().

Referenced by CmsTrackerPetalBuilder::sortNS(), and CmsTrackerWheelBuilder::sortNS().

144 {
145  return a->deepComponents().front()->rho() < b->deepComponents().front()->rho();
146 }
ConstGeometricDetContainer deepComponents() const
bool CmsTrackerLevelBuilder::isLessZ ( const GeometricDet a,
const GeometricDet b 
)
static

Definition at line 29 of file CmsTrackerLevelBuilder.cc.

References GeometricDet::translation().

Referenced by CmsTrackerOTLayerBuilder::sortNS(), and CmsTrackerLadderBuilder::sortNS().

30 {
31  // NP** change for Phase 2 Tracker
32  if (a->translation().z() == b->translation().z()) {
33  return a->translation().rho() < b->translation().rho();
34  } else {
35  // Original version
36  return a->translation().z() < b->translation().z();
37  }
38 }
DDTranslation const & translation() const
Definition: GeometricDet.h:125
bool CmsTrackerLevelBuilder::phiSortNP ( const GeometricDet a,
const GeometricDet b 
)
static

Definition at line 18 of file CmsTrackerLevelBuilder.cc.

References funct::abs(), and GeometricDet::translation().

19 {
20  if (std::abs(a->translation().rho() - b->translation().rho()) < 0.01
21  && (std::abs(a->translation().phi() - b->translation().phi()) < 0.01
22  || std::abs(a->translation().phi() - b->translation().phi()) > 6.27)
23  && a->translation().z() * b->translation().z() > 0.0) {
24  return (std::abs(a->translation().z()) < std::abs(b->translation().z()));
25  } else
26  return false;
27 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
DDTranslation const & translation() const
Definition: GeometricDet.h:125
virtual void CmsTrackerLevelBuilder::sortNS ( DDFilteredView ,
GeometricDet  
)
inlineprivatevirtual
bool CmsTrackerLevelBuilder::subDetByType ( const GeometricDet a,
const GeometricDet b 
)
static

Definition at line 9 of file CmsTrackerLevelBuilder.cc.

References GeometricDet::type().

Referenced by CmsTrackerBuilder::sortNS().

10 {
11  // it relies on the fact that the GeometricDet::GDEnumType enumerators used
12  // to identify the subdetectors in the upgrade geometries are equal to the
13  // ones of the present detector + n*100
14  return a->type() % 100 < b->type() % 100;
15 }
GeometricEnumType type() const
Definition: GeometricDet.h:142

Member Data Documentation

CmsTrackerStringToEnum CmsTrackerLevelBuilder::_CmsTrackerStringToEnum
private

Definition at line 41 of file CmsTrackerLevelBuilder.h.

CmsTrackerStringToEnum CmsTrackerLevelBuilder::theCmsTrackerStringToEnum
protected