CMS 3D CMS Logo

HeterogeneousHGCalHEFCellPositionsFiller.cc
Go to the documentation of this file.
2 
5  edm::ESInputTag{"", "HGCalHESiliconSensitive"});
7 }
8 
10 
11 //the geometry is not required if the layer offset is hardcoded (potential speed-up)
13  //fill the CPU position structure from the geometry
14  posmap_->zLayer.clear();
15  posmap_->nCellsLayer.clear();
16  posmap_->nCellsWaferUChunk.clear();
17  posmap_->nCellsHexagon.clear();
18  posmap_->detid.clear();
19 
20  int nlayers = ddd_->lastLayer(true) - ddd_->firstLayer() + 1;
21  int upper_estimate_wafer_number_1D = 2 * nlayers * (ddd_->waferMax() - ddd_->waferMin());
22  int upper_estimate_wafer_number_2D = upper_estimate_wafer_number_1D * (ddd_->waferMax() - ddd_->waferMin());
23  int upper_estimate_cell_number = upper_estimate_wafer_number_2D * 3 * 12 * 12;
24  posmap_->zLayer.resize(nlayers * 2);
25  posmap_->nCellsLayer.reserve(nlayers * 2);
26  posmap_->nCellsWaferUChunk.reserve(upper_estimate_wafer_number_1D);
27  posmap_->nCellsHexagon.reserve(upper_estimate_wafer_number_2D);
28  posmap_->detid.reserve(upper_estimate_cell_number);
29  //set position-related variables
30  posmap_->waferSize = static_cast<float>(params_->waferSize_);
31  posmap_->sensorSeparation = static_cast<float>(params_->sensorSeparation_);
33  assert(posmap_->firstLayer == 1); //otherwise the loop over the layers has to be changed
34  posmap_->lastLayer = ddd_->lastLayer(true);
37 
38  unsigned sumCellsLayer, sumCellsWaferUChunk;
39 
40  //store detids following a geometry ordering
41  for (int ilayer = 1; ilayer <= posmap_->lastLayer; ++ilayer) {
42  sumCellsLayer = 0;
43  posmap_->zLayer[ilayer - 1] = static_cast<float>(ddd_->waferZ(ilayer, true)); //originally a double
44  posmap_->zLayer[ilayer - 1 + nlayers] = static_cast<float>(ddd_->waferZ(ilayer, true)); //originally a double
45 
46  for (int iwaferU = posmap_->waferMin; iwaferU < posmap_->waferMax; ++iwaferU) {
47  sumCellsWaferUChunk = 0;
48 
49  for (int iwaferV = posmap_->waferMin; iwaferV < posmap_->waferMax; ++iwaferV) {
50  //0: fine; 1: coarseThin; 2: coarseThick (as defined in DataFormats/ForwardDetId/interface/HGCSiliconDetId.h)
51  int type_ = ddd_->waferType(ilayer, iwaferU, iwaferV);
52 
53  int nCellsHexSide = ddd_->numberCellsHexagon(ilayer, iwaferU, iwaferV, false);
54  int nCellsHexTotal = ddd_->numberCellsHexagon(ilayer, iwaferU, iwaferV, true);
55  sumCellsLayer += nCellsHexTotal;
56  sumCellsWaferUChunk += nCellsHexTotal;
57  posmap_->nCellsHexagon.push_back(nCellsHexTotal);
58 
59  //left side of wafer
60  for (int cellUmax = nCellsHexSide, icellV = 0; cellUmax < 2 * nCellsHexSide and icellV < nCellsHexSide;
61  ++cellUmax, ++icellV) {
62  for (int icellU = 0; icellU <= cellUmax; ++icellU) {
63  HGCSiliconDetId detid_(DetId::HGCalHSi, 1, type_, ilayer, iwaferU, iwaferV, icellU, icellV);
64  posmap_->detid.push_back(detid_.rawId());
65  }
66  }
67  //right side of wafer
68  for (int cellUmin = 1, icellV = nCellsHexSide; cellUmin <= nCellsHexSide and icellV < 2 * nCellsHexSide;
69  ++cellUmin, ++icellV) {
70  for (int icellU = cellUmin; icellU < 2 * nCellsHexSide; ++icellU) {
71  HGCSiliconDetId detid_(DetId::HGCalHSi, 1, type_, ilayer, iwaferU, iwaferV, icellU, icellV);
72  posmap_->detid.push_back(detid_.rawId());
73  }
74  }
75  }
76  posmap_->nCellsWaferUChunk.push_back(sumCellsWaferUChunk);
77  }
78  posmap_->nCellsLayer.push_back(sumCellsLayer);
79  }
80 }
81 
82 std::unique_ptr<HeterogeneousHGCalHEFCellPositionsConditions> HeterogeneousHGCalHEFCellPositionsFiller::produce(
84  auto geom = iRecord.getTransientHandle(geometryToken_);
85  ddd_ = &(geom->topology().dddConstants());
87 
89 
90  std::unique_ptr<HeterogeneousHGCalHEFCellPositionsConditions> up =
91  std::make_unique<HeterogeneousHGCalHEFCellPositionsConditions>(posmap_);
92  return up;
93 }
94 
hgcal_conditions::positions::HGCalPositionsMapping::nCellsHexagon
std::vector< std::int32_t > nCellsHexagon
Definition: HGCConditions.h:151
HeterogeneousHGCalHEFCellPositionsFiller::set_conditions_
void set_conditions_()
Definition: HeterogeneousHGCalHEFCellPositionsFiller.cc:12
hgcal_conditions::positions::HGCalPositionsMapping::waferSize
float waferSize
Definition: HGCConditions.h:154
hgcal_conditions::positions::HGCalPositionsMapping::sensorSeparation
float sensorSeparation
Definition: HGCConditions.h:155
edm::ESInputTag
Definition: ESInputTag.h:87
hgcal_conditions::positions::HGCalPositionsMapping::lastLayer
std::int32_t lastLayer
Definition: HGCConditions.h:158
hgcal_conditions::positions::HGCalPositionsMapping::firstLayer
std::int32_t firstLayer
Definition: HGCConditions.h:157
HGCalDDDConstants::firstLayer
int firstLayer() const
Definition: HGCalDDDConstants.h:53
HGCalDDDConstants::waferMin
int waferMin() const
Definition: HGCalDDDConstants.h:150
HeterogeneousHGCalHEFCellPositionsFiller::~HeterogeneousHGCalHEFCellPositionsFiller
~HeterogeneousHGCalHEFCellPositionsFiller() override
Definition: HeterogeneousHGCalHEFCellPositionsFiller.cc:9
eventsetuprecord_registration_macro.h
HGCalDDDConstants::waferZ
double waferZ(int layer, bool reco) const
Definition: HGCalDDDConstants.cc:1390
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:163
hgcal_conditions::positions::HGCalPositionsMapping::nCellsLayer
std::vector< std::int32_t > nCellsLayer
Definition: HGCConditions.h:149
HeterogeneousHGCalHEFCellPositionsFiller::HeterogeneousHGCalHEFCellPositionsFiller
HeterogeneousHGCalHEFCellPositionsFiller(const edm::ParameterSet &)
Definition: HeterogeneousHGCalHEFCellPositionsFiller.cc:3
typelookup.h
cms::cuda::assert
assert(be >=bs)
HeterogeneousHGCalHEFCellPositionsConditionsRecord
Definition: HeterogeneousHGCalHEFCellPositionsConditionsRecord.h:8
HGCalParameters::waferSize_
double waferSize_
Definition: HGCalParameters.h:144
HeterogeneousHGCalHEFCellPositionsFiller::posmap_
hgcal_conditions::positions::HGCalPositionsMapping * posmap_
Definition: HeterogeneousHGCalHEFCellPositionsFiller.h:48
HGCalDDDConstants::lastLayer
int lastLayer(bool reco) const
Definition: HGCalDDDConstants.cc:559
HGCSiliconDetId
Definition: HGCSiliconDetId.h:22
HeterogeneousHGCalHEFCellPositionsFiller::geometryToken_
edm::ESGetToken< HGCalGeometry, IdealGeometryRecord > geometryToken_
Definition: HeterogeneousHGCalHEFCellPositionsFiller.h:39
HGCalParameters::sensorSeparation_
double sensorSeparation_
Definition: HGCalParameters.h:146
HGCalDDDConstants::waferMax
int waferMax() const
Definition: HGCalDDDConstants.h:149
DetId::HGCalHSi
Definition: DetId.h:33
MakerMacros.h
HGCalDDDConstants::waferType
int waferType(DetId const &id, bool fromFile=false) const
Definition: HGCalDDDConstants.cc:1245
edm::eventsetup::DependentRecordImplementation::getTransientHandle
ESTransientHandle< ProductT > getTransientHandle(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:98
relativeConstraints.geom
geom
Definition: relativeConstraints.py:72
HGCalGeometry
Definition: HGCalGeometry.h:29
hgcal_conditions::positions::HGCalPositionsMapping::waferMin
std::int32_t waferMin
Definition: HGCConditions.h:160
edm::ParameterSet
Definition: ParameterSet.h:47
hgcal_conditions::positions::HGCalPositionsMapping
Definition: HGCConditions.h:147
HeterogeneousHGCalHEFCellPositionsFiller::produce
std::unique_ptr< HeterogeneousHGCalHEFCellPositionsConditions > produce(const HeterogeneousHGCalHEFCellPositionsConditionsRecord &)
Definition: HeterogeneousHGCalHEFCellPositionsFiller.cc:82
HeterogeneousHGCalHEFCellPositionsFiller::params_
const HGCalParameters * params_
Definition: HeterogeneousHGCalHEFCellPositionsFiller.h:51
HeterogeneousHGCalHEFCellPositionsFiller
Definition: HeterogeneousHGCalHEFCellPositionsFiller.h:31
HeterogeneousHGCalHEFCellPositionsFiller.h
HGCalDDDConstants::numberCellsHexagon
int numberCellsHexagon(int wafer) const
Definition: HGCalDDDConstants.cc:927
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
hgcal_conditions::positions::HGCalPositionsMapping::waferMax
std::int32_t waferMax
Definition: HGCConditions.h:159
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
hgcal_conditions::positions::HGCalPositionsMapping::nCellsWaferUChunk
std::vector< std::int32_t > nCellsWaferUChunk
Definition: HGCConditions.h:150
hgcal_conditions::positions::HGCalPositionsMapping::detid
std::vector< std::uint32_t > detid
Definition: HGCConditions.h:152
HeterogeneousHGCalHEFCellPositionsFiller::ddd_
const HGCalDDDConstants * ddd_
Definition: HeterogeneousHGCalHEFCellPositionsFiller.h:50
hgcal_conditions::positions::HGCalPositionsMapping::zLayer
std::vector< float > zLayer
Definition: HGCConditions.h:148
HGCalDDDConstants::getParameter
const HGCalParameters * getParameter() const
Definition: HGCalDDDConstants.h:59
up
Definition: BitonicSort.h:7
IdealGeometryRecord
Definition: IdealGeometryRecord.h:25
nlayers
Definition: HIMultiTrackSelector.h:48