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 "AliMUONRawStreamTracker.h"
30 #include "AliMUONDspHeader.h"
31 #include "AliMUONBlockHeader.h"
32 #include "AliMUONBusStruct.h"
33 #include "AliMUONDDLTracker.h"
38 // Macro to read rawdata for tracker
39 // Ch. Finck, Subatech, April. 2006
41 // This macro is interface with AliRawReader for RAW
42 // The different stucture of the patload are readout and stored in TClonesArray
43 // with AliMUONRawStreamTracker classe.
44 // The macro just simpy read again the TClonesArray contents.
45 // The parameter of each structure could be seen in the container classes
46 // AliMUONBlockHeader, AliMUONBlockHeader, AliMUONBusStruct.
47 // The class AliMUONDDLTracker manages the structure containers.
48 // The number of structures in the rawdata file could be set.
50 void MUONRawStreamTracker(Int_t maxEvent = 1000, Int_t minDDL = 0, Int_t maxDDL = 19, TString fileName = "./")
52 AliRawReader* rawReader = 0x0;
54 // check extention to choose the rawdata file format
55 if (fileName.EndsWith("/")) {
56 rawReader = new AliRawReaderFile(fileName); // DDL files
57 } else if (fileName.EndsWith(".root")) {
58 rawReader = new AliRawReaderRoot(fileName);
59 } else if (!fileName.IsNull()) {
60 rawReader = new AliRawReaderDate(fileName); // DATE file
64 AliMUONRawStreamTracker* rawStream = new AliMUONRawStreamTracker(rawReader);
66 // set the number of DDL block Dsp & buspatch structures that are PRESENT in the rawdata file
67 // it's NOT the number to be read.
68 // default wise set to 20, 2, 5 ans 5 respectively.
69 // rawStream->SetMaxDDL(xx);
70 // rawStream->SetMaxBlock(xx);
71 // rawStream->SetMaxDsp(xx);
72 // rawStream->SetMaxBus(xx);
75 AliMUONDDLTracker* ddlTracker = 0x0;
76 AliMUONBlockHeader* blkHeader = 0x0;
77 AliMUONDspHeader* dspHeader = 0x0;
78 AliMUONBusStruct* busStruct = 0x0;
84 while (rawReader->NextEvent()) {
86 if (iEvent == maxEvent)
89 printf("Event %d\n",iEvent++);
91 // read DDL while < 20 DDL
92 while(rawStream->NextDDL()) {
94 if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
97 printf("\niDDL %d\n", rawStream->GetDDL());
99 ddlTracker = rawStream->GetDDLTracker();
101 // loop over block structure
102 Int_t nBlock = ddlTracker->GetBlkHeaderEntries();
103 for(Int_t iBlock = 0; iBlock < nBlock ;iBlock++){
105 blkHeader = ddlTracker->GetBlkHeaderEntry(iBlock);
106 printf("Block Total length %d\n",blkHeader->GetTotalLength());
108 // loop over DSP structure
109 Int_t nDsp = blkHeader->GetDspHeaderEntries();
110 for(Int_t iDsp = 0; iDsp < nDsp ;iDsp++){ //DSP loop
112 dspHeader = blkHeader->GetDspHeaderEntry(iDsp);
113 // printf("Dsp length %d even word %d\n",dspHeader->GetTotalLength(), dspHeader->GetEventWord());
115 // loop over BusPatch structure
116 Int_t nBusPatch = dspHeader->GetBusPatchEntries();
117 for(Int_t iBusPatch = 0; iBusPatch < nBusPatch; iBusPatch++) {
119 busStruct = dspHeader->GetBusPatchEntry(iBusPatch);
121 printf("busPatchId %d", busStruct->GetBusPatchId());
122 printf(" BlockId %d", busStruct->GetBlockId());
123 printf(" DspId %d\n", busStruct->GetDspId());
126 dataSize = busStruct->GetLength();
127 for (Int_t iData = 0; iData < dataSize; iData++) {
129 Int_t manuId = busStruct->GetManuId(iData);
130 Int_t channelId = busStruct->GetChannelId(iData);
131 Int_t charge = busStruct->GetCharge(iData);
132 printf("manuId: %d, channelId: %d charge: %d\n", manuId,