// @(#) $Id$ /** \class AliL3TPCBeamTestMemHandler
//_____________________________________________________________
// AliL3TPCBeamTestMemHandler
//
// Class for converting the test beam data of May 2004 
// to the HLT file format using R. Bramms tables.
//
// Author: C. Loizides 
// -- Copyright © ALICE HLT Group
*/ #include "AliL3StandardIncludes.h" #include "AliL3RootTypes.h" #include "AliL3Logging.h" #include "AliL3Transform.h" #include "AliL3MemHandler.h" #include "AliL3DigitData.h" #include "AliL3TPCBeamTestMemHandler.h" #if __GNUC__ >= 3 using namespace std; #endif ClassImp(AliL3TPCBeamTestMemHandler) AliL3TPCBeamTestMemHandler::AliL3TPCBeamTestMemHandler(Char_t *fPathToMappingFile) : AliL3MemHandler() { //constructor fMinTimeBin=1; fNumOfChannels=7807+1; //must be big enough to contain all channels (per patch) Char_t readcarry[255]; Int_t actPos=0; Int_t oldPos=0; ifstream *in = new ifstream(); in->open(fPathToMappingFile); #if defined(__HP_aCC) || defined(__DECCXX) if(!in->rdbuf()->is_open()){ #else if(!in->is_open()){ #endif LOG(AliL3Log::kFatal,"AliL3TPCBeamTestMemHandler","Mapping File") <<"Can't open file " << fPathToMappingFile << " !!!" <> readcarry; mappingRow[j] = atoi(readcarry); } actPos = mappingRow[0]; fMapping[actPos] = mappingRow; if( (actPos - oldPos) > 1){ for(Int_t j = (oldPos+1); j < actPos; j++){ fMapping[j] = fMappingEmptyRow; } } oldPos = actPos; } in->close(); delete in; } AliL3TPCBeamTestMemHandler::~AliL3TPCBeamTestMemHandler() { //destructor for(Int_t i = 0; i < 5504 ; i++) { if(fMapping[i] != fMappingEmptyRow && fMapping[i]) delete[] fMapping[i]; } delete [] fMappingEmptyRow; delete[] fMapping; } AliL3DigitRowData* AliL3TPCBeamTestMemHandler::RawData2Memory(UInt_t &nrow,Int_t /*event*/) { //convert the raw data AliL3DigitRowData *data = 0; nrow=0; Int_t nrowsdummy=AliL3Transform::GetNRows(fPatch); fRows = new AliRowStructure[nrowsdummy]; for(Int_t i=0;i=fNumOfChannels) continue; Int_t pad=MappingGetPad(hw); Int_t lrow=MappingGetPadRow(hw); if((lrow<0) ||(pad<0)) continue; if(lrow+fRowMin>fRowMax) continue; fRows[lrow].fRow=lrow+fRowMin; if(fRows[lrow].fPadPos[pad]!=-1){ continue; } Bool_t isThereDataOnThisPad=kFALSE; Int_t digmean=0; #if 1 for(Int_t timebin = fMinTimeBin ; timebin <= ntimebins ; timebin++){ Int_t dig=fInputPtr[pos+timebin]; digmean+=dig; } digmean/=(ntimebins-fMinTimeBin+1); #else digmean = 40; #endif for(Int_t timebin = fMinTimeBin ; timebin <= ntimebins ; timebin++){ Int_t dig=fInputPtr[pos+timebin]-digmean; if(dig <= AliL3Transform::GetZeroSup()) continue; if(dig >= AliL3Transform::GetADCSat()) dig = AliL3Transform::GetADCSat(); fRows[lrow].fNDigits++; //for this row only ndigitcount++; isThereDataOnThisPad=kTRUE; } if(isThereDataOnThisPad) { fRows[lrow].fPadPos[pad]=pos; } } Int_t nrows=0; for(Int_t i=0;ifRow = slrow; tempPt->fNDigit = fRows[i].fNDigits; Int_t localcount=0; for(Int_t pad=0;pad= AliL3Transform::GetADCSat()) dig = AliL3Transform::GetADCSat(); //Exclude data outside cone: //AliL3Transform::Raw2Local(xyz,sector,row,pad,time); //if(fParam->GetPadRowRadii(sector,row)<230./250.*fabs(xyz[2])) continue; tempPt->fDigitData[localcount].fCharge=(UShort_t)dig; tempPt->fDigitData[localcount].fPad=(UChar_t)pad; tempPt->fDigitData[localcount].fTime=(UShort_t)timebin-1; //cout << slrow << " " << pad << " " << timebin << " " << dig << endl; #ifdef do_mc tempPt->fDigitData[localcount].fTrackID[0] = 0; tempPt->fDigitData[localcount].fTrackID[1] = 0; tempPt->fDigitData[localcount].fTrackID[2] = 0; #endif localcount++; ndigitcounttest++; } //time } //pad if(localcount != fRows[i].fNDigits) LOG(AliL3Log::kFatal,"AliL3TPCBeamTestMemHandler::RawData2Memory","Memory") <