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

Last change on this file since 622 was 418, checked in by harald, 24 years ago
Changed in a way that SIMONE is able to read CER files and print the content of the shower on screen.
File size: 2.2 KB
Line 
1//
2//
3//
4//
5//
6//
7#include <stdlib.h>
8
9#include "COREventHeader.hxx"
10#include "CORParticle.hxx"
11#include "CORStatfile.hxx"
12
13int main(int argc, char **argv)
14{
15 char path[100] = "" ;
16
17 char cername[120] ;
18 char datname[120] ;
19
20 ifstream cerfile ;
21
22 COREventHeader Event ;
23 CORParticle Photon ;
24
25 Int_t iPhotonInShower ;
26
27 Float_t lambda ;
28
29 cout << " ============================" << endl ;
30 cout << " SIMONE" << endl ;
31 cout << " " << endl ;
32 cout << " SImulated MONte carlo Events" << endl ;
33 cout << " " << endl ;
34
35
36 if ( argc <= 1 ) {
37 cout << endl ;
38 cout << " INFO: You have to start the program with "<<endl <<endl ;
39 cout << " -> simone DIRECTORY_WITH_CER_FILES" <<endl <<endl ;
40 cout << " no SLASH at the end of the directory name"<<endl ;
41 cout << " (example: -> simone /hd123/Protons "<<endl ;
42 exit (-1) ;
43 }
44
45 sprintf (path , "%s", argv[1] ) ;
46
47 for (int i_cer = 1; i_cer <= 100; i_cer++ ) {
48 //
49 // create the file names
50 //
51 sprintf ( cername, "%s/cer%06d", path, i_cer ) ;
52 sprintf ( datname, "%s/dat%06d", path, i_cer ) ;
53
54 // cout << cername << endl ;
55 // cout << datname << endl ;
56
57 //
58 // try to open the files
59 //
60
61 cerfile.open( cername );
62
63 if ( cerfile.bad() ) {
64 cout << "Cannot open input file: " << cername << endl ;
65 continue ;
66 }
67
68 //
69 // cout << " Read event " << endl ;
70 //
71
72 Event.read( cerfile );
73
74 Event.Print() ;
75
76 //
77 // loop over the particles (cerenkov photons) in
78 // the file
79 //
80
81 iPhotonInShower = 0 ;
82
83 while( ! (cerfile.eof() || cerfile.bad() )) {
84
85 //
86 // read in the particles
87 //
88
89 Photon.read ( cerfile ) ;
90
91 //
92 // only if the wavelength lambda is greater than
93 // 1.0 it is a real cerenkov photon
94 //
95 lambda = Photon.get_wl() ;
96
97 if ( lambda < 1.0 )
98 break ;
99
100 iPhotonInShower++ ;
101
102 Photon.print() ;
103 }
104
105 //
106 // close the file
107 //
108
109 cerfile.close();
110
111
112
113 }
114
115}
116
117
Note: See TracBrowser for help on using the repository browser.