All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions | Private Member Functions | Private Attributes | List of all members
icarusDB::ChannelMapPostGres Class Reference

ChannelMapPostGres class definiton. More...

Inheritance diagram for icarusDB::ChannelMapPostGres:
icarusDB::IChannelMapping

Public Member Functions

 ChannelMapPostGres (fhicl::ParameterSet const &pset)
 Constructor. More...
 
 ~ChannelMapPostGres ()
 Destructor. More...
 
virtual int BuildTPCFragmentIDToReadoutIDMap (TPCFragmentIDToReadoutIDMap &) const override
 Define the returned data structures for a mapping between TPC Fragment IDs and the related crate and readout information. Then define the function interface to fill these data structures. More...
 
virtual int BuildTPCReadoutBoardToChannelMap (TPCReadoutBoardToChannelMap &) const override
 Define the returned data structures for a mapping between TPC readout boards and the channel information Then define the function interface to fill these data structures. More...
 
virtual int BuildFragmentToDigitizerChannelMap (FragmentToDigitizerChannelMap &) const override
 Define the returned data structures for a mapping between PMT Fragment IDs and the related crate and readout information. Then define the function interface to fill these data structures. More...
 
virtual int BuildCRTChannelIDToHWtoSimMacAddressPairMap (CRTChannelIDToHWtoSimMacAddressPairMap &) const override
 Define the returned data structures for a mapping between CRT hardware mac_address to the simulated mac_address. Then define the function interface to fill these data structures. More...
 
virtual int BuildTopCRTHWtoSimMacAddressPairMap (TopCRTHWtoSimMacAddressPairMap &) const override
 Top CRT harware mac5 to software mac5 relation. More...
 
virtual int BuildSideCRTCalibrationMap (SideCRTChannelToCalibrationMap &) const override
 Define the returned data structures for a mapping between Side CRT Channels and their calibration values. Then define the function interface to fill these data structures. More...
 
- Public Member Functions inherited from icarusDB::IChannelMapping
virtual ~IChannelMapping () noexcept=default
 Virtual Destructor. More...
 

Private Member Functions

int GetDataset (const std::string &, const std::string &, const std::string &, Dataset &) const
 
int GetCRTCaldata (const std::string &, const std::string &, Dataset &) const
 

Private Attributes

uint32_t fNothing
 

Additional Inherited Members

- Public Types inherited from icarusDB::IChannelMapping
using ReadoutIDVec = std::vector< unsigned int >
 Define the returned data structures for a mapping between TPC Fragment IDs and the related crate and readout information. Then define the function interface to fill these data structures. More...
 
using CrateNameReadoutIDPair = std::pair< std::string, ReadoutIDVec >
 
using TPCFragmentIDToReadoutIDMap = std::map< unsigned int, CrateNameReadoutIDPair >
 
using ChannelPlanePair = std::pair< unsigned int, unsigned int >
 Define the returned data structures for a mapping between TPC readout boards and the channel information Then define the function interface to fill these data structures. More...
 
using ChannelPlanePairVec = std::vector< ChannelPlanePair >
 
using SlotChannelVecPair = std::pair< unsigned int, ChannelPlanePairVec >
 
using TPCReadoutBoardToChannelMap = std::map< unsigned int, SlotChannelVecPair >
 
using DigitizerChannelChannelIDPair = std::pair< size_t, size_t >
 Define the returned data structures for a mapping between PMT Fragment IDs and the related crate and readout information. Then define the function interface to fill these data structures. More...
 
using DigitizerChannelChannelIDPairVec = std::vector< DigitizerChannelChannelIDPair >
 
using FragmentToDigitizerChannelMap = std::map< size_t, DigitizerChannelChannelIDPairVec >
 
using CRTHWtoSimMacAddressPair = std::pair< unsigned int, unsigned int >
 Define the returned data structures for a mapping between CRT hardware mac_address to the simulated mac_address. Then define the function interface to fill these data structures. More...
 
using CRTChannelIDToHWtoSimMacAddressPairMap = std::map< unsigned int, CRTHWtoSimMacAddressPair >
 
using TopCRTHWtoSimMacAddressPairMap = std::map< unsigned int, unsigned int >
 
using SideCRTMac5ToChannelPair = std::pair< unsigned int, unsigned int >
 
using SideCRTGainToPedPair = std::pair< double, double >
 
using SideCRTChannelToCalibrationMap = std::map< SideCRTMac5ToChannelPair, SideCRTGainToPedPair >
 

Detailed Description

ChannelMapPostGres class definiton.

Definition at line 34 of file ChannelMapPostGres_tool.cc.

Constructor & Destructor Documentation

icarusDB::ChannelMapPostGres::ChannelMapPostGres ( fhicl::ParameterSet const &  pset)
explicit

Constructor.

Parameters
pset

Definition at line 94 of file ChannelMapPostGres_tool.cc.

95 {
96  fNothing = pset.get<uint32_t>("Nothing");
97 
98  return;
99 }
icarusDB::ChannelMapPostGres::~ChannelMapPostGres ( )

Destructor.

Definition at line 103 of file ChannelMapPostGres_tool.cc.

104 {
105 }

Member Function Documentation

int icarusDB::ChannelMapPostGres::BuildCRTChannelIDToHWtoSimMacAddressPairMap ( CRTChannelIDToHWtoSimMacAddressPairMap crtChannelIDToHWtoSimMacAddressPairMap) const
overridevirtual

Define the returned data structures for a mapping between CRT hardware mac_address to the simulated mac_address. Then define the function interface to fill these data structures.

Implements icarusDB::IChannelMapping.

Definition at line 399 of file ChannelMapPostGres_tool.cc.

400  {
401  // clearing is cleansing
402  crtChannelIDToHWtoSimMacAddressPairMap.clear();
403  // Recover the information from the database on the mapping
404  const std::string name("Feb_channels");
405  const std::string dburl("https://dbdata0vm.fnal.gov:9443/QE/hw/app/SQ/query?dbname=icarus_hardware_prd");
406  const std::string dataType("feb_channels");
407  Dataset dataset;
408  // Recover the data from the database
409  int error = GetDataset(name,dburl,dataType,dataset);
410  // If there was an error the function above would have printed a message so bail out
411  if (error) throw(std::exception());
412  // Ok, now we can start extracting the information
413  // We do this by looping through the database and building the map from that
414  for(int row = 1; row < getNtuples(dataset); row++)
415  {
416  // Recover the row
417  Tuple tuple = getTuple(dataset, row);
418  if (tuple != NULL)
419  {
420  // Recover the simmacaddress
421  unsigned int simmacaddress = getLongValue(tuple, 11, &error);
422  if (error) throw std::runtime_error("Encountered error when trying to recover the CRT simmacaddress");
423  // Now recover the hwmacaddress
424  unsigned int hwmacaddress = getLongValue(tuple, 12, &error);
425  if (error) throw std::runtime_error("Encountered error when trying to recover the CRT hwmacaddress");
426  // Finally, get the LArsoft channel ID
427  unsigned int channelID = getLongValue(tuple, 10, &error);
428  if (error) throw std::runtime_error("Encountered error when trying to recover the CRT channel ID");
429  // Fill the map
430  crtChannelIDToHWtoSimMacAddressPairMap[channelID]=std::make_pair(hwmacaddress,simmacaddress);
431  releaseTuple(tuple);
432  }
433  }
434 
435  return error;
436  }
void * Tuple
Definition: DBFolder.h:13
int GetDataset(const std::string &, const std::string &, const std::string &, Dataset &) const
void * Dataset
Definition: DBFolder.h:12
then echo fcl name
int icarusDB::ChannelMapPostGres::BuildFragmentToDigitizerChannelMap ( FragmentToDigitizerChannelMap fragmentToDigitizerChannelMap) const
overridevirtual

Define the returned data structures for a mapping between PMT Fragment IDs and the related crate and readout information. Then define the function interface to fill these data structures.

Implements icarusDB::IChannelMapping.

Definition at line 352 of file ChannelMapPostGres_tool.cc.

353 {
354  // clearing is cleansing
355  fragmentToDigitizerChannelMap.clear();
356  // Recover the information from the database on the mapping
357  const std::string name("Pmt_placement");
358  const std::string dburl("https://dbdata0vm.fnal.gov:9443/QE/hw/app/SQ/query?dbname=icarus_hardware_prd");
359  const std::string dataType("pmt_placements");
360  Dataset dataset;
361  // Recover the data from the database
362  int error = GetDataset(name,dburl,dataType,dataset);
363  // If there was an error the function above would have printed a message so bail out
364  if (error) throw(std::exception());
365  // Ok, now we can start extracting the information
366  // We do this by looping through the database and building the map from that
367  for(int row = 1; row < getNtuples(dataset); row++)
368  {
369  // Recover the row
370  Tuple tuple = getTuple(dataset, row);
371  if (tuple != NULL)
372  {
373  char digitizerBuffer[10];
374  // Recover the digitizer label first
375  getStringValue(tuple, 8, digitizerBuffer, sizeof(digitizerBuffer), &error);
376  if (error) throw std::runtime_error("Encountered error when trying to recover the PMT digitizer label");
377  std::string digitizerLabel(digitizerBuffer, 8); //sizeof(digitizerBuffer));
378  // Recover the fragment id
379  unsigned fragmentID = getLongValue(tuple, 18, &error);
380  if (error) throw std::runtime_error("Encountered error when trying to recover the PMT fragment id");
381  // Now recover the digitizer channel number
382  unsigned int digitizerChannelNo = getLongValue(tuple, 9, &error);
383  if (error) throw std::runtime_error("Encountered error when trying to recover the PMT digitizer channel number");
384  // Finally, get the LArsoft channel ID
385  unsigned int channelID = getLongValue(tuple, 17, &error);
386  if (error) throw std::runtime_error("Encountered error when trying to recover the PMT channel ID");
387  // Fill the map
388  fragmentToDigitizerChannelMap[fragmentID].emplace_back(digitizerChannelNo,channelID);
389  releaseTuple(tuple);
390  }
391  }
392 
393  return error;
394 }
void * Tuple
Definition: DBFolder.h:13
int GetDataset(const std::string &, const std::string &, const std::string &, Dataset &) const
void * Dataset
Definition: DBFolder.h:12
then echo fcl name
int icarusDB::ChannelMapPostGres::BuildSideCRTCalibrationMap ( SideCRTChannelToCalibrationMap sideCRTChannelToCalibrationMap) const
overridevirtual

Define the returned data structures for a mapping between Side CRT Channels and their calibration values. Then define the function interface to fill these data structures.

Accesing the Side CRT charge calibration from the postgresql database.

Implements icarusDB::IChannelMapping.

Definition at line 482 of file ChannelMapPostGres_tool.cc.

482  {
483  // sideCRTChannelToCalibrationMap.clear();
484  const std::string name("SideCRT_calibration_data");
485  const std::string dburl("https://dbdata0vm.fnal.gov:9443/icarus_con_prod/app/data?f=crt_gain_reco_data&t=1638918270");
486  Dataset ds;
487  // Recover the data from the database
488  int error = GetCRTCaldata(name,dburl,ds);
489  if (error)
490  { fprintf(stderr, "error code=%d\n", error); perror("error message"); }
491  if (getHTTPstatus(ds) != 200)
492  { fprintf(stderr, "HTTP code=%ld, message: '%s'\n", getHTTPstatus(ds), getHTTPmessage(ds)); }
493  int mac5, chan;
494  double gain, ped;
495  int err;
496  int nrows = getNtuples(ds);
497  int ncols;
498  Tuple tup;
499  for (int rows = 0; rows < nrows; rows++ ){
500  tup = getTuple(ds, rows); // Get the row with double array
501  ncols = getNfields(tup);//check number of columns
502  if(ncols <5) continue;//first few rows aren't actual data and have ncols==1, this excludes those
503  if (tup != NULL)/*check that the tup is not empty before proceeding*/ {
504  //assign values from the database to variables so we can use them
505  mac5 = (int)getDoubleValue(tup,1,&err);
506  chan = (int)getDoubleValue(tup,2,&err);
507  gain = getDoubleValue(tup,3,&err);
508  ped = getDoubleValue(tup,4,&err);
509  //This line adds the association between the two pairs to the map object
510  sideCRTChannelToCalibrationMap.insert(std::make_pair(std::make_pair(mac5,chan), std::make_pair(gain,ped)));
511 
512  releaseTuple(tup);
513  }//end if(tup != NULL)
514  else releaseTuple(tup);
515  }//end loop over rows
516 
517  return error;
518  }
int GetCRTCaldata(const std::string &, const std::string &, Dataset &) const
EResult err(const char *call)
void * Tuple
Definition: DBFolder.h:13
void * Dataset
Definition: DBFolder.h:12
then echo fcl name
int icarusDB::ChannelMapPostGres::BuildTopCRTHWtoSimMacAddressPairMap ( TopCRTHWtoSimMacAddressPairMap topcrtHWtoSimMacAddressPairMap) const
overridevirtual

Top CRT harware mac5 to software mac5 relation.

Implements icarusDB::IChannelMapping.

Definition at line 441 of file ChannelMapPostGres_tool.cc.

442  {
443  // clearing is cleansing
444  topcrtHWtoSimMacAddressPairMap.clear();
445  // Recover the information from the database on the mapping
446  const std::string name("topcrt_febs");
447  const std::string dburl("https://dbdata0vm.fnal.gov:9443/QE/hw/app/SQ/query?dbname=icarus_hardware_prd");
448  const std::string dataType("crtfeb");
449  Dataset dataset;
450  // Recover the data from the database
451  int error = GetDataset(name,dburl,dataType,dataset);
452  // If there was an error the function above would have printed a message so bail out
453  if (error) throw(std::exception());
454  // Ok, now we can start extracting the information
455  // We do this by looping through the database and building the map from that
456  for(int row = 1; row < getNtuples(dataset); row++)
457  {
458  // Recover the row
459  Tuple tuple = getTuple(dataset, row);
460  if (tuple != NULL)
461  {
462  // Recover the simmacaddress
463  unsigned int simmacaddress = getLongValue(tuple, 41, &error);
464  if (error) throw std::runtime_error("Encountered error when trying to recover the CRT simmacaddress");
465  // Now recover the hwmacaddress
466  unsigned int hwmacaddress = getLongValue(tuple, 3, &error);
467  if (error) throw std::runtime_error("Encountered error when trying to recover the CRT hwmacaddress");
468 
469  // Fill the map
470  topcrtHWtoSimMacAddressPairMap[hwmacaddress] = simmacaddress;
471  releaseTuple(tuple);
472  }
473  }
474 
475  return error;
476  }
void * Tuple
Definition: DBFolder.h:13
int GetDataset(const std::string &, const std::string &, const std::string &, Dataset &) const
void * Dataset
Definition: DBFolder.h:12
then echo fcl name
int icarusDB::ChannelMapPostGres::BuildTPCFragmentIDToReadoutIDMap ( TPCFragmentIDToReadoutIDMap fragmentBoardMap) const
overridevirtual

Define the returned data structures for a mapping between TPC Fragment IDs and the related crate and readout information. Then define the function interface to fill these data structures.

Implements icarusDB::IChannelMapping.

Definition at line 154 of file ChannelMapPostGres_tool.cc.

155 {
156  const unsigned int tpcIdentifier(0x00001000);
157  const std::string name("icarus_hw_readoutboard");
158  const std::string dburl("https://dbdata0vm.fnal.gov:9443/QE/hw/app/SQ/query?dbname=icarus_hardware_prd");
159  const std::string dataType("readout_boards");
160  Dataset dataset;
161  // Recover the data from the database
162  int error = GetDataset(name,dburl,dataType,dataset);
163  // Include a by hand mapping of fragement ID to crate
164  using FlangeIDToCrateMap = std::map<size_t,std::string>;
165  FlangeIDToCrateMap flangeIDToCrateMap;
166  flangeIDToCrateMap[19] = "WW01T";
167  flangeIDToCrateMap[68] = "WW01M";
168  flangeIDToCrateMap[41] = "WW01B";
169  flangeIDToCrateMap[11] = "WW02";
170  flangeIDToCrateMap[17] = "WW03";
171  flangeIDToCrateMap[36] = "WW04";
172  flangeIDToCrateMap[18] = "WW05";
173  flangeIDToCrateMap[58] = "WW06";
174  flangeIDToCrateMap[71] = "WW07";
175  flangeIDToCrateMap[14] = "WW08";
176  flangeIDToCrateMap[25] = "WW09";
177  flangeIDToCrateMap[34] = "WW10";
178  flangeIDToCrateMap[67] = "WW11";
179  flangeIDToCrateMap[33] = "WW12";
180  flangeIDToCrateMap[87] = "WW13";
181  flangeIDToCrateMap[10] = "WW14";
182  flangeIDToCrateMap[59] = "WW15";
183  flangeIDToCrateMap[95] = "WW16";
184  flangeIDToCrateMap[22] = "WW17";
185  flangeIDToCrateMap[91] = "WW18";
186  flangeIDToCrateMap[61] = "WW19";
187  flangeIDToCrateMap[55] = "WW20T";
188  flangeIDToCrateMap[97] = "WW20M";
189  flangeIDToCrateMap[100] = "WW20B";
190  flangeIDToCrateMap[83] = "WE01T";
191  flangeIDToCrateMap[85] = "WE01M";
192  flangeIDToCrateMap[7] = "WE01B";
193  flangeIDToCrateMap[80] = "WE02";
194  flangeIDToCrateMap[52] = "WE03";
195  flangeIDToCrateMap[32] = "WE04";
196  flangeIDToCrateMap[70] = "WE05";
197  flangeIDToCrateMap[74] = "WE06";
198  flangeIDToCrateMap[46] = "WE07";
199  flangeIDToCrateMap[81] = "WE08";
200  flangeIDToCrateMap[63] = "WE09";
201  flangeIDToCrateMap[30] = "WE10";
202  flangeIDToCrateMap[51] = "WE11";
203  flangeIDToCrateMap[90] = "WE12";
204  flangeIDToCrateMap[23] = "WE13";
205  flangeIDToCrateMap[93] = "WE14";
206  flangeIDToCrateMap[92] = "WE15";
207  flangeIDToCrateMap[88] = "WE16";
208  flangeIDToCrateMap[73] = "WE17";
209  flangeIDToCrateMap[1] = "WE18";
210  flangeIDToCrateMap[66] = "WE19";
211  flangeIDToCrateMap[48] = "WE20T";
212  flangeIDToCrateMap[13] = "WE20M";
213  flangeIDToCrateMap[56] = "WE20B";
214  flangeIDToCrateMap[94] = "EW01T";
215  flangeIDToCrateMap[77] = "EW01M";
216  flangeIDToCrateMap[72] = "EW01B";
217  flangeIDToCrateMap[65] = "EW02";
218  flangeIDToCrateMap[4] = "EW03";
219  flangeIDToCrateMap[89] = "EW04";
220  flangeIDToCrateMap[37] = "EW05";
221  flangeIDToCrateMap[76] = "EW06";
222  flangeIDToCrateMap[49] = "EW07";
223  flangeIDToCrateMap[60] = "EW08";
224  flangeIDToCrateMap[21] = "EW09";
225  flangeIDToCrateMap[6] = "EW10";
226  flangeIDToCrateMap[62] = "EW11";
227  flangeIDToCrateMap[2] = "EW12";
228  flangeIDToCrateMap[29] = "EW13";
229  flangeIDToCrateMap[44] = "EW14";
230  flangeIDToCrateMap[9] = "EW15";
231  flangeIDToCrateMap[31] = "EW16";
232  flangeIDToCrateMap[98] = "EW17";
233  flangeIDToCrateMap[38] = "EW18";
234  flangeIDToCrateMap[99] = "EW19";
235  flangeIDToCrateMap[53] = "EW20T";
236  flangeIDToCrateMap[82] = "EW20M";
237  flangeIDToCrateMap[35] = "EW20B";
238  flangeIDToCrateMap[96] = "EE01T";
239  flangeIDToCrateMap[28] = "EE01M";
240  flangeIDToCrateMap[16] = "EE01T";
241  flangeIDToCrateMap[69] = "EE02";
242  flangeIDToCrateMap[20] = "EE02";
243  flangeIDToCrateMap[79] = "EE02";
244  flangeIDToCrateMap[50] = "EE02";
245  flangeIDToCrateMap[45] = "EE02";
246  flangeIDToCrateMap[84] = "EE02";
247  flangeIDToCrateMap[42] = "EE02";
248  flangeIDToCrateMap[39] = "EE02";
249  flangeIDToCrateMap[26] = "EE02";
250  flangeIDToCrateMap[64] = "EE02";
251  flangeIDToCrateMap[43] = "EE02";
252  flangeIDToCrateMap[47] = "EE02";
253  flangeIDToCrateMap[15] = "EE02";
254  flangeIDToCrateMap[3] = "EE02";
255  flangeIDToCrateMap[27] = "EE02";
256  flangeIDToCrateMap[24] = "EE02";
257  flangeIDToCrateMap[40] = "EE02";
258  flangeIDToCrateMap[75] = "EE02";
259  flangeIDToCrateMap[86] = "EE20T";
260  flangeIDToCrateMap[54] = "EE20M";
261  flangeIDToCrateMap[8] = "EE20B";
262  // If there was an error the function above would have printed a message so bail out
263  if (error) throw(std::exception());
264  // Loop through the data to recover the channels
265  // NOTE that we skip the first row because that is just the labels
266  for(int row = 1; row < getNtuples(dataset); row++)
267  {
268  // Recover the row
269  Tuple tuple = getTuple(dataset, row);
270  if (tuple != NULL)
271  {
272  // Note that the fragment ID is stored in the database as a string which reads as a hex number
273  // Meaning we have to read back as a string and decode to get the numerical value.
274  char fragmentBuffer[16];
275  getStringValue(tuple, 8, fragmentBuffer, sizeof(fragmentBuffer), &error);
276  if (error) throw std::runtime_error("Encountered error in trying to recover FragmentID from database");
277  std::string fragmentIDString(fragmentBuffer,4);
278  unsigned int fragmentID = std::stol(fragmentIDString,nullptr,16);
279  if (!(fragmentID & tpcIdentifier)) continue;
280  if (fragmentBoardMap.find(fragmentID) == fragmentBoardMap.end())
281  {
282  unsigned int flangeID = getLongValue(tuple, 1, &error);
283  if (error) throw std::runtime_error("Encountered error in trying to recover Board Flange ID from database");
284  fragmentBoardMap[fragmentID].first = flangeIDToCrateMap[flangeID];
285  }
286  unsigned int readoutID = getLongValue(tuple, 0, &error);
287  if (error) throw std::runtime_error("Encountered error in trying to recover Board ReadoutID from database");
288  fragmentBoardMap[fragmentID].second.emplace_back(readoutID);
289  releaseTuple(tuple);
290  }
291  }
292  return error;
293 }
void * Tuple
Definition: DBFolder.h:13
int GetDataset(const std::string &, const std::string &, const std::string &, Dataset &) const
void * Dataset
Definition: DBFolder.h:12
then echo fcl name
int icarusDB::ChannelMapPostGres::BuildTPCReadoutBoardToChannelMap ( TPCReadoutBoardToChannelMap rbChanMap) const
overridevirtual

Define the returned data structures for a mapping between TPC readout boards and the channel information Then define the function interface to fill these data structures.

Implements icarusDB::IChannelMapping.

Definition at line 303 of file ChannelMapPostGres_tool.cc.

304 {
305  const std::string name("icarus_hardware_prd");
306  const std::string dburl("https://dbdata0vm.fnal.gov:9443/QE/hw/app/SQ/query?dbname=icarus_hardware_prd");
307  const std::string dataType("daq_channels");
308  Dataset dataset;
309  // Recover the data from the database
310  int error = GetDataset(name,dburl,dataType,dataset);
311  // If there was an error the function above would have printed a message so bail out
312  if (error) throw std::runtime_error("Encountered error accessing the database with GetDataset");
313  // Loop through the data to recover the channels, making sure to skip the first (header) row
314  for(int row = 1; row < getNtuples(dataset); row++)
315  {
316  // Recover the row
317  Tuple tuple = getTuple(dataset, row);
318  if (tuple != NULL)
319  {
320  unsigned int readoutBoardID = getLongValue(tuple, 2, &error);
321  if (error) throw std::runtime_error("Encountered error when trying to read Board ReadoutID");
322  if (rbChanMap.find(readoutBoardID) == rbChanMap.end())
323  {
324  unsigned int readoutBoardSlot = getLongValue(tuple, 4, &error);
325  if (error) throw std::runtime_error("Encountered error when trying to read Board Readout slot");
326  rbChanMap[readoutBoardID].first = readoutBoardSlot;
327  rbChanMap[readoutBoardID].second.resize(CHANNELSPERBOARD);
328  }
329  unsigned int channelNum = getLongValue(tuple, 5, &error);
330  if (error) throw std::runtime_error("Encountered error when trying to read channel number");
331  unsigned int channelID = getLongValue(tuple, 0, &error);
332  if (error) throw std::runtime_error("Encountered error when recovering the channel ID list");
333  // Recover the plane identifier
334  char fragmentBuffer[16];
335  getStringValue(tuple, 10, fragmentBuffer, sizeof(fragmentBuffer), &error);
336  if (error) throw std::runtime_error("Encountered error when trying to read plane type");
337  // Make sure lower case... (sigh...)
338  for(size_t charIdx = 0; charIdx < sizeof(fragmentBuffer); charIdx++) fragmentBuffer[charIdx] = tolower(fragmentBuffer[charIdx]);
339  unsigned int plane(3);
340  if (strstr(fragmentBuffer,"collection")) plane = 2;
341  else if (strstr(fragmentBuffer,"induction 2")) plane = 1;
342  else if (strstr(fragmentBuffer,"induction 1")) plane = 0;
343  if (plane > 2) std::cout << "YIKES!!! Plane is " << plane << " for channel " << channelID << " with type " << std::string(fragmentBuffer) << std::endl;
344  rbChanMap[readoutBoardID].second[channelNum] = ChannelPlanePair(channelID,plane);
345  }
346  }
347 
348  return error;
349 }
std::pair< unsigned int, unsigned int > ChannelPlanePair
Define the returned data structures for a mapping between TPC readout boards and the channel informat...
void * Tuple
Definition: DBFolder.h:13
int GetDataset(const std::string &, const std::string &, const std::string &, Dataset &) const
void * Dataset
Definition: DBFolder.h:12
const unsigned int CHANNELSPERBOARD
then echo fcl name
BEGIN_PROLOG could also be cout
int icarusDB::ChannelMapPostGres::GetCRTCaldata ( const std::string &  name,
const std::string &  url,
Dataset &  dataSet 
) const
private

Definition at line 132 of file ChannelMapPostGres_tool.cc.

133  {
134  const int timeout(200);
135  int error(0);
136  dataSet = getDataWithTimeout(url.c_str(),name.c_str(),timeout,&error);
137  if (error)
138  {
139  std::string errorMsg = "Database access GetDataset failed with error " + std::to_string(error) + "\nurl: "
140  + url + ", name: " + name;
141  std::cout << "****> Database retrieval error, code: " << error << std::endl;
142  throw std::runtime_error(errorMsg);
143  }
144 
145  return error;
146  }
std::string to_string(WindowPattern const &pattern)
then echo fcl name
BEGIN_PROLOG could also be cout
int icarusDB::ChannelMapPostGres::GetDataset ( const std::string &  name,
const std::string &  url,
const std::string &  dataType,
Dataset &  dataSet 
) const
private

Definition at line 114 of file ChannelMapPostGres_tool.cc.

115 {
116  const int timeout(200);
117  std::string dburl = url + "&t=" + dataType;
118  int error(0);
119  dataSet = getDataWithTimeout(dburl.data(),name.data(),timeout,&error);
120  if (error)
121  {
122  std::string errorMsg = "Database access GetDataset failed with error " + std::to_string(error) + "\nDB url: "
123  + dburl + ", name: " + name + ", type: " + dataType;
124  std::cout << "****> Database retrieval error, code: " << error << std::endl;
125  throw std::runtime_error(errorMsg);
126  }
127 
128  return error;
129 }
std::string to_string(WindowPattern const &pattern)
then echo fcl name
BEGIN_PROLOG could also be cout

Member Data Documentation

uint32_t icarusDB::ChannelMapPostGres::fNothing
private

Definition at line 90 of file ChannelMapPostGres_tool.cc.


The documentation for this class was generated from the following file: