1 // gSystem->SetIncludePath("-I$ROOTSYS/include -I$ALICE_ROOT/include -I$ALICE_ROOT/RAW -I$ALICE_ROOT/TOF")
2 // .L AliTOFRawDataRead.C++
5 #if !defined(__CINT__) || defined(__MAKECINT__)
8 #include "TClonesArray.h"
10 // AliRoot include files
12 #include "AliHitMap.h"
14 #include "AliRawReader.h"
15 #include "AliRawReaderFile.h"
17 #include "AliTOFrawData.h"
18 #include "AliTOFRawMap.h"
19 #include "AliTOFRawStream.h"
23 void AliTOFRawDataRead(Int_t iEvent=0);
25 void AliTOFRawDataRead(Int_t iEvent)
28 // To read TOF raw data
31 TClonesArray *fTOFrawData = new TClonesArray("AliTOFrawData",1000);
32 Int_t fPackedDigits=0;
35 Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
38 AliRawReaderFile reader(iEvent);
39 reader.RewindEvents();
42 ftxt.open("TOFrawDataReading.txt",ios::app);
44 while (reader.NextEvent()) {
46 AliTOFRawMap *rawMap = new AliTOFRawMap(fTOFrawData);
48 Int_t slot[4] = {-1, -1, -1, -1};
50 for (indexDDL = 0; indexDDL < AliDAQ::NumberOfDdls("TOF"); indexDDL++) {
56 printf(" \n \n \n DRM number %2i \n \n \n ", indexDDL);
59 AliTOFRawStream stream(&reader);
61 reader.Select("TOF", indexDDL, indexDDL);
62 Bool_t signal = kFALSE;
64 while(stream.Next()) {
66 signal = (stream.GetSector()!=-1 &&
67 stream.GetPlate()!=-1 &&
68 stream.GetStrip()!=-1 &&
69 stream.GetPadZ()!=-1 &&
70 stream.GetPadX()!=-1);
73 printf(" %2i %1i %2i %1i %2i \n", stream.GetSector(), stream.GetPlate(), stream.GetStrip(), stream.GetPadZ(), stream.GetPadX());
75 slot[0] = stream.GetTRM();
76 slot[1] = stream.GetTRMchain();
77 slot[2] = stream.GetTDC();
78 slot[3] = stream.GetTDCchannel();
80 if (rawMap->TestHit(slot) != kEmpty) {
82 AliTOFrawData *rawDigit = static_cast<AliTOFrawData*>(rawMap->GetHit(slot));
83 rawDigit->Update(stream.GetTofBin(), stream.GetToTbin(), stream.GetLeadingEdge(), stream.GetTrailingEdge(), stream.GetPSbit(), stream.GetACQ(), stream.GetErrorFlag());
88 TClonesArray &arrayTofRawData = *fTOFrawData;
89 new (arrayTofRawData[fPackedDigits++]) AliTOFrawData(stream.GetTRM(), stream.GetTRMchain(), stream.GetTDC(), stream.GetTDCchannel(),
90 stream.GetTofBin(), stream.GetToTbin(), stream.GetLeadingEdge(), stream.GetTrailingEdge(),
91 stream.GetPSbit(), stream.GetACQ(), stream.GetErrorFlag());
95 printf(" %6i \n", rawMap->GetHitIndex(slot));
101 } // closed loop on TOF raw data per current DDL file
103 printf("\n \n \n end of reading DRM number %2i\n", indexDDL);
104 printf(" packed data %5i\n \n \n ", fTOFrawData->GetEntriesFast());
106 for (Int_t iRawData = 0; iRawData<fTOFrawData->GetEntriesFast(); iRawData++) {
108 AliTOFrawData *tofRawDatum = (AliTOFrawData*)fTOFrawData->UncheckedAt(iRawData);
110 if (tofRawDatum->GetTOT()==-1 || tofRawDatum->GetTOF()==-1) continue;
112 if (indexDDL<10) ftxt << " " << indexDDL;
113 else ftxt << " " << indexDDL;
114 if (tofRawDatum->GetTRM()<10) ftxt << " " << tofRawDatum->GetTRM();
115 else ftxt << " " << tofRawDatum->GetTRM();
116 ftxt << " " << tofRawDatum->GetTRMchain();
117 if (tofRawDatum->GetTDC()<10) ftxt << " " << tofRawDatum->GetTDC();
118 else ftxt << " " << tofRawDatum->GetTDC();
119 ftxt << " " << tofRawDatum->GetTDCchannel();
121 stream.EquipmentId2VolumeId(indexDDL, tofRawDatum->GetTRM(), tofRawDatum->GetTRMchain(),
122 tofRawDatum->GetTDC(), tofRawDatum->GetTDCchannel(), detectorIndex);
123 dummy = detectorIndex[3];
124 detectorIndex[3] = detectorIndex[4];
125 detectorIndex[4] = dummy;
127 if (detectorIndex[0]<10) ftxt << " -> " << detectorIndex[0];
128 else ftxt << " -> " << detectorIndex[0];
129 ftxt << " " << detectorIndex[1];
130 if (detectorIndex[2]<10) ftxt << " " << detectorIndex[2];
131 else ftxt << " " << detectorIndex[2];
132 ftxt << " " << detectorIndex[3];
133 if (detectorIndex[4]<10) ftxt << " " << detectorIndex[4];
134 else ftxt << " " << detectorIndex[4];
136 if (tofRawDatum->GetTOT()<10) ftxt << " " << tofRawDatum->GetTOT();
137 else if (tofRawDatum->GetTOT()>=10 && tofRawDatum->GetTOT()<100) ftxt << " " << tofRawDatum->GetTOT();
138 else ftxt << " " << tofRawDatum->GetTOT();
139 if (tofRawDatum->GetTOF()<10) ftxt << " " << tofRawDatum->GetTOF() << endl;
140 else if (tofRawDatum->GetTOF()>=10 && tofRawDatum->GetTOF()<100) ftxt << " " << tofRawDatum->GetTOF() << endl;
141 else if (tofRawDatum->GetTOF()>=100 && tofRawDatum->GetTOF()<1000) ftxt << " " << tofRawDatum->GetTOF() << endl;
142 else ftxt << " " << tofRawDatum->GetTOF() << endl;
146 } // endl loop on DDL files
150 } // end while loop on event