{
RooGKCounter lines;
std::string _row;
ifstream inFile( map_file . c_str(), std::ios::in );
if (!inFile)
{
std::cout << "Unable to open file with the logical map: " << map_file << std::endl;
}
else
{
std::cout << "File with the logical map opened successfully: " << map_file << std::endl;
std::cout << "Type: " << type << std::endl;
}
while ( getline( inFile, _row ) > 0 )
{
LMapRow aRow;
char det[32];
char rbx[32];
char fpga[32];
char slbin[32];
char slbin2[32];
char slnam[32];
char rctnam[32];
const char * let_code = "Z";
int _read = 0;
if ( type == "HBEF" )
{
const char * _format = " %d %d %d %d %d %s %s %d %d %d %d %d %d %d %d %d %s %d %d %d %d %d %s %s %s %d %d %d %s %d";
_read = sscanf( _row . c_str(), _format,
&(aRow.side),
&(aRow.eta), &(aRow.phi), &(aRow.dphi), &(aRow.depth),
det,
rbx,
&(aRow.wedge), &(aRow.rm), &(aRow.pixel), &(aRow.qie), &(aRow.adc), &(aRow.rm_fi), &(aRow.fi_ch),
&(aRow.crate), &(aRow.htr),
fpga,
&(aRow.htr_fi),
&(aRow.dcc_sl), &(aRow.spigo), &(aRow.dcc), &(aRow.slb),
slbin, slbin2, slnam,
&(aRow.rctcra), &(aRow.rctcar), &(aRow.rctcon),
rctnam,
&(aRow.fedid) );
}
else if ( type == "HO" )
{
const char * _format = " %d %d %d %d %d %s %s %d %d %d %d %d %d %d %s %d %d %s %d %d %d %d %d";
_read = sscanf( _row . c_str(), _format,
&(aRow.side),
&(aRow.eta), &(aRow.phi), &(aRow.dphi), &(aRow.depth),
det,
rbx,
&(aRow.wedge), &(aRow.rm), &(aRow.pixel), &(aRow.qie), &(aRow.adc), &(aRow.rm_fi), &(aRow.fi_ch),
&let_code,
&(aRow.crate), &(aRow.htr),
fpga,
&(aRow.htr_fi),
&(aRow.dcc_sl), &(aRow.spigo), &(aRow.dcc), &(aRow.slb) );
}
if ( _read >= 23 )
{
lines . count();
std::string _det(det);
if ( _det.find("HB") != std::string::npos ) aRow . det = HcalBarrel;
else if ( _det.find("HE") != std::string::npos ) aRow . det = HcalEndcap;
else if ( _det.find("HF") != std::string::npos ) aRow . det = HcalForward;
else if ( _det.find("HO") != std::string::npos ) aRow . det = HcalOuter;
else aRow . det = HcalOther;
aRow . rbx .append( rbx );
aRow . fpga .append( fpga );
aRow . slbin .append( slbin );
aRow . slbin2 .append( slbin2 );
aRow . slnam .append( slnam );
aRow . rctnam .append( rctnam );
aRow . let_code .append( let_code );
_table . push_back( aRow );
HcalDetId _hdid(aRow.det, aRow.side*aRow.eta, aRow.phi, aRow.depth);
_lmap[_hdid.rawId()] = aRow;
}
}
inFile.close();
std::cout << "LMap: " << lines . getCount() << " lines read" << std::endl;
return 0;
}