]>
Commit | Line | Data |
---|---|---|
99e11065 | 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 | // Macro for reading tracker raw data | |
18 | // Ch. Finck, Subatech Febuary | |
19 | // | |
20 | ||
21 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
22 | ||
23 | // RAW includes | |
24 | #include "AliRawReaderDate.h" | |
25 | #include "AliRawReaderFile.h" | |
26 | #include "AliRawReaderRoot.h" | |
27 | ||
28 | // MUON includes | |
29 | #include "AliMUONRawStreamTrigger.h" | |
30 | #include "AliMUONDarcHeader.h" | |
31 | #include "AliMUONRegHeader.h" | |
32 | #include "AliMUONLocalStruct.h" | |
33 | #include "AliMUONDDLTrigger.h" | |
9d1949d2 | 34 | #include "AliMpTriggerCrate.h" |
35 | #include "AliMpDDLStore.h" | |
a89c7656 | 36 | #include "AliMpCDB.h" |
37 | ||
38 | #include "TStopwatch.h" | |
39 | ||
40 | ||
99e11065 | 41 | #endif |
42 | ||
43 | // Macro to read rawdata for trigger | |
44 | // Ch. Finck, Subatech, April. 2006 | |
a89c7656 | 45 | // Implement "digits" iterator |
99e11065 | 46 | // This macro is interface with AliRawReader for RAW |
47 | // The different stucture of the patload are readout and stored in TClonesArray | |
48 | // with AliMUONRawStreamTrigger classe. | |
49 | // The macro just simpy read again the TClonesArray contents. | |
50 | // The parameter of each structure could be seen in the container classes | |
51 | // AliMUONDarcHeader, AliMUONRegHeader, AliMUONLocalStruct. | |
52 | // The class AliMUONDDLTrigger manages the structure containers. | |
53 | // The number of structures in the rawdata file could be set. | |
a89c7656 | 54 | // The DATE format reading is no more supported please use the MUONTRGda code |
99e11065 | 55 | |
63898c67 | 56 | void MUONRawStreamTrigger(Int_t maxEvent = 1, Int_t minDDL = 0, Int_t maxDDL = 1, TString fileName = "./") |
99e11065 | 57 | { |
a89c7656 | 58 | |
59 | TStopwatch timer; | |
60 | timer.Start(kTRUE); | |
61 | ||
99e11065 | 62 | AliRawReader* rawReader = 0x0; |
63 | ||
64 | if (fileName.EndsWith("/")) { | |
65 | rawReader = new AliRawReaderFile(fileName);// DDL files | |
66 | } else if (fileName.EndsWith(".root")) { | |
67 | rawReader = new AliRawReaderRoot(fileName); | |
a89c7656 | 68 | } |
69 | ||
70 | ||
71 | // Load mapping | |
72 | if ( ! AliMpCDB::LoadDDLStore() ) { | |
73 | printf("Could not access mapping from OCDB !\n"); | |
74 | } | |
99e11065 | 75 | |
76 | // raw stream | |
77 | AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader); | |
78 | ||
a89c7656 | 79 | // set the number ofreg & local that are PRESENT in the rawdata file |
99e11065 | 80 | // it's NOT the number to be read. |
a89c7656 | 81 | // default wise set to 8, 16 respectively. |
82 | // rawStream->SetMaxReg(2); | |
99e11065 | 83 | // rawStream->SetMaxLoc(xx); |
84 | ||
85 | // containers | |
86 | AliMUONDDLTrigger* ddlTrigger = 0x0; | |
87 | AliMUONDarcHeader* darcHeader = 0x0; | |
88 | AliMUONRegHeader* regHeader = 0x0; | |
89 | AliMUONLocalStruct* localStruct = 0x0; | |
90 | ||
63898c67 | 91 | |
99e11065 | 92 | // Loop over events |
93 | Int_t iEvent = 0; | |
94 | ||
95 | while (rawReader->NextEvent()) { | |
96 | ||
97 | if (iEvent == maxEvent) | |
98 | break; | |
99 | ||
100 | printf("Event %d\n",iEvent++); | |
101 | ||
102 | // read DDL while < 2 DDL | |
103 | while(rawStream->NextDDL()) { | |
104 | ||
105 | if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL) | |
106 | continue; | |
107 | ||
108 | printf("\niDDL %d\n", rawStream->GetDDL()); | |
109 | ||
110 | ddlTrigger = rawStream->GetDDLTrigger(); | |
111 | darcHeader = ddlTrigger->GetDarcHeader(); | |
112 | ||
113 | printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput()); | |
114 | ||
115 | // loop over regional structures | |
116 | Int_t nReg = darcHeader->GetRegHeaderEntries(); | |
117 | for(Int_t iReg = 0; iReg < nReg ;iReg++){ //REG loop | |
118 | ||
a89c7656 | 119 | // printf("RegionalId %d\n", iReg); |
99e11065 | 120 | |
121 | regHeader = darcHeader->GetRegHeaderEntry(iReg); | |
122 | // printf("Reg length %d\n",regHeader->GetHeaderLength()); | |
123 | ||
9d1949d2 | 124 | // crate info |
125 | AliMpTriggerCrate* crate = AliMpDDLStore::Instance()-> | |
126 | GetTriggerCrate(rawStream->GetDDL(), iReg); | |
63898c67 | 127 | |
99e11065 | 128 | // loop over local structures |
129 | Int_t nLocal = regHeader->GetLocalEntries(); | |
130 | for(Int_t iLocal = 0; iLocal < nLocal; iLocal++) { | |
131 | ||
132 | localStruct = regHeader->GetLocalEntry(iLocal); | |
133 | ||
9d1949d2 | 134 | Int_t iLocCard = crate->GetLocalBoardId(localStruct->GetId()); |
135 | ||
136 | if ( !iLocCard ) continue; // empty slot | |
137 | ||
99e11065 | 138 | // check if trigger |
a89c7656 | 139 | if (localStruct->GetTriggerX() |
8d1deca2 | 140 | || localStruct->GetTriggerY()) { // no empty data |
99e11065 | 141 | |
a89c7656 | 142 | printf("LocalId %d\n", localStruct->GetId()); |
63898c67 | 143 | |
a89c7656 | 144 | Int_t loStripX = (Int_t)localStruct->GetXPos(); |
145 | Int_t loStripY = (Int_t)localStruct->GetYPos(); | |
146 | Int_t loDev = (Int_t)localStruct->GetXDev(); | |
147 | ||
63898c67 | 148 | printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", iLocCard, loStripX, loStripY, loDev); |
a89c7656 | 149 | |
99e11065 | 150 | } |
151 | } // iLocal | |
152 | } // iReg | |
153 | } // NextDDL | |
154 | }// NextEvent | |
155 | ||
156 | delete rawReader; | |
157 | delete rawStream; | |
a89c7656 | 158 | |
159 | timer.Print(); | |
160 | ||
161 | } | |
162 | ||
163 | ||
164 | void MUONRawStreamTriggerSimple(Int_t maxEvent = 1, TString fileName = "./") | |
165 | { | |
166 | /// Reads the raw data in fileName, using a simplified interface (iterator | |
167 | /// over local structure response). | |
168 | ||
169 | TStopwatch timer; | |
170 | timer.Start(kTRUE); | |
171 | ||
172 | AliRawReader* rawReader = 0x0; | |
173 | ||
174 | if (fileName.EndsWith("/")) { | |
175 | rawReader = new AliRawReaderFile(fileName);// DDL files | |
176 | } else if (fileName.EndsWith(".root")) { | |
177 | rawReader = new AliRawReaderRoot(fileName); | |
178 | } | |
179 | ||
180 | // raw stream | |
181 | AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader); | |
182 | ||
183 | // set the number of reg & local that are PRESENT in the rawdata file | |
184 | // it's NOT the number to be read. | |
185 | // default wise set to 8, 16 respectively. | |
186 | // rawStream->SetMaxReg(2); | |
187 | // rawStream->SetMaxLoc(xx); | |
188 | ||
189 | UChar_t id; | |
190 | UChar_t dec; | |
191 | Bool_t trigY; | |
192 | UChar_t yPos; | |
193 | UChar_t sXDev; | |
194 | UChar_t xDev; | |
195 | UChar_t xPos; | |
196 | ||
197 | Bool_t triggerX; | |
198 | Bool_t triggerY; | |
199 | ||
200 | ||
201 | TArrayS xPattern; | |
202 | TArrayS yPattern; | |
203 | ||
204 | // Loop over events | |
205 | Int_t iEvent = 0; | |
206 | ||
207 | while (rawReader->NextEvent()) { | |
208 | ||
209 | if (iEvent == maxEvent) | |
210 | break; | |
211 | ||
212 | printf("Event %d\n",iEvent++); | |
213 | ||
214 | rawStream->First(); | |
215 | ||
216 | // read while there are digits | |
217 | while( rawStream->Next(id, dec, trigY, yPos, sXDev, xDev, xPos, | |
218 | triggerX, triggerY, xPattern, yPattern) ) | |
219 | { | |
220 | if ( triggerX || triggerY ) // no empty data | |
221 | printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", id, xPos, yPos, xDev); | |
222 | ||
223 | }// Next | |
224 | ||
225 | }// NextEvent | |
226 | ||
227 | delete rawReader; | |
228 | delete rawStream; | |
229 | ||
230 | timer.Print(); | |
231 | ||
99e11065 | 232 | } |