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 141 of file CmsMTDLevelBuilder.cc.

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

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

141  {
142  LogTrace("GeometricTimingDetBuilding") << std::string(3 * fv.history().size(), '-') << "+ "
143  << ExtractStringFromDDD::getString(attribute, &fv) << " " << tracker->type()
144  << " " << tracker->name() << std::endl;
145 
146  bool doLayers = fv.firstChild(); // descend to the next Layer
147 
148  while (doLayers) {
149  buildComponent(fv, tracker, attribute);
150  doLayers = fv.nextSibling(); // go to the next adjacent thingy
151  }
152 
153  fv.parent();
154 
155  sortNS(fv, tracker);
156 }
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)
std::string const & name() const
static std::string getString(std::string const &, DDFilteredView *)
virtual void buildComponent(DDFilteredView &, GeometricTimingDet *, std::string)=0
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 41 of file CmsMTDLevelBuilder.cc.

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

Referenced by CmsMTDTrayBuilder::sortNS().

41  {
42  double phi = a->phi();
43  return (phi >= 0 ? phi : phi + 2 * M_PI);
44 }
double phi() const
#define M_PI
double CmsMTDLevelBuilder::getPhiGluedModule ( const GeometricTimingDet a)
static

Definition at line 80 of file CmsMTDLevelBuilder.cc.

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

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

80  {
81  std::vector<const GeometricTimingDet*> comp;
82  a->deepComponents(comp);
83  float phi = 0.;
84  bool sum = true;
85 
86  for (auto& i : comp) {
87  if (std::abs(i->phi()) > M_PI / 2.) {
88  sum = false;
89  break;
90  }
91  }
92 
93  if (sum) {
94  for (auto& i : comp) {
95  phi += i->phi();
96  }
97 
98  double temp = phi / float(comp.size()) < 0. ? 2 * M_PI + phi / float(comp.size()) : phi / float(comp.size());
99  return temp;
100 
101  } else {
102  for (auto& i : comp) {
103  double phi1 = i->phi() >= 0 ? i->phi() : i->translation().phi() + 2 * M_PI;
104  phi += phi1;
105  }
106 
107  double com = comp.front()->phi() >= 0 ? comp.front()->phi() : 2 * M_PI + comp.front()->phi();
108  double temp =
109  std::abs(phi / float(comp.size()) - com) > 2. ? M_PI - phi / float(comp.size()) : phi / float(comp.size());
110  temp = temp >= 0 ? temp : 2 * M_PI + temp;
111  return temp;
112  }
113 }
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 127 of file CmsMTDLevelBuilder.cc.

References getPhiGluedModule(), M_PI, and phi.

127  {
128  double phi = getPhiGluedModule(a); // [0,2pi)
129  phi = (phi <= M_PI ? phi : phi - 2 * M_PI); // (-pi,pi]
130  return (M_PI - phi);
131 }
static double getPhiGluedModule(const GeometricTimingDet *a)
#define M_PI
double CmsMTDLevelBuilder::getPhiMirror ( const GeometricTimingDet a)
static

Definition at line 115 of file CmsMTDLevelBuilder.cc.

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

115  {
116  double phi = a->phi();
117  phi = (phi >= 0 ? phi : phi + 2 * M_PI); // (-pi,pi] --> [0,2pi)
118  return ((M_PI - phi) >= 0 ? (M_PI - phi) : (M_PI - phi) + 2 * M_PI); // (-pi,pi] --> [0,2pi)
119 }
double phi() const
#define M_PI
double CmsMTDLevelBuilder::getPhiModule ( const GeometricTimingDet a)
static

Definition at line 46 of file CmsMTDLevelBuilder.cc.

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

Referenced by getPhiModuleMirror().

46  {
47  std::vector<const GeometricTimingDet*> const& comp = a->components().back()->components();
48  float phi = 0.;
49  bool sum = true;
50 
51  for (auto i : comp) {
52  if (std::abs(i->phi()) > M_PI / 2.) {
53  sum = false;
54  break;
55  }
56  }
57 
58  if (sum) {
59  for (auto i : comp) {
60  phi += i->phi();
61  }
62 
63  double temp = phi / float(comp.size()) < 0. ? 2 * M_PI + phi / float(comp.size()) : phi / float(comp.size());
64  return temp;
65 
66  } else {
67  for (auto i : comp) {
68  double phi1 = i->phi() >= 0 ? i->phi() : i->phi() + 2 * M_PI;
69  phi += phi1;
70  }
71 
72  double com = comp.front()->phi() >= 0 ? comp.front()->phi() : 2 * M_PI + comp.front()->phi();
73  double temp =
74  std::abs(phi / float(comp.size()) - com) > 2. ? M_PI - phi / float(comp.size()) : phi / float(comp.size());
75  temp = temp >= 0 ? temp : 2 * M_PI + temp;
76  return temp;
77  }
78 }
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 121 of file CmsMTDLevelBuilder.cc.

References getPhiModule(), M_PI, and phi.

121  {
122  double phi = getPhiModule(a); // [0,2pi)
123  phi = (phi <= M_PI ? phi : phi - 2 * M_PI); // (-pi,pi]
124  return (M_PI - phi);
125 }
#define M_PI
static double getPhiModule(const GeometricTimingDet *a)
bool CmsMTDLevelBuilder::isLessModZ ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 37 of file CmsMTDLevelBuilder.cc.

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

Referenced by CmsMTDEndcapBuilder::sortNS().

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

Definition at line 137 of file CmsMTDLevelBuilder.cc.

References GeometricTimingDet::rho().

Referenced by CmsMTDSubStrctBuilder::sortNS().

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

Definition at line 133 of file CmsMTDLevelBuilder.cc.

References GeometricTimingDet::deepComponents().

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

Definition at line 27 of file CmsMTDLevelBuilder.cc.

References GeometricTimingDet::translation().

Referenced by CmsMTDModuleBuilder::sortNS().

27  {
28  // NP** change for Phase 2 Tracker
29  if (a->translation().z() == b->translation().z()) {
30  return a->translation().rho() < b->translation().rho();
31  } else {
32  // Original version
33  return a->translation().z() < b->translation().z();
34  }
35 }
Translation const & translation() const
bool CmsMTDLevelBuilder::phiSortNP ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 17 of file CmsMTDLevelBuilder.cc.

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

17  {
18  if (std::abs(a->translation().rho() - b->translation().rho()) < 0.01 &&
19  (std::abs(a->translation().phi() - b->translation().phi()) < 0.01 ||
20  std::abs(a->translation().phi() - b->translation().phi()) > 6.27) &&
21  a->translation().z() * b->translation().z() > 0.0) {
22  return (std::abs(a->translation().z()) < std::abs(b->translation().z()));
23  } else
24  return false;
25 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
Translation const & translation() const
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().

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

Member Data Documentation

CmsMTDStringToEnum CmsMTDLevelBuilder::_CmsMTDStringToEnum
private

Definition at line 46 of file CmsMTDLevelBuilder.h.

CmsMTDStringToEnum CmsMTDLevelBuilder::theCmsMTDStringToEnum
protected