1 | /*############################################################################
|
---|
2 | #
|
---|
3 | # Input:
|
---|
4 | # - A 3D hist of Alpha vs Energy vs Theta
|
---|
5 | # - A 2D hist of DiffTime vs Time
|
---|
6 | # - A 2D with Effective Collection Area
|
---|
7 | #
|
---|
8 | # Then calculate:
|
---|
9 | # - Effecive on Time
|
---|
10 | # - Nex for the Alpha plot foreach bin (energy,theta)
|
---|
11 | #
|
---|
12 | #
|
---|
13 | # Fixed a bug: the loop for extracing the signal started in bin=0 instead in
|
---|
14 | # bin 1.
|
---|
15 | #
|
---|
16 | # Fixed a bug: the above change introduced a extremely important bug, since
|
---|
17 | # the loop started from 1 but we have in the arrays:
|
---|
18 | # signal[i] = fNex;
|
---|
19 | # errorsignal[i] = fdNex;
|
---|
20 | # so the signal[0] was actually the signal for the last bin. For that we
|
---|
21 | # had a very low point in the first bin and all the spectrum was displaced.
|
---|
22 | # Now it is fixed with:
|
---|
23 | # signal[i-1] = fNex;
|
---|
24 | # errorsignal[i-1] = fdNex;
|
---|
25 | #
|
---|
26 | # authors: Marcos Lopez
|
---|
27 | # Rober Wagner
|
---|
28 | # email: marcos@gae.ucm.es
|
---|
29 | # date: 31-11-2004
|
---|
30 | # last revision: 31-11-2004
|
---|
31 | ###########################################################################*/
|
---|
32 |
|
---|
33 | void Flux6()
|
---|
34 | {
|
---|
35 |
|
---|
36 | //TString datafile = "flux/Alpha10_H3.New.Resized.root";
|
---|
37 | //TString datafile = "flux/Alpha10_HadCut_Variable.Resized.root";
|
---|
38 | TString datafile = "flux/Alpha10_HadCut_Variable.SizeAbove250.Resized.root";
|
---|
39 | //TString datafile = "flux/Alpha_E_50_2000_10bins_HadCut_Variable.SizeAbove250.Resized.root";
|
---|
40 |
|
---|
41 |
|
---|
42 | //TString areafile = "flux/area_HadCut_03_and_AlphaCut_20.Resized.root";
|
---|
43 | //TString areafile = "../mcdata/collarea.root";
|
---|
44 | //TString areafile = "area_HadCut03_and_AlphaCut20.root";
|
---|
45 | //TString areafile = "area_HacCut_Variable_and_AlphaCut_20.Resized.root";
|
---|
46 | //TString areafile = "area_HacCut_Variable.Resized.root";
|
---|
47 | TString areafile = "flux/area_HadCut_Variable.SizeAbove250.Resized.root";
|
---|
48 |
|
---|
49 | // ------------------------------------------------------------------------
|
---|
50 | //
|
---|
51 | // Load histograms from file
|
---|
52 | //
|
---|
53 | TFile* file = new TFile(datafile);
|
---|
54 |
|
---|
55 | //
|
---|
56 | // Read Hist of Alpha Vs. Energy and Theta
|
---|
57 | //
|
---|
58 | MHAlphaEnergyTheta hAlpha;
|
---|
59 | hAlpha.Read("MHAlphaEnergyTheta");
|
---|
60 | hAlpha.DrawClone();
|
---|
61 |
|
---|
62 | //
|
---|
63 | // Read Hist of EffectiveTime vs. Theta and Time
|
---|
64 | //
|
---|
65 | MHEffectiveOnTime hEffTime;
|
---|
66 | hEffTime.Read("MHEffectiveOnTime");
|
---|
67 | hEffTime.DrawClone();
|
---|
68 |
|
---|
69 | //
|
---|
70 | // Read CollectionArea
|
---|
71 | //
|
---|
72 | TFile* file3 = new TFile(areafile);
|
---|
73 | MHMcCollectionArea area;
|
---|
74 | area.Read("MHMcCollectionArea");
|
---|
75 | area.DrawClone();
|
---|
76 |
|
---|
77 |
|
---|
78 | // -----------------------------------------------------------------------
|
---|
79 | //
|
---|
80 | // Calculate # Excess events vs. Energy and Theta
|
---|
81 | //
|
---|
82 | MHExcessEnergyTheta *hex = new MHExcessEnergyTheta;
|
---|
83 | hex->Calc(&hAlpha);
|
---|
84 | hex->Draw();
|
---|
85 |
|
---|
86 | //
|
---|
87 | // Calculate diferential Flux vs. Enregy and Theta
|
---|
88 | //
|
---|
89 | MHFlux* hFlux = new MHFlux;
|
---|
90 | hFlux->Calc(hex, &area, &hEffTime);
|
---|
91 | hFlux->Draw();
|
---|
92 |
|
---|
93 |
|
---|
94 |
|
---|
95 |
|
---|
96 | //
|
---|
97 | // Write flux into root file
|
---|
98 | //
|
---|
99 | TFile outfile("flux/Flux.root","RECREATE");
|
---|
100 | hFlux->Write();
|
---|
101 | outfile.Close();
|
---|
102 |
|
---|
103 | }
|
---|
104 |
|
---|