1 | #!/usr/bin/python -itt
|
---|
2 |
|
---|
3 | import sys
|
---|
4 | import numpy as np
|
---|
5 |
|
---|
6 | import rlcompleter
|
---|
7 | import readline
|
---|
8 | readline.parse_and_bind('tab: complete')
|
---|
9 |
|
---|
10 | from ROOT import *
|
---|
11 |
|
---|
12 | import readcorsika
|
---|
13 | from reflector import *
|
---|
14 |
|
---|
15 |
|
---|
16 |
|
---|
17 | run = readcorsika.read_corsika_file(sys.argv[1])
|
---|
18 |
|
---|
19 | h1 = TH2F("h_phi_theta","phi versus theta",180,0,180,360,-180,180)
|
---|
20 | huv = TH2F("huv"," u versus v",100,-1 ,1 ,100,-1,1)
|
---|
21 | huvm = TH2F("huvmean"," u-u_mean versus v-v_mean ",100,-0.3 ,0.3 ,100,-0.3,0.3)
|
---|
22 |
|
---|
23 |
|
---|
24 | event_counter = 0
|
---|
25 | for event in run.events:
|
---|
26 | #print event_counter
|
---|
27 | event_counter += 1
|
---|
28 | if event.photons is None:
|
---|
29 | continue
|
---|
30 | for photon in event.photons:
|
---|
31 | # photon is a 1D-nd.array with 10 elements
|
---|
32 | # make Photon instance from this horrible array
|
---|
33 | photon[1:3] -= np.array(event.info_dict['core_loc'])
|
---|
34 | huv.Fill(photon[3],photon[4])
|
---|
35 | photon = Photon(photon)
|
---|
36 | d = photon.dir
|
---|
37 |
|
---|
38 | r = length(d)
|
---|
39 | p = np.arctan2(d[1],d[0]) / np.pi * 180.
|
---|
40 | t = np.arccos(d[2]/r) /np.pi * 180.
|
---|
41 |
|
---|
42 | h1.Fill( t, p )
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 | c1 = TCanvas("c1","title",0,0,500,500)
|
---|
47 | h1.Draw("colz")
|
---|
48 | c1.Update()
|
---|
49 |
|
---|
50 | c2 = TCanvas("c2","title",500,0,500,500)
|
---|
51 | huv.Draw("colz")
|
---|
52 | c2.Update()
|
---|
53 |
|
---|
54 | print "u mean:",huv.GetMean(1)
|
---|
55 | print "v mean",huv.GetMean(2)
|
---|
56 | umean = huv.GetMean(1)
|
---|
57 | vmean = huv.GetMean(2)
|
---|
58 |
|
---|
59 | for event in run.events:
|
---|
60 | #print event_counter
|
---|
61 | event_counter += 1
|
---|
62 | if event.photons is None:
|
---|
63 | continue
|
---|
64 | for photon in event.photons:
|
---|
65 |
|
---|
66 | huvm.Fill(photon[3]-umean,photon[4]-vmean)
|
---|
67 |
|
---|
68 | c3 = TCanvas("c3","title",0,500,500,500)
|
---|
69 | huvm.Draw("colz")
|
---|
70 | c3.Update()
|
---|
71 |
|
---|