test_energyResolution.C

Deil Christoph, 10/10/2012 11:46 AM

Download (3.68 KB)

 
1
#include <iostream>
2
#include <TH1.h>
3
#include <TCanvas.h>
4
#include <TLine.h>
5
#include <sash/HESSArray.hh>
6
#include <muon/ArrayMuonParameters.hh>
7
#include <flux/EnergyResolutionLookupIR.hh>
8
#include <flux/EnergyResolution2LookupIR.hh>
9

    
10
int test_energyResolution() {
11

    
12
  // standard test for fixed optical configuration
13

    
14
  Flux::EnergyResolutionLookupIR lookup( "std" );
15
  Flux::EnergyResolution2LookupIR lookup2( "std" );
16

    
17
  int muonEntry        = 100;
18
  int telescopePattern = 30;
19
  double azimuth       = 197.467;
20
  double zenith        = 29.9336;
21
  double offset        = 0.450788;
22
  double energy        = 0.404803;
23
  double relativeError = 0.1;
24
  double reco_energy   = (relativeError + 1) * energy;
25

    
26
  double pdf, pdf_err;
27
  bool success = lookup.InterpolatePdf(energy,relativeError,zenith,offset,muonEntry,
28
                                       telescopePattern,azimuth,pdf,pdf_err);
29
  std::cout << "pdf: " << pdf << " +- " << pdf_err << " success: " << success << std::endl;
30

    
31
  double pdf2, pdf_err2;
32
  bool success2 = lookup2.InterpolatePdf(energy,reco_energy,zenith,offset,muonEntry,
33
                                         telescopePattern,azimuth,pdf2,pdf_err2);
34
  std::cout << "pdf2: " << pdf2 << " +- " << pdf_err2 << " success2: " << success2 << std::endl;
35

    
36
  return 0;
37
}
38

    
39
int test_energyResolution_opticalConfiguration(){
40

    
41
  // test interpolation based on optical efficiencies
42

    
43
  Flux::EnergyResolutionLookupIR lookup( "std" );
44
  Flux::EnergyResolution2LookupIR lookup2( "std" );
45

    
46
  int telescopePattern = 30;
47
  double azimuth       = 0.0;
48
  double zenith        = 13.0;
49
  double offset        = 0.4;
50
  double energy        = 1.4;
51
  double relativeError = 0.1;
52
  double reco_energy   = (relativeError + 1) * energy;
53

    
54
  Muon::ArrayMuonParameters ap(Sash::HESSArray::GetHESSArray());
55
  ap.GetMcCorrectionFactorForSecondMuonEntry()  = 1.4;
56
  ap.GetDataCorrectionFactorForFirstMuonEntry() = 1.1;
57
  ap.GetFirstMuonEntry()   = 101;
58
  ap.GetSecondMuonEntry()  = 102;
59
  ap.GetTelescopePattern() = telescopePattern;
60

    
61
  double pdf, pdf_err;
62
  bool success = lookup.InterpolatePdf(&ap,energy,relativeError,zenith,offset,azimuth,pdf,pdf_err);
63
  std::cout << "pdf: " << pdf << " +- " << pdf_err << " success: " << success << std::endl;
64

    
65
  double pdf2, pdf_err2;
66
  bool success2 = lookup2.InterpolatePdf(&ap,energy,reco_energy,zenith,offset,azimuth,pdf2,pdf_err2);
67
  std::cout << "pdf2: " << pdf2 << " +- " << pdf_err2 << " success2: " << success2 << std::endl;
68

    
69
  return 0;
70
}
71

    
72

    
73
int plot_slice( double energy = 1.0, double zenith = 25., double offset = 1.3, double azimuth = 223.,
74
                int muonEntry = 100, int telPattern = 30 ) {
75

    
76
  Flux::EnergyResolutionLookupIR lookup( "std" );
77

    
78
  TH1F* pdf = lookup.CalculatePdfHistogram( energy, zenith, offset, muonEntry, telPattern, azimuth );
79
  pdf->Draw();
80

    
81
  return 0;
82
}
83

    
84

    
85
int plot_slice_opticalConfiguration( double energy = 1.0, double zenith = 25., 
86
                                     double offset = 1.3, double azimuth = 223. ) {
87

    
88
  Flux::EnergyResolutionLookupIR lookup( "std" );
89

    
90
  Muon::ArrayMuonParameters ap(Sash::HESSArray::GetHESSArray());
91
  ap.GetMcCorrectionFactorForSecondMuonEntry()  = 1.4;
92
  ap.GetDataCorrectionFactorForFirstMuonEntry() = 1.1;
93
  ap.GetFirstMuonEntry()   = 101;
94
  ap.GetSecondMuonEntry()  = 102;
95
  ap.GetTelescopePattern() = 30;
96

    
97
  TH1F* pdf = lookup.CalculatePdfHistogram(&ap, energy, zenith, offset, azimuth );
98
  pdf->Draw();
99

    
100
  return 0;
101
}
102

    
103
/*
104
int plot_pdf( double zenith = 25., double offset = 1.3, double azimuth = 223.,
105
              int muonEntry = 100, int telPattern = 30 ) {
106

107
  Flux::EnergyResolutionLookupIR lookup( "std" );
108

109
  TH1F* pdf = lookup.CalculatePdfHistogram( energy, zenith, offset, muonEntry, telPattern, azimuth );
110

111
  TCanvas* canvas = new TCanvas("EnergyResolution");
112
  canvas->Divide(2,1);
113
  canvas->cd(1);
114
  pdf->Draw("colz");
115
  canvas->cd(2);
116

117
  return 0;
118
}
119
*/
120