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 **************************************************************************/
19 /// \file MUONRawStreamTrigger.C
20 /// \brief Macro for reading trigger raw data
22 /// \author Ch. Finck, Subatech, April 2006
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.
36 #if !defined(__CINT__) || defined(__MAKECINT__)
39 #include "AliRawReader.h"
42 #include "AliMUONRawStreamTrigger.h"
43 #include "AliMUONDarcHeader.h"
44 #include "AliMUONRegHeader.h"
45 #include "AliMUONLocalStruct.h"
46 #include "AliMUONDDLTrigger.h"
47 #include "AliMpTriggerCrate.h"
48 #include "AliMpDDLStore.h"
51 #include "TStopwatch.h"
56 void MUONRawStreamTrigger(Int_t maxEvent = 1, Int_t minDDL = 0, Int_t maxDDL = 1, TString fileName = "./")
62 AliRawReader* rawReader = AliRawReader::Create(fileName.Data());
65 if ( ! AliMpCDB::LoadDDLStore() ) {
66 printf("Could not access mapping from OCDB !\n");
70 AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader);
72 // set the number ofreg & local that are PRESENT in the rawdata file
73 // it's NOT the number to be read.
74 // default wise set to 8, 16 respectively.
75 // rawStream->SetMaxReg(2);
76 // rawStream->SetMaxLoc(xx);
79 AliMUONDDLTrigger* ddlTrigger = 0x0;
80 AliMUONDarcHeader* darcHeader = 0x0;
81 AliMUONRegHeader* regHeader = 0x0;
82 AliMUONLocalStruct* localStruct = 0x0;
88 while (rawReader->NextEvent()) {
90 if (iEvent == maxEvent)
93 printf("Event %d\n",iEvent++);
95 // read DDL while < 2 DDL
96 while(rawStream->NextDDL()) {
98 if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
101 printf("\niDDL %d\n", rawStream->GetDDL());
103 ddlTrigger = rawStream->GetDDLTrigger();
104 darcHeader = ddlTrigger->GetDarcHeader();
106 printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput());
108 // loop over regional structures
109 Int_t nReg = darcHeader->GetRegHeaderEntries();
110 for(Int_t iReg = 0; iReg < nReg ;iReg++){ //REG loop
112 // printf("RegionalId %d\n", iReg);
114 regHeader = darcHeader->GetRegHeaderEntry(iReg);
115 // printf("Reg length %d\n",regHeader->GetHeaderLength());
118 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->
119 GetTriggerCrate(rawStream->GetDDL(), iReg);
121 // loop over local structures
122 Int_t nLocal = regHeader->GetLocalEntries();
123 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++) {
125 localStruct = regHeader->GetLocalEntry(iLocal);
127 Int_t iLocCard = crate->GetLocalBoardId(localStruct->GetId());
129 if ( !iLocCard ) continue; // empty slot
132 if (localStruct->GetTriggerX()
133 || localStruct->GetTriggerY()) { // no empty data
135 printf("LocalId %d\n", localStruct->GetId());
137 Int_t loStripX = (Int_t)localStruct->GetXPos();
138 Int_t loStripY = (Int_t)localStruct->GetYPos();
139 Int_t loDev = (Int_t)localStruct->GetXDev();
141 printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", iLocCard, loStripX, loStripY, loDev);
157 void MUONRawStreamTriggerSimple(Int_t maxEvent = 1, TString fileName = "./")
159 /// Reads the raw data in fileName, using a simplified interface (iterator
160 /// over local structure response).
165 AliRawReader* rawReader = 0x0;
167 if (fileName.EndsWith("/")) {
168 rawReader = new AliRawReaderFile(fileName);// DDL files
169 } else if (fileName.EndsWith(".root")) {
170 rawReader = new AliRawReaderRoot(fileName);
174 AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader);
176 // set the number of reg & local that are PRESENT in the rawdata file
177 // it's NOT the number to be read.
178 // default wise set to 8, 16 respectively.
179 // rawStream->SetMaxReg(2);
180 // rawStream->SetMaxLoc(xx);
200 while (rawReader->NextEvent()) {
202 if (iEvent == maxEvent)
205 printf("Event %d\n",iEvent++);
209 // read while there are digits
210 while( rawStream->Next(id, dec, trigY, yPos, sXDev, xDev, xPos,
211 triggerX, triggerY, xPattern, yPattern) )
213 if ( triggerX || triggerY ) // no empty data
214 printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", id, xPos, yPos, xDev);