Changeset 20031 for trunk/Mars
- Timestamp:
- 01/07/21 14:38:53 (4 years ago)
- Location:
- trunk/Mars/hawc/processing
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Mars/hawc/processing/extract-aux-data.sh
r20030 r20031 1 1 #!/bin/bash 2 3 # Specify the telescope for which to run the script. Replace '1' 4 # by $1 if the telesocpe number is supplied as an option to the script 5 TELESCOPE=1 2 6 3 7 # The base directory of the aux-files … … 7 11 # The path (relative to your Mars/build directory where the processing macros are stored 8 12 MACROS=../hawc/processing 13 # File to which the queries are written 14 OUTPUT="insert-aux.sql" 9 15 10 16 # Open the query-file with the create table statement … … 13 19 CREATE TABLE AuxData 14 20 ( 21 Telescope TINYINT UNSIGNED NOT NULL, 15 22 NIGHT INT UNSIGNED NOT NULL, 16 23 RUNID MEDIUMINT UNSIGNED NOT NULL, … … 48 55 RateSum0 FLOAT, 49 56 RateSum1 FLOAT, 50 PRIMARY KEY( NIGHT, RUNID)57 PRIMARY KEY(Telescope, NIGHT, RUNID) 51 58 ) 52 59 SELECT * FROM 53 60 ( VALUES 54 "\ > insert-data.sql61 "\ > ${OUTPUT} 55 62 56 63 # Get all available runs and their start and stop time … … 61 68 NIGHT, RUNID, TSTARTI+TSTARTF, TSTOPI+TSTOPF 62 69 FROM 63 RawData\ 70 RawData 71 WHERE 72 Telescope=${TELESCOPE}\ 64 73 "\ 65 74 | mysql \ … … 129 138 130 139 # Write the result as one row to the query file 131 echo "/* "${FNAME}" */" >> insert-data.sql132 echo "ROW(" >> insert-data.sql133 echo " "${ NIGHT}, ${RUNID}, >> insert-data.sql134 echo " "${DRS_TEMP}, >> insert-data.sql135 echo " "${BIAS_DATA}, >> insert-data.sql136 echo " "${FTU_DATA}, >> insert-data.sql137 echo " "${FTM_DATA} >> insert-data.sql138 echo ")," >> insert-data.sql140 echo "/* "${FNAME}" */" >> ${OUTPUT} 141 echo "ROW(" >> ${OUTPUT} 142 echo " "${TELESCOPE], ${NIGHT}, ${RUNID}, >> ${OUTPUT} 143 echo " "${DRS_TEMP}, >> ${OUTPUT} 144 echo " "${BIAS_DATA}, >> ${OUTPUT} 145 echo " "${FTU_DATA}, >> ${OUTPUT} 146 echo " "${FTM_DATA} >> ${OUTPUT} 147 echo ")," >> ${OUTPUT} 139 148 140 149 done … … 144 153 AS 145 154 ( 146 NIGHT, RUNID,155 Telescope, NIGHT, RUNID, 147 156 TavgDRS, TrmsDRS, 148 157 Umed, Uavg, Udev, Urms, … … 156 165 RateSum0, RateSum1 157 166 )\ 158 " >> insert-data.sql167 " >> ${OUTPUT} -
trunk/Mars/hawc/processing/extract-raw-headers.sh
r20026 r20031 1 1 #/bin/bash 2 3 # Specify the telescope for which to run the script. Replace '1' 4 # by $1 if the telesocpe number is supplied as an option to the script 5 TELESCOPE=1 2 6 3 7 # This is the directory in which to serach for files … … 6 10 FITSDUMP=~/FACT++/build/fitsdump 7 11 # File to which the queries are written 8 OUTPUT="insert- queries.sql"12 OUTPUT="insert-raw.sql" 9 13 10 # Remove an existing file with queries 11 rm -f ${OUTPUT} 14 echo \ 15 "\ 16 CREATE TABLE RawData IF NOT EXIST 17 ( 18 Telescope tinyint UNSIGNED NOT NULL, 19 NIGHT int UNSIGNED NOT NULL, 20 RUNID mediumint UNSIGNED NOT NULL, 21 DATE-OBS datetime(6) NOT NULL, 22 DATE-END datetime(6) NOT NULL, 23 RUNTYPE tinyint UNSIGNED NOT NULL, 24 DRSSTEP tinyint UNSIGNED DEFAULT NULL, 25 NROI mediumint UNSIGNED NOT NULL, 26 ZNAXIS2 bigint UNSIGNED NOT NULL, 27 NTRG int UNSIGNED NOT NULL, 28 NTRGMISC int UNSIGNED NOT NULL, 29 NTRGPED int UNSIGNED NOT NULL, 30 REFCLK float NOT NULL, 31 ZRATIO float NOT NULL, 32 DAC0 mediumint UNSIGNED NOT NULL, 33 DAC1 mediumint UNSIGNED NOT NULL, 34 DAC2 mediumint UNSIGNED NOT NULL, 35 DAC3 mediumint UNSIGNED NOT NULL, 36 DAC4 mediumint UNSIGNED NOT NULL, 37 DAC5 mediumint UNSIGNED NOT NULL, 38 DAC6 mediumint UNSIGNED NOT NULL, 39 DAC7 mediumint UNSIGNED NOT NULL, 40 DATE timestamp NOT NULL, 41 DRSCALIB tinyint(1) NOT NULL, 42 NTRGEXT1 int UNSIGNED NOT NULL, 43 NTRGEXT2 int UNSIGNED NOT NULL, 44 NTRGLPE int UNSIGNED NOT NULL, 45 NTRGLPI int UNSIGNED NOT NULL, 46 NTRGTIM int UNSIGNED NOT NULL, 47 TSTARTF double NOT NULL, 48 TSTARTI mediumint UNSIGNED NOT NULL, 49 TSTOPF double NOT NULL, 50 TSTOPI mediumint UNSIGNED NOT NULL, 51 DNA0 bigint UNSIGNED NOT NULL, 52 DNA1 bigint UNSIGNED NOT NULL, 53 FWVER0 mediumint UNSIGNED NOT NULL, 54 FWVER1 mediumint UNSIGNED NOT NULL, 55 PRIMARY KEY (Telescope, NIGHT, RUNID), 56 KEY (RUNTYPE) 57 ); 58 "\ > ${OUTPUT} 59 12 60 13 61 # Loop over all tokens returned by the given bash extension … … 58 106 then 59 107 echo "INSERT INTO RawData SET" >> ${OUTPUT} 60 echo ${RESULT} >> ${OUTPUT} 108 echo Telescope=${TELESCOPE}, >> ${OUTPUT} 109 echo ${RESULT} >> ${OUTPUT} 61 110 echo ";" >> ${OUTPUT} 62 111 fi -
trunk/Mars/hawc/processing/find-calibration-files.sql
r20026 r20031 8 8 SELECT 9 9 -- NIGHT and RUNID of the data file 10 R1.NIGHT AS NIGHT, 11 R1.RUNID AS RUNID, 10 R1.Telescope AS Telescope, 11 R1.NIGHT AS NIGHT, 12 R1.RUNID AS RUNID, 12 13 -- NIGHT and RUNID of the DRS file 13 R2.NIGHT AS DrsNight,14 R2.RUNID AS DrsRunID,14 R2.NIGHT AS DrsNight, 15 R2.RUNID AS DrsRunID, 15 16 -- Time difference between the two 16 17 LEAST( … … 40 41 DoNotUse ON (R2.NIGHT=DoNotUse.NIGHT AND R2.RUNID=DoNotUse.RUNID) 41 42 WHERE 43 -- Of course claibration must be from the same telescope 44 R1.Telescope=R2.Telescope 45 AND 42 46 -- Select all combinations that have a data file in R1 and a drs file (at step 1) in R2 43 ISNULL(R1.DRSSTEP) AND R2.DRSSTEP=1 47 ISNULL(R1.DRSSTEP) AND R2.DRSSTEP=1 44 48 AND 45 49 -- Only DRS files with 100 events and the correct ROI are considered … … 51 55 -- AND ABS(UNIX_TIMESTAMP(R2.`DATE-OBS`)-UNIX_TIMESTAMP(R1.`DATE-OBS`))<78*3600 52 56 ORDER BY 53 R1.NIGHT, R1.RUNID, DeltaT 57 R1.Telescope, 58 R1.NIGHT, 59 R1.RUNID, 60 DeltaT 54 61 ) 55 62 SELECT 63 Telescope, 56 64 NIGHT, 57 65 RUNID, -
trunk/Mars/hawc/processing/root2sql-callisto.rc
r20026 r20031 1 # link to database 1 2 uri=hawcwrite:password@ihp-pc45.ethz.ch/hawcdata 2 3 3 # Table's name, will be created if it is not existing already4 create=yes5 delete=yes6 4 # Tree's name 7 5 tree=Events 8 6 7 # Table's name, will be created if it is not existing already 8 #table=Callisto 9 10 # Create if not yet existing 11 create=yes 12 # Delete entries corresponding to consts 13 delete=yes 14 15 # Consts 16 primary=Telescope 9 17 primary=NIGHT 10 18 primary=RUNID 19 # Event ID 11 20 primary=DAQEvtNumber 12 21 22 # Manual specification of type for const columns 23 sql-type=Telescope/TINYINT UNSIGNED NOT NULL 13 24 sql-type=NIGHT/INT UNSIGNED NOT NULL 14 25 sql-type=RUNID/MEDIUMINT UNSIGNED NOT NULL -
trunk/Mars/hawc/processing/root2sql-star.rc
r20026 r20031 1 # link to database 1 2 uri=hawcwrite:password@ihp-pc45.ethz.ch/hawcdata 2 3 4 # Tree's name 3 5 tree=Events 4 6 7 # Table's name, will be created if it is not existing already 8 #table=Star 9 10 # Create if not yet existing 5 11 create=yes 12 # Delete entries corresponding to consts 6 13 delete=yes 7 14 15 # Consts 16 primary=Telescope 8 17 primary=NIGHT 9 18 primary=RUNID 19 # Event ID 10 20 primary=DAQEvtNumber 11 21 22 # Manual specification of type for const columns 23 sql-type=Telescope/TINYINT UNSIGNED NOT NULL 12 24 sql-type=NIGHT/INT UNSIGNED NOT NULL 13 25 sql-type=RUNID/MEDIUMINT UNSIGNED NOT NULL -
trunk/Mars/hawc/processing/run-callisto.sh
r20028 r20031 1 1 #!/bin/bash 2 3 # Specify the telescope for which to run the script. Replace '1' 4 # by $1 if the telesocpe number is supplied as an option to the script 5 TELESCOPE=1 2 6 3 7 # The data is expected to be found in /data/raw and data/callisto … … 20 24 FROM 21 25 Calibration 26 WHERE 27 Telescope=${TELESCOPE} 22 28 ORDER BY 23 29 NIGHT, RUNID\ -
trunk/Mars/hawc/processing/run-root2sql.sh
r20026 r20031 1 1 #/bin/bash 2 3 # Specify the telescope for which to run the script. Replace '1' 4 # by $1 if the telesocpe number is supplied as an option to the script 5 TELESCOPE=1 2 6 3 7 # Path where the data is stored... can be callisto or star … … 61 65 -C ${RESOURCE} \ 62 66 --table=${TABLE} \ 67 --const.Telescope=${TELESCOPE} \ 63 68 --const.NIGHT=${NIGHT} \ 64 69 --const.RUNID=${RUNID} \ -
trunk/Mars/hawc/processing/run-star.sh
r20028 r20031 1 1 #!/bin/bash 2 3 4 # Specify the telescope for which to run the script. Replace '1' 5 # by $1 if the telesocpe number is supplied as an option to the script 6 TELESCOPE=1 2 7 3 8 # The data is expected to be found in /data/raw and data/callisto … … 19 24 NIGHT, RUNID 20 25 FROM 21 Calibration_new 26 Calibration 27 WHERE 28 Telescope=${TELESCOPE} 22 29 ORDER BY 23 30 NIGHT, RUNID\ -
trunk/Mars/hawc/processing/software-trigger.sql
r20026 r20031 3 3 CREATE TABLE SoftwareTrigger 4 4 ( 5 NIGHT INT UNSIGNED NOT NULL, 6 RUNID MEDIUMINT UNSIGNED NOT NULL, 7 Cnt500 INT UNSIGNED NOT NULL, 8 Cnt750 INT UNSIGNED NOT NULL, 9 Cnt1000 INT UNSIGNED NOT NULL, 10 Cnt1250 INT UNSIGNED NOT NULL, 11 Cnt1500 INT UNSIGNED NOT NULL, 12 Cnt2000 INT UNSIGNED NOT NULL, 13 Cnt5000 INT UNSIGNED NOT NULL, 14 PRIMARY KEY (NIGHT, RUNID) 5 Telescope TINYINT UNSIGNED NOT NULL, 6 NIGHT INT UNSIGNED NOT NULL, 7 RUNID MEDIUMINT UNSIGNED NOT NULL, 8 Cnt500 INT UNSIGNED NOT NULL, 9 Cnt750 INT UNSIGNED NOT NULL, 10 Cnt1000 INT UNSIGNED NOT NULL, 11 Cnt1250 INT UNSIGNED NOT NULL, 12 Cnt1500 INT UNSIGNED NOT NULL, 13 Cnt2000 INT UNSIGNED NOT NULL, 14 Cnt5000 INT UNSIGNED NOT NULL, 15 PRIMARY KEY (Telescope, NIGHT, RUNID) 15 16 ) 16 17 AS 17 18 ( 18 19 SELECT 20 Telescope, 19 21 NIGHT, 20 22 RUNID, … … 29 31 `Callisto` 30 32 GROUP BY 33 Telescope, 34 NIGHT, 35 RUNID 36 ORDER BY 37 Telescope, 31 38 NIGHT, 32 39 RUNID -
trunk/Mars/hawc/processing/summary-aux-data.rc
r20026 r20031 19 19 RawData 20 20 LEFT JOIN 21 AuxData USING ( NIGHT, RUNID)21 AuxData USING (Telescope, NIGHT, RUNID) 22 22 LEFT JOIN 23 SoftwareTrigger USING ( NIGHT, RUNID)23 SoftwareTrigger USING (Telescope, NIGHT, RUNID) 24 24 LEFT JOIN 25 DoNotUse USING ( NIGHT, RUNID)25 DoNotUse USING (Telescope, NIGHT, RUNID) 26 26 HAVING 27 27 ObsTime>0 28 28 ORDER BY 29 NIGHT, RUNID29 Telescope, NIGHT, RUNID -
trunk/Mars/hawc/processing/summary-callisto.sql
r20026 r20031 1 1 #!/usr/bin/env -S rootifysql 2 2 SELECT 3 Telescope, 3 4 NIGHT, 5 RUNID, 4 6 (TSTARTI+TSTARTF) AS ObsStart, 5 7 RUNTYPE, … … 11 13 `Callisto` Callisto 12 14 LEFT JOIN 13 RawData USING( NIGHT, RUNID)15 RawData USING(Telescope, NIGHT, RUNID) 14 16 LEFT JOIN 15 AuxData USING( NIGHT, RUNID)17 AuxData USING(Telescope, NIGHT, RUNID) 16 18 ORDER BY 17 NIGHT, RUNID19 Telesscope, NIGHT, RUNID -
trunk/Mars/hawc/processing/summary-star.sql
r20026 r20031 8 8 `Star` Star 9 9 LEFT JOIN 10 RawData USING(NIGHT, RUNID) 11 10 RawData USING(Telescope, NIGHT, RUNID) 11 ORDER BY 12 Telescope, 13 NIGHT, 14 RUNID
Note:
See TracChangeset
for help on using the changeset viewer.