CMS 3D CMS Logo

SiStripRegionConnectivity.cc
Go to the documentation of this file.
13 
14 using namespace sistrip;
15 
17 public:
19  ~SiStripRegionConnectivity() override;
20 
21  std::unique_ptr<SiStripRegionCabling> produceRegionCabling(const SiStripRegionCablingRcd&);
22 
23 private:
27 
29  uint32_t etadivisions_;
30  uint32_t phidivisions_;
31 
33  double etamax_;
34 };
35 
37  :
38 
39  etadivisions_(pset.getUntrackedParameter<unsigned int>("EtaDivisions", 10)),
40  phidivisions_(pset.getUntrackedParameter<unsigned int>("PhiDivisions", 10)),
41  etamax_(pset.getUntrackedParameter<double>("EtaMax", 2.4))
42 
43 {
45  .setConsumes(detcablingToken_)
46  .setConsumes(tkgeomToken_)
47  .setConsumes(tTopoToken_);
48 }
49 
51 
52 std::unique_ptr<SiStripRegionCabling> SiStripRegionConnectivity::produceRegionCabling(
53  const SiStripRegionCablingRcd& iRecord) {
54  const auto& detcabling = iRecord.get(detcablingToken_);
55  const auto& tkgeom = iRecord.get(tkgeomToken_);
56  const auto& tTopo = iRecord.get(tTopoToken_);
57 
58  //here build an object of type SiStripRegionCabling using the information from class SiStripDetCabling **PLUS** the geometry.
59 
60  //Construct region cabling object
61  auto RegionConnections = std::make_unique<SiStripRegionCabling>(etadivisions_, phidivisions_, etamax_);
62 
63  //Construct region cabling map
64  SiStripRegionCabling::Cabling regioncabling(
69 
70  //Loop det cabling
71  for (const auto& idet : detcabling.getDetCabling()) {
72  if (!idet.first || (idet.first == sistrip::invalid32_))
73  continue;
74 
75  // Check if geom det unit exists
76  auto geom_det = tkgeom.idToDetUnit(DetId(idet.first));
77  auto strip_det = dynamic_cast<StripGeomDetUnit const*>(geom_det);
78  if (!strip_det) {
79  continue;
80  }
81 
82  //Calculate region from geometry
83  double eta = tkgeom.idToDet(DetId(idet.first))->position().eta();
84  double phi = tkgeom.idToDet(DetId(idet.first))->position().phi().value();
85  uint32_t reg = RegionConnections->region(SiStripRegionCabling::Position(eta, phi));
86 
87  //Find subdet from det-id
88  uint32_t subdet = static_cast<uint32_t>(SiStripRegionCabling::subdetFromDetId(idet.first));
89 
90  //Find layer from det-id
91  uint32_t layer = tTopo.layer(idet.first);
92 
93  //@@ BELOW IS TEMP FIX TO HANDLE BUG IN DET CABLING
94  const std::vector<const FedChannelConnection*>& conns = idet.second;
95 
96  //Update region cabling map
97  regioncabling[reg][subdet][layer].push_back(SiStripRegionCabling::Element());
98  auto& elem = regioncabling[reg][subdet][layer].back();
99  elem.first = idet.first;
100  elem.second.resize(conns.size());
101  for (const auto& iconn : conns) {
102  if ((iconn != nullptr) && (iconn->apvPairNumber() < conns.size())) {
103  elem.second[iconn->apvPairNumber()] = *iconn;
104  }
105  }
106  }
107 
108  //Add map to region cabling object
109  RegionConnections->setRegionCabling(regioncabling);
110 
111  return RegionConnections;
112 }
113 
SiStripRegionCabling::Position
std::pair< double, double > Position
Definition: SiStripRegionCabling.h:38
SiStripRegionCabling::RegionCabling
std::vector< WedgeCabling > RegionCabling
Definition: SiStripRegionCabling.h:33
SiStripRegionCabling::ALLLAYERS
Definition: SiStripRegionCabling.h:27
SiStripRegionConnectivity::produceRegionCabling
std::unique_ptr< SiStripRegionCabling > produceRegionCabling(const SiStripRegionCablingRcd &)
Definition: SiStripRegionConnectivity.cc:52
SiStripRegionConnectivity::~SiStripRegionConnectivity
~SiStripRegionConnectivity() override
Definition: SiStripRegionConnectivity.cc:50
StripGeomDetUnit.h
SiStripRegionCabling::WedgeCabling
std::vector< ElementCabling > WedgeCabling
Definition: SiStripRegionCabling.h:32
TrackerGeometry.h
SiStripRegionConnectivity::tkgeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > tkgeomToken_
Definition: SiStripRegionConnectivity.cc:25
sistrip::invalid32_
static const uint32_t invalid32_
Definition: Constants.h:15
edm::ESProducer::setWhatProduced
auto setWhatProduced(T *iThis, const es::Label &iLabel={})
Definition: ESProducer.h:138
SiStripRegionCabling::ALLSUBDETS
Definition: SiStripRegionCabling.h:26
ESProducer.h
HLT_2018_cff.SiStripRegionConnectivity
SiStripRegionConnectivity
Definition: HLT_2018_cff.py:5232
SiStripRegionConnectivity::SiStripRegionConnectivity
SiStripRegionConnectivity(const edm::ParameterSet &)
Definition: SiStripRegionConnectivity.cc:36
SiStripRegionConnectivity
Definition: SiStripRegionConnectivity.cc:16
DetId
Definition: DetId.h:17
SiStripRegionConnectivity::etadivisions_
uint32_t etadivisions_
Definition: SiStripRegionConnectivity.cc:29
SiStripDetCabling.h
TrackerTopologyRcd.h
PVValHelper::eta
Definition: PVValidationHelpers.h:69
SiStripRegionConnectivity::etamax_
double etamax_
Definition: SiStripRegionConnectivity.cc:33
edm::eventsetup::DependentRecordImplementation::get
ProductT const & get(ESGetToken< ProductT, DepRecordT > const &iToken) const
Definition: DependentRecordImplementation.h:112
SiStripConstants.h
edm::ParameterSet
Definition: ParameterSet.h:36
createfilelist.int
int
Definition: createfilelist.py:10
SiStripRegionCablingRcd
Definition: SiStripDependentRecords.h:23
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd >
SiStripRegionCabling.h
DDAxes::phi
GeomDet.h
ModuleFactory.h
SiStripRegionCablingRcd.h
SiStripRegionCabling::Cabling
std::vector< RegionCabling > Cabling
Definition: SiStripRegionCabling.h:34
DEFINE_FWK_EVENTSETUP_MODULE
#define DEFINE_FWK_EVENTSETUP_MODULE(type)
Definition: ModuleFactory.h:60
edm::ESProducer
Definition: ESProducer.h:101
SiStripRegionConnectivity::phidivisions_
uint32_t phidivisions_
Definition: SiStripRegionConnectivity.cc:30
SiStripDetCablingRcd.h
ParameterSet.h
sistrip
sistrip classes
Definition: SiStripQualityHelpers.h:14
SiStripRegionCabling::ElementCabling
std::vector< Element > ElementCabling
Definition: SiStripRegionCabling.h:31
SiStripRegionConnectivity::tTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > tTopoToken_
Definition: SiStripRegionConnectivity.cc:26
SiStripRegionCabling::Element
std::pair< uint32_t, std::vector< FedChannelConnection > > Element
Definition: SiStripRegionCabling.h:30
muonDTDigis_cfi.pset
pset
Definition: muonDTDigis_cfi.py:27
SiStripRegionConnectivity::detcablingToken_
edm::ESGetToken< SiStripDetCabling, SiStripDetCablingRcd > detcablingToken_
Definition: SiStripRegionConnectivity.cc:24