CMS 3D CMS Logo

PixelConfigurationVerifier.cc
Go to the documentation of this file.
1 //
2 //
3 //
4 //
5 
9 #include <set>
10 #include <cassert>
11 
12 using namespace pos;
13 using namespace std;
14 
16  PixelNameTranslation *theNameTranslation,
17  PixelDetectorConfig *theDetConfig) {
18  std::string mthn = "[PixelConfigurationVerifier::checkChannelEnable()]\t\t ";
19  set<PixelChannel> channels = theNameTranslation->getChannels(*theDetConfig);
20 
21  unsigned int fedid = theFEDCard->fedNumber;
22 
23  //use slots 1-36
24 
25  vector<bool> usedChannel(37);
26  for (unsigned int i = 1; i < 37; i++) {
27  usedChannel[i] = false;
28  }
29 
30  set<PixelChannel>::const_iterator iChannel = channels.begin();
31 
32  map<int, int> nrocs;
33  for (; iChannel != channels.end(); ++iChannel) {
34  PixelHdwAddress hdw = theNameTranslation->getHdwAddress(*iChannel);
35  if (fedid == hdw.fednumber()) {
36  unsigned int fedchannel = hdw.fedchannel();
37  assert(fedchannel > 0 && fedchannel < 37);
38  usedChannel[fedchannel] = true;
39  nrocs[fedchannel] = theNameTranslation->getROCsFromChannel(*iChannel).size();
40  }
41  }
42 
43  map<PixelROCName, PixelROCStatus> roclistcopy = theDetConfig->getROCsList();
44  //Now check the channels
45 
46  for (unsigned int jChannel = 1; jChannel < 37; jChannel++) {
47  bool used = theFEDCard->useChannel(jChannel);
48  // if (!used) cout << "Channel="<<jChannel<<" is not used"<<endl;
49  if (used) {
50  // cout << "Channel="<<jChannel<<" is used"<<endl;
51  //check that nROCs is the same from theNameTranslation and theFEDCard
52  if (nrocs[jChannel] != theFEDCard->NRocs[jChannel - 1]) {
53  cout << "[PixelConfigurationVerifier] Warning in FED#" << fedid << ", channel#" << jChannel
54  << ": number of ROCs mismatch: theNameTranslation=" << nrocs[jChannel]
55  << "; theFEDCard=" << theFEDCard->NRocs[jChannel - 1] << endl;
56  }
57  }
58 
59  //only do these checks if the channel exists
60  if (theNameTranslation->FEDChannelExist(fedid, jChannel)) {
61  //make sure that all rocs on a channel have the same noAnalogSignal status
62  vector<PixelROCName> rocsOnThisChannel = theNameTranslation->getROCsFromFEDChannel(fedid, jChannel);
63  bool onehasNAS = false, onedoesnothaveNAS = false;
64  vector<PixelROCName>::const_iterator jROC = rocsOnThisChannel.begin();
65  for (; jROC != rocsOnThisChannel.end(); ++jROC) {
66  PixelROCStatus thisROCstatus = roclistcopy[*jROC];
67  if (thisROCstatus.get(PixelROCStatus::noAnalogSignal))
68  onehasNAS = true;
69  else
70  onedoesnothaveNAS = true;
71  }
72  if (onehasNAS && onedoesnothaveNAS) {
73  cout << "[PixelConfigurationVerifier] Error in FED#" << fedid << ", channel#" << jChannel
74  << ": not all ROCs have the same noAnalogSignal state." << endl;
75  assert(0);
76  }
77 
78  //now if onehasNAS is true, then all must be noAnalogSignal --> turn off this FED channel!
79  if (onehasNAS) {
80  cout << "[PixelConfigurationVerifier] FEDid=" << fedid << ", channel=" << jChannel
81  << ": Channel disabled because ROCs are set to noAnalogSignal" << endl;
82  theFEDCard->setChannel(jChannel, false); //false should disable the channel
83  }
84 
85  if (!onehasNAS && (used != usedChannel[jChannel])) {
86  cout << __LINE__ << "]\t" << mthn << "*******************************************************" << endl;
87  cout << __LINE__ << "]\t" << mthn << "WARNING for fedid=" << fedid << " and channel=" << jChannel
88  << " found that fedcard has channel as " << endl;
89  if (used)
90  cout << __LINE__ << "]\t" << mthn << "used while configuration not using this channel" << endl;
91  if (!used)
92  cout << __LINE__ << "]\t" << mthn << "not used while configuration uses this channel" << endl;
93  cout << __LINE__ << "]\t" << mthn << "The fedcard will be modifed to agree with configuration" << endl;
94  cout << __LINE__ << "]\t" << mthn << "*******************************************************" << endl;
95  theFEDCard->setChannel(jChannel, usedChannel[jChannel]);
96  }
97  }
98  }
99 }
pos::PixelConfigurationVerifier::checkChannelEnable
void checkChannelEnable(PixelFEDCard *theFEDCard, PixelNameTranslation *theNameTranslation, PixelDetectorConfig *theDetConfig)
Definition: PixelConfigurationVerifier.cc:15
mps_fire.i
i
Definition: mps_fire.py:428
pos::PixelNameTranslation::getROCsFromChannel
const std::vector< PixelROCName > & getROCsFromChannel(const PixelChannel &aChannel) const
Definition: PixelNameTranslation.cc:850
pos::PixelFEDCard::useChannel
bool useChannel(unsigned int iChannel)
Definition: PixelFEDCard.cc:2019
pos::PixelHdwAddress::fednumber
unsigned int fednumber() const
Definition: PixelHdwAddress.h:43
PixelROCStatus.h
This class keeps the possible non-standard status a ROC can have.
gather_cfg.cout
cout
Definition: gather_cfg.py:144
pos::PixelDetectorConfig
This is the documentation about PixelDetectorConfig...
Definition: PixelDetectorConfig.h:39
pos
Definition: PixelAliasList.h:18
cms::cuda::assert
assert(be >=bs)
PixelConfigurationVerifier.h
This class performs various tests to make sure that configurations are consistent.
pos::PixelFEDCard::NRocs
int NRocs[36]
Definition: PixelFEDCard.h:115
pos::PixelNameTranslation::getHdwAddress
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
Definition: PixelNameTranslation.cc:449
pos::PixelNameTranslation::getROCsFromFEDChannel
const std::vector< PixelROCName > & getROCsFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const
Definition: PixelNameTranslation.cc:516
pos::PixelFEDCard::setChannel
void setChannel(unsigned int iChannel, bool mode)
Definition: PixelFEDCard.cc:2024
PixelChannel.h
This class implements...
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
pos::PixelNameTranslation::FEDChannelExist
bool FEDChannelExist(unsigned int fednumber, unsigned int fedchannel) const
Definition: PixelNameTranslation.cc:620
pos::PixelFEDCard
This is the documentation about PixelFEDCard...
Definition: PixelFEDCard.h:27
pos::PixelNameTranslation::getChannels
std::set< PixelChannel > getChannels() const
Definition: PixelNameTranslation.cc:426
pos::PixelHdwAddress::fedchannel
unsigned int fedchannel() const
Definition: PixelHdwAddress.h:44
pos::PixelHdwAddress
Store mfec, mfecchannel etc.
Definition: PixelHdwAddress.h:23
PixelSLinkDataInputSource_cfi.fedid
fedid
Definition: PixelSLinkDataInputSource_cfi.py:6
pos::PixelDetectorConfig::getROCsList
const std::map< PixelROCName, PixelROCStatus > & getROCsList() const
Definition: PixelDetectorConfig.h:53
pos::PixelROCStatus::noAnalogSignal
Definition: PixelROCStatus.h:26
std
Definition: JetResolutionObject.h:76
ewkTauDQM_cfi.channels
channels
Definition: ewkTauDQM_cfi.py:14
DeadROCCounter.nrocs
nrocs
Definition: DeadROCCounter.py:57
pos::PixelROCStatus
This class implements..
Definition: PixelROCStatus.h:20
pos::PixelNameTranslation
This is the documentation about PixelNameTranslation...
Definition: PixelNameTranslation.h:41
pos::PixelFEDCard::fedNumber
unsigned long fedNumber
Definition: PixelFEDCard.h:146
pos::PixelROCStatus::get
bool get(ROCstatus stat) const
Definition: PixelROCStatus.cc:57