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