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 19 of file SiPixelFedCablingMap.h.

Member Typedef Documentation

◆ Map

Definition at line 54 of file SiPixelFedCablingMap.h.

Constructor & Destructor Documentation

◆ SiPixelFedCablingMap() [1/2]

SiPixelFedCablingMap::SiPixelFedCablingMap ( const SiPixelFedCablingTree cab)

Definition at line 75 of file SiPixelFedCablingMap.cc.

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

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

◆ SiPixelFedCablingMap() [2/2]

SiPixelFedCablingMap::SiPixelFedCablingMap ( const std::string &  version = "")
inline

Definition at line 23 of file SiPixelFedCablingMap.h.

23 : theVersion(version) {}
std::string version() const override

◆ ~SiPixelFedCablingMap()

SiPixelFedCablingMap::~SiPixelFedCablingMap ( )
inlineoverride

Definition at line 27 of file SiPixelFedCablingMap.h.

27 {}

Member Function Documentation

◆ cablingTree()

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

◆ det2fedMap()

std::unordered_map< uint32_t, unsigned int > SiPixelFedCablingMap::det2fedMap ( ) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 133 of file SiPixelFedCablingMap.cc.

References mps_fire::result, and theMap.

Referenced by SiPixelFEDChannelContainerFromQualityConverter::createFromSiPixelQuality(), FastSiPixelFEDChannelContainerFromQuality::createFromSiPixelQuality(), SiPixelTopoFinder::init(), and SiPixelCoordinates::init().

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

◆ det2PathMap()

std::map< uint32_t, std::vector< sipixelobjects::CablingPathToDetUnit > > SiPixelFedCablingMap::det2PathMap ( ) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 141 of file SiPixelFedCablingMap.cc.

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

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

◆ fedIds()

std::vector< unsigned int > SiPixelFedCablingMap::fedIds ( ) const

Definition at line 114 of file SiPixelFedCablingMap.cc.

References l1tstage2_dqm_sourceclient-live_cfg::fedId, spr::find(), mps_fire::result, and theMap.

Referenced by SiPixelCoordinates::fedid(), SiPixelROCsStatusAndMappingWrapper::getModToUnpRegionalAsync(), SiPixelRawToDigi::produce(), and SiPixelROCsStatusAndMappingWrapper::SiPixelROCsStatusAndMappingWrapper().

114  {
115  std::vector<unsigned int> result;
116  for (Map::const_iterator im = theMap.begin(); im != theMap.end(); im++) {
117  unsigned int fedId = im->first.fed;
118  if (find(result.begin(), result.end(), fedId) == result.end())
119  result.push_back(fedId);
120  }
121  return result;
122 }
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:19

◆ findItem()

const sipixelobjects::PixelROC * SiPixelFedCablingMap::findItem ( const sipixelobjects::CablingPathToDetUnit path) const
finalvirtual

◆ initializeRocs()

void SiPixelFedCablingMap::initializeRocs ( )

Definition at line 12 of file SiPixelFedCablingMap.cc.

References gather_cfg::cout, l1tstage2_dqm_sourceclient-live_cfg::fedId, dqmdumpme::first, caHitNtupletGeneratorKernels::if(), FEDNumbering::MINSiPixeluTCAFEDID, and findQualityFiles::v.

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

◆ pathToDetUnit()

std::vector< sipixelobjects::CablingPathToDetUnit > SiPixelFedCablingMap::pathToDetUnit ( uint32_t  rawDetId) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 150 of file SiPixelFedCablingMap.cc.

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

Referenced by SiPixelFEDChannelContainerFromQualityConverter::createFromSiPixelQuality(), FastSiPixelFEDChannelContainerFromQuality::createFromSiPixelQuality(), PixelDigitizerAlgorithm::module_killing_DB(), SiPixelDigitizerAlgorithm::module_killing_DB(), and SiPixelDigitizerAlgorithm::pixel_inefficiency().

150  {
151  std::vector<sipixelobjects::CablingPathToDetUnit> result;
152  for (auto im = theMap.begin(); im != theMap.end(); ++im) {
153  if (im->second.rawId() == rawDetId) {
154  CablingPathToDetUnit path = {im->first.fed, im->first.link, im->first.roc};
155  result.push_back(path);
156  }
157  }
158  return result;
159 }

◆ pathToDetUnitHasDetUnit()

bool SiPixelFedCablingMap::pathToDetUnitHasDetUnit ( uint32_t  rawDetId,
unsigned int  fedId 
) const
finalvirtual

Implements SiPixelFedCabling.

Definition at line 161 of file SiPixelFedCablingMap.cc.

References mps_fire::end, l1tstage2_dqm_sourceclient-live_cfg::fedId, and theMap.

161  {
162  auto end = theMap.end();
163  for (auto im = theMap.lower_bound({fedId, 0, 0}); im != end and im->first.fed == fedId; ++im) {
164  if (im->second.rawId() == rawDetId) {
165  return true;
166  }
167  }
168  return false;
169 }

◆ serialize()

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

◆ version()

std::string SiPixelFedCablingMap::version ( ) const
inlineoverridevirtual

Implements SiPixelFedCabling.

Definition at line 33 of file SiPixelFedCablingMap.h.

References theVersion.

Referenced by validation.Sample::datasetpattern(), and validation.Sample::filename().

33 { return theVersion; }

Friends And Related Function Documentation

◆ boost::serialization::access

friend class boost::serialization::access
friend

Definition at line 57 of file SiPixelFedCablingMap.h.

◆ cond::serialization::access

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

Definition at line 57 of file SiPixelFedCablingMap.h.

Member Data Documentation

◆ theMap

Map SiPixelFedCablingMap::theMap
private

◆ theVersion

std::string SiPixelFedCablingMap::theVersion
private

Definition at line 53 of file SiPixelFedCablingMap.h.

Referenced by cablingTree(), and version().