-//----------------------------------------------------------------------
-Int_t AliITSspdTestBeam::DecodeModule(Int_t pilot,Int_t chip){
- // Determines the Module number based on the pilot and chip
- // valules and the fVersion of the simulation.
- // Inputs:
- // Int_t pilot Pilot number
- // Int_t chip chip number
- // Outputs:
- // none.
- // Return:
- // The module number (see simulations geometry).
-
- switch (fVersion) {
- case 2002:
- if(pilot==0) return chip;
- if(pilot==1) return 2;
- if(pilot==2) return chip+3;
- break;
- default:
- if(pilot==0) return chip;
- if(pilot==1) return 2;
- if(pilot==2) return chip+3;
- break;
- } // end switch
- return -1;
-}
-//----------------------------------------------------------------------
-Int_t AliITSspdTestBeam::DecodeColumn(Int_t pilot,Int_t chip,Int_t colm){
- // Determines the Column number based on the pilot, chip, and column
- // valules and the fVersion of the simulation.
- // Inputs:
- // Int_t pilot Pilot number
- // Int_t chip chip number
- // Int_t colm Column number
- // Outputs:
- // none.
- // Return:
- // The Column number (see simulations geometry).
- const Int_t colmperchip = 160/5; // Should be gotten from AliITSsegmentationSPD
-
- switch (fVersion) {
- case 2002:
- if(pilot==0) return colm;
- if(pilot==1) return colm+chip*colmperchip;
- if(pilot==2) return colm;
- break;
- default:
- if(pilot==0) return colm;
- if(pilot==1) return colm+chip*colmperchip;
- if(pilot==2) return colm;
- break;
- } // end switch
- return -1;
-}
-//----------------------------------------------------------------------
-void AliITSspdTestBeam::Digitize(Int_t evnt){
- // Write out ITS SPD Digits.
- // Inputs:
- // Int_t evnt events number
- // Outputs:
- // none.
- // Return:
- // none.
- Int_t p,i;
- Int_t module,chip,row,colm,digit[3];
- Int_t oldmodule=-1;
-
- fLoader->GetRunLoader()->SetEventNumber(evnt);
- fLoader->SetEvent();
- if(!(fLoader->TreeD())){
- fLoader->MakeTree("D");
- } // end if
-
- fITS->MakeBranch("D");
- //fITS->SetTreeAddress();
- fITS->SetTreeAddressD(fLoader->TreeD());
-
- for(p=0;p<GetNumberOfPilots();p++)
- for(i=0;i<fNData[p][evnt];i++){
- chip = fData[p][evnt]->Chip(i);
- module = DecodeModule(p,chip);
- row = fData[p][evnt]->Row(i);
- colm = DecodeColumn(p,chip,fData[p][evnt]->Colm(i));
- digit[0] = row; digit[1] = colm, digit[2] = 1;
- fITS->AddRealDigit(0,digit);
- if(module!=oldmodule) { // New Module
- oldmodule= module;
- fLoader->TreeD()->Fill();
- fITS->ResetDigits();
- } // end if
- } // end for p
- fITS->ClearModules();
- fLoader->TreeD()->GetEntries();
- fLoader->TreeD()->AutoSave();
- fLoader->TreeD()->Reset();
-}
-//----------------------------------------------------------------------
-void AliITSspdTestBeam::PrintHeadder(ostream *os){
- // Prints the Run Headder.
- // Inputs:
- // ostream *os Output stream where the data should go to
- // Outputs:
- // none.
- // Return:
- // none.
- fRH.Print(os);
-}
-//----------------------------------------------------------------------
-void AliITSspdTestBeam::PrintTrailer(ostream *os){
- // Prints the Run Trailer.
- // Inputs:
- // ostream *os Output stream where the data should go to
- // Outputs:
- // none.
- // Return:
- // none.
- fRT.Print(os);
-}
-//----------------------------------------------------------------------
-void AliITSspdTestBeam::PrintBurstInfo(Int_t i,ostream *os){
- // Prints the specified burts information
- // Inputs:
- // Int_t i Specifies which burst to print.
- // ostream *os Output stream where the data should go to
- // Outputs:
- // none.
- // Return:
- // none.
- fBrst[i]->Print(os);
-}
-//----------------------------------------------------------------------
-void AliITSspdTestBeam::PrintEventData(Int_t evnt,ostream *os){
- // Prints the data for a specified event number.
- // Inputs:
- // Int_t evnt events number
- // ostream *os Output stream where the data should go to
- // Outputs:
- // none.
- // Return:
- // none.
- Int_t p,i;
-
- for(p=0;p<GetNumberOfPilots();p++)
- for(i=0;i<fNData[p][evnt];i++){
- *os << "Pilot=" << setw(3) << p << " ";
- fData[p][evnt]->Print(os,i);
- *os << endl;
- } // end for p
-}
-//----------------------------------------------------------------------
-void AliITSspdTestBeam::PrintEventHead(Int_t evnt,ostream *os){
- // Prints the data Headder for a specified event number.
- // Inputs:
- // Int_t evnt events number
- // ostream *os Output stream where the data should go to
- // Outputs:
- // none.
- // Return:
- // none.
- Int_t p;
-
- for(p=0;p<GetNumberOfPilots();p++){
- *os << "Pilot=" << setw(3) << p << " " << *(fHData[p][evnt]);
- } // end for p
-}
-//----------------------------------------------------------------------
-void AliITSspdTestBeam::PrintEventTail(Int_t evnt,ostream *os){
- // Prints the data Trailer for a specified event number.
- // Inputs:
- // Int_t evnt events number
- // ostream *os Output stream where the data should go to
- // Outputs:
- // none.
- // Return:
- // none.
- Int_t p;
-
- for(p=0;p<GetNumberOfPilots();p++){
- *os << "Pilot=" << setw(3) << p << " " << *(fTData[p][evnt]);
- } // end for p
-}
-//============================================================================
-void AliITSTestBeamData::Swapit(Int_t i,UChar_t *a){
- // Swap the order of the bits
- // Inputs:
- // Int_t i Size of UChar_t array a.
- // UChar_t a Array of bytes to be swapped.
- // Outputs:
- // UChar_t a Array with bytes swapped
- // Return:
- // none.
- Int_t j;
- UChar_t c[i];
-
- for(j=0;j<i;j++) c[j] = a[i-j-1];
- for(j=0;j<i;j++) a[j] = c[j];
-}