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