The turbo version of decoding now as option for DA.
authordibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Apr 2008 07:29:59 +0000 (07:29 +0000)
committerdibari <dibari@f7af4fe6-9843-0410-8265-dc069ae4e863>
Thu, 17 Apr 2008 07:29:59 +0000 (07:29 +0000)
HMPID/AliHMPIDCalib.cxx
HMPID/AliHMPIDRawStream.cxx
HMPID/AliHMPIDRawStream.h
HMPID/HMPIDda.cxx

index 85b6ccc..abbef79 100644 (file)
@@ -577,18 +577,22 @@ Bool_t AliHMPIDCalib::CalcPedestalPaolo(Int_t nDDL, Char_t* /*name*/, Int_t nEv)
          nEvPerPad2=fnpc[nDDL][2*row][dil][pad];
         
         if(nEvPerPad1 < 1 ) { mean1  = 4000; sigma1 = 1000; }
+        else 
+        {
+          mean1 = fsq[nDDL][2*row-1][dil][pad]*1.0/nEvPerPad1;
+          qs2m1 = fsq2[nDDL][2*row-1][dil][pad]*1.0/nEvPerPad1;
+          qsm21 = TMath::Power(fsq[nDDL][2*row-1][dil][pad]*1.0/nEvPerPad1,2); 
+         sigma1 = TMath::Sqrt(TMath::Abs(qs2m1-qsm21));
+        }
+        
         if(nEvPerPad2 < 1 ) { mean2  = 4000; sigma2 = 1000; }
-                
-         mean1 = fsq[nDDL][2*row-1][dil][pad]*1.0/nEvPerPad1;
-         qs2m1 = fsq2[nDDL][2*row-1][dil][pad]*1.0/nEvPerPad1;
-         qsm21 = TMath::Power(fsq[nDDL][2*row-1][dil][pad]*1.0/nEvPerPad1,2); 
-        sigma1 = TMath::Sqrt(TMath::Abs(qs2m1-qsm21));
-       
+        else
+        {        
          mean2 = fsq[nDDL][2*row][dil][pad]*1.0/nEvPerPad2;
          qs2m2 = fsq2[nDDL][2*row][dil][pad]*1.0/nEvPerPad2;
          qsm22 = TMath::Power(fsq[nDDL][2*row][dil][pad]*1.0/nEvPerPad2,2); 
         sigma2 = TMath::Sqrt(TMath::Abs(qs2m2-qsm22));
-        
+      }
         pped[(row-1)/4]<<Form("%d %3.3lf %3.3lf %3.3lf %3.3lf \n",cnt,mean1,sigma1,mean2,sigma2);cnt++;
       }//pad
       }//dil 
index 2c1bcd9..dbab61a 100644 (file)
@@ -44,7 +44,8 @@ AliHMPIDRawStream::AliHMPIDRawStream(AliRawReader* rawReader) :
   fWord(0),
   fZeroSup(kTRUE),
   fPos(0x0),
-  fiPos(0)
+  fiPos(0),
+  fTurbo(kFALSE)
 {
   //
   // Constructor
@@ -83,7 +84,8 @@ AliHMPIDRawStream::AliHMPIDRawStream() :
   fWord(0),
   fZeroSup(kTRUE),
   fPos(0x0),
-  fiPos(0) 
+  fiPos(0),
+  fTurbo(kFALSE) 
 {
   //
   // Constructor
@@ -116,7 +118,7 @@ AliHMPIDRawStream::~AliHMPIDRawStream()
   fPosition=0;
   fWord=0;
   fZeroSup=0;
-  
+  fTurbo=0;
   for(Int_t i=0;i<kSumErr;i++) delete [] fNumOfErr[i]; 
   delete [] fNumOfErr; 
 
@@ -135,6 +137,37 @@ void AliHMPIDRawStream::Reset()
   if (fRawReader) fRawReader->Reset();
 }
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+Bool_t AliHMPIDRawStream::Turbo()
+{
+  
+  Int_t row,dilogic;UInt_t pad;
+  Int_t cntGlob = fRawReader->GetDataSize()/4;
+  fPosition=0;
+  fNPads=0;
+//  Int_t gw=0;
+  for(Int_t i=1;i<cntGlob;i++) {
+    GetWord(1);
+    if (((fWord >> kbit27) & 1)) continue;
+    UInt_t statusControlRow = 0x32a8; 
+    UInt_t rowControlWord = fWord >> kbit0 & 0xfbff;
+    if(rowControlWord == statusControlRow) continue;
+
+    row = (fWord >> kbit22) & 0x1f;
+    dilogic = (fWord >> kbit18) & 0xf;                                              //dilogic info in raw word is between bits: 18...21
+    
+    pad = (fWord >> kbit12) & 0x3f;                                          //pad info in raw word is between bits: 12...17
+    if(!CheckPad(pad)) continue;
+    Int_t charge = fWord & 0xfff;
+    if(GetPad(fDDLNumber,row,dilogic,pad)<0) continue;
+    fPad[fNPads] = GetPad(fDDLNumber,row,dilogic,pad);
+    fCharge[fNPads] = charge; 
+    fNPads++;
+    if(charge==0) fNumOfErr[fDDLNumber][kPedQZero]++;
+  }//word loop
+  //Printf("Size: %i  DDL %i row %i dilogic %i pad %i fPos %i fNPads: %i Charge: %d Word %4.4x GoodW: %i",cntGlob,fDDLNumber,row,dilogic,pad,fPosition,fNPads,fCharge[fNPads-1],fWord,gw++);
+  return kTRUE;
+}//Turbo()
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 Bool_t AliHMPIDRawStream::Next()
 {
   // read next DDL raw data from the HMPID raw data stream
@@ -179,7 +212,8 @@ Bool_t AliHMPIDRawStream::Next()
     DelVars();                                        //We have to delete the variables initialized in the InitVars before recall IntiVars!!!
     InitVars(rawDataSize);                            //To read the charge and pads we cannot delete before the status return
     
-    status = ReadHMPIDRawData();
+    if(fTurbo==kTRUE) status=Turbo();
+    else status = ReadHMPIDRawData();
    
     if(status) AliDebug(1,Form("Event DDL %i successfully decoded!.",fDDLNumber));
     else AliDebug(1,Form("Event DDL %i ERROR in decoding!.",fDDLNumber));
index 7d09907..c3aef37 100644 (file)
@@ -54,8 +54,9 @@ class AliHMPIDRawStream: public TObject {
     UInt_t GetLDCNumber() const{ return fLDCNumber;} //return the number of LDC actually being decoded
     UInt_t GetTimeStamp() const{ return fTimeStamp;} //return the time stamp of the event actually being decoded
 
-  
-        
+    void   SetTurbo(Bool_t isTurbo){fTurbo=isTurbo;}     // Enable/Disable Turbo
+    Bool_t GetTurbo(){ return fTurbo;}                   // Enable Turbo
+    Bool_t Turbo();                                      // Read HMPID Raw data without error checks
     Bool_t ReadHMPIDRawData();                           // Read HMPID Raw data
     Bool_t ReadSegment(Int_t &cntSegment);               // Read Segment
     Bool_t ReadRow(Int_t &cntRow);                       // Read Row
@@ -127,6 +128,7 @@ enum Ebits {kbit0,kbit1 , kbit2, kbit3, kbit4, kbit5, kbit6, kbit7, kbit8,
     Bool_t           fZeroSup;                                           // set if zero suppression is applied
     Int_t           *fPos;                                               // for debug purposes
     Int_t            fiPos;                                              // counter for debug
+    Bool_t           fTurbo;                                             // kTRUE = Turbo decoding is called. DEFAULT: kFALSE = normal decoding is called
     ClassDef(AliHMPIDRawStream, 2)                                       // base class for reading HMPID raw digits
 };
 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
index beffd73..cbc7b03 100644 (file)
@@ -152,13 +152,13 @@ int main(int argc, char **argv){
         ldcId=(unsigned long)event->eventLdcId;
         if(iEvtNcal==firstEvt && pCal->GetWritePads()==kTRUE) 
         {
-          if(pCal->GetLargePads()==kFALSE)  pCal->InitFile((Int_t)ldcId);    //The number for iEvtNcal should be the same as for the first value
-          else pCal->InitFile((Int_t)runNum);    //The number for iEvtNcal should be the same as for the first value
+          if(pCal->GetLargePads()==kFALSE)  pCal->InitFile((Int_t)ldcId);         //The number for iEvtNcal should be the same as for the first value
+          else pCal->InitFile((Int_t)runNum);                                     //The number for iEvtNcal should be the same as for the first value
         }
         
         iEvtNcal++;        
        AliRawReader *reader = new AliRawReaderDate((void*)event);
-       AliHMPIDRawStream stream(reader);
+       AliHMPIDRawStream stream(reader);stream.SetTurbo(kTRUE);                  //raw data decoding without error checks SetTurbo(kTRUE)
         while(stream.Next())
           {
              for(Int_t iPad=0;iPad<stream.GetNPads();iPad++) {
@@ -206,7 +206,7 @@ int main(int argc, char **argv){
     /* Calculate pedestal for the given ddl, if there is no ddl go t next */
     if(!pCal->CalcPedestal(nDDL,Form("%sHmpidPedDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue;
     /* to create pedestal file as Paolo uncomment the line */
-//    if(!pCal->CalcPedestalPaolo(nDDL,Form("%sHmpidPedDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue;
+    //if(!pCal->CalcPedestalPaolo(nDDL,Form("%sHmpidPedDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue;
     if(!pCal->WriteErrors(nDDL,Form("%sHmpidErrorsDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue;
     
     /* store the result file on FES */