AliITSDDLModuleMapSDD* ddlsdd=fDetTypeSim->GetDDLModuleMapSDD();
- Bool_t isHLTmodeC=fDetTypeSim->IsHLTmodeC();
+ Char_t rawSDD=fDetTypeSim->GetSimuParam()->GetSDDRawDataFormat();
AliITSDDLRawData rawWriter;
- if(isHLTmodeC) rawWriter.SetUseCompressedSDDFormat(kTRUE);
- else rawWriter.SetUseCompressedSDDFormat(kFALSE);
+
+ rawWriter.SetSDDRawFormat(rawSDD);
//Verbose level
// 0: Silent
// 1: cout messages
if(deleteFOsignalsLater) delete foSignals;
//SILICON DRIFT DETECTOR
- AliDebug(1,"Formatting raw data for SDD");
+ AliDebug(1,Form("Formatting raw data for SDD - Format code =%d",rawSDD));
rawWriter.RawDataSDD(digits->GetBranch("ITSDigitsSDD"),ddlsdd);
//SILICON STRIP DETECTOR
//------------------------------------------------------------
// This function creates ITS clusters from raw data
//------------------------------------------------------------
- rawReader->Reset();
- AliITSRawStream* inputSDD;
- if(fDetTypeRec->IsHLTmodeC()==kTRUE){
- inputSDD=new AliITSRawStreamSDDCompressed(rawReader);
- }else{
- inputSDD=new AliITSRawStreamSDD(rawReader);
- }
+
+ AliITSRawStream* inputSDD=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader);
+ AliDebug(1,Form("%s is used",inputSDD->ClassName()));
AliITSDDLModuleMapSDD *ddlmap=(AliITSDDLModuleMapSDD*)fDetTypeRec->GetDDLModuleMapSDD();
inputSDD->SetDDLModuleMap(ddlmap);
fVerbose(0),
fIndex(-1),
fHalfStaveModule(-1),
-fUseCompressedSDDFormat(0){
+fSDDRawFormat(7){
//Default constructor
}
fVerbose(source.fVerbose),
fIndex(source.fIndex),
fHalfStaveModule(source.fHalfStaveModule),
-fUseCompressedSDDFormat(source.fUseCompressedSDDFormat){
+fSDDRawFormat(source.fSDDRawFormat){
//Copy Constructor
}
this->fIndex=source.fIndex;
this->fHalfStaveModule=source.fHalfStaveModule;
this->fVerbose=source.fVerbose;
- this->fUseCompressedSDDFormat=source.fUseCompressedSDDFormat;
+ this->fSDDRawFormat=source.fSDDRawFormat;
return *this;
}
dataWord+=sid<<26;
dataWord+=iz<<18;
dataWord+=ix<<10;
- dataWord+=is;
+ UInt_t adcEncoded=0;
+ Int_t shift=0;
+ if(is < 8) shift=2;
+ else if(is<16) shift=3;
+ else if(is<32) shift=4;
+ else if(is<64) shift=5;
+ else if(is<128) shift=6;
+ else shift=7;
+ adcEncoded=shift+((is-(1<<shift))<<3);
+ dataWord+=adcEncoded;
fIndex++;
buf[fIndex]=dataWord;
}
char fileName[15];
AliFstream* outfile; // logical name of the output file
AliRawDataHeaderSim header;
+
+ if(fSDDRawFormat!=0){
+ for(Int_t ibit=0; ibit<8; ibit++) header.SetAttribute(ibit);
+ }else{
+ for(Int_t ibit=0; ibit<5; ibit++) header.SetAttribute(ibit);
+ for(Int_t ibit=5; ibit<8; ibit++) header.ResetAttribute(ibit);
+ }
UInt_t skippedword, carlosFooterWord,fifoFooterWord,jitterWord;
Bool_t retcode;
retcode = AliBitPacking::PackWord(0x3FFFFFFF,carlosFooterWord,0,31);
retcode = AliBitPacking::PackWord(0x3F1F1F1F,fifoFooterWord,0,31);
- if(!fUseCompressedSDDFormat) retcode = AliBitPacking::PackWord(0x7F000000,jitterWord,0,31);
+ if(fSDDRawFormat!=0) retcode = AliBitPacking::PackWord(0x7F000000,jitterWord,0,31);
else retcode = AliBitPacking::PackWord(0x80000000,jitterWord,0,31);
//loop over DDLs
//first 1 "dummy" word to be skipped
- if(!fUseCompressedSDDFormat){
+ if(fSDDRawFormat!=0){
retcode = AliBitPacking::PackWord(0xFFFFFFFF,skippedword,0,31);
outfile->WriteBuffer((char*)(&skippedword),sizeof(skippedword));
}
//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
// cout<<"MODULE NUMBER:"<<mapSDD[i][mod]<<endl;
- if(fUseCompressedSDDFormat){
+ if(fSDDRawFormat==0){
GetDigitsSDDCompressed(digits,mod,buf);
outfile->WriteBuffer((char *)buf,((fIndex+1)*sizeof(UInt_t)));
}else{
}//end if
}//end for
// 12 words with FIFO footers (=4 FIFO x 3 3F1F1F1F words per DDL)
- if(!fUseCompressedSDDFormat){
+ if(fSDDRawFormat!=0){
for(Int_t iw=0;iw<12;iw++) outfile->WriteBuffer((char*)(&fifoFooterWord),sizeof(fifoFooterWord));
}
outfile->WriteBuffer((char*)(&jitterWord),sizeof(jitterWord));
// This method generates the files with the Silicon pixel detector data
void SetVerbose(Int_t Verbose){fVerbose=Verbose;}
// To set the verbose level
- void SetUseCompressedSDDFormat(Bool_t opt=kFALSE){
- fUseCompressedSDDFormat=opt;
+ void SetSDDRawFormat(Char_t val=7){
+ fSDDRawFormat=val;
}
private:
void GetDigitsSPD(TClonesArray *ITSdigits, Int_t mod,Int_t ddl,UInt_t *buf, AliITSFOSignalsSPD* foSignals = NULL);
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
- Bool_t fUseCompressedSDDFormat; // flag for use the compressed SDD raw data format
+ Char_t fSDDRawFormat; // index for SDD raw format
- ClassDef(AliITSDDLRawData,2)
+ ClassDef(AliITSDDLRawData,3)
};
#endif
#include "AliITSCorrMapSDD.h"
#include "AliITSDriftSpeedArraySDD.h"
#include "AliITSDriftSpeedSDD.h"
-#include "AliITSHLTforSDD.h"
#include "AliITSCalibrationSSD.h"
#include "AliITSNoiseSSDv2.h"
#include "AliITSGainSSDv2.h"
fkDigClassName(), // String with digit class name.
fLoader(0), // local pointer to loader
fFirstcall(kTRUE),
-fIsHLTmodeC(0), // flag
fFOGenerator(),
fTriggerConditions(NULL)
{
fkDigClassName(), // String with digit class name.
fLoader(source.fLoader), // local pointer to loader
fFirstcall(source.fFirstcall),
-fIsHLTmodeC(source.fIsHLTmodeC),
fFOGenerator(source.fFOGenerator),
fTriggerConditions(source.fTriggerConditions)
{
AliCDBEntry *entrySDD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSDD", run);
AliCDBEntry *drSpSDD = AliCDBManager::Instance()->Get("ITS/Calib/DriftSpeedSDD",run);
AliCDBEntry *ddlMapSDD = AliCDBManager::Instance()->Get("ITS/Calib/DDLMapSDD",run);
- AliCDBEntry *hltforSDD = AliCDBManager::Instance()->Get("ITS/Calib/HLTforSDD");
//AliCDBEntry *mapASDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsAnodeSDD",run);
AliCDBEntry *mapTSDD = AliCDBManager::Instance()->Get("ITS/Calib/MapsTimeSDD",run);
// AliCDBEntry *entrySSD = AliCDBManager::Instance()->Get("ITS/Calib/CalibSSD", run);
if(!deadSPD || !noisySPD || !foEffSPD || !foNoiSPD
|| !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD
- || !drSpSDD || !ddlMapSDD || !hltforSDD || !mapTSDD){
+ || !drSpSDD || !ddlMapSDD || !mapTSDD){
AliFatal("Calibration object retrieval failed! ");
return kFALSE;
}
if(!isCacheActive)ddlMapSDD->SetObject(NULL);
ddlMapSDD->SetOwner(kTRUE);
- AliITSHLTforSDD* hltsdd=(AliITSHLTforSDD*)hltforSDD->GetObject();
- if(!isCacheActive)hltforSDD->SetObject(NULL);
- hltforSDD->SetOwner(kTRUE);
-
// TObjArray *mapAn = (TObjArray *)mapASDD->GetObject();
// if(!isCacheActive)mapASDD->SetObject(NULL);
// mapASDD->SetOwner(kTRUE);
delete entryGainSSD;
delete entryBadChannelsSSD;
// delete mapASDD;
- delete hltforSDD;
delete mapTSDD;
delete drSpSDD;
delete ddlMapSDD;
AliCDBManager::Instance()->SetCacheFlag(origCacheStatus);
if ((!calDeadSPD) || (!calNoisySPD) || (!calFoEffSPD) || (!calFoNoiSPD)
- || (!calSDD) || (!drSp) || (!ddlsdd) || (!hltsdd)
+ || (!calSDD) || (!drSp) || (!ddlsdd)
|| (!mapT) || (!noiseSSD)|| (!gainSSD)|| (!badChannelsSSD)) {
AliWarning("Can not get calibration from calibration database !");
return kFALSE;
fFOGenerator.SetNoise(calFoNoiSPD); // this cal object is used only by the generator
fDDLMapSDD->SetDDLMap(ddlsdd);
- fIsHLTmodeC=hltsdd->IsHLTmodeC();
Bool_t oldMapFormat=kFALSE;
TObject* objmap=(TObject*)mapT->At(0);
TString cname(objmap->ClassName());
}
virtual AliITSSimuParam* GetSimuParam() const {return fSimuPar;}
- virtual Bool_t IsHLTmodeC() const {return fIsHLTmodeC;}
virtual AliITSDDLModuleMapSDD* GetDDLModuleMapSDD()const { return fDDLMapSDD;}
TObjArray* GetCalibrationArray() const {return fCalibration;}
TObjArray* GetSegmentation() const {return fSegmentation;}
const Char_t* fkDigClassName[3]; //! String with digit class name.
AliITSLoader* fLoader; //! loader
Bool_t fFirstcall; //! flag
- Bool_t fIsHLTmodeC; //! flag for HLT mode C status (used by SDD)
AliITSFOGeneratorSPD fFOGenerator; //! Fast-OR generator object
AliITSTriggerConditions* fTriggerConditions; //! Trigger conditions
- ClassDef(AliITSDetTypeSim,10) // ITS Simulation structure
+ ClassDef(AliITSDetTypeSim,11) // ITS Simulation structure
};
///////////////////////////////////////////////////////////////////////////////
#include "AliITSRawStreamSDD.h"
+#include "AliITSRawStreamSDDCompressed.h"
#include "AliRawReader.h"
#include "AliLog.h"
if(fDDLModuleMap) delete fDDLModuleMap;
}
//______________________________________________________________________
+UChar_t AliITSRawStreamSDD::ReadBlockAttributes(AliRawReader* rawReader){
+ // reads block attribuited from CDH
+ UChar_t *data;
+ rawReader->Reset();
+ rawReader->Select("ITSSDD");
+ do{
+ if(!rawReader->ReadNextData(data)) return 0x0;
+ }while(rawReader->GetDataSize()==0);
+ UChar_t attr=rawReader->GetBlockAttributes();
+ return attr;
+}
+//______________________________________________________________________
+AliITSRawStream* AliITSRawStreamSDD::CreateRawStreamSDD(AliRawReader* rawReader, UChar_t attributes){
+ // instantiates the proper raw stream from block attributes value
+
+ Int_t rawFormat=(attributes&0xE0)>>5;
+ rawReader->Reset();
+ AliITSRawStream* inputSDD;
+ if(rawFormat==0){
+ inputSDD=new AliITSRawStreamSDDCompressed(rawReader);
+ inputSDD->SetADCEncoded(kTRUE);
+ }else{
+ inputSDD=new AliITSRawStreamSDD(rawReader);
+ }
+ return inputSDD;
+}
+//______________________________________________________________________
+AliITSRawStream* AliITSRawStreamSDD::CreateRawStreamSDD(AliRawReader* rawReader){
+ // reads the data format from CDH and instantiates the proper raw stream
+ UChar_t attr=ReadBlockAttributes(rawReader);
+ return CreateRawStreamSDD(rawReader,attr);
+}
+//______________________________________________________________________
UInt_t AliITSRawStreamSDD::ReadBits()
{
// read bits from the given channel
AliITSRawStreamSDD& operator=(const AliITSRawStreamSDD& rs);
virtual ~AliITSRawStreamSDD();
+ static UChar_t ReadBlockAttributes(AliRawReader* rawReader);
+ static AliITSRawStream* CreateRawStreamSDD(AliRawReader* rawReader, UChar_t attributes);
+ static AliITSRawStream* CreateRawStreamSDD(AliRawReader* rawReader);
+
virtual Bool_t Next();
virtual Int_t GetAnode() const {return fCoord1;}
while(kTRUE){
if (!fRawReader->ReadNextInt(fData)) return kFALSE; // read next word
UInt_t mostsigbits=fData>>28;
- if(mostsigbits==maskeom){
+ if(fData==0xFFFFFFFF){
+ // CarlosRX header do nothing
+ } else if(mostsigbits==maskeom){
fCarlosId=fData&maskmod;
fDDL=fRawReader->GetDDLID();
fModuleID = GetModuleNumber(fDDL,fCarlosId);
fSDDDynamicRange(fgkSDDDynamicRangeDefault),
fSDDMaxAdc(0.),
fSDDChargeLoss(fgkSDDChargeLossDefault),
+fSDDRawFormat(7),
fSSDCouplingPR(0),
fSSDCouplingPL(0),
fSSDCouplingNR(0),
fSDDDynamicRange(simpar.fSDDDynamicRange),
fSDDMaxAdc(simpar.fSDDMaxAdc),
fSDDChargeLoss(simpar.fSDDChargeLoss),
+fSDDRawFormat(simpar.fSDDRawFormat),
fSSDCouplingPR(simpar.fSSDCouplingPR),
fSSDCouplingPL(simpar.fSSDCouplingPL),
fSSDCouplingNR(simpar.fSSDCouplingNR),
printf("Dynamic Range = %f\n",fSDDDynamicRange);
printf("Max. ADC = %f\n",fSDDMaxAdc);
printf("Charge Loss = %f\n",fSDDChargeLoss);
+ printf("Raw Data Format = %d\n",fSDDRawFormat);
printf("\n");
printf("===== SSD parameters =====\n");
printf("Coupling PR = %f\n",fSSDCouplingPR);
void SetSDDChargeLoss(Double_t p1) {fSDDChargeLoss=p1;}
Float_t GetSDDChargeLoss() const {return fSDDChargeLoss;}
+ void SetSDDRawDataFormatCarlos() {fSDDRawFormat=7;}
+ void SetSDDRawDataFormatFixLen8bitEncoded() {fSDDRawFormat=0;}
+ Char_t GetSDDRawDataFormat() const {return fSDDRawFormat;}
Int_t GetSSDZSThreshold() const { // ZS threshold
return fSSDZSThreshold; }
virtual void SetSSDZSThreshold(Int_t zsth) { fSSDZSThreshold = zsth; }
Float_t fSDDDynamicRange; // SDD Dynamic Range
Float_t fSDDMaxAdc; // SDD ADC saturation value
Float_t fSDDChargeLoss; // Set Linear Coefficient for Charge Loss
+ Char_t fSDDRawFormat; // Index for SDD RawFormat
Double_t fSSDCouplingPR; // SSD couplings
Double_t fSSDCouplingPL; // SSD couplings
Double_t fN; // the impurity concentration of the material in #/cm^3 (NOT USED!)
Float_t fT; // The temperature of the Si in Degree K.
- ClassDef(AliITSSimuParam,3);
+ ClassDef(AliITSSimuParam,4);
};
#endif