]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONRawDigit.C
Added copy constructor and assignement operator (I. Hrivnacova)
[u/mrichter/AliRoot.git] / MUON / MUONRawDigit.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include "iostream.h"
3 #include "/home/alice/guernane/date/tmp/ionlx/event.h"
4 #include "/home/alice/guernane/date/tmp/ionlx/monitor.h"
5 #endif
6
7 //=======================================================================
8 //
9 // The following macro is used to read raw data from run#.raw files 
10 // generated by DATE acquisition package. It was written using
11 // Guy Jacquet (IPN Lyon) monitoring code. 
12 //
13 // 1-Feb-2000 Rachid GUERNANE, IPN Lyon, France
14 //
15 //
16
17 void MUONRawDigit (Int_t evNumber1 = 0, Int_t evNumber2 = 0, char* dataSource="/home/alice/guernane/test/run3403_Linux.raw") 
18 {
19
20 //  Dynamically link some shared libs
21
22     if (gClassTable->GetID("AliRun") < 0) {
23         gROOT->LoadMacro("loadlibs.C");
24         loadlibs();
25     }
26
27 //  Connect the Root Galice file containing Geometry, Kine and Hits
28
29     TFile* file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root");
30     if (file) file->Close(); 
31     file = new TFile("galice.root", "UPDATE");
32     
33 //  Get AliRun object from file or create it if not on file
34
35     if (!gAlice) {
36         gAlice = (AliRun*)file->Get("gAlice");
37         if (gAlice) printf("AliRun object found on file\n");
38         if (!gAlice) gAlice = new AliRun("gAlice","Alice test program");
39     }
40
41     AliMUONv2* MUON = (AliMUONv2*)gAlice->GetModule("MUON");
42     
43 //
44 //  Start Event Loop
45 //
46
47     static int ilen;
48     int status;
49     
50         
51     status = monitorSetDataSource(dataSource);
52
53     if (status != 0) {
54         fprintf( stderr,                            
55                  "Error in monitorSetDataSource: %s\n",
56                  monitorSetDataSource(status));
57     }
58     
59     status = monitorDeclareMp("Retrieve Raw Data");
60         
61     if (status != 0) {
62         fprintf( stderr,                
63                  "Error in monitorDeclareMp: %s\n",
64                  monitorSetDataSource(status));
65     }
66     
67     Int_t nev = 0;
68     Int_t iev = 0;
69     
70     for (; iev <= evNumber2 && nev < evNumber2*20; nev++) {
71
72 //
73 // Raw event decoding
74 //
75         
76         void *ptr;
77         struct eventStruct *rawevent;
78         
79         status = monitorGetEventDynamic(&ptr);
80
81         if (status != 0) {
82             fprintf( stderr,
83                      "Error in monitorGetEventDynamic: %s\n",
84                      monitorDecodeError(status));  
85             exit(1);
86         }
87         
88         rawevent = (struct eventStruct*)ptr;        
89         
90         ilen = (rawevent->eventHeader.size - rawevent->eventHeader.headLen)/4;
91         
92         if (rawevent->eventHeader.type == PHYSICS_EVENT) {
93             iev = rawevent->eventHeader.nbInRun;
94             gAlice->GetEvent(iev-1);
95             printf("\nEvent No.: %d\n", iev);
96             printf("--------------------------------------------\n");  
97
98             int* lptr = (int*)&rawevent->rawData[0];
99             
100             MUON->GetRawDigits(iev-1, lptr, ilen);
101             
102         }
103         
104         free(ptr);
105
106     }
107 //
108 // End Event loop 
109 //
110     
111     file->Close();
112
113 }
114
115
116
117
118
119
120
121
122
123
124
125
126
127