]>
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" | |
63898c67 | 34 | #include "AliMUONTriggerCrateStore.h" |
35 | #include "AliMUONTriggerCrate.h" | |
36 | #include "AliMUONLocalTriggerBoard.h" | |
99e11065 | 37 | |
38 | #endif | |
39 | ||
40 | // Macro to read rawdata for trigger | |
41 | // Ch. Finck, Subatech, April. 2006 | |
42 | // | |
43 | // This macro is interface with AliRawReader for RAW | |
44 | // The different stucture of the patload are readout and stored in TClonesArray | |
45 | // with AliMUONRawStreamTrigger classe. | |
46 | // The macro just simpy read again the TClonesArray contents. | |
47 | // The parameter of each structure could be seen in the container classes | |
48 | // AliMUONDarcHeader, AliMUONRegHeader, AliMUONLocalStruct. | |
49 | // The class AliMUONDDLTrigger manages the structure containers. | |
50 | // The number of structures in the rawdata file could be set. | |
51 | ||
63898c67 | 52 | void MUONRawStreamTrigger(Int_t maxEvent = 1, Int_t minDDL = 0, Int_t maxDDL = 1, TString fileName = "./") |
99e11065 | 53 | { |
54 | AliRawReader* rawReader = 0x0; | |
55 | ||
56 | if (fileName.EndsWith("/")) { | |
57 | rawReader = new AliRawReaderFile(fileName);// DDL files | |
58 | } else if (fileName.EndsWith(".root")) { | |
59 | rawReader = new AliRawReaderRoot(fileName); | |
60 | } else if (!fileName.IsNull()) { | |
61 | rawReader = new AliRawReaderDate(fileName);// DATE file | |
62 | } | |
63 | ||
64 | // raw stream | |
65 | AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader); | |
66 | ||
67 | // set the number of DDL reg & local that are PRESENT in the rawdata file | |
68 | // it's NOT the number to be read. | |
69 | // default wise set to 2, 8, 16 respectively. | |
70 | // rawStream->SetMaxDDL(xx); | |
71 | // rawStream->SetMaxReg(xx); | |
72 | // rawStream->SetMaxLoc(xx); | |
73 | ||
74 | // containers | |
75 | AliMUONDDLTrigger* ddlTrigger = 0x0; | |
76 | AliMUONDarcHeader* darcHeader = 0x0; | |
77 | AliMUONRegHeader* regHeader = 0x0; | |
78 | AliMUONLocalStruct* localStruct = 0x0; | |
79 | ||
63898c67 | 80 | // crate manager |
81 | AliMUONTriggerCrateStore* crateManager = new AliMUONTriggerCrateStore(); | |
82 | crateManager->ReadFromFile(); | |
83 | ||
99e11065 | 84 | // Loop over events |
85 | Int_t iEvent = 0; | |
86 | ||
87 | while (rawReader->NextEvent()) { | |
88 | ||
89 | if (iEvent == maxEvent) | |
90 | break; | |
91 | ||
92 | printf("Event %d\n",iEvent++); | |
93 | ||
94 | // read DDL while < 2 DDL | |
95 | while(rawStream->NextDDL()) { | |
96 | ||
97 | if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL) | |
98 | continue; | |
99 | ||
100 | printf("\niDDL %d\n", rawStream->GetDDL()); | |
101 | ||
102 | ddlTrigger = rawStream->GetDDLTrigger(); | |
103 | darcHeader = ddlTrigger->GetDarcHeader(); | |
104 | ||
105 | printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput()); | |
106 | ||
107 | // loop over regional structures | |
108 | Int_t nReg = darcHeader->GetRegHeaderEntries(); | |
109 | for(Int_t iReg = 0; iReg < nReg ;iReg++){ //REG loop | |
110 | ||
111 | printf("RegionalId %d\n", iReg); | |
112 | ||
113 | regHeader = darcHeader->GetRegHeaderEntry(iReg); | |
114 | // printf("Reg length %d\n",regHeader->GetHeaderLength()); | |
115 | ||
63898c67 | 116 | // crate info |
117 | AliMUONTriggerCrate* crate = crateManager->Crate(rawStream->GetDDL(), iReg); | |
118 | TObjArray *boards = crate->Boards(); | |
119 | ||
99e11065 | 120 | // loop over local structures |
121 | Int_t nLocal = regHeader->GetLocalEntries(); | |
122 | for(Int_t iLocal = 0; iLocal < nLocal; iLocal++) { | |
123 | ||
124 | localStruct = regHeader->GetLocalEntry(iLocal); | |
125 | ||
126 | // check if trigger | |
127 | if (localStruct->GetTriggerY() == 0) { // no empty data | |
128 | ||
63898c67 | 129 | // local trigger circuit number |
130 | AliMUONLocalTriggerBoard* localBoard = (AliMUONLocalTriggerBoard*)boards->At(iLocal+1); | |
131 | ||
132 | printf("LocalId %d\n", localStruct->GetId()); | |
99e11065 | 133 | |
63898c67 | 134 | Int_t iLocCard = localBoard->GetNumber(); |
135 | Int_t loStripX = (Int_t)localStruct->GetXPos(); | |
136 | Int_t loStripY = (Int_t)localStruct->GetYPos(); | |
137 | Int_t loDev = (Int_t)localStruct->GetXDev(); | |
99e11065 | 138 | |
63898c67 | 139 | printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", iLocCard, loStripX, loStripY, loDev); |
99e11065 | 140 | } |
141 | } // iLocal | |
142 | } // iReg | |
143 | } // NextDDL | |
144 | }// NextEvent | |
145 | ||
146 | delete rawReader; | |
147 | delete rawStream; | |
148 | } |