All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
HWChannelMapping.py
Go to the documentation of this file.
1 #-------------------------------------------------------------------
2 #
3 # This script is to generate lot of functions which will help /
4 # on mapping between different important piece of channel mapping /
5 #
6 # This is a draft script for testing
7 # Author: Biswaranjan.Behera@colostate.edu @ 13 May 2020
8 #
9 #-------------------------------------------------------------------
10 
11 from DataLoader3 import DataLoader, DataQuery
12 import sys, os
13 
14 
15 queryUrl = "https://dbdata0vm.fnal.gov:9443/QE/hw/app/SQ/query"
16 print("\n Hello! Welcome to DataQuery form ICARUS Hardware Database: \n")
17 
18 
19 #Data query
20 dataQuery = DataQuery(queryUrl)
21 
22 # Mapping between ChannelID ----> Physical location
23 def physical_loc (ChannelID):
24 
25  geo_loc = dataQuery.query("icarus_hardware_dev", "daq_channels", 'readout_board_id',
26  'channel_id:eq:'+str(ChannelID))
27 
28  Flange_ID = dataQuery.query("icarus_hardware_dev", "readout_boards",
29  'flange_id',
30  'readout_board_id:eq:'+str(geo_loc)[2:-6])
31 
32  geo_loc = dataQuery.query("icarus_hardware_dev", "flanges", 'flange_pos_at_chimney',
33  'flange_id:eq:'+str(Flange_ID)[2:-6])
34 
35  return str(geo_loc)[2:-6]
36 
37 
38 # for example..
39 print (physical_loc(45295))
40 
41 
42 # Mapping between PMTChannelID (Larsoft) From Physical location of PMT ID
44  geo_loc = dataQuery.query("icarus_hardware_dev", "pmt_placements",
45  'channel_id',
46  'pmt_id:eq:'+str(pmtid))
47 
48  return str(geo_loc)[2:-6]
49 
50 # Mapping between PMTChannelID (Larsoft) From Digitizer Label and Digitizer Channel
51 def PMTChannelIDFromDigitizerLabel (digitizerlabel, digitizerchannel):
52  geo_loc = dataQuery.query("icarus_hardware_dev", "pmt_placements",
53  'channel_id',
54  ['digitizer_label:eq:'+str(digitizerlabel), 'digitizer_ch_number:eq:'+str(digitizerchannel)])
55 
56 
57  return str(geo_loc)[2:-6]
58 
59 print (PMTChannelIDFromPhysicalPMTPositionID (333))
60 print (PMTChannelIDFromDigitizerLabel ("EE-BOT-B", 10))
do one_file $F done echo for F in find $TOP name CMakeLists txt print
def PMTChannelIDFromDigitizerLabel
def PMTChannelIDFromPhysicalPMTPositionID