]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALTriggerRawDigit.cxx
Changes needed for evaporation and fragmentation
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTriggerRawDigit.cxx
index 7332439fd60603b8ef90b26ee6854b55928398c0..3d0278b34a3b5eed2d1a370e8e6ea2f5bb3c4497 100644 (file)
 #include <TMath.h>
 
 #include "AliEMCALTriggerRawDigit.h"
-#include "AliLog.h"
 
 ClassImp(AliEMCALTriggerRawDigit)
 
 //____________________________________________________________________________
 AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit() : AliEMCALRawDigit(),
-fL0Trigger(0),
+fTriggerBits(0),
 fNL0Times(0),
 fL0Times(),
 fL1TimeSum(-1)
@@ -42,31 +41,34 @@ fL1TimeSum(-1)
 
 //____________________________________________________________________________
 AliEMCALTriggerRawDigit::AliEMCALTriggerRawDigit(Int_t id, Int_t timeSamples[], Int_t nSamples) : AliEMCALRawDigit(id, timeSamples, nSamples),
-fL0Trigger(0),
+fTriggerBits(0),
 fNL0Times(0),
 fL0Times(),
 fL1TimeSum(-1)
 {
-       //
+       // Ctor
+       
        for (Int_t i = 0; i < 10; i++) fL0Times[i] = -1;
 }
 
 //____________________________________________________________________________
 AliEMCALTriggerRawDigit::~AliEMCALTriggerRawDigit() 
 {
-       //
+       // Dtor
+       
        //delete [] fL0Times;
 }
 
 //____________________________________________________________________________
 Bool_t AliEMCALTriggerRawDigit::SetL0Time(const Int_t i)
 {
-       //
+       // Set L0 times
+       
        for (Int_t j = 0; j < fNL0Times; j++)
        {
                if (i == fL0Times[j]) 
                {
-                       AliWarning("L0 time already there! Won't add it twice");
+                       AliDebug(1,Form("Digit id %d: L0 time %d already there! Won't add it twice",fId,i));
                        return kFALSE;
                }
        }
@@ -87,7 +89,8 @@ Bool_t AliEMCALTriggerRawDigit::SetL0Time(const Int_t i)
 //____________________________________________________________________________
 Bool_t AliEMCALTriggerRawDigit::GetL0Time(const Int_t i, Int_t& time) const
 {
-       //
+       // Get L0 times
+       
        if (i < 0 || i > fNL0Times)
        {
                AliError("Bad index!");
@@ -102,12 +105,7 @@ Bool_t AliEMCALTriggerRawDigit::GetL0Time(const Int_t i, Int_t& time) const
 //____________________________________________________________________________
 Bool_t AliEMCALTriggerRawDigit::GetL0Times(Int_t times[]) const
 {
-       //
-       if (sizeof(times) < (sizeof(Int_t) * fNL0Times))
-       {
-               AliError("Array size too small!");
-               return kFALSE;
-       }
+       // Get L0 times
        
        for (Int_t i = 0; i < fNL0Times; i++) times[i] = fL0Times[i];
        
@@ -117,7 +115,7 @@ Bool_t AliEMCALTriggerRawDigit::GetL0Times(Int_t times[]) const
 //____________________________________________________________________________
 Int_t AliEMCALTriggerRawDigit::GetL0TimeSum(const Int_t time) const
 {
-       //
+       // Get L0 time sum
        
        Int_t value = 0;
        
@@ -132,10 +130,22 @@ Int_t AliEMCALTriggerRawDigit::GetL0TimeSum(const Int_t time) const
        return value;
 }
 
+//____________________________________________________________________________
+Int_t AliEMCALTriggerRawDigit::GetTriggerBit(const TriggerType_t type, const Int_t mode) const
+{
+       // Get trigger bit
+       
+       Int_t shift = kTriggerTypeEnd * mode;
+       Int_t mask  = 1 << type;
+       
+       return ((fTriggerBits >> shift) & mask);
+}      
+
 //____________________________________________________________________________
 void AliEMCALTriggerRawDigit::Print(const Option_t* /*opt*/) const
 {
-       //
+       // Dump
+       
        printf("===\n| Digit id: %4d / %d Time Samples: \n",fId,fNSamples);
        for (Int_t i=0; i < fNSamples; i++) 
        {
@@ -144,13 +154,16 @@ void AliEMCALTriggerRawDigit::Print(const Option_t* /*opt*/) const
                printf("| (%d,%d) ",timeBin,amp);
        }       
        printf("\n");
-       printf("| L0: %4d / %d Time(s): \n",fL0Trigger,fNL0Times);
+       printf("| L0: (%d,%d) / %d Time(s): \n",GetTriggerBit(kL0,1),GetTriggerBit(kL0,0),fNL0Times);
        for (Int_t i = 0; i < fNL0Times; i++) 
        {
                Int_t time;
                if (GetL0Time(i, time)) printf("| %d ",time);
        }
        printf("\n");
-       printf("| Time sum: %d\n", fL1TimeSum);
+       printf("| L1: g high (%d,%d) g low (%d,%d) j high (%d,%d) j low (%d,%d) / Time sum: %d\n",
+                  GetTriggerBit(kL1GammaHigh,1),GetTriggerBit(kL1GammaHigh,0),GetTriggerBit(kL1GammaLow,1),GetTriggerBit(kL1GammaLow,0),
+                  GetTriggerBit(kL1JetHigh,1),  GetTriggerBit(kL1JetHigh,0),  GetTriggerBit(kL1JetLow,1),  GetTriggerBit(kL1JetLow,0),
+                  fL1TimeSum);
 }