CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Protected Attributes
CmsMTDConstruction< FilteredView > Class Template Reference

#include <CmsMTDConstruction.h>

Public Member Functions

void baseNumberFromHistory (const DDGeoHistory &gh)
 
void buildBTLModule (FilteredView &, GeometricTimingDet *)
 
template<>
void buildBTLModule (DDFilteredView &fv, GeometricTimingDet *mother)
 
template<>
void buildBTLModule (cms::DDFilteredView &fv, GeometricTimingDet *mother)
 
void buildETLModule (FilteredView &, GeometricTimingDet *)
 
template<>
void buildETLModule (DDFilteredView &fv, GeometricTimingDet *mother)
 
template<>
void buildETLModule (cms::DDFilteredView &fv, GeometricTimingDet *mother)
 
GeometricTimingDetbuildLayer (FilteredView &)
 
GeometricTimingDetbuildSubdet (FilteredView &)
 
 CmsMTDConstruction ()
 
bool isBTLV2 (FilteredView &)
 
bool isETLtdr (FilteredView &)
 
 ~CmsMTDConstruction ()=default
 

Static Public Member Functions

static bool btlOrderPhi (const GeometricTimingDet *a, const GeometricTimingDet *b)
 
static bool btlOrderZ (const GeometricTimingDet *a, const GeometricTimingDet *b)
 
static bool mtdOrderPhi (const GeometricTimingDet *a, const GeometricTimingDet *b)
 
static bool mtdOrderRR (const GeometricTimingDet *a, const GeometricTimingDet *b)
 
static bool mtdOrderZ (const GeometricTimingDet *a, const GeometricTimingDet *b)
 

Protected Attributes

MTDBaseNumber baseNumber_
 
BTLNumberingScheme btlScheme_
 
ETLNumberingScheme etlScheme_
 
CmsMTDStringToEnum theCmsMTDStringToEnum
 

Detailed Description

template<class FilteredView>
class CmsMTDConstruction< FilteredView >

Adds GeometricTimingDets representing final modules to the previous level

Definition at line 14 of file CmsMTDConstruction.h.

Constructor & Destructor Documentation

◆ CmsMTDConstruction()

template<class FilteredView >
CmsMTDConstruction< FilteredView >::CmsMTDConstruction ( )

Definition at line 17 of file CmsMTDConstruction.cc.

BTLNumberingScheme btlScheme_
ETLNumberingScheme etlScheme_
MTDBaseNumber baseNumber_

◆ ~CmsMTDConstruction()

template<class FilteredView>
CmsMTDConstruction< FilteredView >::~CmsMTDConstruction ( )
default

Member Function Documentation

◆ baseNumberFromHistory()

template<class FilteredView>
void CmsMTDConstruction< FilteredView >::baseNumberFromHistory ( const DDGeoHistory gh)

◆ btlOrderPhi()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::btlOrderPhi ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 41 of file CmsMTDConstruction.cc.

References a, b, angle_units::operators::convertRadToDeg(), and angle0to2pi::make0To2pi().

41  {
42  return static_cast<int>(convertRadToDeg(angle0to2pi::make0To2pi(a->phi()))) <
43  static_cast<int>(convertRadToDeg(angle0to2pi::make0To2pi(b->phi())));
44 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
double b
Definition: hdecay.h:118
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
double a
Definition: hdecay.h:119

◆ btlOrderZ()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::btlOrderZ ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 47 of file CmsMTDConstruction.cc.

References a, b, angle_units::operators::convertRadToDeg(), angle0to2pi::make0To2pi(), and eventshapeDQM_cfi::order.

47  {
48  bool order = (static_cast<int>(convertRadToDeg(angle0to2pi::make0To2pi(a->phi()))) ==
49  static_cast<int>(convertRadToDeg(angle0to2pi::make0To2pi(b->phi())))) &&
50  (a->translation().z() < b->translation().z());
51  return order;
52 }
constexpr NumType convertRadToDeg(NumType radians)
Definition: angle_units.h:21
double b
Definition: hdecay.h:118
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
double a
Definition: hdecay.h:119

◆ buildBTLModule() [1/3]

template<class FilteredView>
void CmsMTDConstruction< FilteredView >::buildBTLModule ( FilteredView &  ,
GeometricTimingDet  
)

◆ buildBTLModule() [2/3]

template<>
void CmsMTDConstruction< DDFilteredView >::buildBTLModule ( DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 55 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), DDFilteredView::copyNumbers(), Exception, DDFilteredView::geoHistory(), mps_fire::i, CmsMTDStringToEnum::kModStrLen, timingPdfMaker::modname, Skims_PA_cff::name, DDFilteredView::name(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

55  {
56  std::string nodeName(fv.name());
57  GeometricTimingDet* det =
59 
60  if (isBTLV2(fv)) {
61  auto& gh = fv.geoHistory();
62 
64  baseNumber_.setSize(gh.size());
65 
66  for (uint i = gh.size(); i-- > 0;) {
67  baseNumber_.addLevel(gh[i].logicalPart().name().name(), gh[i].copyno());
68 #ifdef EDM_ML_DEBUG
69  edm::LogVerbatim("CmsMTDConstruction") << gh[i].logicalPart().name().name() << " " << gh[i].copyno();
70 #endif
71  }
72 
73  det->setGeographicalID(BTLDetId(btlScheme_.getUnitID(baseNumber_)));
74 
75  } else {
76  const auto& copyNumbers = fv.copyNumbers();
77  auto module_number = copyNumbers[copyNumbers.size() - 2];
78 
79  constexpr char positive[] = "PositiveZ";
80  constexpr char negative[] = "NegativeZ";
81 
82  const std::string& modname(fv.name());
83  size_t delim1 = modname.find("BModule");
84  size_t delim2 = modname.find("Layer");
85  module_number += atoi(modname.substr(delim1 + CmsMTDStringToEnum::kModStrLen, delim2).c_str()) - 1;
86 
87 #ifdef EDM_ML_DEBUG
88  edm::LogVerbatim("CmsMTDConstruction")
89  << "BTLModule = " << modname << " " << copyNumbers[copyNumbers.size() - 3] << " " << module_number;
90 #endif
91 
92  if (modname.find(positive) != std::string::npos) {
93  det->setGeographicalID(BTLDetId(1, copyNumbers[copyNumbers.size() - 3], module_number, 0, 1));
94  } else if (modname.find(negative) != std::string::npos) {
95  det->setGeographicalID(BTLDetId(0, copyNumbers[copyNumbers.size() - 3], module_number, 0, 1));
96  } else {
97  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
98  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
99  }
100  }
101 
102  mother->addComponent(det);
103 }
Log< level::Info, true > LogVerbatim
bool isBTLV2(FilteredView &)
nav_type copyNumbers() const
return the stack of copy numbers
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const std::string & name() const
The name of a logical-part of the current node in the filtered-view.
static constexpr size_t kModStrLen
BTLNumberingScheme btlScheme_
void addComponent(GeometricTimingDet *)
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19
void setSize(const int size)
MTDBaseNumber baseNumber_

◆ buildBTLModule() [3/3]

template<>
void CmsMTDConstruction< cms::DDFilteredView >::buildBTLModule ( cms::DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 106 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), cms::DDFilteredView::copyNos(), cms::DDFilteredView::copyNumbers(), Exception, cms::DDFilteredView::geoHistory(), mps_fire::i, CmsMTDStringToEnum::kModStrLen, timingPdfMaker::modname, Skims_PA_cff::name, cms::DDFilteredView::name(), cms::DDFilteredView::path(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

106  {
107  std::string nodeName(fv.name());
108  GeometricTimingDet* det =
110 
111  if (isBTLV2(fv)) {
112  baseNumber_.reset();
113  baseNumber_.setSize(fv.copyNos().size());
114 
115  for (uint i = 0; i < fv.copyNos().size(); i++) {
116  std::string_view name((fv.geoHistory()[i])->GetName());
117  size_t ipos = name.rfind('_');
118  baseNumber_.addLevel(name.substr(0, ipos), fv.copyNos()[i]);
119 #ifdef EDM_ML_DEBUG
120  edm::LogVerbatim("CmsMTDConstruction") << name.substr(0, ipos) << " " << fv.copyNos()[i];
121 #endif
122  }
123 
124  det->setGeographicalID(BTLDetId(btlScheme_.getUnitID(baseNumber_)));
125 
126  } else {
127  const auto& copyNumbers = fv.copyNumbers();
128  auto module_number = copyNumbers[1];
129 
130  constexpr char positive[] = "PositiveZ";
131  constexpr char negative[] = "NegativeZ";
132 
133  const std::string modname(fv.name());
134  size_t delim1 = modname.find("BModule");
135  size_t delim2 = modname.find("Layer");
136  module_number += atoi(modname.substr(delim1 + CmsMTDStringToEnum::kModStrLen, delim2).c_str()) - 1;
137 
138 #ifdef EDM_ML_DEBUG
139  edm::LogVerbatim("MTDNumbering") << fv.path() << "\nBTLModule = " << modname << " " << copyNumbers[2] << " "
140  << module_number;
141 #endif
142 
143  if (modname.find(positive) != std::string::npos) {
144  det->setGeographicalID(BTLDetId(1, copyNumbers[2], module_number, 0, 1));
145  } else if (modname.find(negative) != std::string::npos) {
146  det->setGeographicalID(BTLDetId(0, copyNumbers[2], module_number, 0, 1));
147  } else {
148  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
149  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
150  }
151  }
152 
153  mother->addComponent(det);
154 }
Log< level::Info, true > LogVerbatim
bool isBTLV2(FilteredView &)
const std::vector< int > copyNos() const
The list of the volume copy numbers.
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
const std::string path() const
The full path to the current node.
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const std::vector< const Node * > geoHistory() const
static constexpr size_t kModStrLen
std::string_view name() const
BTLNumberingScheme btlScheme_
void addComponent(GeometricTimingDet *)
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19
auto copyNumbers(Ts &&... ts) const -> decltype(copyNos(std::forward< Ts >(ts)...))
void setSize(const int size)
MTDBaseNumber baseNumber_

◆ buildETLModule() [1/3]

template<class FilteredView>
void CmsMTDConstruction< FilteredView >::buildETLModule ( FilteredView &  ,
GeometricTimingDet  
)

◆ buildETLModule() [2/3]

template<>
void CmsMTDConstruction< DDFilteredView >::buildETLModule ( DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 157 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), DDFilteredView::copyNumbers(), DDFilteredView::geoHistory(), mps_fire::i, CmsMTDStringToEnum::kModStrLen, Skims_PA_cff::name, DDFilteredView::name(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

157  {
158  std::string nodeName(fv.name());
159  GeometricTimingDet* det =
161 
162  if (isETLtdr(fv)) {
163  //
164  // For the TDR ETL geometry
165  // in principle this method works also for the new geometry, if the main loop points to "Timingactive"
166  // but backward compatibility is kept in order to avoid change in volume name and number of siblings
167  //
168 
169  auto& gh = fv.geoHistory();
170 
171  baseNumber_.reset();
172  baseNumber_.setSize(gh.size());
173 
174  for (uint i = gh.size(); i-- > 0;) {
175  baseNumber_.addLevel(gh[i].logicalPart().name().name(), gh[i].copyno());
176 #ifdef EDM_ML_DEBUG
177  edm::LogVerbatim("CmsMTDConstruction") << gh[i].logicalPart().name().name() << " " << gh[i].copyno();
178 #endif
179  }
180 
181  det->setGeographicalID(ETLDetId(etlScheme_.getUnitID(baseNumber_)));
182 
183  } else {
184  const auto& copyNumbers = fv.copyNumbers();
185  auto module_number = copyNumbers[copyNumbers.size() - 2];
186 
187  size_t delim_ring = det->name().find("EModule");
188  size_t delim_disc = det->name().find("Disc");
189 
190  std::string ringN = det->name().substr(delim_ring + CmsMTDStringToEnum::kModStrLen, delim_disc);
191 
192  const uint32_t side = det->translation().z() > 0 ? 1 : 0;
193 
194  // label geographic detid is front or back (even though it is one module per entry here)
195  det->setGeographicalID(ETLDetId(side, atoi(ringN.c_str()), module_number, 0));
196  }
197 
198  mother->addComponent(det);
199 }
Log< level::Info, true > LogVerbatim
nav_type copyNumbers() const
return the stack of copy numbers
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const std::string & name() const
The name of a logical-part of the current node in the filtered-view.
static constexpr size_t kModStrLen
void addComponent(GeometricTimingDet *)
bool isETLtdr(FilteredView &)
ETLNumberingScheme etlScheme_
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
void setSize(const int size)
MTDBaseNumber baseNumber_

◆ buildETLModule() [3/3]

template<>
void CmsMTDConstruction< cms::DDFilteredView >::buildETLModule ( cms::DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 202 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), cms::DDFilteredView::copyNos(), cms::DDFilteredView::geoHistory(), mps_fire::i, CmsMTDStringToEnum::kModStrLen, Skims_PA_cff::name, cms::DDFilteredView::name(), AlCaHLTBitMon_QueryRunRegistry::string, and parallelization::uint.

202  {
203  std::string nodeName(fv.name());
204  GeometricTimingDet* det =
206 
207  baseNumber_.reset();
208  baseNumber_.setSize(fv.copyNos().size());
209 
210  for (uint i = 0; i < fv.copyNos().size(); i++) {
211  std::string_view name((fv.geoHistory()[i])->GetName());
212  size_t ipos = name.rfind('_');
213  baseNumber_.addLevel(name.substr(0, ipos), fv.copyNos()[i]);
214 #ifdef EDM_ML_DEBUG
215  edm::LogVerbatim("CmsMTDConstruction") << name.substr(0, ipos) << " " << fv.copyNos()[i];
216 #endif
217  }
218 
219  det->setGeographicalID(ETLDetId(etlScheme_.getUnitID(baseNumber_)));
220 
221  mother->addComponent(det);
222 }
Log< level::Info, true > LogVerbatim
const std::vector< int > copyNos() const
The list of the volume copy numbers.
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const std::vector< const Node * > geoHistory() const
static constexpr size_t kModStrLen
std::string_view name() const
void addComponent(GeometricTimingDet *)
ETLNumberingScheme etlScheme_
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
uint32_t getUnitID(const MTDBaseNumber &baseNumber) const override
void setSize(const int size)
MTDBaseNumber baseNumber_

◆ buildLayer()

template<class FilteredView >
GeometricTimingDet * CmsMTDConstruction< FilteredView >::buildLayer ( FilteredView &  fv)

Definition at line 243 of file CmsMTDConstruction.cc.

References Exception, pixelTopology::layer, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by DDCmsMTDConstruction::construct().

243  {
244  std::string nodeName(fv.name());
245  auto thisDet = theCmsMTDStringToEnum.type(nodeName);
246  GeometricTimingDet* layer = new GeometricTimingDet(&fv, thisDet);
247 
248  if (thisDet != GeometricTimingDet::BTLLayer && thisDet != GeometricTimingDet::ETLDisc) {
249  throw cms::Exception("CmsMTDConstruction") << " ERROR - I was expecting a SubDet, I got a " << fv.name();
250  }
251 
252  uint32_t nLayer;
253  if (thisDet == GeometricTimingDet::BTLLayer) {
254  //
255  // only one layer in BTL
256  //
257  nLayer = 1;
258  layer->setGeographicalID(nLayer);
259  } else if (thisDet == GeometricTimingDet::ETLDisc) {
260  //
261  // no change for pre TDR scenarios, otherwise identifiy layer with disc
262  //
263  nLayer = (fv.name().find("Disc1") != std::string::npos) ? 1 : 2;
264  layer->setGeographicalID(nLayer);
265  }
266 
267  return layer;
268 }
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
constexpr std::array< uint8_t, layerIndexSize< TrackerTraits > > layer

◆ buildSubdet()

template<class FilteredView >
GeometricTimingDet * CmsMTDConstruction< FilteredView >::buildSubdet ( FilteredView &  fv)

Definition at line 225 of file CmsMTDConstruction.cc.

References Exception, GeometricTimingDet::setGeographicalID(), AlCaHLTBitMon_QueryRunRegistry::string, and GeometricTimingDet::translation().

Referenced by DDCmsMTDConstruction::construct().

225  {
226  std::string nodeName(fv.name());
227  auto thisDet = theCmsMTDStringToEnum.type(nodeName);
228  GeometricTimingDet* subdet = new GeometricTimingDet(&fv, thisDet);
229 
230  if (thisDet == GeometricTimingDet::BTL) {
231  subdet->setGeographicalID(BTLDetId(0, 0, 0, 0, 0));
232  } else if (thisDet == GeometricTimingDet::ETL) {
233  const uint32_t side = subdet->translation().z() > 0 ? 1 : 0;
234  subdet->setGeographicalID(ETLDetId(side, 0, 0, 0));
235  } else {
236  throw cms::Exception("CmsMTDConstruction") << " ERROR - I was expecting a SubDet, I got a " << fv.name();
237  }
238 
239  return subdet;
240 }
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void setGeographicalID(DetId id)
Translation const & translation() const
Detector identifier class for the Endcap Timing Layer.
Definition: ETLDetId.h:15
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:19

◆ isBTLV2()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::isBTLV2 ( FilteredView &  fv)

Definition at line 271 of file CmsMTDConstruction.cc.

Referenced by DDCmsMTDConstruction::construct().

271  {
272  return (fv.name().substr(0, 9) == "BTLModule");
273 }

◆ isETLtdr()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::isETLtdr ( FilteredView &  fv)

Definition at line 276 of file CmsMTDConstruction.cc.

Referenced by DDCmsMTDConstruction::construct().

276  {
277  return (fv.name() == "EModule_Timingactive");
278 }

◆ mtdOrderPhi()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderPhi ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 34 of file CmsMTDConstruction.cc.

References a, b, globals_cff::id1, globals_cff::id2, and angle0to2pi::make0To2pi().

34  {
35  MTDDetId id1(a->geographicalId());
36  MTDDetId id2(b->geographicalId());
37  return (id1.mtdRR() == id2.mtdRR()) && (angle0to2pi::make0To2pi(a->phi()) < angle0to2pi::make0To2pi(b->phi()));
38 }
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
double b
Definition: hdecay.h:118
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
double a
Definition: hdecay.h:119

◆ mtdOrderRR()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderRR ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 27 of file CmsMTDConstruction.cc.

References a, b, globals_cff::id1, and globals_cff::id2.

27  {
28  MTDDetId id1(a->geographicalId());
29  MTDDetId id2(b->geographicalId());
30  return id1.mtdRR() < id2.mtdRR();
31 }
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

◆ mtdOrderZ()

template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderZ ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 20 of file CmsMTDConstruction.cc.

References a, b, and eventshapeDQM_cfi::order.

20  {
21  bool order = (a->translation().z() == b->translation().z()) ? a->translation().rho() < b->translation().rho()
22  : a->translation().z() < b->translation().z();
23  return order;
24 }
double b
Definition: hdecay.h:118
double a
Definition: hdecay.h:119

Member Data Documentation

◆ baseNumber_

template<class FilteredView>
MTDBaseNumber CmsMTDConstruction< FilteredView >::baseNumber_
protected

Definition at line 42 of file CmsMTDConstruction.h.

◆ btlScheme_

template<class FilteredView>
BTLNumberingScheme CmsMTDConstruction< FilteredView >::btlScheme_
protected

Definition at line 40 of file CmsMTDConstruction.h.

◆ etlScheme_

template<class FilteredView>
ETLNumberingScheme CmsMTDConstruction< FilteredView >::etlScheme_
protected

Definition at line 41 of file CmsMTDConstruction.h.

◆ theCmsMTDStringToEnum

template<class FilteredView>
CmsMTDStringToEnum CmsMTDConstruction< FilteredView >::theCmsMTDStringToEnum
protected

Definition at line 38 of file CmsMTDConstruction.h.