Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-06 08:14:00

0001 #include "InttHotMap.h"
0002 
0003 #include <iostream>
0004 #include <fstream>
0005 
0006 using namespace std;
0007 
0008 bool InttHotMap::Readfile(const char* hotfile) {
0009 
0010   ifstream fin(hotfile);
0011   if(!fin){
0012     cout<<"failed to open : "<<hotfile<<endl;
0013     return false;
0014   }
0015 
0016   int felix, ladder, chip, channel, nhit;
0017   while(fin>>felix>>ladder>>chip>>channel>>nhit){
0018     hotchannel hot(felix, ladder, chip, channel);
0019     vHot.push_back(hot);
0020   }
0021 
0022   cout<<"Nhot channel : "<<vHot.size()<<endl;
0023 
0024   return true;
0025 }
0026 
0027 bool InttHotMap::isHot(unsigned int felix, unsigned int ladder, unsigned int chip, unsigned int channel) 
0028 {
0029   for(auto itr=vHot.begin(); itr!=vHot.end(); ++itr){
0030     if(  itr->felix   == felix
0031       && itr->ladder  == ladder
0032       && itr->chip    == chip
0033       && itr->channel == channel) 
0034     {
0035       if(debug_ && fail_counter_<10) {
0036         cout<<"Hotchannel is removed : "<< felix <<" "<<ladder<<" "<<chip<<" "<<channel<<endl;
0037       }
0038 
0039       fail_counter_++;
0040 
0041       return true; 
0042     }
0043   }
0044 
0045   return false;
0046 }
0047