]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
SDD raw data format read from block attributes of CDH, RawStreamSDD instantiated...
authorprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 1 Jul 2009 08:29:22 +0000 (08:29 +0000)
committerprino <prino@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 1 Jul 2009 08:29:22 +0000 (08:29 +0000)
ITS/AliITS.cxx
ITS/AliITSClusterFinderV2SDD.cxx
ITS/AliITSDDLRawData.cxx
ITS/AliITSDDLRawData.h
ITS/AliITSDetTypeSim.cxx
ITS/AliITSDetTypeSim.h
ITS/AliITSRawStreamSDD.cxx
ITS/AliITSRawStreamSDD.h
ITS/AliITSRawStreamSDDCompressed.cxx
ITS/AliITSSimuParam.cxx
ITS/AliITSSimuParam.h

index 2198c9924fe8d2630a5548726a7a16e64eea78c1..234b90cdd53a697cfc2b5b91bd3854bac53b3b48 100644 (file)
@@ -1125,10 +1125,10 @@ void AliITS::Digits2Raw(){
   
   
   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
@@ -1145,7 +1145,7 @@ void AliITS::Digits2Raw(){
   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
index d8f971b4e3c5c9d2cc55c2d66a77b720ac08a5cd..63618bba0a21b16f0fa41afb747b578dea2e743c 100644 (file)
@@ -287,13 +287,9 @@ void AliITSClusterFinderV2SDD::RawdataToClusters(AliRawReader* rawReader,TClones
     //------------------------------------------------------------
   // 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);
index 79e11cc8b9b305b77b8f2a7228038152f3d8df47..5ce7908e9dd6e03a82f3546f7cbd185ce8c809b8 100644 (file)
@@ -46,7 +46,7 @@ AliITSDDLRawData::AliITSDDLRawData():
 fVerbose(0),
 fIndex(-1),
 fHalfStaveModule(-1),
-fUseCompressedSDDFormat(0){
+fSDDRawFormat(7){
   //Default constructor
 
 }
@@ -58,7 +58,7 @@ AliITSDDLRawData::AliITSDDLRawData(const AliITSDDLRawData &source) :
 fVerbose(source.fVerbose),
 fIndex(source.fIndex),
 fHalfStaveModule(source.fHalfStaveModule),
-fUseCompressedSDDFormat(source.fUseCompressedSDDFormat){
+fSDDRawFormat(source.fSDDRawFormat){
   //Copy Constructor
 }
 
@@ -69,7 +69,7 @@ AliITSDDLRawData& AliITSDDLRawData::operator=(const AliITSDDLRawData &source){
   this->fIndex=source.fIndex;
   this->fHalfStaveModule=source.fHalfStaveModule;
   this->fVerbose=source.fVerbose;
-  this->fUseCompressedSDDFormat=source.fUseCompressedSDDFormat;
+  this->fSDDRawFormat=source.fSDDRawFormat;
   return *this;
 }
 
@@ -151,7 +151,16 @@ void AliITSDDLRawData::GetDigitsSDDCompressed(TClonesArray *ITSdigits, Int_t mod
       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;
     }
@@ -631,11 +640,18 @@ Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch, AliITSDDLModuleMapSDD* ddlsd
   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  
@@ -648,7 +664,7 @@ Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch, AliITSDDLModuleMapSDD* ddlsd
 
 
     //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));
     }
@@ -663,7 +679,7 @@ Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch, AliITSDDLModuleMapSDD* ddlsd
        //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{
@@ -675,7 +691,7 @@ Int_t AliITSDDLRawData::RawDataSDD(TBranch* branch, AliITSDDLModuleMapSDD* ddlsd
       }//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));      
index 4caf0b4549fb29437a99a6e875999372e6bc6fd0..5edfba73f4fe5307d45672397da978993379b1ec 100644 (file)
@@ -29,8 +29,8 @@ class AliITSDDLRawData:public TObject{
   // 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);
@@ -48,9 +48,9 @@ class AliITSDDLRawData:public TObject{
   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
index 85949f1dc77e6c4c9ec2083a8647f0d99b7586e7..635b2f6d475343a11c71a7483e907be265644a78 100644 (file)
@@ -48,7 +48,6 @@
 #include "AliITSCorrMapSDD.h"
 #include "AliITSDriftSpeedArraySDD.h"
 #include "AliITSDriftSpeedSDD.h"
-#include "AliITSHLTforSDD.h"
 #include "AliITSCalibrationSSD.h"
 #include "AliITSNoiseSSDv2.h"
 #include "AliITSGainSSDv2.h"
@@ -93,7 +92,6 @@ fDDLMapSDD(0),
 fkDigClassName(), // String with digit class name.
 fLoader(0),      // local pointer to loader
 fFirstcall(kTRUE),
-fIsHLTmodeC(0), // flag
 fFOGenerator(),
 fTriggerConditions(NULL)
 { 
@@ -182,7 +180,6 @@ fDDLMapSDD(source.fDDLMapSDD),
 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) 
 {
@@ -464,7 +461,6 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
   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);
@@ -474,7 +470,7 @@ Bool_t AliITSDetTypeSim::GetCalibration() {
 
 if(!deadSPD || !noisySPD || !foEffSPD || !foNoiSPD 
      || !entrySDD || !entryNoiseSSD || !entryGainSSD || !entryBadChannelsSSD 
-     || !drSpSDD || !ddlMapSDD || !hltforSDD || !mapTSDD){
+     || !drSpSDD || !ddlMapSDD || !mapTSDD){
     AliFatal("Calibration object retrieval failed! ");
     return kFALSE;
   }            
@@ -508,10 +504,6 @@ if(!deadSPD || !noisySPD || !foEffSPD || !foNoiSPD
   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);
@@ -587,7 +579,6 @@ if(!deadSPD || !noisySPD || !foEffSPD || !foNoiSPD
     delete entryGainSSD;
     delete entryBadChannelsSSD;
 //    delete mapASDD;   
-    delete hltforSDD;
     delete mapTSDD;
     delete drSpSDD;
     delete ddlMapSDD;
@@ -596,7 +587,7 @@ if(!deadSPD || !noisySPD || !foEffSPD || !foNoiSPD
   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;
@@ -620,7 +611,6 @@ if(!deadSPD || !noisySPD || !foEffSPD || !foNoiSPD
   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());
index cf57a31a6f86b959b3265c4f83536d1259ddccf0..6f7fa795c296f7066202013fbb8ffab07ebfb48a 100644 (file)
@@ -70,7 +70,6 @@ class AliITSDetTypeSim : public TObject {
     }
     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;}
@@ -150,11 +149,10 @@ class AliITSDetTypeSim : public TObject {
     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
  
 };
 
index 2682d00c2e70ff535f809dc452b5dcf2d72efdaf..379153fadd8193dd46ca55b69e1b468e0ee965fd 100644 (file)
@@ -22,6 +22,7 @@
 ///////////////////////////////////////////////////////////////////////////////
 
 #include "AliITSRawStreamSDD.h"
+#include "AliITSRawStreamSDDCompressed.h"
 #include "AliRawReader.h"
 #include "AliLog.h"
 
@@ -85,6 +86,39 @@ AliITSRawStreamSDD::~AliITSRawStreamSDD(){
   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
index 471f91bd2bfc8c04af386eacffa1536bffc94814..d8e30257e908ad8256175bc6443898f339f8de2a 100644 (file)
@@ -24,6 +24,10 @@ class AliITSRawStreamSDD: public AliITSRawStream {
     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;}
index 9ddab4899c863008068884a64b267aa1af49554b..00953c6f0a998b2708bb8c9f55268d1d9d9601ac 100644 (file)
@@ -164,7 +164,9 @@ Bool_t AliITSRawStreamSDDCompressed::Next()
   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);
index d903555f1cc925c275a966a1e012bf4c44a85dd9..d4bb8a0d737381ddfd92c0959a8615822cb88c0b 100644 (file)
@@ -71,6 +71,7 @@ fSDDJitterError(fgkSDDJitterErrorDefault),
 fSDDDynamicRange(fgkSDDDynamicRangeDefault),
 fSDDMaxAdc(0.),
 fSDDChargeLoss(fgkSDDChargeLossDefault),
+fSDDRawFormat(7),
 fSSDCouplingPR(0),
 fSSDCouplingPL(0),
 fSSDCouplingNR(0),
@@ -116,6 +117,7 @@ fSDDJitterError(simpar.fSDDJitterError),
 fSDDDynamicRange(simpar.fSDDDynamicRange),
 fSDDMaxAdc(simpar.fSDDMaxAdc),
 fSDDChargeLoss(simpar.fSDDChargeLoss),
+fSDDRawFormat(simpar.fSDDRawFormat),
 fSSDCouplingPR(simpar.fSSDCouplingPR),
 fSSDCouplingPL(simpar.fSSDCouplingPL),
 fSSDCouplingNR(simpar.fSSDCouplingNR),
@@ -184,6 +186,7 @@ void AliITSSimuParam::PrintParameters() const{
   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);
index 125e9344e53f6bd7feaf2cc7bd37fe7ded1ddb60..520180874fd571cbcc49e7cb13f5118b1f96d35e 100644 (file)
@@ -93,6 +93,9 @@ class AliITSSimuParam : public TObject {
   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; }
@@ -222,6 +225,7 @@ class AliITSSimuParam : public TObject {
   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
@@ -237,6 +241,6 @@ class AliITSSimuParam : public TObject {
   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