//Since data is zero suppressed,the coordinates for the chip having zero digits
//doesn't get listed in the galice.root file. However the SPD format requires
//the empty chip to be written with chip header and chip trailer.
+ //The index of the half stave is calculated as (mod/2).
Int_t ix;
Int_t iz;
Int_t chipNo=0;
branch->GetEvent(moduleNumber);
//For each Module, buf contains the array of data words in Binary format
//fIndex gives the number of 32 bits words in the buffer for each module
- GetDigitsSPD(digits,moduleNumber,i,buf);
+ GetDigitsSPD(digits,mod,i,buf);
outfile.write((char *)buf,((fIndex+1)*sizeof(UInt_t)));
for(Int_t i=0;i<(fIndex+1);i++){
buf[i]=0;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::WriteChipHeader(Int_t ChipAddr,Int_t /*EventCnt*/,UInt_t &BaseWord){
+void AliITSDDLRawData::WriteChipHeader(Int_t ChipAddr,Int_t halfStave,UInt_t &BaseWord){
//This method writes a chip header
- //cout<<"Chip: "<<ChipAddr<<" Half Stave module:"<<EventCnt<<endl;
+ //cout<<"Chip: "<<ChipAddr<<" Half Stave module:"<<halfStave<<endl;
BaseWord=0;
- AliBitPacking::PackWord(ChipAddr,BaseWord,0,3);
-// AliBitPacking::PackWord(EventCnt,BaseWord,4,10);
- AliBitPacking::PackWord(0,BaseWord,4,10);
- AliBitPacking::PackWord(0x7,BaseWord,11,13);
- AliBitPacking::PackWord(0x1,BaseWord,14,15);
+ AliBitPacking::PackWord(ChipAddr,BaseWord,16,19);
+ // At the moment the event count is always 0 (bits 20-26)
+ AliBitPacking::PackWord(0,BaseWord,20,26);
+ AliBitPacking::PackWord(halfStave,BaseWord,27,29);
+ AliBitPacking::PackWord(0x1,BaseWord,30,31);
return;
}//end WriteChipHeader
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,UInt_t BaseWord){
- //This method reads a chip header
- UInt_t temp=AliBitPacking::UnpackWord(BaseWord,0,3);
- ChipAddr=(Int_t)temp;
- temp=AliBitPacking::UnpackWord(BaseWord,4,10);
- EventCnt=(Int_t)temp;
- if(fVerbose)
- Info("ReadChipHeader", "Chip:&d Half Stave module:%d",ChipAddr,EventCnt);
- return;
-}//end ReadChipHeader
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
void AliITSDDLRawData::WriteChipTrailer(UInt_t *buf,Int_t ChipHitCount,UInt_t &BaseWord){
//This method writes a chip trailer
//pixel fill word
if((ChipHitCount%2)!=0){
- AliBitPacking::PackWord(0xC000,BaseWord,0,15);
+ AliBitPacking::PackWord(0xC000,BaseWord,16,31);
}
- AliBitPacking::PackWord(ChipHitCount,BaseWord,16,29);
- AliBitPacking::PackWord(0x0,BaseWord,30,31);
+ AliBitPacking::PackWord(ChipHitCount,BaseWord,0,13);
+ AliBitPacking::PackWord(0x0,BaseWord,14,15);
fIndex++;
buf[fIndex]=BaseWord;
BaseWord=0;
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-void AliITSDDLRawData::ReadChipTrailer(Int_t &ChipHitCount,UInt_t BaseWord){
- //This method reads a chip trailer
- UInt_t temp=AliBitPacking::UnpackWord(BaseWord,16,29);
- ChipHitCount=(Int_t)temp;
- return;
-}//end ReadChipTrailer
-
-/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
void AliITSDDLRawData::WriteHit(UInt_t *buf,Int_t RowAddr,Int_t HitAddr,UInt_t &BaseWord){
//This method writs an hit
if(!BaseWord){
- AliBitPacking::PackWord(HitAddr,BaseWord,0,4);
- AliBitPacking::PackWord(RowAddr,BaseWord,5,12);
- AliBitPacking::PackWord(2,BaseWord,14,15);
- }//end if
- else{
AliBitPacking::PackWord(HitAddr,BaseWord,16,20);
AliBitPacking::PackWord(RowAddr,BaseWord,21,28);
AliBitPacking::PackWord(2,BaseWord,30,31);
+ }//end if
+ else{
+ AliBitPacking::PackWord(HitAddr,BaseWord,0,4);
+ AliBitPacking::PackWord(RowAddr,BaseWord,5,12);
+ AliBitPacking::PackWord(2,BaseWord,14,15);
fIndex++;
buf[fIndex]=BaseWord;
BaseWord=0;
//This method formats and stores in buf all the digits of a SDD module
void GetDigitsSSD(TClonesArray *ITSdigits, Int_t mod,Int_t modR,Int_t ddl,UInt_t *buf);
//This method formats and stores in buf all the digits of a SSD module
- void WriteChipHeader(Int_t ChipAddr,Int_t EventCnt,UInt_t &BaseWord);
+ void WriteChipHeader(Int_t ChipAddr,Int_t halfStave,UInt_t &BaseWord);
void WriteChipTrailer(UInt_t *buf,Int_t ChipHitCount,UInt_t &BaseWord);
void WriteHit(UInt_t *buf,Int_t RowAddr,Int_t HitAddr,UInt_t &BaseWord);
//The three previous methods are used to store the data according to the
//Silicon pixel detector data format
- void ReadChipHeader(Int_t &ChipAddr,Int_t &EventCnt,UInt_t BaseWord);
- void ReadChipTrailer(Int_t &ChipHitCount,UInt_t BaseWord);
- //Methods used for reading and dubugging SPD data files
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
Int_t fHalfStaveModule; //first or second half of an Half Stave module