]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - EMCAL/AliEMCALTrigger.cxx
Updates D+ syst err
[u/mrichter/AliRoot.git] / EMCAL / AliEMCALTrigger.cxx
index 933d7fb0d3b0d7f672cd71a04f560f9442582fc5..68bd95b2bb6e7f998fcf5debc72022bb74243222 100644 (file)
 #include "AliEMCALGeometry.h"
 #include "AliEMCALRawUtils.h"
 #include "AliLog.h"
+#include "AliCaloConstants.h"
+#include "AliEMCALRawResponse.h"
+
+using namespace CALO;
 
 ClassImp(AliEMCALTrigger)
 
@@ -123,58 +127,6 @@ AliEMCALTrigger::AliEMCALTrigger()
    //Print("") ; 
 }
 
-
-
-//____________________________________________________________________________
-AliEMCALTrigger::AliEMCALTrigger(const AliEMCALTrigger & trig) 
-  : AliTriggerDetector(trig),
-    fGeom(trig.fGeom),
-    f2x2MaxAmp(trig.f2x2MaxAmp), 
-    f2x2ModulePhi(trig.f2x2ModulePhi),  
-    f2x2ModuleEta(trig.f2x2ModuleEta),
-    f2x2SM(trig.f2x2SM),
-    fnxnMaxAmp(trig.fnxnMaxAmp), 
-    fnxnModulePhi(trig.fnxnModulePhi),  
-    fnxnModuleEta(trig.fnxnModuleEta),
-    fnxnSM(trig.fnxnSM),
-    fADCValuesHighnxn(trig.fADCValuesHighnxn),
-    fADCValuesLownxn(trig.fADCValuesLownxn),
-    fADCValuesHigh2x2(trig.fADCValuesHigh2x2),
-    fADCValuesLow2x2(trig.fADCValuesLow2x2),
-    fDigitsList(trig.fDigitsList),
-    fL0Threshold(trig.fL0Threshold),
-    fL1GammaLowPtThreshold(trig.fL1GammaLowPtThreshold),
-    fL1GammaMediumPtThreshold(trig.fL1GammaMediumPtThreshold), 
-    fL1GammaHighPtThreshold(trig.fL1GammaHighPtThreshold),
-    fPatchSize(trig.fPatchSize),
-    fIsolPatchSize(trig.fIsolPatchSize), 
-    f2x2AmpOutOfPatch(trig.f2x2AmpOutOfPatch), 
-    fnxnAmpOutOfPatch(trig.fnxnAmpOutOfPatch), 
-    f2x2AmpOutOfPatchThres(trig.f2x2AmpOutOfPatchThres),  
-    fnxnAmpOutOfPatchThres(trig.fnxnAmpOutOfPatchThres), 
-    fIs2x2Isol(trig.fIs2x2Isol),
-    fIsnxnIsol(trig.fIsnxnIsol),  
-    fSimulation(trig.fSimulation),
-    fIsolateInSuperModule(trig.fIsolateInSuperModule),
-    fTimeKey(trig.fTimeKey),
-    fAmpTrus(trig.fAmpTrus),
-    fTimeRtrus(trig.fTimeRtrus),
-    fAmpSMods(trig.fAmpSMods),
-    fTriggerPosition(trig.fTriggerPosition),
-    fTriggerAmplitudes(trig.fTriggerAmplitudes),
-    fNJetPatchPhi(trig.fNJetPatchPhi), 
-    fNJetPatchEta(trig.fNJetPatchEta), 
-    fNJetThreshold(trig.fNJetThreshold),
-    fL1JetThreshold(trig.fL1JetThreshold), 
-    fJetMaxAmp(trig.fJetMaxAmp),
-    fAmpJetMatrix(trig.fAmpJetMatrix),
-    fJetMatrixE(trig.fJetMatrixE),
-    fAmpJetMax(trig.fAmpJetMax),
-    fVZER0Mult(trig.fVZER0Mult)
-{
-  // cpy ctor
-}
-
 //____________________________________________________________________________
 AliEMCALTrigger::~AliEMCALTrigger() {
        
@@ -244,7 +196,8 @@ Bool_t AliEMCALTrigger::IsPatchIsolated(Int_t iPatchType, const TClonesArray * a
   //                            1             4x4                      8x8               
                           
   Bool_t b = kFALSE;
+  if(!ampmatrixes) return kFALSE;
+  
   // Get matrix of TRU or Module with maximum amplitude patch.
   Int_t itru = mtru + iSM * fGeom->GetNTRU(); //number of tru, min 0 max 3*12=36.
   TMatrixD * ampmatrix   = 0x0;
@@ -266,7 +219,7 @@ Bool_t AliEMCALTrigger::IsPatchIsolated(Int_t iPatchType, const TClonesArray * a
   }
   if(iSM>9) rowborder /= 2; // half size in phi
   
-  if(!ampmatrixes){
+  if(!ampmatrixes || !ampmatrix){
     AliError("Could not recover the matrix with the amplitudes");
     return kFALSE;
   }
@@ -470,7 +423,7 @@ void AliEMCALTrigger::MakeSlidingTowers(const TClonesArray * amptrus, const TClo
     Int_t mtru = itru - isupermod*nTRU ; // Number of TRU in Supermodule !!
     
     if(!amptru || !timeRtru){
-      AliError("Amplitude or Time TRU matrix not available")
+      AliError("Amplitude or Time TRU matrix not available");
       return;
     }
     
@@ -636,7 +589,8 @@ void AliEMCALTrigger::SetTriggers(const TClonesArray * ampmatrix,const Int_t iSM
   Float_t maxtimeR2 = -1 ;
   Float_t maxtimeRn = -1 ;
   static AliEMCALRawUtils rawUtil;
-  Int_t nTimeBins = rawUtil.GetRawFormatTimeBins() ;
+  // Int_t nTimeBins = rawUtil.GetRawFormatTimeBins() ;
+  Int_t nTimeBins = TIMEBINS;  //changed by PTH
 
   //Set max of 2x2 amplitudes and select L0 trigger
   if(max2[0] > f2x2MaxAmp ){
@@ -663,9 +617,15 @@ void AliEMCALTrigger::SetTriggers(const TClonesArray * ampmatrix,const Int_t iSM
         fADCValuesHigh2x2 = new Int_t[nTimeBins];
       }
       //printf(" maxtimeR2 %12.5e (1)\n", maxtimeR2);
-      rawUtil.RawSampledResponse(maxtimeR2 * AliEMCALRawUtils::GetRawFormatTimeBin(), 
-      f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
-    
+      //  rawUtil.RawSampledResponse(maxtimeR2 * AliEMCALRawUtils::GetRawFormatTimeBin(), 
+      //                                f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
+       
+      //  rawUtil.RawSampledResponse(maxtimeR2*TIMEBINMAX/TIMEBINS, 
+      //                                f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
+      
+      AliEMCALRawResponse::RawSampledResponse( maxtimeR2*TIMEBINMAX/TIMEBINS, 
+                                              f2x2MaxAmp, fADCValuesHigh2x2, fADCValuesLow2x2) ; 
+
     // Set Trigger Inputs, compare ADC time bins until threshold is attained
     // Set L0
       for(Int_t i = 0 ; i < nTimeBins ; i++){
@@ -705,9 +665,15 @@ void AliEMCALTrigger::SetTriggers(const TClonesArray * ampmatrix,const Int_t iSM
         fADCValuesHighnxn = new Int_t[nTimeBins];
         fADCValuesLownxn  = new Int_t[nTimeBins];
       }
-      rawUtil.RawSampledResponse(maxtimeRn * AliEMCALRawUtils::GetRawFormatTimeBin(), 
-      fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
-    
+      //  rawUtil.RawSampledResponse(maxtimeRn * AliEMCALRawUtils::GetRawFormatTimeBin(), 
+      //   fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
+
+      //rawUtil.RawSampledResponse(maxtimeRn*TIMEBINMAX/TIMEBINS, 
+      //                                fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
+
+      AliEMCALRawResponse::RawSampledResponse (maxtimeRn*TIMEBINMAX/TIMEBINS, 
+                                              fnxnMaxAmp, fADCValuesHighnxn, fADCValuesLownxn) ;
+      
     //Set Trigger Inputs, compare ADC time bins until threshold is attained
     //SetL1 Low
       for(Int_t i = 0 ; i < nTimeBins ; i++){
@@ -856,19 +822,20 @@ void AliEMCALTrigger::FillTRU(const TClonesArray * digits, TClonesArray * ampmat
       TMatrixD * amptrus   = dynamic_cast<TMatrixD *>(ampmatrix->At(itru)) ;
       TMatrixD * timeRtrus = dynamic_cast<TMatrixD *>(timeRmatrix->At(itru)) ;
       
-      if(!amptrus || timeRtrus){
+      if(!amptrus || !timeRtrus){
         AliError("Could not recover the TRU matrix with amplitudes or times");
-        continue;
       }
-      //Calculate row and column of the module inside the TRU with number itru
-      Int_t irow = iphim - row * nModulesPhi;
-      if(iSupMod > 9)
-        irow = iphim - row *  nModulesPhi2; // size of matrix the same
-      Int_t icol = ietam - col * nModulesEta;
+      else{
+        //Calculate row and column of the module inside the TRU with number itru
+        Int_t irow = iphim - row * nModulesPhi;
+        if(iSupMod > 9)
+          irow = iphim - row *  nModulesPhi2; // size of matrix the same
+        Int_t icol = ietam - col * nModulesEta;
       
-      (*amptrus)(irow,icol)  += amp ;
-      if((*timeRtrus)(irow,icol) <0.0 || (*timeRtrus)(irow,icol) <= timeR){ // ??
-        (*timeRtrus)(irow,icol) = timeR ;
+        (*amptrus)(irow,icol)  += amp ;
+        if((*timeRtrus)(irow,icol) <0.0 || (*timeRtrus)(irow,icol) <= timeR){ // ??
+          (*timeRtrus)(irow,icol) = timeR ;
+        }
       }
       //printf(" ieta %i iphi %i iSM %i || col %i row %i : itru %i -> amp %f\n", 
       //          ieta, iphi, iSupMod, col, row, itru, amp);