AliPhysics  d565ceb (d565ceb)
AliAnalysisTaskEmcalJetHUtils.cxx
Go to the documentation of this file.
1 //
2 // Utilities class for Jet-Hadron correlation analysis
3 //
4 
6 
7 // Require to use AliLog streams with some types
8 #include <iostream>
9 
10 #include <TMath.h>
11 
12 #include <AliLog.h>
13 
14 #include "AliEmcalJet.h"
17 
18 namespace PWGJE {
19 namespace EMCALJetTasks {
20 
21 const std::map<std::string, AliAnalysisTaskEmcalJetHUtils::ELeadingHadronBiasType_t> AliAnalysisTaskEmcalJetHUtils::fgkLeadingHadronBiasMap = {
25 };
26 
40 {
41  double maxTrackPt = 0;
42  double maxClusterPt = 0;
43 
44  if (leadingHadronType == kCharged || leadingHadronType == kBoth) {
45  auto particle = jet->GetLeadingParticleConstituent();
46  if (particle) {
47  maxTrackPt = particle->Pt();
48  }
49  }
50  if (leadingHadronType == kNeutral || leadingHadronType == kBoth) {
51  // NOTE: We don't want to use jet->MaxNeutralPt() because this uses energy
52  // from the neutral particles at the particle level. While this is not
53  // strictly wrong, it can be rather misleading to have a leading neutral
54  // particle value when we are really interested in the cluster pt that is
55  // only meaningful at detector level.
56  auto cluster = jet->GetLeadingClusterConstituent();
57  if (cluster) {
58  // Uses the energy definition that was used when the constituent was created
59  // to calculate the Pt(). Usually, this would be the hadronic corrected energy
60  maxClusterPt = cluster->Pt();
61  }
62  }
63 
64  // The max value will be 0 unless it was filled. Thus, it will only be greater if
65  // it was requested.
66  return (maxTrackPt > maxClusterPt) ? maxTrackPt : maxClusterPt;
67 }
68 
78 double AliAnalysisTaskEmcalJetHUtils::RelativeEPAngle(double jetAngle, double epAngle)
79 {
80  double dphi = (epAngle - jetAngle);
81 
82  // ran into trouble with a few dEP<-Pi so trying this...
83  if( dphi<-1*TMath::Pi() ) {
84  dphi = dphi + 1*TMath::Pi();
85  } // this assumes we are doing full jets currently
86 
87  if( (dphi>0) && (dphi<1*TMath::Pi()/2) ) {
88  // Do nothing! we are in quadrant 1
89  } else if ( (dphi>1*TMath::Pi()/2) && (dphi<1*TMath::Pi()) ) {
90  dphi = 1*TMath::Pi() - dphi;
91  } else if ( (dphi<0) && (dphi>-1*TMath::Pi()/2) ) {
92  dphi = std::abs(dphi);
93  } else if ( (dphi<-1*TMath::Pi()/2) && (dphi>-1*TMath::Pi()) ) {
94  dphi = dphi + 1*TMath::Pi();
95  }
96 
97  // Warn if we are not in the proper range
98  if ( dphi < 0 || dphi > TMath::Pi()/2 ) {
99  AliWarningGeneralStream("AliAnalysisTaskEmcalJetHUtils") << ": dPHI not in range [0, 0.5*Pi]!\n";
100  }
101 
102  return dphi; // dphi in [0, Pi/2]
103 }
104 
105 } /* namespace EMCALJetTasks */
106 } /* namespace PWGJE */
const PWG::JETFW::AliEmcalParticleJetConstituent * GetLeadingParticleConstituent() const
Get the leading particle constituent.
ELeadingHadronBiasType_t
Determine the jet leading hadron bias type.
static double RelativeEPAngle(double jetAngle, double epAngle)
static double GetLeadingHadronPt(AliEmcalJet *jet, ELeadingHadronBiasType_t leadingHadronType)
const PWG::JETFW::AliEmcalClusterJetConstituent * GetLeadingClusterConstituent() const
Get the leading cluster constituent.
virtual double Pt() const
Access to transverse momentum.
virtual double Pt() const
Access to transverse momentum.
Represent a jet reconstructed using the EMCal jet framework.
Definition: AliEmcalJet.h:51
static const std::map< std::string, ELeadingHadronBiasType_t > fgkLeadingHadronBiasMap
! Map from name to leading hadron bias used with the YAML config