00001
00002
00003
00004
00005
00006 #include "CalibFormats/SiPixelObjects/interface/PixelConfigurationVerifier.h"
00007 #include "CalibFormats/SiPixelObjects/interface/PixelChannel.h"
00008 #include <set>
00009 #include <assert.h>
00010
00011 using namespace pos;
00012 using namespace std;
00013
00014
00015 void PixelConfigurationVerifier::checkChannelEnable(PixelFEDCard *theFEDCard,
00016 PixelNameTranslation *theNameTranslation,
00017 PixelDetectorConfig *theDetConfig){
00018
00019 set<PixelChannel> channels=theNameTranslation->getChannels(*theDetConfig);
00020
00021 unsigned int fedid=theFEDCard->fedNumber;
00022
00023
00024
00025 vector<bool> usedChannel(37);
00026 for(unsigned int i=1;i<37;i++){
00027 usedChannel[i]=false;
00028 }
00029
00030 set<PixelChannel>::const_iterator iChannel=channels.begin();
00031
00032
00033 for(;iChannel!=channels.end();++iChannel){
00034 PixelHdwAddress hdw=theNameTranslation->getHdwAddress(*iChannel);
00035 if (fedid==hdw.fednumber()){
00036 unsigned int fedchannel=hdw.fedchannel();
00037 assert(fedchannel>0&&fedchannel<37);
00038 usedChannel[fedchannel]=true;
00039 }
00040 }
00041
00042
00043
00044 for(unsigned int iChannel=1;iChannel<37;iChannel++){
00045 bool used=theFEDCard->useChannel(iChannel);
00046
00047
00048 if (used!=usedChannel[iChannel]) {
00049 cout << "*******************************************************"<<endl;
00050 cout << "WARNING for fedid="<<fedid<<" and channel="<<iChannel;
00051 cout << " found that fedcard has channel as"<<endl;
00052 if (used) cout << "used while configuration not using this channel"
00053 << endl;
00054 if (!used)cout << "not used while configuration uses this channel"
00055 << endl;
00056 cout << "The fedcard will be modifed to agree with configuration"<<endl;
00057 cout << "*******************************************************"<<endl;
00058 theFEDCard->setChannel(iChannel,usedChannel[iChannel]);
00059 }
00060 }
00061
00062 }