CMS 3D CMS Logo

CmsDetConstruction.cc
Go to the documentation of this file.
7 
8 template <class FilteredView>
10  GeometricDet* mother,
11  const std::string& attribute) {
12  GeometricDet* det = new GeometricDet(&fv,
15  if (det->stereo()) {
16  uint32_t temp = 1;
18  } else {
19  uint32_t temp = 2;
21  }
22 
23  mother->addComponent(det);
24 }
25 
26 template <class FilteredView>
28  GeometricDet* mother,
29  const std::string& attribute) {
30  GeometricDet* det = new GeometricDet(&fv,
33 
34  if (det->isLowerSensor()) {
35  uint32_t temp = 1;
37  } else if (det->isUpperSensor()) {
38  uint32_t temp = 2;
40  } else {
41  edm::LogError("DetConstruction") << " module defined in a Stack but not upper either lower!? ";
42  }
43  mother->addComponent(det);
44 }
45 
46 /*
47  * OLD DD.
48  * Module with 2 sensors: calculate the sensor local ID, and add the sensor to its mother volume (module).
49  * Module with 1 sensor: just add the sensor to to its mother volume (ladder).
50  */
51 template <>
53  GeometricDet* mother,
54  const std::string& attribute) {
55  // Mother volume
56  // Module with 2 sensors: the mother volume is the module volume.
57  // Module with 1 sensor: the mother volume is the ladder volume.
58  const std::string& myTopologicalNameInXMLs = ExtractStringFromDDD<DDFilteredView>::getString(attribute, &fv);
59  const GeometricDet::GDEnumType& myTopologicalType =
61 
62  GeometricDet* det = new GeometricDet(&fv, myTopologicalType);
63 
64  const bool isPhase1ModuleWith2Sensors = (myTopologicalType == GeometricDet::mergedDet);
65  const bool isPhase2ModuleWith2Sensors = (myTopologicalType == GeometricDet::OTPhase2Stack);
66 
67  // CASE A: MODULE HAS 2 SENSORS
68  if (isPhase1ModuleWith2Sensors || isPhase2ModuleWith2Sensors) {
69  // Go down in hierarchy: from module to sensor
70  bool dodets = fv.firstChild(); // very important
71  while (dodets) {
72  // PHASE 1 (MERGEDDET)
73  if (isPhase1ModuleWith2Sensors) {
74  buildSmallDetsforGlued(fv, det, attribute);
75  }
76  // PHASE 2 (STACKDET)
77  else if (isPhase2ModuleWith2Sensors) {
78  buildSmallDetsforStack(fv, det, attribute);
79  }
80 
81  dodets = fv.nextSibling();
82  }
83 
84  fv.parent();
85  }
86 
87  // CASE B: MODULE HAS 1 SENSOR: NOTHING SPECIFIC TO DO
88  // Indeed, we are not going to sort sensors within module, if there is only 1 sensor!
89 
90  // ALL CASES: add sensor to its mother volume (module or ladder).
91  mother->addComponent(det);
92 }
93 
94 /*
95  * DD4hep.
96  * Module with 2 sensors: calculate the sensor local ID, and add the sensor to its mother volume (module).
97  * Module with 1 sensor: just add the sensor to its mother volume (ladder).
98  */
99 template <>
101  GeometricDet* mother,
102  const std::string& attribute) {
103  // Mother volume
104  // Module with 2 sensors: the mother volume is the module volume.
105  // Module with 1 sensor: the mother volume is the ladder volume.
106  const std::string& myTopologicalNameInXMLs = ExtractStringFromDDD<cms::DDFilteredView>::getString(attribute, &fv);
107  const GeometricDet::GDEnumType& myTopologicalType =
109  GeometricDet* det = new GeometricDet(&fv, myTopologicalType);
110 
111  const bool isPhase1ModuleWith2Sensors = (myTopologicalType == GeometricDet::mergedDet);
112  const bool isPhase2ModuleWith2Sensors = (myTopologicalType == GeometricDet::OTPhase2Stack);
113 
114  // CASE A: MODULE HAS 2 SENSORS
115  if (isPhase1ModuleWith2Sensors || isPhase2ModuleWith2Sensors) {
116  // Go down in hierarchy: from module to sensor
117  if (!fv.firstChild()) { // very important
118  edm::LogError("CmsDetConstruction::buildComponent. Cannot go down to sensor volume.");
119  return;
120  }
121 
122  // This is the sensor hierarchy level
123  const int sensorHierarchyLevel = fv.level();
124 
125  // Loop on all siblings (ie, on all sensors)
126  while (fv.level() == sensorHierarchyLevel) {
127  // PHASE 1 (MERGEDDET)
128  if (isPhase1ModuleWith2Sensors) {
129  buildSmallDetsforGlued(fv, det, attribute);
130  }
131  // PHASE 2 (STACKDET)
132  else if (isPhase2ModuleWith2Sensors) {
133  buildSmallDetsforStack(fv, det, attribute);
134  }
135 
136  // Go to the next volume in FilteredView.
137  // NB: If this volume is another sensor of the same module, will stay in the loop.
138  // Otherwise, it is very important to access the next volume to be treated anyway.
139  fv.firstChild();
140  }
141  }
142 
143  // CASE B: MODULE HAS 1 SENSOR: NOTHING SPECIFIC TO DO
144  // Indeed, we are not going to sort sensors within module, if there is only 1 sensor!
145  else {
146  // Go to the next volume in FilteredView.
147  fv.firstChild();
148  }
149 
150  // ALL CASES: add sensor to its mother volume (module or ladder).
151  mother->addComponent(det);
152 }
ExtractStringFromDDD::getString
static std::string getString(const std::string &, FilteredView *)
CmsTrackerLevelBuilder
Definition: CmsTrackerLevelBuilder.h:31
MessageLogger.h
GeometricDet::isLowerSensor
bool isLowerSensor() const
Definition: GeometricDet.h:138
CmsDetConstruction.h
cms::DDFilteredView
Definition: DDFilteredView.h:70
DDFilteredView::parent
bool parent()
set the current node to the parent node ...
Definition: DDFilteredView.cc:161
groupFilesInBlocks.temp
list temp
Definition: groupFilesInBlocks.py:142
ExtractStringFromDDD
Definition: ExtractStringFromDDD.h:12
CmsDetConstruction::buildSmallDetsforStack
void buildSmallDetsforStack(FilteredView &, GeometricDet *, const std::string &)
Definition: CmsDetConstruction.cc:27
DetId
Definition: DetId.h:17
DDFilteredView::firstChild
bool firstChild()
set the current node to the first child ...
Definition: DDFilteredView.cc:86
DDFilteredView.h
GeometricDet::mergedDet
Definition: GeometricDet.h:64
GeometricDet::setGeographicalID
void setGeographicalID(DetId id)
Definition: GeometricDet.h:97
cms::DDFilteredView::firstChild
bool firstChild()
set the current node to the first child
Definition: DDFilteredView.cc:268
GeometricDet
Definition: GeometricDet.h:31
DDFilteredView::nextSibling
bool nextSibling()
set the current node to the next sibling ...
Definition: DDFilteredView.cc:124
DDFilteredView.h
CmsDetConstruction::buildSmallDetsforGlued
void buildSmallDetsforGlued(FilteredView &, GeometricDet *, const std::string &)
Definition: CmsDetConstruction.cc:9
GeometricDet::GDEnumType
GDEnumType
Definition: GeometricDet.h:48
GeometricDet::stereo
bool stereo() const
Definition: GeometricDet.h:137
cms::DDFilteredView::level
const int level() const
get Iterator level
Definition: DDFilteredView.cc:639
gainCalibHelper::gainCalibPI::type
type
Definition: SiPixelGainCalibHelper.h:40
edm::LogError
Log< level::Error, false > LogError
Definition: MessageLogger.h:123
AlCaHLTBitMon_QueryRunRegistry.string
string string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
ExtractStringFromDDD.h
GeometricDet::OTPhase2Stack
Definition: GeometricDet.h:74
DetId.h
CmsDetConstruction::buildComponent
void buildComponent(FilteredView &, GeometricDet *, const std::string &) override
DDFilteredView
Definition: DDFilteredView.h:20
GeometricDet::addComponent
void addComponent(GeometricDet *)
Definition: GeometricDet.cc:276
GeometricDet::isUpperSensor
bool isUpperSensor() const
Definition: GeometricDet.h:139