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 fileName, const bool phase1=false)
 

Private Member Functions

std::string myprint (const PixelGeomDetUnit *pxUnit)
 

Private Attributes

std::string fileName_
 
bool phase1_
 

Detailed Description

Definition at line 14 of file SiPixelFedCablingMapBuilder.h.

Constructor & Destructor Documentation

SiPixelFedCablingMapBuilder::SiPixelFedCablingMapBuilder ( const std::string  fileName,
const bool  phase1 = false 
)

Definition at line 33 of file SiPixelFedCablingMapBuilder.cc.

34  :
35  fileName_(fileName) //, phase1_(phase1) not used anymore
36 { }

Member Function Documentation

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

Definition at line 191 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(), z, and PV3DBase< T, PVType, FrameType >::z().

192 {
193  std::ostringstream str;
194  const PixelTopology & tpl = pxUnit->specificTopology();
195  LocalPoint local;
196  GlobalPoint global;
197 
198  local = LocalPoint(0,0,0); global = (*pxUnit).toGlobal(local);
199  // phi measured from Y axis
200  float phi = 180*atan2(global.x(),global.y())/M_PI; if (phi > 180.) phi = phi-360;
201  float r = global.perp();
202  float z = global.z();
203  str <<" POSITION: "<<" r="<<r<<" phi="<<phi<<" z="<<z;
204  str <<" (rows,coll:"<<tpl.nrows()<<","<<tpl.ncolumns()<<")";
205  str <<endl;
206  local = LocalPoint(0,0,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
207  local = LocalPoint(1,0,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
208  local = LocalPoint(0,1,0); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
209  local = LocalPoint(0,0,1); str <<local<<"global: "<<(*pxUnit).toGlobal(local) <<endl;
210 
211  return str.str();
212 }
T perp() const
Definition: PV3DBase.h:72
virtual int ncolumns() const =0
T y() const
Definition: PV3DBase.h:63
virtual int nrows() const =0
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
SiPixelFedCablingTree * SiPixelFedCablingMapBuilder::produce ( const edm::EventSetup setup)

Definition at line 39 of file SiPixelFedCablingMapBuilder.cc.

References SiPixelFedCablingTree::addItem(), PixelToFEDAssociate::CablingRocId::fedId, fileName_, GeomDet::geographicalId(), edm::EventSetup::get(), PixelToFEDAssociate::CablingRocId::linkId, FEDNumbering::MAXSiPixelFEDID, FEDNumbering::MAXSiPixeluTCAFEDID, FEDNumbering::MINSiPixelFEDID, FEDNumbering::MINSiPixeluTCAFEDID, PixelToFEDAssociate::DetectorRocId::module, PixelModuleName::name(), mergeVDriftHistosByStation::name, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, phase1_, edm::ESHandle< class >::product(), DetId::rawId(), mps_fire::result, PixelToFEDAssociate::DetectorRocId::rocDetId, PixelToFEDAssociate::CablingRocId::rocLinkId, DetId::subdetId(), groupFilesInBlocks::tt, units(), PixelToFEDAssociate::version(), and relval_steps::version.

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

39  {
40 
41  // Access geometry
42  edm::LogInfo("read tracker geometry...");
44  setup.get<TrackerDigiGeometryRecord>().get( pDD );
45  edm::LogInfo("tracker geometry read")<<"There are: "<< pDD->dets().size() <<" detectors";
46 
47  // Test new TrackerGeometry features
48  //cout << "Test of TrackerGeometry::isThere";
49  //cout << " is there PixelBarrel: " << pDD->isThere(GeomDetEnumerators::PixelBarrel);
50  //cout << " is there PixelEndcap: " << pDD->isThere(GeomDetEnumerators::PixelEndcap);
51  //cout << " is there P1PXB: " << pDD->isThere(GeomDetEnumerators::P1PXB);
52  //cout << " is there P1PXEC: " << pDD->isThere(GeomDetEnumerators::P1PXEC);
53  //cout << endl;
54 
55  // switch on the phase1
56  if( (pDD->isThere(GeomDetEnumerators::P1PXB)) ||
57  (pDD->isThere(GeomDetEnumerators::P1PXEC)) ) {
58  phase1_ = true;
59  //cout<<" this is phase1 "<<endl;
60  edm::LogInfo("SiPixelFedCablingMapBuilder")<<" pixel phase1 setup ";
61  } else {
62  phase1_ = false;
63  //cout<<" this is phase0 "<<endl;
64  edm::LogInfo("SiPixelFedCablingMapBuilder")<<" pixel phase0 setup ";
65  }
66 
67  int MINFEDID = FEDNumbering::MINSiPixelFEDID;
68  int MAXFEDID = FEDNumbering::MAXSiPixelFEDID;
69  if(phase1_) {
70  // bpix 1200-1239, fpix 1240-1255
72  MAXFEDID = FEDNumbering::MAXSiPixeluTCAFEDID; // is actually 1349, might work
73  }
74  TRange<int> fedIds(MINFEDID,MAXFEDID);
75  edm::LogInfo("SiPixelFedCablingMapBuilder")<<"pixel fedid range: "<<fedIds;
76 
77  // in the constrcuctor init() is called which reads the ascii file and makes
78  // the map roc<->link
79  // what is this junk? Replace by fixed associator.
80  //edm::ESHandle<PixelToFEDAssociate> associator;
81  //setup.get<TrackerDigiGeometryRecord>().get(theAssociatorName,associator);
82  //PixelToFEDAssociate * associator = new PixelToLNKAssociateFromAscii("pixelToLNK.ascii",phase1_);
84 
85  const PixelToFEDAssociate & name2fed = *associator;
86 
87  string version = name2fed.version();
89  edm::LogInfo(" version ")<<version<<endl;
90 
91  // Access topology
93  setup.get<TrackerTopologyRcd>().get(tTopo);
94  const TrackerTopology* tt = tTopo.product();
95 
96  typedef TrackerGeometry::DetContainer::const_iterator ITG;
97  int npxdets = 0;
98 
99  typedef std::vector<pair<PixelModuleName* , uint32_t> > UNITS;
100  UNITS units;
101 
102  for (ITG it = pDD->dets().begin(); it != pDD->dets().end(); it++) {
103  const PixelGeomDetUnit * pxUnit = dynamic_cast<const PixelGeomDetUnit*>(*it);
104  if (pxUnit ==0 ) continue;
105  npxdets++;
106  DetId geomid = pxUnit->geographicalId();
107  PixelModuleName * name = 0;
108  if (1 == geomid.subdetId()) { // bpix
109  name = new PixelBarrelName(geomid,tt,phase1_);
110  } else { // fpix
111  name = new PixelEndcapName(geomid,tt,phase1_);
112  }
113  edm::LogInfo(" NAME: ")<<name->name();
114  //cout << " NAME: "<<name->name()<<" "<<geomid.rawId()<<
115  //" "<<myprint(pxUnit)<<endl;
116  units.push_back( std::make_pair( name, geomid.rawId() ) );
117  }
118 
119  // This produces a simple, unrealistic map, NOT USED ANYMORE
120  // if (theAssociatorName=="PixelToFEDAssociateFromAscii") {
121  // cout <<" HERE PixelToFEDAssociateFromAscii"<<endl;
122  // vector<FedSpec> fedSpecs(fedIds.max()-fedIds.min()+1);
123  // for (int id=fedIds.first; id<=fedIds.second; id++) {
124  // FedSpec fs={ id, vector<PixelModuleName* >(), vector<uint32_t>()};
125  // int idx = id - fedIds.min();
126  // fedSpecs[idx]= fs;
127  // }
128  // for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) {
129  // PixelModuleName* name = (*iu).first;
130  // uint32_t rawId = (*iu).second;
131  // int fedId = name2fed( *name);
132  // if ( fedIds.inside(fedId) ) {
133  // int idx = fedId - fedIds.min();
134  // fedSpecs[idx].rawids.push_back(rawId);
135  // fedSpecs[idx].names.push_back(name);
136  // } else edm::LogError("SiPixelFedCablingMapBuilder")
137  // <<"problem with numbering! "<<fedId<<" name: " << name->name();
138  // }
139  // edm::LogInfo("tracker geometry read")<<"There are: "<< npxdets<<" pixel detetors";
140  // // construct FEDs
141  // typedef vector<FedSpec>::iterator FI;
142  // for ( FI it = fedSpecs.begin(); it != fedSpecs.end(); it++) {
143  // int fedId = it->fedId;
144  // vector<PixelModuleName* > names = it->names;
145  // vector<uint32_t> units = it->rawids;
146  // if ( names.size() == 0) continue;
147  // PixelFEDCabling fed(fedId);
148  // bool barrel = it->names.front()->isBarrel();
149  // if (barrel) {
150  // PixelFEDCabling::Links links =
151  // PixelBarrelLinkMaker(&fed).links(names,units);
152  // fed.setLinks(links);
153  // result->addFed(fed);
154  // } else {
155  // PixelFEDCabling::Links links =
156  // PixelEndcapLinkMaker(&fed).links(names,units);
157  // fed.setLinks(links);
158  // result->addFed(fed);
159  // }
160  // }
161  // } else { // This is what is really used
162 
164  edm::LogInfo(" HERE PixelToLNKAssociateFromAscii");
165  for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) {
166  PixelModuleName * name = (*iu).first;
167  detectorRocId.module = name;
168  //for (int rocDetId=0; rocDetId<=16; rocDetId++) {
169  for (int rocDetId=0; rocDetId<16; rocDetId++) {
170  detectorRocId.rocDetId = rocDetId;
171  const PixelToFEDAssociate::CablingRocId * cablingRocId = name2fed(detectorRocId);
172  if (cablingRocId) {
173  sipixelobjects::PixelROC roc( iu->second, rocDetId, cablingRocId->rocLinkId );
174  result->addItem(cablingRocId->fedId, cablingRocId->linkId, roc);
175  edm::LogInfo(" ok ")<<name->name()<<" "<<rocDetId<<" "<<cablingRocId->fedId<<" "
176  <<cablingRocId->linkId;
177  } else { // did it fail?
178  edm::LogInfo(" failed ")<<name->name()<<" "<<rocDetId;
179  //cout<<" failed "<<name->name()<<" "<<rocDetId<<endl;
180  }
181  }
182  }
183  //}
184 
185  //clear names:
186  for (UNITS::iterator iu=units.begin(); iu != units.end(); iu++) delete iu->first;
187 
188  return result;
189 
190 }
tuple result
Definition: mps_fire.py:83
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
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
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
const T & get() const
Definition: EventSetup.h:56
T const * product() const
Definition: ESHandle.h:86
TString units(TString variable, Char_t axis)
void addItem(unsigned int fedId, unsigned int linkId, const sipixelobjects::PixelROC &roc)

Member Data Documentation

std::string SiPixelFedCablingMapBuilder::fileName_
private

Definition at line 28 of file SiPixelFedCablingMapBuilder.h.

Referenced by produce().

bool SiPixelFedCablingMapBuilder::phase1_
private

Definition at line 30 of file SiPixelFedCablingMapBuilder.h.

Referenced by produce().