1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
17 // Macro for reading tracker raw data
18 // Ch. Finck, Subatech Febuary
21 #if !defined(__CINT__) || defined(__MAKECINT__)
24 #include "AliRawReaderDate.h"
25 #include "AliRawReaderFile.h"
26 #include "AliRawReaderRoot.h"
29 #include "AliMUONRawStreamTrigger.h"
30 #include "AliMUONDarcHeader.h"
31 #include "AliMUONRegHeader.h"
32 #include "AliMUONLocalStruct.h"
33 #include "AliMUONDDLTrigger.h"
34 #include "AliMpTriggerCrate.h"
35 #include "AliMpDDLStore.h"
38 #include "TStopwatch.h"
43 // Macro to read rawdata for trigger
44 // Ch. Finck, Subatech, April. 2006
45 // Implement "digits" iterator
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.
54 // The DATE format reading is no more supported please use the MUONTRGda code
56 void MUONRawStreamTrigger(Int_t maxEvent = 1, Int_t minDDL = 0, Int_t maxDDL = 1, TString fileName = "./")
62 AliRawReader* rawReader = 0x0;
64 if (fileName.EndsWith("/")) {
65 rawReader = new AliRawReaderFile(fileName);// DDL files
66 } else if (fileName.EndsWith(".root")) {
67 rawReader = new AliRawReaderRoot(fileName);
72 if ( ! AliMpCDB::LoadDDLStore() ) {
73 printf("Could not access mapping from OCDB !\n");
77 AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader);
79 // set the number ofreg & local that are PRESENT in the rawdata file
80 // it's NOT the number to be read.
81 // default wise set to 8, 16 respectively.
82 // rawStream->SetMaxReg(2);
83 // rawStream->SetMaxLoc(xx);
86 AliMUONDDLTrigger* ddlTrigger = 0x0;
87 AliMUONDarcHeader* darcHeader = 0x0;
88 AliMUONRegHeader* regHeader = 0x0;
89 AliMUONLocalStruct* localStruct = 0x0;
95 while (rawReader->NextEvent()) {
97 if (iEvent == maxEvent)
100 printf("Event %d\n",iEvent++);
102 // read DDL while < 2 DDL
103 while(rawStream->NextDDL()) {
105 if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
108 printf("\niDDL %d\n", rawStream->GetDDL());
110 ddlTrigger = rawStream->GetDDLTrigger();
111 darcHeader = ddlTrigger->GetDarcHeader();
113 printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput());
115 // loop over regional structures
116 Int_t nReg = darcHeader->GetRegHeaderEntries();
117 for(Int_t iReg = 0; iReg < nReg ;iReg++){ //REG loop
119 // printf("RegionalId %d\n", iReg);
121 regHeader = darcHeader->GetRegHeaderEntry(iReg);
122 // printf("Reg length %d\n",regHeader->GetHeaderLength());
125 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->
126 GetTriggerCrate(rawStream->GetDDL(), iReg);
128 // loop over local structures
129 Int_t nLocal = regHeader->GetLocalEntries();
130 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++) {
132 localStruct = regHeader->GetLocalEntry(iLocal);
134 Int_t iLocCard = crate->GetLocalBoardId(localStruct->GetId());
136 if ( !iLocCard ) continue; // empty slot
139 if (localStruct->GetTriggerX()
140 || localStruct->GetTriggerY()) { // no empty data
142 printf("LocalId %d\n", localStruct->GetId());
144 Int_t loStripX = (Int_t)localStruct->GetXPos();
145 Int_t loStripY = (Int_t)localStruct->GetYPos();
146 Int_t loDev = (Int_t)localStruct->GetXDev();
148 printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", iLocCard, loStripX, loStripY, loDev);
164 void MUONRawStreamTriggerSimple(Int_t maxEvent = 1, TString fileName = "./")
166 /// Reads the raw data in fileName, using a simplified interface (iterator
167 /// over local structure response).
172 AliRawReader* rawReader = 0x0;
174 if (fileName.EndsWith("/")) {
175 rawReader = new AliRawReaderFile(fileName);// DDL files
176 } else if (fileName.EndsWith(".root")) {
177 rawReader = new AliRawReaderRoot(fileName);
181 AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader);
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);
207 while (rawReader->NextEvent()) {
209 if (iEvent == maxEvent)
212 printf("Event %d\n",iEvent++);
216 // read while there are digits
217 while( rawStream->Next(id, dec, trigY, yPos, sXDev, xDev, xPos,
218 triggerX, triggerY, xPattern, yPattern) )
220 if ( triggerX || triggerY ) // no empty data
221 printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", id, xPos, yPos, xDev);