From fb371b83871e563c8d1e79a964aa61afaa80b7b2 Mon Sep 17 00:00:00 2001 From: gconesab Date: Fri, 29 Aug 2014 18:20:30 +0200 Subject: [PATCH] reject also primary particles if they fall into a declared bad channel, add acceptance check for TLorentzVector --- PWG/CaloTrackCorrBase/AliCalorimeterUtils.cxx | 65 ++++++++++++++++++- PWG/CaloTrackCorrBase/AliCalorimeterUtils.h | 1 + 2 files changed, 63 insertions(+), 3 deletions(-) diff --git a/PWG/CaloTrackCorrBase/AliCalorimeterUtils.cxx b/PWG/CaloTrackCorrBase/AliCalorimeterUtils.cxx index 70723793001..4d096a518ad 100755 --- a/PWG/CaloTrackCorrBase/AliCalorimeterUtils.cxx +++ b/PWG/CaloTrackCorrBase/AliCalorimeterUtils.cxx @@ -1400,7 +1400,15 @@ Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, TP else if(calo == "EMCAL") { Int_t absID = 0 ; - return GetEMCALGeometry()->GetAbsCellIdFromEtaPhi( particle->Eta(), particle->Phi(), absID); + Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle->Eta(),particle->Phi(),absID); + if(ok) + { + Int_t icol = -1, irow = -1, iRCU = -1; + Int_t nModule = GetModuleNumberCellIndexes(absID,calo, icol, irow, iRCU); + Int_t status = GetEMCALChannelStatus(nModule,icol,irow); + if(status > 0) ok = kFALSE; + } + return ok ; } return kFALSE ; @@ -1420,17 +1428,68 @@ Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, Al return kFALSE ; } + Float_t phi = particle->Phi(); + if(phi < 0) phi+=TMath::TwoPi(); + 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) ; + return GetPHOSGeometry()->ImpactOnEmc(vtx, particle->Theta(), phi, mod, z, x) ; } else if(calo == "EMCAL") { Int_t absID = 0 ; - return GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle->Eta(),particle->Phi(),absID); + Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle->Eta(),phi,absID); + if(ok) + { + Int_t icol = -1, irow = -1, iRCU = -1; + Int_t nModule = GetModuleNumberCellIndexes(absID,calo, icol, irow, iRCU); + Int_t status = GetEMCALChannelStatus(nModule,icol,irow); + if(status > 0) ok = kFALSE; + } + return ok ; + } + + return kFALSE ; +} + +//_____________________________________________________________________________________________________________________ +Bool_t AliCalorimeterUtils::IsMCParticleInCalorimeterAcceptance(TString calo, TLorentzVector particle, Int_t & absID) +{ + // Check that a TLorentzVector is in the calorimeter acceptance, give the cell number where it hit + + if(calo!="EMCAL" && calo!="PHOS") return kFALSE ; + + if( (!IsPHOSGeoMatrixSet () && calo == "PHOS" ) || + (!IsEMCALGeoMatrixSet() && calo == "EMCAL") ) + { + AliFatal(Form("Careful Geo Matrix for %s is not set, use AliFidutialCut instead \n",calo.Data())); + return kFALSE ; + } + + Float_t phi = particle.Phi(); + if(phi < 0) phi+=TMath::TwoPi(); + + if(calo == "PHOS" ) + { + Int_t mod = 0 ; + Double_t x = 0, z = 0 ; + Double_t vtx[]={0,0,0} ; + return GetPHOSGeometry()->ImpactOnEmc(vtx, particle.Theta(), phi, mod, z, x) ; + } + else if(calo == "EMCAL") + { + Bool_t ok = GetEMCALGeometry()->GetAbsCellIdFromEtaPhi(particle.Eta(),phi,absID); + if(ok) + { + Int_t icol = -1, irow = -1, iRCU = -1; + Int_t nModule = GetModuleNumberCellIndexes(absID,calo, icol, irow, iRCU); + Int_t status = GetEMCALChannelStatus(nModule,icol,irow); + if(status > 0) ok = kFALSE; + } + return ok ; } return kFALSE ; diff --git a/PWG/CaloTrackCorrBase/AliCalorimeterUtils.h b/PWG/CaloTrackCorrBase/AliCalorimeterUtils.h index ba9ff19d6d7..bc0e613ba2c 100755 --- a/PWG/CaloTrackCorrBase/AliCalorimeterUtils.h +++ b/PWG/CaloTrackCorrBase/AliCalorimeterUtils.h @@ -104,6 +104,7 @@ class AliCalorimeterUtils : public TObject { Bool_t IsMCParticleInCalorimeterAcceptance(TString calo, TParticle* particle); Bool_t IsMCParticleInCalorimeterAcceptance(TString calo, AliAODMCParticle* particle); + Bool_t IsMCParticleInCalorimeterAcceptance(TString calo, TLorentzVector particle, Int_t & absID); void SwitchOnLoadOwnEMCALGeometryMatrices() { fLoadEMCALMatrices = kTRUE ; } void SwitchOffLoadOwnEMCALGeometryMatrices() { fLoadEMCALMatrices = kFALSE ; } -- 2.43.0