]> git.uio.no Git - u/mrichter/AliRoot.git/blame - PWG4/GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.cxx
Updating conv correlation software
[u/mrichter/AliRoot.git] / PWG4 / GammaConv / ConvCorrelations / AliAnaConvCorrPhotonJet.cxx
CommitLineData
fc7e3b59 1/**************************************************************************
2 * This file is property of and copyright by the ALICE HLT Project *
3 * ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Primary Author: Svein Lindal <slindal@fys.uio.no> *
6 * *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
15
16/// @file AliAnaConvCorrPhoton.cxx
17/// @author Svein Lindal
18/// @brief Class used to fill calculate correlation between photons - jets
19
20#include "AliAnaConvCorrPhotonJet.h"
21#include "AliAODTrack.h"
22#include "TClonesArray.h"
23#include "AliAODConversionParticle.h"
24#include "AliAODJet.h"
25
811b0806 26#include "TRefArray.h"
27#include "TH1F.h"
fc7e3b59 28#include <iostream>
29// Gamma - jet correlation analysis task
30// Authors: Svein Lindal
31
32
33using namespace std;
34ClassImp(AliAnaConvCorrPhotonJet)
35
36//________________________________________________________________________________
37AliAnaConvCorrPhotonJet::AliAnaConvCorrPhotonJet() :
38AliAnaConvCorrBase("photonJet") {
39 //consctructor
40}
41//________________________________________________________________________________
42AliAnaConvCorrPhotonJet::AliAnaConvCorrPhotonJet(TString name) :
43AliAnaConvCorrBase(name) {
44 //consctructor
45}
46
47
48//________________________________________________________________________________
49AliAnaConvCorrPhotonJet::~AliAnaConvCorrPhotonJet() {
50 //destructor
51}
52
fc7e3b59 53
811b0806 54void AliAnaConvCorrPhotonJet::CreateHistograms() {
55
56 CreateBaseHistograms();
57 fhPtFracGamma = new TH1F("fhPtFracGamma", "fhPtFracGamma", 100, 0, 10);
58 GetHistograms()->Add(fhPtFracGamma);
59 fhPtFracPion = new TH1F("fhPtFracPion", "fhPtFracPion", 100, 0, 10);
60 GetHistograms()->Add(fhPtFracPion);
61
62}
63
64void AliAnaConvCorrPhotonJet::DoJetAnalysisGamma(AliAODJet * jet, const TClonesArray * const photons, const TClonesArray *const pions ) const{
65
66 Int_t trackIDs[4];
67
68 for(Int_t i = 0; i < photons->GetEntriesFast(); i++) {
69 AliAODConversionParticle * photon = dynamic_cast<AliAODConversionParticle*>(photons->At(i));
70 if(photon) {
71 trackIDs[0] = photon->GetLabel1();
72 trackIDs[1] = photon->GetLabel2();
73 if(IsParticleInJet(jet, photon, 2, trackIDs)){
74 fhPtFracGamma->Fill(photon->Pt()/jet->Pt());
75 }
76 }
77 }
78
79
80
81 for(Int_t i = 0; i < pions->GetEntriesFast(); i++) {
82 AliAODConversionParticle * pion = dynamic_cast<AliAODConversionParticle*>(pions->At(i));
83 if(pion) {
84 pion->GetGrandChildren(photons, trackIDs);
85 if(IsParticleInJet(jet, pion, 4, trackIDs)){
86 fhPtFracPion->Fill(pion->Pt()/jet->Pt());
87 }
88 }
89 }
90
91
92
93
94
95}
96
97//________________________________________________________________________________
98Bool_t AliAnaConvCorrPhotonJet::IsParticleInJet(AliAODJet * jet, const AliAODConversionParticle * const particle, Int_t nTracks, Int_t * trackIds) const {
99
100 Int_t mTracks = 0;
101 TRefArray * refTracks = jet->GetRefTracks();
102 for(Int_t jRef = 0; jRef < refTracks->GetEntriesFast(); jRef++) {
103 AliAODTrack * track = dynamic_cast<AliAODTrack*>(refTracks->At(jRef));
104 if(track) {
105 for(Int_t it = 0; it < nTracks; it++) {
106 if (track->GetID() == trackIds[it]) {
107 mTracks++;
108 }
109 }
110 }
111 }
112
113 //cout <<mTracks << " " << (mTracks > 1) << endl;
114 return (mTracks > 1);
115}
116
117
118//________________________________________________________________________________
119Double_t AliAnaConvCorrPhotonJet::ExtractFromJet(AliAODJet * jet, const AliAODConversionParticle * const particle) const {
120
121 Float_t jetPt = jet->Pt();
122 cout << "Jet pt before and after: " << jetPt << " ";
123
124 TRefArray * refTracks = jet->GetRefTracks();
125 for(Int_t jRef = 0; jRef < refTracks->GetEntriesFast(); jRef++) {
126 AliAODTrack * track = dynamic_cast<AliAODTrack*>(refTracks->At(jRef));
127 if(track) {
128 if (track->GetID() == particle->GetLabel1() || track->GetID() == particle->GetLabel2()) {
129 cout << " - " << track->Pt() << " ";
130 jetPt = jetPt - track->Pt();
131 } else {
132 //cout << track->Pt() << endl;
133 }
134 } else {
135 cout <<"FUUUUUUUUUUUUUUUUUCJK"<<endl;
136 }
137 }
138
139 cout << jetPt << endl;
140 return jetPt;
141}
142
143
144
145///_______________________________________________________________________________
146void AliAnaConvCorrPhotonJet::CorrelateWithHadrons(const AliAODConversionParticle * const photon, const TClonesArray * const jets, const Bool_t isolated) {
147 FillTriggerCounters(photon->Pt(), isolated);
fc7e3b59 148 //See header file for documentation
811b0806 149 if (jets) {
150 for(int ij = 0; ij < jets->GetEntriesFast(); ij++) {
151 AliAODJet * jet = dynamic_cast<AliAODJet*>(jets->At(ij));
fc7e3b59 152 if(jet) {
811b0806 153 Double_t jetPt = ExtractFromJet(jet, photon);
154 FillHistograms(photon->Pt(), jetPt, GetDPhi(photon->Phi() - jet->Phi()), photon->Eta() - jet->Eta(), isolated);
fc7e3b59 155 }
156 }
157 }
158}