CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
SiStripRegionConnectivity.cc
Go to the documentation of this file.
9 
10 using namespace sistrip;
11 
13 
14  etadivisions_(pset.getUntrackedParameter<unsigned int>("EtaDivisions",10)),
15  phidivisions_(pset.getUntrackedParameter<unsigned int>("PhiDivisions",10)),
16  etamax_(pset.getUntrackedParameter<double>("EtaMax",2.4))
17 
18 {
20 }
21 
23 
24 std::auto_ptr<SiStripRegionCabling> SiStripRegionConnectivity::produceRegionCabling( const SiStripRegionCablingRcd& iRecord ) {
25 
27  iRecord.getRecord<SiStripDetCablingRcd>().get( detcabling );
28 
30  iRecord.getRecord<TrackerDigiGeometryRecord>().get( tkgeom );
31 
32  //here build an object of type SiStripRegionCabling using the information from class SiStripDetCabling **PLUS** the geometry.
33 
34  //Construct region cabling object
36 
37  //Construct region cabling map
39 
40  //Loop det cabling
41  std::map< uint32_t, std::vector<FedChannelConnection> >::const_iterator idet = detcabling->getDetCabling().begin();
42  for (;idet!=detcabling->getDetCabling().end();idet++) {
43  if (!idet->first || (idet->first == sistrip::invalid32_)) continue;
44 
45  // Check if geom det unit exists
46  GeomDetUnit* geom_det = const_cast<GeomDetUnit*>( tkgeom->idToDetUnit(DetId(idet->first)) );
47  StripGeomDetUnit* strip_det = dynamic_cast<StripGeomDetUnit*>( geom_det );
48  if ( !strip_det ) { continue; }
49 
50  //Calculate region from geometry
51  double eta = tkgeom->idToDet(DetId(idet->first))->position().eta();
52  double phi = tkgeom->idToDet(DetId(idet->first))->position().phi().value();
53  uint32_t reg = RegionConnections->region(SiStripRegionCabling::Position(eta,phi));
54 
55  //Find subdet from det-id
56  uint32_t subdet = static_cast<uint32_t>(SiStripRegionCabling::subdetFromDetId(idet->first));
57 
58  //Find layer from det-id
59  uint32_t layer = SiStripRegionCabling::layerFromDetId(idet->first);
60 
61  //@@ BELOW IS TEMP FIX TO HANDLE BUG IN DET CABLING
62  std::vector<FedChannelConnection> conns = idet->second;
63  std::vector<FedChannelConnection>::iterator iconn = conns.begin();
64  std::vector<FedChannelConnection>::iterator jconn = conns.end();
65 
66  //Update region cabling map
67  regioncabling[reg][subdet][layer][idet->first].resize(conns.size());
68  for ( ; iconn != jconn; ++iconn ) {
69  if ( iconn->apvPairNumber() < conns.size() ) {
70  regioncabling[reg][subdet][layer][idet->first][iconn->apvPairNumber()] = *iconn;
71  }
72  }
73 
74  }
75 
76  //Add map to region cabling object
77  RegionConnections->setRegionCabling(regioncabling);
78 
79  return std::auto_ptr<SiStripRegionCabling>( RegionConnections );
80 }
81 
SiStripRegionConnectivity(const edm::ParameterSet &)
static const uint32_t invalid32_
Definition: Constants.h:16
T eta() const
void setWhatProduced(T *iThis, const es::Label &iLabel=es::Label())
Definition: ESProducer.h:115
std::auto_ptr< SiStripRegionCabling > produceRegionCabling(const SiStripRegionCablingRcd &)
void setRegionCabling(const Cabling &)
std::vector< ElementCabling > WedgeCabling
static const SubDet subdetFromDetId(const uint32_t detid)
std::pair< double, double > Position
Definition: DetId.h:20
static const uint32_t layerFromDetId(const uint32_t detid)
const uint32_t region(const Position) const
std::vector< WedgeCabling > RegionCabling
std::map< uint32_t, std::vector< FedChannelConnection > > ElementCabling
std::vector< RegionCabling > Cabling
Definition: DDAxes.h:10