1 #if !defined(__CINT__) || defined(__MAKECINT__)
4 #include "TClonesArray.h"
6 // AliRoot include files
10 #include "AliRawReader.h"
11 #include "AliRawReaderFile.h"
13 #include "AliTOFrawData.h"
14 #include "AliTOFRawMap.h"
15 #include "AliTOFRawStream.h"
19 void AliTOFRawDataRead(Int_t iEvent=0);
21 void AliTOFRawDataRead(Int_t iEvent)
24 // To read TOF raw data
27 AliTOFrawData *tofRawDatum=new AliTOFrawData();
28 TTree *PackedDataTree= new TTree("PackedDataTree", "Decoded Packed Data");
29 PackedDataTree->Branch("HitData", "AliTOFrawData", &tofRawDatum);
31 TClonesArray *clonesRawData = new TClonesArray("AliTOFrawData",1000);
32 Int_t fPackedDigits=0;
34 Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
37 AliRawReader *reader = new AliRawReaderFile(iEvent);
38 reader->RewindEvents();
41 ftxt.open("TOFrawDataReading.txt",ios::app);
43 while (reader->NextEvent()) {
45 AliTOFRawMap *rawMap = new AliTOFRawMap(clonesRawData);
47 Int_t slot[4] = {-1, -1, -1, -1};
49 for (Int_t indexDDL = 0; indexDDL < AliDAQ::NumberOfDdls("TOF"); indexDDL++) {
52 AliTOFRawStream stream(reader);
53 stream.LoadRawData(indexDDL);
55 clonesRawData = (TClonesArray*)stream.GetRawData();
57 for (Int_t iRawData = 0; iRawData<clonesRawData->GetEntriesFast(); iRawData++) {
59 tofRawDatum = (AliTOFrawData*)clonesRawData->UncheckedAt(iRawData);
61 if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
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();
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;
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];
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;
102 PackedDataTree->Fill();
105 } // endl loop on DDL files
109 } // end while loop on event
112 TFile fileOut("TOF_rawQA_OldDecoder.root", "RECREATE");
113 PackedDataTree->Write();