]> git.uio.no Git - u/mrichter/AliRoot.git/blame - TOF/AliTOFRawDataReadBuffer.C
Overlaps corrected, new shape of sectors
[u/mrichter/AliRoot.git] / TOF / AliTOFRawDataReadBuffer.C
CommitLineData
0d1aab4f 1#if !defined(__CINT__) || defined(__MAKECINT__)
2
3// Root include files
4#include "TClonesArray.h"
5
6// AliRoot include files
7#include "AliDAQ.h"
8#include "AliHitMap.h"
9
10#include "AliRawReader.h"
11#include "AliRawReaderFile.h"
12
13#include "AliTOFrawData.h"
14#include "AliTOFRawMap.h"
15#include "AliTOFRawStream.h"
16
17#endif
18
19extern gBenchmark;
20
21void AliTOFRawDataReadBuffer(Int_t iEvent=0);
22
23void AliTOFRawDataReadBuffer(Int_t iEvent)
24{
25
26 //
27 // To read TOF raw data
28 //
29
30 Int_t Volume[5];
31 AliTOFHitData *HitData;
32 AliTOFHitDataBuffer *DataBuffer;
33 AliTOFHitDataBuffer *PackedDataBuffer;
34
35 /* create a tree for decoded data */
36 TTree DataTree("DataTree", "Decoded Data");
37 DataTree.Branch("HitData", "AliTOFHitData", &HitData);
38
39 /* create a tree for decoded packed data */
40 TTree PackedDataTree("PackedDataTree", "Decoded Packed Data");
41 PackedDataTree.Branch("HitData", "AliTOFHitData", &HitData);
42
43 AliRawReaderFile reader(iEvent);
44 AliTOFRawStream stream(&reader);
45
46 reader.RewindEvents();
47
48 gBenchmark->Reset();
49 /* loop over events */
50 for (Int_t iEvent = 0; reader.NextEvent(); iEvent++) {
51 printf("processing event %d\n", iEvent);
52
53 /* reset buffers (actually not needed)*/
54 stream.ResetBuffers();
55
56 /* decode all DDLs */
57 gBenchmark->Start("time");
58 stream.DecodeDDL(0, AliDAQ::NumberOfDdls("TOF") - 1,0);
59 gBenchmark->Stop("time");
60
61 /* loop over DDLs */
62 for (Int_t iDDL = 0; iDDL < AliDAQ::NumberOfDdls("TOF"); iDDL++){
63
64 /* read decoded data */
65 DataBuffer = stream.GetDataBuffer(iDDL);
66 PackedDataBuffer = stream.GetPackedDataBuffer(iDDL);
67
68 /* get buffer entries */
69 Int_t nDBEntries = DataBuffer->GetEntries();
70 Int_t nPDBEntries = PackedDataBuffer->GetEntries();
71
72 /* read data buffer hits */
73 for (Int_t iHit = 0; iHit < nDBEntries; iHit++){
74 HitData = DataBuffer->GetHit(iHit);
75 HitData->SetDDLID(iDDL);
76 /* add volume information to hit */
77 stream.EquipmentId2VolumeId(HitData, HitData->GetVolume());
78 DataTree.Fill();
79 }
80 /* reset buffer */
81 DataBuffer->Reset();
82
83 /* read data buffer hits */
84 for (Int_t iHit = 0; iHit < nPDBEntries; iHit++){
85 HitData = PackedDataBuffer->GetHit(iHit);
86 HitData->SetDDLID(iDDL);
87 /* add volume information to hit */
88 stream.EquipmentId2VolumeId(HitData, HitData->GetVolume());
89 PackedDataTree.Fill();
90 }
91 /* reset buffer */
92 PackedDataBuffer->Reset();
93 }
94
95 }
96 gBenchmark->Print("time");
97
98 TFile fileOut("TOF_rawQA.root", "RECREATE");
99 DataTree.Write();
100 PackedDataTree.Write();
101 fileOut.Close();
102
103
104}