Thread daten auslesen benötige hilfe (23 answers)
Opened by quant at 2009-02-10 16:37

quant82
 2009-02-11 11:15
#118785 #118785
User since
2007-07-27
13 Artikel
BenutzerIn
[default_avatar]
hallo
danke dass du dich mir annimmst, ich hab versucht mal das umzusetzen was du geschrieben hast... der code läuft auch soweit, solange ich pro event nur nach einem lambda (27) suche, sobald ich nach 2 suchen will versagt mein können.
hier der modofizierte code:
Code (perl): (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/perl
use strict;
use warnings;

my $noe;
while(<>) { 
my @stuff=split(' ');

 if(/UQMD/){
 }
 elsif(/projectile:/){
 my $protar=$_
 }
 elsif(/equation_of_state:/){
  my $ecm=$stuff[5];
  my $midy=log($ecm/0.938);
  my $elab=$stuff[3];
  my $plab=$stuff[7];
 }
 elsif(/event#/){
  $noe++                    # numbers of events: noe
 }      
 else{
  if($#stuff==14){ 

   my @x=@stuff[0..3];   
   my @p=@stuff[4..7];
   my @id=@stuff[8..11];

   my $mass=$id[0];
   my $ityp=$id[1];
   my $iz2=$id[2];
   my $charge=$id[3];

# ab hier steht folgende info zur verfuegung:

# stuff[0] = r_0    = $x[0]
# stuff[1] = r_x    = $x[1]
# stuff[2] = r_y    .
# stuff[3] = r_z    .
# stuff[4] = p_0    = $p[0]
# stuff[5] = p_x    = $p[1]
# stuff[6] = p_y    .
# stuff[7] = p_z    .
# stuff[8] = mass   = $id[0]
# stuff[9] = ityp   = $id[1]
# stuff[10]= iz2    = $id[2]
# stuff[11]= charge = $id[3]
my $noe1;

   if ($ityp==27) {
    $noe1=$noe;
    print("lambda \n");
    print("Event", $noe1, "\n");
   
#   if ($itype==27 && $noe1==$noe){ #hier wuerde ich gern suchen ob 27 nochmal vorkommt in diesem event
#     print("match");

#   }
   }
} 
 }
  }
 


die daten files die ich checke sehen immer gleich aus, oben ist eine art kopf wo event nummer etc. drinne stehen und dann folgt eine tabelle mit werten... in dieser tabelle will ich dann erst mal pro event suchen ob die zahl 27 zwei mal vorkommt

hier der input:
Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
UQMD   version:       20030   1000  20030  output_file  14
projectile: (ityp, char) 49 -1 target: (mass, char) 197 79
transformation betas (NN,lab,pro) 0.0000000 0.1110044 -0.0794210
impact_parameter_real/min/max(fm): 0.00 0.00 0.00 total_cross_section(mbarn): 0.00
equation_of_state: 0 E_lab(GeV/u): 0.2407E-01 sqrt(s)(GeV): 0.2263E+01 p_lab(GeV/u): 0.2528E+00
event# 1 random seed: 1234262625 (fixed) total_time(fm/c): 200 Delta(t)_O(fm/c): 200.000
op 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
op 0 0 0 0 0 0 1 0 1 0 0 0 0 2 1
op 0 0 0 1 1 0 0 0 0 0 0 0 0 1 0
pa 0.1000E+01 0.5200E+00 0.2000E+01 0.3000E+00 0.0000E+00 0.3700E+00 0.0000E+00 0.9300E-01 0.3500E+00 0.2500E+00 0.0000E+00 0.5000E+00
pa 0.2700E+00 0.4900E+00 0.2700E+00 0.1000E+01 0.1600E+01 0.8500E+00 0.1550E+01 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00 0.0000E+00
pa 0.9000E+00 0.5000E+02 0.1000E+01 0.1000E+01 0.1000E+01 0.1500E+01 0.1600E+01 0.0000E+00 0.2500E+01 0.1000E+00 0.3000E+01 0.2750E+00
pa 0.4200E+00 0.1080E+01 0.8000E+00 0.5000E+00 0.0000E+00 0.5500E+00 0.5000E+01 0.8000E+00 0.5000E+00 0.8000E+06 0.1000E+01 0.2000E+01
pvec: r0 rx ry rz p0 px py pz m ityp 2i3 chg lcl# ncl or
198 200
1 1 0 0 0 0 0 0
0.20000000E+03 -0.29270856E+01 -0.21151216E+01 -0.10648322E+02 0.95357633E+00 -0.29205595E-01 -0.38037133E-01 -0.28511840E+00 0.90868890E+00 1 1 1 0 0 0
0.20000000E+03 -0.26733028E+01 -0.48575282E+01 -0.11135421E+02 0.93966054E+00 -0.16105977E+00 -0.78331655E-01 -0.14366491E+00 0.91117848E+00 1 1 1 0 0 0
0.20000000E+03 0.17302826E+01 -0.19563007E+01 -0.59252391E+01 0.93977688E+00 -0.16357943E+00 -0.15714093E+00 -0.14424081E+00 0.90051300E+00 1 1 1 0 0 0
0.20000000E+03 0.53763010E+01 0.40176612E+01 -0.96760700E+01 0.93947602E+00 0.89151978E-01 0.10288793E+00 -0.14219121E+00 0.91862008E+00 1 1 1 0 0 0
0.20000000E+03 0.13783666E+01 -0.58041928E+00 -0.95032043E+01 0.93026380E+00 -0.17300076E+00 0.10975707E+00 -0.48033855E-01 0.90614989E+00 1 1 1 0 0 0


danke für eure hilfe

View full thread daten auslesen benötige hilfe