CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Classes | Public Member Functions | Private Member Functions | Private Attributes
SiPixelFedCablingMapBuilder Class Reference

#include <SiPixelFedCablingMapBuilder.h>

Classes

struct  FedSpec
 

Public Member Functions

SiPixelFedCablingTreeproduce (const edm::EventSetup &setup)
 
 SiPixelFedCablingMapBuilder (const std::string &associatorName)
 

Private Member Functions

std::string myprint (const PixelGeomDetUnit *pxUnit)
 

Private Attributes

std::string theAssociatorName
 

Detailed Description

Definition at line 14 of file SiPixelFedCablingMapBuilder.h.

Constructor & Destructor Documentation

SiPixelFedCablingMapBuilder::SiPixelFedCablingMapBuilder ( const std::string &  associatorName)

Definition at line 34 of file SiPixelFedCablingMapBuilder.cc.

34  : theAssociatorName(associatorName)
35 { }

Member Function Documentation

std::string SiPixelFedCablingMapBuilder::myprint ( const PixelGeomDetUnit pxUnit)
private

Definition at line 150 of file SiPixelFedCablingMapBuilder.cc.

References M_PI, PixelTopology::ncolumns(), PixelTopology::nrows(), PV3DBase< T, PVType, FrameType >::perp(), phi, alignCSCRings::r, PixelGeomDetUnit::specificTopology(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), detailsBasic3DVector::z, and PV3DBase< T, PVType, FrameType >::z().

151 {
152  std::ostringstream str;
153  const PixelTopology & tpl = pxUnit->specificTopology();
154  LocalPoint local;
155  GlobalPoint global;
156 
157  local = LocalPoint(0,0,0); global = (*pxUnit).toGlobal(local);
158  // phi measured from Y axis
159  float phi = 180*atan2(global.x(),global.y())/M_PI; if (phi > 180.) phi = phi-360;
160  float r = global.perp();
161  float z = global.z();
162  str <<" POSITION: "<<" r="<<r<<" phi="<<phi<<" z="<<z;
163  str <<" (rows,coll:"<<tpl.nrows()<<","<<tpl.ncolumns()<<")";
164  str <<endl;
165  local = LocalPoint(0,0,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
166  local = LocalPoint(1,0,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
167  local = LocalPoint(0,1,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
168  local = LocalPoint(0,0,1); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
169 
170  return str.str();
171 }
T perp() const
Definition: PV3DBase.h:72
virtual int ncolumns() const =0
T y() const
Definition: PV3DBase.h:63
virtual int nrows() const =0
float float float z
T z() const
Definition: PV3DBase.h:64
#define M_PI
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Local3DPoint LocalPoint
Definition: LocalPoint.h:11
T x() const
Definition: PV3DBase.h:62
Definition: DDAxes.h:10
SiPixelFedCablingTree * SiPixelFedCablingMapBuilder::produce ( const edm::EventSetup setup)

Definition at line 38 of file SiPixelFedCablingMapBuilder.cc.

References SiPixelFedCablingTree::addFed(), SiPixelFedCablingTree::addItem(), Reference_intrackfit_cff::barrel, gather_cfg::cout, PixelToFEDAssociate::CablingRocId::fedId, GeomDet::geographicalId(), edm::EventSetup::get(), customizeTrackingMonitorSeedNumber::idx, TRange< T >::inside(), PixelToFEDAssociate::CablingRocId::linkId, PixelEndcapLinkMaker::links(), PixelBarrelLinkMaker::links(), electronStore::links, LogDebug, TRange< T >::max(), TRange< T >::min(), PixelToFEDAssociate::DetectorRocId::module, PixelModuleName::name(), mergeVDriftHistosByStation::name, cscdqm::h::names, DetId::rawId(), query::result, PixelToFEDAssociate::DetectorRocId::rocDetId, PixelToFEDAssociate::CablingRocId::rocLinkId, sipixelobjects::PixelFEDCabling::setLinks(), DetId::subdetId(), theAssociatorName, asciidump::UNITS, create_public_lumi_plots::units, PixelToFEDAssociate::version(), and BeamSplash_cfg::version.

Referenced by JSONExport.JsonExport::export(), HTMLExport.HTMLExport::export(), and HTMLExport.HTMLExportStatic::export().

39 {
40  FEDNumbering fednum;
41 // TRange<int> fedIds(FEDNumbering::MINSiPixelFEDID, FEDNumbering::MAXSiPixelFEDID);
42  TRange<int> fedIds(0,39);
43  edm::LogInfo("SiPixelFedCablingMapBuilder")<<"pixel fedid range: "<<fedIds;
44 
45 
47  setup.get<TrackerDigiGeometryRecord>().get(theAssociatorName,associator);
48 // PixelToFEDAssociate * associator = new PixelToLNKAssociateFromAscii("pixelToLNK.ascii");
49 
50 
51  const PixelToFEDAssociate & name2fed = *associator;
52 
53  string version = name2fed.version();
55 
56 
57  LogDebug("read tracker geometry...");
59  setup.get<TrackerDigiGeometryRecord>().get( pDD );
60  LogDebug("tracker geometry read")<<"There are: "<< pDD->dets().size() <<" detectors";
61 
62  typedef TrackerGeometry::DetContainer::const_iterator ITG;
63  int npxdets = 0;
64 
65  typedef std::vector<pair<PixelModuleName* , uint32_t> > UNITS;
66  UNITS units;
67 
68  for (ITG it = pDD->dets().begin(); it != pDD->dets().end(); it++){
69  const PixelGeomDetUnit * pxUnit = dynamic_cast<const PixelGeomDetUnit*>(*it);
70  if (pxUnit ==0 ) continue;
71  npxdets++;
72  DetId geomid = pxUnit->geographicalId();
73  PixelModuleName * name = 0;
74  if (1 == geomid.subdetId()) {
75  name = new PixelBarrelName(geomid);
76  } else {
77  name = new PixelEndcapName(geomid);
78 // cout << " NAME: "<<name->name()<<myprint(pxUnit)<<endl;
79  }
80  units.push_back( std::make_pair( name, geomid.rawId() ) );
81  }
82 
83 
84  if (theAssociatorName=="PixelToFEDAssociateFromAscii") {
85  cout <<" HERE PixelToFEDAssociateFromAscii"<<endl;
86  vector<FedSpec> fedSpecs(fedIds.max()-fedIds.min()+1);
87  for (int id=fedIds.first; id<=fedIds.second; id++) {
88  FedSpec fs={ id, vector<PixelModuleName* >(), vector<uint32_t>()};
89  int idx = id - fedIds.min();
90  fedSpecs[idx]= fs;
91  }
92  for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) {
93  PixelModuleName* name = (*iu).first;
94  uint32_t rawId = (*iu).second;
95  int fedId = name2fed( *name);
96  if ( fedIds.inside(fedId) ) {
97  int idx = fedId - fedIds.min();
98  fedSpecs[idx].rawids.push_back(rawId);
99  fedSpecs[idx].names.push_back(name);
100  } else edm::LogError("SiPixelFedCablingMapBuilder")
101  <<"problem with numbering! "<<fedId<<" name: " << name->name();
102  }
103 
104  LogDebug("tracker geometry read")<<"There are: "<< npxdets<<" pixel detetors";
105  // construct FEDs
106  typedef vector<FedSpec>::iterator FI;
107  for ( FI it = fedSpecs.begin(); it != fedSpecs.end(); it++) {
108  int fedId = it->fedId;
109  vector<PixelModuleName* > names = it->names;
110  vector<uint32_t> units = it->rawids;
111  if ( names.size() == 0) continue;
112  PixelFEDCabling fed(fedId);
113  bool barrel = it->names.front()->isBarrel();
114  if (barrel) {
115  PixelFEDCabling::Links links =
116  PixelBarrelLinkMaker(&fed).links(names,units);
117  fed.setLinks(links);
118  result->addFed(fed);
119  } else {
120  PixelFEDCabling::Links links =
121  PixelEndcapLinkMaker(&fed).links(names,units);
122  fed.setLinks(links);
123  result->addFed(fed);
124  }
125  }
126  } else {
128  cout <<" HERE PixelToLNKAssociateFromAscii"<<endl;
129  for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) {
130  PixelModuleName * name = (*iu).first;
131  detectorRocId.module = name;
132  for (int rocDetId=0; rocDetId<=16; rocDetId++) {
133  detectorRocId.rocDetId = rocDetId;
134  const PixelToFEDAssociate::CablingRocId * cablingRocId = name2fed(detectorRocId);
135  if (cablingRocId) {
136  sipixelobjects::PixelROC roc( iu->second, rocDetId, cablingRocId->rocLinkId );
137  result->addItem(cablingRocId->fedId, cablingRocId->linkId, roc);
138  }
139  }
140  }
141  }
142 
143  //clear names:
144  for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) delete iu->first;
145 
146 
147  return result;
148 
149 }
#define LogDebug(id)
static const HistoName names[]
Links links(const Names &n, const DetUnits &u) const
uint32_t rawId() const
get the raw id
Definition: DetId.h:43
virtual std::string version() const =0
version
virtual std::string name() const =0
associated name
tuple result
Definition: query.py:137
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:72
int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:37
Definition: DetId.h:18
tuple idx
DEBUGGING if hasattr(process,&quot;trackMonIterativeTracking2012&quot;): print &quot;trackMonIterativeTracking2012 D...
const T & get() const
Definition: EventSetup.h:55
void addFed(const PixelFEDCabling &f)
add cabling for one fed
tuple cout
Definition: gather_cfg.py:121
void addItem(unsigned int fedId, unsigned int linkId, const sipixelobjects::PixelROC &roc)
dictionary UNITS
Definition: asciidump.py:257
Links links(const Names &n, const DetUnits &u) const

Member Data Documentation

std::string SiPixelFedCablingMapBuilder::theAssociatorName
private

Definition at line 25 of file SiPixelFedCablingMapBuilder.h.

Referenced by produce().