/[PAMELA software]/calo/flight/MyDetector2Level2/src/mydectrk.for
ViewVC logotype

Annotation of /calo/flight/MyDetector2Level2/src/mydectrk.for

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Tue Apr 18 13:12:40 2006 UTC (18 years, 7 months ago) by mocchiut
Branch: v0r00
CVS Tags: start
Changes since 1.1: +0 -0 lines
Imported sources

1 mocchiut 1.1 *****************************************************************************
2     INTEGER FUNCTION MYDECTRK()
3     c
4     IMPLICIT NONE
5     C
6     INCLUDE 'COMMON.TXT'
7     C
8     DOUBLE PRECISION al_p(5),
9     & xout(22),yout(22),zin(22)
10     C
11     REAL ZALIG, DISTX
12     REAL PIANO(22), VARFIT(2)
13     REAL TBAR(2,22), CBAR(2,22)
14     C
15     INTEGER m, i, T, IFAIL
16     INTEGER NPFIT(2)
17     C
18     REAL hmemor(9000000)
19     INTEGER Iquest(100)
20     C
21     COMMON / pawcd / hmemor
22     save / pawcd /
23     C
24     Common / QUESTd / Iquest
25     save / questd /
26     C
27     C Begin !
28     C
29     MYDECTRK = 0
30     C
31     C Z positions where to calculate the track
32     C
33     PIANO(1) = 0.
34     DO I = 2, 22
35     IF ( MOD(I,2).EQ.0 ) THEN
36     PIANO(I) = PIANO(I-1) - 8.09
37     ELSE
38     PIANO(I) = PIANO(I-1) - 10.09
39     ENDIF
40     ENDDO
41     ZALIG = -263.
42     C
43     C BEGIN WITH THE FISRT TRACK
44     C
45     T = 1
46     C
47     10 CONTINUE
48     C
49     C COPY THE ALFA VECTOR FROM AL_PP TO AL_P FOR THE TRACK "T"
50     C
51     do m = 1, 5
52     al_p(m) = al_pp(t,m)
53     enddo
54     if (al_p(5).eq.0.) THEN
55     PRINT *,' MYDETECTOR2 - WARNING F77: track with R = 0, discarded'
56     GOTO 969
57     ENDIF
58     C
59     C CALL THE TRACKING ROUTINE
60     C
61     DO M = 1,2
62     DO I = 1,22
63     XOUT(I) = 0.
64     YOUT(I) = 0.
65     IF (MOD(M,2).EQ.0) THEN
66     DISTX = PIANO(I) + ZALIG
67     ELSE
68     DISTX = PIANO(I) - 5.81 + ZALIG
69     ENDIF
70     ZIN(I) = distx / 10.
71     enddo
72     IFAIL = 0
73     call TRACK(22,ZIN,XOUT,YOUT,AL_P,IFAIL)
74     if(IFAIL.ne.0)then
75     GOOD = 0
76     print *,' MYDETECTOR2 - WARNING F77: tracking failed '
77     goto 969
78     endif
79     DO I = 1, 22
80     C
81     C CHECK IF XOUT OR YOUT ARE NaN
82     C
83     IF (XOUT(I).NE.XOUT(I).OR.YOUT(I).NE.YOUT(I)) THEN
84     print *,
85     & ' MYDETECTOR2 - WARNING F77: tracking error (NaN values)'
86     GOTO 969
87     ENDIF
88     C
89     ENDDO
90     ENDDO
91     969 continue
92    
93     C
94     C HERE WE MAKE SOME KIND OF ALTERNATIVE FIT WITH OUR INSTRUMENT TO COMPARE IT WITH THE TRACK COMING FROM TRACKER
95     C
96    
97     C
98     C IF WE HAVE A GOOD FIT FROM OUR INSTRUMENT (NPFIT(2).GT.15.AND.VARFIT(2).LT.1000) AND WE HAVE AN IMAGE TRACK WE CAN TRY TO SEE IF WE ARE CLOSER TO THE IMAGE OR TO THE MAIN TRACK
99     C
100     IF (GOOD.EQ.1.AND.NPFIT(2).GT.15.AND.VARFIT(2).LT.1000
101     & .AND.TRKCHI2.EQ.1) THEN
102     IF (ABS(TBAR(2,1)-CBAR(2,1))<40.) THEN ! HERE WE CHECK IF THE TWO TRACKS ARE THE SAME PHYSICS TRACK
103     C
104     C GOOD, THE TWO TRACKS COINCIDE
105     C
106     IF (T.EQ.2) TRKCHI2 = 2
107     GOTO 6996
108     ELSE
109     C
110     C IT IS NOT A GOOD FIT BUT WE HAVE AN IMAGE AND THIS IS THE FIRST TRACK
111     C
112     IF (T.EQ.1) THEN
113     T = 2
114     GOTO 10
115     ENDIF
116     C
117     C IT IS NOT A GOOD FIT BUT WE HAVE AN IMAGE AND THIS IS THE SECOND TRACK, USE THE FIRST ONE
118     C
119     IF (T.EQ.2) THEN
120     TRKCHI2 = -1
121     T = 1
122     GOTO 10
123     ENDIF
124     ENDIF
125     C
126     ENDIF
127     C
128     IF (T.EQ.1.AND.TRKCHI2.EQ.1) THEN
129     GOOD = 1
130     T = 2
131     GOTO 10
132     ENDIF
133     C
134    
135     6996 CONTINUE
136     C
137     C HERE WE DETERMINE TRACK-RELATED VARIABLES
138     C
139     MYTRKVAR = 18.
140    
141     50 CONTINUE
142     C
143     RETURN
144     END
145    
146    

  ViewVC Help
Powered by ViewVC 1.1.23