/[PAMELA software]/tracker/ground/source/readraw/readraw_old.f
ViewVC logotype

Contents of /tracker/ground/source/readraw/readraw_old.f

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1.1.1 - (show annotations) (download) (vendor branch)
Wed Mar 8 15:00:39 2006 UTC (18 years, 9 months ago) by pam-fi
Branch: MAIN, trk-ground
CVS Tags: R3v02, HEAD
Changes since 1.1: +0 -0 lines
Error occurred while calculating annotation data.
First CVS release of tracker ground software (R3v02) 

1 ************************************************************************
2 *
3 * Program readraw.F
4 *
5 * - creates output files data structure with RUNINFO and LEVEL0 ntuples
6 * - reads raw data input files (FILENAME.DAT, FILENAME.PEDSIG##,
7 * ##=1..12)
8 * - fills ped, sig and bad histograms with online computed (DSP) values
9 * - fills RUNINFO and LEVEL0 ntuples
10 *
11 * needs:
12 * - ./go_readraw go file
13 * - ../data/FILENAME.DAT input data file
14 * - ../data/FILENAME.PEDSIG##, ##=1..12 input pedsig files
15 * - ../common/commontracker.f tracker general common
16 * - ../common/runinfo.f runinfo ntuple common
17 * - ../common/level0.f level0 ntuple common
18 * - ./readevent.c C routine to read input file
19 *
20 * output:
21 * - ../rz/FILENAME.rz ntuples out file
22 *
23 *************************************************************************
24
25
26 program readraw
27
28 include '../common/commontracker.f'
29 include '../common/common_readraw.f'
30 include '../common/level0.f'
31 include '../common/calib.f'
32
33 include '../tof/common_tof.f'
34
35
36 integer trk_DSP_ok(nviews) !mask of found DSP packets
37 common/DSPok/trk_DSP_ok
38
39 c------------------------------------------------------------------------
40 c
41 c local variables
42 c
43 c------------------------------------------------------------------------
44 parameter (nfile_max=20)
45
46 character*24 processing_date
47
48 c local variables for input files
49 character*60 name_temp
50 character*3 aa(nfile_max)
51 character*2 aaa
52 character*40 in_file(nfile_max) !input data file
53 character*40 in_dir !input data dir
54 character*40 out_dir !output dir
55 character*60 out_file !output rz file
56 character*60 out_file_runinfo !output log file
57 character*60 out_file_level0 !output rz file (level 0)
58 character*60 out_file_calib !output rz file (calibration)
59 character*60 out_file_tof !output rz file (TOF)
60
61
62 character*8 date
63 c character*3 particle
64
65 integer file_id(nfile_max),file_events(nfile_max)
66
67 character*200 copystring
68
69 c integer this_eventn
70 c integer this_calib
71
72 c local variables for data unpacking
73 logical found_cal_pkt !flag for calibration packets
74 integer ffd !input file descriptor
75 integer runerror !readevent error flag
76 c integer ffd_pkt !pkt file descriptor
77 c !(file temporaneo)
78 parameter (MAXBUFFLEN=z'172c8')
79 integer*4 CPU_pkt_counter
80 c integer pkt_type
81 integer*4 length_buffer
82 integer trk_calib_used
83 integer acq_build_info
84 integer*1 buffer(MAXBUFFLEN)
85
86 c integer ndummy
87 c data ndummy/1000/
88
89 logical DEBUG,ALARMs
90 common/DEBUGflag/DEBUG,ALARMS
91
92 logical trk_link(2)
93
94
95 c local parameters
96 parameter (lun_out_file_runinfo=49) !txt log file id number
97 parameter (lun_out_file_calib=50) !output file id number
98 parameter (lun_out_file_level0=51) !output file id number
99 parameter (lun_out_file_tof=52) !output file id number
100
101 parameter (lun_in_file=53) !input file id number
102
103
104 parameter (max_event_number=50000) !maximum number of events
105
106 integer last_trigger(nviews)
107 common/trigger_counter/last_trigger
108 data last_trigger/12*0./
109
110
111 COMMON/QUEST/IQUEST(100) !permette di ottenere ntuple funzionanti nonostante
112 ! il messaggio dei 64K di RZOUT...!???
113
114
115 c------------------------------------------------------------------------
116 c
117 c HBOOK initialization
118 c
119 c------------------------------------------------------------------------
120
121 call HLIMIT(NWPAWC)
122
123
124 c------------------------------------------------------------------------
125 c
126 c reads input informations (through < go_readraw)
127 c
128 c------------------------------------------------------------------------
129
130 print*,'______________________________________________'
131
132 print*,'Number of files to be analysed:'
133 read(*,*)nfile
134 print*,nfile
135 print*,'Date YYMMDD:'
136 300 format(a6)
137 read(*,300)date
138 print*,date
139 print*,'List of file identifiers:'
140 c 401 format('output_',A6,'_',A3,'.dat') !file name
141 401 format('DW_',A6,'_',A3,'.dat') !file name
142 c 402 format('dt_temp/') !directory
143 read(*,*)(file_id(i),i=1,nfile)
144 write(*,*)(file_id(i),i=1,nfile)
145 c write(in_dir,402)date
146 c in_dir='dt_temp/'
147 in_dir='raw-data/'
148 do i=1,nfile
149 iii = file_id(i)
150 call intstr(iii,aa(i),3)
151 c write(name_temp,400)date,date,aa(i)
152 write(name_temp,401)date,aa(i)
153 in_file(i)=name_temp(1:LNBLNK(name_temp))
154 print*,in_file(i)
155 file_events(i)=0
156 enddo
157
158 499 format(A40)
159 print*,'output directory:'
160 read(*,499)out_dir
161 print*,out_dir
162 c out_dir='rz/'
163 print*,'output files:' !../rz/PART_E_##
164 print*,'(name only, without extention)'
165 500 format(A40)
166 read(*,500)out_file
167 print*,out_file
168 501 format(a,'_RUNINFO.txt')
169 write(out_file_runinfo,501)out_file(1:LNBLNK(out_file))
170 print*,'RUN INFORMATION:'
171 print*,out_file_runinfo
172
173 print*,'Total number of events to be analized:'
174 read(*,*)nev_total
175 print*,nev_total
176 print*,'______________________________________________'
177
178
179 c------------------------------------------------------------------------
180 c
181 c Opening log-file RUNINFO
182 c
183 c
184 c------------------------------------------------------------------------
185
186 call fdate(processing_date)
187 open(UNIT=lun_out_file_runinfo
188 $ ,FILE=out_dir(1:LNBLNK(out_dir))
189 $ //out_file_runinfo(1:LNBLNK(out_file_runinfo))
190 $ ,ACCESS='APPEND'
191 $ ,FORM='FORMATTED'
192 $ ,STATUS='UNKNOWN'
193 $ )
194 write(lun_out_file_runinfo,101)
195 $ processing_date
196 $ ,nfile
197 $ ,date
198 $ ,(file_id(i),i=1,nfile)
199 101 format(/
200 $ ,'*** *** *** *** *** *** *** *** *** *** *** *** ***',/
201 $ ,'* *',/
202 $ ,'* READRAW *',/
203 $ ,'* *',/
204 $ ,'*** *** *** *** *** *** *** *** *** *** *** *** ***',/
205 $ ,a24,/
206 $ ,/
207 $ ,'Data info',/
208 $ ,'...................................................',/
209 $ ,'Number of reduced files ',i6,/
210 $ ,'Date ',a6,/
211 $ ,'List of file identifiers ',/
212 $ ,10i5/
213 $ )
214
215 c------------------------------------------------------------------------
216 c
217 c read run information
218 c
219 c------------------------------------------------------------------------
220 c level0=.true. !data elaboration level
221 c level1=.false.
222 c level2=.false.
223 c level3=.false.
224
225 c call read_runinfo !some information about the run is from prompt
226
227
228 *-------------------------------------------------------------
229 *
230 * start loop on data files
231 *
232 *
233 *------------------------------------------------------------
234 * some flags to check the data stream
235 found_cal_pkt=.false.
236 n_cal_pkt=0
237 n_cal_pkt_last=0
238
239 nev0_c = 0 !global event counter
240 nev0_good = 0
241 trk_link(1)=.false.
242 trk_link(2)=.false.
243
244
245
246 this_CPU_pkt = 0
247 do ifile = 1,nfile !loop on data files
248
249 write(lun_out_file_runinfo,104)
250 $ ifile
251 $ ,in_file(ifile)
252 104 format(/
253 $ ,/
254 $ '+...+...+...+...+...+...+...+...+...+...+...+...+',/
255 $ ,' Processing file ',i2,/
256 $ ,' ',a40,/
257 $ '+...+...+...+...+...+...+...+...+...+...+...+...+'
258 $ )
259
260
261 print*,' '
262 print*,'OPENING PARTICLE FILE:'
263 print*,in_file(ifile)
264 print*,' '
265
266 open(unit=lun_in_file,
267 $ file=in_dir(1:LNBLNK(in_dir))
268 $ //in_file(ifile)(1:LNBLNK(in_file(ifile))),
269 $ status='old',
270 $ form='unformatted',
271 $ err=22)
272 ffd = FNum(lun_in_file) !reads unix file descriptor
273
274 file_events(ifile)=0 !sigle-file event counter
275 nev_file_good = 0
276 c this_eventn=0
277
278 c this_CPU_pkt = 0
279 do iev = 1,min(nev_total,max_event_number) !events loop
280
281
282
283 ****************************************************************
284 * this routine search for a cpu header pointing to a tracker
285 * packet, and save the content in a temp file
286 * >>>>>> packet.dat <<<<<<
287 call findcpuheader(runerror,ffd,pkt_type,CPU_pkt_counter
288 $ ,obt,buffer,length_buffer)
289
290
291 c if(runerror.eq.-1) goto 24
292 if(runerror.eq.-1) then
293 print*,' '
294 print*,'readraw: ERROR ON READING FILE: ',in_file(ifile)
295 print*,'_____________________________________ '
296 goto 9900 !end loop on files
297 endif
298 if(runerror.eq.1) then
299 print*,' '
300 print*,'readraw: FILE: ',in_file(ifile)
301 print*,'readraw: END OF FILE AT EVENT ',iev-1
302 print*,'_____________________________________ '
303 goto 9900 !end loop on files
304 endif
305 if(CPU_pkt_counter.le.this_CPU_pkt)then
306 print*,' '
307 print*,' Non consecutive cpu packet! '
308 print*,' From ',this_CPU_pkt,' to ',CPU_pkt_counter
309 goto 9900 !next file
310 endif
311
312 this_CPU_pkt = CPU_pkt_counter
313 name_temp='packet.dat'
314
315 pkt_num=CPU_pkt_counter
316
317 ******************************************************
318 ******************************************************
319 ******************************************************
320 ******************************************************
321 ******************************************************
322 ******************************************************
323 ******************************************************
324 ******************************************************
325
326
327
328 ******************************************************
329 ******************************************************
330 ******************************************************
331 ******************************************************
332 ******************************************************
333 ******************************************************
334
335
336 if(pkt_type.eq.z'12'.or.pkt_type.eq.z'13')then
337 if(pkt_type.eq.z'12')then
338 trk_link(1)=.true.
339 else
340 trk_link(2)=.true.
341 endif
342 c-- **--**--**--**--**--**--**--**--**--**--**--**--**--**--**
343 c -----------
344 c CALIBRATION
345 c -----------
346 c-- **--**--**--**--**--**--**--**--**--**--**--**--**--**--**
347
348 call trkcalibpkt(runerror,name_temp)
349
350 2222 continue
351
352 elseif(pkt_type.eq.z'10'.or.pkt_type.eq.z'30')then
353
354 good0=.true.
355 call trkeventpkt(runerror,name_temp)
356 if(runerror.ne.0)then
357 good0=.false.
358 DEBUG = .true.
359 endif
360
361 call init_tof
362 good=.true.
363 call triggerunpack(buffer,length_buffer,me)
364 if(me.eq.1)good=.false.
365 call tofunpack(buffer,length_buffer,me)
366 if(me.eq.1)good=.false.
367
368 **** CHECK TRIGGER SEQUENCE ****
369 do idsp=1,nviews
370 if(trk_DSP_ok(idsp).eq.1)then
371 if(eventn(idsp).ne.(last_trigger(idsp)+1)
372 $ .and.eventn(idsp).ne.1)
373 $ write(*,8181)
374 $ idsp,last_trigger(idsp),eventn(idsp)
375 last_trigger(idsp)=eventn(idsp)
376 endif
377 enddo
378 8181 format(i2,' >> JUMP from trigger ',i6,' to ',i6)
379
380 c$$$ c-- **--**--**--**--**--**--**--**--**--**--**--**--**--**--**
381 c$$$ c -----
382 c$$$ c EVENT
383 c$$$ c -----
384 c$$$ c-- **--**--**--**--**--**--**--**--**--**--**--**--**--**--**
385 elseif(pkt_type.eq.z'83')then
386
387 call trkalarmpkt(buffer,length_buffer,runerror)
388
389 c$$$ c-- **--**--**--**--**--**--**--**--**--**--**--**--**--**--**
390 c$$$ c -----
391 c$$$ c ALARM
392 c$$$ c -----
393 c$$$ c-- **--**--**--**--**--**--**--**--**--**--**--**--**--**--**
394
395 elseif(pkt_type.eq.z'20')then
396
397 call runheaderpkt(buffer,length_buffer
398 $ ,trk_calib_used,acq_build_info)
399 c this gives the TRK_CALIB_USED field and the ACQ_BUILD_INFO only
400 c inside the runheader packet
401 c$$$ c-- **--**--**--**--**--**--**--**--**--**--**--**--**--**--**
402 c$$$ c -----
403 c$$$ c RUNHEADER PACKET
404 c$$$ c -----
405 c$$$ c-- **--**--**--**--**--**--**--**--**--**--**--**--**--**--**
406
407 c$$$ 6667 format(z1,' ',z8)
408 c$$$ write(*,6667) trk_calib_used,acq_build_info
409
410
411 endif !end pkt type conditions
412
413
414 ******************************************************
415 ******************************************************
416 ******************************************************
417 ******************************************************
418 ******************************************************
419 ******************************************************
420
421 * format of output files
422 502 format(a,'_',a2,'_LEVEL0.rz')
423 5022 format(a,'_',a2,'_TOF.rz')
424 503 format(a,'_',a2,'_calib.rz')
425
426
427 if(
428 $ (pkt_type.eq.z'10'.or.pkt_type.eq.z'30').and.
429 $ .true.) then
430 c----------------------------------------------------------------
431 c an EVENT was found, fill the n-tuple
432 c----------------------------------------------------------------
433 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
434 C if no calib pkts have been found
435 C a data file labelled "00" is opened
436 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
437 if(
438 $ (n_cal_pkt_last.eq.0.and.nev0_c.eq.0).or.
439 $ (n_cal_pkt_last.ne.n_cal_pkt).or.
440 $ .false.)then
441
442 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
443 C if new calib pkts have been found
444 C and a new one is opened with an increased label
445 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
446 n_cal_pkt_last = n_cal_pkt
447 nev0_c = 0
448 nev0_good = 0
449
450 if(n_cal_pkt.ge.1)then
451 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
452 C in this case a calibration pkt has already been found
453 C --> the previous data file is closed
454 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
455 print*,' '
456 print*,'CLOSING FILES:'
457 print*,out_file_level0
458 print*,out_file_tof
459 print*,' '
460 call HCDIR('//LEVEL0',' ')
461 call HPRNTU(ntp_level0) !prints ntuple structure
462 call RZPURG(-1)
463 call HROUT(ntp_level0,ICYCLE,'T')
464 call HREND('LEVEL0')
465 close(lun_out_file_level0)
466 call HCDIR('//TOF',' ')
467 call HPRNTU(ntp_tof) !prints ntuple structure
468 call RZPURG(-1)
469 call HROUT(ntp_tof,ICYCLE,'T')
470 call HREND('TOF')
471 close(lun_out_file_tof)
472
473 elseif(n_cal_pkt.eq.0.and.pkt_type.ne.z'30')then
474 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
475 C if no calib pkts have been found
476 C and the pkt type is "physics", a calibration labelled "00" is open
477 C with default calibration parameters
478 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
479
480 nnnn=n_cal_pkt
481 c print*,nnnn,n_cal_pkt
482 call intstr(nnnn,aaa,2)
483 c print*,aaa,out_file
484 write(out_file_calib,503)
485 $ out_file(1:LNBLNK(out_file)),aaa
486 c write(out_file_calib,503)out_file(1:LNBLNK(out_file))
487 c print*,'CREATING DEFAULT CALIBRATION FILE:'
488 c print*,out_file_calib
489
490 write(lun_out_file_runinfo,1033)
491 $ out_file_calib
492 write(*,1033)
493 $ out_file_calib
494 1033 format(
495 $ '*---------------------------------------------/
496 $ ----*',/
497 $ ,' Creating DEFAULT calibration rz file',/
498 $ ,' ',a40,/
499 $ '*---------------------------------------------/
500 $ ----*',/
501 c $ ,/
502 c $ 'Processing events from 1 to ',i6,/
503 c $ ,/
504 $ )
505
506 copystring='cp '
507 $ //out_dir(1:LNBLNK(out_dir))
508 $ //'output_040707_010_01_calib.rz '
509 $ //out_dir(1:LNBLNK(out_dir))
510 $ //out_file_calib(1:LNBLNK(out_file_calib))
511 c print*,copystring
512 call system(copystring)
513
514 endif
515
516 c------------------------------------------------------------------------
517 c
518 c ntuples and histos booking
519 c
520 c------------------------------------------------------------------------
521 nnnn=n_cal_pkt
522 call intstr(nnnn,aaa,2)
523 write(out_file_level0,502)
524 $ out_file(1:LNBLNK(out_file)),aaa
525 c print*,'LEVEL0 EVENT DATA:'
526 c print*,out_file_level0
527
528 write(out_file_tof,5022)
529 $ out_file(1:LNBLNK(out_file)),aaa
530 c print*,'TOF EVENT DATA:'
531 c print*,out_file_tof
532
533 IQUEST(10)=64000
534 c permette di ottenere ntuple funzionanti nonostante
535 c il messaggio dei 64K di RZOUT... !???
536
537
538 write(lun_out_file_runinfo,103)
539 $ out_file_level0,out_file_tof
540 write(*,103)
541 $ out_file_level0,out_file_tof
542 103 format(
543 $ '*---------------------------------------------/
544 $ ----*',/
545 $ ,' Creating rz files',/
546 $ ,' ',a40,/
547 $ ,' ',a40,/
548 $ '*---------------------------------------------/
549 $ ----*',/
550 c $ ,/
551 c $ 'Processing events from 1 to ',i6,/
552 c $ ,/
553 $ )
554
555
556 * create LEVEL0 tracker file
557 call HROPEN(lun_out_file_level0,
558 $ 'LEVEL0',
559 $ out_dir(1:LNBLNK(out_dir))
560 $ //out_file_level0(1:LNBLNK(out_file_level0)),
561 $ 'QN',4096,istat) !opens rz
562 if(istat.ne.0) goto 19
563 call HCDIR('//LEVEL0',' ')
564 call book_level0
565
566 * create TOF tracker file
567
568
569 call HROPEN(lun_out_file_tof,
570 $ 'TOF',
571 $ out_dir(1:LNBLNK(out_dir))
572 $ //out_file_tof(1:LNBLNK(out_file_tof)),
573 $ 'QN',4096,istat) !opens rz
574 if(istat.ne.0) goto 19
575 call HCDIR('//TOF',' ')
576 call book_tof
577
578 c print*,'DONE'
579 print*,' '
580
581
582
583
584 endif !end condition for opening a new data file
585
586
587 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
588 C then the nt-uple is filled
589 C - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
590 file_events(ifile) =
591 $ file_events(ifile) +1 !sigle-file event counter
592 if(good0.eqv..true.)nev_file_good = nev_file_good +1
593 nev0_c = nev0_c + 1 !global event counter
594 nev0 = 1000000*file_id(ifile) + nev0_c
595 nev_trk = nev0
596
597 call HCDIR('//LEVEL0',' ')
598 c print*,'CALL HFILL --- event ',nev0_c
599 call HFNT(ntp_level0) !ntuple filling
600
601 call HCDIR('//TOF',' ')
602 call HFNT(ntp_tof) !ntuple filling
603
604 if(mod(nev0_c,10).eq.0)print*,nev0_c
605 if(nev0_c.eq.nev_total)then
606 write(lun_out_file_runinfo,107)
607 $ file_events(ifile),
608 $ nev_file_good
609 nev0_good = nev0_good + nev_file_good
610 goto 9990
611 endif
612 dsptot=0
613 do iview=1,nviews
614 dsptot=dsptot+trk_DSP_ok(iview)
615 trk_DSP_ok(iview)=0 !init DSP flag
616 enddo
617
618 if(dsptot.lt.nviews)then
619 print *,'DSP pkt found: '
620 $ ,(trk_DSP_ok(iview),iview=1,12)
621 print *,'---> CPU physics pkt --- ',this_CPU_pkt
622 print *,''
623 elseif(DEBUG)then
624 print *,'---> CPU physics pkt --- ',this_CPU_pkt
625 print *,''
626 DEBUG = .false.
627 endif
628
629
630
631 elseif(
632 $ pkt_type.eq.z'83'.and.
633 $ .true.) then
634
635 print*,''
636 print*,'@@@@@@@@@@@@ ALARM @@@@@@@@@@@@@@@'
637 print*,''
638
639 elseif(
640 $ (pkt_type.eq.z'12'.or.pkt_type.eq.z'13').and.
641 $ trk_link(1).eqv..true..and.
642 $ trk_link(2).eqv..true..and.
643 $ .true.) then
644 c print*,trk_link(1),trk_link(2),pkt_type
645 c----------------------------------------------------------------
646 c a calibration packet was found
647 c --> book and fill histos
648 c----------------------------------------------------------------
649 n_cal_pkt = n_cal_pkt + 1
650 nnnn=n_cal_pkt
651 call intstr(nnnn,aaa,2)
652 write(out_file_calib,503)
653 $ out_file(1:LNBLNK(out_file)),
654 $ aaa
655
656 write(lun_out_file_runinfo,106)out_file_calib
657 write(*,106)out_file_calib
658 106 format(
659 $ '*--------------------------------------------/
660 $ -----*',/
661 $ ,' Creating CALIBRATION rz file',/
662 $ ,' ',a40,/
663 $ ,'*-------------------------------------------/
664 $ ------*'
665 $ )
666
667 call HROPEN(lun_out_file_calib,
668 $ 'RUNINFO',
669 $ out_dir(1:LNBLNK(out_dir))
670 $ //out_file_calib(1:LNBLNK(out_file_calib)),
671 $ 'QN',4096,istat) !opens rz
672 if(istat.ne.0) goto 19
673 call HCDIR('//RUNINFO',' ')
674
675 call book_histos
676 call fill_histos
677
678 call HCDIR('//RUNINFO',' ')
679 do iview=1,nviews
680 c if(trk_DSP_ok(iview).eq.1)then
681 call HROUT(id_hi_bad+iview,ICYCLE,'T')
682 call HROUT(id_hi_ped+iview,ICYCLE,'T')
683 call HROUT(id_hi_sig+iview,ICYCLE,'T')
684 c endif
685 enddo
686 call HREND('RUNINFO')
687 close(lun_out_file_calib)
688 do iview=1,nviews
689 trk_DSP_ok(iview)=0 !init DSP flag
690 enddo
691 trk_link(1)=.false.
692 trk_link(2)=.false.
693
694 c print*,'///////////////////////'
695 c stop
696
697 endif
698 9909 continue
699 c close(lun_pkt)
700 enddo !end loop on events
701 9900 continue
702 close(lun_in_file)
703
704 nev0_good = nev0_good + nev_file_good
705 write(lun_out_file_runinfo,107)
706 $ file_events(ifile),
707 $ nev_file_good
708 107 format(
709 $ 'Number of events ',i8,/
710 $ ,'Good events ',i8,/
711 $ ,'...................................................',/
712 $ )
713
714 enddo !end loop on data files
715
716 9990 continue
717 write(lun_out_file_runinfo,108)
718 $ nev0_c,nev0_good
719 108 format(/
720 $ ,'|------------------------------------------------|',/
721 $ ,'| Number of processed events |',/
722 $ ,'| Total ',i8,' |'/
723 $ ,'| Good ',i8,' |'/
724 $ ,'|------------------------------------------------|',/
725 $ )
726
727
728 goto 9000 !go to end
729 c-----------------------------------------
730 c output file creation error
731 c-----------------------------------------
732 19 continue
733 print*,' '
734 print*,'readraw: ERROR CREATING OUTPUT FILE: ',out_file
735 print*,istat
736 print*,' '
737 print*,' '
738 goto 9000 !the end
739 c-----------------------------------------
740 c particle input file opening error
741 c-----------------------------------------
742 22 continue
743 print*,' '
744 print*,'readraw: ERROR OPENING PARTICLE FILE: ',in_file(ifile)
745 print *,in_dir
746 print *,in_dir(1:LNBLNK(in_dir))
747 $ //in_file(ifile)(1:LNBLNK(in_file(ifile)))
748 print*,' '
749 goto 9000 !the end
750 c-----------------------------------------
751 c event found before calibration packet
752 c-----------------------------------------
753 20 continue
754 print*,' '
755 print*,'readraw: EVENT FOUND BEFORE CALIBRATION PACKET: '
756 print*,in_file(ifile)
757 print*,' '
758 goto 9000 !the end
759 c-----------------------------------------
760 c particle input file reading error
761 c-----------------------------------------
762 23 continue
763 print*,' '
764 print*,'readraw: END OF FILE: ',in_file(ifile)
765 print*,'readraw: FOWND AT EVENT ',iev
766 print*,' '
767 goto 9000 !the end
768 24 continue
769 print*,' '
770 print*,'readraw: ERROR READING PARTICLE FILE: ',in_file(ifile)
771 print*,'readraw: READ ERROR AT EVENT ',iev
772 print*,' '
773 goto 9000 !the end
774
775 c------------------------------------------------------------------------
776 c
777 c closes files and exits
778 c
779 c------------------------------------------------------------------------
780 9000 continue
781
782 print*,' '
783 print*,'CLOSING FILES:'
784 print*,out_file_level0
785 print*,out_file_tof
786 print*,' '
787
788 call HCDIR('//LEVEL0',' ')
789 call HPRNTU(ntp_level0) !prints ntuple structure
790 c deletes all but the last cycles of all key
791 c from the current working RZ directory
792 call RZPURG(-1)
793 call HROUT(ntp_level0,ICYCLE,'T')
794 call HREND('LEVEL0')
795 close(lun_out_file_level0)
796
797 call HCDIR('//TOF',' ')
798 call HPRNTU(ntp_tof) !prints ntuple structure
799 c deletes all but the last cycles of all key
800 c from the current working RZ directory
801 call RZPURG(-1)
802 call HROUT(ntp_tof,ICYCLE,'T')
803 call HREND('TOF')
804 close(lun_out_file_tof)
805
806
807 close(lun_out_file_runinfo)
808
809
810
811 stop
812 end
813

  ViewVC Help
Powered by ViewVC 1.1.23