]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/AliITSspdTestBeam.cxx
Using TMath::Abs instead of fabs
[u/mrichter/AliRoot.git] / ITS / AliITSspdTestBeam.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
6  *                                                                        *
7  * Permission to use, copy, modify and distribute this software and its   *
8  * documentation strictly for non-commercial purposes is hereby granted   *
9  * without fee, provided that the above copyright notice appears in all   *
10  * copies and that both the copyright notice and this permission notice   *
11  * appear in the supporting documentation. The authors make no claims     *
12  * about the suitability of this software for any purpose. It is          *
13  * provided "as is" without express or implied warranty.                  *
14  **************************************************************************/
15
16 /*
17   $Id$
18 */
19
20 #include <stddef.h>
21 #include <iomanip>
22 #include <Riostream.h>
23 #include <fstream>
24 #include <AliRunLoader.h>
25 #include <AliLoader.h>
26 #include <AliITS.h>
27
28 #include "AliITSspdTestBeam.h"
29
30 ClassImp(AliITSspdTestBeam)
31
32 //----------------------------------------------------------------------
33 AliITSspdTestBeam::AliITSspdTestBeam(){
34     // Default Constructor for the Task AliITSspdTestBeam.
35     // Inputs:
36     //    none.
37     // Outputs:
38     //    none.
39     // Return:
40     //     A default constructed AliITSspdTestBeam class
41
42     fNBrst        = 0;
43     fBrstSize     = 0;
44     fBrst         = 0;
45     fNData        = 0;
46     fData         = 0;
47     fHData        = 0;
48     fTData        = 0;
49     SetTerminationWord();
50     fNEvents      = 0;
51     fBuffSize     = 0;
52     fBuff         = 0;
53     fVersion      = 0;
54     fITS          = 0;
55     fNfiles       = 0;
56     fMaxFiles     = 0;
57     fFiles        = 0;
58     fNeventsStart = 0;
59     fNeventsEnd   = 0;
60 }
61 //----------------------------------------------------------------------
62 AliITSspdTestBeam::AliITSspdTestBeam(const Char_t *filename,const Char_t *opt,
63                                      AliITS *its){
64     // Standard Constructor for the Task AliITSspdTestBeam.
65     // Inputs:
66     //    const Char_t *filename   File where to read in the SPD test beam data
67     //    const Char_t *opt        Option, 2002 => 2002 test beam data.
68     // Outputs:
69     //    none.
70     // Return:
71     //     A default constructed AliITSspdTestBeam class
72
73     fNBrst        = 0;
74     fBrstSize     = 0;
75     fBrst         = 0;
76     fNData        = 0;
77     fData         = 0;
78     fHData        = 0;
79     fTData        = 0;
80     SetTerminationWord();
81     fNEvents      = 0;
82     fBuffSize     = 0;
83     fBuff         = 0;
84     fVersion      = 0;
85     fITS          = 0;
86     fNfiles       = 0;
87     fMaxFiles     = 0;
88     fFiles        = 0;
89     fNeventsStart = 0;
90     fNeventsEnd   = 0;
91     //
92     fITS          = its;
93     fNfiles       = 0;
94     OpenInputFile(filename,0,-1);
95     if(strcmp(opt,"2002")) cout << "2002 assumed" << endl;
96 }
97
98 //----------------------------------------------------------------------
99 AliITSspdTestBeam::~AliITSspdTestBeam(){
100     // Destructor. Frees up any memory allocated or closes any files opened.
101     // Inputs:
102     //    none.
103     // Outputs:
104     //    none.
105     // Return:
106     //     nothing.
107
108     DeletefBrst();
109     DeletefNData();
110     DeletefData();
111     DeletefHData();
112     DeletefTData();
113     DeletefFiles();
114     DeletefBrstSize();
115     DeletefBuff();
116     DeletefITS();
117     DeletefNeventsStart();
118     DeletefNeventsEnd();
119 }
120 //----------------------------------------------------------------------
121 void AliITSspdTestBeam::DeletefBrst(){
122     // Properly deletes fBrst object.
123     // Inputs:
124     //    none.
125     // Outputs:
126     //    none.
127     // Return:
128     //    none.
129     Int_t i;
130     
131     if(fBrst){
132         for(i=0;i<fNBrst;i++) if(fBrst[i]){
133             delete[] fBrst[i];
134             fBrst[i] = 0;
135         } // end for i/if
136         delete[] fBrst;
137         fBrst = 0;
138     } // end if
139 }
140 //----------------------------------------------------------------------
141 void AliITSspdTestBeam::DeletefNData(){
142     // Properly deletes fNData object.
143     // Inputs:
144     //    none.
145     // Outputs:
146     //    none.
147     // Return:
148     //    none.
149     Int_t i,np=GetNumberOfPilots();
150
151     if(fNData){
152         for(i=0;i<np;i++) if(fNData[i]){
153             delete[] fNData[i];
154             fNData[i] = 0;
155         } // end for i
156         delete[] fNData;
157         fNData = 0;
158     } // end if
159 }
160 //----------------------------------------------------------------------
161 void AliITSspdTestBeam::DeletefData(){
162     // Properly deletes fData object.
163     // Inputs:
164     //    none.
165     // Outputs:
166     //    none.
167     // Return:
168     //    none.
169     Int_t i,j,np=GetNumberOfPilots();
170
171     if(fData){
172         for(i=0;i<np;i++) if(fData[i]){
173             for(j=0;j<fNEvents;j++){
174                 delete[] fData[i][j];
175                 fData[i][j] = 0;
176             } // end for j
177             delete[] fData[i];
178             fData[i] = 0;
179         } // end for i
180         delete[] fData;
181         fData = 0;
182     } // end if
183 }
184 //----------------------------------------------------------------------
185 void AliITSspdTestBeam::DeletefHData(){
186     // Properly deletes fHData object.
187     // Inputs:
188     //    none.
189     // Outputs:
190     //    none.
191     // Return:
192     //    none.
193     Int_t i,j,np=GetNumberOfPilots();
194
195     if(fHData){
196         for(i=0;i<np;i++) if(fHData[i]){
197             for(j=0;j<fNEvents;j++){
198                 delete[] fHData[i][j];
199                 fHData[i][j] = 0;
200             } // end for j
201             delete[] fHData[i];
202             fHData[i] = 0;
203         } // end for i
204         delete[] fHData;
205         fHData = 0;
206     } // end if
207 }
208 //----------------------------------------------------------------------
209 void AliITSspdTestBeam::DeletefTData(){
210     // Properly deletes fTData object.
211     // Inputs:
212     //    none.
213     // Outputs:
214     //    none.
215     // Return:
216     //    none.
217     Int_t i,j,np=GetNumberOfPilots();
218
219     if(fTData){
220         for(i=0;i<np;i++) if(fTData[i]){
221             for(j=0;j<fNEvents;j++){
222                 delete[] fTData[i][j];
223                 fTData[i][j] = 0;
224             } // end for j
225             delete[] fTData[i];
226             fTData[i] = 0;
227         } // end for i
228         delete[] fTData;
229         fTData = 0;
230     } // end if
231 }
232 //----------------------------------------------------------------------
233 void AliITSspdTestBeam::DeletefFiles(){
234     // Properly deletes fBrst object.
235     // Inputs:
236     //    none.
237     // Outputs:
238     //    none.
239     // Return:
240     //    none.
241     Int_t i;
242
243     if(fFiles){
244         for(i=0;i<fMaxFiles;i++){
245             if(fFiles[i]!=0) delete fFiles[i];
246         } // end for i
247     } // end if
248 }
249 //----------------------------------------------------------------------
250 void AliITSspdTestBeam::DeletefBrstSize(){
251     // Properly deletes fBrstSize object.
252     // Inputs:
253     //    none.
254     // Outputs:
255     //    none.
256     // Return:
257     //    none.
258     Int_t i,np=GetNumberOfPilots();
259
260     if(fBrstSize){
261         for(i=0;i<np;i++){
262             if(fBrstSize[i]){
263                 delete[] fBrstSize[i];
264                 fBrstSize[i] = 0;
265             } // end if
266         } // end for i
267         delete[] fBrstSize;
268         fBrstSize = 0;
269     } // end if
270 }
271 //----------------------------------------------------------------------
272 Int_t AliITSspdTestBeam::OpenInputFile(const Char_t *filename,Int_t start,Int_t end){
273     // Opens input file for reading spd test beam data.
274     // Inputs:
275     //    const Char_t *filename    file name to read data from
276     // Outputs:
277     //    none.
278     // Return:
279     //    An error number. 0=success, -1=failure.
280     Int_t stat = 0,i;
281
282     if(fMaxFiles==0) {
283         fMaxFiles     = 5;
284         fFiles        = new ifstream*[fMaxFiles];
285         for(i=0;i<fMaxFiles;i++) fFiles[i] = 0;
286         fNeventsStart = new Int_t[fMaxFiles];
287         fNeventsEnd   = new Int_t[fMaxFiles];
288     } // end if
289     if(fNfiles==fMaxFiles){// Need to expand array of open files.
290         ifstream *tmp[fMaxFiles];
291         Int_t st[fMaxFiles],en[fMaxFiles];
292         for(i=0;i<fMaxFiles;i++) { // copy pointers into tmp
293             tmp[i]    = fFiles[i];
294             fFiles[i] = 0;
295             st[i]     = fNeventsStart[i];
296             en[i]     = fNeventsEnd[i];
297         } // end for i
298         delete fFiles;
299         fMaxFiles    += 5;  // expand by 5.
300         fFiles        = new ifstream*[fMaxFiles];
301         fNeventsStart = new Int_t[fMaxFiles];
302         fNeventsEnd   = new Int_t[fMaxFiles];
303         for(i=0;i<fMaxFiles;i++) { // copy pointers back into fFiles
304             fFiles[i]        = 0;  // and zero rest.
305             fNeventsStart[i] = 0;
306             fNeventsEnd[i]   = 0;
307             if(i<fNfiles) {
308                 fFiles[i]        = tmp[i];
309                 tmp[i]           = 0;
310                 fNeventsStart[i] = st[i];
311                 fNeventsEnd[i]   = en[i];
312             } // end if i<fNfiles
313         } // end for i
314         // the array of pointers tmp is deleted automatically.
315     } // end if
316     // Open file
317     fFiles[fNfiles] = new ifstream(filename,ios::in|ios::binary);
318     if(fFiles[fNfiles]==0){// file open error
319         cout << "Error opening input file " << filename << endl;
320         stat = -1;
321         return stat;
322     } // end if
323     fNeventsStart[fNfiles] = start;
324     fNeventsEnd[fNfiles]   = end;
325     fNfiles++;
326     return stat;
327 }
328 //----------------------------------------------------------------------
329 Int_t AliITSspdTestBeam::Read(Int_t i){
330     // Read in one buffer's worth of the file.
331     // Inputs:
332     //    Int_t i  Which file from the array of files to be read in.
333     // Outputs:
334     //    none.
335     // Return:
336     //    size of file.
337     Int_t filesize=0;
338
339     fFiles[i]->seekg(0,ios::end);
340     filesize  = fFiles[i]->tellg();
341     fFiles[i]->seekg(0,ios::beg);
342     if(fBuff) delete[] fBuff;
343     fBuffSize = filesize;
344     fBuff     = new UChar_t[fBuffSize];
345     fFiles[i]->read((Char_t*)fBuff,fBuffSize);
346     fFiles[i] ->close();
347     return filesize;
348 }
349 //----------------------------------------------------------------------
350 Int_t AliITSspdTestBeam::Decode(){
351     // Decode the fBuff read in.
352     // Inputs:
353     //    none.
354     // Outputs:
355     //    none.
356     // Return:
357     //    sets up the array fData fRH, and fRT
358     Int_t stat=0;
359     UInt_t *tr;
360     union {
361         UInt_t  *wd;
362         UChar_t *bt;
363     }u; // end union
364     Int_t size;
365     Int_t *ivnt,iburst,ip,np,i,j;
366     AliITSspdTestBeamData  *d;
367     AliITSspdTestBeamBurst *b;
368
369     np = GetNumberOfPilots();
370     cout << "Sizeof(Headder)=" << fRH.SizeOf() << endl;
371     cout << "Sizeof(Tail)=" << fRT.SizeOf() << endl;
372     ivnt = new Int_t[np];
373     for(i=0;i<np;i++) ivnt[i] = 0;
374     fRH.SetBuffer(fBuff);//Set Run Header
375     size = fRT.SizeOf();
376     size = fBuffSize - size;
377     cout <<"fBuffSize-sizeof(AliITSspdTestBeamTail) "<< size << endl;
378     fRT.SetBuffer(&(fBuff[size]));
379     // Check termination
380     size -= sizeof(UInt_t);
381     tr   = (UInt_t*) &(fBuff[size]);
382     if(!(*tr==fTermination)){
383         cout << "Error Termination word not found at " << size << " tr=0x" <<
384             hex << *tr << dec << endl;
385         exit(-1);
386     } // end if
387     DeletefBrst();
388     DeletefNData();
389     DeletefData();
390     DeletefHData();
391     DeletefTData();
392     DeletefBrstSize();
393     fNEvents  = fRH.GetNumberOfEvents();
394     if(fRT.GetNumberOfEvents()>fNEvents) fNEvents  = fRT.GetNumberOfEvents();
395     fNBrst    = fNEvents/fRH.GetBurstSize();
396     fBrst     = new AliITSspdTestBeamBurst*[fNBrst];
397     fBrstSize = new Int_t*[np];
398     fNData    = new Int_t*[np];
399     fData     = new AliITSspdTestBeamData**[np];
400     fHData    = new AliITSspdTestBeamData**[np];
401     fTData    = new AliITSspdTestBeamData**[np];
402     for(i=0;i<np;i++){
403         fBrstSize[i] = new Int_t[fNBrst];
404         fNData[i]    = new Int_t[fNEvents];
405         fData[i]     = new AliITSspdTestBeamData*[fNEvents];
406         fHData[i]    = new AliITSspdTestBeamData*[fNEvents];
407         fTData[i]    = new AliITSspdTestBeamData*[fNEvents];
408         for(j=0;j<fNEvents;j++){
409             fNData[i][j] = 0;
410             fData[i][j]  = 0;
411             fHData[i][j] = 0;
412             fTData[i][j] = 0;
413         } // end for j
414     } // end for i
415     size      = fRH.SizeOf();
416     u.bt      = &fBuff[size];
417     //
418     for(iburst=0;(*(u.wd) != fTermination)&&(u.wd<tr);iburst++){ 
419         // loop over Bursts
420         b   = new AliITSspdTestBeamBurst(u.bt);
421         fBrst[iburst] = b;
422         u.bt += b->SizeOf(); // increment wd byte wise
423         for(ip=0;ip<np;ip++){  // loop over pilots
424             // Get size of data stored for this pilot.
425             AliITSTestBeamData::Swapit(4,u.bt);
426             fBrstSize[ip][iburst] = (UInt_t) *(u.wd);
427             u.bt += sizeof(UInt_t); // increment wd byte wise
428             for(i=0;i<fBrstSize[ip][iburst];i++){ // loop over data
429                 AliITSTestBeamData::Swapit(4,u.bt);
430                 d = new AliITSspdTestBeamData(u.bt);
431                 switch (d->Mode()){
432                 case AliITSTestBeamData::kData :
433                     fNData[ip][ivnt[ip]]++;
434                     // set pointer to first data member
435                     if(fData[ip][ivnt[ip]] == 0 ){
436                         fData[ip][ivnt[ip]] = d;
437                     } // end if
438                     break;
439                 case AliITSTestBeamData::kHead :
440                     fHData[ip][ivnt[ip]]   = d;
441                     fTData[ip][ivnt[ip]]   = 0;
442                     fNData[ip][ivnt[ip]]   = 0;
443                     fData[ip][ivnt[ip]]    = 0;
444                     break;
445                 case AliITSTestBeamData::kTail  : 
446                 case AliITSTestBeamData::kAbort :
447                     fTData[ip][ivnt[ip]++] = d;
448                     break;
449                 default:
450                     cout << "Unknown Data Type: wd="<<hex<<*(u.wd)<<dec<<endl; 
451                     break;
452                 } // end switch
453                 u.bt += d->SizeOf(); // increment wd byte wise
454             } // end for i (next data word).
455         } // end for loop over pilots (ip).
456     } // end for loop over bursts
457     delete[] ivnt;
458     return stat;
459 }
460 //----------------------------------------------------------------------
461 Int_t AliITSspdTestBeam::DecodeModule(Int_t pilot,Int_t chip){
462     // Determines the Module number based on the pilot and chip 
463     // valules and the fVersion of the simulation.
464     // Inputs:
465     //    Int_t   pilot   Pilot number
466     //    Int_t   chip    chip number
467     // Outputs:
468     //    none.
469     // Return:
470     //    The module number (see simulations geometry).
471
472     switch (fVersion) {
473     case 2002:
474         if(pilot==0) return chip;
475         if(pilot==1) return 2;
476         if(pilot==2) return chip+3;
477         break;
478     default:
479         if(pilot==0) return chip;
480         if(pilot==1) return 2;
481         if(pilot==2) return chip+3;
482         break;
483     } // end switch
484     return -1;
485 }
486 //----------------------------------------------------------------------
487 Int_t AliITSspdTestBeam::DecodeColumn(Int_t pilot,Int_t chip,Int_t colm){
488     // Determines the Column number based on the pilot, chip, and column 
489     // valules and the fVersion of the simulation.
490     // Inputs:
491     //    Int_t   pilot   Pilot number
492     //    Int_t   chip    chip number
493     //    Int_t   colm    Column number
494     // Outputs:
495     //    none.
496     // Return:
497     //    The Column number (see simulations geometry).
498     const Int_t colmperchip = 160/5; // Should be gotten from AliITSsegmentationSPD
499
500     switch (fVersion) {
501     case 2002:
502         if(pilot==0) return colm;
503         if(pilot==1) return colm+chip*colmperchip;
504         if(pilot==2) return colm;
505         break;
506     default:
507         if(pilot==0) return colm;
508         if(pilot==1) return colm+chip*colmperchip;
509         if(pilot==2) return colm;
510         break;
511     } // end switch
512     return -1;
513 }
514 //----------------------------------------------------------------------
515 void AliITSspdTestBeam::Digitize(Int_t evnt){
516     // Write out ITS SPD Digits.
517     // Inputs:
518     //    Int_t   evnt   events number
519     // Outputs:
520     //    none.
521     // Return:
522     //    none.
523     Int_t p,i;
524     Int_t module,chip,row,colm,digit[3];
525     Int_t oldmodule=-1;
526
527     fLoader->GetRunLoader()->SetEventNumber(evnt);
528     fLoader->SetEvent();
529     if(!(fLoader->TreeD())){
530         fLoader->MakeTree("D");
531     } // end if
532
533     fITS->MakeBranch("D");
534     //fITS->SetTreeAddress();
535     fITS->SetTreeAddressD(fLoader->TreeD());
536
537     for(p=0;p<GetNumberOfPilots();p++)
538         for(i=0;i<fNData[p][evnt];i++){
539             chip = fData[p][evnt]->Chip(i);
540             module = DecodeModule(p,chip);
541             row  = fData[p][evnt]->Row(i);
542             colm = DecodeColumn(p,chip,fData[p][evnt]->Colm(i));
543             digit[0] = row; digit[1] = colm, digit[2] = 1;
544             fITS->AddRealDigit(0,digit);
545             if(module!=oldmodule) { // New Module
546                 oldmodule= module;
547                 fLoader->TreeD()->Fill();
548                 fITS->ResetDigits();
549             } // end if
550     } // end for p
551     fITS->ClearModules();
552     fLoader->TreeD()->GetEntries();
553     fLoader->TreeD()->AutoSave();
554     fLoader->TreeD()->Reset();
555 }
556 //----------------------------------------------------------------------
557 void AliITSspdTestBeam::PrintHeadder(ostream *os){
558     // Prints the Run Headder.
559     // Inputs:
560     //    ostream *os    Output stream where the data should go to
561     // Outputs:
562     //    none.
563     // Return:
564     //    none.
565     fRH.Print(os);
566 }
567 //----------------------------------------------------------------------
568 void AliITSspdTestBeam::PrintTrailer(ostream *os){
569     // Prints the Run Trailer.
570     // Inputs:
571     //    ostream *os    Output stream where the data should go to
572     // Outputs:
573     //    none.
574     // Return:
575     //    none.
576     fRT.Print(os);
577 }
578 //----------------------------------------------------------------------
579 void AliITSspdTestBeam::PrintBurstInfo(Int_t i,ostream *os){
580     // Prints the specified burts information
581     // Inputs:
582     //    Int_t    i     Specifies which burst to print.
583     //    ostream *os    Output stream where the data should go to
584     // Outputs:
585     //    none.
586     // Return:
587     //    none.
588     fBrst[i]->Print(os);
589 }
590 //----------------------------------------------------------------------
591 void AliITSspdTestBeam::PrintEventData(Int_t evnt,ostream *os){
592     // Prints the data for a specified event number.
593     // Inputs:
594     //    Int_t   evnt   events number
595     //    ostream *os    Output stream where the data should go to
596     // Outputs:
597     //    none.
598     // Return:
599     //    none.
600     Int_t p,i;
601
602     for(p=0;p<GetNumberOfPilots();p++)
603         for(i=0;i<fNData[p][evnt];i++){
604             *os << "Pilot=" << setw(3) << p << " ";
605             fData[p][evnt]->Print(os,i);
606             *os << endl;
607     } // end for p
608 }
609 //----------------------------------------------------------------------
610 void AliITSspdTestBeam::PrintEventHead(Int_t evnt,ostream *os){
611     // Prints the data Headder for a specified event number.
612     // Inputs:
613     //    Int_t   evnt   events number
614     //    ostream *os    Output stream where the data should go to
615     // Outputs:
616     //    none.
617     // Return:
618     //    none.
619     Int_t p;
620
621     for(p=0;p<GetNumberOfPilots();p++){
622             *os << "Pilot=" << setw(3) << p << " " << *(fHData[p][evnt]);
623     } // end for p
624 }
625 //----------------------------------------------------------------------
626 void AliITSspdTestBeam::PrintEventTail(Int_t evnt,ostream *os){
627     // Prints the data Trailer for a specified event number.
628     // Inputs:
629     //    Int_t   evnt   events number
630     //    ostream *os    Output stream where the data should go to
631     // Outputs:
632     //    none.
633     // Return:
634     //    none.
635     Int_t p;
636
637     for(p=0;p<GetNumberOfPilots();p++){
638             *os << "Pilot=" << setw(3) << p << " " << *(fTData[p][evnt]);
639     } // end for p
640 }
641 //============================================================================
642 void AliITSTestBeamData::Swapit(Int_t i,UChar_t *a){
643     // Swap the order of the bits
644     // Inputs:
645     //    Int_t   i  Size of UChar_t array a.
646     //    UChar_t a  Array of bytes to be swapped.
647     // Outputs:
648     //    UChar_t a  Array with bytes swapped
649     // Return:
650     //    none.
651     Int_t j;
652     UChar_t c[i];
653
654     for(j=0;j<i;j++) c[j] = a[i-j-1];
655     for(j=0;j<i;j++) a[j] = c[j];
656 }
657 //============================================================================
658 void AliITSspdTestBeamHeader::Print(ostream *os){
659     // print out the header information
660     // Inputs:
661     //    ostream *os  Pointer to the output stream.
662     // Outputs:
663     //    none.
664     // Return:
665     //    none.
666 /*
667 #if defined __GNUC__
668 #if __GNUC__ > 2
669     ios::fmtflags fmt;
670 #else
671     Int_t fmt;
672 #endif
673 #else
674 #if defined __ICC || defined __ECC
675     ios::fmtflags fmt;
676 #else
677     Int_t fmt;
678 #endif
679 #endif
680 */
681     *os<<"Version: "<<GetVersion()<<" Written: "<<fUnion->fHead.fDate;
682     *os<<" " << fUnion->fHead.fTime << endl;
683     *os<<"Buffer Size [0], [1], [2]: " << GetBuffSize(0) << ",";
684     *os<<GetBuffSize(1)<<"," <<GetBuffSize(2) << endl;
685     *os<<"Test Pulse: " << GetTestPulse() << endl;
686     *os<<"Trigger Mode General, [0], [1], [2]: " << GetTriggerMode();
687     *os<<","<<GetTrigger(0)<<","<<GetTrigger(1)<< ",";
688     *os<<GetTrigger(2) << endl;
689     *os<<"Number of Events: " << GetNumberOfEvents() << " Burst Size: ";
690     *os<<GetBurstSize() << endl;
691     return;
692 }
693 //----------------------------------------------------------------------
694 ostream &operator<<(ostream &os,AliITSspdTestBeamHeader &p){
695     // Standard output operator. See Print
696     // Inputs:
697     //    ostream                 &os  the output stream.
698     //    AliITSspdTestBeamHeader &p   the data to be printed out.
699     // Outputs:
700     //    none.
701     // Return:
702     //    ostream &os pointing now to the end of the present stream.
703
704     p.Print(&os);
705     return os;
706 }
707 //============================================================================
708 void AliITSspdTestBeamTail::Print(ostream *os){
709     // print out the Tail information
710     // Inputs:
711     //    ostream *os  Pointer to the output stream.
712     // Outputs:
713     //    none.
714     // Return:
715     //    none.
716 /*
717 #if defined __GNUC__
718 #if __GNUC__ > 2
719     ios::fmtflags fmt;
720 #else
721     Int_t fmt;
722 #endif
723 #else
724 #if defined __ICC || defined __ECC
725     ios::fmtflags fmt;
726 #else
727     Int_t fmt;
728 #endif
729 #endif
730 */
731     *os << "Number of Events: "<< GetNumberOfEvents() << " Written: "
732         << fUnion->fTail.fDate;
733     *os << " " << fUnion->fTail.fTime << endl;
734     *os <<"Termination Flag: " << GetTermMode() << endl; 
735     return;
736 }
737 //----------------------------------------------------------------------
738 ostream &operator<<(ostream &os,AliITSspdTestBeamTail &p){
739     // Standard output operator. See Print
740     // Inputs:
741     //    ostream                 &os  the output stream.
742     //    AliITSspdTestBeamHeader &p   the data to be printed out.
743     // Outputs:
744     //    none.
745     // Return:
746     //    ostream &os pointing now to the end of the present stream.
747
748     p.Print(&os);
749     return os;
750 }
751 //============================================================================
752 void AliITSspdTestBeamBurst::Print(ostream *os){
753     // print out the Burst information
754     // Inputs:
755     //    ostream *os  Pointer to the output stream.
756     // Outputs:
757     //    none.
758     // Return:
759     //    none.
760 /*
761 #if defined __GNUC__
762 #if __GNUC__ > 2
763     ios::fmtflags fmt;
764 #else
765     Int_t fmt;
766 #endif
767 #else
768 #if defined __ICC || defined __ECC
769     ios::fmtflags fmt;
770 #else
771     Int_t fmt;
772 #endif
773 #endif
774 */
775     *os << "Burst Number: "<< GetEventNumber()<< " Transfers: " 
776         << GetTransfers() << endl; 
777     return;
778 }
779 //----------------------------------------------------------------------
780 ostream &operator<<(ostream &os,AliITSspdTestBeamBurst &p){
781     // Standard output operator. See Print
782     // Inputs:
783     //    ostream                 &os  the output stream.
784     //    AliITSspdTestBeamHeader &p   the data to be printed out.
785     // Outputs:
786     //    none.
787     // Return:
788     //    ostream &os pointing now to the end of the present stream.
789
790     p.Print(&os);
791     return os;
792 }
793 //======================================================================
794 void AliITSspdTestBeamData::Print(ostream *os,Int_t i){
795     // print out the the Test Beam Data information
796     // Inputs:
797     //    ostream *os  Pointer to the output stream.
798     // Outputs:
799     //    none.
800     // Return:
801     //    none.
802 /*
803 #if defined __GNUC__
804 #if __GNUC__ > 2
805     ios::fmtflags fmt;
806 #else
807     Int_t fmt;
808 #endif
809 #else
810 #if defined __ICC || defined __ECC
811     ios::fmtflags fmt;
812 #else
813     Int_t fmt;
814 #endif
815 #endif
816 */
817   //*os << "Word=" << hex << (fUnion+i)->fBuf[0] << hex << (fUnion+i)->fBuf[1] 
818   //               << hex << (fUnion+i)->fBuf[2] << hex << (fUnion+i)->fBuf[3]
819     *os << "Word=" << hex << (fUnion+i)->fIBuff
820         << dec;
821     switch (this->Mode(i)){
822     case AliITSTestBeamData::kData :
823         *os << " kData chip=" << setw(3) << Chip(i); 
824         *os << " Row="        << setw(3) << Row(i);
825         *os << " Column="     << setw(3) << Colm(i);
826         break;
827     case AliITSTestBeamData::kHead :
828         *os << " kHead Event Sync =" << EventCounter();
829         break;
830     case AliITSTestBeamData::kTail  :
831         *os << " kTail Transmitted word count =" << TransWordCount();
832         break;
833     case AliITSTestBeamData::kAbort :
834         *os << " kAbort Transmitted word count =" << TransWordCount();
835         break;
836     default:
837         *os << " Unknown Data Type"; 
838         break;
839     } // end switch
840     *os << endl;
841     return;
842 }
843 //----------------------------------------------------------------------
844 ostream &operator<<(ostream &os,AliITSspdTestBeamData &p){
845     // Standard output operator. See Print
846     // Inputs:
847     //    ostream                 &os  the output stream.
848     //    AliITSspdTestBeamHeader &p   the data to be printed out.
849     // Outputs:
850     //    none.
851     // Return:
852     //    ostream &os pointing now to the end of the present stream.
853
854     p.Print(&os,0);
855     return os;
856 }