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 "AliRawReaderDate.h"
40 #include "AliRawReaderFile.h"
41 #include "AliRawReaderRoot.h"
44 #include "AliMUONRawStreamTrigger.h"
45 #include "AliMUONDarcHeader.h"
46 #include "AliMUONRegHeader.h"
47 #include "AliMUONLocalStruct.h"
48 #include "AliMUONDDLTrigger.h"
49 #include "AliMpTriggerCrate.h"
50 #include "AliMpDDLStore.h"
53 #include "TStopwatch.h"
58 void MUONRawStreamTrigger(Int_t maxEvent = 1, Int_t minDDL = 0, Int_t maxDDL = 1, TString fileName = "./")
64 AliRawReader* rawReader = 0x0;
66 if (fileName.EndsWith("/")) {
67 rawReader = new AliRawReaderFile(fileName);// DDL files
68 } else if (fileName.EndsWith(".root")) {
69 rawReader = new AliRawReaderRoot(fileName);
74 if ( ! AliMpCDB::LoadDDLStore() ) {
75 printf("Could not access mapping from OCDB !\n");
79 AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader);
81 // set the number ofreg & local that are PRESENT in the rawdata file
82 // it's NOT the number to be read.
83 // default wise set to 8, 16 respectively.
84 // rawStream->SetMaxReg(2);
85 // rawStream->SetMaxLoc(xx);
88 AliMUONDDLTrigger* ddlTrigger = 0x0;
89 AliMUONDarcHeader* darcHeader = 0x0;
90 AliMUONRegHeader* regHeader = 0x0;
91 AliMUONLocalStruct* localStruct = 0x0;
97 while (rawReader->NextEvent()) {
99 if (iEvent == maxEvent)
102 printf("Event %d\n",iEvent++);
104 // read DDL while < 2 DDL
105 while(rawStream->NextDDL()) {
107 if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
110 printf("\niDDL %d\n", rawStream->GetDDL());
112 ddlTrigger = rawStream->GetDDLTrigger();
113 darcHeader = ddlTrigger->GetDarcHeader();
115 printf("Global output %x\n", (Int_t)darcHeader->GetGlobalOutput());
117 // loop over regional structures
118 Int_t nReg = darcHeader->GetRegHeaderEntries();
119 for(Int_t iReg = 0; iReg < nReg ;iReg++){ //REG loop
121 // printf("RegionalId %d\n", iReg);
123 regHeader = darcHeader->GetRegHeaderEntry(iReg);
124 // printf("Reg length %d\n",regHeader->GetHeaderLength());
127 AliMpTriggerCrate* crate = AliMpDDLStore::Instance()->
128 GetTriggerCrate(rawStream->GetDDL(), iReg);
130 // loop over local structures
131 Int_t nLocal = regHeader->GetLocalEntries();
132 for(Int_t iLocal = 0; iLocal < nLocal; iLocal++) {
134 localStruct = regHeader->GetLocalEntry(iLocal);
136 Int_t iLocCard = crate->GetLocalBoardId(localStruct->GetId());
138 if ( !iLocCard ) continue; // empty slot
141 if (localStruct->GetTriggerX()
142 || localStruct->GetTriggerY()) { // no empty data
144 printf("LocalId %d\n", localStruct->GetId());
146 Int_t loStripX = (Int_t)localStruct->GetXPos();
147 Int_t loStripY = (Int_t)localStruct->GetYPos();
148 Int_t loDev = (Int_t)localStruct->GetXDev();
150 printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", iLocCard, loStripX, loStripY, loDev);
166 void MUONRawStreamTriggerSimple(Int_t maxEvent = 1, TString fileName = "./")
168 /// Reads the raw data in fileName, using a simplified interface (iterator
169 /// over local structure response).
174 AliRawReader* rawReader = 0x0;
176 if (fileName.EndsWith("/")) {
177 rawReader = new AliRawReaderFile(fileName);// DDL files
178 } else if (fileName.EndsWith(".root")) {
179 rawReader = new AliRawReaderRoot(fileName);
183 AliMUONRawStreamTrigger* rawStream = new AliMUONRawStreamTrigger(rawReader);
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);
209 while (rawReader->NextEvent()) {
211 if (iEvent == maxEvent)
214 printf("Event %d\n",iEvent++);
218 // read while there are digits
219 while( rawStream->Next(id, dec, trigY, yPos, sXDev, xDev, xPos,
220 triggerX, triggerY, xPattern, yPattern) )
222 if ( triggerX || triggerY ) // no empty data
223 printf("iLocCard: %d, XPos: %d, YPos: %d Dev: %d\n", id, xPos, yPos, xDev);