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

Last change on this file since 721 was 721, checked in by domingo, 24 years ago
small changes to adapt Simone on single file version of Mmcs. Not ready yet.
File size: 2.6 KB
Line 
1//
2//
3//
4//
5//
6//
7#include <stdlib.h>
8#include <stdio.h>
9
10#include "COREventHeader.hxx"
11#include "CORParticle.hxx"
12#include "CORStatfile.hxx"
13
14int main(int argc, char **argv)
15{
16 char path[100] = "" ;
17
18 char cername[120] ;
19 char datname[120] ;
20
21 ifstream cerfile ;
22
23 COREventHeader Event ;
24 CORParticle Photon ;
25
26 Int_t iPhotonInShower ;
27
28 Float_t lambda ;
29
30 cout << " ============================" << endl ;
31 cout << " SIMONE" << endl ;
32 cout << " " << endl ;
33 cout << " SImulated MONte carlo Events" << endl ;
34 cout << " " << endl ;
35
36
37 if ( argc <= 1 ) {
38 cout << endl ;
39 cout << " INFO: You have to start the program with "<<endl <<endl ;
40 cout << " -> simone DIRECTORY_WITH_CER_FILES" <<endl <<endl ;
41 cout << " no SLASH at the end of the directory name"<<endl ;
42 cout << " (example: -> simone /hd123/Protons "<<endl ;
43 exit (-1) ;
44 }
45
46 // copy the argument to filename
47
48 sprintf (cername , "%s", argv[1] ) ;
49
50
51 cout << cername << endl ;
52
53 //
54 // try to open the files
55 //
56
57 cerfile.open( cername );
58
59 if ( cerfile.bad() ) {
60 cout << "Cannot open input file: " << cername << endl ;
61 exit (1) ;
62 }
63
64 //
65 // cout << " Read event " << endl ;
66 //
67
68 // tricky stuff. We read in the RunHeader which has by chance the
69 // same sice than the EventHeader
70 Event.read( cerfile );
71
72 // now we read in the event
73
74 Event.read( cerfile );
75
76 Event.Print() ;
77
78 //
79 // loop over the particles (cerenkov photons) in
80 // the file
81 //
82
83 iPhotonInShower = 0 ;
84
85 while( ! (cerfile.eof() || cerfile.bad() )) {
86
87 cout << " testit " ;
88 //
89 // read in the particles
90 //
91
92 Photon.read ( cerfile ) ;
93
94 //
95 // only if the wavelength lambda is greater than
96 // 1.0 it is a real cerenkov photon
97 //
98 lambda = Photon.get_wl() ;
99
100 Photon.print() ;
101
102 if ( lambda < 1.0 ) {
103 // here we got to the next event reading in all the ZERO
104 // from the file
105 while ( lambda < 1.) {
106 Photon.read ( cerfile ) ;
107 lambda = Photon.get_wl() ;
108 }
109
110 // sprintf (" size of Photon: %d \n", (int) sizeof( CORParticle )) ;
111 fseek ( cerfile, -sizeof(CORParticle), SEEK_CUR(1) );
112
113 cout << sizeof ( CORParticle ) ;
114 cout << sizeof ( int ) ;
115
116 break ;
117
118
119
120
121 }
122
123
124 iPhotonInShower++ ;
125
126 }
127
128 //
129 // close the file
130 //
131
132 cerfile.close();
133
134
135
136}
137
138
Note: See TracBrowser for help on using the repository browser.