source: trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx@ 405

Last change on this file since 405 was 405, checked in by harald, 24 years ago
Able to read in all photons of one event. So this may be the start point for a clever gui to display some properties of the shower.
File size: 2.4 KB
Line 
1//
2//
3//
4//
5//
6//
7#include <stdlib.h>
8#include "TROOT.h"
9
10#include "TFile.h"
11#include "TNtuple.h"
12
13#include "COREventHeader.hxx"
14#include "CORParticle.hxx"
15#include "CORStatfile.hxx"
16
17#include "MSimone.hxx"
18
19main()
20 {
21 // initialise ROOT
22
23 TROOT simple("simple", "SIMONE - statistic of MonteCarlo");
24
25 // char path[100] = "/hd61/Maggi/Data/mcMAGIC-1-30:30000-1" ;
26 char path[100] = "/hd02/Maggi/Data/prot_15/" ;
27 // char path[100] = "/data/mmcs/" ;
28 char cername[120] ;
29 char datname[120] ;
30
31 ifstream cerfile ;
32
33 COREventHeader Event ;
34 CORParticle Photon ;
35
36 MSimone Infos ;
37
38 Int_t iPhotonInShower ;
39
40 Float_t lambda ;
41 //
42 // now create a root-file for the ntuple output
43 //
44
45 TFile *outfile = new TFile("simone.root","RECREATE");
46
47 TNtuple *Ntup = new TNtuple("simone",
48 "Simone info of mmcs",
49 "fPartId:fEnergy:fTheta:fPhi");
50
51
52 for (int i_cer = 1; i_cer <= 100; i_cer++ ) {
53
54 //
55 // info of progress
56 //
57 if (!( i_cer %10) )
58 {
59 cout << i_cer << endl ;
60 }
61
62 //
63 // create the file names
64 //
65 sprintf ( cername, "%s/cer%06d", path, i_cer ) ;
66 sprintf ( datname, "%s/dat%06d", path, i_cer ) ;
67
68 // cout << cername << endl ;
69 // cout << datname << endl ;
70
71 //
72 // try to open the files
73 //
74
75 cerfile.open( cername );
76
77 if ( cerfile.bad() ) {
78 cout << "Cannot open input file: " << cername << endl ;
79 continue ;
80 }
81
82 //
83 // cout << " Read event " << endl ;
84 //
85
86 Event.read( cerfile );
87 Infos.Transfer ( &Event ) ;
88
89 //
90 // fill the ntuple
91 //
92 Infos.NtupFill ( Ntup ) ;
93
94 //
95 // loop over the particles (cerenkov photons) in
96 // the file
97 //
98
99 iPhotonInShower = 0 ;
100
101 while( ! (cerfile.eof() || cerfile.bad() )) {
102
103 //
104 // read in the particles
105 //
106
107 Photon.read ( cerfile ) ;
108
109 //
110 // only if the wavelength lambda is greater than
111 // 1.0 it is a real cerenkov photon
112 //
113 lambda = Photon.get_wl() ;
114
115 if ( lambda < 1.0 )
116 break ;
117
118 iPhotonInShower++ ;
119
120 Photon.print() ;
121
122 }
123
124 cout << iPhotonInShower << endl ;
125
126
127
128 cerfile.close();
129
130
131
132 }
133
134
135 //
136 // write all to file
137 //
138 outfile->Write() ;
139
140
141 //
142 //
143 //
144
145 }
146
147
Note: See TracBrowser for help on using the repository browser.