source: fact/tools/pyscripts/simulation/old_and_tests/check_corsi.py

Last change on this file was 14805, checked in by neise, 12 years ago
initial commit
  • Property svn:executable set to *
File size: 1.6 KB
Line 
1#!/usr/bin/python -itt
2
3import sys
4import numpy as np
5
6import rlcompleter
7import readline
8readline.parse_and_bind('tab: complete')
9
10from ROOT import *
11
12import readcorsika
13from reflector import *
14
15
16
17run = readcorsika.read_corsika_file(sys.argv[1])
18
19h1 = TH2F("h_phi_theta","phi versus theta",180,0,180,360,-180,180)
20huv = TH2F("huv"," u versus v",100,-1 ,1 ,100,-1,1)
21huvm = TH2F("huvmean"," u-u_mean versus v-v_mean ",100,-0.3 ,0.3 ,100,-0.3,0.3)
22
23
24event_counter = 0
25for 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
46c1 = TCanvas("c1","title",0,0,500,500)
47h1.Draw("colz")
48c1.Update()
49
50c2 = TCanvas("c2","title",500,0,500,500)
51huv.Draw("colz")
52c2.Update()
53
54print "u mean:",huv.GetMean(1)
55print "v mean",huv.GetMean(2)
56umean = huv.GetMean(1)
57vmean = huv.GetMean(2)
58
59for 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
68c3 = TCanvas("c3","title",0,500,500,500)
69huvm.Draw("colz")
70c3.Update()
71
Note: See TracBrowser for help on using the repository browser.