34 if (fullname.empty()) {
35 std::cout <<
"Input file " << channelMapFile <<
" not found" <<
std::endl;
39 std::cout <<
"Iceberg Channel Map: Building RCE TPC wiremap from file " << channelMapFile <<
std::endl;
41 std::ifstream
inFile(fullname, std::ios::in);
44 while (std::getline(inFile,line)) {
45 unsigned int crateNo, slotNo, fiberNo, FEMBChannel, StreamChannel, slotID, fiberID, chipNo, chipChannel, asicNo, asicChannel, planeType, offlineChannel;
46 std::stringstream linestream(line);
47 linestream >> crateNo >> slotNo >> fiberNo>> FEMBChannel >> StreamChannel >> slotID >> fiberID >> chipNo >> chipChannel >> asicNo >> asicChannel >> planeType >> offlineChannel;
54 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Offline Channel: " << offlineChannel <<
"\n";
58 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Crate Number: " << crateNo <<
"\n";
62 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Slot Number: " << slotNo <<
"\n";
66 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Fiber Number: " << fiberNo <<
"\n";
70 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood FEMB (Stream) Channel Number: " << StreamChannel <<
"\n";
93 sp.
find_file(FELIXchannelMapFile, fullname);
95 if (fullname.empty()) {
96 std::cout <<
"Input file " << FELIXchannelMapFile <<
" not found" <<
std::endl;
100 std::cout <<
"Iceberg Channel Map: Building FELIX TPC wiremap from file " << channelMapFile <<
std::endl;
102 std::ifstream FELIXinFile(fullname, std::ios::in);
104 while (std::getline(FELIXinFile,line)) {
105 unsigned int crateNo, slotNo, fiberNo, FEMBChannel, StreamChannel, slotID, fiberID, chipNo, chipChannel, asicNo, asicChannel, planeType, offlineChannel;
106 std::stringstream linestream(line);
107 linestream >> crateNo >> slotNo >> fiberNo>> FEMBChannel >> StreamChannel >> slotID >> fiberID >> chipNo >> chipChannel >> asicNo >> asicChannel >> planeType >> offlineChannel;
114 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Offline Channel: " << offlineChannel <<
"\n";
118 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Crate Number: " << crateNo <<
"\n";
122 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Slot Number: " << slotNo <<
"\n";
126 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Fiber Number: " << fiberNo <<
"\n";
130 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood FEMB (Stream) Channel Number: " << StreamChannel <<
"\n";
154 sp.
find_file(SSPchannelMapFile, SSPfullname);
156 if (SSPfullname.empty()) {
157 std::cout <<
"Input file for SSP Channel Map " << SSPchannelMapFile <<
" not found in FW_SEARCH_PATH " <<
std::endl;
161 std::cout <<
"Iceberg Channel Map: Building SSP channel map from file " << SSPchannelMapFile <<
std::endl;
163 std::ifstream SSPinFile(SSPfullname, std::ios::in);
165 while (std::getline(SSPinFile,line)) {
166 unsigned int onlineChannel, APA, SSP, SSPGlobal, ChanWithinSSP, OpDetNo, offlineChannel;
167 std::stringstream linestream(line);
168 linestream >> onlineChannel >> APA >> SSP >> SSPGlobal >> ChanWithinSSP >> OpDetNo >> offlineChannel;
175 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood SSP Online Channel: " << onlineChannel <<
"\n";
179 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood SSP Offline Channel: " << offlineChannel <<
"\n";
183 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood APA Number in SSP map file: " << APA <<
"\n";
195 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Channel within SSP Number: " << ChanWithinSSP <<
" " << SSPGlobal <<
"\n";
199 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood SSP Module Number: " << OpDetNo <<
"\n";
223 unsigned int offlineChannel=0;
224 unsigned int lcrate =
crate;
225 unsigned int lslot = slot;
226 unsigned int lfiber = fiber;
232 mf::LogWarning(
"IcebergChannelMapService: Bad Crate Number, expecting a number of 1. Falling back to 1. Ununderstood crate number=") <<
crate;
242 mf::LogWarning(
"IcebergChannelMapService: Bad slot number, using slot number zero as a fallback. Ununderstood slot number: ") << slot;
252 mf::LogWarning(
"IcebergChannelMapService: Bad fiber number, falling back to 1. Ununderstood fiber number: ") << fiber;
260 throw cet::exception(
"IcebergChannelMapService") <<
"Ununderstood Stream (FEMB) chan: " 261 << crate <<
" " << slot <<
" " << fiber <<
" " << streamchannel <<
"\n";
264 if (frswitch ==
kRCE)
273 return offlineChannel;
313 if (frswitch ==
kRCE)
369 mf::LogWarning(
"IcebergChannelMapService: Deprecated call to ASICFromOfflineChannel. Use AsicLinkFromOfflineChannel");
384 mf::LogWarning(
"IcebergChannelMapService: Deprecated call to ASICChannelFromOfflineChannel. Not a meaningful number -- channels are grouped by 16's not 8's");
399 size_t s =
sizeof(size_t)*8;
400 for (
size_t j=0; j<
s; ++j)
410 unsigned int lchannel = onlineChannel;
416 mf::LogWarning(
"IcebergChannelMapService: Online Channel Number too high, using zero as a fallback: ") << onlineChannel;
unsigned int fFELIXvFEMBChannelMap[1280]
unsigned int fvStreamChannelMap[1280]
unsigned int SSPAPAFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fvFEMBChannelMap[1280]
size_t fSSPBadChannelNumberWarningsIssued
size_t fBadCrateNumberWarningsIssued
unsigned int fvChipMap[1280]
unsigned int fvASICMap[1280]
unsigned int fFELIXvChipChannelMap[1280]
unsigned int SSPOfflineChannelFromOnlineChannel(unsigned int onlineChannel)
unsigned int farrayCsfcToOffline[1][3][4][128]
size_t fBadFiberNumberWarningsIssued
unsigned int ASICChannelFromOfflineChannel(unsigned int offlineChannel)
Returns ASIC channel number – to be deprecated.
unsigned int fFELIXvPlaneMap[1280]
unsigned int AsicChannelFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fvSlotIdMap[1280]
void check_offline_channel(unsigned int offlineChannel) const
unsigned int farraySSPOfflineToOnline[288]
unsigned int fvWIBMap[1280]
unsigned int fFELIXvASICChannelMap[1280]
unsigned int fvSSPGlobalMap[288]
const size_t fNChansPerSSP
unsigned int FiberIdFromOfflineChannel(unsigned int offlineChannel) const
Returns global fiber ID.
unsigned int SlotIdFromOfflineChannel(unsigned int offlineChannel) const
Returns global slot ID.
unsigned int OpDetNoFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fvSSPWithinAPAMap[288]
unsigned int fFELIXvChipMap[1280]
unsigned int fFELIXvASICMap[1280]
unsigned int ChipChannelFromOfflineChannel(unsigned int offlineChannel) const
Returns chip channel number.
unsigned int AsicLinkFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fvASICChannelMap[1280]
unsigned int GetOfflineNumberFromDetectorElements(unsigned int crate, unsigned int slot, unsigned int fiber, unsigned int fembchannel, FelixOrRCE frswitch)
unsigned int farraySSPOnlineToOffline[288]
unsigned int SSPOnlineChannelFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fFELIXvSlotIdMap[1280]
unsigned int fvOpDetNoMap[288]
size_t fASICWarningsIssued
unsigned int fvPlaneMap[1280]
unsigned int fFELIXvFiberIdMap[1280]
struct dune::tde::crate crate
unsigned int AsicFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fFELIXvStreamChannelMap[1280]
enum dune::IcebergChannelMapService::_FelixOrRCE FelixOrRCE
unsigned int SSPChanWithinSSPFromOfflineChannel(unsigned int offlineChannel) const
T get(std::string const &key) const
unsigned int StreamChannelFromOfflineChannel(unsigned int offlineChannel, FelixOrRCE frswitch) const
Returns RCE(FELIX) stream(frame) channel.
unsigned int fvAPAMap[1280]
unsigned int fFELIXarrayCsfcToOffline[6][5][4][128]
unsigned int APAFromOfflineChannel(unsigned int offlineChannel) const
Returns APA/crate.
static int max(int a, int b)
size_t fASICChanWarningsIssued
IcebergChannelMapService(fhicl::ParameterSet const &pset)
unsigned int fvSSPAPAMap[288]
size_t count_bits(size_t i)
#define DEFINE_ART_SERVICE(svc)
unsigned int fvChipChannelMap[1280]
unsigned int fFELIXvWIBMap[1280]
void line(double t, double *p, double &x, double &y, double &z)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
unsigned int FEMBChannelFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB channel.
std::string find_file(std::string const &filename) const
unsigned int ChipFromOfflineChannel(unsigned int offlineChannel) const
Returns chip number.
unsigned int ASICFromOfflineChannel(unsigned int offlineChannel)
Returns ASIC number – to be deprecated.
unsigned int fvFEMBMap[1280]
unsigned int fvFiberIdMap[1280]
unsigned int PlaneFromOfflineChannel(unsigned int offlineChannel) const
Returns plane.
size_t fBadSlotNumberWarningsIssued
unsigned int SSPWithinAPAFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fFELIXvAPAMap[1280]
unsigned int SSPGlobalFromOfflineChannel(unsigned int offlineChannel) const
unsigned int WIBFromOfflineChannel(unsigned int offlineChannel) const
Returns WIB/slot.
unsigned int fFELIXvFEMBMap[1280]
unsigned int FEMBFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB/fiber.
unsigned int fvSSPChanWithinSSPMap[288]
void SSP_check_offline_channel(unsigned int offlineChannel) const
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)