34 if (fullname.empty()) {
35 std::cout <<
"Input file " << channelMapFile <<
" not found" <<
std::endl;
39 std::cout <<
"PDSP 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(
"PdspChannelMapService") <<
"Ununderstood Offline Channel: " << offlineChannel <<
"\n";
58 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood Crate Number: " << crateNo <<
"\n";
62 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood Slot Number: " << slotNo <<
"\n";
66 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood Fiber Number: " << fiberNo <<
"\n";
70 throw cet::exception(
"PdspChannelMapService") <<
"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 <<
"PDSP 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(
"PdspChannelMapService") <<
"Ununderstood Offline Channel: " << offlineChannel <<
"\n";
118 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood Crate Number: " << crateNo <<
"\n";
122 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood Slot Number: " << slotNo <<
"\n";
126 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood Fiber Number: " << fiberNo <<
"\n";
130 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood FEMB (Stream) Channel Number: " << StreamChannel <<
"\n";
170 for (
size_t i=0; i<6; ++i)
178 sp.
find_file(SSPchannelMapFile, SSPfullname);
180 if (SSPfullname.empty()) {
181 std::cout <<
"Input file for SSP Channel Map " << SSPchannelMapFile <<
" not found in FW_SEARCH_PATH " <<
std::endl;
185 std::cout <<
"PDSP Channel Map: Building SSP channel map from file " << SSPchannelMapFile <<
std::endl;
187 std::ifstream SSPinFile(SSPfullname, std::ios::in);
189 while (std::getline(SSPinFile,line)) {
190 unsigned int onlineChannel, APA, SSP, SSPGlobal, ChanWithinSSP, OpDetNo, offlineChannel;
191 std::stringstream linestream(line);
192 linestream >> onlineChannel >> APA >> SSP >> SSPGlobal >> ChanWithinSSP >> OpDetNo >> offlineChannel;
199 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood SSP Online Channel: " << onlineChannel <<
"\n";
203 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood SSP Offline Channel: " << offlineChannel <<
"\n";
207 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood APA Number in SSP map file: " << APA <<
"\n";
219 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood Channel within SSP Number: " << ChanWithinSSP <<
" " << SSPGlobal <<
"\n";
223 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood SSP Module Number: " << OpDetNo <<
"\n";
247 unsigned int offlineChannel=0;
248 unsigned int lcrate =
crate;
249 unsigned int lslot = slot;
250 unsigned int lfiber = fiber;
256 mf::LogWarning(
"PdspChannelMapService: Bad Crate Number, expecting a number between 1 and 6. Falling back to 1. Ununderstood crate number=") <<
crate;
266 mf::LogWarning(
"PdspChannelMapService: Bad slot number, using slot number zero as a fallback. Ununderstood slot number: ") << slot;
276 mf::LogWarning(
"PdspChannelMapService: Bad fiber number, falling back to 1. Ununderstood fiber number: ") << fiber;
284 throw cet::exception(
"PdspChannelMapService") <<
"Ununderstood Stream (FEMB) chan: " 285 << crate <<
" " << slot <<
" " << fiber <<
" " << streamchannel <<
"\n";
288 if (frswitch ==
kRCE)
297 return offlineChannel;
310 unsigned int offlineAPA =
fvAPAMap[offlineChannel];
313 throw cet::exception(
"PdspChannelMapService") <<
"Offline APA Number out of range: " << offlineAPA <<
"\n";
346 if (frswitch ==
kRCE)
402 mf::LogWarning(
"PdspChannelMapService: Deprecated call to ASICFromOfflineChannel. Use AsicLinkFromOfflineChannel");
417 mf::LogWarning(
"PdspChannelMapService: Deprecated call to ASICChannelFromOfflineChannel. Not a meaningful number -- channels are grouped by 16's not 8's");
432 size_t s =
sizeof(size_t)*8;
433 for (
size_t j=0; j<
s; ++j)
443 unsigned int lchannel = onlineChannel;
449 mf::LogWarning(
"PdspChannelMapService: Online Channel Number too high, using zero as a fallback: ") << onlineChannel;
unsigned int fvStreamChannelMap[15360]
unsigned int ChipChannelFromOfflineChannel(unsigned int offlineChannel) const
Returns chip channel number.
unsigned int SSPAPAFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fvInstalledAPA[6]
unsigned int StreamChannelFromOfflineChannel(unsigned int offlineChannel, FelixOrRCE frswitch) const
Returns RCE(FELIX) stream(frame) channel.
unsigned int InstalledAPAFromOfflineChannel(unsigned int offlineChannel) const
Returns APA/crate in installation notation.
unsigned int FiberIdFromOfflineChannel(unsigned int offlineChannel) const
Returns global fiber ID.
unsigned int FEMBChannelFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB channel.
unsigned int fFELIXvChipMap[15360]
size_t count_bits(size_t i)
unsigned int fFELIXvASICMap[15360]
size_t fASICChanWarningsIssued
const size_t fNChansPerSSP
unsigned int ASICChannelFromOfflineChannel(unsigned int offlineChannel)
Returns ASIC channel number – to be deprecated.
unsigned int SSPOnlineChannelFromOfflineChannel(unsigned int offlineChannel) const
unsigned int AsicFromOfflineChannel(unsigned int offlineChannel) const
enum dune::PdspChannelMapService::_FelixOrRCE FelixOrRCE
unsigned int AsicChannelFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fFELIXvASICChannelMap[15360]
unsigned int fvSSPAPAMap[288]
unsigned int fFELIXarrayCsfcToOffline[6][5][4][128]
unsigned int GetOfflineNumberFromDetectorElements(unsigned int crate, unsigned int slot, unsigned int fiber, unsigned int fembchannel, FelixOrRCE frswitch)
unsigned int SSPGlobalFromOfflineChannel(unsigned int offlineChannel) const
unsigned int APAFromOfflineChannel(unsigned int offlineChannel) const
Returns APA/crate.
unsigned int fvASICChannelMap[15360]
unsigned int fvPlaneMap[15360]
size_t fASICWarningsIssued
void check_offline_channel(unsigned int offlineChannel) const
unsigned int SSPChanWithinSSPFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fFELIXvAPAMap[15360]
unsigned int fFELIXvFEMBMap[15360]
unsigned int SlotIdFromOfflineChannel(unsigned int offlineChannel) const
Returns global slot ID.
unsigned int fFELIXvWIBMap[15360]
unsigned int SSPOfflineChannelFromOnlineChannel(unsigned int onlineChannel)
unsigned int fFELIXvChipChannelMap[15360]
unsigned int farraySSPOnlineToOffline[288]
unsigned int fvFEMBMap[15360]
struct dune::tde::crate crate
unsigned int fvSSPWithinAPAMap[288]
T get(std::string const &key) const
unsigned int farraySSPOfflineToOnline[288]
unsigned int fFELIXvPlaneMap[15360]
unsigned int OpDetNoFromOfflineChannel(unsigned int offlineChannel) const
size_t fBadCrateNumberWarningsIssued
unsigned int fFELIXvFEMBChannelMap[15360]
size_t fSSPBadChannelNumberWarningsIssued
unsigned int fvFEMBChannelMap[15360]
unsigned int farrayCsfcToOffline[6][5][4][128]
static int max(int a, int b)
unsigned int PlaneFromOfflineChannel(unsigned int offlineChannel) const
Returns plane.
unsigned int ASICFromOfflineChannel(unsigned int offlineChannel)
Returns ASIC number – to be deprecated.
unsigned int fvChipMap[15360]
unsigned int fFELIXvSlotIdMap[15360]
PdspChannelMapService(fhicl::ParameterSet const &pset)
unsigned int SSPWithinAPAFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fvSSPGlobalMap[288]
unsigned int fvAPAMap[15360]
#define DEFINE_ART_SERVICE(svc)
unsigned int WIBFromOfflineChannel(unsigned int offlineChannel) const
Returns WIB/slot.
unsigned int fvASICMap[15360]
unsigned int fvSSPChanWithinSSPMap[288]
unsigned int fvWIBMap[15360]
void line(double t, double *p, double &x, double &y, double &z)
MaybeLogger_< ELseverityLevel::ELsev_warning, false > LogWarning
std::string find_file(std::string const &filename) const
unsigned int FEMBFromOfflineChannel(unsigned int offlineChannel) const
Returns FEMB/fiber.
size_t fBadSlotNumberWarningsIssued
unsigned int fvChipChannelMap[15360]
unsigned int fvFiberIdMap[15360]
void SSP_check_offline_channel(unsigned int offlineChannel) const
unsigned int AsicLinkFromOfflineChannel(unsigned int offlineChannel) const
unsigned int fFELIXvStreamChannelMap[15360]
unsigned int fvOpDetNoMap[288]
unsigned int fvTPCSet_VsInstalledAPA[6]
unsigned int fFELIXvFiberIdMap[15360]
unsigned int ChipFromOfflineChannel(unsigned int offlineChannel) const
Returns chip number.
size_t fBadFiberNumberWarningsIssued
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
unsigned int fvSlotIdMap[15360]