]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDmcmSim.cxx
Changed AliRunLoader::GetRunLoader() into AliRunLoader::Instance()
[u/mrichter/AliRoot.git] / TRD / AliTRDmcmSim.cxx
index 39b1eb25570fab7d3cb7d691baae710fba0ba03e..534f82c23315ef0197faae8d7f4f3a9aeb5ab943 100644 (file)
@@ -610,7 +610,7 @@ Int_t AliTRDmcmSim::ProduceRawStream( UInt_t *buf, Int_t maxSize )
 }
 
 //_____________________________________________________________________________
-Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize )
+Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize, UInt_t iEv )
 {
   //
   // Produce raw data stream from this MCM and put in buf
@@ -619,7 +619,7 @@ Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize )
   //
 
   UInt_t  x;
-  UInt_t  iEv = 0;
+  //UInt_t  iEv = 0;
   Int_t   nw  = 0;  // Number of written words
   Int_t   of  = 0;  // Number of overflowed words
   Int_t   rawVer   = fFeeParam->GetRAWversion();
@@ -634,8 +634,13 @@ Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize )
     adc = fADCF;
   }
 
-  // Produce MCM header
-  x = (1<<31) | ((fRobPos * fFeeParam->GetNmcmRob() + fMcmPos) << 24) | ((iEv % 0x100000) << 4) | 0xC;
+  // Produce MCM header : xrrr mmmm eeee eeee eeee eeee eeee 1100
+  //                      x : 0 before , 1 since 10.2007
+  //                      r : Readout board position (Alice numbering)
+  //                      m : MCM posi
+  //                      e : Event counter from 1
+  //x = (1<<31) | ((fRobPos * fFeeParam->GetNmcmRob() + fMcmPos) << 24) | ((iEv % 0x100000) << 4) | 0xC;
+  x = (1<<31) | (fRobPos << 28) | (fMcmPos << 24) | ((iEv % 0x100000) << 4) | 0xC;
   if (nw < maxSize) {
     buf[nw++] = x;
        //printf("\nMCM header: %X ",x);
@@ -673,7 +678,7 @@ Int_t AliTRDmcmSim::ProduceRawStreamV2( UInt_t *buf, Int_t maxSize )
 
   for (Int_t iAdc = 0; iAdc < 21; iAdc++ ) {
     if( rawVer>= 3 && fZSM1Dim[iAdc] != 0 ) continue; // Zero Suppression, 0 means not suppressed
-    aa = !(iAdc & 1) + 2;
+    aa = !(iAdc & 1) + 2;      // 3 for the even ADC channel , 2 for the odd ADC channel
     for (Int_t iT = 0; iT < fNTimeBin; iT+=3 ) {
       a1 = ((iT    ) < fNTimeBin ) ? adc[iAdc][iT  ] : 0;
       a2 = ((iT + 1) < fNTimeBin ) ? adc[iAdc][iT+1] : 0;
@@ -837,8 +842,9 @@ void AliTRDmcmSim::FilterTail()
     break;
   }
 
-  delete dtarg;
-  delete itarg;
+  delete [] dtarg;
+  delete [] itarg;
+
 }
 
 //_____________________________________________________________________________
@@ -2537,7 +2543,7 @@ void AliTRDmcmSim::Tracklet(){
   Int_t u = 0;
 
   AliTRDdigitsManager *digman = new AliTRDdigitsManager();
-  digman->ReadDigits(gAlice->GetRunLoader()->GetLoader("TRDLoader")->TreeD());
+  digman->ReadDigits(AliRunLoader::Instance()->GetLoader("TRDLoader")->TreeD());
   digman->SetUseDictionaries(kTRUE);
   AliTRDfeeParam *feeParam = AliTRDfeeParam::Instance();
 
@@ -2582,7 +2588,7 @@ void AliTRDmcmSim::Tracklet(){
       }
   }
 
AliDataLoader *dl = gAlice->GetRunLoader()->GetLoader("TRDLoader")->GetDataLoader("tracklets");
 AliDataLoader *dl = AliRunLoader::Instance()->GetLoader("TRDLoader")->GetDataLoader("tracklets");
   if (!dl) {
     AliError("Could not get the tracklets data loader!");
   }
@@ -2734,5 +2740,25 @@ void AliTRDmcmSim::FlagDigitsArray(AliTRDarrayADC *tempdigs, Int_t valrow)
        }
     }
 }
+//_______________________________________________________________________________________
+void AliTRDmcmSim::RestoreZeros()
+{
+  //
+  // Restore the zero-suppressed values (set as -1) to the value 0
+  //
+
+  for( Int_t iadc = 1 ; iadc < fNADC-1; iadc++ ) 
+    {
+      for( Int_t it = 0 ; it < fNTimeBin ; it++ ) 
+       {
+         
+         if(fADCF[iadc][it]==-1)  //if is a supressed zero, reset to zero
+           {
+             fADCF[iadc][it]=0;
+             fADCR[iadc][it]=0;
+           }     
+       }
+    }
 
+}