CMS 3D CMS Logo

CmsTrackerLevelBuilder.cc
Go to the documentation of this file.
7 
8 #include <cmath>
9 
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 }
16 
17 // NP** Phase2 BarrelEndcap
19  if (std::abs(a->translation().rho() - b->translation().rho()) < 0.01 &&
20  (std::abs(a->translation().phi() - b->translation().phi()) < 0.01 ||
21  std::abs(a->translation().phi() - b->translation().phi()) > 6.27) &&
22  a->translation().z() * b->translation().z() > 0.0) {
23  return (std::abs(a->translation().z()) < std::abs(b->translation().z()));
24  } else
25  return false;
26 }
27 
29  // NP** change for Phase 2 Tracker
30  if (a->translation().z() == b->translation().z()) {
31  return a->translation().rho() < b->translation().rho();
32  } else {
33  // Original version
34  return a->translation().z() < b->translation().z();
35  }
36 }
37 
39  return std::abs(a->translation().z()) < std::abs(b->translation().z());
40 }
41 
43  double phi = a->phi();
44  return (phi >= 0 ? phi : phi + 2 * M_PI);
45 }
46 
48  std::vector<const GeometricDet*> const& comp = a->components().back()->components();
49  float phi = 0.;
50  bool sum = true;
51 
52  for (auto i : comp) {
53  if (std::abs(i->phi()) > M_PI / 2.) {
54  sum = false;
55  break;
56  }
57  }
58 
59  if (sum) {
60  for (auto i : comp) {
61  phi += i->phi();
62  }
63 
64  double temp = phi / float(comp.size()) < 0. ? 2 * M_PI + phi / float(comp.size()) : phi / float(comp.size());
65  return temp;
66 
67  } else {
68  for (auto i : comp) {
69  double phi1 = i->phi() >= 0 ? i->phi() : i->phi() + 2 * M_PI;
70  phi += phi1;
71  }
72 
73  double com = comp.front()->phi() >= 0 ? comp.front()->phi() : 2 * M_PI + comp.front()->phi();
74  double temp =
75  std::abs(phi / float(comp.size()) - com) > 2. ? M_PI - phi / float(comp.size()) : phi / float(comp.size());
76  temp = temp >= 0 ? temp : 2 * M_PI + temp;
77  return temp;
78  }
79 }
80 
82  std::vector<const GeometricDet*> comp;
83  a->deepComponents(comp);
84  float phi = 0.;
85  bool sum = true;
86 
87  for (auto& i : comp) {
88  if (std::abs(i->phi()) > M_PI / 2.) {
89  sum = false;
90  break;
91  }
92  }
93 
94  if (sum) {
95  for (auto& i : comp) {
96  phi += i->phi();
97  }
98 
99  double temp = phi / float(comp.size()) < 0. ? 2 * M_PI + phi / float(comp.size()) : phi / float(comp.size());
100  return temp;
101 
102  } else {
103  for (auto& i : comp) {
104  double phi1 = i->phi() >= 0 ? i->phi() : i->translation().phi() + 2 * M_PI;
105  phi += phi1;
106  }
107 
108  double com = comp.front()->phi() >= 0 ? comp.front()->phi() : 2 * M_PI + comp.front()->phi();
109  double temp =
110  std::abs(phi / float(comp.size()) - com) > 2. ? M_PI - phi / float(comp.size()) : phi / float(comp.size());
111  temp = temp >= 0 ? temp : 2 * M_PI + temp;
112  return temp;
113  }
114 }
115 
117  double phi = a->phi();
118  phi = (phi >= 0 ? phi : phi + 2 * M_PI); // (-pi,pi] --> [0,2pi)
119  return ((M_PI - phi) >= 0 ? (M_PI - phi) : (M_PI - phi) + 2 * M_PI); // (-pi,pi] --> [0,2pi)
120 }
121 
123  double phi = getPhiModule(a); // [0,2pi)
124  phi = (phi <= M_PI ? phi : phi - 2 * M_PI); // (-pi,pi]
125  return (M_PI - phi);
126 }
127 
129  double phi = getPhiGluedModule(a); // [0,2pi)
130  phi = (phi <= M_PI ? phi : phi - 2 * M_PI); // (-pi,pi]
131  return (M_PI - phi);
132 }
133 
135  return a->deepComponents().front()->rho() < b->deepComponents().front()->rho();
136 }
137 
138 bool CmsTrackerLevelBuilderHelper::isLessR(const GeometricDet* a, const GeometricDet* b) { return a->rho() < b->rho(); }
139 
140 template <class FilteredView>
143  const std::string& attribute) {
144  LogTrace("GeometricDetBuilding") //<< std::string(3 * fv.history().size(), '-') << "+ "
145  << ExtractStringFromDDD<FilteredView>::getString(attribute, &fv) << " " << tracker->type() << " "
146  << tracker->name() << std::endl;
147 
148  bool doLayers = fv.firstChild(); // descend to the first Layer
149 
150  while (doLayers) {
151  buildComponent(fv, tracker, attribute);
152  doLayers = fv.nextSibling(); // go to next layer
153  }
154 
155  fv.parent();
156 
157  sortNS(fv, tracker);
158 }
159 
ExtractStringFromDDD::getString
static std::string getString(const std::string &, FilteredView *)
CmsTrackerLevelBuilder
Definition: CmsTrackerLevelBuilder.h:31
CmsTrackerLevelBuilder.h
mps_fire.i
i
Definition: mps_fire.py:355
MessageLogger.h
dqmMemoryStats.float
float
Definition: dqmMemoryStats.py:127
CmsTrackerLevelBuilderHelper::getPhiModuleMirror
static double getPhiModuleMirror(const GeometricDet *a)
Definition: CmsTrackerLevelBuilder.cc:122
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
CmsTrackerLevelBuilderHelper::isLessZ
static bool isLessZ(const GeometricDet *a, const GeometricDet *b)
Definition: CmsTrackerLevelBuilder.cc:28
CmsTrackerLevelBuilderHelper::getPhiGluedModule
static double getPhiGluedModule(const GeometricDet *a)
Definition: CmsTrackerLevelBuilder.cc:81
AlCaHLTBitMon_QueryRunRegistry.comp
comp
Definition: AlCaHLTBitMon_QueryRunRegistry.py:249
CmsTrackerLevelBuilderHelper::getPhiModule
static double getPhiModule(const GeometricDet *a)
Definition: CmsTrackerLevelBuilder.cc:47
CmsTrackerLevelBuilderHelper::getPhi
static double getPhi(const GeometricDet *a)
Definition: CmsTrackerLevelBuilder.cc:42
CmsTrackerLevelBuilderHelper::isLessR
static bool isLessR(const GeometricDet *a, const GeometricDet *b)
Definition: CmsTrackerLevelBuilder.cc:138
DDFilteredView.h
CmsTrackerLevelBuilderHelper::subDetByType
static bool subDetByType(const GeometricDet *a, const GeometricDet *b)
Definition: CmsTrackerLevelBuilder.cc:10
GeometricDet
Definition: GeometricDet.h:30
DDFilteredView.h
CmsTrackerLevelBuilderHelper::isLessModZ
static bool isLessModZ(const GeometricDet *a, const GeometricDet *b)
Definition: CmsTrackerLevelBuilder.cc:38
b
double b
Definition: hdecay.h:118
CmsTrackerLevelBuilderHelper::getPhiMirror
static double getPhiMirror(const GeometricDet *a)
Definition: CmsTrackerLevelBuilder.cc:116
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
PbPb_ZMuSkimMuonDPG_cff.tracker
tracker
Definition: PbPb_ZMuSkimMuonDPG_cff.py:60
CmsTrackerLevelBuilderHelper::getPhiGluedModuleMirror
static double getPhiGluedModuleMirror(const GeometricDet *a)
Definition: CmsTrackerLevelBuilder.cc:128
a
double a
Definition: hdecay.h:119
CmsTrackerLevelBuilder::build
void build(FilteredView &, GeometricDet *, const std::string &) override
Definition: CmsTrackerLevelBuilder.cc:141
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:50
GeometricDet.h
CmsTrackerLevelBuilderHelper::isLessRModule
static bool isLessRModule(const GeometricDet *a, const GeometricDet *b)
Definition: CmsTrackerLevelBuilder.cc:134
DDAxes::phi
ExtractStringFromDDD.h
funct::abs
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:671
CmsTrackerLevelBuilderHelper::phiSortNP
static bool phiSortNP(const GeometricDet *a, const GeometricDet *b)
Definition: CmsTrackerLevelBuilder.cc:18