CMS 3D CMS Logo

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
List of all members | Public Member Functions
pos::PixelConfigurationVerifier Class Reference

This class performs various tests to make sure that configurations are consistent. More...

#include "interface/PixelConfigurationVerifier.h"

Public Member Functions

void checkChannelEnable (PixelFEDCard *theFEDCard, PixelNameTranslation *theNameTranslation, PixelDetectorConfig *theDetConfig)
 
 PixelConfigurationVerifier ()
 
virtual ~PixelConfigurationVerifier ()
 

Detailed Description

This class performs various tests to make sure that configurations are consistent.

This class collects the information about the range of DAC settings used in scans of the DACs.

A longer explanation will be placed here later

Definition at line 23 of file PixelConfigurationVerifier.h.

Constructor & Destructor Documentation

◆ PixelConfigurationVerifier()

pos::PixelConfigurationVerifier::PixelConfigurationVerifier ( )
inline

Definition at line 25 of file PixelConfigurationVerifier.h.

25 {}

◆ ~PixelConfigurationVerifier()

virtual pos::PixelConfigurationVerifier::~PixelConfigurationVerifier ( )
inlinevirtual

Definition at line 26 of file PixelConfigurationVerifier.h.

26 {}

Member Function Documentation

◆ checkChannelEnable()

void PixelConfigurationVerifier::checkChannelEnable ( PixelFEDCard theFEDCard,
PixelNameTranslation theNameTranslation,
PixelDetectorConfig theDetConfig 
)

Definition at line 15 of file PixelConfigurationVerifier.cc.

References cms::cuda::assert(), ewkTauDQM_cfi::channels, gather_cfg::cout, pos::PixelHdwAddress::fedchannel(), pos::PixelNameTranslation::FEDChannelExist(), PixelSLinkDataInputSource_cfi::fedid, pos::PixelHdwAddress::fednumber(), pos::PixelFEDCard::fedNumber, pos::PixelROCStatus::get(), pos::PixelNameTranslation::getChannels(), pos::PixelNameTranslation::getHdwAddress(), pos::PixelNameTranslation::getROCsFromChannel(), pos::PixelNameTranslation::getROCsFromFEDChannel(), pos::PixelDetectorConfig::getROCsList(), mps_fire::i, pos::PixelROCStatus::noAnalogSignal, DeadROCCounter::nrocs, pos::PixelFEDCard::NRocs, pos::PixelFEDCard::setChannel(), AlCaHLTBitMon_QueryRunRegistry::string, and pos::PixelFEDCard::useChannel().

17  {
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 }
bool FEDChannelExist(unsigned int fednumber, unsigned int fedchannel) const
const std::vector< PixelROCName > & getROCsFromChannel(const PixelChannel &aChannel) const
unsigned int fedchannel() const
assert(be >=bs)
const std::vector< PixelROCName > & getROCsFromFEDChannel(unsigned int fednumber, unsigned int fedchannel) const
bool useChannel(unsigned int iChannel)
std::set< PixelChannel > getChannels() const
Store mfec, mfecchannel etc.
const std::map< PixelROCName, PixelROCStatus > & getROCsList() const
const PixelHdwAddress * getHdwAddress(const PixelROCName &aROC) const
This class implements..
void setChannel(unsigned int iChannel, bool mode)
unsigned long fedNumber
Definition: PixelFEDCard.h:146
bool get(ROCstatus stat) const
unsigned int fednumber() const