]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - PWGLF/totEt/AliAnalysisEtSelectorEmcal.cxx
Merge branch 'feature-movesplit'
[u/mrichter/AliRoot.git] / PWGLF / totEt / AliAnalysisEtSelectorEmcal.cxx
index eb1fb7ff51a0640a12356d7ff7f0dd05d6fbcdcd..e938188e70b1f59fa8fefaa151f4de3549aed268 100644 (file)
@@ -10,6 +10,8 @@
 #include "AliAnalysisEtCuts.h"
 #include "AliEMCALTrack.h"
 #include "TParticle.h"
+#include <iostream>
+#include "AliStack.h"
 
 AliAnalysisEtSelectorEmcal::AliAnalysisEtSelectorEmcal(AliAnalysisEtCuts* cuts):AliAnalysisEtSelector(cuts)
 {
@@ -66,6 +68,10 @@ Bool_t AliAnalysisEtSelectorEmcal::PassMinEnergyCut(const TParticle& p) const
 {
   return TMath::Sin(p.Theta())*p.Energy() > fCuts->GetReconstructedEmcalClusterEnergyCut();
 }
+Bool_t AliAnalysisEtSelectorEmcal::PassMinEnergyCut(Double_t e) const
+{
+  return e > fCuts->GetReconstructedEmcalClusterEnergyCut();
+}
 
 Bool_t AliAnalysisEtSelectorEmcal::PassDistanceToBadChannelCut(const AliESDCaloCluster& ) const
 {
@@ -104,28 +110,34 @@ Bool_t AliAnalysisEtSelectorEmcal::PassTrackMatchingCut(const AliESDCaloCluster&
     //return distance > fCuts->GetEmcalTrackDistanceCut();
 }
 
-Bool_t AliAnalysisEtSelectorEmcal::CutGeometricalAcceptance(const TParticle& part) const
+Bool_t AliAnalysisEtSelectorEmcal::CutGeometricalAcceptance(const TParticle& part)
 {
+  float myphi = part.Phi();
+  myphi = AliAnalysisEtSelector::ShiftAngle(myphi);
     return TMath::Abs(part.Eta()) < fCuts->GetGeometryEmcalEtaAccCut()
-           && part.Phi() < fCuts->GetGeometryEmcalPhiAccMaxCut()*TMath::Pi()/180.
-           && part.Phi() > fCuts->GetGeometryEmcalPhiAccMinCut()*TMath::Pi()/180.;
+    && myphi < fCuts->GetGeometryEmcalPhiAccMaxCut()*TMath::Pi()/180.
+    && myphi > fCuts->GetGeometryEmcalPhiAccMinCut()*TMath::Pi()/180.;
 }
 
-Bool_t AliAnalysisEtSelectorEmcal::CutGeometricalAcceptance(const AliVTrack& part) const
+Bool_t AliAnalysisEtSelectorEmcal::CutGeometricalAcceptance(const AliVTrack& part)
 {
-    return TMath::Abs(part.Eta()) < fCuts->GetGeometryEmcalEtaAccCut()
-           && part.Phi() < fCuts->GetGeometryEmcalPhiAccMaxCut()*TMath::Pi()/180.
-           && part.Phi() > fCuts->GetGeometryEmcalPhiAccMinCut()*TMath::Pi()/180.;
+  float myphi = part.Phi();
+  myphi = AliAnalysisEtSelector::ShiftAngle(myphi);
+  return TMath::Abs(part.Eta()) < fCuts->GetGeometryEmcalEtaAccCut()
+    && myphi < fCuts->GetGeometryEmcalPhiAccMaxCut()*TMath::Pi()/180.
+    && myphi > fCuts->GetGeometryEmcalPhiAccMinCut()*TMath::Pi()/180.;
 }
 
-Bool_t AliAnalysisEtSelectorEmcal::CutGeometricalAcceptance(const AliESDCaloCluster& cluster) const
+Bool_t AliAnalysisEtSelectorEmcal::CutGeometricalAcceptance(const AliESDCaloCluster& cluster)
 {
   Float_t pos[3];
   cluster.GetPosition(pos);
   TVector3 cp(pos);
+  float myphi = cp.Phi();
+  myphi = AliAnalysisEtSelector::ShiftAngle(myphi);
   return TMath::Abs(cp.Eta()) < fCuts->GetGeometryEmcalEtaAccCut()
-    && cp.Phi() < fCuts->GetGeometryEmcalPhiAccMaxCut()*TMath::Pi()/180.
-    && cp.Phi() > fCuts->GetGeometryEmcalPhiAccMinCut()*TMath::Pi()/180.;
+    && myphi < fCuts->GetGeometryEmcalPhiAccMaxCut()*TMath::Pi()/180.
+    && myphi > fCuts->GetGeometryEmcalPhiAccMinCut()*TMath::Pi()/180.;
 }
 
 
@@ -173,7 +185,35 @@ AliAnalysisEtSelectorEmcal::CalcTrackClusterDistance(const Float_t clsPos[3],Int
     return distance;
 }
 
+UInt_t AliAnalysisEtSelectorEmcal::GetLabel(const AliESDCaloCluster *cluster, AliStack *stack){
+  UInt_t correctLabel = TMath::Abs(cluster->GetLabel());
+  correctLabel = GetFirstMotherNotFromDetectorCover(correctLabel,*stack);
+
+  //Now we want to see if this particle is really just something that converted in the cover of the detector and if so, override the label
+//   if(!stack){return 0;}
+//   if( correctLabel > 0 && stack->IsSecondaryFromMaterial(correctLabel)){//if this is flagged as a secondary then we look to see where it really came from
+//     TParticle *hitParticle = stack->Particle(correctLabel);
+//     if(hitParticle){
+//       Bool_t partVtxSecondary = (TMath::Sqrt(hitParticle->Vx()*hitParticle->Vx() + hitParticle->Vy()*hitParticle->Vy()) >420);
+//       if(partVtxSecondary){//at this point we have something which converted near the detector.  Let's find the mother particle
+//     UInt_t mothIdx = stack->Particle(correctLabel)->GetMother(0);
+//     if(mothIdx>0){
+//       TParticle *mother = stack->Particle(mothIdx);
+//       if(mother){
+//         if(AliAnalysisEtSelector::CutGeometricalAcceptance(*mother)){//and the mother is in the acceptance
+//           if( !(mother->GetPdgCode()==fgPi0Code)){//some of these are decays that just happen this far out
+//             cout<<"I am declaring that "<<hitParticle->GetName()<<" with a vertex of "<< TMath::Sqrt(hitParticle->Vx()*hitParticle->Vx() + hitParticle->Vy()*hitParticle->Vy()) <<" is actually "<<mother->GetName()<<endl;
+//             cout<<"ID check "<<mothIdx<<" vs "<<mother->GetUniqueID()<<endl;
+//             //so now we know that the particle originated near the cover and within the acceptance of the detector
+//             return mothIdx;
+//           }
+//         }
+//       }
+//     }
+//       }
 
+//     }
+//   }
+  return  correctLabel ; // DS: should this line be inside n>0 check, and return another value if n<=0 ? 
 
-
-
+}