CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 isETLtdr (FilteredView &)
 
 ~CmsMTDConstruction ()=default
 

Static Public Member Functions

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_
 
ETLNumberingScheme etlScheme_
 
CmsMTDStringToEnum theCmsMTDStringToEnum
 

Detailed Description

template<class FilteredView>
class CmsMTDConstruction< FilteredView >

Adds GeometricTimingDets representing final modules to the previous level

Definition at line 13 of file CmsMTDConstruction.h.

Constructor & Destructor Documentation

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

Definition at line 15 of file CmsMTDConstruction.cc.

15 : etlScheme_(), baseNumber_() {}
ETLNumberingScheme etlScheme_
MTDBaseNumber baseNumber_
template<class FilteredView>
CmsMTDConstruction< FilteredView >::~CmsMTDConstruction ( )
default

Member Function Documentation

template<class FilteredView>
void CmsMTDConstruction< FilteredView >::baseNumberFromHistory ( const DDGeoHistory gh)
template<class FilteredView>
void CmsMTDConstruction< FilteredView >::buildBTLModule ( FilteredView &  ,
GeometricTimingDet  
)
template<>
void CmsMTDConstruction< DDFilteredView >::buildBTLModule ( DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 39 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), DDFilteredView::copyNumbers(), Exception, CmsMTDStringToEnum::kModStrLen, timingPdfMaker::modname, DDFilteredView::name(), and AlCaHLTBitMon_QueryRunRegistry::string.

39  {
40  std::string nodeName(fv.name());
41  GeometricTimingDet* det =
43 
44  const auto& copyNumbers = fv.copyNumbers();
45  auto module_number = copyNumbers[copyNumbers.size() - 2];
46 
47  constexpr char positive[] = "PositiveZ";
48  constexpr char negative[] = "NegativeZ";
49 
50  const std::string modname(fv.name());
51  size_t delim1 = modname.find("BModule");
52  size_t delim2 = modname.find("Layer");
53  module_number += atoi(modname.substr(delim1 + CmsMTDStringToEnum::kModStrLen, delim2).c_str()) - 1;
54 
55 #ifdef EDM_ML_DEBUG
56  edm::LogVerbatim("MTDNumbering") << "BTLModule = " << modname << " " << copyNumbers[copyNumbers.size() - 3] << " "
57  << module_number;
58 #endif
59 
60  if (modname.find(positive) != std::string::npos) {
61  det->setGeographicalID(BTLDetId(1, copyNumbers[copyNumbers.size() - 3], module_number, 0, 1));
62  } else if (modname.find(negative) != std::string::npos) {
63  det->setGeographicalID(BTLDetId(0, copyNumbers[copyNumbers.size() - 3], module_number, 0, 1));
64  } else {
65  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
66  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
67  }
68 
69  mother->addComponent(det);
70 }
Log< level::Info, true > LogVerbatim
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
const std::string & name() const
The name of a logical-part of the current node in the filtered-view.
nav_type copyNumbers() const
return the stack of copy numbers
CmsMTDStringToEnum theCmsMTDStringToEnum
static constexpr size_t kModStrLen
void addComponent(GeometricTimingDet *)
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
template<>
void CmsMTDConstruction< cms::DDFilteredView >::buildBTLModule ( cms::DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 73 of file CmsMTDConstruction.cc.

References GeometricTimingDet::addComponent(), cms::DDFilteredView::copyNumbers(), Exception, CmsMTDStringToEnum::kModStrLen, timingPdfMaker::modname, cms::DDFilteredView::name(), cms::DDFilteredView::path(), and AlCaHLTBitMon_QueryRunRegistry::string.

73  {
74  std::string nodeName(fv.name());
75  GeometricTimingDet* det =
77 
78  const auto& copyNumbers = fv.copyNumbers();
79  auto module_number = copyNumbers[1];
80 
81  constexpr char positive[] = "PositiveZ";
82  constexpr char negative[] = "NegativeZ";
83 
84  const std::string modname(fv.name());
85  size_t delim1 = modname.find("BModule");
86  size_t delim2 = modname.find("Layer");
87  module_number += atoi(modname.substr(delim1 + CmsMTDStringToEnum::kModStrLen, delim2).c_str()) - 1;
88 
89 #ifdef EDM_ML_DEBUG
90  edm::LogVerbatim("MTDNumbering") << fv.path() << "\nBTLModule = " << modname << " " << copyNumbers[2] << " "
91  << module_number;
92 #endif
93 
94  if (modname.find(positive) != std::string::npos) {
95  det->setGeographicalID(BTLDetId(1, copyNumbers[2], module_number, 0, 1));
96  } else if (modname.find(negative) != std::string::npos) {
97  det->setGeographicalID(BTLDetId(0, copyNumbers[2], module_number, 0, 1));
98  } else {
99  throw cms::Exception("CmsMTDConstruction::buildBTLModule")
100  << "BTL Module " << module_number << " is neither positive nor negative in Z!";
101  }
102 
103  mother->addComponent(det);
104 }
Log< level::Info, true > LogVerbatim
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
auto copyNumbers(Ts &&...ts) const -> decltype(copyNos(std::forward< Ts >(ts)...))
CmsMTDStringToEnum theCmsMTDStringToEnum
static constexpr size_t kModStrLen
void addComponent(GeometricTimingDet *)
std::string_view name() const
const std::string path() const
The full path to the current node.
Detector identifier class for the Barrel Timing Layer. The crystal count must start from 0...
Definition: BTLDetId.h:18
template<class FilteredView>
void CmsMTDConstruction< FilteredView >::buildETLModule ( FilteredView &  ,
GeometricTimingDet  
)
template<>
void CmsMTDConstruction< DDFilteredView >::buildETLModule ( DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 107 of file CmsMTDConstruction.cc.

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

107  {
108  std::string nodeName(fv.name());
109  GeometricTimingDet* det =
111 
112  if (isETLtdr(fv)) {
113  //
114  // For the TDR ETL geometry
115  // in principle this method works also for the new geometry, if the main loop points to "Timingactive"
116  // but backward compatibility is kept in order to avoid change in volume name and number of siblings
117  //
118 
119  auto& gh = fv.geoHistory();
120 
121  baseNumber_.reset();
122  baseNumber_.setSize(gh.size());
123 
124  for (uint i = gh.size(); i-- > 0;) {
125  baseNumber_.addLevel(gh[i].logicalPart().name().name(), gh[i].copyno());
126 #ifdef EDM_ML_DEBUG
127  edm::LogVerbatim("CmsMTDConstruction") << gh[i].logicalPart().name().name() << " " << gh[i].copyno();
128 #endif
129  }
130 
131  det->setGeographicalID(ETLDetId(etlScheme_.getUnitID(baseNumber_)));
132 
133  } else {
134  const auto& copyNumbers = fv.copyNumbers();
135  auto module_number = copyNumbers[copyNumbers.size() - 2];
136 
137  size_t delim_ring = det->name().find("EModule");
138  size_t delim_disc = det->name().find("Disc");
139 
140  std::string ringN = det->name().substr(delim_ring + CmsMTDStringToEnum::kModStrLen, delim_disc);
141 
142  const uint32_t side = det->translation().z() > 0 ? 1 : 0;
143 
144  // label geographic detid is front or back (even though it is one module per entry here)
145  det->setGeographicalID(ETLDetId(side, atoi(ringN.c_str()), module_number, 0));
146  }
147 
148  mother->addComponent(det);
149 }
Log< level::Info, true > LogVerbatim
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
const std::string & name() const
The name of a logical-part of the current node in the filtered-view.
nav_type copyNumbers() const
return the stack of copy numbers
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
const DDGeoHistory & geoHistory() const
The list of ancestors up to the root-node of the current node.
static constexpr size_t kModStrLen
void addComponent(GeometricTimingDet *)
bool isETLtdr(FilteredView &)
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_
template<>
void CmsMTDConstruction< cms::DDFilteredView >::buildETLModule ( cms::DDFilteredView fv,
GeometricTimingDet mother 
)

Definition at line 152 of file CmsMTDConstruction.cc.

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

152  {
153  std::string nodeName(fv.name());
154  GeometricTimingDet* det =
156 
157  baseNumber_.reset();
158  baseNumber_.setSize(fv.copyNos().size());
159 
160  for (uint i = 0; i < fv.copyNos().size(); i++) {
161  std::string_view name((fv.geoHistory()[i])->GetName());
162  size_t ipos = name.rfind('_');
163  baseNumber_.addLevel(name.substr(0, ipos), fv.copyNos()[i]);
164 #ifdef EDM_ML_DEBUG
165  edm::LogVerbatim("CmsMTDConstruction") << name.substr(0, ipos) << " " << fv.copyNos()[i];
166 #endif
167  }
168 
169  det->setGeographicalID(ETLDetId(etlScheme_.getUnitID(baseNumber_)));
170 
171  mother->addComponent(det);
172 }
Log< level::Info, true > LogVerbatim
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void addLevel(const std::string_view name, const int copyNumber)
static constexpr size_t kModStrLen
const std::vector< const Node * > geoHistory() const
void addComponent(GeometricTimingDet *)
std::string_view name() const
const std::vector< int > copyNos() const
The list of the volume copy numbers.
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_
template<class FilteredView >
GeometricTimingDet * CmsMTDConstruction< FilteredView >::buildLayer ( FilteredView &  fv)

Definition at line 193 of file CmsMTDConstruction.cc.

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

Referenced by DDCmsMTDConstruction::construct().

193  {
194  std::string nodeName(fv.name());
195  auto thisDet = theCmsMTDStringToEnum.type(nodeName);
196  GeometricTimingDet* layer = new GeometricTimingDet(&fv, thisDet);
197 
198  if (thisDet != GeometricTimingDet::BTLLayer && thisDet != GeometricTimingDet::ETLDisc) {
199  throw cms::Exception("CmsMTDConstruction") << " ERROR - I was expecting a SubDet, I got a " << fv.name();
200  }
201 
202  uint32_t nLayer;
203  if (thisDet == GeometricTimingDet::BTLLayer) {
204  //
205  // only one layer in BTL
206  //
207  nLayer = 1;
208  layer->setGeographicalID(nLayer);
209  } else if (thisDet == GeometricTimingDet::ETLDisc) {
210  //
211  // no change for pre TDR scenarios, otherwise identifiy layer with disc
212  //
213  nLayer = (fv.name().find("Disc1") != std::string::npos) ? 1 : 2;
214  layer->setGeographicalID(nLayer);
215  }
216 
217  return layer;
218 }
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
constexpr std::array< uint8_t, layerIndexSize > layer
void setGeographicalID(DetId id)
template<class FilteredView >
GeometricTimingDet * CmsMTDConstruction< FilteredView >::buildSubdet ( FilteredView &  fv)

Definition at line 175 of file CmsMTDConstruction.cc.

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

Referenced by DDCmsMTDConstruction::construct().

175  {
176  std::string nodeName(fv.name());
177  auto thisDet = theCmsMTDStringToEnum.type(nodeName);
178  GeometricTimingDet* subdet = new GeometricTimingDet(&fv, thisDet);
179 
180  if (thisDet == GeometricTimingDet::BTL) {
181  subdet->setGeographicalID(BTLDetId(0, 0, 0, 0, 0));
182  } else if (thisDet == GeometricTimingDet::ETL) {
183  const uint32_t side = subdet->translation().z() > 0 ? 1 : 0;
184  subdet->setGeographicalID(ETLDetId(side, 0, 0, 0));
185  } else {
186  throw cms::Exception("CmsMTDConstruction") << " ERROR - I was expecting a SubDet, I got a " << fv.name();
187  }
188 
189  return subdet;
190 }
GeometricTimingDet::GeometricTimingEnumType type(std::string const &) const
CmsMTDStringToEnum theCmsMTDStringToEnum
void setGeographicalID(DetId id)
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:18
Translation const & translation() const
template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::isETLtdr ( FilteredView &  fv)

Definition at line 221 of file CmsMTDConstruction.cc.

Referenced by DDCmsMTDConstruction::construct().

221  {
222  return (fv.name() == "EModule_Timingactive");
223 }
template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderPhi ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 32 of file CmsMTDConstruction.cc.

References GeometricTimingDet::geographicalId(), angle0to2pi::make0To2pi(), and GeometricTimingDet::phi().

32  {
33  MTDDetId id1(a->geographicalId());
34  MTDDetId id2(b->geographicalId());
35  return (id1.mtdRR() == id2.mtdRR()) && (angle0to2pi::make0To2pi(a->phi()) < angle0to2pi::make0To2pi(b->phi()));
36 }
DetId geographicalId() const
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
double phi() const
constexpr valType make0To2pi(valType angle)
Definition: deltaPhi.h:67
template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderRR ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 25 of file CmsMTDConstruction.cc.

References GeometricTimingDet::geographicalId(), and MTDDetId::mtdRR().

25  {
26  MTDDetId id1(a->geographicalId());
27  MTDDetId id2(b->geographicalId());
28  return id1.mtdRR() < id2.mtdRR();
29 }
DetId geographicalId() const
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
int mtdRR() const
Definition: MTDDetId.h:64
template<class FilteredView >
bool CmsMTDConstruction< FilteredView >::mtdOrderZ ( const GeometricTimingDet a,
const GeometricTimingDet b 
)
static

Definition at line 18 of file CmsMTDConstruction.cc.

References GeometricTimingDet::translation().

18  {
19  bool order = (a->translation().z() == b->translation().z()) ? a->translation().rho() < b->translation().rho()
20  : a->translation().z() < b->translation().z();
21  return order;
22 }
Translation const & translation() const

Member Data Documentation

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

Definition at line 36 of file CmsMTDConstruction.h.

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

Definition at line 35 of file CmsMTDConstruction.h.

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

Definition at line 33 of file CmsMTDConstruction.h.