]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALTriggerBoard.cxx
Re-enable trigger calculation removing STU OCDB access. Improve simulation (L0 time...
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTriggerBoard.cxx
index 4841bc250f75909dde0e8cabe95eada5639f415e..f52fa408075926516b9ff20f856f0a8a5c5feda8 100644 (file)
@@ -23,9 +23,9 @@ Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
 
 #include "AliEMCALTriggerBoard.h"
 #include "AliEMCALTriggerPatch.h"
+#include "AliLog.h"
 
 #include <TClonesArray.h>
-
 #include <iostream>
 #include <cstdlib>
 
@@ -40,7 +40,7 @@ fMap(0x0),
 fRegionSize(0x0),
 fSubRegionSize(0x0),
 fPatchSize(0x0),
-fPatches( new TClonesArray("AliEMCALTriggerPatch",10) )
+fPatches(0x0)
 {
        
 }      
@@ -54,6 +54,8 @@ fSubRegionSize( new TVector2() ),
 fPatchSize(     new TVector2() ),
 fPatches( new TClonesArray("AliEMCALTriggerPatch",10) )
 {
+       // Ctor
+       
   fRegion = (int**)malloc( (int)fRegionSize->X() * sizeof( int* ) );  
   
   if (!fRegion) printf("Error: malloc could not allocate %d bytes for fRegion\n",
@@ -91,6 +93,8 @@ fPatches( new TClonesArray("AliEMCALTriggerPatch",10) )
 //_______________
 AliEMCALTriggerBoard::~AliEMCALTriggerBoard()
 {
+       // Dtor
+       
    for (Int_t i=0;i<fRegionSize->X();i++) 
    {
       if (fRegion[i]) {free(fRegion[i]); fRegion[i] = 0;}
@@ -108,14 +112,22 @@ AliEMCALTriggerBoard::~AliEMCALTriggerBoard()
 //_______________
 void AliEMCALTriggerBoard::ZeroRegion()
 {
-       //
-       for (Int_t i=0;i<int(fRegionSize->X());i++) for (Int_t j=0;j<int(fRegionSize->Y());j++) fRegion[i][j] = 0;
+       // Initilize fRegion
+  
+  if(fRegion){
+    for (Int_t i=0;i<int(fRegionSize->X());i++) for (Int_t j=0;j<int(fRegionSize->Y());j++) fRegion[i][j] = 0;
+  }
+  else {
+    AliFatal("fRegion was not previously initialized");
+  }
+
 }
 
 //_______________
-void AliEMCALTriggerBoard::SlidingWindow(TriggerType_t /*type*/, Int_t thres, Int_t time)
+void AliEMCALTriggerBoard::SlidingWindow(TriggerType_t type, Int_t thres, Int_t time)
 {
-       //
+       // Sliding window
+       
        Int_t ipatch = 0;
        
        for (Int_t i=0; i<=int(fRegionSize->X()-fPatchSize->X()*fSubRegionSize->X()); i+=int(fSubRegionSize->X()))
@@ -136,8 +148,6 @@ void AliEMCALTriggerBoard::SlidingWindow(TriggerType_t /*type*/, Int_t thres, In
 
                        if ( sum > thres ) 
                        {
-                               //if ( type == kJet ) sum /= 4; // truncate patch sum for jet case
-                               
                                new((*fPatches)[fPatches->GetLast()+1]) 
                                                AliEMCALTriggerPatch(int(i/fSubRegionSize->X()), int(j/fSubRegionSize->Y()), int(sum), time);
                        }
@@ -148,7 +158,8 @@ void AliEMCALTriggerBoard::SlidingWindow(TriggerType_t /*type*/, Int_t thres, In
 //__________
 void AliEMCALTriggerBoard::Scan()
 {
-       //
+       // Dump
+       
        cout << "     ";
        for (Int_t i=0; i<int(fRegionSize->X()); i++) printf("%8d ",i);
        cout << "\n";