CMS 3D CMS Logo

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

#include <CmsMTDLevelBuilder.h>

Inheritance diagram for CmsMTDLevelBuilder:
CmsMTDAbstractConstruction CmsMTDBuilder CmsMTDConstruction CmsMTDDiscBuilder CmsMTDEndcapBuilder CmsMTDETLRingBuilder CmsMTDModuleBuilder CmsMTDSubStrctBuilder CmsMTDTrayBuilder

Public Member Functions

void build (DDFilteredView &, GeometricTimingDet *, std::string) override
 
 ~CmsMTDLevelBuilder () override
 
- Public Member Functions inherited from CmsMTDAbstractConstruction
virtual ~CmsMTDAbstractConstruction ()=default
 

Static Public Member Functions

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

Protected Attributes

CmsMTDStringToEnum theCmsMTDStringToEnum
 

Private Member Functions

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

Private Attributes

CmsMTDStringToEnum _CmsMTDStringToEnum
 

Detailed Description

Abstract Class to construct a Level in the hierarchy

Definition at line 16 of file CmsMTDLevelBuilder.h.

Constructor & Destructor Documentation

CmsMTDLevelBuilder::~CmsMTDLevelBuilder ( )
inlineoverride

Definition at line 36 of file CmsMTDLevelBuilder.h.

References buildComponent(), and AlCaHLTBitMon_QueryRunRegistry::string.

36 {}

Member Function Documentation

void CmsMTDLevelBuilder::build ( DDFilteredView fv,
GeometricTimingDet tracker,
std::string  attribute 
)
overridevirtual

Implements CmsMTDAbstractConstruction.

Definition at line 150 of file CmsMTDLevelBuilder.cc.

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

Referenced by CmsMTDTrayBuilder::buildComponent(), CmsMTDDiscBuilder::buildComponent(), CmsMTDSubStrctBuilder::buildComponent(), CmsMTDEndcapBuilder::buildComponent(), CmsMTDBuilder::buildComponent(), and DDDCmsMTDConstruction::construct().

151 {
152 
153  LogTrace("GeometricTimingDetBuilding")
154  << std::string(3 * fv.history().size(), '-') << "+ " << ExtractStringFromDDD::getString(attribute, &fv) << " "
155  << tracker->type() << " " << tracker->name() << std::endl;
156 
157  bool doLayers = fv.firstChild(); // descend to the next Layer
158 
159  while (doLayers) {
160  buildComponent(fv, tracker, attribute);
161  doLayers = fv.nextSibling(); // go to the next adjacent thingy
162  }
163 
164  fv.parent();
165 
166  sortNS(fv, tracker);
167 }
static std::string getString(std::string const &, DDFilteredView *)
bool parent()
set the current node to the parent node ...
bool nextSibling()
set the current node to the next sibling ...
GeometricTimingEnumType type() const
const std::vector< DDGeoHistory > & history() const
virtual void sortNS(DDFilteredView &, GeometricTimingDet *)
#define LogTrace(id)
virtual void buildComponent(DDFilteredView &, GeometricTimingDet *, std::string)=0
DDName const & name() const
bool firstChild()
set the current node to the first child ...
virtual void CmsMTDLevelBuilder::buildComponent ( DDFilteredView ,
GeometricTimingDet ,
std::string   
)
privatepure virtual
double CmsMTDLevelBuilder::getPhi ( const GeometricTimingDet a)
static

Definition at line 45 of file CmsMTDLevelBuilder.cc.

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

Referenced by CmsMTDTrayBuilder::sortNS().

46 {
47  double phi = a->phi();
48  return (phi >= 0 ? phi : phi + 2 * M_PI);
49 }
#define M_PI
double CmsMTDLevelBuilder::getPhiGluedModule ( const GeometricTimingDet a)
static

Definition at line 86 of file CmsMTDLevelBuilder.cc.

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

Referenced by getPhiGluedModuleMirror(), and CmsMTDETLRingBuilder::sortNS().

87 {
88  std::vector<const GeometricTimingDet*> 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 }
ConstGeometricTimingDetContainer deepComponents() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
double CmsMTDLevelBuilder::getPhiGluedModuleMirror ( const GeometricTimingDet a)
static

Definition at line 136 of file CmsMTDLevelBuilder.cc.

References getPhiGluedModule(), M_PI, and phi.

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 }
static double getPhiGluedModule(const GeometricTimingDet *a)
#define M_PI
double CmsMTDLevelBuilder::getPhiMirror ( const GeometricTimingDet a)
static

Definition at line 122 of file CmsMTDLevelBuilder.cc.

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

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 CmsMTDLevelBuilder::getPhiModule ( const GeometricTimingDet a)
static

Definition at line 51 of file CmsMTDLevelBuilder.cc.

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

Referenced by getPhiModuleMirror().

52 {
53  std::vector<const GeometricTimingDet*> 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 }
ConstGeometricTimingDetContainer & components()
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
#define M_PI
double CmsMTDLevelBuilder::getPhiModuleMirror ( const GeometricTimingDet a)
static

Definition at line 129 of file CmsMTDLevelBuilder.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 }
#define M_PI
static double getPhiModule(const GeometricTimingDet *a)
bool CmsMTDLevelBuilder::isLessModZ ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 40 of file CmsMTDLevelBuilder.cc.

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

Referenced by CmsMTDEndcapBuilder::sortNS().

41 {
42  return std::abs(a->translation().z()) < std::abs(b->translation().z());
43 }
DDTranslation const & translation() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
bool CmsMTDLevelBuilder::isLessR ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 148 of file CmsMTDLevelBuilder.cc.

References GeometricTimingDet::rho().

Referenced by CmsMTDSubStrctBuilder::sortNS().

148 { return a->rho() < b->rho(); }
bool CmsMTDLevelBuilder::isLessRModule ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 143 of file CmsMTDLevelBuilder.cc.

References GeometricTimingDet::deepComponents().

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

Definition at line 29 of file CmsMTDLevelBuilder.cc.

References GeometricTimingDet::translation().

Referenced by CmsMTDModuleBuilder::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
bool CmsMTDLevelBuilder::phiSortNP ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 18 of file CmsMTDLevelBuilder.cc.

References funct::abs(), and GeometricTimingDet::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 }
DDTranslation const & translation() const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
virtual void CmsMTDLevelBuilder::sortNS ( DDFilteredView ,
GeometricTimingDet  
)
inlineprivatevirtual
bool CmsMTDLevelBuilder::subDetByType ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 9 of file CmsMTDLevelBuilder.cc.

References GeometricTimingDet::type().

Referenced by CmsMTDBuilder::sortNS().

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

Member Data Documentation

CmsMTDStringToEnum CmsMTDLevelBuilder::_CmsMTDStringToEnum
private

Definition at line 46 of file CmsMTDLevelBuilder.h.

CmsMTDStringToEnum CmsMTDLevelBuilder::theCmsMTDStringToEnum
protected