]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Add method to check if a MC particle hits the calorimeters realistic acceptance
authorgconesab <gustavo.conesa.balbastre@cern.ch>
Thu, 31 Jul 2014 08:11:59 +0000 (10:11 +0200)
committergconesab <gustavo.conesa.balbastre@cern.ch>
Thu, 31 Jul 2014 13:58:08 +0000 (15:58 +0200)
PWG/CaloTrackCorrBase/AliCalorimeterUtils.cxx
PWG/CaloTrackCorrBase/AliCalorimeterUtils.h

index 83f62d624284abc1c8113e6d7444f693cbe9f9c6..9fbbc8dfb6ee573a388e8922e93c134b8c26b577 100755 (executable)
@@ -29,6 +29,7 @@
 #include <TStyle.h>
 #include <TPad.h>
 #include <TFile.h>
+#include <TParticle.h>
 
 // --- ANALYSIS system ---
 #include "AliCalorimeterUtils.h"
@@ -42,6 +43,7 @@
 #include "AliAODCaloCluster.h"
 #include "AliOADBContainer.h"
 #include "AliAnalysisManager.h"
+#include "AliAODMCParticle.h"
 
 // --- Detector ---
 #include "AliEMCALGeometry.h"
@@ -559,7 +561,6 @@ Bool_t AliCalorimeterUtils::IsClusterSharedByTwoSuperModules(const AliEMCALGeome
   
 }
 
-
 //_____________________________________________________________________________________
 Bool_t AliCalorimeterUtils::CheckCellFiducialRegion(AliVCluster* cluster, 
                                                     AliVCaloCells* cells, 
@@ -1420,6 +1421,72 @@ void AliCalorimeterUtils::InitPHOSGeometry(Int_t runnumber)
        }       
 }
 
+//_______________________________________________________________________________________________
+Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, TParticle* particle)
+{
+  // Check that a MC ESD is in the calorimeter acceptance
+  
+  if( (!IsPHOSGeoMatrixSet() && calo == "PHOS" ) ||
+     (!IsPHOSGeoMatrixSet() && calo == "EMCAL")   )
+  {
+    AliFatal(Form("Careful Geo Matrix for %s is not set, use AliFidutialCut instead \n",calo.Data()));
+    return kFALSE ;
+  }
+  
+  if(calo == "PHOS" )
+  {
+    Int_t mod = 0 ;
+    Double_t x = 0, z = 0 ;
+    
+    return GetPHOSGeometry()->ImpactOnEmc( particle, mod, z, x);
+  }
+  else if(calo == "EMCAL")
+  {
+    Int_t absID = 0 ;
+    
+    GetEMCALGeometry()->GetAbsCellIdFromEtaPhi( particle->Eta(), particle->Phi(), absID);
+    
+    if( absID >= 0) return kTRUE  ;
+    else            return kFALSE ;
+  }
+  
+  return kFALSE ;
+}
+
+//______________________________________________________________________________________________________
+Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, AliAODMCParticle* particle)
+{
+  // Check that a MC AOD is in the calorimeter acceptance
+  
+  if( (!IsPHOSGeoMatrixSet() && calo == "PHOS" ) ||
+      (!IsPHOSGeoMatrixSet() && calo == "EMCAL")   )
+  {
+    AliFatal(Form("Careful Geo Matrix for %s is not set, use AliFidutialCut instead \n",calo.Data()));
+    return kFALSE ;
+  }
+
+  if(calo == "PHOS" )
+  {
+    Int_t mod = 0 ;
+    Double_t x = 0, z = 0 ;
+    
+    Double_t vtx[]={ particle->Xv(), particle->Yv(), particle->Zv() } ;
+    
+    return GetPHOSGeometry()->ImpactOnEmc(vtx, particle->Theta(), particle->Phi(), mod, z, x) ;
+  }
+  else if(calo == "EMCAL")
+  {
+    Int_t absID = 0 ;
+    
+    GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle->Eta(),particle->Phi(),absID);
+    
+    if( absID >= 0) return kTRUE  ;
+    else            return kFALSE ;
+  }
+  
+  return kFALSE ;
+}
+
 //_______________________________________________________________________
 Bool_t AliCalorimeterUtils::MaskFrameCluster(Int_t iSM, Int_t ieta) const
 {
index 58dbca8ebed559daa7e19b657ec2760b4dcf99fc..304e0490fd27431a9163f1fcd3d931a9496a26c4 100755 (executable)
@@ -27,6 +27,9 @@ class AliAODCaloCluster;
 class AliVCaloCells;
 class AliPHOSGeoUtils;
 class AliEMCALGeometry;
+class AliAODMCParticle;
+class TParticle;
+
 #include "AliEMCALRecoUtils.h"
 
 class AliCalorimeterUtils : public TObject {
@@ -99,6 +102,9 @@ class AliCalorimeterUtils : public TObject {
                                                              fImportGeometryFromFile = import    ;
                                                              fImportGeometryFilePath = path      ; } // EMCAL
   
+  Bool_t        IsMCParticleInCalorimeterAcceptance(TString calo, TParticle* particle);
+  Bool_t        IsMCParticleInCalorimeterAcceptance(TString calo, AliAODMCParticle* particle);
+  
   void          SwitchOnLoadOwnEMCALGeometryMatrices()     { fLoadEMCALMatrices = kTRUE   ; }
   void          SwitchOffLoadOwnEMCALGeometryMatrices()    { fLoadEMCALMatrices = kFALSE  ; }
   void          SetEMCALGeometryMatrixInSM(TGeoHMatrix* m, Int_t i) { fEMCALMatrix[i] = m ; }
@@ -343,7 +349,7 @@ class AliCalorimeterUtils : public TObject {
   Int_t              fNSuperModulesUsed;     // Number of supermodules to be used in analysis, can be different than the real geo,
                                              // to be used at initialization of histograms
 
-  Bool_t             fMCECellClusFracCorrOn;  // Correct or not the weight of cells in cluster
+  Bool_t             fMCECellClusFracCorrOn; // Correct or not the weight of cells in cluster
   Float_t            fMCECellClusFracCorrParam[4]; // Parameters for the function correcting the weight of the cells in the cluster
   
   AliCalorimeterUtils(              const AliCalorimeterUtils & cu) ; // cpy ctor