}
//____________________________________________________________________________
-void AliTOF::SetTOFSectors(Int_t *sectors){
+void AliTOF::SetTOFSectors(Int_t *sectors)
+{
+ // Setter for partial/full TOF configuration
+
for(Int_t isec=0;isec<18;isec++){
fTOFSectors[isec]=sectors[isec];
}
}
//____________________________________________________________________________
-void AliTOF::GetTOFSectors(Int_t *sectors) const {
+void AliTOF::GetTOFSectors(Int_t *sectors) const
+{
+ // Getter for partial/full TOF configuration
for(Int_t isec=0;isec<18;isec++){
sectors[isec]=fTOFSectors[isec];
/*
$Log$
+Revision 1.8 2006/05/04 19:41:42 hristov
+Possibility for partial TOF geometry (S.Arcelli)
+
Revision 1.7 2006/04/27 13:13:29 hristov
Moving the destructor to the implementation file
#include <Rtypes.h>
#include "TRandom.h"
-#include "TString.h"
#include "AliLog.h"
#include "AliAlignObj.h"
#include "TFile.h"
#include "TTree.h"
+#include "AliDAQ.h"
#include "AliLoader.h"
#include "AliLog.h"
#include "AliRawReader.h"
}
//------------------------------------------------------------------------
- AliTOFClusterFinder& AliTOFClusterFinder::operator=(const AliTOFClusterFinder &source)
+AliTOFClusterFinder& AliTOFClusterFinder::operator=(const AliTOFClusterFinder &source)
{
// ass. op.
this->fDigits=source.fDigits;
dig[3]=d->GetPadz();
dig[4]=d->GetPadx();
+ //AliInfo(Form(" %2i %1i %2i %1i %2i ",dig[0],dig[1],dig[2],dig[3],dig[4]));
+
for (jj=0; jj<3; jj++) g[jj] = 0.;
fTOFGeometry->GetPos(dig,g);
// Converts RAW data to recpoints for TOF
//
- const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
+ //const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
+ const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
ResetRecpoint();
while(tofInput.Next()) {
+ for (ii=0; ii<5; ii++) detectorIndex[ii] = -1;
+
detectorIndex[0] = tofInput.GetSector();
detectorIndex[1] = tofInput.GetPlate();
detectorIndex[2] = tofInput.GetStrip();
detectorIndex[3] = tofInput.GetPadZ();
detectorIndex[4] = tofInput.GetPadX();
+ //AliInfo(Form(" %2i %1i %2i %1i %2i ",detectorIndex[0],detectorIndex[1],detectorIndex[2],detectorIndex[3],detectorIndex[4]));
+
+ if (detectorIndex[0]==-1 ||
+ detectorIndex[1]==-1 ||
+ detectorIndex[2]==-1 ||
+ detectorIndex[3]==-1 ||
+ detectorIndex[4]==-1) continue;
+
for (ii=0; ii<3; ii++) position[ii] = 0.;
fTOFGeometry->GetPos(detectorIndex, position);
cylindricalPosition[1] = TMath::ATan2(position[1], position[0]);
cylindricalPosition[2] = position[2];
cylindricalPosition[3] = tofInput.GetTofBin();
- cylindricalPosition[4] = tofInput.GetADCbin();
- tToT = tofInput.GetADCbin();
+ cylindricalPosition[4] = tofInput.GetToTbin();
+ tToT = tofInput.GetToTbin();
tTdcND = -1.;
AliTOFcluster *tofCluster = new AliTOFcluster(cylindricalPosition, detectorIndex);
tofCluster->SetToT(tToT);
// Converts RAW data to recpoints for TOF
//
- const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
+ //const Int_t kDDL = fTOFGeometry->NDDL()*fTOFGeometry->NSectors();
+ const Int_t kDDL = AliDAQ::NumberOfDdls("TOF");
fRunLoader->GetEvent(iEvent);
Int_t ii = 0;
Int_t indexDDL = 0;
- Int_t detectorIndex[5];
+ Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
Float_t position[3];
Double_t cylindricalPosition[5];
Float_t tToT;
while(tofInput.Next()) {
+ for (ii=0; ii<5; ii++) detectorIndex[ii] = -1;
+
detectorIndex[0] = (Int_t)tofInput.GetSector();
detectorIndex[1] = (Int_t)tofInput.GetPlate();
detectorIndex[2] = (Int_t)tofInput.GetStrip();
detectorIndex[3] = (Int_t)tofInput.GetPadZ();
detectorIndex[4] = (Int_t)tofInput.GetPadX();
+ if (detectorIndex[0]==-1 ||
+ detectorIndex[1]==-1 ||
+ detectorIndex[2]==-1 ||
+ detectorIndex[3]==-1 ||
+ detectorIndex[4]==-1) continue;
+
+ //AliInfo(Form(" %2i %1i %2i %1i %2i ",detectorIndex[0],detectorIndex[1],detectorIndex[2],detectorIndex[3],detectorIndex[4]));
+
for (ii=0; ii<3; ii++) position[ii] = 0.;
fTOFGeometry->GetPos(detectorIndex, position);
cylindricalPosition[1] = (Double_t)TMath::ATan2(position[1], position[0]);
cylindricalPosition[2] = (Double_t)position[2];
cylindricalPosition[3] = (Double_t)tofInput.GetTofBin();
- cylindricalPosition[4] = (Double_t)tofInput.GetADCbin();
- tToT = tofInput.GetADCbin();
+ cylindricalPosition[4] = (Double_t)tofInput.GetToTbin();
+ tToT = tofInput.GetToTbin();
tTdcND = -1.;
AliTOFcluster *tofCluster = new AliTOFcluster(cylindricalPosition, detectorIndex);
fTreeD = fTOFLoader->TreeD();
if (fTreeD)
{
- AliInfo("AliTOFClusterFinder: TreeD re-creation");
+ AliInfo("TreeD re-creation");
fTreeD = 0x0;
fTOFLoader->MakeTree("D");
fTreeD = fTOFLoader->TreeD();
}
-
- fTreeR = fTOFLoader->TreeD();
- if (fTreeD == 0x0)
- {
- fTOFLoader->MakeTree("D");
- fTreeD = fTOFLoader->TreeD();
- }
-
TClonesArray dummy("AliTOFdigit",10000), *tofDigits=&dummy;
Int_t bufsize = 32000;
fTreeD->Branch("TOF", &tofDigits, bufsize);
AliDebug(2,Form(" Event number %2i ", iEvent));
+ Int_t ii = 0;
Int_t indexDDL = 0;
Int_t detectorIndex[5];
- Float_t digit[2];
+ Float_t digit[4];
for (indexDDL = 0; indexDDL < kDDL; indexDDL++) {
while(tofInput.Next()) {
+ for (ii=0; ii<5; ii++) detectorIndex[ii] = -1;
+
detectorIndex[0] = tofInput.GetSector();
detectorIndex[1] = tofInput.GetPlate();
detectorIndex[2] = tofInput.GetStrip();
detectorIndex[3] = tofInput.GetPadX();
detectorIndex[4] = tofInput.GetPadZ();
+ //AliInfo(Form(" %2i %1i %2i %1i %2i ",detectorIndex[0],detectorIndex[1],detectorIndex[2],detectorIndex[3],detectorIndex[4]));
+
+ if (detectorIndex[0]==-1 ||
+ detectorIndex[1]==-1 ||
+ detectorIndex[2]==-1 ||
+ detectorIndex[3]==-1 ||
+ detectorIndex[4]==-1) continue;
+
digit[0] = (Float_t)tofInput.GetTofBin();
- digit[1] = (Float_t)tofInput.GetADCbin();
+ digit[1] = (Float_t)tofInput.GetToTbin();
+ digit[2] = (Float_t)tofInput.GetToTbin();
+ digit[3] = -1.;
Int_t tracknum[3]={-1,-1,-1};
**************************************************************************/
/*
+$Log$
+Revision 1.10.1 2006/06/28 A.De Caro
+ Update TOF raw data format
+ according to the final version
+ (see ALICE internal note in preparation
+ 'ALICE TOF raw data format')
+
Revision 0.02 2005/7/25 A.De Caro
Update number of bits allocated for time-of-flight
and 'charge' measurements
GetDigits
*/
-//////////////////////////////////////////////////////////////////
-//
-// This class contains the methods to create the Raw Data files
-// for the TOF detector starting from the Digits.
-// In this preliminary implementation, we defined the structure
-// of the ALICE-TOF raw data starting from the current format
-// for the TOF digits and the TOF raw data.
-//
-//////////////////////////////////////////////////////////////////
+////////////////////////////////////////////////////////////////////
+// //
+// This class contains the methods to create the Raw Data files //
+// for the TOF detector starting from the Digits. //
+// In this implementation, we defined the structure //
+// of the ALICE-TOF raw data (according to the //
+// ALICE technical note, in preparation) //
+// starting from the TOF digit format. //
+// //
+////////////////////////////////////////////////////////////////////
#include "Riostream.h"
#include "TBranch.h"
#include "TClonesArray.h"
#include "TMath.h"
+#include "TRandom.h"
#include "AliBitPacking.h"
+#include "AliDAQ.h"
#include "AliLog.h"
-#include "AliRawDataHeader.h"
+//#include "AliRawDataHeader.h"
+#include "AliRawDataHeaderSim.h"
#include "AliTOFDDLRawData.h"
+#include "AliTOFDigitMap.h"
#include "AliTOFdigit.h"
#include "AliTOFGeometry.h"
#include "AliTOFRawStream.h"
-#include "AliDAQ.h"
+
+extern TRandom *gRandom;
ClassImp(AliTOFDDLRawData)
-//----------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------
AliTOFDDLRawData::AliTOFDDLRawData()
{
//Default constructor
fIndex=-1;
fVerbose=0;
fTOFgeometry = 0;
+ fTOFdigitMap = new AliTOFDigitMap();
}
-//----------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------
AliTOFDDLRawData::AliTOFDDLRawData(AliTOFGeometry *tofGeom)
{
//Constructor
fIndex=-1;
fVerbose=0;
fTOFgeometry = tofGeom;
-}
+ fTOFdigitMap = new AliTOFDigitMap();
+ fTOFdigitArray = 0x0;
+ fTOFrawStream = new AliTOFRawStream();
-//----------------------------------------------------------------------------------------
+}
-AliTOFDDLRawData::AliTOFDDLRawData(const AliTOFDDLRawData &source) :
- TObject(source){
+//----------------------------------------------------------------------------
+AliTOFDDLRawData::AliTOFDDLRawData(const AliTOFDDLRawData &source) :
+ TObject(source) {
//Copy Constructor
this->fIndex=source.fIndex;
this->fVerbose=source.fVerbose;
this->fTOFgeometry=source.fTOFgeometry;
+ this->fTOFdigitMap=source.fTOFdigitMap;
+ this->fTOFdigitArray=source.fTOFdigitArray;
+ this->fTOFrawStream=source.fTOFrawStream;
return;
}
-//---------------------------------------------------------------------------------------
-
-AliTOFDDLRawData& AliTOFDDLRawData::operator=(const AliTOFDDLRawData &source){
+//----------------------------------------------------------------------------
+AliTOFDDLRawData& AliTOFDDLRawData::operator=(const AliTOFDDLRawData &source) {
//Assigment operator
this->fIndex=source.fIndex;
this->fVerbose=source.fVerbose;
this->fTOFgeometry=source.fTOFgeometry;
+ this->fTOFdigitMap=source.fTOFdigitMap;
+ this->fTOFdigitArray=source.fTOFdigitArray;
+ this->fTOFrawStream=source.fTOFrawStream;
return *this;
}
-//---------------------------------------------------------------------------------------
-
-void AliTOFDDLRawData::GetDigits(TClonesArray *TOFdigits,Int_t nDDL,UInt_t *buf)
+//----------------------------------------------------------------------------
+Int_t AliTOFDDLRawData::RawDataTOF(TBranch* branch)
{
-
- //This method packs the TOF digits in a proper 32 bits structure
-
- Int_t iDDL = nDDL%AliTOFGeometry::NDDL();
- Int_t iSector = (Int_t)((Float_t)nDDL/AliTOFGeometry::NDDL());
- Int_t iTRM = 0;
- Int_t iTDC = 0;
- Int_t iCH =-1;
- Int_t sector;
- Int_t plate;
- Int_t strip;
- Int_t padx;
- Int_t padz;
- Int_t totCharge;
- Int_t timeOfFlight;
- Int_t error=0;
- Int_t eureka;
- UInt_t word;
- UInt_t baseWord;
- Int_t ndigits = TOFdigits->GetEntries();
- AliTOFdigit *digs;
- ofstream ftxt;
- if(!ndigits)
- {
- AliError("No found TOF digits");
- return;
- }
-
- if (fVerbose==2) ftxt.open("TOFdigits.txt",ios::app);
-
- for (Int_t digit=0;digit<ndigits;digit++) {
- digs = (AliTOFdigit*)TOFdigits->UncheckedAt(digit);
- sector = digs->GetSector(); // Sector Number (0-17)
- plate = digs->GetPlate(); // Plate Number (0-4)
- strip = digs->GetStrip(); // Strip Number (0-14/18/19)
- padx = digs->GetPadx(); // Pad Number in x direction (0-47)
- padz = digs->GetPadz(); // Pad Number in z direction (0-1)
- eureka = digs->GetTotPad(fTOFgeometry); // Global Pad Number inside a Sector
- // totCharge = (Int_t)digs->GetAdc(); //Use realistic ToT, for Standard production with no miscalibration/Slewing it == fAdC in digit (see AliTOFDigitizer)
- totCharge = (Int_t)digs->GetToT();
- timeOfFlight = (Int_t)digs->GetTdc();
-
- if (sector!=iSector || (Int_t)((Float_t)eureka/AliTOFGeometry::NPadXTRM()/AliTOFGeometry::NTRM())!=iDDL) continue;
-
- if (fVerbose==2) ftxt << " Sector: " << sector << " Plate: " << plate << " Strip: " << strip << " PadZ: " << padz << " PadX: " << padx << " totPadNumber " << eureka << endl;
-
- iTRM = (Int_t)((Float_t)eureka/AliTOFGeometry::NPadXTRM()) - iDDL*AliTOFGeometry::NTRM();
-
-
- iTDC = (Int_t)((Float_t)eureka/AliTOFGeometry::NCh()) - (iDDL*AliTOFGeometry::NTRM() + iTRM) * AliTOFGeometry::NTdc();
- /*
- iTDC = (Int_t)(AliTOFGeometry::NTdc()*
- (
- (Float_t)eureka/AliTOFGeometry::NPadXTRM() -
- (Int_t)((Float_t)eureka/AliTOFGeometry::NPadXTRM())
- )
- );
- */
-
- iCH = eureka - ((iDDL*AliTOFGeometry::NTRM() + iTRM) * AliTOFGeometry::NTdc() + iTDC) * AliTOFGeometry::NCh();
- /*
- iCH = (Int_t)(AliTOFGeometry::NCh() *
- (
- (Float_t)eureka/AliTOFGeometry::NPadXTRM()*AliTOFGeometry::NTdc() - (Int_t)((Float_t)eureka/AliTOFGeometry::NPadXTRM()*AliTOFGeometry::NTdc()) -
- (Int_t)((Float_t)eureka/AliTOFGeometry::NPadXTRM()*AliTOFGeometry::NTdc() - (Int_t)((Float_t)eureka/AliTOFGeometry::NPadXTRM()*AliTOFGeometry::NTdc()))
- )
- );
- */
-
- if (fVerbose==2) ftxt << "DDL: "<<nDDL<<" TRM: "<<iTRM<<" TDC: "<<iTDC<<" Channel: "<<iCH<<" totCharge: "<<totCharge<<" tof: "<<timeOfFlight<<endl;
-
- AliDebug(2,Form("%2i %2i %2i %2i %2i %2i %2i %2i %2i %7i %8i",nDDL,iTRM,iTDC,iCH,sector,plate,strip,padz,padx,totCharge,timeOfFlight));
-
- baseWord=0;
-
- word=iTRM;
- AliBitPacking::PackWord(word,baseWord, 0, 3); // TRM ID
- word=iTDC;
- AliBitPacking::PackWord(word,baseWord, 4, 8); // TDC ID
- word=iCH;
- AliBitPacking::PackWord(word,baseWord, 9,11); // CH ID
-
- // temporary control
- if (totCharge<0) word=TMath::Abs(totCharge);
- else word=totCharge;
- AliBitPacking::PackWord(word,baseWord,12,31); // Charge (TOT) // v0.01
- //AliBitPacking::PackWord(word,baseWord,12,19); // Charge (TOT) // v0.02
- //AliBitPacking::PackWord(0,baseWord,20,31); // v0.02
-
- fIndex++;
- buf[fIndex]=baseWord;
-
- baseWord=0;
-
- word=error;
- AliBitPacking::PackWord(word,baseWord,0, 7); // Error flag
- word=timeOfFlight;
- AliBitPacking::PackWord(word,baseWord,8,31); // time-of-flight // v0.01
- //AliBitPacking::PackWord(word,baseWord,8,19); // time-of-flight // v0.02
- //AliBitPacking::PackWord(0,baseWord,20,30); // v0.02
- //AliBitPacking::PackWord(1,baseWord,31,31); // v0.02
-
- fIndex++;
- buf[fIndex]=baseWord;
- word=0;
- baseWord=0;
-
- }//end for
-
- if (fVerbose==2) ftxt.close();
-
- return;
-
-}//end GetDigits
-
-//---------------------------------------------------------------------------------------
-
-Int_t AliTOFDDLRawData::RawDataTOF(TBranch* branch){
//
// This method creates the Raw data files for TOF detector
//
const Int_t kSize = 5000; //max number of digits per DDL file times 2
UInt_t buf[kSize];
- //UInt_t baseWord; // v0.01
- //UInt_t word; // v0.01
- fIndex=-1;
+ fIndex = -1;
+
+ fTOFdigitArray = * (TClonesArray**) branch->GetAddress();
- TClonesArray*& digits = * (TClonesArray**) branch->GetAddress();
char fileName[15];
ofstream outfile; // logical name of the output file
- AliRawDataHeader header;
+
+ //AliRawDataHeader header;
+ AliRawDataHeaderSim header;
+
UInt_t sizeRawData = 0;
+ branch->GetEvent();
+
+ GetDigits();
+
+ Int_t jj = -1;
+ Int_t iDDL = -1;
+ Int_t nDDL = -1;
+ Int_t nTRM = 0;
+ Int_t iChain = -1;
+
+ UInt_t nWordsPerTRM = 0;
+
//loop over TOF DDL files
- for(Int_t i = 0; i<AliTOFGeometry::NDDL()*AliTOFGeometry::NSectors(); i++){
+ for (nDDL=0; nDDL<AliDAQ::NumberOfDdls("TOF"); nDDL++) {
- strcpy(fileName,AliDAQ::DdlFileName("TOF",i)); //The name of the output file
+ strcpy(fileName,AliDAQ::DdlFileName("TOF",nDDL)); //The name of the output file
#ifndef __DECCXX
outfile.open(fileName,ios::binary);
#else
outfile.open(fileName);
#endif
- //write Dummy DATA HEADER
- UInt_t dataHeaderPosition=outfile.tellp();
+ iDDL = fTOFrawStream->GetDDLnumberPerSector(nDDL);
+
+ // write Dummy DATA HEADER
+ UInt_t dataHeaderPosition = outfile.tellp();
outfile.write((char*)(&header),sizeof(header));
- /*
- // v0.01
- baseWord=0;
- word=i;
- //AliBitPacking::PackWord(word,baseWord,0, 31); // Number of DDL file
- AliBitPacking::PackWord(word,baseWord,0, 6); // Number of DDL file
- AliBitPacking::PackWord(0,baseWord,7,31);
+ // DRM section: trailer
+ MakeDRMtrailer(buf);
+ // LTM section
fIndex++;
- buf[fIndex]=baseWord;
- */
+ buf[fIndex] = MakeFiller();
+ MakeLTMtrailer(buf);
+ MakeLTMdata(buf);
+ MakeLTMheader(buf);
+
+ // loop on TRM number per DRM
+ for (nTRM=AliTOFGeometry::NTRM(); nTRM>=3; nTRM--) {
+
+ nWordsPerTRM = 0;
+
+ // the slot number 3 of the even DRM (i.e. right) doesn't contain TDC digit data
+ if (iDDL%2==0 && nTRM==3) continue;
+
+ // TRM global trailer
+ MakeTRMtrailer(buf);
+
+ // loop on TRM chain number per TRM
+ for (iChain=AliTOFGeometry::NChain()-1; iChain>=0; iChain--) {
+
+ // TRM chain trailer
+ MakeTRMchainTrailer(iChain, buf);
+ nWordsPerTRM++;
+
+ // TRM TDC digits
+ MakeTDCdigits(nDDL, nTRM, iChain, buf, nWordsPerTRM);
+
+ // TRM chain header
+ MakeTRMchainHeader(nTRM, iChain, buf);
+ nWordsPerTRM++;
+
+ } // end loop on iChain
- branch->GetEvent();
+ // TRM global header
+ MakeTRMheader(nTRM, buf);
+
+ // TRM filler in case where TRM data number is odd
+ if (nWordsPerTRM%2!=0) MakeTRMfiller(buf, nWordsPerTRM);
+
+ } // end loop on nTRM
+
+ // DRM section: in
+ MakeDRMheader(nDDL, buf);
+
+ ReverseArray(buf, fIndex+1);
- //For each DDL file, buf contains the array of data words in Binary format
- //fIndex gives the number of 32 bits words in the buffer for each DDL file
- GetDigits(digits,i,buf);
outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
- for(Int_t ii=0;ii<(fIndex+1);ii++) buf[ii]=0;
- fIndex=-1;
+ 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.fSize = currentFilePosition - dataHeaderPosition;
header.SetAttribute(0); // valid data
outfile.seekp(dataHeaderPosition);
outfile.write((char*)(&header),sizeof(header));
outfile.close();
- }//end for
+ } //end loop on DDL file number
+
+ return 0;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::GetDigits()
+{
+ //
+ // Fill the TOF volumes' map with the TOF digit indices
+ //
+
+ Int_t vol[5] = {-1,-1,-1,-1,-1};
+
+ Int_t digit = -1;
+ Int_t ndigits = fTOFdigitArray->GetEntries();
+
+ AliTOFdigit *digs;
+
+ // loop on TOF digits
+ for (digit=0; digit<ndigits; digit++) {
+ digs = (AliTOFdigit*)fTOFdigitArray->UncheckedAt(digit);
+
+ vol[0] = digs->GetSector(); // Sector Number (0-17)
+ vol[1] = digs->GetPlate(); // Plate Number (0-4)
+ vol[2] = digs->GetStrip(); // Strip Number (0-14/18)
+ vol[3] = digs->GetPadx(); // Pad Number in x direction (0-47)
+ vol[4] = digs->GetPadz(); // Pad Number in z direction (0-1)
+
+ fTOFdigitMap->AddDigit(vol, digit);
+
+ } // close loop on digit del TOF
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeDRMheader(Int_t nDDL, UInt_t *buf)
+{
+ //
+ // DRM global header
+ //
+
+ Int_t iDDL = fTOFrawStream->GetDDLnumberPerSector(nDDL);
+
+ Int_t iSector = fTOFrawStream->GetSectorNumber(nDDL);
+
+ UInt_t baseWord=0;
+ UInt_t word;
+
+ // DRM event CRC
+ baseWord=0;
+ word = 1; // 0001 -> DRM data are coming from the VME slot number 1
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 0; // event CRC
+ AliBitPacking::PackWord(word,baseWord, 4,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 = 4; // 0100 -> DRM header ID
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // DRM status header 2
+ baseWord=0;
+ word = 1; // 0001 -> DRM data are coming from the VME slot number 1
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+
+ if (iDDL%2==1) {
+ word = 2047; // enable ID: [00000000000;11111111111] for odd
+ // (i.e. right) crates
+ AliBitPacking::PackWord(word,baseWord, 4,14);
+ } else {
+ word = 2045; // enable ID: [00000000000;11111111101] for even
+ // (i.e. left) crates
+ AliBitPacking::PackWord(word,baseWord, 4,14);
+ }
+
+ word = 0; //
+ AliBitPacking::PackWord(word,baseWord,15,15);
+ word = 0; // fault ID
+ AliBitPacking::PackWord(word,baseWord,16,27);
+ word = 4; // 0100 -> DRM header ID
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
- return 0;
+ // DRM status header 1
+ baseWord=0;
+ word = 1; // 0001 -> DRM data are coming from the VME slot number 1
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+
+ if (iDDL%2==1) {
+ word = 2047; // slot ID: [00000000000;11111111111] for odd
+ // (i.e. right) crates
+ AliBitPacking::PackWord(word,baseWord, 4,14);
+ } else {
+ word = 2045; // slot ID: [00000000000;11111111101] for even
+ // (i.e. left) crates
+ AliBitPacking::PackWord(word,baseWord, 4,14);
+ }
+
+ word = 1; // LHC clock status: 1/0
+ AliBitPacking::PackWord(word,baseWord,15,15);
+ word = 0; // reserved for future use
+ AliBitPacking::PackWord(word,baseWord,16,27);
+ word = 4; // 0100 -> DRM header ID
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // DRM global header
+ baseWord=0;
+ word = 1; // 0001 -> DRM data are coming from the VME slot number 1
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = fIndex+1 + 1; // event words
+ AliBitPacking::PackWord(word,baseWord, 4,20);
+ word = iDDL; // crate ID [0;3]
+ AliBitPacking::PackWord(word,baseWord,21,22);
+ word = iSector; // sector ID [0;17]
+ AliBitPacking::PackWord(word,baseWord,23,27);
+ word = 4; // 0100 -> DRM header ID
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
}
-//---------------------------------------------------------------------------
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeDRMtrailer(UInt_t *buf)
+{
+ //
+ // DRM global trailer
+ //
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ baseWord=0;
+ word = 1; // 0001 -> DRM data are coming from the VME slot number 1
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 0; // local event counter
+ AliBitPacking::PackWord(word,baseWord, 4,15);
+ word = 0; // reserved for future use
+ AliBitPacking::PackWord(word,baseWord,16,27);
+ word = 5; // 0101 -> DRM trailer ID
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeLTMheader(UInt_t *buf)
+{
+ //
+ // LTM header
+ //
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ baseWord=0;
+ word = 2; // 0010 -> LTM data are coming from the VME slot number 2
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 35; // event words
+ AliBitPacking::PackWord(word,baseWord, 4,16);
+ word = 0; // crc error
+ AliBitPacking::PackWord(word,baseWord,17,17);
+ word = 0; // fault
+ AliBitPacking::PackWord(word,baseWord,18,23);
+ word = 0;
+ AliBitPacking::PackWord(word,baseWord,24,27);
+ word = 4; // 0100 -> LTM header ID
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeLTMdata(UInt_t *buf)
+{
+ //
+ // LTM data
+ //
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ baseWord=0;
+ word = 100; // Local temperature in LTM5 -> 4 X 25 degree (environment temperature)
+ AliBitPacking::PackWord(word,baseWord, 0, 9);
+ word = 100; // Local temperature in LTM6 -> 4 X 25 degree (environment temperature)
+ AliBitPacking::PackWord(word,baseWord,10,19);
+ word = 100; // Local temperature in LTM7 -> 4 X 25 degree (environment temperature)
+ AliBitPacking::PackWord(word,baseWord,20,29);
+ word = 0;
+ AliBitPacking::PackWord(word,baseWord,30,31);
+
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Local temperature in LTM2, LMT3, LTM4 -> 4 X 25 degree (environment temperature)
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Local temperature in FEAC7, FEAC8, LTM1 -> 4 X 25 degree (environment temperature)
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Local temperature in FEAC4, FEAC5, FEAC6 -> 4 X 25 degree (environment temperature)
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Local temperature in FEAC1, FEAC2, FEAC3 -> 4 X 25 degree (environment temperature)
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ baseWord=0;
+ word = 0; // GND-FEAC15 -> Voltage drop between GND and FEAC15
+ AliBitPacking::PackWord(word,baseWord, 0, 9);
+ word = 0; // VTH16 -> Thereshould voltage for FEAC16
+ AliBitPacking::PackWord(word,baseWord,10,19);
+ word = 0; // GND-FEAC16 -> Voltage drop between GND and FEAC16
+ AliBitPacking::PackWord(word,baseWord,20,29);
+ word = 0;
+ AliBitPacking::PackWord(word,baseWord,30,31);
+
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // VTH14 -> Thereshould voltage for FEAC14
+ // GND-FEAC14 -> Voltage drop between GND and FEAC14
+ // VTH15 -> Thereshould voltage for FEAC15
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // GND-FEAC12 -> Voltage drop between GND and FEAC12
+ // VTH13 -> Thereshould voltage for FEAC13
+ // GND-FEAC13 -> Voltage drop between GND and FEAC13
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // VTH11 -> Thereshould voltage for FEAC11
+ // GND-FEAC11 -> Voltage drop between GND and FEAC11
+ // VTH12 -> Thereshould voltage for FEAC12
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // GND-FEAC9 -> Voltage drop between GND and FEAC9
+ // VTH10 -> Thereshould voltage for FEAC10
+ // GND-FEAC10 -> Voltage drop between GND and FEAC10
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // VTH8 -> Thereshould voltage for FEAC8
+ // GND-FEAC8 -> Voltage drop between GND and FEAC8
+ // VTH9 -> Thereshould voltage for FEAC9
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // GND-FEAC6 -> Voltage drop between GND and FEAC6
+ // VTH7 -> Thereshould voltage for FEAC7
+ // GND-FEAC7 -> Voltage drop between GND and FEAC7
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // VTH5 -> Thereshould voltage for FEAC5
+ // GND-FEAC5 -> Voltage drop between GND and FEAC5
+ // VTH6 -> Thereshould voltage for FEAC6
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // GND-FEAC3 -> Voltage drop between GND and FEAC3
+ // VTH4 -> Thereshould voltage for FEAC4
+ // GND-FEAC4 -> Voltage drop between GND and FEAC4
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // VTH2 -> Thereshould voltage for FEAC2
+ // GND-FEAC2 -> Voltage drop between GND and FEAC2
+ // VTH3 -> Thereshould voltage for FEAC3
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // LV16 -> Low Voltage measured by FEAC16
+ // GND-FEAC1 -> Voltage drop between GND and FEAC1
+ // VTH1 -> Thereshould voltage for FEAC1
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Low Voltage measured by FEAC13, FEAC14, FEAC15
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Low Voltage measured by FEAC10, FEAC11, FEAC12
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Low Voltage measured by FEAC7, FEAC8, FEAC9
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Low Voltage measured by FEAC4, FEAC5, FEAC6
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Low Voltage measured by FEAC1, FEAC2, FEAC3
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+
+ baseWord=0;
+ word = 0; // PDL45 -> Delay Line setting for PDL45
+ AliBitPacking::PackWord(word,baseWord, 0, 7);
+ word = 0; // PDL46 -> Delay Line setting for PDL46
+ AliBitPacking::PackWord(word,baseWord, 8,15);
+ word = 0; // PDL47 -> Delay Line setting for PDL47
+ AliBitPacking::PackWord(word,baseWord,16,23);
+ word = 0; // PDL48 -> Delay Line setting for PDL48
+ AliBitPacking::PackWord(word,baseWord,24,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL41, PDL42, PDL43, PDL44
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL37, PDL38, PDL39, PDL40
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL33, PDL34, PDL35, PDL36
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL29, PDL30, PDL31, PDL32
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL25, PDL26, PDL27, PDL28
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL21, PDL22, PDL23, PDL24
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL17, PDL18, PDL19, PDL20
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL13, PDL14, PDL15, PDL16
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL9, PDL10, PDL11, PDL12
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL5, PDL6, PDL7, PDL8
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ // Delay Line setting for PDL1, PDL2, PDL3, PDL4
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeLTMtrailer(UInt_t *buf)
+{
+ //
+ // LTM trailer
+ //
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ baseWord=0;
+ word = 2; // 0010 -> LTM data are coming from the VME slot number 2
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 0; // event crc
+ AliBitPacking::PackWord(word,baseWord, 4,15);
+ word = 0; // event number
+ AliBitPacking::PackWord(word,baseWord,16,27);
+ word = 5; // 0101 -> LTM trailer ID
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeTRMheader(Int_t nTRM, UInt_t *buf)
+{
+ //
+ // TRM header for the TRM number nTRM [ 3;12]
+ //
+
+ if (nTRM<3 || nTRM>12) {
+ AliWarning(Form(" TRM number is out of the right range [3;12] (nTRM = %3i",nTRM));
+ return;
+ }
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ baseWord = 0;
+ word = nTRM; // TRM data coming from the VME slot number nTRM
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 0; // event words
+ AliBitPacking::PackWord(word,baseWord, 4,16);
+ word = 0; // ACQuisition mode: [0;3] see document
+ AliBitPacking::PackWord(word,baseWord,17,18);
+ word = 0; // description of a SEU inside LUT tables for INL compensation;
+ // the data are unaffected
+ AliBitPacking::PackWord(word,baseWord,19,19);
+ word = 0; // Must Be Zero (MBZ)
+ AliBitPacking::PackWord(word,baseWord,20,27);
+ word = 4; // 0100 -> TRM header ID
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeTRMtrailer(UInt_t *buf)
+{
+ //
+ // TRM trailer
+ //
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ baseWord=0;
+ word = 15; // 1111 -> TRM trailer ID 1
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 0; // event CRC
+ AliBitPacking::PackWord(word,baseWord, 4,15);
+ word = 0; // local event counter == DRM local event counter
+ AliBitPacking::PackWord(word,baseWord,16,27);
+ word = 5; // 0101 -> TRM trailer ID 2
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeTRMchainHeader(Int_t nTRM, Int_t iChain,
+ UInt_t *buf)
+{
+ //
+ // TRM chain header
+ //
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ if (nTRM<3 || nTRM>12) {
+ AliWarning(Form(" TRM number is out of the right range [3;12] (nTRM = %3i", nTRM));
+ return;
+ }
+
+ if (iChain<0 || iChain>1) {
+ AliWarning(Form(" Chain number is out of the right range [0;1] (iChain = %3i", iChain));
+ return;
+ }
+
+ baseWord=0;
+ word = nTRM; // TRM data coming from the VME slot ID nTRM
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 0; // bunch ID
+ AliBitPacking::PackWord(word,baseWord, 4,15);
+ word = 100; // PB24 temperature -> 4 X 25 degree (environment temperature)
+ AliBitPacking::PackWord(word,baseWord,16,23);
+ word = (Int_t)(5 * gRandom->Rndm()); // PB24 ID [0;4]
+ AliBitPacking::PackWord(word,baseWord,24,26);
+ word = 0; // TS
+ AliBitPacking::PackWord(word,baseWord,27,27);
+ switch (iChain) {
+ case 0:
+ word = 0; // 0000 -> TRM chain 0 ID
+ break;
+ case 1:
+ word = 2; // 0010 -> TRM chain 1 ID
+ break;
+ }
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeTRMfiller(UInt_t *buf, UInt_t nWordsPerTRM)
+{
+ //
+ // TRM filler
+ //
+
+ Int_t jj = -1;
+
+ fIndex++;
+ for (jj=fIndex; jj>fIndex-(Int_t)nWordsPerTRM; jj--) {
+ buf[jj] = buf[jj-1];
+ }
+
+ buf[fIndex-nWordsPerTRM] = MakeFiller();
+
+}
+
+//----------------------------------------------------------------------------
+UInt_t AliTOFDDLRawData::MakeFiller()
+{
+ //
+ // Filler word definition: to make even the number of words per TRM/LTM
+ //
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ baseWord=0;
+ word = 0; // 0000 -> filler ID 1
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 0; // MBZ
+ AliBitPacking::PackWord(word,baseWord, 4,27);
+ word = 7; // 0111 -> filler ID 2
+ AliBitPacking::PackWord(word,baseWord, 28,31);
+
+ return baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeTRMchainTrailer(Int_t iChain, UInt_t *buf)
+{
+ //
+ // TRM chain trailer
+ //
+
+ if (iChain<0 || iChain>1) {
+ AliWarning(Form(" Chain number is out of the right range [0;1] (iChain = %3i", iChain));
+ return;
+ }
+
+ UInt_t baseWord;
+ UInt_t word;
+
+ baseWord=0;
+ word = 0; // status
+ AliBitPacking::PackWord(word,baseWord, 0, 3);
+ word = 0; // MBZ
+ AliBitPacking::PackWord(word,baseWord, 4,15);
+ word = 0; // event counter
+ AliBitPacking::PackWord(word,baseWord,16,27);
+ switch (iChain) {
+ case 0:
+ word = 1; // 0001 -> TRM chain 0 trailer ID
+ break;
+ case 1:
+ word = 3; // 0011 -> TRM chain 1 trailer ID
+ break;
+ }
+ AliBitPacking::PackWord(word,baseWord,28,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain,
+ UInt_t *buf, UInt_t &nWordsPerTRM)
+{
+ //
+ // TRM TDC digit
+ //
+
+ if (nDDL<0 || nDDL>71) {
+ AliWarning(Form(" DDL number is out of the right range [0;71] (nDDL = %3i", nDDL));
+ return;
+ }
+
+ if (nTRM<3 || nTRM>12) {
+ AliWarning(Form(" TRM number is out of the right range [3;12] (nTRM = %3i", nTRM));
+ return;
+ }
+
+ if (iChain<0 || iChain>1) {
+ AliWarning(Form(" Chain number is out of the right range [0;1] (iChain = %3i", iChain));
+ return;
+ }
+
+ Int_t iDDL = nDDL%AliTOFGeometry::NDDL();
+
+ Int_t volume[5] = {-1, -1, -1, -1, -1};
+ Int_t indexDigit[3] = {-1, -1, -1};
+
+ Int_t totCharge = -1;
+ Int_t timeOfFlight = -1;
+
+ AliTOFdigit *digs;
+
+ UInt_t baseWord=0;
+ UInt_t word=0;
+
+ Int_t jj = -1;
+ Int_t nTDC = -1;
+ Int_t iCH = -1;
+
+ ofstream ftxt;
+
+ if (fVerbose==2) ftxt.open("TOFdigits.txt",ios::app);
+
+ for (jj=0; jj<5; jj++) volume[jj] = -1;
+
+ // loop on TDC number
+ for (nTDC=AliTOFGeometry::NTdc()-1; nTDC>=0; nTDC--) {
+
+ // the DRM odd (i.e. left) slot number 3 doesn't contain TDC digit data
+ // for TDC numbers 3-14
+ if (iDDL%2==1 && nTRM==3 && (Int_t)(nTDC/3.)!=0) continue;
+
+ // loop on TDC channel number
+ for (iCH=AliTOFGeometry::NCh()-1; iCH>=0; iCH--) {
+
+ fTOFrawStream->EquipmentId2VolumeId(nDDL, nTRM, iChain, nTDC, iCH, volume);
+
+ if (volume[0]==-1 || volume[1]==-1 || volume[2]==-1 ||
+ volume[3]==-1 || volume[4]==-1) continue;
+ //AliInfo(Form(" sector = %2i plate = %1i strip = %2i
+ //padX = %2i padZ = %1i", volume[0], volume[1], volume[2],
+ //volume[3], volume[4]));
+
+ for (jj=0; jj<3; jj++) indexDigit[jj] = -1;
+
+ fTOFdigitMap->GetDigitIndex(volume, indexDigit);
+
+ for (jj=0; jj<3;jj++) {
+
+ if (indexDigit[jj]<0) continue;
+ digs = (AliTOFdigit*)fTOFdigitArray->UncheckedAt(indexDigit[jj]);
+
+ if (digs->GetSector()!=volume[0] ||
+ digs->GetPlate() !=volume[1] ||
+ digs->GetStrip() !=volume[2] ||
+ digs->GetPadx() !=volume[3] ||
+ digs->GetPadz() !=volume[4]) AliWarning(" --- ERROR --- ");
+
+ timeOfFlight = (Int_t)(digs->GetTdc())%8192;
+ totCharge = (Int_t)(digs->GetToT());//digs->GetAdc();
+ // temporary control
+ if (totCharge<0) totCharge = TMath::Abs(totCharge);
+ if (totCharge>=256) totCharge = 255;
+
+ if (fVerbose==2) {
+ if (nDDL<10) ftxt << " " << nDDL;
+ else ftxt << " " << nDDL;
+ if (nTRM<10) ftxt << " " << nTRM;
+ else ftxt << " " << nTRM;
+ ftxt << " " << iChain;
+ if (nTDC<10) ftxt << " " << nTDC;
+ else ftxt << " " << nTDC;
+ ftxt << " " << iCH;
+ if (volume[0]<10) ftxt << " -> " << volume[0];
+ else ftxt << " -> " << volume[0];
+ ftxt << " " << volume[1];
+ if (volume[2]<10) ftxt << " " << volume[2];
+ else ftxt << " " << volume[2];
+ ftxt << " " << volume[4];
+ if (volume[3]<10) ftxt << " " << volume[3];
+ else ftxt << " " << volume[3];
+ if (totCharge<10) ftxt << " " << totCharge;
+ else if (totCharge>=10 && totCharge<100) ftxt << " " << totCharge;
+ else ftxt << " " << totCharge;
+ if (timeOfFlight<10) ftxt << " " << timeOfFlight << endl;
+ else if (timeOfFlight>=10 && timeOfFlight<100) ftxt << " " << timeOfFlight << endl;
+ else if (timeOfFlight>=100 && timeOfFlight<1000) ftxt << " " << timeOfFlight << endl;
+ else ftxt << " " << timeOfFlight << endl;
+ }
+
+ word = timeOfFlight; // time-of-fligth measurement
+ AliBitPacking::PackWord(word,baseWord, 0,12);
+
+ word = totCharge; // time-over-threshould measurement
+ AliBitPacking::PackWord(word,baseWord,13,20);
+
+ word = iCH; // TDC channel ID [0;7]
+ AliBitPacking::PackWord(word,baseWord,21,23);
+ word = nTDC; // TDC ID [0;14]
+ AliBitPacking::PackWord(word,baseWord,24,27);
+ word = 0; // error flag
+ AliBitPacking::PackWord(word,baseWord,28,28);
+ word = 0; // Packing Status [0;5]
+ AliBitPacking::PackWord(word,baseWord,29,30);
+ word = 1; // TRM TDC digit ID
+ AliBitPacking::PackWord(word,baseWord,31,31);
+ fIndex++;
+ buf[fIndex]=baseWord;
+
+ nWordsPerTRM++;
+ baseWord=0;
+
+ } //end loop on digits in the same volume
+
+ } // end loop on TDC channel number
+
+ } // end loop on TDC number
+
+
+ if (fVerbose==2) ftxt.close();
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFDDLRawData::ReverseArray(UInt_t a[], Int_t n) const
+{
+ //
+ // Reverses the n elements of array a
+ //
+
+ Int_t ii, temp;
+
+ for (ii=0; ii<n/2; ii++) {
+ temp = a[ii];
+ a[ii] = a[n-ii-1];
+ a[n-ii-1] = temp;
+ }
+
+ return;
+
+}
#include "TObject.h"
+class TBranch;
+class TClonesArray;
+
+class AliTOFDigitMap;
class AliTOFGeometry;
+class AliTOFRawStream;
+
+class AliTOFDDLRawData:public TObject {
-class AliTOFDDLRawData:public TObject{
public:
+
AliTOFDDLRawData(); // default constructor
AliTOFDDLRawData(AliTOFGeometry *tofGeom); // constructor
virtual ~AliTOFDDLRawData(){;} // destructor
AliTOFDDLRawData(const AliTOFDDLRawData &source); // copy constructor
AliTOFDDLRawData& operator=(const AliTOFDDLRawData &source); // ass. op.
+ void SetVerbose(Int_t Verbose){fVerbose=Verbose;} // To set the verbose level
+
Int_t RawDataTOF(TBranch* branch);
- // This method generates the files with the TOF detector data
- void SetVerbose(Int_t Verbose){fVerbose=Verbose;}
- // To set the verbose level
+
private:
- void GetDigits(TClonesArray *TOFdigits, Int_t ddl,UInt_t *buf);
- //This method formats and stores in buf all the digits of a TOF module
- Int_t fVerbose; //Verbose level (0:no msg, 1:msg, 2:digits in txt files)
- Int_t fIndex; //number of 32 words to be stored into the output file
- AliTOFGeometry *fTOFgeometry; //Pointer to the TOF geometry
+ void GetDigits();
+
+ void ReverseArray(UInt_t a[], Int_t n) const;
+
+ void MakeDRMheader(Int_t nDDL, UInt_t *buf);
+ void MakeDRMtrailer(UInt_t *buf);
+ void MakeLTMheader(UInt_t *buf);
+ void MakeLTMdata(UInt_t *buf);
+ void MakeLTMtrailer(UInt_t *buf);
+ void MakeTRMheader(Int_t nTRM, UInt_t *buf);
+ void MakeTRMtrailer(UInt_t *buf);
+ void MakeTRMfiller(UInt_t *buf, UInt_t nWordsPerTRM);
+ void MakeTRMchainHeader(Int_t iChain, Int_t nTRM, UInt_t *buf);
+ void MakeTRMchainTrailer(Int_t iChain, UInt_t *buf);
+ void MakeTDCdigits(Int_t nDDL, Int_t nTRM, Int_t iChain, UInt_t *buf, UInt_t &nWordsPerTRM);
+
+ UInt_t MakeFiller();
+
+ Int_t fVerbose; //Verbose level (0:no msg, 1:msg, 2:digits in txt files)
+ Int_t fIndex; //number of 32-bit words to be stored into the output file
+
+ AliTOFGeometry *fTOFgeometry; //Pointer to the TOF geometry
+
+ AliTOFDigitMap *fTOFdigitMap; //Pointer to the channel-TOF map
+
+ TClonesArray *fTOFdigitArray; //Pointer to the TOF digits
+
+ AliTOFRawStream *fTOFrawStream; //Pointer to the AliTOFRawStream class
ClassDef(AliTOFDDLRawData,1)
//
// AliTOFDigitMap class
//
-// digitmap enables fast check if the pad was already hit
-// The index of a AliTOFdigit is saved in the each hitmap "cell"
-// (there is an offset +1, because the index can be zero and
-// zero means empty cell.
+// digitmap enables fast check if the pad was already digit.
+
+// The index of a AliTOFdigit is saved in the each digitmap "cell"
+// (there is an offset +1, because the index can be zero and zero
+// means empty cell).
// In TOF, number of strips varies according plate type, the highest
-// number is in plate C. For all plates is used this number, so
-// the size of the digitmap is a little bit greater than necessary, but
-// it simplifies the access algorithm.
+// number is in plate C. For all plates is used this number, so the
+// size of the digitmap is a little bit greater than necessary, but it
+// simplifies the access algorithm.
//
//
// Author: F. Pierella based on AliTOFHitMap
//
-////////////////////////////////////////////////////////////////////////
+// Modified by A. De Caro
+//
+///////////////////////////////////////////////////////////////////////
-#include "TClonesArray.h"
+#include "AliLog.h"
#include "AliTOFDigitMap.h"
#include "AliTOFGeometry.h"
// Default ctor
//
fDigitMap = 0;
- fDigits = 0;
fTOFGeometry = new AliTOFGeometry();
-}
-
-////////////////////////////////////////////////////////////////////////
-AliTOFDigitMap::AliTOFDigitMap(TClonesArray *dig, AliTOFGeometry *tofGeom)
-{
- //
- // ctor
- //
- // of course, these constants must not be hardwired
- // change later
-
- fTOFGeometry = tofGeom;
-
fNSector = AliTOFGeometry::NSectors();
fNplate = AliTOFGeometry::NPlates();
- fNstrip = fTOFGeometry->NMaxNstrip();
+ fNstrip = fTOFGeometry->NStripC();//fTOFGeometry->NMaxNstrip();
fNpx = AliTOFGeometry::NpadX();
fNpz = AliTOFGeometry::NpadZ();
fMaxIndex=fNSector*fNplate*fNstrip*fNpx*fNpz;
- fDigitMap = new Int_t[fMaxIndex];
- fDigits = dig;
+
+ fDigitMap = new Int_t*[fMaxIndex];
+ for (Int_t i=0; i<fMaxIndex; i++) fDigitMap[i] = new Int_t[kMaxDigitsPerPad];
Clear();
}
//
// Destructor
//
- if (fDigitMap) delete[] fDigitMap;
+ if (fDigitMap) {
+ for (Int_t i=0; i<fMaxIndex; i++) delete[] fDigitMap[i];
+ }
fTOFGeometry = 0;
}
////////////////////////////////////////////////////////////////////////
-void AliTOFDigitMap::Clear(const char *)
+void AliTOFDigitMap::Clear(const Option_t*)
{
-//
-// Clear hitmap
-//
- memset(fDigitMap,0,sizeof(int)*fMaxIndex);
+ //
+ // Clear digitmap
+ //
+
+ for(Int_t ii=0; ii<fMaxIndex; ii++) {
+ for (Int_t jj=0; jj<kMaxDigitsPerPad; jj++) {
+ fDigitMap[ii][jj] = 0;
+ }
+ }
+
}
////////////////////////////////////////////////////////////////////////
Int_t AliTOFDigitMap::CheckedIndex(Int_t *vol) const
{
-//
-// Return checked indices for vol
-//
- Int_t index=
+ //
+ // Return checked index for vol
+ //
+
+ Int_t index =
vol[0]*fNplate*fNstrip*fNpx*fNpz+ // sector
vol[1]*fNstrip*fNpx*fNpz+ // plate
vol[2]*fNpx*fNpz+ // strip
vol[3]*fNpz+ // padx
vol[4]; // padz
- if (index >= fMaxIndex) {
- Error("AliTOFDigitMap","CheckedIndex - input outside bounds");
- return -1;
+ if (index >= fMaxIndex || index < 0) {
+ AliError("CheckedIndex - input outside bounds");
+ return -1;
} else {
- return index;
+ return index;
}
}
////////////////////////////////////////////////////////////////////////
-void AliTOFDigitMap::SetHit(Int_t *vol, Int_t idigit)
+void AliTOFDigitMap::AddDigit(Int_t *vol, Int_t idigit)
{
-//
-// Assign digit to pad vol
-//
+ //
+ // Assign digit to pad vol
+ //
+ // 0 means empty pad, we need to shift indeces by 1
-// 0 means empty pad, we need to shift indeces by 1
- fDigitMap[CheckedIndex(vol)]=idigit+1;
-}
+ for (Int_t slot=0; slot<kMaxDigitsPerPad; slot++) {
-////////////////////////////////////////////////////////////////////////
-void AliTOFDigitMap::SetHit(Int_t *vol)
-{
-//
-// Assign last digit to pad vol
-//
+ if (fDigitMap[CheckedIndex(vol)][slot]==0) {
+ fDigitMap[CheckedIndex(vol)][slot]=idigit+1;
+ break;
+ }
+ //else continue;
-// 0 means empty pad, we need to shift indeces by 1
- fDigitMap[CheckedIndex(vol)]=fDigits->GetLast()+1;
+ }
}
////////////////////////////////////////////////////////////////////////
-Int_t AliTOFDigitMap::GetHitIndex(Int_t *vol) const
+void AliTOFDigitMap::GetDigitIndex(Int_t *vol, Int_t *digitLabels) const
{
-//
-// Get contents of pad vol
-//
+ //
+ // Get all contents (digitLabels) of pad volume (vol)
+ //
+
+ // 0 means empty pad, we need to shift indeces by 1
-// 0 means empty pad, we need to shift indeces by 1
- return fDigitMap[CheckedIndex(vol)]-1;
+ Int_t dummy;
+ for (Int_t j=0; j<kMaxDigitsPerPad; j++) {
+ dummy = GetDigitIndex(vol,j);
+ if (dummy>=0) digitLabels[j] = dummy;
+ else break;
+ }
}
////////////////////////////////////////////////////////////////////////
-TObject* AliTOFDigitMap::GetHit(Int_t *vol) const
+Int_t AliTOFDigitMap::GetDigitIndex(Int_t *vol, Int_t label) const
{
-//
-// Get pointer to object at vol
-// return 0 if vol out of bounds
- Int_t index=GetHitIndex(vol);
- return (index <0) ? 0 : fDigits->UncheckedAt(index);
+ //
+ // Get one of the contents (label) of pad volume (vol)
+ //
+
+ // 0 means empty pad, we need to shift indeces by 1
+
+ if (!(label<kMaxDigitsPerPad)) {
+ AliWarning(Form("label (=%i) >= kMaxDigitsPerPad (=%i)", label, kMaxDigitsPerPad));
+ return -1;
+ }
+
+ if (CheckedIndex(vol)==-1) return -1;
+
+ Int_t dummy = fDigitMap[CheckedIndex(vol)][label];
+
+ if (dummy>0) return dummy-1;
+ else return -1;
+
}
////////////////////////////////////////////////////////////////////////
-FlagType AliTOFDigitMap::TestHit(Int_t *vol) const
+FlagType AliTOFDigitMap::TestDigit(Int_t *vol) const
{
//
// Check if hit cell is empty, used or unused
//
- Int_t inf=fDigitMap[CheckedIndex(vol)];
+ Int_t inf=fDigitMap[CheckedIndex(vol)][0]; // to be modified
if (inf > 0) {
return kUsed;
} else if (inf == 0) {
// //
// Author: F. Pierella | pierella@bo.infn.it //
// //
+// Modified by A. De Caro | decaro@sa.infn.it //
+// //
//////////////////////////////////////////////////////////////
#include "TObject.h"
#include "AliHitMap.h"
-class TClonesArray;
class AliTOFGeometry;
class AliTOFDigitMap : public TObject
{
public:
AliTOFDigitMap();
- AliTOFDigitMap(TClonesArray *dig, AliTOFGeometry *tofGeom);
AliTOFDigitMap(const AliTOFDigitMap & digitMap);
virtual ~AliTOFDigitMap();
- // Clear the hit map
- virtual void Clear(const char *opt = "");
- // Set a single hit
- virtual void SetHit(Int_t *vol, Int_t idigit);
- virtual void SetHit(Int_t *vol);
- // Get index of hit in the list of digits
- virtual Int_t GetHitIndex(Int_t *vol) const;
- // Get pointer to digit
- virtual TObject* GetHit(Int_t *vol) const;
- // Test hit status
- virtual FlagType TestHit(Int_t *vol) const;
+
+ // Clear the digit map
+ virtual void Clear(const Option_t* opt = "");
+ // Add a single digit
+ void AddDigit(Int_t *vol, Int_t idigit);
+
+ // Get index of digit in the cell labelled by vol
+ Int_t GetDigitIndex(Int_t *vol, Int_t index) const;
+ // Get indices of digits in the cell labelled by vol
+ void GetDigitIndex(Int_t *vol, Int_t *index) const;
+
+ // Test digit status
+ virtual FlagType TestDigit(Int_t *vol) const;
+
// Assignment operator
AliTOFDigitMap& operator = (const AliTOFDigitMap& rhs);
// Check index
Int_t CheckedIndex(Int_t *vol) const;
private:
+ enum {
+ kMaxDigitsPerPad = 3
+ };
+
Int_t fNSector; // Number of sectors
Int_t fNplate; // Number of plates
Int_t fNstrip; // Maximum number of strips
Int_t fNpx; // Number of pads in x
Int_t fNpz; // Number of pads in z
- TClonesArray *fDigits; // Pointer to sdigits
Int_t fMaxIndex; // maximum index in hit map
- Int_t *fDigitMap; // ! [fMaxIndex]
+ Int_t **fDigitMap; // ! [fMaxIndex][kMaxDigitsPerPad]
AliTOFGeometry *fTOFGeometry; // Pointer to the TOF geometry
- ClassDef(AliTOFDigitMap,0) // Implements DigitMap as a 1-dim array
+ ClassDef(AliTOFDigitMap,1) // Implements DigitMap as a 1-dim array
};
#endif
// start loop on number of slots for current sdigit
for (Int_t islot = 0; islot < nslot; islot++) {
- Float_t digit[2]; // TOF digit variables
+ Float_t digit[4] = {-1.,-1.,-1.,-1.}; // TOF digit variables
Int_t tracknum[AliTOFSDigit::kMAXDIGITS]; // contributing tracks for the current slot
Float_t tdc=tofsdigit->GetTdc(islot); digit[0]=tdc;
static Int_t NDDL() { return kNDDL;};
static Int_t NTRM() { return kNTRM;}
static Int_t NTdc() { return kNTdc;};
+ static Int_t NChain() { return kNChain;};
static Int_t NCh() { return kNCh;};
- static Int_t NPadXTRM() { return kNCh*kNTdc;};
+ static Int_t NPadXTRM() { return kNCh*kNTdc*kNChain;};
virtual Float_t ZlenA() const { return fZlenA;};
virtual Float_t ZlenB() const { return fZlenB;};
// TARODA : TOF-ALICE Read Out and Data Acquisition system
enum {
kNDDL = 4, // Number of DDL (Detector Data Link) per sector
- kNTRM = 10, // Number of TRM ( Readout Module) per DDL
- kNTdc = 30, // Number of Tdc (Time to Digital Converter) per TRM
+ kNTRM = 12, // Number of TRM ( Readout Module) per DDL
+ kNTdc = 15, // Number of Tdc (Time to Digital Converter) per TRM
+ kNChain = 2, // Number of chains per TRM
kNCh = 8 // Number of channels per Tdc
};
fNSector = AliTOFGeometry::NSectors();
fNplate = AliTOFGeometry::NPlates();
- fNstrip = fTOFGeometry->NMaxNstrip();
+ fNstrip = fTOFGeometry->NStripC();//fTOFGeometry->NMaxNstrip();
fNpx = AliTOFGeometry::NpadX();
fNpz = AliTOFGeometry::NpadZ();
fMaxIndex=fNSector*fNplate*fNstrip*fNpx*fNpz;
// To read TOF raw data
//
+ Int_t ii = 0;
Int_t indexDDL = 0;
+ Int_t detectorIndex[5] = {-1, -1, -1, -1, -1};
- AliRawReaderFile reader(ievt);
+ AliRawReaderFile reader(iEvent);
+ reader.RewindEvents();
- for (indexDDL = 0; indexDDL < 72; indexDDL++) {
+ while (reader.NextEvent()) {
- reader.Reset();
- AliTOFRawStream stream(&reader);
- reader.Select("TOF", indexDDL, indexDDL);
+ for (indexDDL = 0; indexDDL < AliDAQ::NumberOfDdls("TOF"); indexDDL++) {
- //FILE *fpw = fopen("TOFrawDataRead.txt","w");
+ reader.Reset();
+ AliTOFRawStream stream(&reader);
+ reader.Select("TOF", indexDDL, indexDDL);
- while(stream.Next()) {
+ //FILE *fpw = fopen("TOFrawDataRead.txt","w");
- if (stream.GetSector()==0) {
+ while(stream.Next()) {
- printf("%2i %2i %2i %2i %2i %1i %2i %1i %2i %7i %8i\n",
- stream.GetDDL(),stream.GetTRM(),
- stream.GetTDC(),stream.GetChannel(),
- stream.GetSector(),stream.GetPlate(),
- stream.GetStrip(),stream.GetPadZ(),stream.GetPadX(),
- stream.GetADCbin(),stream.GetTofBin());
- /*
- Int_t iSector = stream.GetSector();
- Int_t iPlate = stream.GetPlate();
- Int_t iStrip = stream.GetStrip();
- Int_t iPadZ = stream.GetPadZ();
- Int_t iPadX = stream.GetPadX();
- Int_t iTof = stream.GetTofBin();
- Int_t iAdc = stream.GetADCbin();
-
- fprintf(fpw,"%2i %1i %2i %1i %2i %8i %7i\n",
- iSector, iPlate, iStrip, iPadZ, iPadX, iTof, iAdc);
- */
+ for (ii=0; ii<5; ii++) detectorIndex[ii] = -1;
- }
+ detectorIndex[0] = (Int_t)stream.GetSector();
+ detectorIndex[1] = (Int_t)stream.GetPlate();
+ detectorIndex[2] = (Int_t)stream.GetStrip();
+ detectorIndex[3] = (Int_t)stream.GetPadZ();
+ detectorIndex[4] = (Int_t)stream.GetPadX();
- }
+ if (detectorIndex[0]==-1 ||
+ detectorIndex[1]==-1 ||
+ detectorIndex[2]==-1 ||
+ detectorIndex[3]==-1 ||
+ detectorIndex[4]==-1) continue;
+ else {
- }
+ printf("%2i %2i %2i %2i %2i %2i %1i %2i %1i %2i %7i %8i\n",
+ stream.GetDDL(),stream.GetTRM(),stream.GetTRMchain(),
+ stream.GetTDC(),stream.GetTDCchannel(),
+ stream.GetSector(),stream.GetPlate(),
+ stream.GetStrip(),stream.GetPadZ(),stream.GetPadX(),
+ stream.GetToTbin(),stream.GetTofBin());
+
+ } // end else
+
+ } // end while loop on next stream
+
+ } // endl loop on DDL files
+
+ iEvent++;
+
+ } // end while loop on event
}
**************************************************************************/
/*
+$Log$
+Revision 1.6.1 2006/06/28 A. De Caro, R. Preghenella:
+ Update TOF raw data format
+ according to the final version
+ (see the ALICE internal note in preparation
+ 'ALICE TOF raw data format')
+ Added the methods for the correspoonding numbering
+ between the equipment IDs and the volume IDs:
+ Equip2VolNPlate(...)
+ Equip2VolNStrip(...)
+ Equip2VolNPad(...)
+
Revision 0.02 2005/07/28 A. De Caro:
Update format TOF raw data
(temporary solution)
// //
////////////////////////////////////////////////////////////////////////
+#include "AliLog.h"
#include "AliRawReader.h"
#include "AliTOFGeometry.h"
#include "AliTOFGeometryV5.h"
#include "AliTOFRawStream.h"
+
+/******************************************
+GENERAL DATA FORMAT
+******************************************/
+
+//filler
+#define FILLER 0x70000000
+
+//word type mask/position
+#define WORD_TYPE_MASK 0xf0000000
+#define WORD_TYPE_POSITION 28
+
+//global header word required bit pattern
+#define GLOBAL_HEADER 0x40000000
+
+//global trailer word required bit pattern
+#define GLOBAL_TRAILER 0x50000000
+
+//error word required bit pattern
+#define ERROR 0x30000000
+
+//header slot ID mask/position
+#define HEADER_SLOT_ID_MASK 0x0000000f
+#define HEADER_SLOT_ID_POSITION 0
+
+//word types
+#define GLOBAL_HEADER_TYPE 4
+#define GLOBAL_TRAILER_TYPE 5
+#define ERROR_TYPE 6
+#define FILLER_TYPE 7
+#define TRM_CHAIN0_HEADER_TYPE 0
+#define TRM_CHAIN0_TRAILER_TYPE 1
+#define TRM_CHAIN1_HEADER_TYPE 2
+#define TRM_CHAIN1_TRAILER_TYPE 3
+
+//slot types
+#define DRM_ID_NUMBER 1
+#define LTM_ID_NUMBER 2
+
+
+/******************************************
+DRM DATA FORMAT
+******************************************/
+
+//DRM global header word required bit pattern
+#define DRM_GLOBAL_HEADER 0x40000001
+
+//DRM event words mask/position
+#define DRM_EVENT_WORDS_MASK 0x001ffff0
+#define DRM_EVENT_WORDS_POSITION 4
+
+//DRM DRM ID mask/position
+#define DRM_DRM_ID_MASK 0x0fe00000
+#define DRM_DRM_ID_POSITION 21
+
+//DRM status header 1 word required bit pattern
+#define DRM_STATUS_HEADER_1 0x40000001
+
+//DRM slot ID mask/position
+#define DRM_SLOT_ID_MASK 0x00007ff0
+#define DRM_SLOT_ID_POSITION 4
+
+//DRM C-bit mask/position
+#define DRM_C_BIT_MASK 0x00008000
+#define DRM_C_BIT_POSITION 15
+
+//DRM status header 2 word required bit pattern
+#define DRM_STATUS_HEADER_2 0x40000001
+
+//DRM enable ID mask/position
+#define DRM_ENABLE_ID_MASK 0x00007ff0
+#define DRM_ENABLE_ID_POSITION 4
+
+//DRM fault ID mask/position
+#define DRM_FAULT_ID_MASK 0x07ff0000
+#define DRM_FAULT_ID_POSITION 16
+
+//DRM status header 3 word required bit pattern
+#define DRM_STATUS_HEADER_3 0x40000001
+
+//DRM TTC event counter mask/position
+#define DRM_TTC_EVENT_COUNTER_MASK 0x0ffffff0
+#define DRM_TTC_EVENT_COUNTER_POSITION 4
+
+//DRM event CRC mask/position
+//#define DRM_EVENT_CRC_MASK 0x001ffff0
+#define DRM_EVENT_CRC_MASK 0x000ffff0
+#define DRM_EVENT_CRC_POSITION 4
+
+//DRM global trailer word required bit pattern
+#define DRM_GLOBAL_TRAILER 0x50000001
+
+//DRM local event counter mask/position
+#define DRM_LOCAL_EVENT_COUNTER_MASK 0x0000fff0
+#define DRM_LOCAL_EVENT_COUNTER_POSITION 4
+
+
+/******************************************
+TRM DATA FORMAT
+******************************************/
+
+//TRM global header word required bit pattern
+#define TRM_GLOBAL_HEADER 0x40000000
+
+//TRM slot ID mask/position
+#define TRM_SLOT_ID_MASK 0x0000000f
+#define TRM_SLOT_ID_POSITION 0
+
+//TRM event words mask/position
+#define TRM_EVENT_WORDS_MASK 0x0001fff0
+#define TRM_EVENT_WORDS_POSITION 4
+
+//TRM ACQ-bits mask/position
+#define TRM_ACQ_BITS_MASK 0x00060000
+#define TRM_ACQ_BITS_POSITION 17
+
+//TRM L-bit mask/position
+#define TRM_L_BIT_MASK 0x00080000
+#define TRM_L_BIT_POSITION 19
+
+//TRM chain-0 header word required bit pattern
+#define TRM_CHAIN_0_HEADER 0x00000000
+
+//TRM chain-1 header word required bit pattern
+#define TRM_CHAIN_1_HEADER 0x20000000
+
+//TRM bunch ID mask/position
+#define TRM_BUNCH_ID_MASK 0x0000fff0
+#define TRM_BUNCH_ID_POSITION 4
+
+//TRM PB24 temp mask/position
+#define TRM_PB24_TEMP_MASK 0x00ff0000
+#define TRM_PB24_TEMP_POSITION 16
+
+//TRM PB24 ID mask/position
+#define TRM_PB24_ID_MASK 0x07000000
+#define TRM_PB24_ID_POSITION 24
+
+//TRM TS-bit mask/position
+#define TRM_TS_BIT_MASK 0x08000000
+#define TRM_TS_BIT_POSITION 27
+
+//TRM chain-0 trailer word required bit pattern
+#define TRM_CHAIN_0_TRAILER 0x10000000
+
+//TRM chain-1 trailer word required bit pattern
+#define TRM_CHAIN_1_TRAILER 0x30000000
+
+//TRM status mask/position
+#define TRM_STATUS_MASK 0x0000000f
+#define TRM_STATUS_POSITION 0
+
+
+//TDC digit
+
+//TRM TDC digit word required bit pattern
+#define TRM_TDC_DIGIT 0x8000000
+
+//TRM digit time mask/position
+#define TRM_DIGIT_TIME_MASK 0x00001fff
+#define TRM_DIGIT_TIME_POSITION 0
+
+//TRM long digit time mask/position
+#define TRM_LONG_DIGIT_TIME_MASK 0x001fffff
+#define TRM_LONG_DIGIT_TIME_POSITION 0
+
+//TRM TOT width mask/position
+#define TRM_TOT_WIDTH_MASK 0x001fe000
+#define TRM_TOT_WIDTH_POSITION 13
+
+//TRM chan mask/position
+#define TRM_CHAN_MASK 0x00e00000
+#define TRM_CHAN_POSITION 21
+
+//TRM TDC ID mask/position
+#define TRM_TDC_ID_MASK 0x0f000000
+#define TRM_TDC_ID_POSITION 24
+
+//TRM E-bit mask/position
+#define TRM_E_BIT_MASK 0x10000000
+#define TRM_E_BIT_POSITION 28
+
+//TRM PS-bits mask/position
+#define TRM_PS_BITS_MASK 0x60000000
+#define TRM_PS_BITS_POSITION 29
+
+
+//TRM errors
+
+//TRM TDC error word required bit pattern
+#define TRM_TDC_ERROR 0x6000000
+
+//TRM TDC diagnostic error word required bit pattern
+#define TRM_TDC_DIAGNOSTIC_ERROR 0x6f00000
+
+//TRM TDC error flags mask/position
+#define TRM_TDC_ERROR_FLAGS_MASK 0x00007fff
+#define TRM_TDC_ERROR_FLAGS_POSITION 0
+
+//TRM TDC error TDC ID mask/position
+#define TRM_TDC_ERROR_TDC_ID_MASK 0x0f00000
+#define TRM_TDC_ERROR_TDC_ID_POSITION 24
+
+//TRM TDC fault chip flag ID mask/position
+#define TRM_TDC_ERROR_FAULT_CHIP_FLAG_ID_MASK 0x00007fff
+#define TRM_TDC_ERROR_FAULT_CHIP_FLAG_ID_POSITION 0
+
+//TRM TDC error C-bit mask/position
+#define TRM_TDC_ERROR_C_BIT_MASK 0x00008000
+#define TRM_TDC_ERROR_C_BIT_POSITION 15
+
+//TRM TDC JTAG error code mask/position
+#define TRM_TDC_ERROR_JTAG_ERROR_CODE_MASK 0x000007ff
+#define TRM_TDC_ERROR_JTAG_ERROR_CODE_POSITION 0
+
+//TRM TDC disgnostic error TDC ID mask/position
+#define TRM_TDC_DIAGNOSTIC_ERROR_TDC_ID_MASK 0x00007800
+#define TRM_TDC_DIAGNOSTIC_ERROR_TDC_ID_POSITION 11
+
+//TRM global trailer word required bit pattern
+//#define TRM_GLOBAL_TRAILER 0x50000000
+#define TRM_GLOBAL_TRAILER 0x5000000f
+
+//TRM event CRC mask/position
+#define TRM_EVENT_CRC_MASK 0x0000fff0
+#define TRM_EVENT_CRC_POSITION 4
+
+//TRM event counter mask/position
+#define TRM_EVENT_COUNTER_MASK 0x0fff0000
+#define TRM_EVENT_COUNTER_POSITION 16
+
+
+/******************************************
+LTM DATA FORMAT
+******************************************/
+
+//LTM global header word required bit pattern
+#define LTM_GLOBAL_HEADER 0x40000002
+
+//LTM event words mask/position
+#define LTM_EVENT_WORDS_MASK 0x0001fff0
+#define LTM_EVENT_WORDS_POSITION 4
+
+//LTM C-bit mask/position
+#define LTM_C_BIT_MASK 0x00020000
+#define LTM_C_BIT_POSITION 17
+
+//LTM fault mask/position
+#define LTM_FAULT_MASK 0x00fc0000
+#define LTM_FAULT_POSITION 18
+
+//PDL data
+
+//PDL value 1 mask/position
+#define LTM_PDL_VALUE_1_MASK 0x000000ff
+#define LTM_PDL_VALUE_1_POSITION 0
+
+//PDL value 2 mask/position
+#define LTM_PDL_VALUE_2_MASK 0x0000ff00
+#define LTM_PDL_VALUE_2_POSITION 8
+
+//PDL value 3 mask/position
+#define LTM_PDL_VALUE_3_MASK 0x00ff0000
+#define LTM_PDL_VALUE_3_POSITION 16
+
+//PDL value 4 mask/position
+#define LTM_PDL_VALUE_4_MASK 0xff000000
+#define LTM_PDL_VALUE_4_POSITION 24
+
+//ADC data
+
+//ADC value 1 mask/position
+#define LTM_ADC_VALUE_1_MASK 0x000003ff
+#define LTM_ADC_VALUE_1_POSITION 0
+
+//ADC value 2 mask/position
+#define LTM_ADC_VALUE_2_MASK 0x000ffc00
+#define LTM_ADC_VALUE_2_POSITION 10
+
+//ADC value 3 mask/position
+#define LTM_ADC_VALUE_3_MASK 0x3ff00000
+#define LTM_ADC_VALUE_3_POSITION 20
+
+//LTM global trailer word required bit pattern
+#define LTM_GLOBAL_TRAILER 0x50000002
+
+//LTM event CRC mask/position
+#define LTM_EVENT_CRC_MASK 0x0000fff0
+#define LTM_EVENT_CRC_POSITION 4
+
+//LTM event number mask/position
+#define LTM_EVENT_NUMBER_MASK 0x0fff0000
+#define LTM_EVENT_NUMBER_POSITION 16
+
+
ClassImp(AliTOFRawStream)
fDDL = -1;
fTRM = -1;
fTDC = -1;
- fTDCChannel = -1;
+ fTRMchain = -1;
+ fTDCchannel = -1;
fTof = -1;
- fADC = -1;
+ fToT = -1;
fErrorFlag = -1;
- //fCounter = -1; // v0.01
+
+ fSector = -1;
+ fPlate = -1;
+ fStrip = -1;
+ fPadX = -1;
+ fPadZ = -1;
fTOFGeometry = new AliTOFGeometryV5();
fRawReader->Select("TOF");
+ fWordType = -1;
+ fSlotID = -1;
+ fACQ = -1;
+ fPSbit = -1;
+ fTime = -1;
+ fTDCerrorFlag = -1;
+ fInsideDRM = kFALSE;
+ fInsideTRM = kFALSE;
+ fInsideLTM = kFALSE;
+ fInsideTRMchain0 = kFALSE;
+ fInsideTRMchain1 = kFALSE;
+ fLeadingOrphane = kFALSE;
+
}
//_____________________________________________________________________________
-AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
- TObject(stream)
+AliTOFRawStream::AliTOFRawStream()
{
//
- // copy constructor
+ // default ctr
//
- fRawReader = NULL;
+ fRawReader = 0x0;
fDDL = -1;
fTRM = -1;
fTDC = -1;
- fTDCChannel = -1;
+ fTRMchain = -1;
+ fTDCchannel = -1;
fTof = -1;
- fADC = -1;
+ fToT = -1;
fErrorFlag = -1;
- //fCounter = -1; // v0.01
+
+ fSector = -1;
+ fPlate = -1;
+ fStrip = -1;
+ fPadX = -1;
+ fPadZ = -1;
fTOFGeometry = new AliTOFGeometryV5();
+ fWordType = -1;
+ fSlotID = -1;
+ fACQ = -1;
+ fPSbit = -1;
+ fTime = -1;
+ fTDCerrorFlag = -1;
+ fInsideDRM = kFALSE;
+ fInsideTRM = kFALSE;
+ fInsideLTM = kFALSE;
+ fInsideTRMchain0 = kFALSE;
+ fInsideTRMchain1 = kFALSE;
+ fLeadingOrphane = kFALSE;
+
+}
+
+//_____________________________________________________________________________
+AliTOFRawStream::AliTOFRawStream(const AliTOFRawStream& stream) :
+ TObject(stream)
+{
+ //
+ // copy constructor
+ //
+
+ fRawReader = stream.fRawReader;
+ fDDL = stream.fDDL;
+ fTRM = stream.fTRM;
+ fTDC = stream.fTDC;
+ fTRMchain = stream.fTRMchain;
+ fTDCchannel = stream.fTDCchannel;
+ fTof = stream.fTof;
+ fToT = stream.fToT;
+ fErrorFlag = stream.fErrorFlag;
+
+ fSector = stream.fSector;
+ fPlate = stream.fPlate;
+ fStrip = stream.fStrip;
+ fPadX = stream.fPadX;
+ fPadZ = stream.fPadZ;
+
+ fTOFGeometry = stream.fTOFGeometry;
+
+ fWordType = stream.fWordType;
+ fSlotID = stream.fSlotID;
+ fACQ = stream.fACQ;
+ fPSbit = stream.fPSbit;
+ fTime = stream.fTime;
+ fTDCerrorFlag = stream.fTDCerrorFlag;
+ fInsideDRM = stream.fInsideDRM;
+ fInsideTRM = stream.fInsideTRM;
+ fInsideLTM = stream.fInsideLTM;
+ fInsideTRMchain0 = stream.fInsideTRMchain0;
+ fInsideTRMchain1 = stream.fInsideTRMchain1;
+ fLeadingOrphane = stream.fLeadingOrphane;
+
}
//_____________________________________________________________________________
fDDL = stream.fDDL;
fTRM = stream.fTRM;
fTDC = stream.fTDC;
- fTDCChannel = stream.fTDCChannel;
+ fTRMchain = stream.fTRMchain;
+ fTDCchannel = stream.fTDCchannel;
fTof = stream.fTof;
- fADC = stream.fADC;
+ fToT = stream.fToT;
fErrorFlag = stream.fErrorFlag;
- //fCounter = stream.fCounter; // v0.01
+
+ fSector = stream.fSector;
+ fPlate = stream.fPlate;
+ fStrip = stream.fStrip;
+ fPadX = stream.fPadX;
+ fPadZ = stream.fPadZ;
fTOFGeometry = stream.fTOFGeometry;
+ fWordType = stream.fWordType;
+ fSlotID = stream.fSlotID;
+ fACQ = stream.fACQ;
+ fPSbit = stream.fPSbit;
+ fTime = stream.fTime;
+ fTDCerrorFlag = stream.fTDCerrorFlag;
+ fInsideDRM = stream.fInsideDRM;
+ fInsideTRM = stream.fInsideTRM;
+ fInsideLTM = stream.fInsideLTM;
+ fInsideTRMchain0 = stream.fInsideTRMchain0;
+ fInsideTRMchain1 = stream.fInsideTRMchain1;
+ fLeadingOrphane = stream.fLeadingOrphane;
+
return *this;
}
//_____________________________________________________________________________
Bool_t AliTOFRawStream::Next()
{
-// read the next raw digit
-// returns kFALSE if there is no digit left
-
- //fCounter++; // v0.01
+ //
+ // Read next 32-bit word in TOF raw data files
+ // returns kFALSE if there is no word left
+ //
UInt_t data;
- /*
- // v0.01
- if (fCounter==0) {
- if (!fRawReader->ReadNextInt(data)) return kFALSE;
- Int_t dummy = data & 0x007F; // first 7 bits
- AliInfo(Form("This is the number of the current DDL file %2i",dummy));
- }
- */
-
if (!fRawReader->ReadNextInt(data)) return kFALSE;
- fTRM = data & 0x000F; // first 4 bits
- fTDC = (data >> 4) & 0x001F; // next 5 bits
- fTDCChannel = (data >> 9) & 0x0007; // next 3 bits
- fADC = (data >> 12) & 0x000FFFFF; // last 20 bits // v0.01
- //fADC = (data >> 12) & 0x00FF; // next 8 bits // v0.02
-
- if (!fRawReader->ReadNextInt(data)) return kFALSE;
+ if (fSector!=-1 && fPlate!=-1 && fStrip!=-1 && fPadZ!=-1 && fPadX!=-1) {
+ fSector = -1;
+ fPlate = -1;
+ fStrip = -1;
+ fPadZ = -1;
+ fPadX = -1;
+ }
- fErrorFlag = data & 0x00FF; // first 8 bits
- fTof = (data >> 8) & 0x00FFFFFF; // last 24 bits // v0.01
- //fTof = (data >> 8) & 0x0FFF; // next 12 bits // v0.02
fDDL = fRawReader->GetDDLID();
- //AliInfo(Form("fDDL %2i,fTRM %2i, fTDC %2i, fTDCChannel %1i",fDDL,fTRM,fTDC,fTDCChannel));
+ // orphane digits
+ AliTOFtdcDigit orphaneLeadingDigit;
+
+ fWordType = GetField(data,WORD_TYPE_MASK,WORD_TYPE_POSITION);
+
+ switch (fWordType) { // switch word type
+
+ case GLOBAL_HEADER_TYPE: // global header
+ fSlotID = GetField(data, HEADER_SLOT_ID_MASK, HEADER_SLOT_ID_POSITION);
+ fTRM = fSlotID;
+
+
+ switch (fSlotID) { // switch global header slot ID
+
+ case DRM_ID_NUMBER: //DRM global header
+ if (fInsideDRM) { // unexpected DRM global headers -> exit
+ break;
+ }
+ fInsideDRM = kTRUE; // DRM global header accepted
+ break;
+
+ case LTM_ID_NUMBER: // LTM global header
+ if (fInsideLTM) { // unexpected LTM global headers -> exit
+ break;
+ }
+ fInsideLTM = kTRUE; // LTM global header accepted
+ break;
+
+ case 3: //TRM header
+ case 4: //TRM header
+ case 5: //TRM header
+ case 6: //TRM header
+ case 7: //TRM header
+ case 8: //TRM header
+ case 9: //TRM header
+ case 10: //TRM header
+ case 11: //TRM header
+ case 12: //TRM header
+ if (fInsideTRM) { // unexpected TRM global headers -> exit
+ break;
+ }
+ fInsideTRM = kTRUE; // TRM global header accepted
+ fACQ = GetField(data,TRM_ACQ_BITS_MASK,TRM_ACQ_BITS_POSITION);
+ break;
+
+ default: // unexpected global header slot ID
+ break;
+
+ } //end switch global header slot id
+
+ break;
+
+
+ case GLOBAL_TRAILER_TYPE: // global trailer
+ fSlotID = GetField(data,HEADER_SLOT_ID_MASK,HEADER_SLOT_ID_POSITION);
+
+
+ switch (fSlotID) { // switch global trailer slot ID
+
+ case DRM_ID_NUMBER: // DRM global trailer
+ if (!fInsideDRM) { // unexpected DRM global trailers -> exit
+ break;
+ }
+ fInsideDRM = kFALSE; // DRM global trailer accepted
+ fInsideTRM = kFALSE;
+ fInsideLTM = kFALSE;
+ fInsideTRMchain0 = kFALSE;
+ fInsideTRMchain1 = kFALSE;
+ fLeadingOrphane = kFALSE;
+ fSector = -1;
+ fPlate = -1;
+ fStrip = -1;
+ fPadZ = -1;
+ fPadX = -1;
+ fDDL = -1;
+ fTRM = -1;
+ fTDC = -1;
+ fTRMchain = -1;
+ fTDCchannel = -1;
+ fTof = -1;
+ fToT = -1;
+ fErrorFlag = -1;
+ fACQ = -1;
+ fPSbit = -1;
+ fTime = -1;
+ fTDCerrorFlag = -1;
+ break;
+ case LTM_ID_NUMBER: // LTM global trailer
+ if (!fInsideLTM) { // unexpected LTM global trailer -> exit
+ break;
+ }
+ fInsideLTM = kFALSE; // LTM global trailer accepted
+ break;
+ case 15: //TRM global trailer
+ if (!fInsideTRM) { // unexpected TRM global trailers -> exit
+ break;
+ }
+ fInsideTRM = kFALSE; // TRM global trailer accepted
+ break;
+ default: // unexpected global trailer slot ID
+ break;
+ } //end switch global trailer slot id
+
+
+ break;
+
+
+ case ERROR_TYPE: // TDC error
+ fTDC = GetField(data,TRM_TDC_ERROR_TDC_ID_MASK,TRM_TDC_ERROR_TDC_ID_POSITION);
+ fTDCerrorFlag = GetField(data,TRM_TDC_ERROR_FLAGS_MASK,TRM_TDC_ERROR_FLAGS_POSITION);
+ break;
+
+
+ case FILLER_TYPE: // filler
+ break;
+
+
+ default: // other word types
+
+ if (fInsideTRM) { // inside TRM
+
+ switch (fWordType) { // switch word type inside TRM
+ case TRM_CHAIN0_HEADER_TYPE: // TRM chain0 header
+ if (fInsideTRMchain0) { // unexpected TRM chain0 header
+ break;
+ }
+ fInsideTRMchain0 = kTRUE;
+ fTRMchain = 0;
+ break;
+ case TRM_CHAIN0_TRAILER_TYPE: // TRM chain0 trailer
+ if (!fInsideTRMchain0) { // unexpected TRM chain0 trailer
+ break;
+ }
+ fInsideTRMchain0 = kFALSE;
+ fTRMchain = -1;
+ break;
+ case TRM_CHAIN1_HEADER_TYPE: // TRM chain1 header
+ if (fInsideTRMchain1) { // unexpected TRM chain1 header
+ break;
+ }
+ fInsideTRMchain1 = kTRUE;
+ fTRMchain = 1;
+ break;
+ case TRM_CHAIN1_TRAILER_TYPE: // TRM chain1 trailer
+ if (!fInsideTRMchain1) { // unexpected TRM chain1 trailer
+ break;
+ }
+ fInsideTRMchain1 = kFALSE;
+ fTRMchain = -1;
+ break;
+ } // end switch word type inside TRM
+
+ } // end if (fInsideTRM)
+
+
+ if (
+ ((fInsideTRMchain0&&!fInsideTRMchain1) || (!fInsideTRMchain0&&fInsideTRMchain1))
+ && fWordType!=TRM_CHAIN0_HEADER_TYPE && fWordType!=TRM_CHAIN0_TRAILER_TYPE
+ && fWordType!=TRM_CHAIN1_HEADER_TYPE && fWordType!=TRM_CHAIN1_TRAILER_TYPE
+ ){ // inside TRM chains
+ fPSbit = GetField(data,TRM_PS_BITS_MASK,TRM_PS_BITS_POSITION);
+ fTDC = GetField(data,TRM_TDC_ID_MASK,TRM_TDC_ID_POSITION);
+ fTDCchannel = GetField(data,TRM_CHAN_MASK,TRM_CHAN_POSITION);
+
+ switch (fPSbit) { // switch fPSbit bits inside TRM chains
+ case 0: // packing ok, digit time and tot
+ fToT = GetField(data,TRM_TOT_WIDTH_MASK,TRM_TOT_WIDTH_POSITION);
+ fTime = GetField(data,TRM_DIGIT_TIME_MASK,TRM_DIGIT_TIME_POSITION);
+ fTof = fTime;
+ SetSector();
+ SetPlate();
+ SetStrip();
+ SetPadZ();
+ SetPadX();
+ break;
+
+ case 1: // leading edge digit, long digit time, no TOT
+ fToT = -1;
+ fTime = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION);
+ fTof = fTime;
+ SetSector();
+ SetPlate();
+ SetStrip();
+ SetPadZ();
+ SetPadX();
+ // always set it as orphane leading
+ fLeadingOrphane=1;
+ orphaneLeadingDigit.fSlotID = fSlotID;
+ orphaneLeadingDigit.fChain = fTRMchain;
+ orphaneLeadingDigit.fPS = fPSbit;
+ orphaneLeadingDigit.fTDC = fTDC;
+ orphaneLeadingDigit.fChannel = fTDCchannel;
+ orphaneLeadingDigit.fTOT = fToT;
+ orphaneLeadingDigit.fTime = fTime;
+ break;
+
+ case 2: // trailing edge digit, long digit time, no TOT
+ fToT = -1;
+ fTime = GetField(data,TRM_LONG_DIGIT_TIME_MASK,TRM_LONG_DIGIT_TIME_POSITION);
+ fTof = fTime;
+ SetSector();
+ SetPlate();
+ SetStrip();
+ SetPadZ();
+ SetPadX();
+ if (fACQ!=3) // check if packing is disabled
+ break;
+ if (!fLeadingOrphane) // check for a orphane leading edge
+ break;
+ if (orphaneLeadingDigit.fSlotID != fSlotID ||
+ orphaneLeadingDigit.fChain != fTRMchain ||
+ orphaneLeadingDigit.fTDC != fTDC ||
+ orphaneLeadingDigit.fChannel != fTDCchannel) // check leading edge compatibility (fSlotID, fTRMchain, fTDC, fTDCchannel)
+ break;
+ fLeadingOrphane = 0; // orphane leading is no longer orphane
+ SetSector();
+ SetPlate();
+ SetStrip();
+ SetPadZ();
+ SetPadX();
+ break;
+ case 3: // TOT overflow
+ fToT = GetField(data,TRM_TOT_WIDTH_MASK,TRM_TOT_WIDTH_POSITION);
+ fTime = GetField(data,TRM_DIGIT_TIME_MASK,TRM_DIGIT_TIME_POSITION);
+ fTof = fTime;
+ SetSector();
+ SetPlate();
+ SetStrip();
+ SetPadZ();
+ SetPadX();
+ break;
+ } // end switch fPSbit bits inside TRM chains
+
+
+ } // end if is inside TRM chains
+
+ } // end switch on fWordType
return kTRUE;
+
}
//_____________________________________________________________________________
-Int_t AliTOFRawStream::GetSector() const
+void AliTOFRawStream::SetSector()
{
//
- // Transform the Hardware coordinate to Software coordinate
- // and also write it in the digit form
+ // Evaluate the TOF sector number -> [ 0;17]
+ // corresponding to the TOF equipment IDs:
+ // fDDL -> [ 0;71]
+ // fTRM -> [ 3;12]
+ // fTRMchain -> [0; 1]
+ // fTDC -> [ 0;14]
+ // fTDCchannel -> [ 0; 7]
//
Int_t iSector = -1;
- iSector = (Int_t)((Float_t)fDDL/AliTOFGeometry::NDDL());
- return iSector;
+ if (!(fDDL==-1)) iSector = Int_t((Float_t)(fDDL)/AliTOFGeometry::NDDL());
+
+ fSector = iSector;
}
//_____________________________________________________________________________
-Int_t AliTOFRawStream::GetPlate() const
+
+void AliTOFRawStream::SetPlate()
{
//
- // Transform the Hardware coordinate to Software coordinate
- // and also write it in the digit form
+ // Evaluate the TOF plate number ->[ 0; 4]
+ // corresponding to the TOF equipment IDs:
+ // fDDL -> [ 0;71]
+ // fTRM -> [ 3;12]
+ // fTRMchain -> [0; 1]
+ // fTDC -> [ 0;14]
+ // fTDCchannel -> [ 0; 7]
//
Int_t iPlate = -1;
+ if (!(fDDL==-1 || fTRM==-1 || fTDC==-1
+ || fSector==-1))
+ iPlate = Equip2VolNplate(GetDDLnumberPerSector(fDDL), fTRM, fTDC);
- Int_t localDDL = fDDL%AliTOFGeometry::NDDL();
-
- Int_t iPadPerSector = fTDCChannel + AliTOFGeometry::NCh()*(fTDC + AliTOFGeometry::NTdc()*(fTRM + AliTOFGeometry::NTRM()*localDDL));
-
- Int_t iStripPerSector = (Int_t)(iPadPerSector/(Float_t)AliTOFGeometry::NpadX()/(Float_t)AliTOFGeometry::NpadZ());
-
- if (iStripPerSector < fTOFGeometry->NStripC())
- iPlate = 0;
- else if (iStripPerSector>=fTOFGeometry->NStripC() &&
- iStripPerSector< fTOFGeometry->NStripC()+AliTOFGeometry::NStripB())
- iPlate = 1;
- else if (iStripPerSector>=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB() &&
- iStripPerSector< fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA())
- iPlate = 2;
- else if (iStripPerSector>=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA() &&
- iStripPerSector< fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB())
- iPlate = 3;
- else if (iStripPerSector>=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB() &&
- iStripPerSector< fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB()+fTOFGeometry->NStripC())
- iPlate = 4;
- else
- iPlate = -1;
-
- return iPlate;
+ fPlate = iPlate;
}
//_____________________________________________________________________________
-Int_t AliTOFRawStream::GetStrip() const
+void AliTOFRawStream::SetStrip()
{
//
- // Transform the Hardware coordinate to Software coordinate
- // and also write it in the digit form
+ // Evaluate the TOF strip number per module -> [ 0; 14/18]
+ // corresponding to the TOF equipment IDs:
+ // fDDL -> [ 0;71]
+ // fTRM -> [ 3;12]
+ // fTRMchain -> [0; 1]
+ // fTDC -> [ 0;14]
+ // fTDCchannel -> [ 0; 7]
//
Int_t iStrip = -1;
- Int_t localDDL = fDDL%AliTOFGeometry::NDDL();
-
- Int_t iPadPerSector = fTDCChannel + AliTOFGeometry::NCh()*(fTDC + AliTOFGeometry::NTdc()*(fTRM + AliTOFGeometry::NTRM()*localDDL));
-
- Int_t iStripPerSector = (Int_t)(iPadPerSector/(Float_t)AliTOFGeometry::NpadX()/(Float_t)AliTOFGeometry::NpadZ());
-
- if (iStripPerSector < fTOFGeometry->NStripC())
- iStrip = iStripPerSector;
- else if (iStripPerSector >=fTOFGeometry->NStripC() &&
- iStripPerSector < fTOFGeometry->NStripC()+AliTOFGeometry::NStripB())
- iStrip = iStripPerSector-fTOFGeometry->NStripC();
- else if (iStripPerSector >=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB() &&
- iStripPerSector < fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA())
- iStrip = iStripPerSector-fTOFGeometry->NStripC()-AliTOFGeometry::NStripB();
- else if (iStripPerSector >=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA() &&
- iStripPerSector < fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB())
- iStrip = iStripPerSector-fTOFGeometry->NStripC()-AliTOFGeometry::NStripB()-AliTOFGeometry::NStripA();
- else if (iStripPerSector >=fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB() &&
- iStripPerSector < fTOFGeometry->NStripC()+AliTOFGeometry::NStripB()+AliTOFGeometry::NStripA()+AliTOFGeometry::NStripB()+fTOFGeometry->NStripC())
- iStrip = iStripPerSector-fTOFGeometry->NStripC()-AliTOFGeometry::NStripB()-AliTOFGeometry::NStripA()-AliTOFGeometry::NStripB();
- else
- iStrip = -1;
+ if (!(fDDL==-1 || fTRM==-1 || fTDC==-1
+ || fSector==-1 || fPlate==-1))
+ iStrip = Equip2VolNstrip(GetDDLnumberPerSector(fDDL), fTRM, fTDC);
- return iStrip;
+ fStrip = iStrip;
}
//_____________________________________________________________________________
-Int_t AliTOFRawStream::GetPadZ() const
+void AliTOFRawStream::SetPadZ()
{
//
- // Transform the Hardware coordinate to Software coordinate
- // and also write it in the digit form
+ // Evaluate the TOF padRow number per strip -> [ 0; 1]
+ // corresponding to the TOF equipment IDs:
+ // fDDL -> [ 0;71]
+ // fTRM -> [ 3;12]
+ // fTRMchain -> [0; 1]
+ // fTDC -> [ 0;14]
+ // fTDCchannel -> [ 0; 7]
//
Int_t iPadZ = -1;
- Int_t localDDL = fDDL%AliTOFGeometry::NDDL();
+ if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1
+ || fSector==-1 || fPlate==-1 || fStrip==-1))
+ {
+ Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel);
+ if (iPadAlongTheStrip!=-1)
+ iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ();
+ }
- Int_t iPadPerSector = fTDCChannel + AliTOFGeometry::NCh()*(fTDC + AliTOFGeometry::NTdc()*(fTRM + AliTOFGeometry::NTRM()*localDDL));
-
- Int_t iStripPerSector = (Int_t)(iPadPerSector/(Float_t)AliTOFGeometry::NpadX()/(Float_t)AliTOFGeometry::NpadZ());
+ fPadZ = iPadZ;
- Int_t iPadPerStrip = iPadPerSector-AliTOFGeometry::NpadX()*AliTOFGeometry::NpadZ()*iStripPerSector;
+}
+//_____________________________________________________________________________
+
+void AliTOFRawStream::SetPadX()
+{
+ //
+ // Evaluate the TOF pad number per strip padRow -> [ 0;47]
+ // corresponding to the TOF equipment IDs:
+ // fDDL -> [ 0;71]
+ // fTRM -> [ 3;12]
+ // fTRMchain -> [0; 1]
+ // fTDC -> [ 0;14]
+ // fTDCchannel -> [ 0; 7]
+ //
- iPadZ = iPadPerStrip%AliTOFGeometry::NpadZ();
+ Int_t iPadX = -1;
- return iPadZ;
+ if (!(fDDL==-1 || fTRM==-1 || fTRMchain==-1 || fTDC==-1 || fTDCchannel==-1
+ || fSector==-1 || fPlate==-1 || fStrip==-1))
+ {
+ Int_t iPadAlongTheStrip = Equip2VolNpad(GetDDLnumberPerSector(fDDL), fTRMchain, fTDC, fTDCchannel);
+ if (iPadAlongTheStrip!=-1)
+ iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ())));
+ }
+
+ fPadX = iPadX;
}
-//_____________________________________________________________________________
-Int_t AliTOFRawStream::GetPadX() const
+//----------------------------------------------------------------------------
+Int_t AliTOFRawStream::GetField(UInt_t word, Int_t fieldMask, Int_t fieldPosition) const
+{
+ //
+ //
+ //
+
+ return ((word & fieldMask) >> fieldPosition);
+}
+
+//----------------------------------------------------------------------------
+Int_t AliTOFRawStream::Equip2VolNplate(Int_t iDDL, Int_t nTRM, Int_t nTDC) const
{
//
- // Transform the Hardware coordinate to Software coordinate
- // and also write it in the digit form
+ // Returns the TOF plate number [0;4]
+ // corresponding to the TOF equipment ID numbers:
+ // iDDL -> DDL number per sector [0;3]
+ // nTRM -> TRM number [3;12]
+ // nTDC -> TDC number [0;14]
//
- Int_t iPadX = -1;
+ Int_t iPlate = -1;
+ if (iDDL==0) {
+
+ if (nTRM>=4 && nTRM<7) {
+ iPlate = 0;
+ } else if (nTRM==7) {
+ if (nTDC<12) iPlate = 0;
+ else iPlate = 1;
+ } else if (nTRM>=8 && nTRM<11) {
+ iPlate = 1;
+ } else if (nTRM==11) {
+ if (nTDC<9) iPlate = 1;
+ else iPlate = 2;
+ }else if (nTRM==12) {
+ iPlate = 2;
+ }
+
+ } else if (iDDL==1) {
+
+ if (nTRM==3) {
+ if (nTDC<3) iPlate = 0;
+ } else if (nTRM>=4 && nTRM<7) {
+ iPlate = 0;
+ } else if (nTRM==7) {
+ if (nTDC<6) iPlate = 1;
+ else iPlate = 0;
+ } else if (nTRM>=8 && nTRM<11) {
+ iPlate = 1;
+ } else if (nTRM==11) {
+ if (nTDC<9) iPlate = 2;
+ else iPlate = 1;
+ } else if (nTRM==12) {
+ iPlate = 2;
+ }
+
+ } else if (iDDL==2) {
+
+ if (nTRM>=4 && nTRM<7) {
+ iPlate = 4;
+ } else if (nTRM==7) {
+ if (nTDC<12) iPlate = 4;
+ else iPlate = 3;
+ } else if (nTRM>=8 && nTRM<11) {
+ iPlate = 3;
+ } else if (nTRM==11) {
+ if (nTDC<9) iPlate = 3;
+ else iPlate = 2;
+ }else if (nTRM==12) {
+ iPlate = 2;
+ }
+
+ } else if (iDDL==3) {
+
+ if (nTRM==3) {
+ if (nTDC<3) iPlate = 4;
+ } else if (nTRM>=4 && nTRM<7) {
+ iPlate = 4;
+ } else if (nTRM==7) {
+ if (nTDC<6) iPlate = 3;
+ else iPlate = 4;
+ } else if (nTRM>=8 && nTRM<11) {
+ iPlate = 3;
+ } else if (nTRM==11) {
+ if (nTDC<9) iPlate = 2;
+ else iPlate = 3;
+ } else if (nTRM==12) {
+ iPlate = 2;
+ }
- Int_t localDDL = fDDL%AliTOFGeometry::NDDL();
+ }
- Int_t iPadPerSector = fTDCChannel + AliTOFGeometry::NCh()*(fTDC + AliTOFGeometry::NTdc()*(fTRM + AliTOFGeometry::NTRM()*localDDL));
+ return iPlate;
- Int_t iStripPerSector = (Int_t)(iPadPerSector/(Float_t)AliTOFGeometry::NpadX()/(Float_t)AliTOFGeometry::NpadZ());
+}
- Int_t iPadPerStrip = iPadPerSector-AliTOFGeometry::NpadX()*AliTOFGeometry::NpadZ()*iStripPerSector;
+//----------------------------------------------------------------------------
+Int_t AliTOFRawStream::Equip2VolNstrip(Int_t iDDL, Int_t nTRM, Int_t nTDC) const
+{
+ //
+ // Returns the TOF strip number per module:
+ // [0;14], in the central plates,
+ // [0;18], in the intermediate and external plates
+ // corresponding to the TOF equipment ID numbers:
+ // iDDL -> DDL number per sector [0;3]
+ // nTRM -> TRM number [3;12]
+ // nTDC -> TDC number [0;14]
+ //
- iPadX = (Int_t)(iPadPerStrip/(Float_t)AliTOFGeometry::NpadZ());
+ Int_t iStrip = -1;
- return iPadX;
+ if (iDDL==0) {
+
+ if (nTRM== 4) iStrip = (Int_t)(nTDC/3.);
+ else if (nTRM== 5) iStrip = 5 + (Int_t)(nTDC/3.);
+ else if (nTRM== 6) iStrip = 10 + (Int_t)(nTDC/3.);
+ else if (nTRM== 7) {
+ if (nTDC<12) iStrip = 15 + (Int_t)(nTDC/3.);
+ else iStrip = (Int_t)(nTDC/3.) - 4;
+ }
+ else if (nTRM== 8) iStrip = 1 + (Int_t)(nTDC/3.);
+ else if (nTRM== 9) iStrip = 6 + (Int_t)(nTDC/3.);
+ else if (nTRM==10) iStrip = 11 + (Int_t)(nTDC/3.);
+ else if (nTRM==11) {
+ if (nTDC<9) iStrip = 16 + (Int_t)(nTDC/3.);
+ else iStrip = (Int_t)(nTDC/3.) - 3;
+ }
+ else if (nTRM==12) iStrip = 2 + (Int_t)(nTDC/3.);
+
+ } else if (iDDL==1) {
+
+ if (nTRM==3 && nTDC<3) iStrip = (Int_t)(nTDC/3.);
+ else if (nTRM== 4) iStrip = 5 - (Int_t)(nTDC/3.);
+ else if (nTRM== 5) iStrip = 10 - (Int_t)(nTDC/3.);
+ else if (nTRM== 6) iStrip = 15 - (Int_t)(nTDC/3.);
+ else if (nTRM== 7) {
+ if (nTDC<6) iStrip = 1 - (Int_t)(nTDC/3.);
+ else iStrip = 20 - (Int_t)(nTDC/3.);
+ }
+ else if (nTRM== 8) iStrip = 6 - (Int_t)(nTDC/3.);
+ else if (nTRM== 9) iStrip = 11 - (Int_t)(nTDC/3.);
+ else if (nTRM==10) iStrip = 16 - (Int_t)(nTDC/3.);
+ else if (nTRM==11) {
+ if (nTDC<9) iStrip = 2 - (Int_t)(nTDC/3.);
+ else iStrip = 21 - (Int_t)(nTDC/3.);
+ }
+ else if (nTRM==12) iStrip = 7 - (Int_t)(nTDC/3.);
+
+ } else if (iDDL==2) {
+
+ if (nTRM== 4) iStrip = 18 - (Int_t)(nTDC/3.);
+ else if (nTRM== 5) iStrip = 18 - ( 5 + (Int_t)(nTDC/3.));
+ else if (nTRM== 6) iStrip = 18 - (10 + (Int_t)(nTDC/3.));
+ else if (nTRM== 7) {
+ if (nTDC<12) iStrip = 18 - (15 + (Int_t)(nTDC/3.));
+ else iStrip = 18 - ((Int_t)(nTDC/3.) - 4);
+ }
+ else if (nTRM== 8) iStrip = 18 - ( 1 + (Int_t)(nTDC/3.));
+ else if (nTRM== 9) iStrip = 18 - ( 6 + (Int_t)(nTDC/3.));
+ else if (nTRM==10) iStrip = 18 - (11 + (Int_t)(nTDC/3.));
+ else if (nTRM==11) {
+ if (nTDC<9) iStrip = 18 - (16 + (Int_t)(nTDC/3.));
+ else iStrip = 14 - ((Int_t)(nTDC/3.) - 3);
+ }
+ else if (nTRM==12) iStrip = 14 - ( 2 + (Int_t)(nTDC/3.));
+
+ } else if (iDDL==3) {
+
+ if (nTRM==3 && nTDC<3) iStrip = 18 - (Int_t)(nTDC/3.);
+ else if (nTRM== 4) iStrip = 18 - ( 5 - (Int_t)(nTDC/3.));
+ else if (nTRM== 5) iStrip = 18 - (10 - (Int_t)(nTDC/3.));
+ else if (nTRM== 6) iStrip = 18 - (15 - (Int_t)(nTDC/3.));
+ else if (nTRM== 7) {
+ if (nTDC<6) iStrip = 18 - (1 - (Int_t)(nTDC/3.));
+ else iStrip = 18 - (20 - (Int_t)(nTDC/3.));
+ }
+ else if (nTRM== 8) iStrip = 18 - ( 6 - (Int_t)(nTDC/3.));
+ else if (nTRM== 9) iStrip = 18 - (11 - (Int_t)(nTDC/3.));
+ else if (nTRM==10) iStrip = 18 - (16 - (Int_t)(nTDC/3.));
+ else if (nTRM==11) {
+ if (nTDC<9) iStrip = 14 - ( 2 - (Int_t)(nTDC/3.));
+ else iStrip = 18 - (21 - (Int_t)(nTDC/3.));
+ }
+ else if (nTRM==12) iStrip = 14 - ( 7 - (Int_t)(nTDC/3.));
+
+ }
+
+ return iStrip;
+
+}
+
+//----------------------------------------------------------------------------
+Int_t AliTOFRawStream::Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC,
+ Int_t iCH) const
+{
+ //
+ // Returns the TOF pad number per strip [0;95]
+ // corresponding to the TOF equipment ID numbers:
+ // iDDL -> DDL number per sector [0;3]
+ // iChain -> TRM chain number [0;1]
+ // nTDC -> TDC number [0;14]
+ // iCH -> TDC channel number [0;7]
+ //
+
+ Int_t iPadAlongTheStrip = -1;
+
+ Int_t iTDClocal = nTDC%3 + (1-iChain)*3;
+
+ if (iDDL==0 || iDDL==3) iTDClocal = 5 - iTDClocal;
+ else if (iDDL==1 || iDDL==2) iTDClocal = 6 + (5 - iTDClocal);
+
+ Int_t iCHlocal = iCH;
+ if (iDDL==0 || iDDL==3) iCHlocal = 7 - iCH;
+
+ iPadAlongTheStrip = iTDClocal*AliTOFGeometry::NCh() + iCHlocal;
+
+ if (((iDDL==1 || iDDL==2) && iPadAlongTheStrip< AliTOFGeometry::NpadX()) ||
+ ((iDDL==0 || iDDL==3) && iPadAlongTheStrip>=AliTOFGeometry::NpadX()))
+ AliError("Problems with the padX number!");
+
+ return iPadAlongTheStrip;
+
+}
+
+//----------------------------------------------------------------------------
+Int_t AliTOFRawStream::GetSectorNumber(Int_t nDDL) const
+{
+ //
+ // Returns the sector number [0;17]
+ // corresponing to the assigned DRM/DDL number [0;71]
+ //
+
+ Int_t iSector = Int_t((Float_t)(nDDL)/AliTOFGeometry::NDDL());
+
+ return iSector;
+
+}
+//----------------------------------------------------------------------------
+Int_t AliTOFRawStream::GetDDLnumberPerSector(Int_t nDDL) const
+{
+ //
+ // Return the DRM/DDL number per sector [0;3]
+ // corresponing to the assigned DRM/DDL number [0;71]
+ //
+
+ Int_t iDDL = nDDL%AliTOFGeometry::NDDL();
+
+ return iDDL;
+
+}
+
+//----------------------------------------------------------------------------
+void AliTOFRawStream::EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain,
+ Int_t nTDC, Int_t iCH,
+ Int_t *volume) const
+{
+ //
+ // To convert:
+ // nDDL (variable in [0;71]) -> number of the DDL file
+ // nTRM (variable in [3;12]) -> number of the TRM slot
+ // iChain (variable in [0; 1]) -> number of the TRM chain
+ // nTDC (variable in [0;14]) -> number of the TDC
+ // iCH (variable in [0; 7]) -> number of the TDC channel
+ //
+ // in:
+ // sector number, i.e. volume[0] (variable in [0,17])
+ // plate number, i.e. volume[1] (variable in [0, 5])
+ // strip number, i.e. volume[2] (variable in [0,14/18])
+ // padX number, i.e. volume[3] (variable in [0,47])
+ // padZ number, i.e. volume[4] (variable in [0, 1])
+ //
+
+ Int_t iDDL = GetDDLnumberPerSector(nDDL);
+
+ Int_t iSector = GetSectorNumber(nDDL);
+
+ Int_t iPlate = Equip2VolNplate(iDDL, nTRM, nTDC);
+ if (iPlate==-1) AliError("Problems with the plate number!");
+
+ Int_t iStrip = Equip2VolNstrip(iDDL, nTRM, nTDC);
+ if (iStrip==-1) AliError("Problems with the strip number!");
+
+ Int_t iPadAlongTheStrip = Equip2VolNpad(iDDL, iChain, nTDC, iCH);
+ if (iPadAlongTheStrip==-1)
+ AliError("Problems with the pad number along the strip!");
+
+ Int_t iPadX = (Int_t)(iPadAlongTheStrip/(Float_t(AliTOFGeometry::NpadZ())));
+ Int_t iPadZ = iPadAlongTheStrip%AliTOFGeometry::NpadZ();
+
+ volume[0] = iSector;
+ volume[1] = iPlate;
+ volume[2] = iStrip;
+ volume[3] = iPadX;
+ volume[4] = iPadZ;
}
-//_____________________________________________________________________________
class AliRawReader;
-
class AliTOFRawStream: public TObject {
- public :
+ public:
- AliTOFRawStream(AliRawReader* rawReader);
- virtual ~AliTOFRawStream();
+ AliTOFRawStream(); // default ctr
+ AliTOFRawStream(AliRawReader* rawReader); // ctr
+ virtual ~AliTOFRawStream(); // default dtr
virtual Bool_t Next();
- //void ResetCounter() {fCounter = -1;}; // v0.01
-
- Int_t GetDDL() const {return fDDL;};
- Int_t GetTRM() const {return fTRM;};
- Int_t GetTDC() const {return fTDC;};
- Int_t GetChannel() const {return fTDCChannel;};
+ Int_t GetDDL() const {return fDDL;};
+ Int_t GetTRM() const {return fTRM;};
+ Int_t GetTDC() const {return fTDC;};
+ Int_t GetTRMchain() const {return fTRMchain;};
+ Int_t GetTDCchannel() const {return fTDCchannel;};
- Int_t GetSector() const;
- Int_t GetPlate() const;
- Int_t GetStrip() const;
- Int_t GetPadZ() const;
- Int_t GetPadX() const;
+ Int_t GetSector() const {return fSector;};
+ Int_t GetPlate() const {return fPlate;};
+ Int_t GetStrip() const {return fStrip;};
+ Int_t GetPadZ() const {return fPadZ;};
+ Int_t GetPadX() const {return fPadX;};
Int_t GetTofBin() const {return fTof;};
- Int_t GetADCbin() const {return fADC;};
+ Int_t GetToTbin() const {return fToT;};
- enum {kDDLOffset = 0x500}; // offset for DDL numbers
-
- private :
-
- AliTOFRawStream(const AliTOFRawStream& stream);
- AliTOFRawStream& operator = (const AliTOFRawStream& stream);
-
- AliRawReader* fRawReader; // object for reading the raw data
-
- Int_t fDDL; // index of current DDL file
- Int_t fTRM; // index of current TRM
- Int_t fTDC; // index of current TDC
- Int_t fTDCChannel; // index of current channel of the TDC
- Int_t fTof; // time-of-flight measurement
- Int_t fADC; // 'charge' measurement
- Int_t fErrorFlag; // error flag
+ void SetDDL(Int_t nDDL) {fDDL = nDDL;};
+ void SetTRM(Int_t nTRM) {fTRM = nTRM;};
+ void SetTDC(Int_t nTDC) {fTDC = nTDC;};
+ void SetTRMchain(Int_t nChain) {fTRMchain = nChain;};
+ void SetTDCchannel(Int_t nChannel) {fTDCchannel = nChannel;};
+
+ void SetSector();
+ void SetPlate();
+ void SetStrip();
+ void SetPadZ();
+ void SetPadX();
+ void EquipmentId2VolumeId(Int_t nDDL, Int_t nTRM, Int_t iChain,
+ Int_t iTDC, Int_t iCH, Int_t *volume) const;
+ Int_t Equip2VolNplate(Int_t iDDL, Int_t nTRM, Int_t nTDC) const ;
+ Int_t Equip2VolNstrip(Int_t iDDL, Int_t nTRM, Int_t nTDC) const ;
+ Int_t Equip2VolNpad(Int_t iDDL, Int_t iChain, Int_t nTDC, Int_t iCH) const ;
+ Int_t GetDDLnumberPerSector(Int_t nDDL) const;
+ Int_t GetSectorNumber(Int_t nDDL) const;
+
+ private:
+
+ Int_t GetField(UInt_t word, Int_t fieldMask, Int_t fieldPosition) const;
+
+ AliTOFRawStream(const AliTOFRawStream& stream); // copy ctr
+ AliTOFRawStream& operator = (const AliTOFRawStream& stream); // ass. op.
+
+ AliRawReader* fRawReader; // object for reading the raw data
+
+ Int_t fDDL; // DDL file number [0;71]
+ Int_t fTRM; // TRM number [1;12]
+ Int_t fTDC; // TDC number [0;14]
+ Int_t fTRMchain; // TRM chain number [0;1]
+ Int_t fTDCchannel; // TDC channel number [0;7]
+ Int_t fTof; // time-of-flight measurement [0;8191]
+ Int_t fToT; // time-over-threshould measurement [0;255]
+ Int_t fErrorFlag; // error flag
+
+ Int_t fSector; // sector number [0;17]
+ Int_t fPlate; // plate number [0;4]
+ Int_t fStrip; // strip number [0;14/18]
+ Int_t fPadX; // pad number along the strip [0;47]
+ Int_t fPadZ; // pad-row number [0;1]
+
AliTOFGeometry *fTOFGeometry; // pointer to the TOF geometry
- //Int_t fCounter; // counter for TOF raw data rows in DDL files // v0.01
+ Int_t fWordType; // word type
+ Int_t fSlotID; // crate slot ID number
+ Int_t fACQ; // flag to identify the aquisition kind
+ Int_t fPSbit; // flag for packing
+ Int_t fTime; // time-of-light measurement
+ Int_t fTDCerrorFlag; // TDC error flag
+ Bool_t fInsideDRM; // inside/outside DRM
+ Bool_t fInsideTRM; // inside/outside TRM
+ Bool_t fInsideLTM; // inside/outside LTM
+ Bool_t fInsideTRMchain0; // inside/outside chain 0
+ Bool_t fInsideTRMchain1; // inside/outside chain 1
+ Bool_t fLeadingOrphane; // flag for leading orphane digit
+
+ struct AliTOFtdcDigit {
+ // TOF TDC digit data struct
+ Int_t fSlotID; // TRM slot ID
+ Int_t fChain; // Chain ID
+ Int_t fPS; // Packing bit
+ Int_t fTDC; // TDC number
+ Int_t fChannel; // TDC channel number
+ Int_t fTOT; // Time-Over-Threashould
+ Int_t fTime; // Time
+ };
+
ClassDef(AliTOFRawStream, 1) // class for reading TOF raw digits
};
#include "TFrame.h"
#include "TH1.h"
#include "TParticle.h"
-#include "TRandom.h"
#include "TBenchmark.h"
-#include "TSystem.h"
#include "TTask.h"
#include "TTree.h"
//
// Constructor of digit object
//
+
fSector = vol[0];
fPlate = vol[1];
fStrip = vol[2];
fPadx = vol[3];
fPadz = vol[4];
fTdc = digit[0];
- fTdcND =0;
+ fTdcND = digit[3];
fAdc = digit[1];
- fToT = 0;
+ fToT = digit[2];
+
}
//____________________________________________________________________________
//______________________________________________________________________________
ostream& operator << (ostream& out, const AliTOFdigit &digit)
{
-//
-// Output streamer: output of the digit data
-//
-out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
-out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
-out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
-return out;
+ //
+ // Output streamer: output of the digit data
+ //
+
+ out << "Sector " << digit.fSector << ", Plate " << digit.fPlate << ", Strip " << digit.fStrip << endl;
+ out << "Padx" << digit.fPadx << ", Padz " << digit.fPadz << endl;
+ out << "TDC " << digit.fTdc << ", ADC "<< digit.fAdc << endl;
+
+ return out;
}