CMS 3D CMS Logo

List of all members | Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
SiPixelFedCablingMap Class Reference

#include <SiPixelFedCablingMap.h>

Inheritance diagram for SiPixelFedCablingMap:
SiPixelFedCabling

Classes

struct  Key
 

Public Member Functions

std::unique_ptr< SiPixelFedCablingTreecablingTree () const
 
std::unordered_map< uint32_t, unsigned int > det2fedMap () const final
 
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > det2PathMap () const final
 
std::vector< unsigned int > fedIds () const
 
const sipixelobjects::PixelROCfindItem (const sipixelobjects::CablingPathToDetUnit &path) const final
 
void initializeRocs ()
 
std::vector< sipixelobjects::CablingPathToDetUnitpathToDetUnit (uint32_t rawDetId) const final
 
bool pathToDetUnitHasDetUnit (uint32_t rawDetId, unsigned int fedId) const final
 
 SiPixelFedCablingMap (const SiPixelFedCablingTree *cab)
 
 SiPixelFedCablingMap (const std::string &version="")
 
std::string version () const override
 
 ~SiPixelFedCablingMap () override
 
- Public Member Functions inherited from SiPixelFedCabling
virtual ~SiPixelFedCabling ()
 

Private Types

typedef std::map< Key, sipixelobjects::PixelROCMap
 

Private Member Functions

template<class Archive >
void serialize (Archive &ar, const unsigned int version)
 

Private Attributes

Map theMap
 
std::string theVersion
 

Friends

class boost::serialization::access
 
template<typename CondSerializationT , typename Enabled >
struct cond::serialization::access
 

Detailed Description

Definition at line 22 of file SiPixelFedCablingMap.h.

Member Typedef Documentation

Definition at line 59 of file SiPixelFedCablingMap.h.

Constructor & Destructor Documentation

SiPixelFedCablingMap::SiPixelFedCablingMap ( const SiPixelFedCablingTree cab)

Definition at line 70 of file SiPixelFedCablingMap.cc.

References SiPixelFedCablingTree::fedList(), hcaldqm::constants::fedList, crabWrapper::key, sipixelobjects::PixelFEDLink::numberOfROCs(), sipixelobjects::PixelFEDLink::roc(), and theMap.

71  : theVersion(cab->version())
72 {
73 
74  // Never called
75  std::vector<const PixelFEDCabling *> fedList = cab->fedList();
76  for (std::vector<const PixelFEDCabling *>::const_iterator ifed=fedList.begin();
77  ifed != fedList.end(); ifed++) {
78  unsigned int fed = (**ifed).id();
79  unsigned int numLink = (**ifed).numberOfLinks();
80  for (unsigned int link=1; link <= numLink; link++) {
81  const PixelFEDLink * pLink = (**ifed).link(link);
82  if (pLink==nullptr) continue;
83  //unsigned int linkId = pLink->id();
84  //if (linkId != 0 && linkId!= link)
85  // std::cout << "PROBLEM WITH LINK NUMBER!!!!" << std::endl;
86  unsigned int numberROC = pLink->numberOfROCs();
87 
88  for (unsigned int roc=1; roc <= numberROC; roc++) {
89  const PixelROC * pROC = pLink->roc(roc);
90  if (pROC==nullptr) continue;
91  //if (pROC->idInLink() != roc)
92  // std::cout << "PROBLEM WITH ROC NUMBER!!!!" << std::endl;
93  Key key = {fed, link, roc};
94  theMap[key] = (*pROC);
95  }
96  }
97  } // fed loop
98 
99 }
std::vector< unsigned int > const fedList
Definition: Constants.h:87
std::string version() const override
map version
std::vector< const PixelFEDCabling * > fedList() const
SiPixelFedCablingMap::SiPixelFedCablingMap ( const std::string &  version = "")
inline

Definition at line 28 of file SiPixelFedCablingMap.h.

References initializeRocs().

28 : theVersion(version) {}
std::string version() const override
SiPixelFedCablingMap::~SiPixelFedCablingMap ( )
inlineoverride

Definition at line 32 of file SiPixelFedCablingMap.h.

References cablingTree().

32 {}

Member Function Documentation

std::unique_ptr< SiPixelFedCablingTree > SiPixelFedCablingMap::cablingTree ( ) const

Definition at line 101 of file SiPixelFedCablingMap.cc.

References l1t::stage2::layer2::fedId, theMap, theVersion, and compare::tree.

Referenced by PixelUnpackingRegions::initialize(), SiPixelDigiToRaw::produce(), SiPixelRawToDigi::produce(), SelectedElectronFEDListProducer< TEle, TCand >::produce(), and ~SiPixelFedCablingMap().

101  {
102 
103  std::unique_ptr<SiPixelFedCablingTree> tree(new SiPixelFedCablingTree(theVersion));
104  for (Map::const_iterator im = theMap.begin(); im != theMap.end(); im++) {
105  const sipixelobjects::PixelROC & roc = im->second;
106  unsigned int fedId = im->first.fed;
107  unsigned int linkId = im->first.link;
108  tree->addItem(fedId, linkId, roc);
109  }
110  return tree;
111 }
Definition: tree.py:1
std::unordered_map< uint32_t, unsigned int > SiPixelFedCablingMap::det2fedMap ( ) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 132 of file SiPixelFedCablingMap.cc.

References mps_fire::result, and theMap.

Referenced by SiPixelCoordinates::init(), and version().

132  {
133  std::unordered_map<uint32_t, unsigned int> result;
134  for (auto im = theMap.begin(); im != theMap.end(); ++im) {
135  result[im->second.rawId()] = im->first.fed; // we know: a det is in only one fed!
136  }
137  return result;
138 }
std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > SiPixelFedCablingMap::det2PathMap ( ) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 140 of file SiPixelFedCablingMap.cc.

References callgraph::path, mps_fire::result, and theMap.

Referenced by version().

140  {
141  std::map< uint32_t,std::vector<sipixelobjects::CablingPathToDetUnit> > result;
142  for (auto im = theMap.begin(); im != theMap.end(); ++im) {
143  CablingPathToDetUnit path = {im->first.fed, im->first.link, im->first.roc};
144  result[im->second.rawId()].push_back(path);
145  }
146  return result;
147 }
std::vector< unsigned int > SiPixelFedCablingMap::fedIds ( ) const

Definition at line 113 of file SiPixelFedCablingMap.cc.

References l1t::stage2::layer2::fedId, spr::find(), mps_fire::result, and theMap.

Referenced by SiPixelCoordinates::fedid(), SiPixelDigiToRaw::produce(), SiPixelRawToDigi::produce(), and version().

113  {
114  std::vector<unsigned int> result;
115  for (Map::const_iterator im = theMap.begin(); im != theMap.end(); im++) {
116  unsigned int fedId = im->first.fed;
117  if (find(result.begin(),result.end(),fedId) == result.end()) result.push_back(fedId);
118  }
119  return result;
120 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
const sipixelobjects::PixelROC * SiPixelFedCablingMap::findItem ( const sipixelobjects::CablingPathToDetUnit path) const
finalvirtual
void SiPixelFedCablingMap::initializeRocs ( )

Definition at line 12 of file SiPixelFedCablingMap.cc.

References gather_cfg::cout, l1t::stage2::layer2::fedId, plotBeamSpotDB::first, FEDNumbering::MINSiPixeluTCAFEDID, and findQualityFiles::v.

Referenced by SiPixelFedCablingMap().

12  {
13 
14  // OLD Method
15  //for (auto & v : theMap) v.second.initFrameConversion();
16  // below is the new code, works for phase0 and phase1
17 
18  // Decide if it is phase0 or phase1 based on the first fed, 0-phase0, 1200-phase1
19  unsigned int fedId = (theMap.begin())->first.fed; // get the first fed
20 
21  // Specifically for CMSSW_9_0_X, we need to call a different version of the frame
22  // conversion steered by the version name in the cabling map
23  if (theVersion.find("CMSSW_9_0_X")!=std::string::npos) {
24  for (auto & v : theMap) v.second.initFrameConversionPhase1_CMSSW_9_0_X(); // works
25  std::cout<<"*** Found CMSSW_9_0_X specific cabling map\n";
26  return;
27  }
28 
29  if(fedId>=FEDNumbering::MINSiPixeluTCAFEDID) { // phase1 >= 1200
30  for (auto & v : theMap) v.second.initFrameConversionPhase1(); // works
31  } else { // phase0
32  for (auto & v : theMap) v.second.initFrameConversion(); // works
33  }
34 
35  // if(0) { // for testing
36  // for (Map::iterator im = theMap.begin(); im != theMap.end(); im++) {
37  // unsigned int fedId = im->first.fed;
38  // unsigned int linkId = im->first.link;
39  // unsigned int rocId = im->first.roc;
40  // auto rawDetID = im->second.rawId();
41  // auto idInDetUnit = im->second.idInDetUnit();
42  // auto idInLink = im->second.idInLink();
43  // //auto v = *im;
44  // if(fedId>=1200) {
45  // //v.second.initFrameConversionPhase1(); //
46  // im->second.initFrameConversionPhase1(); //
47  // } else {
48  // im->second.initFrameConversion();
49  // }
50  // } //
51  // } // end if(0)
52 
53 }
std::vector< sipixelobjects::CablingPathToDetUnit > SiPixelFedCablingMap::pathToDetUnit ( uint32_t  rawDetId) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 150 of file SiPixelFedCablingMap.cc.

References callgraph::path, mps_fire::result, and theMap.

Referenced by Phase2TrackerDigitizerAlgorithm::module_killing_DB(), SiPixelDigitizerAlgorithm::module_killing_DB(), and version().

151  {
152 
153  std::vector<sipixelobjects::CablingPathToDetUnit> result;
154  for (auto im = theMap.begin(); im != theMap.end(); ++im) {
155  if(im->second.rawId()==rawDetId ) {
156  CablingPathToDetUnit path = {im->first.fed, im->first.link, im->first.roc};
157  result.push_back(path);
158  }
159  }
160  return result;
161 }
bool SiPixelFedCablingMap::pathToDetUnitHasDetUnit ( uint32_t  rawDetId,
unsigned int  fedId 
) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 163 of file SiPixelFedCablingMap.cc.

References end, l1t::stage2::layer2::fedId, and theMap.

Referenced by version().

163  {
164 
165  auto end = theMap.end();
166  for (auto im = theMap.lower_bound( {fedId, 0, 0} );
167  im != end and im->first.fed == fedId; ++im) {
168  if(im->second.rawId()==rawDetId ) {
169  return true;
170  }
171  }
172  return false;
173 }
#define end
Definition: vmac.h:39
template<class Archive >
void SiPixelFedCablingMap::serialize ( Archive &  ar,
const unsigned int  version 
)
private
std::string SiPixelFedCablingMap::version ( ) const
inlineoverridevirtual

Friends And Related Function Documentation

friend class boost::serialization::access
friend

Definition at line 62 of file SiPixelFedCablingMap.h.

template<typename CondSerializationT , typename Enabled >
friend struct cond::serialization::access
friend

Definition at line 62 of file SiPixelFedCablingMap.h.

Member Data Documentation

Map SiPixelFedCablingMap::theMap
private
std::string SiPixelFedCablingMap::theVersion
private

Definition at line 58 of file SiPixelFedCablingMap.h.

Referenced by cablingTree(), and version().