CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions
CmsDetConstruction< FilteredView > Class Template Reference

#include <CmsDetConstruction.h>

Inheritance diagram for CmsDetConstruction< FilteredView >:
CmsTrackerLevelBuilder< FilteredView > CmsTrackerAbstractConstruction< FilteredView >

Public Member Functions

void buildComponent (FilteredView &, GeometricDet *, const std::string &) override
 
template<>
void buildComponent (DDFilteredView &fv, GeometricDet *mother, const std::string &attribute)
 
template<>
void buildComponent (cms::DDFilteredView &fv, GeometricDet *mother, const std::string &attribute)
 
- Public Member Functions inherited from CmsTrackerLevelBuilder< FilteredView >
void build (FilteredView &, GeometricDet *, const std::string &) override
 
template<>
void build (DDFilteredView &fv, GeometricDet *tracker, const std::string &attribute)
 
template<>
void build (cms::DDFilteredView &fv, GeometricDet *tracker, const std::string &attribute)
 
 ~CmsTrackerLevelBuilder () override
 
- Public Member Functions inherited from CmsTrackerAbstractConstruction< FilteredView >
virtual ~CmsTrackerAbstractConstruction ()=default
 

Private Member Functions

void buildDets (const FilteredView &, GeometricDet *, const std::string &)
 
void buildSmallDetsfor3D (FilteredView &, GeometricDet *, const std::string &)
 
void buildSmallDetsforGlued (FilteredView &, GeometricDet *, const std::string &)
 
void buildSmallDetsforStack (FilteredView &, GeometricDet *, const std::string &)
 

Additional Inherited Members

- Protected Attributes inherited from CmsTrackerLevelBuilder< FilteredView >
CmsTrackerStringToEnum theCmsTrackerStringToEnum
 

Detailed Description

template<class FilteredView>
class CmsDetConstruction< FilteredView >

Adds GeometricDets representing final modules to the previous level

Definition at line 12 of file CmsDetConstruction.h.

Member Function Documentation

◆ buildComponent() [1/3]

template<class FilteredView>
void CmsDetConstruction< FilteredView >::buildComponent ( FilteredView &  ,
GeometricDet ,
const std::string &   
)
overridevirtual

◆ buildComponent() [2/3]

template<>
void CmsDetConstruction< DDFilteredView >::buildComponent ( DDFilteredView fv,
GeometricDet mother,
const std::string &  attribute 
)

Definition at line 73 of file CmsDetConstruction.cc.

References GeometricDet::addComponent(), ExtractStringFromDDD< FilteredView >::getString(), GeometricDet::ITPhase2Combined, GeometricDet::mergedDet, GeometricDet::OTPhase2Stack, and AlCaHLTBitMon_QueryRunRegistry::string.

75  {
76  // Mother volume
77  // Module with 2 sensors: the mother volume is the module volume.
78  // Module with 1 sensor: the mother volume is the ladder volume.
79  const std::string& myTopologicalNameInXMLs = ExtractStringFromDDD<DDFilteredView>::getString(attribute, &fv);
80  const GeometricDet::GDEnumType& myTopologicalType =
82 
83  auto det = std::make_unique<GeometricDet>(&fv, myTopologicalType);
84 
85  const bool isPhase1ModuleWith2Sensors = (myTopologicalType == GeometricDet::mergedDet);
86  const bool isPhase2ModuleWith2Sensors = (myTopologicalType == GeometricDet::OTPhase2Stack);
87  const bool isPhase2BarrelModuleWith2Sensors = (myTopologicalType == GeometricDet::ITPhase2Combined);
88 
89  // CASE A: MODULE HAS 2 SENSORS
90  if (isPhase1ModuleWith2Sensors || isPhase2ModuleWith2Sensors || isPhase2BarrelModuleWith2Sensors) {
91  // Go down in hierarchy: from module to sensor
92  bool dodets = fv.firstChild(); // very important
93  while (dodets) {
94  // PHASE 1 (MERGEDDET)
95  if (isPhase1ModuleWith2Sensors) {
96  buildSmallDetsforGlued(fv, det.get(), attribute);
97  }
98  // PHASE 2 (STACKDET)
99  else if (isPhase2ModuleWith2Sensors) {
100  buildSmallDetsforStack(fv, det.get(), attribute);
101  } else if (isPhase2BarrelModuleWith2Sensors) {
102  buildSmallDetsfor3D(fv, det.get(), attribute);
103  }
104 
105  dodets = fv.nextSibling();
106  }
107 
108  fv.parent();
109  }
110 
111  // CASE B: MODULE HAS 1 SENSOR: NOTHING SPECIFIC TO DO
112  // Indeed, we are not going to sort sensors within module, if there is only 1 sensor!
113 
114  // ALL CASES: add sensor to its mother volume (module or ladder).
115  mother->addComponent(det.release());
116 }
static std::string getString(const std::string &, FilteredView *)
void addComponent(GeometricDet *)
void buildSmallDetsforStack(FilteredView &, GeometricDet *, const std::string &)
void buildSmallDetsfor3D(FilteredView &, GeometricDet *, const std::string &)
void buildSmallDetsforGlued(FilteredView &, GeometricDet *, const std::string &)

◆ buildComponent() [3/3]

template<>
void CmsDetConstruction< cms::DDFilteredView >::buildComponent ( cms::DDFilteredView fv,
GeometricDet mother,
const std::string &  attribute 
)

Definition at line 124 of file CmsDetConstruction.cc.

References GeometricDet::addComponent(), ExtractStringFromDDD< FilteredView >::getString(), GeometricDet::ITPhase2Combined, GeometricDet::mergedDet, GeometricDet::OTPhase2Stack, and AlCaHLTBitMon_QueryRunRegistry::string.

126  {
127  // Mother volume
128  // Module with 2 sensors: the mother volume is the module volume.
129  // Module with 1 sensor: the mother volume is the ladder volume.
130  const std::string& myTopologicalNameInXMLs = ExtractStringFromDDD<cms::DDFilteredView>::getString(attribute, &fv);
131  const GeometricDet::GDEnumType& myTopologicalType =
133  auto det = std::make_unique<GeometricDet>(&fv, myTopologicalType);
134 
135  const bool isPhase1ModuleWith2Sensors = (myTopologicalType == GeometricDet::mergedDet);
136  const bool isPhase2ModuleWith2Sensors = (myTopologicalType == GeometricDet::OTPhase2Stack);
137  const bool isPhase2BarrelModuleWith2Sensors = (myTopologicalType == GeometricDet::ITPhase2Combined);
138 
139  // CASE A: MODULE HAS 2 SENSORS
140  if (isPhase1ModuleWith2Sensors || isPhase2ModuleWith2Sensors || isPhase2BarrelModuleWith2Sensors) {
141  // Go down in hierarchy: from module to sensor
142  if (!fv.firstChild()) { // very important
143  edm::LogError("CmsDetConstruction::buildComponent. Cannot go down to sensor volume.");
144  return;
145  }
146 
147  // This is the sensor hierarchy level
148  const int sensorHierarchyLevel = fv.level();
149 
150  // Loop on all siblings (ie, on all sensors)
151  while (fv.level() == sensorHierarchyLevel) {
152  // PHASE 1 (MERGEDDET)
153  if (isPhase1ModuleWith2Sensors) {
154  buildSmallDetsforGlued(fv, det.get(), attribute);
155  }
156  // PHASE 2 (STACKDET)
157  else if (isPhase2ModuleWith2Sensors) {
158  buildSmallDetsforStack(fv, det.get(), attribute);
159  } else if (isPhase2BarrelModuleWith2Sensors) {
160  buildSmallDetsfor3D(fv, det.get(), attribute);
161  }
162 
163  // Go to the next volume in FilteredView.
164  // NB: If this volume is another sensor of the same module, will stay in the loop.
165  // Otherwise, it is very important to access the next volume to be treated anyway.
166  fv.firstChild();
167  }
168  }
169 
170  // CASE B: MODULE HAS 1 SENSOR: NOTHING SPECIFIC TO DO
171  // Indeed, we are not going to sort sensors within module, if there is only 1 sensor!
172  else {
173  // Go to the next volume in FilteredView.
174  fv.firstChild();
175  }
176 
177  // ALL CASES: add sensor to its mother volume (module or ladder).
178  mother->addComponent(det.release());
179 }
static std::string getString(const std::string &, FilteredView *)
void addComponent(GeometricDet *)
void buildSmallDetsforStack(FilteredView &, GeometricDet *, const std::string &)
Log< level::Error, false > LogError
void buildSmallDetsfor3D(FilteredView &, GeometricDet *, const std::string &)
void buildSmallDetsforGlued(FilteredView &, GeometricDet *, const std::string &)

◆ buildDets()

template<class FilteredView>
void CmsDetConstruction< FilteredView >::buildDets ( const FilteredView &  ,
GeometricDet ,
const std::string &   
)
private

◆ buildSmallDetsfor3D()

template<class FilteredView >
void CmsDetConstruction< FilteredView >::buildSmallDetsfor3D ( FilteredView &  fv,
GeometricDet mother,
const std::string &  attribute 
)
private

Definition at line 48 of file CmsDetConstruction.cc.

References GeometricDet::addComponent(), and groupFilesInBlocks::temp.

50  {
51  auto det = std::make_unique<GeometricDet>(&fv,
54 
55  if (det->isFirstSensor()) {
56  uint32_t temp = 1;
57  det->setGeographicalID(DetId(temp));
58  } else if (det->isSecondSensor()) {
59  uint32_t temp = 2;
60  det->setGeographicalID(DetId(temp));
61  } else {
62  edm::LogError("DetConstruction") << " module defined in a 3D module but not first or second sensor!? ";
63  }
64  mother->addComponent(det.release());
65 }
void addComponent(GeometricDet *)
Log< level::Error, false > LogError
Definition: DetId.h:17

◆ buildSmallDetsforGlued()

template<class FilteredView >
void CmsDetConstruction< FilteredView >::buildSmallDetsforGlued ( FilteredView &  fv,
GeometricDet mother,
const std::string &  attribute 
)
private

Definition at line 10 of file CmsDetConstruction.cc.

References GeometricDet::addComponent(), and groupFilesInBlocks::temp.

12  {
13  auto det = std::make_unique<GeometricDet>(&fv,
16  if (det->stereo()) {
17  uint32_t temp = 1;
18  det->setGeographicalID(DetId(temp));
19  } else {
20  uint32_t temp = 2;
21  det->setGeographicalID(DetId(temp));
22  }
23 
24  mother->addComponent(det.release());
25 }
void addComponent(GeometricDet *)
Definition: DetId.h:17

◆ buildSmallDetsforStack()

template<class FilteredView >
void CmsDetConstruction< FilteredView >::buildSmallDetsforStack ( FilteredView &  fv,
GeometricDet mother,
const std::string &  attribute 
)
private

Definition at line 28 of file CmsDetConstruction.cc.

References GeometricDet::addComponent(), and groupFilesInBlocks::temp.

30  {
31  auto det = std::make_unique<GeometricDet>(&fv,
34 
35  if (det->isLowerSensor()) {
36  uint32_t temp = 1;
37  det->setGeographicalID(DetId(temp));
38  } else if (det->isUpperSensor()) {
39  uint32_t temp = 2;
40  det->setGeographicalID(DetId(temp));
41  } else {
42  edm::LogError("DetConstruction") << " module defined in a Stack but not upper either lower!? ";
43  }
44  mother->addComponent(det.release());
45 }
void addComponent(GeometricDet *)
Log< level::Error, false > LogError
Definition: DetId.h:17