]> git.uio.no Git - u/mrichter/AliRoot.git/blame_incremental - TOF/AliTOFRawDataRead.C
converted multiplicity selector into task
[u/mrichter/AliRoot.git] / TOF / AliTOFRawDataRead.C
... / ...
CommitLineData
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
19void AliTOFRawDataRead(Int_t iEvent=0);
20
21void AliTOFRawDataRead(Int_t iEvent)
22{
23 //
24 // To read TOF raw data
25 //
26
27 AliTOFrawData *tofRawDatum=new AliTOFrawData();
28 TTree *PackedDataTree= new TTree("PackedDataTree", "Decoded Packed Data");
29 PackedDataTree->Branch("HitData", "AliTOFrawData", &tofRawDatum);
30
31 TClonesArray *clonesRawData = new TClonesArray("AliTOFrawData",1000);
32 Int_t fPackedDigits=0;
33
34 Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
35 Int_t dummy = -1;
36
37 AliRawReader *reader = new AliRawReaderFile(iEvent);
38 reader->RewindEvents();
39
40 ofstream ftxt;
41 ftxt.open("TOFrawDataReading.txt",ios::app);
42
43 while (reader->NextEvent()) {
44
45 AliTOFRawMap *rawMap = new AliTOFRawMap(clonesRawData);
46
47 Int_t slot[4] = {-1, -1, -1, -1};
48
49 for (Int_t indexDDL = 0; indexDDL < AliDAQ::NumberOfDdls("TOF"); indexDDL++) {
50
51 reader->Reset();
52 AliTOFRawStream stream(reader);
53 stream.LoadRawData(indexDDL);
54
55 clonesRawData = (TClonesArray*)stream.GetRawData();
56
57 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
58
59 tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
60
61 if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
62
63 if (indexDDL<10) ftxt << " " << indexDDL;
64 else ftxt << " " << indexDDL;
65 if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
66 else ftxt << " " << tofRawDatum->GetTRM();
67 ftxt << " " << tofRawDatum->GetTRMchain();
68 if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
69 else ftxt << " " << tofRawDatum->GetTDC();
70 ftxt << " " << tofRawDatum->GetTDCchannel();
71
72 stream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
73 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
74 dummy = detectorIndex[3];
75 detectorIndex[3] = detectorIndex[4];
76 detectorIndex[4] = dummy;
77
78 if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
79 else ftxt << " -> " << detectorIndex[0];
80 ftxt << " " << detectorIndex[1];
81 if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
82 else ftxt << " " << detectorIndex[2];
83 ftxt << " " << detectorIndex[3];
84 if (detectorIndex[4]<10) ftxt << " " << detectorIndex[4];
85 else ftxt << " " << detectorIndex[4];
86
87 if (tofRawDatum->GetTOT()<10) ftxt << " " << tofRawDatum->GetTOT();
88 else if (tofRawDatum->GetTOT()>=10 && tofRawDatum->GetTOT()<100) ftxt << " " << tofRawDatum->GetTOT();
89 else if (tofRawDatum->GetTOT()>=100 && tofRawDatum->GetTOT()<1000) ftxt << " " << tofRawDatum->GetTOT();
90 else if (tofRawDatum->GetTOT()>=1000 && tofRawDatum->GetTOT()<10000) ftxt << " " << tofRawDatum->GetTOT();
91 else if (tofRawDatum->GetTOT()>=10000 && tofRawDatum->GetTOT()<100000) ftxt << " " << tofRawDatum->GetTOT();
92 else if (tofRawDatum->GetTOT()>=100000 && tofRawDatum->GetTOT()<1000000) ftxt << " " << tofRawDatum->GetTOT();
93 else ftxt << " " << tofRawDatum->GetTOT();
94 if (tofRawDatum->GetTOF()<10) ftxt << " " << tofRawDatum->GetTOF() << endl;
95 else if (tofRawDatum->GetTOF()>=10 && tofRawDatum->GetTOF()<100) ftxt << " " << tofRawDatum->GetTOF() << endl;
96 else if (tofRawDatum->GetTOF()>=100 && tofRawDatum->GetTOF()<1000) ftxt << " " << tofRawDatum->GetTOF() << endl;
97 else if (tofRawDatum->GetTOF()>=1000 && tofRawDatum->GetTOF()<10000) ftxt << " " << tofRawDatum->GetTOF() << endl;
98 else if (tofRawDatum->GetTOF()>=10000 && tofRawDatum->GetTOF()<100000) ftxt << " " << tofRawDatum->GetTOF() << endl;
99 else if (tofRawDatum->GetTOF()>=100000 && tofRawDatum->GetTOF()<1000000) ftxt << " " << tofRawDatum->GetTOF() << endl;
100 else ftxt << " " << tofRawDatum->GetTOF() << endl;
101
102 PackedDataTree->Fill();
103 } // end loop
104
105 } // endl loop on DDL files
106
107 iEvent++;
108
109 } // end while loop on event
110
111 ftxt.close();
112 TFile fileOut("TOF_rawQA_OldDecoder.root", "RECREATE");
113 PackedDataTree->Write();
114 fileOut.Close();
115
116}
117