]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONDateStreamTracker.C
corrected Print method
[u/mrichter/AliRoot.git] / MUON / MUONDateStreamTracker.C
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
26 // MUON includes
27 #include "AliMUONRawStreamTracker.h"
28 #include "AliMUONDspHeader.h"
29 #include "AliMUONBlockHeader.h"
30 #include "AliMUONBusStruct.h"
31 #include "AliMUONDDLTracker.h"
32
33 #endif
34
35
36 // Macro to read rawdata for tracker
37 // Ch. Finck, Subatech, April. 2006
38 //
39 // This macro is interface with AliRawReader for RAW
40 // The different stucture of the patload are readout and stored in TClonesArray
41 // with AliMUONRawStreamTracker classe.
42 // The macro just simpy read again the TClonesArray contents.
43 // The parameter of each structure could be seen in the container classes
44 // AliMUONBlockHeader, AliMUONBlockHeader, AliMUONBusStruct.
45 // The class AliMUONDDLTracker manages the structure containers.
46 // The number of structures in the rawdata file could be set.
47
48 void MUONDateStreamTracker(Int_t maxEvent = 1000, Int_t minDDL = 0, Int_t maxDDL = 0, 
49                            TString fileName = "run330.raw", Int_t eventType = 0 )
50 {
51
52   // eventType = 7 for DATE file generated from AliRoot
53   // eventType = 0 for DATE file from Nantes test bench
54   // rawReader->SelectEquipment(17, 212, 212); 
55   AliRawReader* rawReader = new AliRawReaderDate(fileName,eventType);// DATE file
56
57    // raw stream
58    AliMUONRawStreamTracker* rawStream  = new AliMUONRawStreamTracker(rawReader);    
59
60    // set the number of DDL block Dsp & buspatch structures that are PRESENT in the rawdata file
61    // it's NOT the number to be read.
62    // default wise set to 20, 2, 5 ans 5 respectively.
63    rawStream->SetMaxDDL(1);
64    rawStream->SetMaxBlock(2);
65    rawStream->SetMaxDsp(5);
66    rawStream->SetMaxBus(50);
67
68    // containers
69    AliMUONDDLTracker*       ddlTracker = 0x0;
70    AliMUONBlockHeader*      blkHeader  = 0x0;
71    AliMUONDspHeader*        dspHeader  = 0x0;
72    AliMUONBusStruct*        busStruct  = 0x0;
73
74    //   Loop over events  
75    Int_t iEvent = 0;
76    Int_t dataSize;
77
78    do {
79
80      if (iEvent == maxEvent)
81        break;
82
83      printf("Event %d\n",iEvent++);
84
85      // read DDL while < 20 DDL
86      while(rawStream->NextDDL()) {
87
88        if (rawStream->GetDDL() < minDDL || rawStream->GetDDL() > maxDDL)
89          continue;
90
91        printf("\niDDL %d\n", rawStream->GetDDL());
92
93        ddlTracker =  rawStream->GetDDLTracker();
94
95        // loop over block structure
96        Int_t nBlock = ddlTracker->GetBlkHeaderEntries();
97        for(Int_t iBlock = 0; iBlock < nBlock ;iBlock++){
98
99          blkHeader = ddlTracker->GetBlkHeaderEntry(iBlock);
100          printf("Block Total length %d\n",blkHeader->GetTotalLength());
101
102          // loop over DSP structure
103          Int_t nDsp = blkHeader->GetDspHeaderEntries();
104          for(Int_t iDsp = 0; iDsp < nDsp ;iDsp++){   //DSP loop
105
106            dspHeader =  blkHeader->GetDspHeaderEntry(iDsp);
107            printf("Dsp length %d\n",dspHeader->GetTotalLength());
108
109            // loop over BusPatch structure
110            Int_t nBusPatch = dspHeader->GetBusPatchEntries();
111            for(Int_t iBusPatch = 0; iBusPatch < nBusPatch; iBusPatch++) {  
112
113              busStruct = dspHeader->GetBusPatchEntry(iBusPatch);
114
115              printf("busPatchId %d", busStruct->GetBusPatchId());
116              printf(" BlockId %d", busStruct->GetBlockId());
117              printf(" DspId %d\n", busStruct->GetDspId());
118
119            // loop over data
120              dataSize = busStruct->GetLength();
121              for (Int_t iData = 0; iData < dataSize; iData++) {
122
123                Int_t  manuId    = busStruct->GetManuId(iData);
124                Int_t  channelId = busStruct->GetChannelId(iData);
125                Int_t  charge    = busStruct->GetCharge(iData);
126                printf("manuId: %d, channelId: %d charge: %d\n", manuId, 
127                       channelId, charge);
128
129              } // iData
130            } // iBusPatch
131          } // iDsp
132        } // iBlock
133      } // NextDDL
134    } while (rawReader->NextEvent()); 
135
136    delete rawReader;
137    delete rawStream;
138 }