CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes | Friends
MTDDetLayerGeometry Class Reference

#include <MTDDetLayerGeometry.h>

Inheritance diagram for MTDDetLayerGeometry:
DetLayerGeometry

Public Member Functions

const std::vector< const DetLayer * > & allBackwardLayers () const
 return all endcap layers More...
 
const std::vector< const DetLayer * > & allBarrelLayers () const
 return all barrel layers More...
 
const std::vector< const DetLayer * > & allBTLLayers () const
 return the BTL DetLayers (barrel), inside-out More...
 
const std::vector< const DetLayer * > & allEndcapLayers () const
 return all endcap layers More...
 
const std::vector< const DetLayer * > & allETLLayers () const
 return the ETL DetLayers (endcap), -Z to +Z More...
 
const std::vector< const DetLayer * > & allForwardLayers () const
 return all endcap layers More...
 
const std::vector< const DetLayer * > & allLayers () const
 return all DetLayers (barrel + endcap), -Z to +Z More...
 
void buildLayers (const MTDGeometry *geo, const MTDTopology *mtopo)
 
const DetLayeridToLayer (const DetId &detId) const override
 return the DetLayer which correspond to a certain DetId More...
 
 MTDDetLayerGeometry ()
 Constructor. More...
 
void sortLayers ()
 
 ~MTDDetLayerGeometry () override
 Destructor. More...
 
- Public Member Functions inherited from DetLayerGeometry
 DetLayerGeometry ()
 
virtual ~DetLayerGeometry ()
 

Private Member Functions

void addBTLLayers (const std::vector< DetLayer *> &btllayers)
 
void addETLLayers (const std::pair< std::vector< DetLayer *>, std::vector< DetLayer *> > &etllayers)
 
DetId makeDetLayerId (const DetLayer *detLayer) const
 

Private Attributes

std::vector< const DetLayer * > allBackward
 
std::vector< const DetLayer * > allBarrel
 
std::vector< const DetLayer * > allDetLayers
 
std::vector< const DetLayer * > allEndcap
 
std::vector< const DetLayer * > allForward
 
std::vector< const DetLayer * > btlLayers
 
std::map< DetId, const DetLayer * > detLayersMap
 
std::vector< const DetLayer * > etlLayers_all
 
std::vector< const DetLayer * > etlLayers_bk
 
std::vector< const DetLayer * > etlLayers_fw
 

Friends

class MTDDetLayerGeometryESProducer
 

Detailed Description

Provide access to the DetLayers of mip timing detectors.

Author
L. Gray - FNAL

Definition at line 22 of file MTDDetLayerGeometry.h.

Constructor & Destructor Documentation

◆ MTDDetLayerGeometry()

MTDDetLayerGeometry::MTDDetLayerGeometry ( )

Constructor.

Definition at line 26 of file MTDDetLayerGeometry.cc.

26 {}

◆ ~MTDDetLayerGeometry()

MTDDetLayerGeometry::~MTDDetLayerGeometry ( )
override

Destructor.

Definition at line 28 of file MTDDetLayerGeometry.cc.

28 {}

Member Function Documentation

◆ addBTLLayers()

void MTDDetLayerGeometry::addBTLLayers ( const std::vector< DetLayer *> &  btllayers)
private

Definition at line 66 of file MTDDetLayerGeometry.cc.

66  {
67  for (auto const it : dtlayers) {
68  btlLayers.push_back(it);
69  allBarrel.push_back(it);
70 
71  detLayersMap[makeDetLayerId(it)] = it;
72  }
73 }
std::map< DetId, const DetLayer * > detLayersMap
std::vector< const DetLayer * > allBarrel
DetId makeDetLayerId(const DetLayer *detLayer) const
std::vector< const DetLayer * > btlLayers

◆ addETLLayers()

void MTDDetLayerGeometry::addETLLayers ( const std::pair< std::vector< DetLayer *>, std::vector< DetLayer *> > &  etllayers)
private

Add ETL layers etllayers.first=forward (+Z), etllayers.second=backward (-Z) both vectors are ASSUMED to be sorted inside-out

Definition at line 50 of file MTDDetLayerGeometry.cc.

50  {
51  for (auto const it : etllayers.first) {
52  etlLayers_fw.push_back(it);
53  allForward.push_back(it);
54 
55  detLayersMap[makeDetLayerId(it)] = it;
56  }
57 
58  for (auto const it : etllayers.second) {
59  etlLayers_bk.push_back(it);
60  allBackward.push_back(it);
61 
62  detLayersMap[makeDetLayerId(it)] = it;
63  }
64 }
std::vector< const DetLayer * > etlLayers_fw
std::vector< const DetLayer * > etlLayers_bk
std::map< DetId, const DetLayer * > detLayersMap
std::vector< const DetLayer * > allBackward
DetId makeDetLayerId(const DetLayer *detLayer) const
std::vector< const DetLayer * > allForward

◆ allBackwardLayers()

const vector< const DetLayer * > & MTDDetLayerGeometry::allBackwardLayers ( ) const

return all endcap layers

Definition at line 92 of file MTDDetLayerGeometry.cc.

Referenced by GeometricSearchTrackerBuilder::build().

92 { return allBackward; }
std::vector< const DetLayer * > allBackward

◆ allBarrelLayers()

const vector< const DetLayer * > & MTDDetLayerGeometry::allBarrelLayers ( ) const

return all barrel layers

Definition at line 86 of file MTDDetLayerGeometry.cc.

Referenced by GeometricSearchTrackerBuilder::build().

86 { return allBarrel; }
std::vector< const DetLayer * > allBarrel

◆ allBTLLayers()

const vector< const DetLayer * > & MTDDetLayerGeometry::allBTLLayers ( ) const

return the BTL DetLayers (barrel), inside-out

Definition at line 94 of file MTDDetLayerGeometry.cc.

Referenced by TrackExtenderWithMTDT< TrackCollection >::tryBTLLayers().

94 { return btlLayers; }
std::vector< const DetLayer * > btlLayers

◆ allEndcapLayers()

const vector< const DetLayer * > & MTDDetLayerGeometry::allEndcapLayers ( ) const

return all endcap layers

Definition at line 88 of file MTDDetLayerGeometry.cc.

88 { return allEndcap; }
std::vector< const DetLayer * > allEndcap

◆ allETLLayers()

const vector< const DetLayer * > & MTDDetLayerGeometry::allETLLayers ( ) const

return the ETL DetLayers (endcap), -Z to +Z

Definition at line 96 of file MTDDetLayerGeometry.cc.

Referenced by TrackExtenderWithMTDT< TrackCollection >::tryETLLayers().

96 { return etlLayers_all; }
std::vector< const DetLayer * > etlLayers_all

◆ allForwardLayers()

const vector< const DetLayer * > & MTDDetLayerGeometry::allForwardLayers ( ) const

return all endcap layers

Definition at line 90 of file MTDDetLayerGeometry.cc.

Referenced by GeometricSearchTrackerBuilder::build().

90 { return allForward; }
std::vector< const DetLayer * > allForward

◆ allLayers()

const vector< const DetLayer * > & MTDDetLayerGeometry::allLayers ( ) const

return all DetLayers (barrel + endcap), -Z to +Z

Definition at line 98 of file MTDDetLayerGeometry.cc.

98 { return allDetLayers; }
std::vector< const DetLayer * > allDetLayers

◆ buildLayers()

void MTDDetLayerGeometry::buildLayers ( const MTDGeometry geo,
const MTDTopology mtopo 
)

Definition at line 30 of file MTDDetLayerGeometry.cc.

References ETLDetLayerGeometryBuilder::buildLayers(), BTLDetLayerGeometryBuilder::buildLayers(), and Exception.

Referenced by GeometricSearchTrackerBuilder::build().

30  {
31  bool abort(false);
32  if (geo == nullptr) {
33  LogError("MTDDetLayers") << "No MTD geometry is available.";
34  abort = true;
35  }
36  if (mtopo == nullptr) {
37  LogError("MTDDetLayers") << "No MTD topology is available.";
38  abort = true;
39  }
40  if (abort) {
41  throw cms::Exception("MTDDetLayers") << "No complete MTD geometry available, aborting.";
42  }
43 
44  // Build BTL layers
46  // Build ETL layers, depends on the scenario
48 }
static std::vector< DetLayer * > buildLayers(const MTDGeometry &geo, const MTDTopology &topo)
Operations.
void addBTLLayers(const std::vector< DetLayer *> &btllayers)
Log< level::Error, false > LogError
void addETLLayers(const std::pair< std::vector< DetLayer *>, std::vector< DetLayer *> > &etllayers)
static std::pair< std::vector< DetLayer * >, std::vector< DetLayer * > > buildLayers(const MTDGeometry &geo, const MTDTopology &topo)

◆ idToLayer()

const DetLayer * MTDDetLayerGeometry::idToLayer ( const DetId detId) const
overridevirtual

return the DetLayer which correspond to a certain DetId

Reimplemented from DetLayerGeometry.

Definition at line 102 of file MTDDetLayerGeometry.cc.

References Exception, MTDDetId::mtdSubDetector(), DetId::rawId(), and DetId::subdetId().

Referenced by GlobalDetLayerGeometry::idToLayer(), and GeometricSearchTracker::idToLayer().

102  {
103  DetId idout;
104  MTDDetId detId(id);
105 
106  if (detId.mtdSubDetector() == 2) { // 2 is ETL
107  ETLDetId etlId(detId.rawId());
108  idout = ETLDetId(etlId.mtdSide(), 0, 0, 0);
109  } else if (detId.mtdSubDetector() == 1) { // 1 is BTL
110  BTLDetId btlId(detId.rawId());
111  idout = BTLDetId(btlId.mtdSide(), 0, 0, 0, 0);
112  } else
113  throw cms::Exception("InvalidSubdetId") << detId.subdetId();
114 
115  std::map<DetId, const DetLayer*>::const_iterator layer = detLayersMap.find(idout);
116  if (layer == detLayersMap.end())
117  return nullptr;
118  return layer->second;
119 }
std::map< DetId, const DetLayer * > detLayersMap
Detector identifier base class for the MIP Timing Layer.
Definition: MTDDetId.h:21
constexpr std::array< uint8_t, layerIndexSize > layer
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:48
Definition: DetId.h:17
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
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

◆ makeDetLayerId()

DetId MTDDetLayerGeometry::makeDetLayerId ( const DetLayer detLayer) const
private

Definition at line 75 of file MTDDetLayerGeometry.cc.

References GeometricSearchDet::basicComponents(), Exception, l1ctLayer2EG_cff::id, DetLayer::subDetector(), GeomDetEnumerators::TimingBarrel, and GeomDetEnumerators::TimingEndcap.

75  {
76  if (detLayer->subDetector() == GeomDetEnumerators::TimingEndcap) {
77  ETLDetId id(detLayer->basicComponents().front()->geographicalId().rawId());
78  return ETLDetId(id.mtdSide(), 0, 0, 0);
79  } else if (detLayer->subDetector() == GeomDetEnumerators::TimingBarrel) {
80  BTLDetId id(detLayer->basicComponents().front()->geographicalId().rawId());
81  return BTLDetId(id.mtdSide(), 0, 0, 0, 0);
82  } else
83  throw cms::Exception("InvalidModuleIdentification"); // << detLayer->module();
84 }
virtual SubDetector subDetector() const =0
The type of detector (PixelBarrel, PixelEndcap, TIB, TOB, TID, TEC, CSC, DT, RPCBarrel, RPCEndcap)
virtual const std::vector< const GeomDet * > & basicComponents() const =0
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

◆ sortLayers()

void MTDDetLayerGeometry::sortLayers ( )

Definition at line 135 of file MTDDetLayerGeometry.cc.

References filterCSVwithJSON::copy, cmsLHEtoEOSManager::l, precomputed_value_sort(), and groupFilesInBlocks::reverse.

Referenced by GeometricSearchTrackerBuilder::build().

135  {
136  // The following are filled inside-out, no need to re-sort
137  // precomputed_value_sort(dtLayers.begin(), dtLayers.end(),ExtractR<DetLayer,float>());
138  // precomputed_value_sort(cscLayers_fw.begin(), cscLayers_fw.end(),ExtractAbsZ<DetLayer,float>());
139  // precomputed_value_sort(cscLayers_bk.begin(), cscLayers_bk.end(),ExtractAbsZ<DetLayer,float>());
140  // precomputed_value_sort(rpcLayers_fw.begin(), rpcLayers_fw.end(),ExtractAbsZ<DetLayer,float>());
141  // precomputed_value_sort(rpcLayers_bk.begin(), rpcLayers_bk.end(),ExtractAbsZ<DetLayer,float>());
142  // precomputed_value_sort(rpcLayers_barrel.begin(), rpcLayers_barrel.end(), ExtractR<DetLayer,float>());
143 
144  // Sort these inside-out
148 
149  // Build more complicated vectors with correct sorting
150 
151  //etlLayers_all: from -Z to +Z
152  etlLayers_all.reserve(etlLayers_bk.size() + etlLayers_fw.size());
153  std::copy(etlLayers_bk.begin(), etlLayers_bk.end(), back_inserter(etlLayers_all));
154  std::reverse(etlLayers_all.begin(), etlLayers_all.end());
155  std::copy(etlLayers_fw.begin(), etlLayers_fw.end(), back_inserter(etlLayers_all));
156 
157  // allEndcap: order is all bw, all fw
158  allEndcap.reserve(allBackward.size() + allForward.size());
159  std::copy(allBackward.begin(), allBackward.end(), back_inserter(allEndcap));
160  std::reverse(allEndcap.begin(), allEndcap.end());
161  std::copy(allForward.begin(), allForward.end(), back_inserter(allEndcap));
162 
163  // allDetLayers: order is all bw, all barrel, all fw
164  allDetLayers.reserve(allBackward.size() + allBarrel.size() + allForward.size());
165  std::copy(allBackward.begin(), allBackward.end(), back_inserter(allDetLayers));
166  std::reverse(allDetLayers.begin(), allDetLayers.end());
167  std::copy(allBarrel.begin(), allBarrel.end(), back_inserter(allDetLayers));
168  std::copy(allForward.begin(), allForward.end(), back_inserter(allDetLayers));
169 
170  // number layers
171  int sq = 0;
172  for (auto l : allDetLayers)
173  (*const_cast<DetLayer*>(l)).setSeqNum(sq++);
174 }
std::vector< const DetLayer * > etlLayers_fw
std::vector< const DetLayer * > etlLayers_bk
std::vector< const DetLayer * > etlLayers_all
std::vector< const DetLayer * > allBackward
std::vector< const DetLayer * > allEndcap
std::vector< const DetLayer * > allBarrel
void precomputed_value_sort(RandomAccessIterator begin, RandomAccessIterator end, const Extractor &extr, const Compare &comp)
std::vector< const DetLayer * > allDetLayers
std::vector< const DetLayer * > allForward

Friends And Related Function Documentation

◆ MTDDetLayerGeometryESProducer

friend class MTDDetLayerGeometryESProducer
friend

Definition at line 27 of file MTDDetLayerGeometry.h.

Member Data Documentation

◆ allBackward

std::vector<const DetLayer*> MTDDetLayerGeometry::allBackward
private

Definition at line 79 of file MTDDetLayerGeometry.h.

◆ allBarrel

std::vector<const DetLayer*> MTDDetLayerGeometry::allBarrel
private

Definition at line 81 of file MTDDetLayerGeometry.h.

◆ allDetLayers

std::vector<const DetLayer*> MTDDetLayerGeometry::allDetLayers
private

Definition at line 82 of file MTDDetLayerGeometry.h.

◆ allEndcap

std::vector<const DetLayer*> MTDDetLayerGeometry::allEndcap
private

Definition at line 80 of file MTDDetLayerGeometry.h.

◆ allForward

std::vector<const DetLayer*> MTDDetLayerGeometry::allForward
private

Definition at line 78 of file MTDDetLayerGeometry.h.

◆ btlLayers

std::vector<const DetLayer*> MTDDetLayerGeometry::btlLayers
private

Definition at line 77 of file MTDDetLayerGeometry.h.

◆ detLayersMap

std::map<DetId, const DetLayer*> MTDDetLayerGeometry::detLayersMap
private

Definition at line 84 of file MTDDetLayerGeometry.h.

◆ etlLayers_all

std::vector<const DetLayer*> MTDDetLayerGeometry::etlLayers_all
private

Definition at line 74 of file MTDDetLayerGeometry.h.

◆ etlLayers_bk

std::vector<const DetLayer*> MTDDetLayerGeometry::etlLayers_bk
private

Definition at line 73 of file MTDDetLayerGeometry.h.

◆ etlLayers_fw

std::vector<const DetLayer*> MTDDetLayerGeometry::etlLayers_fw
private

Definition at line 72 of file MTDDetLayerGeometry.h.