- Timestamp:
- 12/15/19 18:04:36 (5 years ago)
- Location:
- trunk/FACT++
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/spectrum/analysis.sql
r19893 r19907 11 11 returned. (Note that you must not add a comma behind it) 12 12 13 100| %100:columns 14 101| %101:files:: table containing the `FileId`s to analyze. 15 102| %102:runinfo:: table with the run info data 16 103| %103:events:: table with the image parameters 17 104| %104:positions:: table with the source positions in the camera 18 105| %105:estimator:: estimator for log10 energy 13 100| %100:files:: table containing the `FileId`s to analyze. 14 101| %101:runinfo:: table with the run info data 15 102| %102:events:: table with the image parameters 16 103| %103:positions:: table with the source positions in the camera 17 104| %105:zenith:: zenith angle in degrees 18 105| %104:columns 19 106| %105:estimator:: estimator for log10 energy 20 21 WARNING: 22 Right now, we correlate the mean zenith angle of the data 23 file with the particle direction in the simulation! 19 24 20 25 *************************************************************************** */ … … 23 28 ( 24 29 SELECT 25 %100:columns -- this could be removed if we can join events via the same columns (without CorsikaNumResuse) 30 %105:columns -- this could be removed if we can join events via the same columns (without CorsikaNumResuse) 31 %104:zenith AS Theta, 26 32 Weight, 27 33 Size, … … 40 46 cosa*Y + sina*X AS PY 41 47 FROM 42 %10 1:files48 %100:files 43 49 LEFT JOIN 44 %10 2:runinfo USING (FileId)50 %101:runinfo USING (FileId) 45 51 LEFT JOIN 46 %10 3:events USING (FileId) -- This could be replaced by a user uploaded temporary table52 %102:events USING (FileId) -- This could be replaced by a user uploaded temporary table 47 53 LEFT JOIN 48 %10 4:positions USING (FileId, EvtNumber)54 %103:positions USING (FileId, EvtNumber) 49 55 CROSS JOIN 50 56 Wobble … … 60 66 ( 61 67 SELECT 62 %10 0:columns63 Weight,68 %105:columns 69 Theta, Weight, 64 70 Size, CosDelta, SinDelta, M3Long, SlopeLong, Leakage1, WdivL, 65 71 MeanX - PX/1.02e0 AS DX, … … 74 80 ( 75 81 SELECT 76 %10 0:columns77 Weight,82 %105:columns 83 Theta, Weight, 78 84 Size, CosDelta, SinDelta, DX, DY, M3Long, SlopeLong, Leakage1, WdivL, 79 85 SQRT(DX*DX + DY*DY) AS Norm … … 85 91 ( 86 92 SELECT 87 %10 0:columns88 Weight,93 %105:columns 94 Theta, Weight, 89 95 Size, M3Long, SlopeLong, Leakage1, WdivL, Norm, 90 96 LEAST(GREATEST((CosDelta*DY - SinDelta*DX)/Norm, -1), 1) AS LX, … … 97 103 ( 98 104 SELECT 99 %10 0:columns100 Weight,105 %105:columns 106 Theta, Weight, 101 107 Size, Leakage1, WdivL, LX, 102 108 Norm *0.0117193246260285378e0 AS Dist, … … 110 116 ( 111 117 SELECT 112 %10 0:columns113 Weight,118 %105:columns 119 Theta, Weight, 114 120 Size, WdivL, Dist, LX, M3L, Slope, 115 121 1.39252e0 + 0.154247e0*Slope + 1.67972e0*(1-1/(1+4.86232e0*Leakage1)) AS Xi … … 121 127 ( 122 128 SELECT 123 %10 0:columns124 Weight,129 %105:columns 130 Theta, Weight, 125 131 Size, Dist, LX, 126 132 IF (M3L<-0.07 OR (Dist-0.5e0)*7.2e0-Slope<0, -Xi, Xi) * (1-WdivL) AS Disp … … 130 136 131 137 SELECT 132 %10 0:columns133 Weight,138 %105:columns 139 Theta, Weight, 134 140 (Disp*Disp + Dist*Dist - 2*Disp*Dist*SQRT(1-LX*LX)) AS ThetaSq, 135 %10 5:estimator AS LogEnergyEst141 %106:estimator AS LogEnergyEst 136 142 FROM 137 143 Table7 -
trunk/FACT++/spectrum/data.sql
r19905 r19907 1 1 SELECT 2 INTERVAL( fZenithDistanceMean, %106:theta) AS `.theta`,3 INTERVAL(LogEnergyEst, %10 7:sparse) AS `.sparse_est`,2 INTERVAL(Theta, %107:theta) AS `.theta`, 3 INTERVAL(LogEnergyEst, %108:sparse) AS `.sparse_est`, 4 4 5 5 -- Signal and Background counts -
trunk/FACT++/spectrum/simulation.sql
r19893 r19907 3 3 SELECT 4 4 Weight, Energy, LogEnergyEst, 5 INTERVAL( Zd, %106:theta) AS `.theta`,6 INTERVAL(LogEnergyEst, %10 7:sparse) AS `.sparse_est`,7 INTERVAL(LogEnergyEst, %10 8:dense) AS `.dense_est`,8 INTERVAL(LOG10(Energy), %10 7:sparse) AS `.sparse_sim`,9 INTERVAL(LOG10(Energy), %10 8:dense) AS `.dense_sim`,5 INTERVAL(Theta, %107:theta) AS `.theta`, 6 INTERVAL(LogEnergyEst, %108:sparse) AS `.sparse_est`, 7 INTERVAL(LogEnergyEst, %109:dense) AS `.dense_est`, 8 INTERVAL(LOG10(Energy), %108:sparse) AS `.sparse_sim`, 9 INTERVAL(LOG10(Energy), %109:dense) AS `.dense_sim`, 10 10 11 (%1 09:spectrum)/POW(Energy, SpectralIndex) AS SpectralWeight, -- FIXME: Is this correct for files with different Slopes?11 (%110:spectrum)/POW(Energy, SpectralIndex) AS SpectralWeight, -- FIXME: Is this correct for files with different Slopes? 12 12 LogEnergyEst - log10(Energy) AS Residual 13 13 FROM -
trunk/FACT++/spectrum/spectrum.sql
r19904 r19907 76 76 Flux AS 77 77 ( 78 SELECT -- Return final result78 SELECT -- Calculate Flux and Relative Errors 79 79 *, 80 80 81 -- Differe tial Spectrum81 -- Differential Spectrum 82 82 83 83 SimExcess/SimFluxW AS Efficiency, 84 84 85 85 Excess/SimExcess/Width/AreaTime AS ExcessRatio, 86 1/SQRT(86 SQRT( 87 87 + POW(ErrExcess / Excess, 2) 88 88 + POW(ErrSimExcess / SimExcess, 2) 89 ) AS SigmaExcessRatio,89 ) AS RelErrExcessRatio, 90 90 91 91 92 92 Excess/SimExcess*SimFluxW/Width/AreaTime AS Flux, 93 1/SQRT(93 SQRT( 94 94 + POW(ErrExcess / Excess, 2) 95 95 + POW(ErrSimExcess / SimExcess, 2) 96 96 + POW(ErrSimFluxW / SimFluxW, 2) 97 ) AS SigmaFlux,97 ) AS RelErrFlux, 98 98 99 99 -- Integral Spectrum … … 102 102 103 103 ExcessI/SimExcessI/AreaTime AS ExcessRatioI, 104 1/SQRT(104 SQRT( 105 105 + POW(ErrExcessI / ExcessI, 2) 106 106 + POW(ErrSimExcessI / SimExcessI, 2) 107 ) AS SigmaExcessRatioI,107 ) AS RelErrExcessRatioI, 108 108 109 109 110 110 ExcessI/SimExcessI*SimFluxI/AreaTime AS FluxI, 111 1/SQRT(111 SQRT( 112 112 + POW(ErrExcessI / ExcessI, 2) 113 113 + POW(ErrSimExcessI / SimExcessI, 2) 114 114 + POW(ErrSimFluxI / SimFluxI, 2) 115 ) AS SigmaFluxI115 ) AS RelErrFluxI 116 116 117 117 FROM 118 118 CombinedData 119 119 ), 120 SpectrumAS120 Errors AS 121 121 ( 122 SELECT -- Return final result122 SELECT -- Calculate Inverse of Relative Errors (Sigma) and Absolute Errors 123 123 *, 124 124 125 ExcessRatio /SigmaExcessRatio AS ErrExcessRatio, 126 ExcessRatioI/SigmaExcessRatioI AS ErrExcessRatioI, 127 ABS(Flux) /SigmaFlux AS ErrFlux, 128 ABS(FluxI) /SigmaFluxI AS ErrFluxI 125 IF(RelErrExcessRatio =0, NULL, 1/RelErrExcessRatio ) AS SigmaExcessRatio, 126 IF(RelErrExcessRatioI=0, NULL, 1/RelErrExcessRatioI) AS SigmaExcessRatioI, 127 IF(RelErrFlux =0, NULL, 1/RelErrFlux ) AS SigmaFlux, 128 IF(RelErrFluxI =0, NULL, 1/RelErrFluxI ) AS SigmaFluxI, 129 130 IF(Excess =0, ErrExcess /SimExcess /AreaTime/Width, ExcessRatio *RelErrExcessRatio ) AS ErrExcessRatio, 131 IF(ExcessI=0, ErrExcessI/SimExcessI /AreaTime, ExcessRatioI*RelErrExcessRatioI) AS ErrExcessRatioI, 132 IF(Excess =0, ErrExcess /Efficiency /AreaTime/Width, ABS(Flux) *RelErrFlux ) AS ErrFlux, 133 IF(ExcessI=0, ErrExcessI/EfficiencyI /AreaTime, ABS(FluxI) *RelErrFluxI ) AS ErrFluxI 129 134 FROM 130 135 Flux … … 133 138 *, 134 139 135 -- Integrate dSpectrum140 -- Integrate Differential Spectrum 136 141 137 142 SUM(Flux*Width) OVER Integral AS IntegratedFlux, … … 139 144 140 145 FROM 141 Spectrum146 Errors 142 147 WINDOW 143 148 Integral AS (ORDER BY %101:bin DESC) -
trunk/FACT++/spectrum/summary-sim.sql
r19902 r19907 30 30 %102:bin 31 31 ), 32 Triggered AS -- Summariz ytriggered (ceres) data in bins32 Triggered AS -- Summarize triggered (ceres) data in bins 33 33 ( 34 34 SELECT -
trunk/FACT++/src/spectrum.cc
r19904 r19907 1046 1046 1047 1047 query5.template_defaults["table"] = "EventsMC"; 1048 query5.template_defaults["column"] = " Zd";1048 query5.template_defaults["column"] = "DEGREES(Theta)"; 1049 1049 1050 1050 if (print_queries) … … 1322 1322 1323 1323 //query6.template_defaults["columns"] = "FileId, EvtNumber, CorsikaNumReuse,"; 1324 query8.template_defaults["columns"] = "Zd, Energy, SpectralIndex,"; 1324 query8.template_defaults["columns"] = "Energy, SpectralIndex,"; 1325 query8.template_defaults["zenith"] = "DEGREES(Theta)"; 1325 1326 query8.template_defaults["files"] = "MonteCarloFiles"; 1326 1327 query8.template_defaults["runinfo"] = "factmc.RunInfoMC"; … … 1912 1913 1913 1914 //query5.template_defaults["columns"] = "FileId, EvtNumber,"; 1914 query12.template_defaults["columns"] = "fZenithDistanceMean,"; 1915 query12.template_defaults["columns"] = ""; 1916 query12.template_defaults["zenith"] = "fZenithDistanceMean"; 1915 1917 query12.template_defaults["files"] = "DataFiles"; 1916 1918 query12.template_defaults["runinfo"] = "factdata.RunInfo";
Note:
See TracChangeset
for help on using the changeset viewer.