Changeset 19897 for trunk/FACT++
- Timestamp:
- 12/14/19 23:41:19 (5 years ago)
- Location:
- trunk/FACT++/spectrum
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/spectrum/display.C
r19894 r19897 35 35 f0.SetLineStyle(kDashed); 36 36 f0.SetLineColor(kBlack); 37 38 TF1 f("spectrum", "[0]*pow(pow(10, x)/1000, -[1])", 2.8, 4.5); 39 f.SetLineColor(kBlue); 37 40 38 41 // -------------------------------- … … 209 212 // -------------------------------- 210 213 211 c = new TCanvas("Spectrum", "Spectrum"); 214 c = new TCanvas("Integral Spectrum", "Integral Spectrum"); 215 c->SetLogy(); 216 file.GetObject("Data/Energy/IntegratedSpectrum", h1); 217 h1->SetLineColor(kGray); 218 h1->SetMarkerColor(kGray); 219 h1->DrawCopy("P"); 220 file.GetObject("Data/Energy/IntegralSpectrum", h1); 221 h1->DrawCopy("P same"); 222 223 f.SetParameters(h1->GetMaximum(), 2.4); 224 h1->Fit(&f, "N0EM", ""); 225 f.DrawCopy("same"); 226 227 cout << endl; 228 cout << "ChiSq " << f.GetChisquare() << " / " << f.GetNDF() << endl; 229 cout << "Prob. " << f.GetProb() << endl; 230 cout << endl; 231 232 file.GetObject("Data/Energy/RolkeIntegralUL", h1); 233 h1->SetMarkerStyle(23); 234 h1->DrawCopy("P same"); 235 236 //file.GetObject("RolkeLL", h1); 237 //h1->SetMarkerStyle(22); 238 //h1->DrawCopy("P same"); 239 240 // -------------------------------- 241 242 c = new TCanvas("Differential Spectrum", "Differential Spectrum"); 212 243 c->SetLogy(); 213 244 file.GetObject("Data/Energy/Spectrum", h1); 214 245 h1->DrawCopy("P"); 215 246 216 TF1 f("spectrum", "[0]*pow(pow(10, x)/1000, -[1])", 2.8, 4.5);217 247 f.SetParameters(h1->GetMaximum(), 2.4); 218 248 h1->Fit(&f, "N0EM", ""); -
trunk/FACT++/spectrum/spectrum.sql
r19893 r19897 3 3 SELECT 4 4 %101:bin, 5 5 6 SUM(`Signal`) AS `Signal`, 6 7 SUM(`Background`)/5 AS `Background`, … … 12 13 %101:bin 13 14 ), 14 ResultData AS -- Calculate results for allbins15 Data AS -- Integral is a placeholder for the bin and all following bins 15 16 ( 16 17 SELECT 17 18 *, 18 SQRT(`Signal`) AS ErrSignal, 19 SQRT(`Background`) AS ErrBackground, 20 `Signal` - `Background` AS Excess, 21 ExcErr(`Signal`, `Background`) AS ErrExcess, 22 LiMa( `Signal`, `Background`) AS Significance 19 SUM(`Signal`) OVER Integral AS IntegralSignal, 20 SUM(`Background`) OVER Integral /5 AS IntegralBackground, 21 SUM(SumEnergyEst) OVER Integral AS IntegralEnergyEst, 22 SUM(SumW) OVER Integral AS IntegralSumW 23 23 FROM 24 24 BinnedData 25 WINDOW 26 Integral AS (ORDER BY %101:bin DESC) 25 27 ), 26 28 CombinedData AS -- Joind data together and for conveninece (easier reading of the query) rename the columns … … 31 33 %102:id.hi, 32 34 (%102:id.lo+%102:id.hi)/2 AS center, 33 %102:id.Scale, 34 Data.Excess, 35 Data.Signal, 36 Data.Background, 37 Data.ErrExcess, 38 Data.ErrSignal, 39 Data.ErrBackground, 40 Significance, 35 %102:id.Width, 36 %102:id.AreaTime, 37 38 `Signal`, 39 `Background`, 40 41 IntegralSignal, 42 IntegralBackground, 43 44 `Signal` - `Background` AS Excess, 45 SQRT(`Signal`) AS ErrSignal, 46 SQRT(`Background`) AS ErrBackground, 47 ExcErr(`Signal`, `Background`) AS ErrExcess, 48 LiMa( `Signal`, `Background`) AS Significance, 49 50 IntegralSignal - IntegralBackground AS IntegralExcess, 51 SQRT(IntegralSignal) AS ErrIntegralSignal, 52 SQRT(IntegralBackground) AS ErrIntegralBackground, 53 ExcErr(IntegralSignal, IntegralBackground) AS ErrIntegralExcess, 54 LiMa( IntegralSignal, IntegralBackground) AS IntegralSignificance, 55 41 56 SumEnergyEst/SumW AS AvgEnergyEst, 57 IntegralEnergyEst/IntegralSumW AS IntegralAvgEnergyEst, 58 42 59 %102:id.ExcessFluxW AS SimExcess, 43 60 %102:id.ErrExcessFluxW AS ErrSimExcess, 44 Sim.SimFluxW/%103:weight AS SimFluxW, -- Possible correcton for already applied ZdWeights 45 Sim.ErrSimFluxW/%104:errweight AS ErrSimFluxW -- Possible correcton for already applied ZdWeights 61 %102:id.IntegralExcessFluxW AS IntegralSimExcess, 62 %102:id.ErrIntegralExcessFluxW AS ErrIntegralSimExcess, 63 64 -- For flux-vs-theta: Correction for already applied ZdWeights 65 Sim.SimFluxW/%103:weight AS SimFluxW, 66 Sim.ErrSimFluxW/%104:errweight AS ErrSimFluxW, 67 Sim.IntegralSimFluxW/%103:weight AS IntegralSimFluxW, 68 Sim.ErrIntegralSimFluxW/%104:errweight AS ErrIntegralSimFluxW 46 69 FROM 47 ResultDataData70 Data 48 71 INNER JOIN 49 72 %105:join1 50 73 INNER JOIN 51 74 %106:join2 52 ) 75 ), 76 Spectrum AS 77 ( 53 78 SELECT -- Return final result 54 79 *, 55 SimExcess/SimFluxW AS Efficiency, 56 Excess/SimExcess*Scale AS ExcessRatio, 57 Excess/SimExcess*Scale 80 81 -- Differetial Spectrum 82 83 SimExcess/SimFluxW AS Efficiency, 84 85 Excess/SimExcess/Width/AreaTime AS ExcessRatio, 86 Excess/SimExcess/Width/AreaTime 58 87 * SQRT( 59 88 + POW(ErrExcess / Excess, 2) 60 89 + POW(ErrSimExcess / SimExcess, 2) 61 90 ) AS ErrExcessRatio, 62 Excess/SimExcess*SimFluxW*Scale AS Flux, 63 Excess/SimExcess*SimFluxW*Scale 91 92 93 Excess/SimExcess*SimFluxW/Width/AreaTime AS Flux, 94 Excess/SimExcess*SimFluxW/Width/AreaTime 64 95 * SQRT( 65 96 + POW(ErrExcess / Excess, 2) 66 97 + POW(ErrSimExcess / SimExcess, 2) 67 98 + POW(ErrSimFluxW / SimFluxW, 2) 68 ) AS ErrFlux 99 ) AS ErrFlux, 100 101 -- Integral Spectrum 102 103 IntegralSimExcess/IntegralSimFluxW AS IntegralEfficiency, 104 105 IntegralExcess/IntegralSimExcess/AreaTime AS IntegralExcessRatio, 106 IntegralExcess/IntegralSimExcess/AreaTime 107 * SQRT( 108 + POW(ErrIntegralExcess / IntegralExcess, 2) 109 + POW(ErrIntegralSimExcess / IntegralSimExcess, 2) 110 ) AS ErrIntegralExcessRatio, 111 112 113 IntegralExcess/IntegralSimExcess*IntegralSimFluxW/AreaTime AS IntegralFlux, 114 IntegralExcess/IntegralSimExcess*IntegralSimFluxW/AreaTime 115 * SQRT( 116 + POW(ErrIntegralExcess / IntegralExcess, 2) 117 + POW(ErrIntegralSimExcess / IntegralSimExcess, 2) 118 + POW(ErrIntegralSimFluxW / IntegralSimFluxW, 2) 119 ) AS ErrIntegralFlux 120 69 121 FROM 70 122 CombinedData … … 73 125 ORDER BY 74 126 %101:bin 127 ) 128 SELECT 129 *, 130 131 -- Integrated Spectrum 132 133 SUM(Flux*Width) OVER Integral AS IntegratedFlux, 134 SQRT(SUM(POW(ErrFlux*Width,2)) OVER Integral) AS ErrIntegratedFlux 135 136 FROM 137 Spectrum 138 139 WINDOW 140 Integral AS (ORDER BY %101:bin DESC) -
trunk/FACT++/spectrum/summary-est.sql
r19893 r19897 11 11 SELECT 12 12 *, 13 1000/(POW(10,hi)-POW(10,lo))/Area/ObsTime AS Scale 13 (POW(10,hi)-POW(10,lo))/1000 AS Width, 14 Area*ObsTime AS AreaTime 14 15 FROM 15 16 BinningEnergy_%100:binning … … 21 22 SELECT 22 23 `.%100:binning:_est`, 24 23 25 SUM(SignalN) AS SignalN, 24 26 SUM(SignalW) AS SignalW, 25 27 SUM(SignalW2) AS SignalW2, 28 26 29 SUM(BackgroundN) AS BackgroundN, 27 30 SUM(BackgroundW) AS BackgroundW, 28 31 SUM(BackgroundW2) AS BackgroundW2, 32 29 33 SUM(ResidualW) AS ResidualW, 30 34 SUM(ResidualW2) AS ResidualW2, 35 31 36 SUM(SumEnergySimW) AS SumEnergySimW, 32 37 SUM(SumEnergyEstW) AS SumEnergyEstW … … 35 40 GROUP BY 36 41 `.%100:binning:_est` 42 ), 43 Integrated AS 44 ( 45 SELECT -- Return Result 46 *, 47 48 SignalN - BackgroundN/5 AS ExcessN, 49 50 SQRT(SignalN + BackgroundN/25) AS ErrExcessN, 51 SQRT(SignalN) AS ErrSignalN, 52 SQRT(BackgroundN) AS ErrBackgroundN, 53 54 SignalW /Width/AreaTime AS SignalFluxW, 55 BackgroundW/5 /Width/AreaTime AS BackgroundFluxW, 56 (SignalW - BackgroundW/5) /Width/AreaTime AS ExcessFluxW, 57 SQRT(SignalW2) /Width/AreaTime AS ErrSignalFluxW, 58 SQRT(BackgroundW2)/5 /Width/AreaTime AS ErrBackgroundFluxW, 59 SQRT(SignalW2 + BackgroundW2/25) /Width/AreaTime AS ErrExcessFluxW, 60 61 SumEnergyEstW/SignalW AS AvgEnergyEstW, 62 SumEnergySimW/SignalW AS AvgEnergySimW, 63 64 IF(SignalW>0, ResidualW/SignalW, NULL) AS BiasW, 65 IF(SignalW>0, ResidualW/SignalW*SQRT(ResidualW2/POW(ResidualW,2) + SignalW2/POW(SignalW,2)), NULL) AS ErrBiasW, 66 IF(SignalW>0, SQRT(ResidualW2/SignalW - POW(ResidualW/SignalW, 2)), NULL) AS ResolutionW, 67 68 (SUM(SignalW) OVER Integral) AS IntegralSignalW, 69 (SUM(SignalW) OVER Integral) / AreaTime AS IntegralSignalFluxW, 70 (SUM(BackgroundW) OVER Integral) / AreaTime AS IntegralBackgroundFluxW, 71 (SUM(SignalW2) OVER Integral) / POW(AreaTime, 2) AS IntegralSignalFluxW2, 72 (SUM(BackgroundW2) OVER Integral) / POW(AreaTime, 2) AS IntegralBackgroundFluxW2, 73 74 (SUM(SumEnergySimW) OVER Integral) AS IntegralEnergySimW, 75 (SUM(SumEnergyEstW) OVER Integral) AS IntegralEnergyEstW 76 FROM 77 Analyzed 78 INNER JOIN 79 Binning ON `.%100:binning:_est`=bin 80 WINDOW 81 Integral AS (ORDER BY `.%100:binning:_est` DESC) 37 82 ) 38 SELECT -- Return Result83 SELECT 39 84 *, 40 SignalN - BackgroundN/5 AS ExcessN, 41 SQRT(SignalN + BackgroundN/25) AS ErrExcessN, 42 SQRT(SignalN) AS ErrSignalN, 43 SQRT(BackgroundN) AS ErrBackgroundN, 44 Scale*SignalW AS SignalFluxW, 45 Scale*BackgroundW/5 AS BackgroundFluxW, 46 Scale*(SignalW - BackgroundW/5) AS ExcessFluxW, 47 Scale*SQRT(SignalW2) AS ErrSignalFluxW, 48 Scale*SQRT(BackgroundW2)/5 AS ErrBackgroundFluxW, 49 Scale*SQRT(SignalW2 + BackgroundW2/25) AS ErrExcessFluxW, 50 SumEnergyEstW/SignalW AS AvgEnergyEstW, 51 SumEnergySimW/SignalW AS AvgEnergySimW, 52 IF(SignalW>0, ResidualW/SignalW, NULL) AS BiasW, 53 IF(SignalW>0, ResidualW/SignalW*SQRT(ResidualW2/POW(ResidualW,2) + SignalW2/POW(SignalW,2)), NULL) AS ErrBiasW, 54 IF(SignalW>0, SQRT(ResidualW2/SignalW - POW(ResidualW/SignalW, 2)), NULL) AS ResolutionW 85 86 IntegralSignalFluxW-IntegralBackgroundFluxW/5 AS IntegralExcessFluxW, 87 SQRT(IntegralSignalFluxW2+IntegralBackgroundFluxW2/25) AS ErrIntegralExcessFluxW, 88 SQRT(IntegralSignalFluxW2) AS ErrIntegralSignalFluxW, 89 SQRT(IntegralBackgroundFluxW2) AS ErrIntegralBackgroundFluxW, 90 91 IntegralEnergyEstW/IntegralSignalW AS AvgIntegralEnergyEstW, 92 IntegralEnergySimW/IntegralSignalW AS AvgIntegralEnergySimW 93 55 94 FROM 56 Analyzed 57 INNER JOIN 58 Binning ON `.%100:binning:_est`=bin 95 Integrated -
trunk/FACT++/spectrum/summary-sim.sql
r19893 r19897 11 11 SELECT 12 12 *, 13 (%103:binwidth)/Area/ObsTime AS Scale 13 (%103:binwidth) AS Width, 14 Area*ObsTime AS AreaTime 14 15 FROM 15 16 %101:binning … … 45 46 SELECT 46 47 %102:bin, 48 47 49 SUM(SignalN) AS SignalN, 48 50 SUM(SignalW) AS SignalW, 49 51 SUM(SignalW2) AS SignalW2, 52 50 53 SUM(BackgroundN) AS BackgroundN, 51 54 SUM(BackgroundW) AS BackgroundW, 52 55 SUM(BackgroundW2) AS BackgroundW2, 56 53 57 SUM(ResidualW) AS ResidualW, 54 58 SUM(ResidualW2) AS ResidualW2, 59 55 60 SUM(SumEnergySimW) AS SumEnergyEstW, 56 61 SUM(SumEnergyEstW) AS SumEnergySimW … … 66 71 TrigCountN/SimCountN AS TriggerEfficiencyN, 67 72 TrigSumW/SimSumW AS TriggerEfficiencyW, 73 68 74 SignalW - BackgroundW/5 AS ExcessW, 69 75 SignalW2 + BackgroundW2/25 AS ExcessW2 … … 81 87 SELECT -- Everything scaled is "Flux", Everything unscaled is without "Flux", Corsika Data is Sim*, Triggered Data is Trig* and data after cuts is without prefix 82 88 *, 83 SQRT(SimCountN) AS ErrSimCountN, 84 SQRT(TrigCountN) AS ErrTrigCountN, 85 SQRT(SignalN) AS ErrSignalN, 86 Scale*SimSumW AS SimFluxW, 87 Scale*TrigSumW AS TrigFluxW, 88 Scale*SignalW AS SignalFluxW, 89 Scale*BackgroundW/5 AS BackgroundFluxW, 90 Scale*ExcessW AS ExcessFluxW, 91 Scale*SQRT(SimSumW2) AS ErrSimFluxW, 92 Scale*SQRT(TrigSumW2) AS ErrTrigFluxW, 93 Scale*SQRT(SignalW2) AS ErrSignalFluxW, 94 Scale*SQRT(BackgroundW2)/5 AS ErrBackgroundFluxW, 95 Scale*SQRT(ExcessW2) AS ErrExcessFluxW, 96 SumEnergyEstW/SignalW AS AvgEnergyEstW, 97 SumEnergySimW/SignalW AS AvgEnergySimW, 98 Area*TriggerEfficiencyN AS EffectiveAreaN, 99 Area*TriggerEfficiencyW AS EffectiveAreaW, 100 SignalN/TrigCountN AS CutEfficiencyN, 101 IF(ExcessW<0, 0, ExcessW/TrigSumW) AS CutEfficiencyW, 89 90 SQRT(SimCountN) AS ErrSimCountN, 91 SQRT(TrigCountN) AS ErrTrigCountN, 92 SQRT(SignalN) AS ErrSignalN, 93 94 SimSumW /Width/AreaTime AS SimFluxW, 95 TrigSumW /Width/AreaTime AS TrigFluxW, 96 SignalW /Width/AreaTime AS SignalFluxW, 97 BackgroundW/5 /Width/AreaTime AS BackgroundFluxW, 98 ExcessW /Width/AreaTime AS ExcessFluxW, 99 SQRT(SimSumW2) /Width/AreaTime AS ErrSimFluxW, 100 SQRT(TrigSumW2) /Width/AreaTime AS ErrTrigFluxW, 101 SQRT(SignalW2) /Width/AreaTime AS ErrSignalFluxW, 102 SQRT(BackgroundW2)/5 /Width/AreaTime AS ErrBackgroundFluxW, 103 SQRT(ExcessW2) /Width/AreaTime AS ErrExcessFluxW, 104 105 SumEnergyEstW/SignalW AS AvgEnergyEstW, 106 SumEnergySimW/SignalW AS AvgEnergySimW, 107 108 Area*TriggerEfficiencyN AS EffectiveAreaN, 109 Area*TriggerEfficiencyW AS EffectiveAreaW, 110 111 SignalN/TrigCountN AS CutEfficiencyN, 112 IF(ExcessW<0, 0, ExcessW/TrigSumW) AS CutEfficiencyW, 113 102 114 TriggerEfficiencyN * SQRT(1/TrigCountN + 1/SimCountN) AS ErrTriggerEfficiencyN, 103 115 TriggerEfficiencyW * SQRT(TrigSumW2/POW(TrigSumW,2) + SimSumW2/POW(SimSumW,2)) AS ErrTriggerEfficiencyW, 116 104 117 IF(SignalW>0, ResidualW/SignalW, NULL) AS BiasW, 105 118 IF(SignalW>0, ResidualW/SignalW*SQRT(ResidualW2/POW(ResidualW,2) + SignalW2/POW(SignalW,2)), NULL) AS ErrBiasW, 106 IF(SignalW>0, SQRT(ResidualW2/SignalW - POW(ResidualW/SignalW, 2)), NULL) AS ResolutionW 119 IF(SignalW>0, SQRT(ResidualW2/SignalW - POW(ResidualW/SignalW, 2)), NULL) AS ResolutionW, 120 121 (SUM(SignalW) OVER Integral) AS IntegralSignalW, 122 (SUM(SignalW) OVER Integral) / AreaTime AS IntegralSignalFluxW, 123 (SUM(BackgroundW) OVER Integral) / AreaTime AS IntegralBackgroundFluxW, 124 (SUM(SignalW2) OVER Integral) / POW(AreaTime, 2) AS IntegralSignalFluxW2, 125 (SUM(BackgroundW2) OVER Integral) / POW(AreaTime, 2) AS IntegralBackgroundFluxW2, 126 127 (SUM(SimSumW) OVER Integral) / AreaTime AS IntegralSimFluxW, 128 (SUM(SimSumW2) OVER Integral) / POW(AreaTime, 2) AS IntegralSimFluxW2, 129 130 (SUM(SumEnergySimW) OVER Integral) AS IntegralEnergySimW, 131 (SUM(SumEnergyEstW) OVER Integral) AS IntegralEnergyEstW 107 132 FROM 108 133 CombinedData 134 WINDOW 135 Integral AS (ORDER BY %102:bin DESC) 109 136 ) 110 137 SELECT -- Return derived values and result 111 138 *, 139 112 140 Area*ErrTriggerEfficiencyN AS ErrEffectiveAreaN, 113 141 Area*ErrTriggerEfficiencyW AS ErrEffectiveAreaW, 142 114 143 CutEfficiencyN*SQRT(1/SignalN + 1/TrigCountN) AS ErrCutEfficiencyN, 115 CutEfficiencyW*SQRT(ExcessW2/POW(ExcessW,2) + TrigSumW2/POW(TrigSumW,2)) AS ErrCutEfficiencyW 144 CutEfficiencyW*SQRT(ExcessW2/POW(ExcessW,2) + TrigSumW2/POW(TrigSumW,2)) AS ErrCutEfficiencyW, 145 146 IntegralSignalFluxW - IntegralBackgroundFluxW/5 AS IntegralExcessFluxW, 147 SQRT(IntegralSignalFluxW2+IntegralBackgroundFluxW2/25) AS ErrIntegralExcessFluxW, 148 SQRT(IntegralSignalFluxW2) AS ErrIntegralSignalFluxW, 149 SQRT(IntegralBackgroundFluxW2) AS ErrIntegralBackgroundFluxW, 150 SQRT(IntegralSimFluxW2) AS ErrIntegralSimFluxW, 151 152 IntegralEnergyEstW/IntegralSignalW AS AvgIntegralEnergyEstW, 153 IntegralEnergySimW/IntegralSignalW AS AvgIntegralEnergySimW 154 116 155 FROM 117 156 Table0
Note:
See TracChangeset
for help on using the changeset viewer.