]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - RAW/AliAltroData.cxx
mixing example
[u/mrichter/AliRoot.git] / RAW / AliAltroData.cxx
index 5596917879ab622be922126e288b2226917d41a2..a240c8e0d453f12e0047b867901c24b96da560e9 100644 (file)
@@ -22,7 +22,8 @@ AliAltroData::AliAltroData(): fData(0),
                                    fBunchData(0),
                                    fDataSize(0),
                                    fWc(0),
-                                   fHadd(0),
+                                    fHadd(-1),
+                                    fPrevHadd(-1),
                                    fBunchCounter(0),
                                    fIsComplete(0)
 {
@@ -39,8 +40,61 @@ AliAltroData::~AliAltroData()
 }
 
 
+/*
+bool
+//AliHLTAltroData::NextBunch(AliHLTAltroBunch *altroBunch)
+AliAltroData::NextBunch(AliAltroBunch *altroBunch)
+{
+  //comment
+  if(fIsComplete == true)
+    {
+
+      if(fBunchCounter == 0)
+       {
+         fBunchData = &fData[fDataSize - 1];
+         altroBunch->fData = &fData[fDataSize - 1];
+         
+       }
+
+      if(fWc < fDataSize)
+       {
+         fWc += *fBunchData;
+         altroBunch->fBunchSize = *fBunchData;
+         altroBunch->fBunchDataSize = altroBunch->fBunchSize  -2;
+
+         fBunchData --;
+         altroBunch->fEndTimeBin = *fBunchData;
+         fBunchData ++;
+
+         fBunchData = fBunchData  -  (altroBunch->fBunchSize);
+         altroBunch->fData = altroBunch->fData -  (altroBunch->fBunchSize);
+         fBunchCounter ++;
+         return true;
+
+       }
+      else
+       {
+         fBunchCounter = 0;
+         fWc = 0;
+         return false;
+       }
+    }
+  else
+    {
+      printf("\nAliHLTAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
+      printf("\nfor branch %d, card %d, chip %d, channel %d\n",  GetBranch(), GetCard(), GetChip(), GetChannel());
+      return false;
+    }
+}
+
+*/
+
+
+
+
 Bool_t AliAltroData::NextBunch(AliAltroBunch *altroBunch)
 {
+
   if(fIsComplete == kTRUE)
     {
 
@@ -59,6 +113,16 @@ Bool_t AliAltroData::NextBunch(AliAltroBunch *altroBunch)
          altroBunch->SetEndTimeBin( *fBunchData );
          //      altroBunch->SetStartTimeBin(*fBunchData - fBunchSize);
          fBunchData -= (altroBunch->GetBunchSize() +1);
+
+         // PATCH from Per Thomas Hille 250408 mke sure tha
+         // Data is consistent by cheking the start timebin, should never be negative
+         if( (int)altroBunch->GetStartTimeBin( ) < 0)
+           {
+             //              printf("ERROR altroBunch->GetStartTimeBin( ) is  %d", (int)altroBunch->GetStartTimeBin( ) );
+             return kFALSE;
+           }
+
+
          fBunchCounter ++;
          return kTRUE;
        }
@@ -71,13 +135,15 @@ Bool_t AliAltroData::NextBunch(AliAltroBunch *altroBunch)
     }
   else
     {
-      printf("\nAliAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
-      printf("\nfor branch %d, card %d, chip %d, channel %d\n",  GetBranch(), GetCard(), GetChip(), GetChannel());
+      //     printf("\nAliAltroData::NextBunch: WARNING, dataset is not complet. 2AAA endmarker is missing ");
+      //    printf("\nfor branch %d, card %d, chip %d, channel %d\n",  GetBranch(), GetCard(), GetChip(), GetChannel());
       return kFALSE;
     }
 
 }
 
+
+
 void AliAltroData::Reset()
 {
    fWc = 0;