CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros 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

pos::PixelConfigurationVerifier::PixelConfigurationVerifier ( )
inline

Definition at line 27 of file PixelConfigurationVerifier.h.

27 {}
virtual pos::PixelConfigurationVerifier::~PixelConfigurationVerifier ( )
inlinevirtual

Definition at line 28 of file PixelConfigurationVerifier.h.

28 {}

Member Function Documentation

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

Definition at line 16 of file PixelConfigurationVerifier.cc.

References assert(), gather_cfg::cout, pos::PixelHdwAddress::fedchannel(), pos::PixelNameTranslation::FEDChannelExist(), pos::PixelHdwAddress::fednumber(), pos::PixelFEDCard::fedNumber, pos::PixelROCStatus::get(), pos::PixelNameTranslation::getChannels(), pos::PixelNameTranslation::getHdwAddress(), pos::PixelNameTranslation::getROCsFromChannel(), pos::PixelNameTranslation::getROCsFromFEDChannel(), pos::PixelDetectorConfig::getROCsList(), i, pos::PixelROCStatus::noAnalogSignal, pos::PixelFEDCard::NRocs, pos::PixelFEDCard::setChannel(), AlCaHLTBitMon_QueryRunRegistry::string, and pos::PixelFEDCard::useChannel().

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