Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 12:51:45

0001 #!/bin/csh
0002 
0003 setenv  CELL_MAP_VERSION $1
0004 setenv   ROB_MAP_VERSION $2
0005 setenv NUMBERING_VERSION $3
0006 
0007 #setenv DB_SRC drifttube@cmsomds/daqcms
0008 
0009 setenv DB_SRC CMS_VAL_DT_POOL_OWNER@cms_val_lb.cern.ch/val_dt_own_1031
0010 setenv DB_END CMS_VAL_DT_POOL_WRITER@cms_val_lb.cern.ch/val_dt_wri_1031
0011 
0012 #setenv DB_SRC cms_dt_writer@devdb/daqcms123
0013 #setenv DB_END cms_dt_writer@devdb/daqcms123
0014 
0015 setenv TMPFILE /tmp/buildscript`date +%s`
0016 
0017 # count maps in destination db
0018 
0019 sqlplus ${DB_END} << EOF | grep ENTRY | grep -vi mapping | awk -v NMAX=0 '($2>=NMAX){NMAX=1+$2} END {print "setenv NMAP "NMAX}' > ${TMPFILE}
0020 select 'ENTRY',iov_value_id from dtreadoutmapping;
0021 EOF
0022 
0023 # retrieve original maps identifiers
0024 
0025 sqlplus ${DB_SRC} << EOF | grep ENTRY | grep -vi connection | awk -v CELL_MAP_VERSION=${CELL_MAP_VERSION} '{print "setenv CELL_MAP_ID "$2}' >> ${TMPFILE}
0026 select 'ENTRY',connection_id from dt_connection_master where connection_type='DT_CELL_READOUT_CONNECTION' and mapping_version='${CELL_MAP_VERSION}';
0027 EOF
0028 
0029 sqlplus ${DB_SRC} << EOF | grep ENTRY | grep -vi connection | awk -v ROB_MAP_VERSION=${ROB_MAP_VERSION} '{print "setenv ROB_MAP_ID "$2}' >> ${TMPFILE}
0030 select 'ENTRY',connection_id from dt_connection_master where connection_type='DT_ROB_ROS_CONNECTION' and mapping_version='${ROB_MAP_VERSION}';
0031 EOF
0032 
0033 sqlplus ${DB_SRC} << EOF | grep ENTRY | grep -vi numbering | awk -v NUMBERING_VERSION=${NUMBERING_VERSION} '{print "setenv NUMBERING_ID "$2}' >> ${TMPFILE}
0034 select 'ENTRY',numbering_id from dt_numbering_master where numbering_version='${NUMBERING_VERSION}';
0035 EOF
0036 
0037 source ${TMPFILE}
0038 rm -f ${TMPFILE}
0039 
0040 # build offline map
0041 
0042 echo ${NMAP}" "${CELL_MAP_ID}" "${ROB_MAP_ID}
0043 
0044 sqlplus ${DB_SRC} << EOF | grep ENTRY | grep -vi wheel | awk -v NMAP=${NMAP} -v CELL_MAP_VERSION=${CELL_MAP_VERSION} -v ROB_MAP_VERSION=${ROB_MAP_VERSION} -v NCON=0 -f buildmap.awk | sqlplus ${DB_END}
0045 
0046 set line 200
0047 set pagesize 2
0048 select 'ENTRY',
0049        dt_wheel_numbering.object_number as wheel,
0050        dt_chamber_numbering.station_number as station,
0051        dt_chamber_numbering.sector_number as sector,
0052        dt_superlayer_numbering.object_number as sl,
0053        dt_layer_numbering.object_number as layer,
0054        dt_cell_numbering.object_number as cell,
0055        dt_ddu.read_out_number as ddu,
0056        dt_ros.read_out_number as ros,
0057        dt_ros_channel.read_out_number as rob,
0058        dt_tdc.read_out_number as tdc,
0059        dt_tdc_channel.read_out_number as channel,
0060        dt_cell_readout_map.connection_id,
0061        dt_rob_ros_connection.connection_id
0062   from dt_wheel_numbering,dt_chamber_numbering,
0063        dt_superlayer_numbering,dt_layer_numbering,dt_cell_numbering,
0064        dt_wheel,dt_sector,dt_chamber,dt_superlayer,dt_layer,dt_cell,
0065        dt_cell_readout_map,dt_tdc_channel,dt_tdc,dt_rob,
0066        dt_rob_ros_connection,dt_ros_channel,dt_ros,dt_ddu
0067   where dt_cell_readout_map.cell_id=dt_cell.cell_id
0068     and dt_cell.layer_id=dt_layer.layer_id
0069     and dt_layer.sl_id=dt_superlayer.sl_id
0070     and dt_superlayer.chamber_id=dt_chamber.chamber_id
0071     and dt_chamber.sector_id=dt_sector.sector_id
0072     and dt_sector.wheel_id=dt_wheel.wheel_id
0073     and dt_wheel_numbering.wheel_id=dt_wheel.wheel_id
0074     and dt_chamber_numbering.chamber_id=dt_chamber.chamber_id
0075     and dt_superlayer_numbering.sl_id=dt_superlayer.sl_id
0076     and dt_layer_numbering.layer_id=dt_layer.layer_id
0077     and dt_cell_numbering.cell_id=dt_cell.cell_id
0078     and dt_cell_readout_map.tdc_channel_id=dt_tdc_channel.tdc_channel_id
0079     and dt_tdc_channel.tdc_id=dt_tdc.tdc_id
0080     and dt_tdc.rob_id=dt_rob.rob_id
0081     and dt_rob.rob_id=dt_rob_ros_connection.rob_id
0082     and dt_ros_channel.ros_channel_id=dt_rob_ros_connection.ros_channel_id
0083     and dt_ros_channel.ros_id=dt_ros.ros_id
0084     and dt_ros.ddu_id=dt_ddu.ddu_id
0085     and dt_cell_readout_map.connection_id=${CELL_MAP_ID}
0086     and dt_rob_ros_connection.connection_id=${ROB_MAP_ID}
0087     and dt_wheel_numbering.numbering_id=${NUMBERING_ID}
0088     and dt_chamber_numbering.numbering_id=${NUMBERING_ID}
0089     and dt_superlayer_numbering.numbering_id=${NUMBERING_ID}
0090     and dt_layer_numbering.numbering_id=${NUMBERING_ID}
0091     and dt_cell_numbering.numbering_id=${NUMBERING_ID};
0092 quit;
0093 EOF
0094