Changeset 19904
- Timestamp:
- 12/15/19 16:23:56 (5 years ago)
- Location:
- trunk/FACT++
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/spectrum/display.C
r19900 r19904 32 32 fx.SetLineColor(kBlack); 33 33 34 TF1 f0("f0", "0", 0, 90); 34 TF1 f0("f0", "[0]", 0, 90); 35 f0.SetParameter(0, 0); 35 36 f0.SetLineStyle(kDashed); 36 37 f0.SetLineColor(kBlack); … … 211 212 212 213 // -------------------------------- 214 f0.SetLineColor(kRed); 215 // -------------------------------- 213 216 214 217 c = new TCanvas("Integral Spectrum", "Integral Spectrum"); 215 c->SetLogy(); 218 c->Divide(2,2); 219 c->cd(4); 220 gPad->SetLogy(); 216 221 file.GetObject("Data/Energy/Differential/IntegratedSpectrum", h1); 217 222 h1->SetLineColor(kGray); 218 223 h1->SetMarkerColor(kGray); 224 if (h1->GetMinimum()<=0) 225 { 226 h1->SetMinimum(h1->GetMinimum(0)*0.1); 227 cout << "WARNING: Integral Spectrum contains negative flux points!\n" << endl; 228 } 219 229 h1->DrawCopy("P"); 220 230 file.GetObject("Data/Energy/Integral/Spectrum", h1); … … 238 248 //h1->DrawCopy("P same"); 239 249 250 c->cd(1); 251 gPad->SetGridx(); 252 file.GetObject("Data/Energy/Integral/SigmaFlux", h1); 253 h1->SetMaximum(5); 254 h1->SetMarkerStyle(kFullDotLarge); 255 h1->DrawCopy("P"); 256 f0.SetParameter(0, 1); 257 f0.DrawCopy("same"); 258 259 c->cd(3); 260 gPad->SetGridx(); 261 file.GetObject("Data/Energy/Integral/BackgroundI", h1); 262 h1->Scale(5); 263 h1->SetMaximum(30); 264 h1->SetLineColor(kRed); 265 h1->DrawCopy("P"); 266 file.GetObject("Data/Energy/Integral/SignalI", h1); 267 h1->DrawCopy("P same"); 268 file.GetObject("Data/Energy/Integral/ExcessI", h1); 269 h1->SetLineColor(kBlue); 270 h1->DrawCopy("P same"); 271 272 f0.SetParameter(0, 10); 273 f0.DrawCopy("same"); 274 240 275 // -------------------------------- 241 276 242 277 c = new TCanvas("Differential Spectrum", "Differential Spectrum"); 243 c->SetLogy(); 278 c->Divide(2,2); 279 c->cd(4); 280 gPad->SetLogy(); 244 281 file.GetObject("Data/Energy/Differential/Spectrum", h1); 282 if (h1->GetMinimum()<=0) 283 { 284 h1->SetMinimum(h1->GetMinimum(0)*0.1); 285 cout << "WARNING: Differential Spectrum contains negative flux points!\n" << endl; 286 } 245 287 h1->DrawCopy("P"); 246 288 … … 261 303 //h1->SetMarkerStyle(22); 262 304 //h1->DrawCopy("P same"); 305 306 c->cd(1); 307 gPad->SetGridx(); 308 file.GetObject("Data/Energy/Differential/SigmaFlux", h1); 309 h1->SetMaximum(5); 310 h1->SetMarkerStyle(kFullDotLarge); 311 h1->DrawCopy("P"); 312 f0.SetParameter(0, 1); 313 f0.DrawCopy("same"); 314 315 c->cd(3); 316 gPad->SetGridx(); 317 file.GetObject("Data/Energy/Differential/Background", h1); 318 h1->Scale(5); 319 h1->SetMaximum(30); 320 h1->SetLineColor(kRed); 321 h1->DrawCopy("P"); 322 file.GetObject("Data/Energy/Differential/Signal", h1); 323 h1->DrawCopy("P same"); 324 file.GetObject("Data/Energy/Differential/Excess", h1); 325 h1->SetLineColor(kBlue); 326 h1->DrawCopy("P same"); 327 328 f0.SetParameter(0, 10); 329 f0.DrawCopy("same"); 263 330 } -
trunk/FACT++/spectrum/spectrum.sql
r19902 r19904 74 74 %106:join2 75 75 ), 76 Flux AS 77 ( 78 SELECT -- Return final result 79 *, 80 81 -- Differetial Spectrum 82 83 SimExcess/SimFluxW AS Efficiency, 84 85 Excess/SimExcess/Width/AreaTime AS ExcessRatio, 86 1/SQRT( 87 + POW(ErrExcess / Excess, 2) 88 + POW(ErrSimExcess / SimExcess, 2) 89 ) AS SigmaExcessRatio, 90 91 92 Excess/SimExcess*SimFluxW/Width/AreaTime AS Flux, 93 1/SQRT( 94 + POW(ErrExcess / Excess, 2) 95 + POW(ErrSimExcess / SimExcess, 2) 96 + POW(ErrSimFluxW / SimFluxW, 2) 97 ) AS SigmaFlux, 98 99 -- Integral Spectrum 100 101 SimExcessI/SimFluxI AS EfficiencyI, 102 103 ExcessI/SimExcessI/AreaTime AS ExcessRatioI, 104 1/SQRT( 105 + POW(ErrExcessI / ExcessI, 2) 106 + POW(ErrSimExcessI / SimExcessI, 2) 107 ) AS SigmaExcessRatioI, 108 109 110 ExcessI/SimExcessI*SimFluxI/AreaTime AS FluxI, 111 1/SQRT( 112 + POW(ErrExcessI / ExcessI, 2) 113 + POW(ErrSimExcessI / SimExcessI, 2) 114 + POW(ErrSimFluxI / SimFluxI, 2) 115 ) AS SigmaFluxI 116 117 FROM 118 CombinedData 119 ), 76 120 Spectrum AS 77 121 ( 78 SELECT -- Return final result79 *,122 SELECT -- Return final result 123 *, 80 124 81 -- Differetial Spectrum 82 83 SimExcess/SimFluxW AS Efficiency, 84 85 Excess/SimExcess/Width/AreaTime AS ExcessRatio, 86 Excess/SimExcess/Width/AreaTime 87 * SQRT( 88 + POW(ErrExcess / Excess, 2) 89 + POW(ErrSimExcess / SimExcess, 2) 90 ) AS ErrExcessRatio, 91 92 93 Excess/SimExcess*SimFluxW/Width/AreaTime AS Flux, 94 Excess/SimExcess*SimFluxW/Width/AreaTime 95 * SQRT( 96 + POW(ErrExcess / Excess, 2) 97 + POW(ErrSimExcess / SimExcess, 2) 98 + POW(ErrSimFluxW / SimFluxW, 2) 99 ) AS ErrFlux, 100 101 -- Integral Spectrum 102 103 SimExcessI/SimFluxI AS EfficiencyI, 104 105 ExcessI/SimExcessI/AreaTime AS ExcessRatioI, 106 ExcessI/SimExcessI/AreaTime 107 * SQRT( 108 + POW(ErrExcessI / ExcessI, 2) 109 + POW(ErrSimExcessI / SimExcessI, 2) 110 ) AS ErrExcessRatioI, 111 112 113 ExcessI/SimExcessI*SimFluxI/AreaTime AS FluxI, 114 ExcessI/SimExcessI*SimFluxI/AreaTime 115 * SQRT( 116 + POW(ErrExcessI / ExcessI, 2) 117 + POW(ErrSimExcessI / SimExcessI, 2) 118 + POW(ErrSimFluxI / SimFluxI, 2) 119 ) AS ErrFluxI 120 121 FROM 122 CombinedData 123 WHERE 124 Excess>0 125 ExcessRatio /SigmaExcessRatio AS ErrExcessRatio, 126 ExcessRatioI/SigmaExcessRatioI AS ErrExcessRatioI, 127 ABS(Flux) /SigmaFlux AS ErrFlux, 128 ABS(FluxI) /SigmaFluxI AS ErrFluxI 129 FROM 130 Flux 125 131 ) 126 132 SELECT -
trunk/FACT++/src/spectrum.cc
r19903 r19904 2060 2060 map<size_t, double> rolke_int; 2061 2061 2062 if (verbose>0) 2063 cout << "Bin Excess Significance Flux ErrFlux" << endl; 2064 2062 2065 for (auto ir=res13.cbegin(); ir!=res13.cend(); ir++) 2063 2066 { … … 2094 2097 if (verbose>0) 2095 2098 { 2096 cout << setw(5) << row["center"] << ": "; 2097 cout << setw(10) << row["Excess"] << " "; 2098 cout << setw(10) << row["Flux"] << " "; 2099 cout << setw(10) << row["ErrFlux"] << " "; 2100 cout << setw(10) << row["Significance"] << '\n'; 2099 cout << setw(5) << row["center"] << ":"; 2100 cout << " " << setw(10) << row["Excess"]; 2101 cout << " " << setw(10) << row["Significance"]; 2102 cout << " " << setw(10) << row["Flux"]; 2103 cout << " " << setw(10) << row["ErrFlux"]; 2104 cout << endl; 2101 2105 } 2102 2106 } … … 2169 2173 WriteHistogram(connection, hist); 2170 2174 2175 hist.name = "SigmaFlux"; 2176 hist.v = "SigmaFlux"; 2177 hist.err = ""; 2178 WriteHistogram(connection, hist); 2179 2171 2180 if (*ib=="Energy") 2172 2181 { … … 2177 2186 hist.v = "FluxI"; 2178 2187 hist.err = "ErrFluxI"; 2188 WriteHistogram(connection, hist); 2189 2190 hist.dir = "Data/Energy/Integral"; 2191 hist.name = "SigmaFlux"; 2192 hist.v = "SigmaFluxI"; 2193 hist.err = ""; 2179 2194 WriteHistogram(connection, hist); 2180 2195
Note:
See TracChangeset
for help on using the changeset viewer.