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<const 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<const FedChannelConnection *> conns = idet->second;
63  std::vector<const FedChannelConnection *>::iterator iconn = conns.begin();
64  std::vector<const FedChannelConnection *>::iterator jconn = conns.end();
65 
66  //Update region cabling map
67  regioncabling[reg][subdet][layer].push_back(SiStripRegionCabling::Element());
68  auto & elem = regioncabling[reg][subdet][layer].back();
69  elem.first=idet->first; elem.second.resize(conns.size());
70  for ( ; iconn != jconn; ++iconn ) {
71  if ( ((*iconn) != 0) && ((*iconn)->apvPairNumber() < conns.size()) ) {
72  elem.second[(*iconn)->apvPairNumber()] = **iconn;
73  }
74  }
75  }
76 
77  //Add map to region cabling object
78  RegionConnections->setRegionCabling(regioncabling);
79 
80  return std::auto_ptr<SiStripRegionCabling>( RegionConnections );
81 }
82 
SiStripRegionConnectivity(const edm::ParameterSet &)
static const uint32_t invalid32_
Definition: Constants.h:15
std::vector< Element > ElementCabling
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
std::pair< uint32_t, std::vector< FedChannelConnection > > Element
Definition: DetId.h:18
static const uint32_t layerFromDetId(const uint32_t detid)
const uint32_t region(const Position) const
std::vector< WedgeCabling > RegionCabling
std::vector< RegionCabling > Cabling
Definition: DDAxes.h:10