]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changes for #93916 EMCAL commit attached patch and port to the release
authorhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Apr 2012 13:20:19 +0000 (13:20 +0000)
committerhristov <hristov@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 24 Apr 2012 13:20:19 +0000 (13:20 +0000)
35 files changed:
ANALYSIS/AliAnalysisTaskESDfilter.cxx
EMCAL/AliEMCALCalibData.cxx
EMCAL/AliEMCALCalibData.h
EMCAL/AliEMCALDigitizer.cxx
EMCAL/AliEMCALDigitizer.h
EMCAL/AliEMCALGeometry.cxx
EMCAL/AliEMCALPreprocessor.cxx
EMCAL/AliEMCALQADataMakerRec.cxx
EMCAL/AliEMCALReconstructor.cxx
EMCAL/AliEMCALTriggerBoard.cxx
EMCAL/AliEMCALTriggerBoard.h
EMCAL/AliEMCALTriggerData.cxx
EMCAL/AliEMCALTriggerData.h
EMCAL/AliEMCALTriggerElectronics.cxx
EMCAL/AliEMCALTriggerRawDigit.cxx
EMCAL/AliEMCALTriggerRawDigit.h
EMCAL/AliEMCALTriggerRawDigitMaker.cxx
EMCAL/AliEMCALTriggerSTU.cxx
EMCAL/AliEMCALTriggerSTU.h
EMCAL/AliEMCALTriggerSTUDCSConfig.cxx
EMCAL/AliEMCALTriggerSTUDCSConfig.h
EMCAL/AliEMCALTriggerSTURawStream.cxx
EMCAL/AliEMCALTriggerSTURawStream.h
EMCAL/AliEMCALTriggerTRU.cxx
EMCAL/AliEMCALTriggerTRU.h
EMCAL/AliEMCALTriggerTRUDCSConfig.cxx
EMCAL/AliEMCALTriggerTRUDCSConfig.h
EMCAL/AliEMCALTriggerTypes.h
EVE/alice-macros/emcal_digits.C
PWGGA/EMCALTasks/AliAnalysisTaskEMCALTriggerQA.cxx
STEER/AOD/AliAODCaloTrigger.cxx
STEER/AOD/AliAODCaloTrigger.h
STEER/ESD/AliESDCaloTrigger.cxx
STEER/ESD/AliESDCaloTrigger.h
STEER/ESD/AliESDRun.h

index 3681ccf552dbebbd10e6be050bfddc17bc771b60..8fb98dc06be8f163c6d11e5c8cf56bc50d32fa13 100644 (file)
@@ -1548,7 +1548,7 @@ void AliAnalysisTaskESDfilter::ConvertCaloTrigger(TString calo, const AliESDEven
                {\r
                        Int_t *type = esd.GetCaloTriggerType();\r
                                                        \r
-                       for (Int_t i = 0; i < 8; i++) \r
+                       for (Int_t i = 0; i < 15; i++) \r
                        {\r
                                aodTree->GetUserInfo()->Add(new TParameter<int>(Form("EMCALCaloTrigger%d",i), type[i]));\r
                        }\r
@@ -1582,8 +1582,7 @@ void AliAnalysisTaskESDfilter::ConvertCaloTrigger(TString calo, const AliESDEven
                aodTrigger.Add(px, py, a, t, times, nTimes, ts, b);\r
        }\r
                                                        \r
-       aodTrigger.SetL1Threshold(0, esdTrigger.GetL1Threshold(0));\r
-       aodTrigger.SetL1Threshold(1, esdTrigger.GetL1Threshold(1));\r
+       for (int i = 0; i < 4; i++) aodTrigger.SetL1Threshold(i, esdTrigger.GetL1Threshold(i));\r
                                                        \r
        Int_t v0[2] = \r
        {\r
index 36bb21479456769cee7a5123962d23a72cce26e5..9931dd25e368ccd336a047b19ca229801393b23b 100644 (file)
@@ -171,7 +171,9 @@ void AliEMCALCalibData::Reset()
 
       }
     }
-  } 
+  }
+       
+  fADCchannelRef = .0162;      
 }
 
 //________________________________________________________________
index 3de4f72ea991907bf4d9c5fe91e9ef04bce36909..d06fd1f51d9db31f5549ff07a4c5ab5b3fb90a04 100644 (file)
@@ -32,6 +32,8 @@ class AliEMCALCalibData: public TNamed {
   Float_t GetADCpedestal     (Int_t module, Int_t column, Int_t row) const;
   Float_t GetTimeChannel     (Int_t module, Int_t column, Int_t row) const;
   Float_t GetTimeChannelDecal(Int_t module, Int_t column, Int_t row) const;
+       
+  Float_t GetADCchannelRef   () {return fADCchannelRef;}
 
   //
   void SetADCchannel      (Int_t module, Int_t column, Int_t row, Float_t value);
@@ -40,6 +42,8 @@ class AliEMCALCalibData: public TNamed {
   void SetTimeChannel     (Int_t module, Int_t column, Int_t row, Float_t value);
   void SetTimeChannelDecal(Int_t module, Int_t column, Int_t row, Float_t value);
 
+  void SetADCchannelRef   (Float_t value) {fADCchannelRef = value;}
+
   // Fill for (relative) recalibration (undo 1, apply 2)
   void Fill(const AliEMCALCalibData *cd1, const AliEMCALCalibData *cd2, Bool_t print=0);
 
@@ -50,8 +54,10 @@ class AliEMCALCalibData: public TNamed {
   Float_t  fTimeChannel     [AliEMCALGeoParams::fgkEMCALModules][AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows] ; // time width of one ADC channel ([mod][col][row])
   Float_t  fTimeChannelDecal[AliEMCALGeoParams::fgkEMCALModules][AliEMCALGeoParams::fgkEMCALCols][AliEMCALGeoParams::fgkEMCALRows] ; // time width of one ADC channel ([mod][col][row])
 
+  Float_t  fADCchannelRef;
+
   //
-  ClassDef(AliEMCALCalibData,2)    // EMCAL Calibration data
+  ClassDef(AliEMCALCalibData,3)    // EMCAL Calibration data
 };
 
 #endif
index 89d0715368c8d59557b0552b6f4e223ffbc05e64..80b45d8946e1432f011ae9d1c3862e4ac758fc65 100644 (file)
@@ -653,6 +653,35 @@ void AliEMCALDigitizer::DigitizeEnergyTime(Float_t & energy, Float_t & time, con
     energy =  fNADCEC ; 
 }
 
+//_____________________________________________________________________
+void AliEMCALDigitizer::DecalibrateEnergy(Double_t& energy, const Int_t absId)
+{ 
+       // Load Geometry
+       const AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance();
+       
+       if (geom==0){
+               AliFatal("Did not get geometry from EMCALLoader");
+               return;
+       }
+       
+       Int_t iSupMod = -1;
+       Int_t nModule = -1;
+       Int_t nIphi   = -1;
+       Int_t nIeta   = -1;
+       Int_t iphi    = -1;
+       Int_t ieta    = -1;
+       Bool_t bCell = geom->GetCellIndex(absId, iSupMod, nModule, nIphi, nIeta) ;
+       if(!bCell)
+               Error("DigitizeEnergyTime","Wrong cell id number : absId %i ", absId) ;
+       geom->GetCellPhiEtaIndexInSModule(iSupMod,nModule,nIphi, nIeta,iphi,ieta);
+       
+       if(fCalibData) {
+               fADCchannelEC = fCalibData->GetADCchannel(iSupMod,ieta,iphi);
+       }
+
+       energy /= fADCchannelEC/0.0162;
+}
+
 //_____________________________________________________________________
 void AliEMCALDigitizer::CalibrateADCTime(Float_t & adc, Float_t & time, const Int_t absId)
 { 
@@ -825,8 +854,10 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig
       // build FOR from simulated digits
       // and xfer to the corresponding TRU input (mapping)
       
-      TClonesArray* digits = emcalLoader->Digits();
+      TClonesArray* digits = emcalLoader->SDigits();
       
+         AliDebug(999,Form("=== %d SDigits to trigger digits ===",digits->GetEntriesFast()));
+               
       TIter NextDigit(digits);
       while (AliEMCALDigit* digit = (AliEMCALDigit*)NextDigit())
       {
@@ -854,6 +885,11 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig
       
       if (AliDebugLevel()) printf("Number of TRG digits: %d\n",digitsTMP->GetEntriesFast());
       
+         TF1 g4noiseF("g4noise","[0]*exp(-0.5*((x-[1])/[2])**4)",-10,10);
+         g4noiseF.SetParameter( 0,   1 );  //
+         g4noiseF.SetParameter( 1,   0 );  // 
+         g4noiseF.SetParameter( 2,  .2 );  // 
+               
       Int_t    nSamples = 32;
       Int_t *timeSamples = new Int_t[nSamples];
       
@@ -873,6 +909,10 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig
           // FIXME: Check digit time!
           if (depositedEnergy)
           {
+//                     depositedEnergy += depositedEnergy * g4noiseF.GetRandom();
+                         
+                   DecalibrateEnergy(depositedEnergy, id);  
+                         
             DigitalFastOR(time, depositedEnergy, timeSamples, nSamples);
             
             for (Int_t j=0;j<nSamples;j++) 
@@ -881,6 +921,8 @@ void AliEMCALDigitizer::Digits2FastOR(TClonesArray* digitsTMP, TClonesArray* dig
             }
             
             new((*digitsTRG)[digitsTRG->GetEntriesFast()]) AliEMCALRawDigit(id, timeSamples, nSamples);
+                         
+                       if (AliDebugLevel()) ((AliEMCALRawDigit*)digitsTRG->At(digitsTRG->GetEntriesFast() - 1))->Print("");
           }
         }
       }
@@ -899,14 +941,15 @@ void AliEMCALDigitizer::DigitalFastOR( Double_t time, Double_t dE, Int_t timeSam
        // id: 0..95
        const Int_t    reso = 11;      // 11-bit resolution ADC
        const Double_t vFSR = 1;       // Full scale input voltage range
-       const Double_t dNe   = 125;     // signal of the APD per MeV of energy deposit in a tower: 125 photo-e-/MeV @ M=30
+//     const Double_t dNe  = 125;     // signal of the APD per MeV of energy deposit in a tower: 125 photo-e-/MeV @ M=30
+       const Double_t dNe  = 125/1.3; // F-ALTRO max V. FEE: factor 4 
        const Double_t vA   = .136e-6; // CSP output range: 0.136uV/e-
-       const Double_t rise = 40e-9;   // rise time (10-90%) of the FastOR signal before shaping
+       const Double_t rise = 50e-9;   // rise time (10-90%) of the FastOR signal before shaping
        
        const Double_t kTimeBinWidth = 25E-9; // sampling frequency (40MHz)
        
        Double_t vV = 1000. * dE * dNe * vA; // GeV 2 MeV
-       
+               
        TF1 signalF("signal", AnalogFastORFunction, 0, nSamples * kTimeBinWidth, 3);
        signalF.SetParameter( 0,   vV ); 
        signalF.SetParameter( 1, time ); // FIXME: when does the signal arrive? Might account for cable lengths
index 051c2623b049467480720890c322d394aa0d4013..5eecb002a85f3a4b32681c8534b6565a9640c275 100644 (file)
@@ -94,6 +94,7 @@ private:
 
   void     Digits2FastOR(TClonesArray*digitsTMP, TClonesArray* digitsTRG);
   void     DigitalFastOR(Double_t time, Double_t dE, Int_t timeSamples[], Int_t nSamples);     
+  void     DecalibrateEnergy(Double_t & energy, const Int_t absId);
        
 private:
   
index ef474f84ed8ec37c5a00e7a6a2544abb4b66fccf..d750ab21cfcb5e29a7a830cae6882089ce0d9f64 100644 (file)
@@ -1315,7 +1315,7 @@ Bool_t AliEMCALGeometry::GetAbsFastORIndexFromPositionInEMCAL(const Int_t iEta,
 
        if (iEta < 0 || iEta > 47 || iPhi < 0 || iPhi > 63 ) 
        {
-               AliError("Out of range!");
+               AliError(Form("Out of range! eta: %2d phi: %2d", iEta, iPhi));
                return kFALSE;
        }
        
index 1396c43fe077de8502ee6fee329c96404f885115..fdbcc6031abe2a9b2d2e6d9f642ca8395971e72a 100644 (file)
@@ -39,6 +39,7 @@
 #include "AliDCSValue.h"
 #include "AliCDBMetaData.h"
 #include "AliEMCALTriggerTRUDCSConfig.h"
+#include "AliEMCALTriggerSTUDCSConfig.h"
 #include "AliEMCALTriggerDCSConfig.h"
 #include "AliCaloCalibPedestal.h"
 #include "AliCaloCalibSignal.h"
@@ -333,7 +334,10 @@ UInt_t AliEMCALPreprocessor::MapTriggerConfig(TMap* dcsAliasMap)
   AliDCSValue *dcsVal;
   TObjArray *arrL0ALGSEL, *arrPEAKFINDER, *arrGLOBALTHRESH, *arrCOSMTHRESH;
   TObjArray *arrMASK[6];
-
+       
+  TObjArray *arrSTUG[3][2], *arrSTUJ[3][2];
+  TObjArray *arrSTUD, *arrSTUR, *arrSTUF;
+       
   // overall object to hold STU and DCS config info
   // DS comment: for now only holds TRU info, i.e. only partially filled
   // (STU info only in raw data header; unfortunately not also picked up via DCS DPs)
@@ -345,6 +349,8 @@ UInt_t AliEMCALPreprocessor::MapTriggerConfig(TMap* dcsAliasMap)
   }
   trigConfig->SetTRUArr(truArr);
 
+  AliEMCALTriggerSTUDCSConfig *stuConfig = new AliEMCALTriggerSTUDCSConfig();
+       
   // loop through all TRUs
   bool debug = true; // debug flag for AliInfo printouts for each TRU
   for( iTRU = 0; iTRU < kNTRU; iTRU++){
@@ -456,6 +462,94 @@ UInt_t AliEMCALPreprocessor::MapTriggerConfig(TMap* dcsAliasMap)
     
   } // TRUs
   AliInfo(Form("TRU info retrieved.\n"));
+               
+  // STU
+       for (int i = 0; i < 3; i++) {
+               for (int j = 0; j < 2; j++) {
+                       arrSTUG[i][j] = (TObjArray*)dcsAliasMap->GetValue(Form("EMC_STU_G%c%d", i + 65, j));
+                       arrSTUJ[i][j] = (TObjArray*)dcsAliasMap->GetValue(Form("EMC_STU_J%c%d", i + 65, j));    
+                       
+                       if (!arrSTUG[i][j]) {
+                               AliWarning(Form("EMC_STU_G%c%d alias not found!", i + 65, j));
+                       } else {
+                               if (debug) AliInfo( Form("EMC_STU_G%c%d has %d entries", i + 65, j, arrSTUG[i][j]->GetEntries()));
+                               if (arrSTUG[i][j]->GetEntries() > 0) {
+                                       dcsVal = (AliDCSValue*)arrSTUG[i][j]->At(arrSTUG[i][j]->GetEntries() - 1);
+                                       if (dcsVal) {
+                                               stuConfig->SetG(i, j, dcsVal->GetInt());
+                                               if (debug) AliInfo(Form("saving value: %u", dcsVal->GetInt()));
+                                       }
+                               } else
+                                       AliWarning(Form("EMC_STU_G%c%d has no entry!", i + 65, j));
+                       }
+                       
+                       if (!arrSTUJ[i][j]) {
+                               AliWarning(Form("EMC_STU_J%c%d alias not found!", i + 65, j));
+                       } else {
+                               if (debug) AliInfo( Form("EMC_STU_J%c%d has %d entries", i + 65, j, arrSTUJ[i][j]->GetEntries()));
+                               if (arrSTUJ[i][j]->GetEntries() > 0) {
+                                       dcsVal = (AliDCSValue*)arrSTUJ[i][j]->At(arrSTUJ[i][j]->GetEntries() - 1);
+                                       if (dcsVal) {
+                                               stuConfig->SetJ(i, j, dcsVal->GetInt());
+                                               if (debug) AliInfo(Form("saving value: %u", dcsVal->GetInt()));
+                                       }
+                               } else
+                                       AliWarning(Form("EMC_STU_J%c%d has no entry!", i + 65, j));
+                       }
+               }
+       }
+       
+       arrSTUD = (TObjArray*)dcsAliasMap->GetValue("EMC_STU_GETRAW");
+       arrSTUR = (TObjArray*)dcsAliasMap->GetValue("EMC_STU_REGION");  
+       arrSTUF = (TObjArray*)dcsAliasMap->GetValue("EMC_STU_FWVERS");  
+
+       if (!arrSTUD) {
+               AliWarning("EMC_STU_GETRAW alias not found!");
+       } else {
+               if (debug) AliInfo(Form("EMC_STU_GETRAW has %d entries", arrSTUD->GetEntries()));
+               if (arrSTUD->GetEntries() > 0) {
+                       dcsVal = (AliDCSValue*)arrSTUD->At(arrSTUD->GetEntries() - 1);
+                       if (dcsVal) {
+                               stuConfig->SetRawData(dcsVal->GetInt());
+                               if (debug) AliInfo(Form("saving value: %u", dcsVal->GetInt()));
+                       }
+               } else
+                       AliWarning("EMC_STU_GETRAW has no entry!");
+       }
+       
+       if (!arrSTUR) {
+               AliWarning("EMC_STU_REGION");
+       } else {
+               if (debug) AliInfo( Form("EMC_STU_REGION has %d entries", arrSTUR->GetEntries()));
+               if (arrSTUR->GetEntries() > 0) {
+                       dcsVal = (AliDCSValue*)arrSTUR->At(arrSTUR->GetEntries() - 1);
+                       if (dcsVal) {
+                               stuConfig->SetRegion(dcsVal->GetInt());
+                               if (debug) AliInfo(Form("saving value: %u", dcsVal->GetInt()));
+                       }
+               } else
+                       AliWarning("EMC_STU_REGION has no entry!");
+       }
+       
+       if (!arrSTUF) {
+               AliWarning("EMC_STU_FWVERS");
+       } else {
+               if (debug) AliInfo(Form("EMC_STU_FWVERS has %d entries", arrSTUF->GetEntries()));
+               if (arrSTUF->GetEntries() > 0) {
+                       dcsVal = (AliDCSValue*)arrSTUF->At(arrSTUF->GetEntries() - 1);
+                       if (dcsVal) {
+                               stuConfig->SetFw(dcsVal->GetInt());
+                               if (debug) AliInfo(Form("saving value: %u", dcsVal->GetInt()));
+                       }
+               } else
+                       AliWarning("EMC_STU_FWVERS has no entry!");
+       }
+       
+       trigConfig->SetSTUObj(stuConfig);
+       
+       AliInfo(Form("STU info retrieved."));
+
+       
   // save the objects
   AliCDBMetaData metaData;
   metaData.SetBeamPeriod(0);
index 065723515794f6f607a8e4d0b45aebd67a43f7d1..d24f93b12d64f2372e6fb461709ae2894c8abf48 100644 (file)
@@ -1180,9 +1180,9 @@ void AliEMCALQADataMakerRec::MakeRawsSTU(AliRawReader* rawReader)
                        
       //L1 Gamma patches
       Int_t iTRUSTU, x, y;
-      for (Int_t i = 0; i < inSTU->GetNL1GammaPatch(); i++)
+      for (Int_t i = 0; i < inSTU->GetNL1GammaPatch(0); i++)
        {
-         if (inSTU->GetL1GammaPatch(i, iTRUSTU, x, y)) // col (0..23), row (0..3)
+         if (inSTU->GetL1GammaPatch(i, 0, iTRUSTU, x, y)) // col (0..23), row (0..3)
            {
              Int_t iTRU;
              iTRU = fGeom->GetTRUIndexFromSTUIndex(iTRUSTU);
@@ -1213,9 +1213,9 @@ void AliEMCALQADataMakerRec::MakeRawsSTU(AliRawReader* rawReader)
        }
                
       //L1 Jet patches
-      for (Int_t i = 0; i < inSTU->GetNL1JetPatch(); i++)
+      for (Int_t i = 0; i < inSTU->GetNL1JetPatch(0); i++)
        {
-         if (inSTU->GetL1JetPatch(i, x, y)) // col (0,15), row (0,11)
+         if (inSTU->GetL1JetPatch(i, 0, x, y)) // col (0,15), row (0,11)
            {
              
              Int_t etaJ = sizeL1jsubr * (11-y-sizeL1jpatch + 1);
index c5115301ebfb308f81bf0e5ddbd7a8cd8d7e27f9..f81ed5b8998ec454f6e44e80212faee7a37ddca9 100644 (file)
@@ -135,8 +135,8 @@ AliEMCALReconstructor::AliEMCALReconstructor()
   //Init temporary list of digits
   fgDigitsArr     = new TClonesArray("AliEMCALDigit",1000);
   fgClustersArr   = new TObjArray(1000);
-  fgTriggerDigits = new TClonesArray("AliEMCALTriggerRawDigit",1000);  
-
+  fgTriggerDigits = new TClonesArray("AliEMCALTriggerRawDigit", 32 * 96);      
+       
   //Track matching
   fMatches = new TList();
   fMatches->SetOwner(kTRUE);
@@ -362,7 +362,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
       AliWarning("No V0 ESD! Run trigger processor w/ null V0 charges");
     }
   
-  if (fgTriggerDigits) fgTriggerDigits->Clear();
+  if (fgTriggerDigits && fgTriggerDigits->GetEntriesFast()) fgTriggerDigits->Delete();
   
   TBranch *branchtrg = digitsTree->GetBranch("EMTRG");
   
@@ -388,7 +388,8 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
       for (Int_t i = 0; i < fgTriggerDigits->GetEntriesFast(); i++)
        {         
          AliEMCALTriggerRawDigit* rdig = (AliEMCALTriggerRawDigit*)fgTriggerDigits->At(i);
-         
+         if (AliDebugLevel() > 999) rdig->Print("");
+               
          Int_t px, py;
          if (fGeom->GetPositionInEMCALFromAbsFastORIndex(rdig->GetId(), px, py))
            {
@@ -396,14 +397,15 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
              
              rdig->GetMaximum(a, t);
              rdig->GetL0Times(times);
-             
+                       
              trgESD->Add(px, py, a, t, times, rdig->GetNL0Times(), rdig->GetL1TimeSum(), rdig->GetTriggerBits());
            }
        }
       
-      trgESD->SetL1Threshold(0, fTriggerData->GetL1GammaThreshold());
-      
-      trgESD->SetL1Threshold(1, fTriggerData->GetL1JetThreshold()  );
+               for (int i = 0; i < 2; i++) {
+                       trgESD->SetL1Threshold(2 * i    , fTriggerData->GetL1JetThreshold(  i));
+                       trgESD->SetL1Threshold(2 * i + 1, fTriggerData->GetL1GammaThreshold(i));
+               }
       
       Int_t v0[2];
       fTriggerData->GetL1V0(v0);
@@ -413,7 +415,7 @@ void AliEMCALReconstructor::FillESD(TTree* digitsTree, TTree* clustersTree,
       
       if (!saveOnce && fTriggerData->GetL1DataDecoded()) 
        {
-         int type[8] = {0};
+         int type[15] = {0};
          fTriggerData->GetL1TriggerType(type);
          
          esd->SetCaloTriggerType(type);
index 3821eba031db46aec836ca89fd7bd279b253ca25..5da2bce3a3a06fcfaaad3897b2cd0d2191eacaaf 100644 (file)
@@ -124,32 +124,24 @@ void AliEMCALTriggerBoard::ZeroRegion()
 }
 
 //_______________
-void AliEMCALTriggerBoard::SlidingWindow(TriggerType_t /*type*/, Int_t thres, Int_t time)
+void AliEMCALTriggerBoard::SlidingWindow(Int_t thres)
 {
-       // Sliding window
-       
-       Int_t ipatch = 0;
-       
-       for (Int_t i=0; i<=int(fRegionSize->X()-fPatchSize->X()*fSubRegionSize->X()); i+=int(fSubRegionSize->X()))
-       {
-               for (Int_t j=0; j<=int(fRegionSize->Y()-fPatchSize->Y()*fSubRegionSize->Y()); j+=int(fSubRegionSize->Y()))
-               {
-                       ipatch++;
+       // Sliding window       
+       for (int i = 0; i <= int(fRegionSize->X() - fPatchSize->X() * fSubRegionSize->X()); i += int(fSubRegionSize->X())) {
+               for (int j = 0; j <= int(fRegionSize->Y() - fPatchSize->Y() * fSubRegionSize->Y()); j += int(fSubRegionSize->Y())) {
+                       //
+                       int sum = 0;
                        
-                       Int_t sum = 0;
-                       
-                       for (Int_t k=0; k<int(fPatchSize->X()*fSubRegionSize->X()); k++)
-                       {
-                               for (Int_t l=0; l<int(fPatchSize->Y()*fSubRegionSize->Y()); l++)
-                               {
-                                       sum += fRegion[i+k][j+l];
+                       for (int k = 0; k < int(fPatchSize->X() * fSubRegionSize->X()); k++) {
+                               for (int l = 0; l < int(fPatchSize->Y() * fSubRegionSize->Y()); l++) {
+                                       //
+                                       sum += fRegion[i + k][j + l];
                                }
                        }
-
-                       if ( sum > thres ) 
-                       {
-                               new((*fPatches)[fPatches->GetLast()+1]) 
-                                               AliEMCALTriggerPatch(int(i/fSubRegionSize->X()), int(j/fSubRegionSize->Y()), int(sum), time);
+                       
+                       if (sum > thres) {
+                               AliDebug(999, Form("Adding new patch at (%2d,%2d)", i, j));
+                               new((*fPatches)[fPatches->GetEntriesFast()]) AliEMCALTriggerPatch(i, j, sum);
                        }
                }
        }
index 3d93c88bc836dcfabcaecd9570f50867415aa88c..b1212071e1cf218fdfca52c8faa86e637d7617fb 100644 (file)
@@ -9,7 +9,6 @@ run the sliding window algorithm
 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
 */
 
-#include "AliEMCALTriggerTypes.h"
 #include "TVector2.h"
 
 class TClonesArray;
@@ -22,7 +21,7 @@ public:
                 AliEMCALTriggerBoard(const TVector2& RegionSize);
        virtual ~AliEMCALTriggerBoard();
        
-       virtual void SlidingWindow(TriggerType_t type, Int_t Threshold, Int_t time = -1);
+       virtual void SlidingWindow(Int_t Threshold);
 
        virtual void ZeroRegion();
        
index 3c834875af7f1939793d2eea99b3cdd079291117..8cc2090ff7ff172c589751f146d71d925dcc2bc3 100644 (file)
@@ -32,13 +32,8 @@ ClassImp(AliEMCALTriggerData)
 //_____________
 AliEMCALTriggerData::AliEMCALTriggerData() : TObject(),
 fMode(0),
-fL0Patches(),
-fL0Region(),
-fL1GammaPatches(),
-fL1JetPatches(),
-fL1Region(),
-fL1GammaThreshold(0),
-fL1JetThreshold(0),
+fL1GammaThreshold(),
+fL1JetThreshold(),
 fL1V0(),
 fL1FrameMask(0),
 fL1TriggerType(),
@@ -46,217 +41,28 @@ fL1DataDecoded(0),
 fL1RawData(0)
 {  
        // Ctor
-       
-       for (Int_t i = 0; i < 2; i++)
-       {
-                      fL0Patches[i] = new TClonesArray("AliEMCALTriggerPatch");
-                 fL1GammaPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
-                   fL1JetPatches[i] = new TClonesArray("AliEMCALTriggerPatch");
-       }
-       
-       for (Int_t i = 0; i < 32; i++) for (Int_t j = 0; j < 24; j++) for (Int_t k = 0; k <  4; k++) fL0Region[i][j][k] = 0;
-       for (Int_t i = 0; i <  2; i++) for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = 0;
+               
+       fL1GammaThreshold[0] = fL1GammaThreshold[1] = 0;
+       fL1JetThreshold[0] = fL1JetThreshold[1] = 0;
        
        fL1V0[0] = fL1V0[1] = 0;
-       for (Int_t i = 0; i < 8; i++) fL1TriggerType[i] = 0;    
+       for (Int_t i = 0; i < 16; i++) fL1TriggerType[i] = 0;   
 }
 
 //_____________
 AliEMCALTriggerData::~AliEMCALTriggerData()
 {
-       // Dtor
-       
-       for (Int_t i = 0; i < 2; i++)
-       {
-               if (     fL0Patches[i])      fL0Patches[i]->Delete();
-               if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
-               if (  fL1JetPatches[i])   fL1JetPatches[i]->Delete();
-       }
-}
-
-//_____________
-void AliEMCALTriggerData::SetL0Region(Int_t i, const Int_t**& region)
-{
-       // L0 region
-       
-       if (i < 0 || i > 31) 
-       {
-               AliError("Bad index!");
-               return;
-       }
-       
-       for (Int_t j=0;j<24;j++)
-               for (Int_t k=0;k<4;k++) fL0Region[i][j][k] = region[j][k];
-}
-
-//_____________
-void AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i, TClonesArray& patches) const
-{
-       // List of patches
-       
-       if (i < 0 || i > 1) 
-       {
-               AliError("Bad index!");
-               return;
-       }
-       
-       switch (type)
-       {
-               case kL0:
-                       patches =  *fL0Patches[i];
-                       break;
-               case kL1Gamma:
-                       patches =  *fL1GammaPatches[i];
-                       break;
-               case kL1Jet:
-                       patches =  *fL1JetPatches[i];
-                       break;
-               default:
-                       AliError("Unknown trigger type!");
-                       break;
-       }
-}
-
-//_____________
-TClonesArray* AliEMCALTriggerData::GetPatches(TriggerType_t type, Int_t i) const
-{
-       // List of patches
-       
-       if (i < 0 || i > 1) 
-       {
-               AliError("Bad index!");
-               return 0x0;
-       }
-       
-       switch (type)
-       {
-               case kL0:
-                       return fL0Patches[i];
-                       break;
-               case kL1Gamma:
-                       return fL1GammaPatches[i];
-                       break;
-               case kL1Jet:
-                       return fL1JetPatches[i];
-                       break;
-               default:
-                       AliError("Unknown trigger type!");
-                       break;
-       }
-
-       return 0x0;
-}
-
-//_____________
-void AliEMCALTriggerData::SetPatches(TriggerType_t type, Int_t i, const TClonesArray& patches)
-{
-       // Set list of patches
-       
-       if (i < 0 || i > 1) 
-       {
-               AliError("Bad index!");
-               return;
-       }
-       
-       if (patches.GetEntriesFast())
-       {
-               TClonesArray* arr = 0x0;
-               
-               switch (type)
-               {
-                       case kL0:
-                               arr = fL0Patches[i];
-                               break;
-                       case kL1Gamma:
-                               arr = fL1GammaPatches[i];
-                               break;
-                       case kL1Jet:
-                               arr = fL1JetPatches[i];
-                               break;
-                       default:
-                               AliError("Unknown trigger type!");
-                               return;
-               }
-               
-               if (arr)
-               {
-                       Int_t size = arr->GetSize() + patches.GetSize();
-               
-                       arr->Expand(size);
-               
-                       for (Int_t k = 0; k < patches.GetEntriesFast(); k++)
-                       {
-                               AliEMCALTriggerPatch* p = static_cast<AliEMCALTriggerPatch*>(patches.At(k));
-                               new((*arr)[arr->GetEntriesFast()]) AliEMCALTriggerPatch(*p);
-                       }
-               }
-               else
-               {
-                       AliError("TClonesArray is NULL!");
-               }
-       }
-}
-
-//_____________
-void AliEMCALTriggerData::SetL1Region(Int_t i, Int_t**& region)
-{
-       // Set L1 region
-       
-       if (i < 0 || i > 1) 
-       {
-               AliError("Bad index!");
-               return;
-       }
-               
-       for (Int_t j = 0; j < 48; j++)
-               for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = region[j][k];
+       // Dtor 
 }
 
-//_____________
-void AliEMCALTriggerData::GetL1Region(Int_t i, Int_t arr[][64]) const 
-{ 
-       // Get L1 region
-       
-       if (i < 0 || i > 1) 
-       {
-               AliError("Bad index!");
-               return;
-       }
-       
-       for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) { arr[j][k] = fL1Region[i][j][k]; } 
-}
-
-
 //_____________
 void AliEMCALTriggerData::Scan() const
 {
        // Dump
-       
-       TIterator* nP;
 
-       printf("L0:\n");
-       printf("\tFound (%2d,%2d) patches\n", fL0Patches[1]->GetEntriesFast(), fL0Patches[0]->GetEntriesFast());
-       printf("\tRAW:\n");
-       nP = fL0Patches[1]->MakeIterator();
-       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
-       printf("\tREC:\n");
-       nP = fL0Patches[0]->MakeIterator();
-       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
-       printf("L1:\n");
-       printf("\tFound (%4d,%4d) gamma patches\n",fL1GammaPatches[1]->GetEntriesFast(), fL1GammaPatches[0]->GetEntriesFast());
-       printf("\tRAW:\n");
-       nP = fL1GammaPatches[1]->MakeIterator();
-       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
-       printf("\tREC:\n");
-       nP = fL1GammaPatches[0]->MakeIterator();
-       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
-       printf("\tFound (%4d,%4d) jet patches\n",fL1JetPatches[1]->GetEntriesFast(), fL1JetPatches[0]->GetEntriesFast());
-       printf("\tRAW:\n");
-       nP = fL1JetPatches[1]->MakeIterator();
-       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
-       printf("\tREC:\n");
-       nP = fL1JetPatches[0]->MakeIterator();
-       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) {printf("\t"); p->Print("");}
+       for (int i = 0; i < 2; i++){
+               printf("\tL1 thresholds[%d]: gamma %d\tjet %d\n", i, fL1GammaThreshold[i], fL1JetThreshold[i]);
+       }
 }
 
 //_____________
@@ -264,15 +70,6 @@ void AliEMCALTriggerData::Reset()
 {
        // Reset
        
-       for (Int_t i = 0; i < 2; i++)
-       {
-               if (     fL0Patches[i])      fL0Patches[i]->Delete();
-               if (fL1GammaPatches[i]) fL1GammaPatches[i]->Delete();
-               if (  fL1JetPatches[i])   fL1JetPatches[i]->Delete();   
-       }
-               
-       for (Int_t i = 0; i < 2; i++) for (Int_t j = 0; j < 48; j++) for (Int_t k = 0; k < 64; k++) fL1Region[i][j][k] = 0;
-       
        fL1DataDecoded = 0;
 }
 
index 76bbef651f242b843de0a06e9345e5af480047be..ccdf3f32c8a68ec3578fcfc120cccc00675e16a9 100644 (file)
@@ -25,16 +25,12 @@ public:
        virtual void SetMode(Int_t i) {fMode = i;}
        
        virtual void SetL0Trigger(      Int_t i, Int_t j, Int_t k) { fL0Trigger[i][j] = k; }
-       virtual void SetL0Region(       Int_t i, const Int_t**& region);
-       virtual void SetL1Region(       Int_t i,       Int_t**& region);
        
-       virtual void SetPatches(TriggerType_t type, Int_t i, const TClonesArray& patches);
-       
-       virtual void SetL1GammaThreshold(Int_t  v) {fL1GammaThreshold = v;}
-       virtual void SetL1JetThreshold(  Int_t  v) {  fL1JetThreshold = v;}
+       virtual void SetL1GammaThreshold(int i, int  v) {fL1GammaThreshold[i] = v;}
+       virtual void SetL1JetThreshold(  int i, int  v) {  fL1JetThreshold[i] = v;}
        virtual void SetL1V0(            Int_t* v) {for (int i = 0; i < 2; i++) fL1V0[i] = v[i];}
        virtual void SetL1FrameMask(     Int_t  v) {     fL1FrameMask = v;}            
-       virtual void SetL1TriggerType(   Int_t* v) {for (int i = 0; i < 8; i++) fL1TriggerType[i] = v[i];}
+       virtual void SetL1TriggerType(   Int_t* v) {for (int i = 0; i < 15; i++) fL1TriggerType[i] = v[i];}
 
        virtual void SetL1DataDecoded(   Int_t  v) {   fL1DataDecoded = v;} 
        virtual void SetL1RawData(       Int_t  v) {       fL1RawData = v;}
@@ -42,16 +38,11 @@ public:
        virtual void          GetL0Trigger(  Int_t i, Int_t j, Int_t& k  ) const {   k = fL0Trigger[i][j];}
        virtual Int_t         GetL0Trigger(  Int_t i, Int_t j            ) const {return fL0Trigger[i][j];}
        
-       virtual void          GetPatches(TriggerType_t type, Int_t i, TClonesArray& patches) const;
-       virtual TClonesArray* GetPatches(TriggerType_t type, Int_t i                       ) const;
-
-       virtual void          GetL1Region( Int_t i, Int_t arr[][64]             ) const;
-       
-       virtual Int_t         GetL1GammaThreshold()           const {return fL1GammaThreshold;}
-       virtual Int_t         GetL1JetThreshold()             const {return   fL1JetThreshold;}
+       virtual Int_t         GetL1GammaThreshold(int i)           const {return fL1GammaThreshold[i];}
+       virtual Int_t         GetL1JetThreshold(  int i)           const {return   fL1JetThreshold[i];}
        virtual void          GetL1V0(            Int_t  v[]) const {for (int i = 0; i < 2; i++) v[i] = fL1V0[i];}
        virtual Int_t         GetL1FrameMask(               ) const {return fL1FrameMask;}            
-       virtual void          GetL1TriggerType(   Int_t  v[]) const {for (int i = 0; i < 8; i++) v[i] = fL1TriggerType[i];}
+       virtual void          GetL1TriggerType(   Int_t  v[]) const {for (int i = 0; i < 15; i++) v[i] = fL1TriggerType[i];}
        
        virtual Int_t         GetL1DataDecoded(             ) const {return fL1DataDecoded;}
        virtual Int_t             GetL1RawData(             ) const {return     fL1RawData;}
@@ -69,22 +60,13 @@ private:
        Int_t                      fMode;           // Simulation/Raw
        
        Int_t               fL0Trigger[2][32];      // Triggering TRU
-       
-       TClonesArray*       fL0Patches[2];          // array of patches  
-       
-       Int_t               fL0Region[32][24][4];   // from F-ALTRO data only
-       
-       TClonesArray*  fL1GammaPatches[2];          // array of patches  
-       TClonesArray*    fL1JetPatches[2];          // array of patches
-       
-       Int_t                fL1Region[2][48][64];  // STU FastOR
 
-       Int_t        fL1GammaThreshold;             // L1-g threshold
-       Int_t          fL1JetThreshold;             // L1-j threshold
+       Int_t        fL1GammaThreshold[2];          // L1-g threshold
+       Int_t          fL1JetThreshold[2];          // L1-j threshold
        
        Int_t                    fL1V0[2];          // V0 charges
        Int_t             fL1FrameMask;             // Frame mask
-       Int_t           fL1TriggerType[8];          // Trigger type
+       Int_t           fL1TriggerType[15];         // Trigger type
        
        Int_t           fL1DataDecoded;             // Raw data decoded
        Int_t               fL1RawData;             // Raw data
index fa0183247e623f14f041d070d1168a00287ecbee..790ad1318aaec3eeaa778c60960623dd85d8153c 100644 (file)
@@ -42,7 +42,7 @@ Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
 
 namespace
 {
-       const Int_t kNTRU = 30;
+       const Int_t kNTRU = 32;
 }
 
 ClassImp(AliEMCALTriggerElectronics)
@@ -131,7 +131,14 @@ void AliEMCALTriggerElectronics::Digits2Trigger(TClonesArray* digits, const Int_
                        Int_t time, amp;
                        Bool_t isOK2 = digit->GetTimeSample(j, time, amp);
                        
-                       if (isOK1 && isOK2 && amp) (static_cast<AliEMCALTriggerTRU*>(fTRU->At(iTRU)))->SetADC(iADC, time, amp);
+                       if (isOK1 && isOK2 && amp) {
+                               AliDebug(999, Form("=== TRU# %2d ADC# %2d time# %2d signal %d ===", iTRU, iADC, time, amp));
+                               
+                               if (data->GetMode())
+                                       (static_cast<AliEMCALTriggerTRU*>(fTRU->At(iTRU)))->SetADC(iADC, time, 4 * amp);
+                               else
+                                       (static_cast<AliEMCALTriggerTRU*>(fTRU->At(iTRU)))->SetADC(iADC, time,     amp);
+                       }
                }
                
                if (geom->GetPositionInEMCALFromAbsFastORIndex(id, px, py)) posMap[px][py] = i;
@@ -143,7 +150,7 @@ void AliEMCALTriggerElectronics::Digits2Trigger(TClonesArray* digits, const Int_
        
        for (Int_t i=0; i<kNTRU; i++) 
        {
-               AliDebug(999, Form("===========< TRU %2d >============\n", i));
+               AliDebug(999, Form("===========< TRU %2d >============", i));
                
                AliEMCALTriggerTRU* iTRU = static_cast<AliEMCALTriggerTRU*>(fTRU->At(i));
                
@@ -163,7 +170,7 @@ void AliEMCALTriggerElectronics::Digits2Trigger(TClonesArray* digits, const Int_
                        data->SetL0Trigger(0, i, 0);
        }
 
-       AliDebug(999, Form("=== %2d TRU (out of %2d) has issued a L0 / Min L0 time: %d\n", iL0, kNTRU, timeL0min));
+       AliDebug(999, Form("=== %2d TRU (out of %2d) has issued a L0 / Min L0 time: %d", iL0, kNTRU, timeL0min));
        
        AliEMCALTriggerRawDigit* dig = 0x0;
        
@@ -184,25 +191,30 @@ void AliEMCALTriggerElectronics::Digits2Trigger(TClonesArray* digits, const Int_
                                for (int k = 0; k < iTRU->RegionSize()->Y(); k++)
                                {
                                        if (reg[j][k]
-                                                       && 
-                                                       geom->GetAbsFastORIndexFromPositionInTRU(i, j, k, id)
-                                                       &&
-                                                       geom->GetPositionInEMCALFromAbsFastORIndex(id, px, py))
+                                               && 
+                                               geom->GetAbsFastORIndexFromPositionInTRU(i, j, k, id)
+                                               &&
+                                               geom->GetPositionInEMCALFromAbsFastORIndex(id, px, py))
                                        {
                                                pos = posMap[px][py];
                                                                        
                                                if (pos == -1)
                                                {
                                                        // Add a new digit
+                                                       posMap[px][py] = digits->GetEntriesFast();
+
                                                        new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
                                                                                
-                                                       dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+                                                       dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);                                                       
                                                }
                                                else
                                                {
                                                        dig = (AliEMCALTriggerRawDigit*)digits->At(pos);
                                                }
                                                
+                                               // 14b to 12b STU time sums
+                                               reg[j][k] >>= 2; 
+                                               
                                                dig->SetL1TimeSum(reg[j][k]);
                                        }
                                }
@@ -212,23 +224,26 @@ void AliEMCALTriggerElectronics::Digits2Trigger(TClonesArray* digits, const Int_
 
        if (iL0 && !data->GetMode())
        {
-                       // transform local to global 
-               
                for (Int_t i = 0; i < kNTRU; i++)
                {
                        AliEMCALTriggerTRU* iTRU = static_cast<AliEMCALTriggerTRU*>(fTRU->At(i));
                        
+                       AliDebug(999, Form("=== TRU# %2d found %d patches", i, (iTRU->Patches()).GetEntriesFast()));
+                       
                        TIter next(&iTRU->Patches());
                        while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)next())
                        {
                                p->Position(px, py);
                        
-                       // Local 2 Global       
-                               if (geom->GetAbsFastORIndexFromPositionInTRU(i, px, py, id) && 
-                                                               geom->GetPositionInEMCALFromAbsFastORIndex(id, px, py)) p->SetPosition(px, py);
+                               // Local 2 Global
+                               if (geom->GetAbsFastORIndexFromPositionInTRU(i, px, py, id) 
+                                       && 
+                                       geom->GetPositionInEMCALFromAbsFastORIndex(id, px, py)) p->SetPosition(px, py);
                                
-                               Int_t peaks = p->Peaks();
+                               if (AliDebugLevel()) p->Print("");
                                
+                               Int_t peaks = p->Peaks();
+                                                               
                                Int_t sizeX = (Int_t) ((iTRU->PatchSize())->X() * (iTRU->SubRegionSize())->X());
                                Int_t sizeY = (Int_t) ((iTRU->PatchSize())->Y() * (iTRU->SubRegionSize())->Y());
                                        
@@ -238,30 +253,31 @@ void AliEMCALTriggerElectronics::Digits2Trigger(TClonesArray* digits, const Int_
                                        {
                                                pos = posMap[px + j % sizeX][py + j / sizeX];
                                                        
-                                               if (pos == -1)
-                                               {
-                                                               // Add a new digit
+                                               if (pos == -1) {
+                                                       // Add a new digit
+                                                       posMap[px + j % sizeX][py + j / sizeX] = digits->GetEntriesFast();
+
                                                        new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
                                                                
-                                                       dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
-                                               }
-                                               else
-                                               {
+                                                       dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);                                                       
+                                               } else {
                                                        dig = (AliEMCALTriggerRawDigit*)digits->At(pos);
                                                }
                                                        
-                                               dig->SetL0Time(timeL0min);
+                                               dig->SetL0Time(p->Time());
                                        }
                                }
                                        
                                pos = posMap[px][py];
                                        
-                               if (pos == -1)
-                               {
-                                               // Add a new digit
+                               if (pos == -1) {
+                                       // Add a new digit
+                                       posMap[px][py] = digits->GetEntriesFast();
+
                                        new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
                                                
                                        dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+                                       
                                }
                                else
                                {
@@ -273,17 +289,14 @@ void AliEMCALTriggerElectronics::Digits2Trigger(TClonesArray* digits, const Int_
                }
        }
        
-       //
        // Prepare STU for L1 calculation
-       
-       for (int i = 0; i < (fSTU->RegionSize())->X(); i++)
-       {
-               for (int j = 0; j < (fSTU->RegionSize())->Y(); j++)
-               {
+       for (int i = 0; i < (fSTU->RegionSize())->X(); i++) {
+               for (int j = 0; j < (fSTU->RegionSize())->Y(); j++) {
+                       
                        pos = posMap[i][j];
                
-                       if (pos >= 0) 
-                       {
+                       if (pos >= 0) {
+                               
                                AliEMCALTriggerRawDigit *digit = (AliEMCALTriggerRawDigit*)digits->At(pos);
                
                                if (digit->GetL1TimeSum() > -1) region[i][j] = digit->GetL1TimeSum();
@@ -291,82 +304,111 @@ void AliEMCALTriggerElectronics::Digits2Trigger(TClonesArray* digits, const Int_
                }
        }
        
+       AliDebug(999,"==================== STU  ====================");
+       if (AliDebugLevel() >= 999) fSTU->Scan();
+       AliDebug(999,"==============================================");
+       
        fSTU->SetRegion(region);
        
        if (data->GetMode()) 
        {
-               fSTU->SetThreshold(kL1Gamma, data->GetL1GammaThreshold());
-               fSTU->SetThreshold(kL1Jet,   data->GetL1JetThreshold()  );
+               for (int ithr = 0; ithr < 2; ithr++) {
+                       AliDebug(999, Form(" THR %d / EGA %d / EJE %d", ithr, data->GetL1GammaThreshold(ithr), data->GetL1JetThreshold(ithr)));
+                                                          
+                       fSTU->SetThreshold(kL1GammaHigh + ithr, data->GetL1GammaThreshold(ithr));
+                       fSTU->SetThreshold(kL1JetHigh + ithr, data->GetL1JetThreshold(  ithr));
+               }
        }
        else
        {
-               fSTU->ComputeThFromV0(kL1Gamma, V0M); 
-               data->SetL1GammaThreshold( fSTU->GetThreshold(kL1Gamma));
-               fSTU->ComputeThFromV0(kL1Jet,   V0M);
-               data->SetL1JetThreshold(   fSTU->GetThreshold(kL1Jet)  );
+               for (int ithr = 0; ithr < 2; ithr++) {
+                       //
+                       fSTU->ComputeThFromV0(kL1GammaHigh + ithr, V0M); 
+                       data->SetL1GammaThreshold(ithr, fSTU->GetThreshold(kL1GammaHigh + ithr));
+                       
+                       fSTU->ComputeThFromV0(kL1JetHigh + ithr,   V0M);
+                       data->SetL1JetThreshold(ithr, fSTU->GetThreshold(kL1JetHigh + ithr)  );
+                       
+                       AliDebug(999, Form("STU THR %d EGA %d EJE %d", ithr, fSTU->GetThreshold(kL1GammaHigh + ithr), fSTU->GetThreshold(kL1JetHigh + ithr)));
+               }
        }
 
-       fSTU->L1(kL1Gamma);
+       for (int ithr = 0; ithr < 2; ithr++) {
+               //
+               fSTU->Reset();
                
-       TIterator* nP = 0x0;
+               fSTU->L1(kL1GammaHigh + ithr);
                
-       nP = (fSTU->Patches()).MakeIterator();
-       
-       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) 
-       {                       
-               p->Position(px, py);
+               TIterator* nP = 0x0;
+               
+               nP = (fSTU->Patches()).MakeIterator();
+               
+               AliDebug(999, Form("=== STU found %d gamma patches", (fSTU->Patches()).GetEntriesFast()));
+               
+               while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) 
+               {                       
+                       p->Position(px, py);
                        
-               if (geom->GetAbsFastORIndexFromPositionInEMCAL(px, py, id))
-               {
-                       if (posMap[px][py] == -1)
+                       if (AliDebugLevel()) p->Print("");
+                       
+                       if (geom->GetAbsFastORIndexFromPositionInEMCAL(px, py, id))
                        {
+                               if (posMap[px][py] == -1)
+                               {
+                                       posMap[px][py] = digits->GetEntriesFast();
+                                       
                                        // Add a new digit
-                               new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
+                                       new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
                                        
-                               dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
-                       } 
-                       else
-                       {
-                               dig = (AliEMCALTriggerRawDigit*)digits->At(posMap[px][py]);                                                             
-                       }
+                                       dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+                               } 
+                               else
+                               {
+                                       dig = (AliEMCALTriggerRawDigit*)digits->At(posMap[px][py]);                                                             
+                               }
+                               
+                               if (AliDebugLevel()) dig->Print("");
                                
-                       dig->SetTriggerBit(kL1Gamma,0);
+                               dig->SetTriggerBit(kL1GammaHigh + ithr, 0);
+                       }
                }
-       }
-
-       fSTU->Reset();
-
-       fSTU->L1(kL1Jet);
                
-       nP = (fSTU->Patches()).MakeIterator();
+               fSTU->Reset();
+               
+               fSTU->L1(kL1JetHigh + ithr);
+               
+               nP = (fSTU->Patches()).MakeIterator();
+               
+               AliDebug(999, Form("=== STU found %d jet patches", (fSTU->Patches()).GetEntriesFast()));
+               
+               while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) 
+               {                       
+                       p->Position(px, py);
                        
-       while (AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)nP->Next()) 
-       {                       
-               p->Position(px, py);
-
-               px *= (Int_t)((fSTU->SubRegionSize())->X());
-
-               py *= (Int_t)((fSTU->SubRegionSize())->Y());
+                       if (AliDebugLevel()) p->Print("");
                        
-               if (geom->GetAbsFastORIndexFromPositionInEMCAL(px, py, id))
-               {
-                       if (posMap[px][py] == -1)
+                       if (geom->GetAbsFastORIndexFromPositionInEMCAL(px, py, id))
                        {
+                               if (posMap[px][py] == -1)
+                               {
+                                       posMap[px][py] = digits->GetEntriesFast();
+                                       
                                        // Add a new digit
-                               new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
+                                       new((*digits)[digits->GetEntriesFast()]) AliEMCALTriggerRawDigit(id, 0x0, 0);
                                        
-                               dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
-                       } 
-                       else
-                       {
-                               dig = (AliEMCALTriggerRawDigit*)digits->At(posMap[px][py]);
-                       }
+                                       dig = (AliEMCALTriggerRawDigit*)digits->At(digits->GetEntriesFast() - 1);
+                               } 
+                               else
+                               {
+                                       dig = (AliEMCALTriggerRawDigit*)digits->At(posMap[px][py]);
+                               }
+                               
+                               if (AliDebugLevel()) dig->Print("");
                                
-                       dig->SetTriggerBit(kL1Jet, 0);
+                               dig->SetTriggerBit(kL1JetHigh + ithr, 0);
+                       }
                }
        }
-
-       if (AliDebugLevel() >= 999) data->Scan();
        
        // Now reset the electronics for a fresh start with next event
        Reset();
index ccaf833fd2a032f6b5142c29d2d9a9506a9a1d9a..3d0278b34a3b5eed2d1a370e8e6ea2f5bb3c4497 100644 (file)
@@ -161,7 +161,9 @@ void AliEMCALTriggerRawDigit::Print(const Option_t* /*opt*/) const
                if (GetL0Time(i, time)) printf("| %d ",time);
        }
        printf("\n");
-       printf("| L1: g (%d,%d) j (%d,%d) / Time sum: %d\n",
-                  GetTriggerBit(kL1Gamma,1),GetTriggerBit(kL1Gamma,0),GetTriggerBit(kL1Jet,1),GetTriggerBit(kL1Jet,0),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);
 }
 
index 494dab925f009be513a2e2865e735a98377f3093..68d9569d1b1573b78c1b9c5febc2ffb9d27a5653 100644 (file)
@@ -22,7 +22,7 @@ public:
        
        virtual ~AliEMCALTriggerRawDigit();
        
-       void    SetTriggerBit(const TriggerType_t type, const Int_t mode) {fTriggerBits = (fTriggerBits | (1 << (type + kTriggerTypeEnd * mode)));}
+       void    SetTriggerBit(const int type, const Int_t mode) {fTriggerBits = (fTriggerBits | (1 << (type + kTriggerTypeEnd * mode)));}
        
        Bool_t  SetL0Time(   Int_t i);
        
index 0dee4f20fa348d62205b7555a7e263d27337b8dc..f828df0b9c8ccef882f92cccc7a0164413cff3b5 100644 (file)
@@ -319,32 +319,48 @@ void AliEMCALTriggerRawDigitMaker::PostProcess()
        {
                fTriggerData->SetL1DataDecoded(1);
                
-               fTriggerData->SetL1GammaThreshold(fSTURawStream->GetL1GammaThreshold());
-               fTriggerData->SetL1JetThreshold(  fSTURawStream->GetL1JetThreshold()  );
+               for (int i = 0; i < 2; i++) {
+                       fTriggerData->SetL1GammaThreshold(i, fSTURawStream->GetL1GammaThreshold(i));
+                       fTriggerData->SetL1JetThreshold(  i, fSTURawStream->GetL1JetThreshold(i)  );
+               }
                
                Int_t v0[2] = {fSTURawStream->GetV0A(), fSTURawStream->GetV0C()};
                
-               Int_t type[8] = 
+               Int_t type[15] = 
                {
-                       fSTURawStream->GetGA(),
-                       fSTURawStream->GetGB(),
-                       fSTURawStream->GetGC(),
-                       fSTURawStream->GetJA(),
-                       fSTURawStream->GetJB(),
-                       fSTURawStream->GetJC(),
+                       fSTURawStream->GetG(0, 0),
+                       fSTURawStream->GetG(1, 0),
+                       fSTURawStream->GetG(2, 0),
+                       fSTURawStream->GetJ(0, 0),
+                       fSTURawStream->GetJ(1, 0),
+                       fSTURawStream->GetJ(2, 0),
+                       fSTURawStream->GetG(0, 1),
+                       fSTURawStream->GetG(1, 1),
+                       fSTURawStream->GetG(2, 1),
+                       fSTURawStream->GetJ(0, 1),
+                       fSTURawStream->GetJ(1, 1),
+                       fSTURawStream->GetJ(2, 1),
+                       fSTURawStream->GetRawData(), 
                        fSTURawStream->GetRegionEnable(), 
                        fSTURawStream->GetFwVersion()
                };              
 
                // Modify DCS config from STU payload content
-               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetGA(type[0]);
-               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetGB(type[1]);
-               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetGC(type[2]);
-               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJA(type[3]);
-               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJB(type[4]);
-               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJC(type[5]);
-               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetFw(type[7]);
-               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetRawData(fSTURawStream->GetRawData());
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(0, 0, type[0]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(1, 0, type[1]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(2, 0, type[2]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(0, 0, type[3]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(1, 0, type[4]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(2, 0, type[5]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(0, 1, type[6]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(1, 1, type[7]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetG(2, 1, type[8]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(0, 1, type[9]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(1, 1, type[10]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetJ(2, 1, type[11]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetRawData(type[12]);             
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetRegion(type[13]);
+               fDCSConfig->GetTriggerDCSConfig()->GetSTUDCSConfig()->SetFw(type[14]);
                
                fTriggerData->SetL1FrameMask(fSTURawStream->GetFrameReceived());
                fTriggerData->SetL1V0(v0);
@@ -368,7 +384,9 @@ void AliEMCALTriggerRawDigitMaker::PostProcess()
 
                                for (Int_t j = 0; j < 96; j++)
                                {
-                                       if (AliDebugLevel()) printf("| STU => TRU# %2d raw data: ADC# %2d: %d\n", iTRU, j, adc[j]);
+                                       if (adc[j] <= 0) continue;
+                                       
+                                       AliDebug(10,Form("| STU => TRU# %2d raw data: ADC# %2d: %d\n", iTRU, j, adc[j]));
                                        
                                        fGeometry->GetAbsFastORIndexFromTRU(iTRU, j, idx);
                                        
@@ -437,79 +455,80 @@ void AliEMCALTriggerRawDigitMaker::PostProcess()
                        }
                }
                
-               for (Int_t i = 0; i < fSTURawStream->GetNL1GammaPatch(); i++)
-               {
-                       if (fSTURawStream->GetL1GammaPatch(i, iTRU, x, y)) // col (0..23), row (0..3)
-                       {
-                               iTRU = fGeometry->GetTRUIndexFromSTUIndex(iTRU);
+               for (int ithr = 0; ithr < 2; ithr++) {
                        
-                               if (AliDebugLevel()) printf("| STU => Found L1 gamma patch at (%2d , %2d) in TRU# %2d\n", x, y, iTRU);
-                               
-                               Int_t vx = 23 - x, vy = y + 4 * int(iTRU / 2); // Position in EMCal frame
-                               
-                               if (iTRU % 2) vx += 24; // C side
-                               
-                               vx = vx - int(sizeL1gsubr.X()) * int(sizeL1gpatch.X()) + 1;
-
-                               if (vx >= 0 && vy < 63) 
+                       for (Int_t i = 0; i < fSTURawStream->GetNL1GammaPatch(ithr); i++)
+                       {
+                               if (fSTURawStream->GetL1GammaPatch(i, ithr, iTRU, x, y)) // col (0..23), row (0..3)
                                {
-                                       if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(vx, vy, idx))
+                                       iTRU = fGeometry->GetTRUIndexFromSTUIndex(iTRU);
+                                       
+                                       if (AliDebugLevel()) printf("| STU => Found L1 gamma patch at (%2d , %2d) in TRU# %2d\n", x, y, iTRU);
+                                       
+                                       Int_t vx = 23 - x, vy = y + 4 * int(iTRU / 2); // Position in EMCal frame
+                                       
+                                       if (iTRU % 2) vx += 24; // C side
+                                       
+                                       vx = vx - int(sizeL1gsubr.X()) * int(sizeL1gpatch.X()) + 1;
+                                       
+                                       if (vx >= 0 && vy < 63) 
                                        {
-                                       if (AliDebugLevel()) printf("| STU => Add L1 gamma patch at (%2d , %2d)\n", vx, vy);
-                                               
-                                               if (fRawDigitIndex[idx] >= 0)
+                                               if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(vx, vy, idx))
                                                {
-                                                       dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
-                               }
-                                               else
-                                               {
-                                                       fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
-                                                       new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
-
-                                                       dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+                                                       if (AliDebugLevel()) printf("| STU => Add L1 gamma [%d] patch at (%2d , %2d)\n", ithr, vx, vy);
+                                                       
+                                                       if (fRawDigitIndex[idx] >= 0)
+                                                       {
+                                                               dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+                                                       }
+                                                       else
+                                                       {
+                                                               fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
+                                                               new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
+                                                               
+                                                               dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+                                                       }
+                                                       
+                                                       dig->SetTriggerBit(kL1GammaHigh + ithr,1);
                                                }
-               
-                                               dig->SetTriggerBit(kL1Gamma,1);
                                        }
                                }
                        }
-               }
-               
-               for (Int_t i = 0; i < fSTURawStream->GetNL1JetPatch(); i++)
-               {
-                       if (fSTURawStream->GetL1JetPatch(i, x, y)) // col (0,15), row (0,11)
+                       
+                       for (Int_t i = 0; i < fSTURawStream->GetNL1JetPatch(ithr); i++)
                        {
-                               if (AliDebugLevel()) printf("| STU => Found L1 jet patch at (%2d , %2d)\n", x, y);
-                               
-                               Int_t ix = int(sizeL1jsubr.X()) * (11 - y - int(sizeL1jpatch.X()) + 1);
-                               
-                               Int_t iy = int(sizeL1jsubr.Y()) * (15 - x - int(sizeL1jpatch.Y()) + 1);
-                               
-                               // FIXME: x = 0 || y = 0 (Olivier's CS) patches a lost?
-                               
-                               if (ix >= 0 && iy >= 0)
-                               {       
-                                       if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(ix, iy, idx))
-                                       {
-                                       if (AliDebugLevel()) printf("| STU => Add L1 jet patch at (%2d , %2d)\n", ix, iy);
-               
-                                               if (fRawDigitIndex[idx] >= 0)
-                                               {
-                                                       dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
-                                               }
-                                               else
+                               if (fSTURawStream->GetL1JetPatch(i, ithr, x, y)) // col (0,15), row (0,11)
+                               {
+                                       AliDebug(1, Form("| STU => Found L1 jet [%d] patch at (%2d , %2d)\n", ithr, x, y));
+                                       
+                                       Int_t ix = int(sizeL1jsubr.X()) * (11 - y - int(sizeL1jpatch.X()) + 1);
+                                       
+                                       Int_t iy = int(sizeL1jsubr.Y()) * (15 - x - int(sizeL1jpatch.Y()) + 1);
+                                       
+                                       if (ix >= 0 && iy >= 0)
+                                       {       
+                                               if (fGeometry->GetAbsFastORIndexFromPositionInEMCAL(ix, iy, idx))
                                                {
-                                                       fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
-                                                       new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
-               
-                                                       dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+                                                       if (AliDebugLevel()) printf("| STU => Add L1 jet patch at (%2d , %2d)\n", ix, iy);
+                                                       
+                                                       if (fRawDigitIndex[idx] >= 0)
+                                                       {
+                                                               dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+                                                       }
+                                                       else
+                                                       {
+                                                               fRawDigitIndex[idx] = fRawDigits->GetEntriesFast();
+                                                               new((*fRawDigits)[fRawDigits->GetEntriesFast()]) AliEMCALTriggerRawDigit(idx, 0x0, 0);
+                                                               
+                                                               dig = (AliEMCALTriggerRawDigit*)fRawDigits->At(fRawDigitIndex[idx]);
+                                                       }
+                                                       
+                                                       dig->SetTriggerBit(kL1JetHigh + ithr,1);
                                                }
-               
-                                               dig->SetTriggerBit(kL1Jet,1);
                                        }
                                }
-                       }
-               }               
+                       }               
+               }
        }
 }
 
index bf1eb1b48eeacc5d20b9a9a43ea473b1339ba1ce..1727f3f102e5536819db408d0af5c6dcb6796b75 100644 (file)
@@ -45,20 +45,20 @@ ClassImp(AliEMCALTriggerSTU)
 
 //_______________
 AliEMCALTriggerSTU::AliEMCALTriggerSTU() : AliEMCALTriggerBoard()
-,fGammaTh(0)
-,fJetTh(0)
 ,fDCSConfig(0x0)
 {
        // Ctor
+       fGammaTh[0] = fGammaTh[1] = 0;
+       fJetTh[0] = fJetTh[1] = 0;
 }
 
 //_______________
 AliEMCALTriggerSTU::AliEMCALTriggerSTU(AliEMCALTriggerSTUDCSConfig *dcsConf, const TVector2& RS) : AliEMCALTriggerBoard(RS)
-,fGammaTh(0)
-,fJetTh(0)
 ,fDCSConfig(dcsConf)
 {
        // Ctor
+       fGammaTh[0] = fGammaTh[1] = 0;
+       fJetTh[0] = fJetTh[1] = 0;      
 }
 
 //_______________
@@ -100,7 +100,7 @@ void AliEMCALTriggerSTU::Build( TString& str, Int_t iTRU, Int_t** M, const TVect
 }
 
 //_______________
-void AliEMCALTriggerSTU::L1(TriggerType_t type)
+void AliEMCALTriggerSTU::L1(int type)
 {
        // L1
        
@@ -109,11 +109,13 @@ void AliEMCALTriggerSTU::L1(TriggerType_t type)
        
        switch (type)
        {
-               case kL1Gamma:
+               case kL1GammaHigh:
+               case kL1GammaLow:
                        SetSubRegionSize(s1); 
                        SetPatchSize(s2);
                        break;
-               case kL1Jet:
+               case kL1JetHigh:
+               case kL1JetLow:
                        SetSubRegionSize(s3);
                        SetPatchSize(s4);
                        break;
@@ -123,163 +125,12 @@ void AliEMCALTriggerSTU::L1(TriggerType_t type)
                        break;
        }
        
-       SlidingWindow(type, GetThreshold(type));        
-}
-
-//________________
-void AliEMCALTriggerSTU::PrintADC( TriggerType_t type, TVector2& pos, TVector2& idx )
-{
-       // Dump
-       
-       Int_t ix = (Int_t) (( pos.X() + fPatchSize->X() ) * fSubRegionSize->X());
-       
-       Int_t iy = (Int_t) (( pos.Y() + fPatchSize->Y() ) * fSubRegionSize->Y());
-       
-       TString subRegionADC[] = {"0->15", "16->31", "32->47", "48->63", "64->79", "80->95"};
-       
-       switch ( type )
-       {
-               case kL1Gamma:
-               {
-                       Int_t iTRU = ( (ix-1) < 24 ) ? 31 - int(pos.Y() / 4) : 15 - int(pos.Y() / 4);
-                       
-                       printf("TRU #%d row #%d col #%d fastor: ",iTRU,int(idx.Y()),int(idx.X()));
-                       
-                       for (Int_t i=(Int_t)(pos.X() * fSubRegionSize->X());i<ix;i++) 
-                       {
-                         for (Int_t j=(Int_t) (pos.Y() * fSubRegionSize->Y());j<iy;j++) 
-                               {
-                                       Int_t jtru = ( i < 24 ) ? 31 - j / 4 : 15 - j / 4;
-                                       printf("TRU#%d_%d ",jtru,fMap[i][j]);
-                               }
-                       }
-                       
-                       cout << endl;
-               }       
-               break;
-               case kL1Jet:
-               {
-                       //Int_t jTRU = ( (ix-1) < 24 ) ? 31 - (iy-1) / 4 : 15 - (iy-1) / 4;
-                       
-                       printf("jet found at row : %d and col : %d",int(idx.X()),int(idx.Y()));
-                       
-                       Char_t vPair[100];
-                       Int_t nSubRegion = 0;
-                       
-                       for (Int_t i=(Int_t)(pos.X() * fSubRegionSize->X());i<ix;i++) 
-                       {
-                         for (Int_t j=(Int_t)(pos.Y() * fSubRegionSize->Y());j<iy;j++) 
-                               {
-                                       Int_t itru = ( i < 24 ) ? 31 - j / 4 : 15 - j / 4;
-                                       
-                                       Int_t idSR = fMap[i][j]/16;
-                                       
-                                       Char_t value = ((itru << 3) & 0xF8) | (idSR & 0x7);
-                                       
-                                       Bool_t isFound = kFALSE;
-                                       
-                                       for (Int_t k=0;k<nSubRegion && nSubRegion;k++)
-                                       {
-                                               if (vPair[k] == value) isFound = kTRUE;
-                                       }
-                                       
-                                       if (!isFound) 
-                                       {       
-                                               nSubRegion++;
-                                               
-                                               vPair[nSubRegion-1] = value;
-                                       }
-                               }
-                       }
-                       
-                       cout << " fastor:"; 
-                       for (Int_t i=0;i<nSubRegion;i++)
-                       {
-                               cout << " TRU#" << ((vPair[i] & 0xF8) >> 3) << "_" << subRegionADC[(vPair[i] & 0x7)];
-                       }
-               
-                       cout << endl;
-               }
-               break;
-               default:
-                       AliError("AliEMCALTriggerSTU::PrintADC(): Undefined trigger type, pls check!");
-       }
+       SlidingWindow(GetThreshold(type));      
+       AliDebug(999, Form("STU type %d sliding window w/ thr %d found %d patches", type, GetThreshold(type), fPatches->GetEntriesFast()));
 }
 
 //___________
-void AliEMCALTriggerSTU::PatchGenerator(const TClonesArray* lpos, Int_t val)
-{
-       // Patch generator
-       
-       ZeroRegion();
-       
-       Int_t vTRU[32][24][4] ;//= {0};
-       
-       for (Int_t i = 0; i < 32; i++) 
-               for (Int_t j = 0; j < 24; j++) 
-                       for (Int_t k = 0; k < 4; k++) vTRU[i][j][k]=0;
-       
-       
-       AliWarning("AliEMCALTriggerSTU::PatchGenerator(): STU region has been reset!");
-       
-       // Fill the patch FOR at 'pos' w/ value 'val'
-       
-       TIter NextPosition( lpos );
-       
-       while ( TVector2 *pos = (TVector2*)NextPosition() )
-       {
-               pos->Print();
-               for (Int_t i=(Int_t)(pos->X()*fSubRegionSize->X()); i<int((pos->X()+fPatchSize->X())*fSubRegionSize->X()); i++)
-                 for (Int_t j=(Int_t)(pos->Y()*fSubRegionSize->Y()); j<int((pos->Y()+fPatchSize->Y())*fSubRegionSize->Y()); j++) 
-                               fRegion[i][j] = val;
-       }
-       
-       for (Int_t i=0; i<2; i++)
-       {
-               for (Int_t j=0; j<16; j++)
-               {
-                       Int_t iTRU = ( !i ) ? 31 - j : 15 - j;
-                       
-                       for (Int_t i1=24*i; i1<24*(i+1); i1++)
-                       {
-                               for (Int_t j1=4*j; j1<4*(j+1); j1++)
-                               {
-                                       vTRU[iTRU][i1%24][j1%4] = fRegion[i1][j1];
-                               }
-                       }
-               }
-       }
-       
-       gSystem->Exec(Form("mkdir -p GP"));
-
-       for (Int_t i=0; i<32; i++)
-       {
-               std::ofstream outfile(Form("GP/data_TRU%d.txt",i),std::ios::trunc);
-       
-               for (Int_t j=0;j<96;j++) 
-               {
-                       Int_t ietam, iphim;
-                       
-                       if ( int(i / 16) )
-                       {
-                               ietam =      j/4;
-                               iphim =  3 - j%4;
-                       }
-                       else
-                       {                                       
-                               ietam = 23 - j/4;
-                               iphim =      j%4;
-                       }
-                       
-                       outfile << vTRU[i][ietam][iphim] << endl;
-               }
-       
-               outfile.close();
-       }
-}
-
-//___________
-void AliEMCALTriggerSTU::ComputeThFromV0(TriggerType_t type, const Int_t M[])
+void AliEMCALTriggerSTU::ComputeThFromV0(int type, const Int_t M[])
 {
        // Compute threshold from V0
        
@@ -287,15 +138,25 @@ void AliEMCALTriggerSTU::ComputeThFromV0(TriggerType_t type, const Int_t M[])
        
        switch (type)
        {
-               case kL1Gamma:
-                       P[0] = fDCSConfig->GetGA();
-                       P[1] = fDCSConfig->GetGB();
-                       P[2] = fDCSConfig->GetGC();                     
+               case kL1GammaHigh:
+                       P[0] = fDCSConfig->GetG(0, 0);
+                       P[1] = fDCSConfig->GetG(1, 0);
+                       P[2] = fDCSConfig->GetG(2, 0);                  
+                       break;
+               case kL1GammaLow:
+                       P[0] = fDCSConfig->GetG(0, 1);
+                       P[1] = fDCSConfig->GetG(1, 1);
+                       P[2] = fDCSConfig->GetG(2, 1);                  
                        break;
-               case kL1Jet:
-                       P[0] = fDCSConfig->GetJA();
-                       P[1] = fDCSConfig->GetJB();
-                       P[2] = fDCSConfig->GetJC();                     
+               case kL1JetHigh:
+                       P[0] = fDCSConfig->GetJ(0, 0);
+                       P[1] = fDCSConfig->GetJ(1, 0);
+                       P[2] = fDCSConfig->GetJ(2, 0);                  
+                       break;
+               case kL1JetLow:
+                       P[0] = fDCSConfig->GetJ(0, 1);
+                       P[1] = fDCSConfig->GetJ(1, 1);
+                       P[2] = fDCSConfig->GetJ(2, 1);                  
                        break;
                default:
                        AliError("AliEMCALTriggerSTU::ComputeThFromV0(): Undefined trigger type, pls check!");
@@ -307,6 +168,7 @@ void AliEMCALTriggerSTU::ComputeThFromV0(TriggerType_t type, const Int_t M[])
        ULong64_t sqrV0 = v0sum * v0sum;
        
        sqrV0 *= P[0];  
+       
        sqrV0 >>= 32;
        
        v0sum *= P[1];
@@ -317,17 +179,23 @@ void AliEMCALTriggerSTU::ComputeThFromV0(TriggerType_t type, const Int_t M[])
 }
 
 //___________
-void AliEMCALTriggerSTU::SetThreshold(TriggerType_t type, Int_t v)
+void AliEMCALTriggerSTU::SetThreshold(int type, Int_t v)
 {
        // Set threshold
        
        switch (type)
        {
-               case kL1Gamma:
-                       fGammaTh = v;
+               case kL1GammaHigh:
+                       fGammaTh[0] = v;
                        break;
-               case kL1Jet:
-                       fJetTh = v;             
+               case kL1GammaLow:
+                       fGammaTh[1] = v;
+                       break;
+               case kL1JetHigh:
+                       fJetTh[0] = v;          
+                       break;
+               case kL1JetLow:
+                       fJetTh[1] = v;          
                        break;
                default:
                        AliError("AliEMCALTriggerSTU::SetThreshold(): Undefined trigger type, pls check!");
@@ -335,19 +203,24 @@ void AliEMCALTriggerSTU::SetThreshold(TriggerType_t type, Int_t v)
 }
 
 //___________
-Int_t AliEMCALTriggerSTU::GetThreshold(TriggerType_t type)
+Int_t AliEMCALTriggerSTU::GetThreshold(int type)
 {      
        // Compute threshold FIXME: need an access to the OCDB
        // to get f(V0) parameters depending on trigger type
        
-       
        switch (type)
        {
-               case kL1Gamma:
-                       return fGammaTh;
+               case kL1GammaHigh:
+                       return fGammaTh[0];
+                       break;
+               case kL1GammaLow:
+                       return fGammaTh[1];
+                       break;
+               case kL1JetHigh:
+                       return fJetTh[0];               
                        break;
-               case kL1Jet:
-                       return fJetTh;          
+               case kL1JetLow:
+                       return fJetTh[1];               
                        break;
                default:
                        AliError("AliEMCALTriggerSTU::GetThreshold(): Undefined trigger type, pls check!");
index 7c43722627b84f478f9ad3470514ac73d5f422e4..c8a2b2a8a31507b3f4dcaf1ecbd68ae9331ddd63 100644 (file)
@@ -9,6 +9,7 @@
 Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
 */
 
+#include <AliEMCALTriggerTypes.h>
 #include <AliEMCALTriggerBoard.h>
 
 class TTree;
@@ -23,15 +24,12 @@ public:
        virtual      ~AliEMCALTriggerSTU();
        
        virtual void  Build(TString& str, Int_t i, Int_t** Map, const TVector2* rSize);
-       virtual void  PrintADC(TriggerType_t type, TVector2& pos, TVector2& idx);
-       virtual void  L1(TriggerType_t type);
-       virtual void  PatchGenerator(const TClonesArray* lpos, Int_t val);
+       virtual void  L1(int type);
        
-       virtual void  ComputeThFromV0(TriggerType_t type, const Int_t M[]);
+       virtual void  ComputeThFromV0(int type, const Int_t M[]);
        
-       virtual void  SetThreshold(TriggerType_t type, Int_t v);
-       
-       virtual Int_t GetThreshold(TriggerType_t type);
+       virtual void  SetThreshold(int type, Int_t v);
+       virtual Int_t GetThreshold(int type);
 
        virtual void  Reset();
        
@@ -44,12 +42,12 @@ protected:
 
 private:
        
-                 Int_t   fGammaTh; // Gamma threshold
-                 Int_t   fJetTh;   // Jet threshold
+                 Int_t   fGammaTh[2]; // Gamma threshold
+                 Int_t   fJetTh[2];   // Jet threshold
        
-       AliEMCALTriggerSTUDCSConfigfDCSConfig; // DCS config
+       AliEMCALTriggerSTUDCSConfig *fDCSConfig; // DCS config
 
-       ClassDef(AliEMCALTriggerSTU,1)
+       ClassDef(AliEMCALTriggerSTU, 2)
 };
  
 #endif
index 60ef971af4fdc633c09f408e0c0970437e934297..2470a5b82c1aaf33419b64ea453aee95d0121077 100644 (file)
@@ -28,20 +28,20 @@ Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
 ClassImp(AliEMCALTriggerSTUDCSConfig)
   
 //_____________________________________________________________________________
-AliEMCALTriggerSTUDCSConfig::AliEMCALTriggerSTUDCSConfig() : TObject()
-  ,fGA(0)
-  ,fGB(1)
-  ,fGC(0)
-  ,fJA(0)
-  ,fJB(1)
-  ,fJC(0)
-  ,fGetRawData(1)
-  ,fRegion(0xFFFFFFFF)
-  ,fFw(0x2A012)
+AliEMCALTriggerSTUDCSConfig::AliEMCALTriggerSTUDCSConfig() : TObject(),
+fGetRawData(1),
+fRegion(0xFFFFFFFF),
+fFw(0x2A012)
 {
-  //
-  // AliEMCALTriggerSTUDCSConfig default constructor
-  //
+       //
+       // AliEMCALTriggerSTUDCSConfig default constructor
+       //
+       for (int i = 0; i < 3; i++) {
+               for (int j = 0; j < 2; j++) {
+                       fG[i][j] = 0;
+                       fJ[i][j] = 0;
+               }       
+       }
 }
 
 //_____________________________________________________________________________
index af86b073626c9f2638e17498992e51c6b9ac6136..0d9b29dc6fdbd85495c000ee29866a20636e9977 100644 (file)
@@ -21,25 +21,17 @@ class AliEMCALTriggerSTUDCSConfig : public TObject
   AliEMCALTriggerSTUDCSConfig();
   virtual ~AliEMCALTriggerSTUDCSConfig() {};
          
-  void    SetGA(Int_t ga)        { fGA         = ga; }
-  void    SetGB(Int_t gb)        { fGB         = gb; }
-  void    SetGC(Int_t gc)        { fGC         = gc; }
-  void    SetJA(Int_t ja)        { fJA         = ja; }
-  void    SetJB(Int_t jb)        { fJB         = jb; }
-  void    SetJC(Int_t jc)        { fJC         = jc; }
-  void    SetRawData(Int_t rd)   { fGetRawData = rd; }
-  void    SetRegion(Int_t rg)    { fRegion     = rg; }
-  void    SetFw(Int_t fv)        { fFw         = fv; }
+  void    SetG(Int_t i, Int_t j, Int_t gv) { fG[i][j]    = gv; }
+  void    SetJ(Int_t i, Int_t j, Int_t jv) { fJ[i][j]    = jv; }
+  void    SetRawData(Int_t rd)             { fGetRawData = rd; }
+  void    SetRegion(Int_t rg)              { fRegion     = rg; }
+  void    SetFw(Int_t fv)                  { fFw         = fv; }
        
-  Int_t   GetGA()        const { return fGA;         }
-  Int_t   GetGB()        const { return fGB;         }
-  Int_t   GetGC()        const { return fGC;         }
-  Int_t   GetJA()        const { return fJA;         }
-  Int_t   GetJB()        const { return fJB;         }
-  Int_t   GetJC()        const { return fJC;         }
-  Int_t   GetRawData()   const { return fGetRawData; }
-  Int_t   GetRegion()    const { return fRegion;     }
-  Int_t   GetFw()        const { return fFw;         }
+  Int_t   GetG(int i, int j) const { return fG[i][j];    }
+  Int_t   GetJ(int i, int j) const { return fJ[i][j];    }
+  Int_t   GetRawData()       const { return fGetRawData; }
+  Int_t   GetRegion()        const { return fRegion;     }
+  Int_t   GetFw()            const { return fFw;         }
 
   void    GetSegmentation(TVector2& v1, TVector2& v2, TVector2& v3, TVector2& v4) const;
        
@@ -50,17 +42,13 @@ protected:
 
 private:
        
-  Int_t   fGA;         // GA
-  Int_t   fGB;         // GB
-  Int_t   fGC;         // GC
-  Int_t   fJA;         // JA
-  Int_t   fJB;         // JB
-  Int_t   fJC;         // JC
-  Int_t   fGetRawData; // GetRawData
-  Int_t   fRegion;     // Region
-  Int_t   fFw;         // Fw
+  Int_t   fG[3][2];       // GA,B,C
+  Int_t   fJ[3][2];       // JA,B,C
+  Int_t   fGetRawData;    // GetRawData
+  Int_t   fRegion;        // Region
+  Int_t   fFw;            // Fw
   
-  ClassDef(AliEMCALTriggerSTUDCSConfig,1) //
+  ClassDef(AliEMCALTriggerSTUDCSConfig,2) //
 };
 #endif
 
index de4b2c430b86c834158a73503eb052146fcb3ce4..9c47bc1535c9cb323b60469a3ff1beabca0ec1f8 100644 (file)
@@ -33,8 +33,9 @@ Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
 
 namespace
 {
-       const Int_t kPayLoadSizeOld     = 236;
-       const Int_t kPayLoadSizeNew     = 245;        
+       const Int_t kPayLoadSizeV0     = 236;
+       const Int_t kPayLoadSizeV1     = 245;        
+       const Int_t kPayLoadSizeV2     = 390;        
 }
 
 ClassImp(AliEMCALTriggerSTURawStream)
@@ -42,50 +43,72 @@ ClassImp(AliEMCALTriggerSTURawStream)
 //_____________________________________________________________________________
 AliEMCALTriggerSTURawStream::AliEMCALTriggerSTURawStream() : TObject(),
 fRawReader(0x0),
-fL1JetThreshold(0),
-fL1GammaThreshold(0),
+fL1JetThreshold(),
+fL1GammaThreshold(),
 fL0GammaPatchIndex(),
 fL1GammaPatchIndex(),
 fL1JetPatchIndex(),
 fNL0GammaPatch(0),
-fNL1JetPatch(0),
-fNL1GammaPatch(0),
+fNL1JetPatch(),
+fNL1GammaPatch(),
 fGetRawData(0),
 fV0A(0),
 fV0C(0),
-fGA(0),
-fGB(0),
-fGC(0),
-fJA(0),
-fJB(0),
-fJC(0),
+fG(),
+fJ(),
 fRegionEnable(0),
 fFrameReceived(0),
 fFwVersion(0)
 {
        //
+       for (int i = 0; i < 2; i++) {
+               //
+               fL1JetThreshold[i] = fL1GammaThreshold[i] = 0;
+               
+               fNL1JetPatch[i] = fNL1GammaPatch[i] = 0;
+       }
+       
+       for (int i = 0; i < 3; i++) {
+               for (int j = 0; j < 2; j++) {
+                       //
+                       fG[i][j] = fJ[i][j] = 0;
+               }
+       }
+       
+       for (int i = 0; i < 3100; i++) {
+               //
+               fL0GammaPatchIndex[i] = 0;
+               
+               for (int j = 0; j < 2; j++) {
+                       
+                       fL1GammaPatchIndex[i][j] = 0;
+               }
+       }
+       
+       for (int i = 0; i < 200; i++) {
+               for (int j = 0; j < 2; j++) {
+                       
+                       fL1JetPatchIndex[i][j] = 0;
+               }
+       }
 }
 
 //_____________________________________________________________________________
 AliEMCALTriggerSTURawStream::AliEMCALTriggerSTURawStream(AliRawReader* rawReader) : TObject(),
 fRawReader(rawReader),
-fL1JetThreshold(0),
-fL1GammaThreshold(0),
+fL1JetThreshold(),
+fL1GammaThreshold(),
 fL0GammaPatchIndex(),
 fL1GammaPatchIndex(),
 fL1JetPatchIndex(),
 fNL0GammaPatch(0),
-fNL1JetPatch(0),
-fNL1GammaPatch(0),
+fNL1JetPatch(),
+fNL1GammaPatch(),
 fGetRawData(0),
 fV0A(0),
 fV0C(0),
-fGA(0),
-fGB(0),
-fGC(0),
-fJA(0),
-fJB(0),
-fJC(0),
+fG(),
+fJ(),
 fRegionEnable(0),
 fFrameReceived(0),
 fFwVersion(0)
@@ -93,6 +116,37 @@ fFwVersion(0)
        //
        fRawReader->Reset();
        fRawReader->Select("EMCAL",44);
+       //
+       for (int i = 0; i < 2; i++) {
+               //
+               fL1JetThreshold[i] = fL1GammaThreshold[i] = 0;
+               
+               fNL1JetPatch[i] = fNL1GammaPatch[i] = 0;
+       }
+       
+       for (int i = 0; i < 3; i++) {
+               for (int j = 0; j < 2; j++) {
+                       //
+                       fG[i][j] = fJ[i][j] = 0;
+               }
+       }
+       
+       for (int i = 0; i < 3100; i++) {
+               //
+               fL0GammaPatchIndex[i] = 0;
+               
+               for (int j = 0; j < 2; j++) {
+                       
+                       fL1GammaPatchIndex[i][j] = 0;
+               }
+       }
+       
+       for (int i = 0; i < 200; i++) {
+               for (int j = 0; j < 2; j++) {
+                       
+                       fL1JetPatchIndex[i][j] = 0;
+               }
+       }
 }
 
 //_____________________________________________________________________________
@@ -109,8 +163,8 @@ void AliEMCALTriggerSTURawStream::Reset()
        if (fRawReader) fRawReader->Reset();
        
        fNL0GammaPatch = 0;
-       fNL1GammaPatch = 0;
-       fNL1JetPatch   = 0;     
+       fNL1GammaPatch[0] = fNL1GammaPatch[1] = 0;
+       fNL1JetPatch[0] = fNL1JetPatch[1] = 0;
 }
 
 //_____________________________________________________________________________
@@ -119,14 +173,14 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
        // STU data decoder from Olivier Bourrion LPSC CNRS-IN2P3
        // bourrion_at_lpsc_dot_in2p3_dot_fr
        
-       UInt_t word32[kPayLoadSizeNew + 1536]; // 32b words
-       for (Int_t i = 0;i < kPayLoadSizeNew + 1536; i++) word32[i] = 0;
+       UInt_t word32[kPayLoadSizeV2 + 1536]; // 32b words
+       for (Int_t i = 0;i < kPayLoadSizeV2 + 1536; i++) word32[i] = 0;
        
        Int_t iword = 0;
        
        fNL0GammaPatch = 0;
-       fNL1GammaPatch = 0;
-       fNL1JetPatch   = 0;
+       fNL1GammaPatch[0] = fNL1GammaPatch[1] = 0;
+       fNL1JetPatch[0] = fNL1JetPatch[1] = 0;
        
        Int_t eqId = -1, eqSize = 0;
        
@@ -143,78 +197,132 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
                word32[iword++] = w32;
        }
  
-       if (iword != kPayLoadSizeOld && iword != kPayLoadSizeNew && iword != (kPayLoadSizeOld + 1536) && iword != (kPayLoadSizeNew + 1536))
+       if (iword != kPayLoadSizeV0 && iword != kPayLoadSizeV1 && iword != kPayLoadSizeV2 
+               && 
+               iword != (kPayLoadSizeV0 + 1536) && iword != (kPayLoadSizeV1 + 1536) && iword != (kPayLoadSizeV2 + 1536))
        {
                AliError(Form("STU payload (eqId: %d, eqSize: %d) doesn't match expected size! %d word32",
                                          eqId, eqSize, iword));
                return kFALSE;
        }
        
-       if (AliDebugLevel())
-       {
-               AliInfo(Form("STU (eqId: %d, eqSize: %d) payload size: %d word32",
+       AliDebug(1, Form("STU (eqId: %d, eqSize: %d) payload size: %d word32",
                                         eqId, eqSize, iword));
-       }
        
-       int offset = 0, jetSize = 2;
+       int offset = 1;//, jetSize = 2;
+       
+       int nthres = 1;
        
        switch (iword) 
        {
-               case kPayLoadSizeOld:
-               case kPayLoadSizeOld + 1536:
+               case kPayLoadSizeV0:
+               case kPayLoadSizeV0 + 1536:
                {
-                       fL1JetThreshold   = ((word32[0]>>16) & 0xFFFF);
-                       fL1GammaThreshold =  (word32[0]      & 0xFFFF);
+                       fL1JetThreshold[0]   = ((word32[0]>>16) & 0xFFFF);
+                       fL1GammaThreshold[0] =  (word32[0]      & 0xFFFF);
                        
                        break;
                }
-               case kPayLoadSizeNew:
-               case kPayLoadSizeNew + 1536:
+               case kPayLoadSizeV1:
+               case kPayLoadSizeV1 + 1536:
                {
                        fV0A = ((word32[0]>>16) & 0xFFFF);
                        fV0C =  (word32[0]      & 0xFFFF);
                        
-                       fGA            = word32[1];
-                       fGB            = word32[2];
-                       fGC            = word32[3];
-                       fJA            = word32[4];
-                       fJB            = word32[5];
-                       fJC            = word32[6];             
+                       fG[0][0]       = word32[1];
+                       fG[1][0]       = word32[2];
+                       fG[2][0]       = word32[3];
+                       fJ[0][0]       = word32[4];
+                       fJ[1][0]       = word32[5];
+                       fJ[2][0]       = word32[6];             
                        fRegionEnable  = word32[7];
                        fFrameReceived = word32[8];
                        fFwVersion     = word32[9];
                        
-                       jetSize += (fFwVersion >> 16);
+                       fL1JetThreshold[0]   = GetThreshold(fJ[0][0], fJ[1][0], fJ[2][0], fV0A, fV0C);
+                       fL1GammaThreshold[0] = GetThreshold(fG[0][0], fG[1][0], fG[2][0], fV0A, fV0C); 
+                       
+                       offset = 10;
+                       
+                       break;
+               }
+               case kPayLoadSizeV2:
+               case kPayLoadSizeV2 + 1536:
+               {
+                       fV0A = ((word32[0]>>16) & 0xFFFF);
+                       fV0C =  (word32[0]      & 0xFFFF);
                        
-                       fL1JetThreshold   = GetThreshold(fJA, fJB, fJC, fV0A, fV0C);
-                       fL1GammaThreshold = GetThreshold(fGA, fGB, fGC, fV0A, fV0C); 
+                       fG[0][0]       = word32[1];
+                       fG[1][0]       = word32[2];
+                       fG[2][0]       = word32[3];
+                       fJ[0][0]       = word32[4];
+                       fJ[1][0]       = word32[5];
+                       fJ[2][0]       = word32[6];             
+                       
+                       fG[0][1]       = word32[7];
+                       fG[1][1]       = word32[8];
+                       fG[2][1]       = word32[9];
+                       fJ[0][1]       = word32[10];
+                       fJ[1][1]       = word32[11];
+                       fJ[2][1]       = word32[12];            
+                       
+                       fRegionEnable  = word32[13];
+                       fFrameReceived = word32[14];
+                       fFwVersion     = word32[15];
+                       
+                       for (int i = 0; i < 2; i++) {
+                               //
+                               fL1JetThreshold[i]   = GetThreshold(fJ[0][i], fJ[1][i], fJ[2][i], fV0A, fV0C);
+                               fL1GammaThreshold[i] = GetThreshold(fG[0][i], fG[1][i], fG[2][i], fV0A, fV0C); 
+                       }
                        
-                       offset = 9;
+                       offset = 16;                    
+                       
+                       nthres = 2;
                        
                        break;
                }
+               default:
+                       AliError(Form("STU payload size not found! %d word32", iword));
        }
        
+//     jetSize += (fFwVersion >> 16);
+       
        ///////////
        // START DECODING
        //////////
 
-       for (Int_t jet_row = 0; jet_row < 12 - (jetSize - 1); jet_row++)
-       {
-               UInt_t currentrow = word32[offset + 1 + jet_row];
+       for (int i = 0; i < nthres; i++) {
+               DecodeL1JetPatchIndexes(i, word32, offset);
                
-               for (Int_t jet_col = 0; jet_col < 15; jet_col++)
-               {
-                       if (currentrow & (1 << jet_col))
-                       {
-                               fNL1JetPatch++;
-                               
-                               fL1JetPatchIndex[fNL1JetPatch-1] = ((jet_row << 8) & 0xFF00) | (jet_col & 0xFF);
-                       }
-               }
+               offset += 11;
        }
+       
+       DecodeL0GammaPatchIndexes(word32, offset);
+       
+       offset += 96;
+       
+       for (int i = 0; i < nthres; i++) {
+               DecodeL1GammaPatchIndexes(i, word32, offset);   
                
+               offset += 128;
+       }
        
+       if (iword == kPayLoadSizeV0 || iword == kPayLoadSizeV1 || iword == kPayLoadSizeV2) {
+               fGetRawData = 0;
+               return kTRUE;
+       }
+       
+       fGetRawData = 1;
+       
+       DecodeTRUADC(word32, offset);
+       
+       return kTRUE;
+}
+
+//_____________________________________________________________________________
+void AliEMCALTriggerSTURawStream::DecodeL0GammaPatchIndexes(UInt_t *word32, const int offset)
+{
        //////////////////////////////////////////////////////////
        // index des L0                                         //
        //////////////////////////////////////////////////////////
@@ -227,11 +335,11 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
        {
                for (Int_t tru_num=0;tru_num<16;tru_num++)
                {
-                       truL0indexes[2*tru_num  ][index] = ( word32[offset + 12 + index * 16 + tru_num]        & 0xFFFF);
-                       truL0indexes[2*tru_num+1][index] = ((word32[offset + 12 + index * 16 + tru_num] >> 16) & 0xFFFF);
+                       truL0indexes[2*tru_num  ][index] = ( word32[offset + index * 16 + tru_num]        & 0xFFFF);
+                       truL0indexes[2*tru_num+1][index] = ((word32[offset + index * 16 + tru_num] >> 16) & 0xFFFF);
                }
        }
-
+       
        for (Int_t tru_num=0;tru_num<32;tru_num++) 
        {
                for (Int_t index=0;index<6;index++) 
@@ -241,7 +349,7 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
                                if ((truL0indexes[tru_num][index] & (1 << bit_num)))
                                {
                                        Int_t idx = 12 * index + bit_num;
-                                                                               
+                                       
                                        fNL0GammaPatch++;
                                        
                                        fL0GammaPatchIndex[fNL0GammaPatch-1] = (((idx << 5) & 0x7E0) | (tru_num & 0x1F));
@@ -249,7 +357,36 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
                        }
                }
        }
+}
+
+//_____________________________________________________________________________
+void AliEMCALTriggerSTURawStream::DecodeL1JetPatchIndexes(const int i, UInt_t *word32, const int offset)
+{
+       //////////////////////////////////////////////////////////
+       // index des L1 jet                                     //
+       //////////////////////////////////////////////////////////
+       
+       int jetSize = 2 + (fFwVersion >> 16);
+       
+       for (Int_t jet_row = 0; jet_row < 12 - (jetSize - 1); jet_row++)
+       {
+               UInt_t currentrow = word32[offset + jet_row];
+               
+               for (Int_t jet_col = 0; jet_col < 15; jet_col++)
+               {
+                       if (currentrow & (1 << jet_col))
+                       {
+                               fNL1JetPatch[i] = fNL1JetPatch[i] + 1;
+                               
+                               fL1JetPatchIndex[fNL1JetPatch[i] - 1][i] = ((jet_row << 8) & 0xFF00) | (jet_col & 0xFF);
+                       }
+               }
+       }
+}
 
+//_____________________________________________________________________________
+void AliEMCALTriggerSTURawStream::DecodeL1GammaPatchIndexes(const int i, UInt_t *word32, const int offset)
+{
        //////////////////////////////////////////////////////////
        // index des L1 gamma                                   //
        //////////////////////////////////////////////////////////
@@ -261,11 +398,11 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
        {
                for (Int_t tru_num=0;tru_num<16;tru_num++)
                {
-                       truL1indexes[2*tru_num  ][index] = ( word32[offset + 108 + index * 16 + tru_num]        & 0xFFFF);
-                       truL1indexes[2*tru_num+1][index] = ((word32[offset + 108 + index * 16 + tru_num] >> 16) & 0xFFFF);
+                       truL1indexes[2*tru_num  ][index] = ( word32[offset + index * 16 + tru_num]        & 0xFFFF);
+                       truL1indexes[2*tru_num+1][index] = ((word32[offset + index * 16 + tru_num] >> 16) & 0xFFFF);
                }
        }       
-
+       
        // interpretation
        int gammacolnum;
        short indexcopy;
@@ -289,36 +426,28 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
                                                indexcopy   = index-4;
                                        }                                               
                                        
-                                       fNL1GammaPatch++;
+                                       fNL1GammaPatch[i] = fNL1GammaPatch[i] + 1;
                                        
-                                       fL1GammaPatchIndex[fNL1GammaPatch-1] = (((indexcopy << 10) & 0xC00) | ((gammacolnum << 5) & 0x3E0) | (tru_num & 0x1F));
+                                       fL1GammaPatchIndex[fNL1GammaPatch[i] - 1][i] = (((indexcopy << 10) & 0xC00) | ((gammacolnum << 5) & 0x3E0) | (tru_num & 0x1F));
                                }
                        }
                }
        }       
+}
 
-       //////////////////////////////////////////////////////////
-       // raw output                                           //
-       //////////////////////////////////////////////////////////
-       
-       if (iword == kPayLoadSizeOld || iword == kPayLoadSizeNew) 
-       {
-               fGetRawData = 0;
-               return kTRUE;
-       }
-       
-       fGetRawData = 1;
-       
+//_____________________________________________________________________________
+void AliEMCALTriggerSTURawStream::DecodeTRUADC(UInt_t *word32, const int offset)
+{
        // extraction from stream
        for (Int_t index=0;index<96;index++)
        {
                for (Int_t tru_num=0;tru_num<16;tru_num++)
                {
-                       fADC[2*tru_num  ][index] = ( word32[offset + 236 + index * 16 + tru_num]        & 0xFFFF);
-                       fADC[2*tru_num+1][index] = ((word32[offset + 236 + index * 16 + tru_num] >> 16) & 0xFFFF);
+                       fADC[2*tru_num  ][index] = ( word32[offset + index * 16 + tru_num]        & 0xFFFF);
+                       fADC[2*tru_num+1][index] = ((word32[offset + index * 16 + tru_num] >> 16) & 0xFFFF);
                }
        }       
-
+       
        for (Int_t tru_num=16;tru_num<32;tru_num++) // A side
        {
                Int_t v[96];
@@ -326,10 +455,9 @@ Bool_t AliEMCALTriggerSTURawStream::ReadPayLoad()
                
                for (Int_t index=0;index<96;index++) fADC[tru_num][index] = v[index];
        }
-       
-       return kTRUE;
 }
 
+
 //_____________________________________________________________________________
 Bool_t AliEMCALTriggerSTURawStream::GetL0GammaPatch(const Int_t i, Int_t& tru, Int_t& idx) const
 {
@@ -344,28 +472,28 @@ Bool_t AliEMCALTriggerSTURawStream::GetL0GammaPatch(const Int_t i, Int_t& tru, I
 }
 
 //_____________________________________________________________________________
-Bool_t AliEMCALTriggerSTURawStream::GetL1GammaPatch(const Int_t i, Int_t& tru, Int_t& col, Int_t& row) const
+Bool_t AliEMCALTriggerSTURawStream::GetL1GammaPatch(const Int_t i, const Int_t j, Int_t& tru, Int_t& col, Int_t& row) const
 {
        // L1 gamma patch indexes
        
-       if (i > fNL1GammaPatch) return kFALSE;
+       if (j > 2 || i > fNL1GammaPatch[j]) return kFALSE;
        
-       tru =  fL1GammaPatchIndex[i] & 0x1F;
-       col = (fL1GammaPatchIndex[i] & 0x3E0) >> 5;
-       row = (fL1GammaPatchIndex[i] & 0xC00) >> 10;
+       tru =  fL1GammaPatchIndex[i][j] & 0x1F;
+       col = (fL1GammaPatchIndex[i][j] & 0x3E0) >> 5;
+       row = (fL1GammaPatchIndex[i][j] & 0xC00) >> 10;
        
        return kTRUE;
 }
 
 //_____________________________________________________________________________
-Bool_t AliEMCALTriggerSTURawStream::GetL1JetPatch(const Int_t i, Int_t& col, Int_t& row) const
+Bool_t AliEMCALTriggerSTURawStream::GetL1JetPatch(const Int_t i, const Int_t j, Int_t& col, Int_t& row) const
 {
        // L1 jet patch indexes
        
-       if (i > fNL1JetPatch) return kFALSE;
+       if (j > 2 || i > fNL1JetPatch[j]) return kFALSE;
        
-       col =  fL1JetPatchIndex[i] & 0xFF;
-       row = (fL1JetPatchIndex[i] & 0xFF00) >> 8;
+       col =  fL1JetPatchIndex[i][j] & 0xFF;
+       row = (fL1JetPatchIndex[i][j] & 0xFF00) >> 8;
        
        return kTRUE;
 }
@@ -387,60 +515,56 @@ void AliEMCALTriggerSTURawStream::DumpPayLoad(const Option_t *option) const
        
        printf("V0A:             %d\n", fV0A);
        printf("V0C:             %d\n", fV0C);
-       printf("G_A:             %d\n", fGA);
-       printf("G_B:             %d\n", fGB);
-       printf("G_C:             %d\n", fGC);
-       printf("Gamma threshold: %d\n", fL1GammaThreshold);
-       printf("J_A:             %d\n", fJA);
-       printf("J_B:             %d\n", fJB);
-       printf("J_C:             %d\n", fJC);
-       printf("Jet Threshold:   %d\n", fL1JetThreshold);
+
        printf("RawData:         %d\n", fGetRawData);
        printf("RegionEnable:    %8x\n", fRegionEnable); 
        printf("FrameReceived:   %8x\n", fFrameReceived);
        printf("FwVersion:       %x\n", fFwVersion);
        printf("Number of L0:    %d\n", fNL0GammaPatch);
-       printf("Number of L1-g:  %d\n", fNL1GammaPatch);
-       printf("Number of L1-j:  %d\n", fNL1JetPatch);
+
+       for (int i = 0; i < 2; i++) {
+               for (int j = 0; j < 3; j++) {
+                       printf("G[%d][%d]: %d\n", j, i, fG[j][i]);
+                       printf("J[%d][%d]: %d\n", j, i, fJ[j][i]);
+               }
+               
+               printf("Gamma threshold[%d]: %d\n", i, fL1GammaThreshold[i]);
+               printf("Jet Threshold[%d]:   %d\n", i, fL1JetThreshold[i]);
+
+               printf("Number of L1-g[%d]: %d\n", i, fNL1GammaPatch[i]);
+               printf("Number of L1-j[%d]: %d\n", i, fNL1JetPatch[i]);
+       }
        
        Int_t itru, col, row;
        
        if (op.Contains("L0") || op.Contains("ALL"))
        {
-               for (Int_t i=0;i<fNL0GammaPatch;i++)
-               {
-                       
+               for (Int_t i = 0;i < fNL0GammaPatch; i++) {
                        if (GetL0GammaPatch(i,itru,col)) 
                                cout << "> Found L0 gamma in TRU #" << setw(2) << itru <<  " at idx: " << setw(2) << col << endl;
                }
        }
        
-       if (op.Contains("L1") || op.Contains("ALL"))
-       {
-               for (Int_t i=0;i<fNL1GammaPatch;i++)
-               {
-                       if (GetL1GammaPatch(i,itru,col,row)) 
-                               cout << "> Found L1 gamma in TRU #" << setw(2) << itru <<  " at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl;
-               }
-
-               for (Int_t i=0;i<fNL1JetPatch;i++)
-               {
-                       if (GetL1JetPatch(i,col,row)) cout << "> Found L1 jet at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl;
+       if (op.Contains("L1") || op.Contains("ALL")) {
+               for (int j = 0; j < 2; j++) {
+                       for (Int_t i = 0; i < fNL1GammaPatch[j]; i++) {
+                               if (GetL1GammaPatch(i, j, itru, col, row)) 
+                                       cout << "> Found L1 gamma " << j << " in TRU #" << setw(2) << itru <<  " at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl;
+                       }
+                       
+                       for (Int_t i = 0; i < fNL1JetPatch[j]; i++) {
+                               if (GetL1JetPatch(i, j, col, row)) cout << "> Found L1 jet " << j << " at: ( col: " << setw(2) << col << " , row: " << setw(2) << row << " )" << endl;
+                       }
                }
        }
        
-       
-       
-       if ( (op.Contains("ADC") || op.Contains("ALL")) && fGetRawData )
-       {
-               for (Int_t i=0;i<32;i++)
-               {
+       if ((op.Contains("ADC") || op.Contains("ALL")) && fGetRawData) {
+               for (Int_t i = 0; i < 32; i++) {
                        cout << "--------\n";
                        cout << "TRU #" << setw(2) << i << ":";
-                       for (Int_t j=0;j<96;j++) 
-                       { 
-                               TBits xadc(12); xadc.Set(12,&fADC[i][j]); 
-                               if ((j%4)==0) cout << endl;
+                       for (Int_t j = 0;j < 96; j++) { 
+                               //TBits xadc(12); xadc.Set(12,&fADC[i][j]); 
+                               if ((j % 4) == 0) cout << endl;
                                //cout << setw(2) << j << ": " << xadc << " ";
                                printf("%2d: %3x / ",j,fADC[i][j]); 
                        }
index b81fb0d5f871a0a32ec22c56502769d1e258f10e..9c2e47a1bbb5d061b0ba1839fe80ff275681cc69 100644 (file)
@@ -25,29 +25,31 @@ class AliEMCALTriggerSTURawStream: public TObject
   
     virtual void   Reset();
     virtual Bool_t ReadPayLoad();
+       
+       virtual void DecodeL1JetPatchIndexes(  const int i, UInt_t *word32, const int offset);
+       virtual void DecodeL1GammaPatchIndexes(const int i, UInt_t *word32, const int offset);
+       virtual void DecodeL0GammaPatchIndexes(             UInt_t *word32, const int offset);
+    virtual void DecodeTRUADC(                          UInt_t *word32, const int offset);
+       
        virtual void   DumpPayLoad(const Option_t *option = "ALL") const;
 
        virtual void                GetADC(Int_t iTRU, UInt_t ADC[]);
-       virtual UInt_t   GetL1JetThreshold() const {return   fL1JetThreshold;}
-       virtual UInt_t GetL1GammaThreshold() const {return fL1GammaThreshold;}
+       virtual UInt_t   GetL1JetThreshold(const int i) const {return   fL1JetThreshold[i];}
+       virtual UInt_t GetL1GammaThreshold(const int i) const {return fL1GammaThreshold[i];}
        
        virtual Int_t     GetNL0GammaPatch() const {return fNL0GammaPatch;}
-       virtual Int_t     GetNL1GammaPatch() const {return fNL1GammaPatch;}
-       virtual Int_t       GetNL1JetPatch() const {return fNL1JetPatch;}
+       virtual Int_t     GetNL1GammaPatch(const int i) const {return fNL1GammaPatch[i];}
+       virtual Int_t       GetNL1JetPatch(const int i) const {return fNL1JetPatch[i];}
        virtual Int_t           GetRawData() const {return fGetRawData;}
        
        virtual Bool_t     GetL0GammaPatch(const Int_t i, Int_t& x, Int_t& y) const;
-       virtual Bool_t     GetL1GammaPatch(const Int_t i, Int_t& x, Int_t& y, Int_t& z) const;
-       virtual Bool_t       GetL1JetPatch(const Int_t i, Int_t& x, Int_t& y) const;
+       virtual Bool_t     GetL1GammaPatch(const Int_t i, const Int_t j, Int_t& x, Int_t& y, Int_t& z) const;
+       virtual Bool_t       GetL1JetPatch(const Int_t i, const Int_t j, Int_t& x, Int_t& y) const;
        
        virtual UInt_t              GetV0A()           const {return fV0A;}
        virtual UInt_t              GetV0C()           const {return fV0C;}
-       virtual UInt_t              GetGA()            const {return fGA;}
-       virtual UInt_t              GetGB()            const {return fGB;}
-       virtual UInt_t              GetGC()            const {return fGC;}
-       virtual UInt_t              GetJA()            const {return fJA;}
-       virtual UInt_t              GetJB()            const {return fJB;}
-       virtual UInt_t              GetJC()            const {return fJC;}
+       virtual UInt_t              GetG(int i, int j) const {return fG[i][j];}
+       virtual UInt_t              GetJ(int i, int j) const {return fJ[i][j];}
        virtual UInt_t              GetRegionEnable()  const {return fRegionEnable;}
        virtual UInt_t              GetFrameReceived() const {return fFrameReceived;}
        virtual UInt_t              GetFwVersion()     const {return fFwVersion;}
@@ -61,15 +63,15 @@ private:
 
     AliRawReader* fRawReader;   // object for reading the raw data
 
-       UInt_t                               fL1JetThreshold;          // L1 Jet Threshold
-       UInt_t                             fL1GammaThreshold;          // L1 Gamma Threshold
-       UShort_t                          fL0GammaPatchIndex[3100];    // L0 Gamma Patch Index
-       UShort_t                          fL1GammaPatchIndex[3100];    // L1 Gamma Patch Index
-       UShort_t                            fL1JetPatchIndex[200];     // L1 Jet Patch Index
+       UInt_t                               fL1JetThreshold[2];          // L1 Jet Threshold
+       UInt_t                             fL1GammaThreshold[2];          // L1 Gamma Threshold
+       UShort_t                          fL0GammaPatchIndex[3100];       // L0 Gamma Patch Index
+       UShort_t                          fL1GammaPatchIndex[3100][2];    // L1 Gamma Patch Index
+       UShort_t                            fL1JetPatchIndex[200][2];     // L1 Jet Patch Index
                                                                          
-       Int_t                                 fNL0GammaPatch;          // N L0 Gamma Patch
-       Int_t                                   fNL1JetPatch;          // N L1 Jet Patch
-       Int_t                                 fNL1GammaPatch;          // N L1 Gamma Patch
+       Int_t                                 fNL0GammaPatch;             // N L0 Gamma Patch
+       Int_t                                   fNL1JetPatch[2];          // N L1 Jet Patch
+       Int_t                                 fNL1GammaPatch[2];          // N L1 Gamma Patch
                                                                          
        Int_t                                    fGetRawData;          // Get Raw Data
                                                                          
@@ -77,17 +79,13 @@ private:
                                                                          
        UInt_t                                          fV0A;          // V0A
     UInt_t                                          fV0C;          // V0C
-    UInt_t                                           fGA;          // GA
-    UInt_t                                           fGB;          // GB
-    UInt_t                                           fGC;          // GC
-    UInt_t                                           fJA;          // JA
-    UInt_t                                           fJB;          // JB
-    UInt_t                                           fJC;          // JC
+       UInt_t                                      fG[3][2];          // Gamma
+       UInt_t                                      fJ[3][2];          // Jet
     UInt_t                                 fRegionEnable;          // Region Enable
     UInt_t                                fFrameReceived;          // Frame Received
     UInt_t                                    fFwVersion;          // Fw Version
 
-    ClassDef(AliEMCALTriggerSTURawStream,1)   // class for reading EMCAL STU DDL raw data
+    ClassDef(AliEMCALTriggerSTURawStream,2)   // class for reading EMCAL STU DDL raw data
 };
 
 #endif
index 679e40b93ce6b9190cf7d785766f6c3ed06f7414..be09a2c2381aad56f8f0bfd27085f35db5ef03f8 100644 (file)
@@ -30,13 +30,11 @@ Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
 #include <TClonesArray.h>
 #include <TSystem.h>
 #include <Riostream.h>
-  
+
 namespace
 {
        const Int_t kTimeBins       = 16; // number of sampling bins of the FastOR signal
        const Int_t kTimeWindowSize =  4; // 
-       const Int_t kNup            =  2; // 
-       const Int_t kNdown          =  1; // 
 }
 
 ClassImp(AliEMCALTriggerTRU)
@@ -60,7 +58,7 @@ fL0Time(0)
        // Ctor
        
        for (Int_t i=0;i<96;i++) for (Int_t j=0;j<256;j++) fADC[i][j] = 0;
-
+       
        TVector2 size;
        
        if (dcsConf->GetL0SEL() & 0x0001) // 4-by-4
@@ -110,7 +108,7 @@ void AliEMCALTriggerTRU::ShowFastOR(Int_t iTimeWindow, Int_t iChannel)
        else
        {
                iChanF =  0;
-               iChanL = 96;
+               iChanL = 95;
        }
        
        for (Int_t i=iChanF;i<iChanL+1;i++)
@@ -133,207 +131,326 @@ void AliEMCALTriggerTRU::ShowFastOR(Int_t iTimeWindow, Int_t iChannel)
 //________________
 Int_t AliEMCALTriggerTRU::L0()
 {
-       // L0 issuing condition is: (2 up & 1 down) AND (patch sum > thres)
-       // fill a matrix to support sliding window
-       // compute the time sum for all the FastOR of a given TRU
-       // and then move the space window
-
-       AliDebug(999,"=== Running TRU L0 algorithm ===");
+       // L0 algo depending on TRU fw version
+       
        const Int_t xsize    = Int_t(fRegionSize->X());
        const Int_t ysize    = Int_t(fRegionSize->Y());
-       const Int_t zsize    = kNup+kNdown;
 
-       Int_t ***buffer = new Int_t**[xsize];
-       for (Int_t x = 0; x < xsize; x++)
-       {
-               buffer[x] = new Int_t*[ysize];
-               
-               for (Int_t y = 0; y < ysize; y++)
-               {
-                       buffer[x][y] = new Int_t[zsize];
+       Int_t asum = 0;
+       for (Int_t j = 0; j < xsize; j++) {             
+               for (Int_t k = 0; k < ysize; k++) {
+                       for (Int_t l = 0; l < kTimeBins; l++) {
+                               asum += fADC[fMap[j][k]][l];
+                       }
                }
+       }       
+       
+       // TRU has no signal, return!
+       if (!asum) {
+               AliDebug(999,"=== TRU has no signal ===");
+               return 0;
        }
        
-       for (Int_t i = 0; i < fRegionSize->X(); i++) 
-               for (Int_t j = 0; j < fRegionSize->Y(); j++) 
-                       for (Int_t k = 0; k < kNup + kNdown; k++) buffer[i][j][k] = 0;
-               
+       AliDebug(999,Form("=== TRU PF: %x",fDCSConfig->GetSELPF()));
+       
+       UInt_t ma = fDCSConfig->GetSELPF() & 0xffff;
+       
+//     int nb = 0;
+//     for (int i = 0; i < 7; i++) {
+//             UInt_t bit = ma & (1 << i);
+//             if (bit) nb++;
+//     }
+       
+       int nb = ma & 0x7f;
+       
+       ma = (ma >> 8) & 0x7f;
+       
+       AliDebug(999,Form("=== TRU fw version %x ===",fDCSConfig->GetFw()));
+       
+       if (fDCSConfig->GetFw() < 0x4d) {
+               return L0v0(nb, ma);
+       } else {
+               return L0v1(nb, ma);
+       }
+}
+
+//________________
+Int_t AliEMCALTriggerTRU::L0v0(int mask, int pattern)
+{
+       // L0 issuing condition is: (2x2 PF) AND (4x4 > thres)
+       
+       AliDebug(999,"=== Running TRU L0 algorithm version 0 ===");
+
+       const Int_t xsize    = Int_t(fRegionSize->X());
+       const Int_t ysize    = Int_t(fRegionSize->Y());
+
+       Int_t **othr = new Int_t*[xsize];
+       Int_t **patt = new Int_t*[xsize];       
+       Int_t **buff = new Int_t*[xsize];       
+       
+       for (Int_t x = 0; x < xsize; x++) {
+               othr[x] = new Int_t[ysize];
+               patt[x] = new Int_t[ysize];
+               buff[x] = new Int_t[ysize];
+       }
+       
+       for (Int_t i = 0; i < xsize; i++) {
+               for (Int_t j = 0; j < ysize; j++) {
+                       othr[i][j] = 0; 
+                       patt[i][j] = 0;
+                       buff[i][j] = 0;
+               }
+       }
+                       
        // Time sliding window algorithm
-       for (Int_t i=0; i<=(kTimeBins-kTimeWindowSize); i++) 
+       for (int i = 0; i <= (kTimeBins - kTimeWindowSize); i++) 
        {
                AliDebug(999,Form("----------- Time window: %d\n",i));
                
-               for (Int_t j=0; j<fRegionSize->X(); j++)
-               {               
-                       for (Int_t k=0; k<fRegionSize->Y(); k++)
-                       {
-                               for (Int_t l=i; l<i+kTimeWindowSize; l++) 
-                               {
-                                       // [eta][phi][time]
-                                       fRegion[j][k] += fADC[fMap[j][k]][l];   
-                               }
+               if (AliDebugLevel()) ShowFastOR(i, -1);
+               
+               for (int j = 0; j < xsize; j++) {               
+                       for (int k = 0; k < ysize; k++) {
                                
-                               buffer[j][k][i%(kNup + kNdown)] = fRegion[j][k];
+//                             if (
+//                                     !(j % int(fSubRegionSize->X())) 
+//                                     && 
+//                                     !(k % int(fSubRegionSize->Y())) 
+//                                     && 
+//                                     (j + int(fPatchSize->X() * fSubRegionSize->X()) <= xsize)
+//                                     && 
+//                                     (k + int(fPatchSize->Y() * fSubRegionSize->Y()) <= ysize)
+//                                     ) 
+//                             {
+//                                     int sum = 0;
+//                                     
+//                                     for (int l = 0; l < int(fPatchSize->X() * fSubRegionSize->X()); l++) 
+//                                             for (int m = 0; m < int(fPatchSize->Y() * fSubRegionSize->Y()); m++) sum += fRegion[j + l][k + m];
+//                                     
+//                                     if (sum > int(fDCSConfig->GetGTHRL0())) {
+//                                             AliDebug(999,Form("----------- Patch (%2d,%2d) is over threshold\n", j, k));
+//                                             othr[j][k] = sum;
+//                                     }
+//                             }
                                
-                               if ( i > kNup + kNdown - 1 ) 
-                               {       
-                                       for (Int_t v = 0; v < kNup + kNdown - 1; v++) buffer[j][k][v] =  buffer[j][k][v+1];
-       
-                                       buffer[j][k][kNup + kNdown - 1] = fRegion[j][k];
-                               }
-                               else
-                               {
-                                       buffer[j][k][i] = fRegion[j][k];
+                               buff[j][k] = fRegion[j][k];
+                               
+                               fRegion[j][k] = 0;
+                               for (Int_t l = i; l < i + kTimeWindowSize; l++) fRegion[j][k] += fADC[fMap[j][k]][l];   
+                               
+                               if (fRegion[j][k] > buff[j][k]) {
+                                       patt[j][k] |= 0x1;
                                }
                                
-//                             if (kTimeWindowSize > 4) fRegion[j][k] = fRegion[j][k] >> 1; // truncate time sum to fit 14b
+                               if (patt[j][k]) AliDebug(999,Form("----------- (%2d,%2d) New: %d Old: %d patt: %x / pattern: %x / mask: %x", j, k, fRegion[j][k], buff[j][k], patt[j][k], pattern, mask));
                        }
                }
                
-               // Don't start to evaluate space sum if a peak can't be findable
-               if (i < kNup + kNdown - 1) 
-               {
-                       ZeroRegion();
-                       continue; 
-               }
-               
-               Int_t **peaks = new Int_t*[xsize];
-               for (Int_t x = 0; x < xsize; x++)
-               {
-                       peaks[x] = new Int_t[ysize];
-               }
-               
-               for (Int_t j=0; j<fRegionSize->X(); j++) for (Int_t k=0; k<fRegionSize->Y(); k++) peaks[j][k] = 0;
-               
-               Int_t nPeaks = 0;
-               
-               for (Int_t j=0; j<fRegionSize->X(); j++)
-               {               
-                       for (Int_t k=0; k<fRegionSize->Y(); k++)
-                       {
-                               Int_t foundU = 0;
+               for (int j = 0; j <= int(fRegionSize->X() - fPatchSize->X() * fSubRegionSize->X()); j += int(fSubRegionSize->X())) {
+                       for (int k = 0; k <= int(fRegionSize->Y() - fPatchSize->Y() * fSubRegionSize->Y()); k += int(fSubRegionSize->Y())) {
                                
-                               Int_t foundD = 0;
-               
-                               for (Int_t l=   1;l<kNup       ;l++) foundU = ( buffer[j][k][l]> buffer[j][k][l-1] && buffer[j][k][l-1] ) ? 1 : 0;
+//                             if (!othr[j][k]) continue;
+                               int sizeX = int(fPatchSize->X() * fSubRegionSize->X());                         
+                               int sizeY = int(fPatchSize->Y() * fSubRegionSize->Y());
                                
-                               for (Int_t l=kNup;l<kNup+kNdown;l++) foundD = ( buffer[j][k][l]<=buffer[j][k][l-1] && buffer[j][k][l  ] ) ? 1 : 0; 
+                               int foundPeak = 0;
+                               int sum       = 0;
+                               
+                               for (int l = 0; l < sizeX; l++) {
+                                       for (int m = 0; m < sizeY; m++) {
+                                               sum += fRegion[j + l][k + m];
+                                               
+                                               if ((patt[j + l][k + m] & mask) == pattern) foundPeak++;
+                                       }
+                               }
+                               
+                               if (sum > int(fDCSConfig->GetGTHRL0())) othr[j][k] = sum;
                
-                               if ( foundU && foundD ) 
-                               {
-                                       peaks[j][k] = 1;
-                                       nPeaks++;
+                               if (foundPeak && othr[j][k]) {
+                                       
+                                       new((*fPatches)[fPatches->GetEntriesFast()]) AliEMCALTriggerPatch(j, k, othr[j][k], i);
+                                       
+                                       AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)fPatches->At(fPatches->GetEntriesFast() - 1);
+                                       
+                                       if (AliDebugLevel()) p->Print("");
+                                       
+                                       const Int_t psize =  sizeX * sizeY; // Number of FastOR in the patch
+                                       
+                                       Int_t* idx = new Int_t[psize];
+                                       
+                                       for (Int_t l = 0; l < sizeX; l++) 
+                                       {
+                                               for (Int_t m = 0; m < sizeY; m++) 
+                                               {   
+                                                       Int_t index = l * sizeY + m;
+                                                       
+                                                       idx[index] = fMap[int(j * fSubRegionSize->X()) + l][int(k * fSubRegionSize->Y()) + m];
+                                                       
+                                                       if ((patt[j + l][k + m] & mask) == pattern) {
+//                                                             cout << "setting peak at " << l << " " << m << endl;
+                                                               p->SetPeak(l, m, sizeX, sizeY);
+                                                       }
+                                                       
+                                                       if (AliDebugLevel() >= 999) ShowFastOR(i, idx[index]);
+                                               }
+                                       }
+                                       
+                                       delete [] idx;
                                }
                        }
                }
+               
+               if (fPatches->GetEntriesFast() && !fL0Time) {                   
+                       // Stop the algo when at least one patch is found ( thres & max )
+                       fL0Time = i;
 
-               if (!nPeaks)
-               {
-                       ZeroRegion();
+//                     break;
+               }
+               
+               for (int j = 0; j < xsize; j++)         
+                       for (int k = 0; k < ysize; k++) patt[j][k] <<= 1;
+       }
+       
+       for (Int_t x = 0; x < xsize; x++) {
+               delete [] othr[x];
+               delete [] patt[x];
+               delete [] buff[x];
+       }
 
-                       for (Int_t x = 0; x < xsize; x++)
-                       {
-                         delete [] peaks[x];
-                       }
-                       delete [] peaks;
+       delete [] othr;
+       delete [] patt;
+       delete [] buff;
 
-                       continue;
-               }
+       return fPatches->GetEntriesFast();
+}
+
+//________________
+Int_t AliEMCALTriggerTRU::L0v1(int mask, int pattern)
+{
+       // L0 issuing condition is: (4x4 PF) AND (4x4 > thres)
+       
+       AliDebug(999,"=== Running TRU L0 algorithm version 1 ===");
+       
+       const Int_t xsize    = Int_t(fRegionSize->X());
+       const Int_t ysize    = Int_t(fRegionSize->Y());
                
-               // Threshold 
-               // FIXME: for now consider just one threshold for all patches, should consider one per patch?
-               // ANSWE: both solutions will be implemented in the TRU
-               // return the list of patches above threshold
-               // Theshold checked out from OCDB
+       Int_t **othr = new Int_t*[xsize];
+       Int_t **buff = new Int_t*[xsize];
+       Int_t **patt = new Int_t*[xsize];
+       
+       for (Int_t i = 0; i < xsize; i++) {
+               buff[i] = new Int_t[ysize];
+               patt[i] = new Int_t[ysize];
+               othr[i] = new Int_t[ysize];
+       }
+       
+       for (Int_t i = 0; i < xsize; i++) for (Int_t j = 0; j < ysize; j++) {
+               othr[i][j] = 0;
+               patt[i][j] = 0;
+               buff[i][j] = 0;
+       }
+       
+       // Time sliding window algorithm
+       for (Int_t i = 0; i <= (kTimeBins - kTimeWindowSize); i++) {
                
-               SlidingWindow(kL0, fDCSConfig->GetGTHRL0(), i);
+               AliDebug(999,Form("----------- Time window: %d\n",i));
                
-//             for(Int_t j=0; j<fRegionSize->X(); j++)
-//                     for (Int_t k=0; k<fRegionSize->Y(); k++) fRegion[j][k] = fRegion[j][k]>>2; // go to 12b before shipping to STU
+               for (int j = 0; j < xsize; j++) {               
+                       for (int k = 0; k < ysize; k++) {
+                               
+//                             if (
+//                                     !(j % int(fSubRegionSize->X())) 
+//                                     && 
+//                                     !(k % int(fSubRegionSize->Y())) 
+//                                     && 
+//                                     (j + int(fPatchSize->X() * fSubRegionSize->X()) <= xsize)
+//                                     && 
+//                                     (k + int(fPatchSize->Y() * fSubRegionSize->Y()) <= ysize)
+//                                     ) 
+//                             {
+//                                     int sum = 0;
+//                                     
+//                                     for (int l = 0; l < int(fPatchSize->X() * fSubRegionSize->X()); l++) 
+//                                             for (int m = 0; m < int(fPatchSize->Y() * fSubRegionSize->Y()); m++) sum += fRegion[j + l][k + m];
+//                                     
+//                                     if (sum > buff[j][k]) patt[j][k] |= 0x1;
+//                                     
+//                                     AliDebug(999,Form("----------- Patch (%2d,%2d) has sum %d while its whole time pattern is %x\n", j, k, sum, patt[j][k]));
+//                                     
+//                                     buff[j][k] = sum;
+//                                     
+//                                     if (sum > int(fDCSConfig->GetGTHRL0())) {
+//                                             AliDebug(999,Form("----------- Patch (%2d,%2d) is over threshold\n", j, k));
+//                                             othr[j][k] = sum;
+//                                     }
+//                             }
+                               
+                               fRegion[j][k] = 0;
+                               for (Int_t l = i; l < i + kTimeWindowSize; l++) fRegion[j][k] += fADC[fMap[j][k]][l];   
+                       }
+               }
                
-               for (Int_t j=0; j<fPatches->GetEntriesFast(); j++)
-               {
-                       AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)fPatches->At( j );
-
-                       if ( AliDebugLevel() ) p->Print("");
-
-                       TVector2 v; p->Position(v);
-                       
-                       Int_t sizeX = (Int_t)(fPatchSize->X() * fSubRegionSize->X());
-                       
-                       Int_t sizeY = (Int_t)(fPatchSize->Y() * fSubRegionSize->Y());
-                       
-                       const Int_t psize =  sizeX * sizeY; // Number of FastOR in the patch
-                       
-                       Int_t foundPeak = 0;
-                       
-                       Int_t* idx = new Int_t[psize];
-                       
-                       for (Int_t xx=0;xx<sizeX;xx++) 
-                       {
-                               for (Int_t yy=0;yy<sizeY;yy++) 
-                               {   
-                                       Int_t index = xx*sizeY+yy;
+               for (int j = 0; j <= int(fRegionSize->X() - fPatchSize->X() * fSubRegionSize->X()); j += int(fSubRegionSize->X())) {
+                       for (int k = 0; k <= int(fRegionSize->Y() - fPatchSize->Y() * fSubRegionSize->Y()); k += int(fSubRegionSize->Y())) {
                                        
-                                       idx[index] = fMap[int(v.X()*fSubRegionSize->X())+xx][int(v.Y()*fSubRegionSize->Y())+yy]; // Get current patch FastOR ADC channels 
+                               int sum = 0;
+                               
+                               for (int l = 0; l < int(fPatchSize->X() * fSubRegionSize->X()); l++) 
+                                       for (int m = 0; m < int(fPatchSize->Y() * fSubRegionSize->Y()); m++) sum += fRegion[j + l][k + m];
+                               
+                               if (sum > buff[j][k]) patt[j][k] |= 0x1;
+                               
+                               if (sum > int(fDCSConfig->GetGTHRL0())) {
+                                       AliDebug(999,Form("----------- Patch (%2d,%2d) is over threshold\n", j, k));
                                        
-                                       if (peaks[int(v.X() * fSubRegionSize->X()) + xx][int(v.Y() * fSubRegionSize->Y()) + yy]) 
-                                       {
-                                               foundPeak++;
-                                               
-                                               p->SetPeak(xx, yy, sizeX, sizeY);
+                                       othr[j][k] = sum;
+                               }
+                               
+                               AliDebug(999,Form("----------- Patch (%2d,%2d) has sum %d while its whole time pattern is %x\n", j, k, sum, patt[j][k]));
+                               
+                               buff[j][k] = sum;
+                               
+                               if (othr[j][k] && (patt[j][k] & mask) == pattern) {
+                                       
+                                       new((*fPatches)[fPatches->GetEntriesFast()]) AliEMCALTriggerPatch(j, k, othr[j][k], i);
+                                       
+//                                     AliDebug(999,Form("=== New L0 patch at (%2d,%2d) time: %2d",j, k, i));
+                                       
+                                       int sizeX = int(fPatchSize->X() * fSubRegionSize->X());                                 
+                                       int sizeY = int(fPatchSize->Y() * fSubRegionSize->Y());
+                                       
+                                       for (int xx = 0; xx < sizeX; xx++) {
+                                               for (int yy = 0; yy < sizeY; yy++) {
+                                                       ((AliEMCALTriggerPatch*)fPatches->At(fPatches->GetEntriesFast() - 1))->SetPeak(xx, yy, sizeX, sizeY);
+                                               }
                                        }
                                        
-                                       if (AliDebugLevel() >= 999) ShowFastOR(i, idx[index]);
+                                       AliEMCALTriggerPatch* p = (AliEMCALTriggerPatch*)fPatches->At(fPatches->GetEntriesFast() - 1);
+                                       
+                                       if (AliDebugLevel()) p->Print("");
                                }
                        }
-                       
-                       delete [] idx;
-
-                       if ( !foundPeak ) 
-                       {
-                               fPatches->RemoveAt( j );
-                               fPatches->Compress();
-                       }
                }
                
-               //Delete, avoid leak
-               for (Int_t x = 0; x < xsize; x++)
-               {
-                       delete [] peaks[x];
-               }
-               delete [] peaks;
-
-               if ( !fPatches->GetEntriesFast() ) // No patch left
-                       ZeroRegion();
-               else                             // Stop the algo when at least one patch is found ( thres & max )
-               {
+               if (fPatches->GetEntriesFast() && !fL0Time) {
                        fL0Time = i;
                        
-                       for (Int_t xx = 0; xx < fRegionSize->X(); xx++) 
-                       {
-                               for (Int_t yy = 0; yy < fRegionSize->Y(); yy++) 
-                               {   
-                                       // Prepare data to be sent to STU for further L1 processing
-                                       // Sent time sum (rollback tuning) is the one before L0 is issued (maximum time sum)
-                                       fRegion[xx][yy] = buffer[xx][yy][1];
-                               }
-                       }
-                       
-                       break;
-               }               
+//                     break;
+               } 
+               
+               for (int j = 0; j < xsize; j++)         
+                       for (int k = 0; k < ysize; k++) patt[j][k] <<= 1;
        }
        
-       //Delete, avoid leak
-       for (Int_t x = 0; x < xsize; x++)
-       {
-               for (Int_t y = 0; y < ysize; y++)
-               {
-                       delete [] buffer[x][y];
-               }
-               delete [] buffer[x];
+       for (Int_t x = 0; x < xsize; x++) {
+               delete [] othr[x];
+               delete [] patt[x];
+               delete [] buff[x];
        }
-       delete [] buffer;
+       
+       delete [] othr;
+       delete [] patt;
+       delete [] buff;
        
        return fPatches->GetEntriesFast();
 }
@@ -346,14 +463,14 @@ void AliEMCALTriggerTRU::SetADC( Int_t channel, Int_t bin, Int_t sig )
     AliError("TRU has 96 ADC channels and 256 bins only!");
   }
   else{ 
-    fADC[channel][bin] = sig;
+       if (((fDCSConfig->GetMaskReg(int(channel / 16)) >> (channel % 16)) & 0x1) == 0) fADC[channel][bin] = sig;
   }
 }
 
 //________________
 void AliEMCALTriggerTRU::GetL0Region(const int time, Int_t arr[][4])
 {
-       Int_t r0 = time + fDCSConfig->GetRLBKSTU();
+       Int_t r0 = time - fDCSConfig->GetRLBKSTU();
        
        if (r0 < 0) 
        {
index 7a3ee26f1261b95021165f3f9cfb1cb67af95ad5..51336f09f7743ba582e2f54a9b0441994710ccf4 100644 (file)
@@ -24,6 +24,8 @@ public:
        virtual       ~AliEMCALTriggerTRU();
        
        virtual Int_t  L0();
+       virtual Int_t  L0v0(int mask, int pattern);
+       virtual Int_t  L0v1(int mask, int pattern);
        virtual void   SetADC(Int_t channel, Int_t bin, Int_t sig );
        virtual void   SaveRegionADC(Int_t iTRU, Int_t iEvent);
        virtual void   Reset();
index ddc2ab8b4a262118977134e36c836651ed3a0adb..e3811df29dcfddf4a8d2089b49d683a52b86d9c9 100644 (file)
@@ -28,11 +28,12 @@ ClassImp(AliEMCALTriggerTRUDCSConfig)
   
 //_____________________________________________________________________________
 AliEMCALTriggerTRUDCSConfig::AliEMCALTriggerTRUDCSConfig() : TObject()
-,fSELPF(0)
-,fL0SEL(0)
+,fSELPF(0x1e1f)
+,fL0SEL(0x1)
 ,fL0COSM(0)
 ,fGTHRL0(0)
 ,fRLBKSTU(0)
+,fFw(0x21)
 {
        //
        // AliEMCALTriggerTRUDCSConfig default constructor
index d073a67ef813bf86630986f5df8bbfa5cab46e28..a5afc07ad00609329895f51bcee860caa1c3db01 100644 (file)
@@ -27,6 +27,7 @@ public:
        void    SetGTHRL0( UInt_t lg)              { fGTHRL0 = lg;        }
        void    SetMaskReg(UInt_t msk, Int_t pos)  { fMaskReg[pos] = msk; }
        void    SetRLBKSTU(UInt_t rb)              { fRLBKSTU = rb;       }
+       void    SetFw(     UInt_t fw)              { fFw = fw;            }
                        
        UInt_t   GetSELPF()                       const { return fSELPF;        }
        UInt_t   GetL0SEL()                       const { return fL0SEL;        }
@@ -34,7 +35,8 @@ public:
        UInt_t   GetGTHRL0()                      const { return fGTHRL0;       }
        UInt_t   GetMaskReg(Int_t pos)            const { return fMaskReg[pos]; }
        UInt_t   GetRLBKSTU()                     const { return fRLBKSTU;      }
-                       
+       UInt_t   GetFw()                          const { return fFw;           }
+       
        Int_t    GetSegmentation();
        
 protected:
@@ -50,6 +52,7 @@ private:
        UInt_t   fGTHRL0;                        // 4x4
        UInt_t   fMaskReg[6];                    // 6*16 = 96 mask bits per TRU
        UInt_t   fRLBKSTU;                       // TRU circular buffer rollback
+       UInt_t   fFw;                            // TRU fw version
        
        ClassDef(AliEMCALTriggerTRUDCSConfig,3)  //
 };
index 9134b28de76701882fd18ca540d56599c4f36a6a..121f36127aada49529a6c74a6f8c9f8dc215e99a 100644 (file)
@@ -9,6 +9,6 @@
  Author: R. GUERNANE LPSC Grenoble CNRS/IN2P3
  */
 
-typedef enum {kL0 = 0, kL1Gamma, kL1Jet, kTriggerTypeEnd} TriggerType_t;
+typedef enum {kL0 = 0, kL1GammaHigh, kL1GammaLow, kL1JetHigh, kL1JetLow, kTriggerTypeEnd} TriggerType_t;
 
 #endif
index 2b55b2421af836ed2b7b3929fb3f2b255758b37d..bed86d74ba8fd4257d537ad76e107a779ab1b679 100644 (file)
@@ -113,7 +113,7 @@ void emcal_digits()
       amp  = dig->GetAmp(); //amplitude in cell (digit)
       time = dig->GetTime();//time of creation of digit after collision
 
-      AliDebugGeneral("emcal_digits", 5, Form("Cell ID %3d, Amplitude: %f", id, amp));
+//      AliDebugGeneral("emcal_digits", 5, Form("Cell ID %3d, Amplitude: %f", id, amp));
       // cout<<"Cell ID "<<id<<" Amp "<<amp<<endl;//" time "<<time<<endl;
 
       //Geometry methods
@@ -123,15 +123,15 @@ void emcal_digits()
                                        iIphi, iIeta,iphi,ieta);
       //Gives label of cell in eta-phi position per each supermodule
 
-      AliDebugGeneral("emcal_digits", 5, Form("SModule %3d; Tover %3d; Eta %3d; Phi %3d; Cell Eta %3d; Cell Phi %3d",
-                      iSupMod, iTower, iIeta, iIphi, ieta, iphi));
+//      AliDebugGeneral("emcal_digits", 5, Form("SModule %3d; Tover %3d; Eta %3d; Phi %3d; Cell Eta %3d; Cell Phi %3d",
+//                    iSupMod, iTower, iIeta, iIphi, ieta, iphi));
       // cout<< "SModule "<<iSupMod<<"; Tower "<<iTower
       //     <<"; Eta "<<iIeta<<"; Phi "<<iIphi
       //     <<"; Cell Eta "<<ieta<<"; Cell Phi "<<iphi<<endl;
 
       geom->RelPosCellInSModule(id, x, y, z);
       // cout << x <<" "<< y <<" "<< z <<endl;
-      AliDebugGeneral("emcal_digits", 5, Form("(x,y,z)=(%8.3f,%8.3f,%8.3f)", x, y, z));
+//      AliDebugGeneral("emcal_digits", 5, Form("(x,y,z)=(%8.3f,%8.3f,%8.3f)", x, y, z));
 
       TEveQuadSet* q = smodules[iSupMod];
       if (q) {
@@ -140,7 +140,7 @@ void emcal_digits()
        q->QuadId(new AliEMCALDigit(*dig));
       }
     } else {
-      AliDebugGeneral("emcal_digits", 1, Form("Digit pointer 0x0"));
+//      AliDebugGeneral("emcal_digits", 1, Form("Digit pointer 0x0"));
       // cout<<"Digit pointer 0x0"<<endl;
     }
   }
index 2bd46d514a49d1691ac59456e489c3cee4ee89ca..beac72ba3b018718a7a8fc71d0f775d6c87cc1d3 100644 (file)
@@ -1196,7 +1196,7 @@ void AliAnalysisTaskEMCALTriggerQA::UserExec(Option_t *)
       totSTU += ts;
       
       //L1-Gamma
-      if (bit >> 4 & 0x1) 
+      if (bit >> 6 & 0x1) 
       {
         nL1Patch ++;
         emcalPatchL1G[posY][posX] += 1.;
@@ -1208,7 +1208,7 @@ void AliAnalysisTaskEMCALTriggerQA::UserExec(Option_t *)
       }
       
       //L1-Jet
-      if (bit >> 5 & 0x1) 
+      if (bit >> 8 & 0x1) 
       {
         nL1Patch ++;
         emcalPatchL1J[posY][posX] += 1.;
index e36a883e158a0d743414fb92f5e8a1d6fd7cd01e..93abe0d4e3ed300d35e59cd2b2f311476c34d1f2 100644 (file)
@@ -47,7 +47,7 @@ fL1V0(),
 fL1FrameMask(0)
 {
        //
-       fL1Threshold[0] = fL1Threshold[1] = 0;
+       for (int i = 0; i < 4; i++) fL1Threshold[i] = 0;
        fL1V0[0] = fL1V0[1] = 0;
 }
 
@@ -299,6 +299,7 @@ void AliAODCaloTrigger::Print(const Option_t* /*opt*/) const
        printf(")\n");
        printf("--L1:\n");
        printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
-       printf("\tTHRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
+       printf("\tHIGH THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
+       printf("\tLOW THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[2], fL1Threshold[3]);
        printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);
 }      
index 19172439367c9a179494b53bc5adb1e18a54169a..312f276b7e849fa48c2daeceb9509fc7b1ef9332 100644 (file)
@@ -73,12 +73,12 @@ private:
        Int_t*   fL1TimeSum;      // [fNEntries]
        Int_t*   fTriggerBits;    // [fNEntries]
        
-       Int_t    fL1Threshold[2]; // L1 thresholds from raw data
+       Int_t    fL1Threshold[4]; // L1 thresholds from raw data
        Int_t    fL1V0[2];        // L1 threshold components
        Int_t    fL1FrameMask;    // Validation flag for L1 data
        
        
-       ClassDef(AliAODCaloTrigger, 1)
+       ClassDef(AliAODCaloTrigger, 2)
 };
 #endif
 
index 5f30acc4a775f87389d6bcfe6a3d5d2ae7ea37f3..0b7d075da7735eb53a5414e04d34175ea47f4f51 100644 (file)
@@ -47,7 +47,7 @@ fL1V0(),
 fL1FrameMask(0)
 {
        //
-       fL1Threshold[0] = fL1Threshold[1] = 0;
+       for (int i = 0; i < 4; i++) fL1Threshold[i] = 0;
        fL1V0[0] = fL1V0[1] = 0;        
 }
 
@@ -127,8 +127,8 @@ void AliESDCaloTrigger::Copy(TObject &obj) const
                dest.Add(fColumn[i], fRow[i], fAmplitude[i], fTime[i], times, fNL0Times[i], fL1TimeSum[i], fTriggerBits[i]);
        }       
 
-       dest.SetL1Threshold(0, fL1Threshold[0]);
-       dest.SetL1Threshold(1, fL1Threshold[1]);
+       for (int i = 0; i < 4; i++) dest.SetL1Threshold(i, fL1Threshold[i]);
+       
        dest.SetL1V0(fL1V0);
        dest.SetL1FrameMask(fL1FrameMask);
 }
@@ -288,6 +288,7 @@ void AliESDCaloTrigger::Print(const Option_t* /*opt*/) const
        printf(")\n");
        printf("--L1:\n");
        printf("\tTIME SUM: %4d\n", fL1TimeSum[fCurrent]);
-       printf("\tTHRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
+       printf("\tHIGH THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[0], fL1Threshold[1]);
+       printf("\tLOW THRESHOLDS (GAMMA: %4d, JET: %4d)\n", fL1Threshold[2], fL1Threshold[3]);
        printf("--TRIGGER BITS: 0x%x\n", fTriggerBits[fCurrent]);
 }      
index cfa3049f65a239ee89778a9cf8699359b6d34c04..5c216707ca3711c0ea37810e019917ac9e9888be 100644 (file)
@@ -72,12 +72,12 @@ private:
        Int_t*   fL1TimeSum;      // [fNEntries]
        Int_t*   fTriggerBits;    // [fNEntries]
        
-       Int_t    fL1Threshold[2]; // L1 thresholds from raw data
+       Int_t    fL1Threshold[4]; // L1 thresholds from raw data
        Int_t    fL1V0[2];        // L1 threshold components
        Int_t    fL1FrameMask;    // Validation flag for L1 data
        
        
-       ClassDef(AliESDCaloTrigger, 4)
+       ClassDef(AliESDCaloTrigger, 5)
 };
 #endif
 
index e24b1efdcdd69cc86279eaf9c7d41610764c1f26..e6fdc9e333b29acccb79b842026a3f4a04807133 100644 (file)
@@ -106,7 +106,7 @@ public:
   void       SetT0spread(Int_t i, Float_t t);
   void       SetT0spread(Float_t *t);
        
-  void       SetCaloTriggerType(const Int_t* in) {for (int i = 0; i < 8; i++) fCaloTriggerType[i] = in[i];}
+  void       SetCaloTriggerType(const Int_t* in) {for (int i = 0; i < 15; i++) fCaloTriggerType[i] = in[i];}
   Int_t*     GetCaloTriggerType() {return fCaloTriggerType;}
 
   void           SetVZEROEqFactors(Float_t factors[64]) {for (Int_t i = 0; i < 64; ++i) fVZEROEqFactors[i] = factors[i];}
@@ -134,10 +134,10 @@ private:
   TGeoHMatrix*    fPHOSMatrix[kNPHOSMatrix]; //PHOS module position and orientation matrices
   TGeoHMatrix*    fEMCALMatrix[kNEMCALMatrix]; //EMCAL supermodule position and orientation matrices
   Float_t         fT0spread[kT0spreadSize];     // spread of time distributions on T0A, T0C, (T0A+T0C)/2, (T0A-T0C)/2
-  Int_t           fCaloTriggerType[8]; // Calorimeter trigger type
+  Int_t           fCaloTriggerType[15]; // Calorimeter trigger type
   Float_t         fVZEROEqFactors[64]; // V0 channel equalization factors for event-plane reconstruction
        
-  ClassDef(AliESDRun,13)
+  ClassDef(AliESDRun,14)
 };
 
 #endif