CMS 3D CMS Logo

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 (edm::ConsumesCollector &&iCC, const std::string fileName, const bool phase1=false)
 

Private Member Functions

std::string myprint (const PixelGeomDetUnit *pxUnit)
 

Private Attributes

std::string fileName_
 
bool phase1_
 
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecordtrackerGeomToken_
 
edm::ESGetToken< TrackerTopology, TrackerTopologyRcdtrackerTopoToken_
 

Detailed Description

Definition at line 17 of file SiPixelFedCablingMapBuilder.h.

Constructor & Destructor Documentation

◆ SiPixelFedCablingMapBuilder()

SiPixelFedCablingMapBuilder::SiPixelFedCablingMapBuilder ( edm::ConsumesCollector &&  iCC,
const std::string  fileName,
const bool  phase1 = false 
)

Definition at line 30 of file SiPixelFedCablingMapBuilder.cc.

33  : fileName_(fileName) //, phase1_(phase1) not used anymore
34 {
37 }

References trackerGeomToken_, and trackerTopoToken_.

Member Function Documentation

◆ myprint()

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

Definition at line 188 of file SiPixelFedCablingMapBuilder.cc.

188  {
189  std::ostringstream str;
190  const PixelTopology& tpl = pxUnit->specificTopology();
192  GlobalPoint global;
193 
194  local = LocalPoint(0, 0, 0);
195  global = (*pxUnit).toGlobal(local);
196  // phi measured from Y axis
197  float phi = 180 * atan2(global.x(), global.y()) / M_PI;
198  if (phi > 180.)
199  phi = phi - 360;
200  float r = global.perp();
201  float z = global.z();
202  str << " POSITION: "
203  << " r=" << r << " phi=" << phi << " z=" << z;
204  str << " (rows,coll:" << tpl.nrows() << "," << tpl.ncolumns() << ")";
205  str << endl;
206  local = LocalPoint(0, 0, 0);
207  str << local << "global: " << (*pxUnit).toGlobal(local) << endl;
208  local = LocalPoint(1, 0, 0);
209  str << local << "global: " << (*pxUnit).toGlobal(local) << endl;
210  local = LocalPoint(0, 1, 0);
211  str << local << "global: " << (*pxUnit).toGlobal(local) << endl;
212  local = LocalPoint(0, 0, 1);
213  str << local << "global: " << (*pxUnit).toGlobal(local) << endl;
214 
215  return str.str();
216 }

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

◆ produce()

SiPixelFedCablingTree * SiPixelFedCablingMapBuilder::produce ( const edm::EventSetup setup)

Definition at line 39 of file SiPixelFedCablingMapBuilder.cc.

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

References LCToCPAssociation_cfi::associator, TrackerGeometry::dets(), PixelToFEDAssociate::CablingRocId::fedId, L1TStage2BMTF_cff::fedIds, fileName_, GeomDet::geographicalId(), TrackerGeometry::isThere(), PixelToFEDAssociate::CablingRocId::linkId, FEDNumbering::MAXSiPixelFEDID, FEDNumbering::MAXSiPixeluTCAFEDID, FEDNumbering::MINSiPixelFEDID, FEDNumbering::MINSiPixeluTCAFEDID, PixelToFEDAssociate::DetectorRocId::module, Skims_PA_cff::name, GeomDetEnumerators::P1PXB, GeomDetEnumerators::P1PXEC, phase1_, edm::ESHandle< T >::product(), DetId::rawId(), mps_fire::result, PixelMapPlotter::roc, PixelToFEDAssociate::DetectorRocId::rocDetId, PixelToFEDAssociate::CablingRocId::rocLinkId, singleTopDQM_cfi::setup, DetId::subdetId(), trackerGeomToken_, trackerTopoToken_, groupFilesInBlocks::tt, units(), PixelToFEDAssociate::version(), and BeamSplash_cfg::version.

Member Data Documentation

◆ fileName_

std::string SiPixelFedCablingMapBuilder::fileName_
private

Definition at line 30 of file SiPixelFedCablingMapBuilder.h.

Referenced by produce().

◆ phase1_

bool SiPixelFedCablingMapBuilder::phase1_
private

Definition at line 32 of file SiPixelFedCablingMapBuilder.h.

Referenced by produce().

◆ trackerGeomToken_

edm::ESGetToken<TrackerGeometry, TrackerDigiGeometryRecord> SiPixelFedCablingMapBuilder::trackerGeomToken_
private

Definition at line 35 of file SiPixelFedCablingMapBuilder.h.

Referenced by produce(), and SiPixelFedCablingMapBuilder().

◆ trackerTopoToken_

edm::ESGetToken<TrackerTopology, TrackerTopologyRcd> SiPixelFedCablingMapBuilder::trackerTopoToken_
private

Definition at line 34 of file SiPixelFedCablingMapBuilder.h.

Referenced by produce(), and SiPixelFedCablingMapBuilder().

LCToCPAssociation_cfi.associator
associator
Definition: LCToCPAssociation_cfi.py:4
SiPixelFedCablingMapBuilder::phase1_
bool phase1_
Definition: SiPixelFedCablingMapBuilder.h:32
edm::ESHandle::product
T const * product() const
Definition: ESHandle.h:86
PixelModuleName
Definition: PixelModuleName.h:12
PixelToFEDAssociate::DetectorRocId::rocDetId
int rocDetId
Definition: PixelToFEDAssociate.h:22
FEDNumbering::MINSiPixelFEDID
Definition: FEDNumbering.h:27
groupFilesInBlocks.tt
int tt
Definition: groupFilesInBlocks.py:144
SiPixelFedCablingMapBuilder::trackerTopoToken_
edm::ESGetToken< TrackerTopology, TrackerTopologyRcd > trackerTopoToken_
Definition: SiPixelFedCablingMapBuilder.h:34
PV3DBase::x
T x() const
Definition: PV3DBase.h:59
FEDNumbering::MAXSiPixelFEDID
Definition: FEDNumbering.h:28
PixelToFEDAssociate::CablingRocId::linkId
int linkId
Definition: PixelToFEDAssociate.h:17
FEDNumbering::MINSiPixeluTCAFEDID
Definition: FEDNumbering.h:105
TrackerTopology
Definition: TrackerTopology.h:16
PixelToFEDAssociate::DetectorRocId::module
const PixelModuleName * module
Definition: PixelToFEDAssociate.h:21
PixelBarrelName
Definition: PixelBarrelName.h:16
edm::LogInfo
Log< level::Info, false > LogInfo
Definition: MessageLogger.h:125
align::LocalPoint
Point3DBase< Scalar, LocalTag > LocalPoint
Definition: Definitions.h:30
MillePedeFileConverter_cfg.fileName
fileName
Definition: MillePedeFileConverter_cfg.py:32
SiPixelFedCablingMapBuilder::fileName_
std::string fileName_
Definition: SiPixelFedCablingMapBuilder.h:30
edm::ConsumesCollector::esConsumes
auto esConsumes()
Definition: ConsumesCollector.h:97
singleTopDQM_cfi.setup
setup
Definition: singleTopDQM_cfi.py:37
units
TString units(TString variable, Char_t axis)
PV3DBase::z
T z() const
Definition: PV3DBase.h:61
PixelToFEDAssociate::version
virtual std::string version() const =0
version
DetId
Definition: DetId.h:17
PixelEndcapName
Definition: PixelEndcapName.h:16
PixelToFEDAssociate
Definition: PixelToFEDAssociate.h:13
GeomDetEnumerators::P1PXEC
Definition: GeomDetEnumerators.h:26
PixelGeomDetUnit
Definition: PixelGeomDetUnit.h:15
TrackerDigiGeometryRecord
Definition: TrackerDigiGeometryRecord.h:16
DDAxes::z
str
#define str(s)
Definition: TestProcessor.cc:53
edm::ESHandle< TrackerGeometry >
PixelTopology::ncolumns
virtual int ncolumns() const =0
Point3DBase< float, LocalTag >
PixelTopology
Definition: PixelTopology.h:10
TRange< int >
TrackerGeometry::isThere
bool isThere(GeomDetEnumerators::SubDetector subdet) const
Definition: TrackerGeometry.cc:219
DetId::subdetId
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum)
Definition: DetId.h:48
PixelToFEDAssociate::CablingRocId::fedId
int fedId
Definition: PixelToFEDAssociate.h:16
GeomDetEnumerators::P1PXB
Definition: GeomDetEnumerators.h:25
GeomDet::geographicalId
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:64
PixelGeomDetUnit::specificTopology
virtual const PixelTopology & specificTopology() const
Returns a reference to the pixel proxy topology.
Definition: PixelGeomDetUnit.cc:17
PV3DBase::y
T y() const
Definition: PV3DBase.h:60
M_PI
#define M_PI
Definition: BXVectorInputProducer.cc:49
TrackerGeometry::dets
const DetContainer & dets() const override
Returm a vector of all GeomDet (including all GeomDetUnits)
Definition: TrackerGeometry.h:62
PixelToLNKAssociateFromAscii
Definition: PixelToLNKAssociateFromAscii.h:20
PixelToFEDAssociate::CablingRocId::rocLinkId
int rocLinkId
Definition: PixelToFEDAssociate.h:18
alignCSCRings.r
r
Definition: alignCSCRings.py:93
DDAxes::phi
sipixelobjects::PixelROC
Definition: PixelROC.h:23
DetId::rawId
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:57
PixelToFEDAssociate::CablingRocId
Definition: PixelToFEDAssociate.h:15
PixelMapPlotter.roc
roc
Definition: PixelMapPlotter.py:498
L1TStage2BMTF_cff.fedIds
fedIds
Definition: L1TStage2BMTF_cff.py:10
Skims_PA_cff.name
name
Definition: Skims_PA_cff.py:17
FEDNumbering::MAXSiPixeluTCAFEDID
Definition: FEDNumbering.h:106
SiPixelFedCablingMapBuilder::trackerGeomToken_
edm::ESGetToken< TrackerGeometry, TrackerDigiGeometryRecord > trackerGeomToken_
Definition: SiPixelFedCablingMapBuilder.h:35
PixelToFEDAssociate::DetectorRocId
Definition: PixelToFEDAssociate.h:20
mps_fire.result
result
Definition: mps_fire.py:311
DTRecHitClients_cfi.local
local
Definition: DTRecHitClients_cfi.py:10
TrackerTopologyRcd
Definition: TrackerTopologyRcd.h:10
PixelTopology::nrows
virtual int nrows() const =0
BeamSplash_cfg.version
version
Definition: BeamSplash_cfg.py:45
SiPixelFedCablingTree
Definition: SiPixelFedCablingTree.h:13
PV3DBase::perp
T perp() const
Definition: PV3DBase.h:69
TrackerGeometry
Definition: TrackerGeometry.h:14