All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Typedefs | Functions | Variables
icarusDB Namespace Reference

Classes

class  ChannelMapPostGres
 ChannelMapPostGres class definiton. More...
 
class  ChannelMapSQLite
 ChannelMapSQLite class definiton. More...
 
class  ICARUSChannelMap
 
class  ICARUSChannelMapProvider
 
class  IChannelMapping
 IChannelMapping interface class definiton. More...
 
class  IICARUSChannelMap
 

Typedefs

using ReadoutIDVec = std::vector< unsigned int >
 
using ChannelPlanePair = std::pair< unsigned int, unsigned int >
 
using ChannelPlanePairVec = std::vector< ChannelPlanePair >
 
using DigitizerChannelChannelIDPair = std::pair< size_t, size_t >
 
using DigitizerChannelChannelIDPairVec = std::vector< DigitizerChannelChannelIDPair >
 
using SlotChannelVecPair = std::pair< unsigned int, ChannelPlanePairVec >
 
using TPCReadoutBoardToChannelMap = std::map< unsigned int, SlotChannelVecPair >
 

Functions

int callback (void *data, int argc, char **argv, char **azColName)
 
int buildTPCFragmentIDToReadoutIDMap_callback (void *dataIn, int argc, char **argv, char **azColName)
 
int buildTPCReadoutBoardToChannelMap_callback (void *dataIn, int argc, char **argv, char **azColName)
 
int buildFragmentToDigitizerChannelMap_callback (void *dataIn, int argc, char **argv, char **azColName)
 
int buildCRTChannelIDToHWtoSimMacAddressPairMap_callback (void *dataIn, int argc, char **argv, char **azColName)
 
int buildTopCRTHWtoSimMacAddressPairMap_callback (void *dataIn, int argc, char **argv, char **azColName)
 

Variables

const unsigned int CHANNELSPERBOARD = 64
 

Typedef Documentation

typedef std::pair< unsigned int, unsigned int > icarusDB::ChannelPlanePair

Definition at line 23 of file IICARUSChannelMap.h.

Definition at line 24 of file IICARUSChannelMap.h.

using icarusDB::DigitizerChannelChannelIDPair = typedef std::pair<size_t,size_t>

Definition at line 26 of file IICARUSChannelMap.h.

Definition at line 27 of file IICARUSChannelMap.h.

using icarusDB::ReadoutIDVec = typedef std::vector<unsigned int>

Definition at line 22 of file IICARUSChannelMap.h.

using icarusDB::SlotChannelVecPair = typedef std::pair<unsigned int, ChannelPlanePairVec>

Definition at line 31 of file IICARUSChannelMap.h.

using icarusDB::TPCReadoutBoardToChannelMap = typedef std::map<unsigned int, SlotChannelVecPair>

Definition at line 32 of file IICARUSChannelMap.h.

Function Documentation

int icarusDB::buildCRTChannelIDToHWtoSimMacAddressPairMap_callback ( void *  dataIn,
int  argc,
char **  argv,
char **  azColName 
)

Definition at line 412 of file ChannelMapSQLite_tool.cc.

413  {
414  IChannelMapping::CRTChannelIDToHWtoSimMacAddressPairMap& crtChannelIDToHWtoSimMacAddressPairMap = *(IChannelMapping::CRTChannelIDToHWtoSimMacAddressPairMap*)dataIn;
415 
416  /*
417  // Start extracting info
418  unsigned int channelID = std::stol(argv[10]);
419  unsigned int simmacaddress = std::stol(argv[11]);
420  unsigned int hwmacaddress = std::stol(argv[12]);
421  */
422 
423  unsigned int channelID = strcmp(argv[10],"None")==0 ? 0 : std::stol(argv[10]);
424  unsigned int simmacaddress = strcmp(argv[11],"None")==0 ? 0 : std::stol(argv[11]);
425  unsigned int hwmacaddress = strcmp(argv[12],"None")==0 ? 0 : std::stol(argv[12]);
426 
427  // Fill the map
428  crtChannelIDToHWtoSimMacAddressPairMap[channelID]=std::make_pair(hwmacaddress, simmacaddress);
429 
430  return 0;
431  }
int icarusDB::buildFragmentToDigitizerChannelMap_callback ( void *  dataIn,
int  argc,
char **  argv,
char **  azColName 
)

Definition at line 376 of file ChannelMapSQLite_tool.cc.

377  {
379 
380  // Start extracting info
381  // std::string digitizerBuffer = argv[8];
382  unsigned int fragmentID = std::stol(argv[18]);
383  unsigned int digitizerChannelNo = std::stol(argv[9]);
384  unsigned int channelID = std::stol(argv[17]);
385 
386  // Fill the map
387  fragmentToDigitizerChannelMap[fragmentID].emplace_back(digitizerChannelNo,channelID);
388 
389  return 0;
390  }
std::map< size_t, DigitizerChannelChannelIDPairVec > FragmentToDigitizerChannelMap
int icarusDB::buildTopCRTHWtoSimMacAddressPairMap_callback ( void *  dataIn,
int  argc,
char **  argv,
char **  azColName 
)

Definition at line 452 of file ChannelMapSQLite_tool.cc.

453  {
454  IChannelMapping::TopCRTHWtoSimMacAddressPairMap& topcrtHWtoSimMacAddressPairMap = *(IChannelMapping::TopCRTHWtoSimMacAddressPairMap*)dataIn;
455 
456  // Start extracting info
457  unsigned int simmacaddress = strcmp(argv[41],"None")==0 ? 0 : std::stol(argv[41]);
458  unsigned int hwmacaddress = strcmp(argv[3], "None")==0 ? 0 : std::stol(argv[3]);
459 
460  // Fill the map
461  topcrtHWtoSimMacAddressPairMap[hwmacaddress] = simmacaddress;
462 
463  return 0;
464  }
int icarusDB::buildTPCFragmentIDToReadoutIDMap_callback ( void *  dataIn,
int  argc,
char **  argv,
char **  azColName 
)

Definition at line 174 of file ChannelMapSQLite_tool.cc.

175 {
176  const unsigned int tpcIdentifier(0x00001000);
177 
179 
180  // Include a by hand mapping of fragement ID to crate
181  // Note that we now know we can get this from the "flanges" table... so an upgrade coming soon...
182  using FlangeIDToCrateMap = std::map<size_t,std::string>;
183  FlangeIDToCrateMap flangeIDToCrateMap;
184  flangeIDToCrateMap[19] = "WW01T";
185  flangeIDToCrateMap[68] = "WW01M";
186  flangeIDToCrateMap[41] = "WW01B";
187  flangeIDToCrateMap[11] = "WW02";
188  flangeIDToCrateMap[17] = "WW03";
189  flangeIDToCrateMap[36] = "WW04";
190  flangeIDToCrateMap[18] = "WW05";
191  flangeIDToCrateMap[58] = "WW06";
192  flangeIDToCrateMap[71] = "WW07";
193  flangeIDToCrateMap[14] = "WW08";
194  flangeIDToCrateMap[25] = "WW09";
195  flangeIDToCrateMap[34] = "WW10";
196  flangeIDToCrateMap[67] = "WW11";
197  flangeIDToCrateMap[33] = "WW12";
198  flangeIDToCrateMap[87] = "WW13";
199  flangeIDToCrateMap[10] = "WW14";
200  flangeIDToCrateMap[59] = "WW15";
201  flangeIDToCrateMap[95] = "WW16";
202  flangeIDToCrateMap[22] = "WW17";
203  flangeIDToCrateMap[91] = "WW18";
204  flangeIDToCrateMap[61] = "WW19";
205  flangeIDToCrateMap[55] = "WW20T";
206  flangeIDToCrateMap[97] = "WW20M";
207  flangeIDToCrateMap[100] = "WW20B";
208  flangeIDToCrateMap[83] = "WE01T";
209  flangeIDToCrateMap[85] = "WE01M";
210  flangeIDToCrateMap[7] = "WE01B";
211  flangeIDToCrateMap[80] = "WE02";
212  flangeIDToCrateMap[52] = "WE03";
213  flangeIDToCrateMap[32] = "WE04";
214  flangeIDToCrateMap[70] = "WE05";
215  flangeIDToCrateMap[74] = "WE06";
216  flangeIDToCrateMap[46] = "WE07";
217  flangeIDToCrateMap[81] = "WE08";
218  flangeIDToCrateMap[63] = "WE09";
219  flangeIDToCrateMap[30] = "WE10";
220  flangeIDToCrateMap[51] = "WE11";
221  flangeIDToCrateMap[90] = "WE12";
222  flangeIDToCrateMap[23] = "WE13";
223  flangeIDToCrateMap[93] = "WE14";
224  flangeIDToCrateMap[92] = "WE15";
225  flangeIDToCrateMap[88] = "WE16";
226  flangeIDToCrateMap[73] = "WE17";
227  flangeIDToCrateMap[1] = "WE18";
228  flangeIDToCrateMap[66] = "WE19";
229  flangeIDToCrateMap[48] = "WE20T";
230  flangeIDToCrateMap[13] = "WE20M";
231  flangeIDToCrateMap[56] = "WE20B";
232  flangeIDToCrateMap[94] = "EW01T";
233  flangeIDToCrateMap[77] = "EW01M";
234  flangeIDToCrateMap[72] = "EW01B";
235  flangeIDToCrateMap[65] = "EW02";
236  flangeIDToCrateMap[4] = "EW03";
237  flangeIDToCrateMap[89] = "EW04";
238  flangeIDToCrateMap[37] = "EW05";
239  flangeIDToCrateMap[76] = "EW06";
240  flangeIDToCrateMap[49] = "EW07";
241  flangeIDToCrateMap[60] = "EW08";
242  flangeIDToCrateMap[21] = "EW09";
243  flangeIDToCrateMap[6] = "EW10";
244  flangeIDToCrateMap[62] = "EW11";
245  flangeIDToCrateMap[2] = "EW12";
246  flangeIDToCrateMap[29] = "EW13";
247  flangeIDToCrateMap[44] = "EW14";
248  flangeIDToCrateMap[9] = "EW15";
249  flangeIDToCrateMap[31] = "EW16";
250  flangeIDToCrateMap[98] = "EW17";
251  flangeIDToCrateMap[38] = "EW18";
252  flangeIDToCrateMap[99] = "EW19";
253  flangeIDToCrateMap[53] = "EW20T";
254  flangeIDToCrateMap[82] = "EW20M";
255  flangeIDToCrateMap[35] = "EW20B";
256  flangeIDToCrateMap[96] = "EE01T";
257  flangeIDToCrateMap[28] = "EE01M";
258  flangeIDToCrateMap[16] = "EE01T";
259  flangeIDToCrateMap[69] = "EE02";
260  flangeIDToCrateMap[20] = "EE02";
261  flangeIDToCrateMap[79] = "EE02";
262  flangeIDToCrateMap[50] = "EE02";
263  flangeIDToCrateMap[45] = "EE02";
264  flangeIDToCrateMap[84] = "EE02";
265  flangeIDToCrateMap[42] = "EE02";
266  flangeIDToCrateMap[39] = "EE02";
267  flangeIDToCrateMap[26] = "EE02";
268  flangeIDToCrateMap[64] = "EE02";
269  flangeIDToCrateMap[43] = "EE02";
270  flangeIDToCrateMap[47] = "EE02";
271  flangeIDToCrateMap[15] = "EE02";
272  flangeIDToCrateMap[3] = "EE02";
273  flangeIDToCrateMap[27] = "EE02";
274  flangeIDToCrateMap[24] = "EE02";
275  flangeIDToCrateMap[40] = "EE02";
276  flangeIDToCrateMap[75] = "EE02";
277  flangeIDToCrateMap[86] = "EE20T";
278  flangeIDToCrateMap[54] = "EE20M";
279  flangeIDToCrateMap[8] = "EE20B";
280 
281  unsigned int fragmentID = std::stol(argv[8],nullptr,16);
282 
283  if (fragmentID & tpcIdentifier)
284  {
285  if (fragmentBoardMap.find(fragmentID) == fragmentBoardMap.end())
286  {
287  unsigned int flangeID = std::stol(argv[1]);
288  fragmentBoardMap[fragmentID].first = flangeIDToCrateMap[flangeID];
289  }
290 
291  unsigned int readoutID = std::stol(argv[0]);
292  fragmentBoardMap[fragmentID].second.emplace_back(readoutID);
293 
294  }
295 
296  return 0;
297 }
std::map< unsigned int, CrateNameReadoutIDPair > TPCFragmentIDToReadoutIDMap
int icarusDB::buildTPCReadoutBoardToChannelMap_callback ( void *  dataIn,
int  argc,
char **  argv,
char **  azColName 
)

Definition at line 326 of file ChannelMapSQLite_tool.cc.

327  {
329 
330  unsigned int readoutBoardID = std::stol(argv[2]);
331 
332  if (rbChanMap.find(readoutBoardID) == rbChanMap.end())
333  {
334  unsigned int readoutBoardSlot = std::stol(argv[4]);
335 
336  rbChanMap[readoutBoardID].first = readoutBoardSlot;
337  rbChanMap[readoutBoardID].second.resize(CHANNELSPERBOARD);
338  }
339 
340  unsigned int channelNum = std::stol(argv[5]);
341  unsigned int channelID = std::stol(argv[0]);
342 
343  std::string fragmentBuffer = argv[10];
344 
345  // Make sure lower case... (sigh...)
346  std::transform(fragmentBuffer.begin(),fragmentBuffer.end(),fragmentBuffer.begin(),[](char c){return std::tolower(c);});
347 
348  unsigned int plane(3);
349 
350  if (fragmentBuffer.find("collection") != std::string::npos) plane = 2;
351  else if (fragmentBuffer.find("induction 2") != std::string::npos) plane = 1;
352  else if (fragmentBuffer.find("induction 1") != std::string::npos) plane = 0;
353 
354  if (plane > 2) std::cout << "YIKES!!! Plane is " << plane << " for channel " << channelID << " with type " << std::string(fragmentBuffer) << std::endl;
355 
356  rbChanMap[readoutBoardID].second[channelNum] = IChannelMapping::ChannelPlanePair(channelID,plane);
357 
358  return 0;
359  }
static constexpr Sample_t transform(Sample_t sample)
std::map< unsigned int, SlotChannelVecPair > TPCReadoutBoardToChannelMap
const unsigned int CHANNELSPERBOARD
std::pair< unsigned int, unsigned int > ChannelPlanePair
BEGIN_PROLOG could also be cout
int icarusDB::callback ( void *  data,
int  argc,
char **  argv,
char **  azColName 
)

Definition at line 111 of file ChannelMapSQLite_tool.cc.

112 {
113  int i;
114 
115  for(i = 0; i<argc; i++){
116  std::cout << "column: " << azColName[i] << "- value: " << (argv[i] ? argv[i] : "NULL") << " ";
117  }
118  std::cout << std::endl;
119 
120  std::cout << "\n" << std::endl;
121  return 0;
122 }
BEGIN_PROLOG could also be cout

Variable Documentation

const unsigned int icarusDB::CHANNELSPERBOARD = 64

Definition at line 302 of file ChannelMapPostGres_tool.cc.