X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TOF%2FAliTOFDDLRawData.cxx;h=40fc4583a164be1c58f4911eb72d5e427d8ce14c;hb=4c7053339a37d71887aa9ac44b9a3686bfbe56f2;hp=a5dc3d6794df96e284fae0612e22f9bd2a027768;hpb=a403781d64fa98005546b6f5186b28ba3953de47;p=u%2Fmrichter%2FAliRoot.git diff --git a/TOF/AliTOFDDLRawData.cxx b/TOF/AliTOFDDLRawData.cxx index a5dc3d6794d..40fc4583a16 100644 --- a/TOF/AliTOFDDLRawData.cxx +++ b/TOF/AliTOFDDLRawData.cxx @@ -15,6 +15,18 @@ /* $Log$ +Revision 1.19 2007/06/22 11:37:47 cvetan +Fixes in order to write correct raw-data on big-endian platforms (Marco) + +Revision 1.18 2007/05/21 13:26:19 decaro +Correction on matching_window control and bug fixing (R.Preghenella) + +Revision 1.17 2007/05/10 09:29:34 hristov +Last moment fixes and changes from v4-05-Release (Silvia) + +Revision 1.16 2007/05/03 09:07:22 decaro +Double digit in the same TDC channel. Wrong sequence during the raw data writing in unpacked mode: solved + Revision 1.15 2007/04/23 16:51:39 decaro Digits-to-raw_data conversion: correction for a more real description (A.De Caro, R.Preghenella) @@ -74,6 +86,7 @@ Revision 0.01 2004/6/11 A.De Caro, S.B.Sellitto, R.Silvestri #include "AliTOFdigit.h" #include "AliTOFGeometry.h" #include "AliTOFRawStream.h" +#include "AliFstream.h" extern TRandom *gRandom; @@ -86,30 +99,12 @@ AliTOFDDLRawData::AliTOFDDLRawData(): fPackedAcquisition(kTRUE), fFakeOrphaneProduction(kFALSE), fMatchingWindow(8192), - fTOFgeometry(0), fTOFdigitMap(new AliTOFDigitMap()), fTOFdigitArray(0x0), fTOFrawStream(new AliTOFRawStream()) { //Default constructor } - -//---------------------------------------------------------------------------- -AliTOFDDLRawData::AliTOFDDLRawData(AliTOFGeometry *tofGeom): - fVerbose(0), - fIndex(-1), - fPackedAcquisition(kTRUE), - fFakeOrphaneProduction(kFALSE), - fMatchingWindow(8192), - fTOFgeometry(tofGeom), - fTOFdigitMap(new AliTOFDigitMap()), - fTOFdigitArray(0x0), - fTOFrawStream(new AliTOFRawStream()) -{ - //Constructor - -} - //---------------------------------------------------------------------------- AliTOFDDLRawData::AliTOFDDLRawData(const AliTOFDDLRawData &source) : TObject(source), @@ -118,7 +113,6 @@ AliTOFDDLRawData::AliTOFDDLRawData(const AliTOFDDLRawData &source) : fPackedAcquisition(kTRUE), fFakeOrphaneProduction(kFALSE), fMatchingWindow(8192), - fTOFgeometry(0), fTOFdigitMap(new AliTOFDigitMap()), fTOFdigitArray(0x0), fTOFrawStream(new AliTOFRawStream()) @@ -129,7 +123,6 @@ AliTOFDDLRawData::AliTOFDDLRawData(const AliTOFDDLRawData &source) : this->fPackedAcquisition=source.fPackedAcquisition; this->fFakeOrphaneProduction=source.fFakeOrphaneProduction; this->fMatchingWindow=source.fMatchingWindow; - this->fTOFgeometry=source.fTOFgeometry; this->fTOFdigitMap=source.fTOFdigitMap; this->fTOFdigitArray=source.fTOFdigitArray; this->fTOFrawStream=source.fTOFrawStream; @@ -144,13 +137,18 @@ AliTOFDDLRawData& AliTOFDDLRawData::operator=(const AliTOFDDLRawData &source) { this->fPackedAcquisition=source.fPackedAcquisition; this->fFakeOrphaneProduction=source.fFakeOrphaneProduction; this->fMatchingWindow=source.fMatchingWindow; - this->fTOFgeometry=source.fTOFgeometry; this->fTOFdigitMap=source.fTOFdigitMap; this->fTOFdigitArray=source.fTOFdigitArray; this->fTOFrawStream=source.fTOFrawStream; return *this; } +//---------------------------------------------------------------------------- +AliTOFDDLRawData::~AliTOFDDLRawData() +{ + delete fTOFdigitMap; + delete fTOFrawStream; +} //---------------------------------------------------------------------------- Int_t AliTOFDDLRawData::RawDataTOF(TBranch* branch) { @@ -167,7 +165,7 @@ Int_t AliTOFDDLRawData::RawDataTOF(TBranch* branch) fTOFdigitArray = * (TClonesArray**) branch->GetAddress(); char fileName[15]; - ofstream outfile; // logical name of the output file + AliFstream* outfile; // logical name of the output file //AliRawDataHeader header; AliRawDataHeaderSim header; @@ -190,17 +188,13 @@ Int_t AliTOFDDLRawData::RawDataTOF(TBranch* branch) for (nDDL=0; nDDLGetDDLnumberPerSector(nDDL); // write Dummy DATA HEADER - UInt_t dataHeaderPosition = outfile.tellp(); - outfile.write((char*)(&header),sizeof(header)); + UInt_t dataHeaderPosition = outfile->Tellp(); + outfile->WriteBuffer((char*)(&header),sizeof(header)); // DRM section: trailer MakeDRMtrailer(buf); @@ -252,21 +246,21 @@ Int_t AliTOFDDLRawData::RawDataTOF(TBranch* branch) ReverseArray(buf, fIndex+1); - outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t))); + outfile->WriteBuffer((char *)buf,((fIndex+1)*sizeof(UInt_t))); for (jj=0; jj<(fIndex+1); jj++) buf[jj]=0; fIndex = -1; //Write REAL DATA HEADER - UInt_t currentFilePosition = outfile.tellp(); + UInt_t currentFilePosition = outfile->Tellp(); sizeRawData = currentFilePosition - dataHeaderPosition - sizeof(header); header.fSize = currentFilePosition - dataHeaderPosition; header.SetAttribute(0); // valid data - outfile.seekp(dataHeaderPosition); - outfile.write((char*)(&header),sizeof(header)); - outfile.seekp(currentFilePosition); + outfile->Seekp(dataHeaderPosition); + outfile->WriteBuffer((char*)(&header),sizeof(header)); + outfile->Seekp(currentFilePosition); - outfile.close(); + delete outfile; } //end loop on DDL file number @@ -331,12 +325,35 @@ void AliTOFDDLRawData::MakeDRMheader(Int_t nDDL, UInt_t *buf) fIndex++; buf[fIndex]=baseWord; + // DRM status header 4 + baseWord=0; + word = 1; // 0001 -> DRM data are coming from the VME slot number 1 + AliBitPacking::PackWord(word,baseWord, 0, 3); + word = 0; // temperature + AliBitPacking::PackWord(word,baseWord, 4,13); + word = 0; // zero + AliBitPacking::PackWord(word,baseWord, 14,14); + word = 0; // ACK + AliBitPacking::PackWord(word,baseWord, 15,15); + word = 0; // Sens AD + AliBitPacking::PackWord(word,baseWord, 16,18); + word = 0; // zero + AliBitPacking::PackWord(word,baseWord, 19,19); + word = 0; // reserved for future use + AliBitPacking::PackWord(word,baseWord, 20,27); + word = 4; // 0100 -> DRM header ID + AliBitPacking::PackWord(word,baseWord,28,31); + fIndex++; + buf[fIndex]=baseWord; + // DRM status header 3 baseWord=0; word = 1; // 0001 -> DRM data are coming from the VME slot number 1 AliBitPacking::PackWord(word,baseWord, 0, 3); - word = 0; // TTC event counter - AliBitPacking::PackWord(word,baseWord, 4,27); + word = 0; // L0 BCID + AliBitPacking::PackWord(word,baseWord, 4,15); + word = 0; // Run Time info + AliBitPacking::PackWord(word,baseWord, 16,27); word = 4; // 0100 -> DRM header ID AliBitPacking::PackWord(word,baseWord,28,31); fIndex++; @@ -360,7 +377,9 @@ void AliTOFDDLRawData::MakeDRMheader(Int_t nDDL, UInt_t *buf) word = 0; // AliBitPacking::PackWord(word,baseWord,15,15); word = 0; // fault ID - AliBitPacking::PackWord(word,baseWord,16,27); + AliBitPacking::PackWord(word,baseWord,16,26); + word = 0; // RTO + AliBitPacking::PackWord(word,baseWord,27,27); word = 4; // 0100 -> DRM header ID AliBitPacking::PackWord(word,baseWord,28,31); fIndex++; @@ -383,8 +402,12 @@ void AliTOFDDLRawData::MakeDRMheader(Int_t nDDL, UInt_t *buf) word = 1; // LHC clock status: 1/0 AliBitPacking::PackWord(word,baseWord,15,15); + word = 0; // Vers ID + AliBitPacking::PackWord(word,baseWord,16,20); + word = 0; // DRMH size + AliBitPacking::PackWord(word,baseWord,21,24); word = 0; // reserved for future use - AliBitPacking::PackWord(word,baseWord,16,27); + AliBitPacking::PackWord(word,baseWord,25,27); word = 4; // 0100 -> DRM header ID AliBitPacking::PackWord(word,baseWord,28,31); fIndex++; @@ -866,8 +889,8 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain, // TRM TDC digit // - const Double_t kOneMoreFilledCell = 1./(fTOFgeometry->NPadXSector()*fTOFgeometry->NSectors()); - Double_t percentFilledCells = Double_t(fTOFdigitMap->GetFilledCellNumber())/(fTOFgeometry->NPadXSector()*fTOFgeometry->NSectors()); + const Double_t kOneMoreFilledCell = 1./(AliTOFGeometry::NPadXSector()*AliTOFGeometry::NSectors()); + Double_t percentFilledCells = Double_t(fTOFdigitMap->GetFilledCellNumber())/(AliTOFGeometry::NPadXSector()*AliTOFGeometry::NSectors()); if (nDDL<0 || nDDL>71) { AliWarning(Form(" DDL number is out of the right range [0;71] (nDDL = %3i", nDDL)); @@ -1024,9 +1047,9 @@ void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain, digs->GetPadx() !=volume[3] || digs->GetPadz() !=volume[4]) AliWarning(" --- ERROR --- "); - timeOfFlight = (Int_t)(digs->GetTdc())%8192; + timeOfFlight = (Int_t)(digs->GetTdc()); - if (timeOfFlight>fMatchingWindow) continue; + if (timeOfFlight>=fMatchingWindow) continue; //numberOfMeasuresPerChannel++;