CMS 3D CMS Logo

SiStripRegionConnectivity.cc
Go to the documentation of this file.
10 
11 using namespace sistrip;
12 
14 
15  etadivisions_(pset.getUntrackedParameter<unsigned int>("EtaDivisions",10)),
16  phidivisions_(pset.getUntrackedParameter<unsigned int>("PhiDivisions",10)),
17  etamax_(pset.getUntrackedParameter<double>("EtaMax",2.4))
18 
19 {
21 }
22 
24 
25 std::unique_ptr<SiStripRegionCabling> SiStripRegionConnectivity::produceRegionCabling( const SiStripRegionCablingRcd& iRecord ) {
26 
28  iRecord.getRecord<SiStripDetCablingRcd>().get( detcabling );
29 
31  iRecord.getRecord<TrackerDigiGeometryRecord>().get( tkgeom );
32 
34  iRecord.getRecord<TrackerTopologyRcd>().get(tTopoHandle);
35  const TrackerTopology* const tTopo = tTopoHandle.product();
36 
37  //here build an object of type SiStripRegionCabling using the information from class SiStripDetCabling **PLUS** the geometry.
38 
39  //Construct region cabling object
41 
42  //Construct region cabling map
44 
45  //Loop det cabling
46  std::map< uint32_t, std::vector<const FedChannelConnection *> >::const_iterator idet = detcabling->getDetCabling().begin();
47  for (;idet!=detcabling->getDetCabling().end();idet++) {
48  if (!idet->first || (idet->first == sistrip::invalid32_)) continue;
49 
50  // Check if geom det unit exists
51  auto geom_det = tkgeom->idToDetUnit(DetId(idet->first));
52  auto strip_det = dynamic_cast<StripGeomDetUnit const *>( geom_det );
53  if ( !strip_det ) { continue; }
54 
55  //Calculate region from geometry
56  double eta = tkgeom->idToDet(DetId(idet->first))->position().eta();
57  double phi = tkgeom->idToDet(DetId(idet->first))->position().phi().value();
58  uint32_t reg = RegionConnections->region(SiStripRegionCabling::Position(eta,phi));
59 
60  //Find subdet from det-id
61  uint32_t subdet = static_cast<uint32_t>(SiStripRegionCabling::subdetFromDetId(idet->first));
62 
63  //Find layer from det-id
64  uint32_t layer = tTopo->layer(idet->first);
65 
66  //@@ BELOW IS TEMP FIX TO HANDLE BUG IN DET CABLING
67  std::vector<const FedChannelConnection *> conns = idet->second;
68  std::vector<const FedChannelConnection *>::iterator iconn = conns.begin();
69  std::vector<const FedChannelConnection *>::iterator jconn = conns.end();
70 
71  //Update region cabling map
72  regioncabling[reg][subdet][layer].push_back(SiStripRegionCabling::Element());
73  auto & elem = regioncabling[reg][subdet][layer].back();
74  elem.first=idet->first; elem.second.resize(conns.size());
75  for ( ; iconn != jconn; ++iconn ) {
76  if ( ((*iconn) != nullptr) && ((*iconn)->apvPairNumber() < conns.size()) ) {
77  elem.second[(*iconn)->apvPairNumber()] = **iconn;
78  }
79  }
80  }
81 
82  //Add map to region cabling object
83  RegionConnections->setRegionCabling(regioncabling);
84 
85  return std::unique_ptr<SiStripRegionCabling>( RegionConnections );
86 }
87 
SiStripRegionConnectivity(const edm::ParameterSet &)
static const uint32_t invalid32_
Definition: Constants.h:15
Geom::Phi< T > phi() const
Definition: PV3DBase.h:69
std::vector< Element > ElementCabling
sistrip classes
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
void setRegionCabling(const Cabling &)
const TrackerGeomDet * idToDetUnit(DetId) const override
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const Surface::PositionType & position() const
The position (origin of the R.F.)
Definition: GeomDet.h:48
std::vector< ElementCabling > WedgeCabling
static const SubDet subdetFromDetId(const uint32_t detid)
std::pair< double, double > Position
std::pair< uint32_t, std::vector< FedChannelConnection > > Element
def elem(elemtype, innerHTML='', html_class='', kwargs)
Definition: HTMLExport.py:18
Definition: DetId.h:18
const std::map< uint32_t, std::vector< const FedChannelConnection * > > & getDetCabling() const
unsigned int layer(const DetId &id) const
T eta() const
Definition: PV3DBase.h:76
const uint32_t region(const Position) const
std::unique_ptr< SiStripRegionCabling > produceRegionCabling(const SiStripRegionCablingRcd &)
const TrackerGeomDet * idToDet(DetId) const override
T const * product() const
Definition: ESHandle.h:86
std::vector< WedgeCabling > RegionCabling
std::vector< RegionCabling > Cabling