Changeset 415 for trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx
- Timestamp:
- 07/06/00 11:24:00 (24 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Simulation/Corsika/Simone/simone.cxx
r405 r415 7 7 #include <stdlib.h> 8 8 #include "TROOT.h" 9 #include "TApplication.h" 10 11 #include "TCanvas.h" 12 #include "TView.h" 13 14 #include "TSPHE.h" 15 #include "TBRIK.h" 16 17 #include "TNode.h" 9 18 10 19 #include "TFile.h" … … 17 26 #include "MSimone.hxx" 18 27 19 main() 20 21 28 int main(int argc, char **argv) 29 { 30 // initialise ROOT 22 31 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] ; 32 TROOT simple("simple", "SIMONE - statistic of MonteCarlo"); 30 33 31 ifstream cerfile ; 34 TApplication theApp("App", &argc, argv); 35 36 char path[100] = "/dat1/Mmcs/Gamm/" ; 37 // char path[100] = "/hd02/Maggi/Data/prot_15/" ; 38 // char path[100] = "/data/mmcs/" ; 39 char cername[120] ; 40 char datname[120] ; 41 42 ifstream cerfile ; 43 44 COREventHeader Event ; 45 CORParticle Photon ; 46 47 MSimone Infos ; 48 49 Int_t iPhotonInShower ; 50 51 Float_t lambda ; 52 53 cout << " SImulated MONte carlo Events" << endl ; 32 54 33 COREventHeader Event ; 34 CORParticle Photon ; 55 // 56 // now create a root-file for the ntuple output 57 // 58 59 TFile *outfile = new TFile("simone.root","RECREATE"); 60 61 TNtuple *Ntup = new TNtuple("simone", 62 "Simone info of mmcs", 63 "fPartId:fEnergy:fTheta:fPhi:fCoreX:fCoreY:fCoreD:fNumCerPhot"); 64 65 66 for (int i_cer = 1; i_cer <= 100; i_cer++ ) { 67 // 68 // info of progress 69 // 70 if (!( i_cer %10) ) 71 { 72 cout << i_cer << endl ; 73 } 35 74 36 MSimone Infos ; 75 // 76 // create the file names 77 // 78 sprintf ( cername, "%s/cer%06d", path, i_cer ) ; 79 sprintf ( datname, "%s/dat%06d", path, i_cer ) ; 37 80 38 Int_t iPhotonInShower ; 81 // cout << cername << endl ; 82 // cout << datname << endl ; 83 84 // 85 // try to open the files 86 // 87 88 cerfile.open( cername ); 89 90 if ( cerfile.bad() ) { 91 cout << "Cannot open input file: " << cername << endl ; 92 continue ; 93 } 94 95 // 96 // cout << " Read event " << endl ; 97 // 98 99 Event.read( cerfile ); 100 Infos.Transfer ( &Event ) ; 101 102 // 103 // loop over the particles (cerenkov photons) in 104 // the file 105 // 106 107 iPhotonInShower = 0 ; 108 109 while( ! (cerfile.eof() || cerfile.bad() )) { 110 111 // 112 // read in the particles 113 // 114 115 Photon.read ( cerfile ) ; 116 117 // 118 // only if the wavelength lambda is greater than 119 // 1.0 it is a real cerenkov photon 120 // 121 lambda = Photon.get_wl() ; 122 123 if ( lambda < 1.0 ) 124 break ; 125 126 iPhotonInShower++ ; 127 128 //Photon.print() ; 129 } 130 131 Infos.SetNumCerPhot( iPhotonInShower ) ; 132 133 // 134 // fill the ntuple 135 // 136 137 Infos.NtupFill ( Ntup ) ; 138 139 140 cerfile.close(); 141 142 143 144 } 145 146 147 // 148 // write all to file 149 // 150 outfile->Write() ; 39 151 40 Float_t lambda ;41 42 // now create a root-file for the ntuple output43 //152 153 // 154 // 155 // 44 156 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"); 157 Ntup->Draw("fEnergy") ; 50 158 51 159 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 ; 160 theApp.Run(); 161 return 0; 162 163 164 } 125 165 126 166 127 128 cerfile.close();129 130 131 132 }133 134 135 //136 // write all to file137 //138 outfile->Write() ;139 140 141 //142 //143 //144 145 }146 147
Note:
See TracChangeset
for help on using the changeset viewer.