X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=TOF%2FAliTOFD.cxx;h=8f97a4856240b9391ea641438fb4249c9d69f4cc;hp=5afb38a1c25cef67385ec4cf993d50dbc00aa78b;hb=4a8eca94ef065e5dabcbdc494a256c9d6cf87e8b;hpb=94de381804dbc3c6cc154b06fc58284dc8266705 diff --git a/TOF/AliTOFD.cxx b/TOF/AliTOFD.cxx index 5afb38a1c25..8f97a485624 100644 --- a/TOF/AliTOFD.cxx +++ b/TOF/AliTOFD.cxx @@ -15,6 +15,9 @@ /* $Log$ +Revision 1.3 2000/10/02 21:28:17 fca +Removal of useless dependecies via forward declarations + Revision 1.2 2000/05/18 14:33:01 vicinanz Modified to be full HP compliant @@ -52,8 +55,8 @@ AliTOFRoc::AliTOFRoc() // The class represents a ROC in the TARODA system // { - Items = 0; - Size = 0; + fItems = 0; + fSize = 0; } //______________________________________________________________________________ @@ -62,15 +65,16 @@ AliTOFRoc::~AliTOFRoc(){} //______________________________________________________________________________ Int_t AliTOFRoc::AddItem(Int_t Fec, Int_t Tdc, Int_t Error, Float_t Charge, Float_t Time) +{ // // Adds an item (i.e. the charge, the TOF and the // cohordinates of a hit pad) to the ROC class. // -{ - Items++; - SetCharge(Items,Fec,Tdc,Charge); - SetTime (Items,Error,Time); - return Items; + + fItems++; + SetCharge(fItems,Fec,Tdc,Charge); + SetTime (fItems,Error,Time); + return fItems; } //______________________________________________________________________________ @@ -79,42 +83,44 @@ void AliTOFRoc::SetHeader() // Calculate the header line of the ROC in the raw data file // { - Header = NRoc<<28; - Header += Size; + fHeader = fNRoc<<28; + fHeader += fSize; } //______________________________________________________________________________ void AliTOFRoc::SetTime(UInt_t Item, UInt_t Error, Float_t RealTime) +{ // // Calculate the raw data line relative to the TDC // output of a pad in the current ROC. // -{ - UInt_t Itime; - Itime = (UInt_t)(RealTime/50.); - if (Itime >= TMath::Power(2,24)) Itime = 2^24-1; + + UInt_t itime; + itime = (UInt_t)(RealTime/50.); + if (itime >= TMath::Power(2,24)) itime = 2^24-1; Error <<= 24; - TimeRow[Item]= Error+Itime; + fTimeRow[Item]= Error+itime; } //______________________________________________________________________________ void AliTOFRoc::SetCharge(UInt_t Item, UInt_t Fec, UInt_t Tdc, Float_t RealCharge) +{ // // Calculate the raw data line relative to the ADC // output of a pad in the current ROC. // -{ - UInt_t ICharge; - if (NRoc>=TMath::Power(2,4)) NRoc = 0; - NRoc <<= 28; + + UInt_t iCharge; + if (fNRoc>=TMath::Power(2,4)) fNRoc = 0; + fNRoc <<= 28; if (Fec >=TMath::Power(2,6)) Fec = 0; Fec <<= 22; if (Tdc >=TMath::Power(2,6)) Tdc = 0; Tdc <<= 16; - ICharge = (UInt_t)(RealCharge/50.); - if(ICharge>=TMath::Power(2,16)) ICharge = (UInt_t)TMath::Power(2,16)-1; - ChrgRow[Item] = ICharge+NRoc+Fec+Tdc; + iCharge = (UInt_t)(RealCharge/50.); + if(iCharge>=TMath::Power(2,16)) iCharge = (UInt_t)TMath::Power(2,16)-1; + fChrgRow[Item] = iCharge+fNRoc+Fec+Tdc; } //______________________________________________________________________________ @@ -123,7 +129,7 @@ void AliTOFRoc::SetTime(UInt_t Item, UInt_t tir) // Writes the raw data line relative to the TDC // { - ChrgRow[Item]=tir; + fChrgRow[Item]=tir; } //______________________________________________________________________________ @@ -132,68 +138,73 @@ void AliTOFRoc::SetCharge(UInt_t Item, UInt_t chr) // Writes the raw data line relative to the ADC // { - ChrgRow[Item]=chr; + fChrgRow[Item]=chr; } //______________________________________________________________________________ Float_t AliTOFRoc::GetCharge(Int_t Item) +{ // // Reads the effective value of the charge starting // from the line of the raw data // -{ - UInt_t Charge = ChrgRow[Item]&0x0000ffff; - Float_t ACharge = (Float_t)Charge*50.; - return ACharge; + + UInt_t icharge = fChrgRow[Item]&0x0000ffff; + Float_t charge = (Float_t)icharge*50.; + return charge; } //______________________________________________________________________________ Float_t AliTOFRoc::GetTime(Int_t Item, UInt_t& Error) +{ // // Reads the effective value of the time of flight starting // from the line of the raw data // -{ - UInt_t Time = TimeRow[Item]&0x00ffffff; - Float_t ATime = (Float_t)Time*50.; - Error = TimeRow[Item]>>24; - return ATime; + + UInt_t itime = fTimeRow[Item]&0x00ffffff; + Float_t time = (Float_t)itime*50.; + Error = fTimeRow[Item]>>24; + return time; } //______________________________________________________________________________ Int_t AliTOFRoc::GetTotPad(Int_t Item) +{ // // Reads the cohordinates of the pad starting // from the line of the raw data // -{ - UInt_t NRoc = (ChrgRow[Item]&0xf0000000)>>28; - UInt_t NFec = (ChrgRow[Item]&0x0fc00000)>>22; - UInt_t NTdc = (ChrgRow[Item]&0x003f0000)>>16; - UInt_t Pad = NRoc*32*32+NFec*32+NTdc; - return Pad; + + UInt_t nRoc = (fChrgRow[Item]&0xf0000000)>>28; + UInt_t nFec = (fChrgRow[Item]&0x0fc00000)>>22; + UInt_t nTdc = (fChrgRow[Item]&0x003f0000)>>16; + UInt_t pad = nRoc*32*32+nFec*32+nTdc; + return pad; } //______________________________________________________________________________ UInt_t AliTOFRoc::GetCheckSum() +{ // // Calculate the checksum word of the current ROC // -{ - UInt_t CheckSum=0; - for(Int_t i=0; i>=1){ if(x&0x00000001) count++; @@ -203,14 +214,15 @@ UInt_t AliTOFRoc::BitCount(UInt_t x) //______________________________________________________________________________ UInt_t AliTOFRoc::SetSize() +{ // // Reads the size of data from current ROC starting // from the header line of the raw data // -{ - Size = Header&0x0000ffff; - Items = (Size-4)/4; - return Size; + + fSize = fHeader&0x0000ffff; + fItems = (fSize-4)/4; + return fSize; } @@ -220,45 +232,54 @@ ClassImp(AliTOFRawSector) //______________________________________________________________________________ AliTOFRawSector::AliTOFRawSector() +{ // // Constructor of AliTOFRawSector class // Each sector is in effect a // TClonesArray of 14 AliTOFRoc Objects // -{ fRocData = new TClonesArray("AliTOFRoc",14); } //______________________________________________________________________________ AliTOFRawSector::~AliTOFRawSector() { - delete fRocData; +// destructor of the AliTOFRawSector object +// Here we delete the 14 AliTOFRoc istances +// + if (fRocData) { + fRocData->Delete() ; + delete fRocData; + fRocData = 0; + } } //______________________________________________________________________________ void AliTOFRawSector::WriteSector() +{ // // Starting from the raw data objects writes a binary file // similar to real raw data. // -{ + FILE *rawfile; rawfile = fopen("rawdata.dat","w"); // fprintf(rawfile,Header); Int_t nRoc; - + +// loop on all AliTOFRoc Headers to set them for(nRoc=1; nRoc<=14; nRoc++){ AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc); currentRoc->SetHeader(); - // UInt_t RocHeader = currentRoc->Header; + // UInt_t RocHeader = currentRoc->fHeader; // fprintf(rawfile,RocHeader); } for(nRoc=1; nRoc<=14; nRoc++){ AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc); - Int_t rocItems = currentRoc->Items; + Int_t rocItems = currentRoc->GetItems(); for(Int_t nItem=1; nItem<=rocItems;nItem++){ // UInt_t TimeRow = currentRoc->GetTimeRow(nItem); @@ -274,41 +295,43 @@ void AliTOFRawSector::WriteSector() //______________________________________________________________________________ void AliTOFRawSector::ReadSector() +{ // // Starting from raw data initialize and write the // Raw Data objects //(i.e. a TClonesArray of 18 AliTOFRawSector) // -{ + FILE *rawfile; rawfile = fopen("rawdata.dat","r"); +// fscanf(rawfile,Header); // fscanf(rawfile,Header); Int_t nRoc; for(nRoc=1; nRoc<=14; nRoc++){ AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc); - UInt_t RocHeader; - // fscanf(rawfile,RocHeader); - currentRoc->SetHeader(RocHeader); + UInt_t rocHeader; + fscanf(rawfile,"%u",&rocHeader); + currentRoc->SetHeader(rocHeader); } - // UInt_t SCMWord; -// fscanf(rawfile,SCMWord); +// UInt_t SCMWord; +// fscanf(rawfile,"%u",SCMWord); for(nRoc=1; nRoc<=14; nRoc++){ AliTOFRoc* currentRoc = (AliTOFRoc*)fRocData->UncheckedAt(nRoc); // Int_t Size = currentRoc->SetSize(); - Int_t nItems = currentRoc->Items; + Int_t nItems = currentRoc->GetItems(); for(Int_t nrow=0; nrow<=nItems; nrow++){ UInt_t charRow,timeRow; -// fscanf(rawfile, charRow); + fscanf(rawfile,"%u",&charRow); currentRoc->SetTime(nrow, charRow); -// fscanf(rawfile, timeRow); + fscanf(rawfile,"%u",&timeRow); currentRoc->SetTime(nrow, timeRow); } - // Int_t FinalWord; -// fscanf(rawfile,FinalWord); + Int_t FinalWord; + fscanf(rawfile,"%d",&FinalWord); } // fscanf(rawfile,GlobalCheckSum); }