fixing rule violations
[u/mrichter/AliRoot.git] / PWGGA / 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() :
296f4e9c 38AliAnaConvCorrBase("photonJet", "Photon Jet"),
e0875dfc 39 fhPtFracGamma(NULL),
40 fhPtFracPion(NULL)
41{
fc7e3b59 42 //consctructor
43}
44//________________________________________________________________________________
45AliAnaConvCorrPhotonJet::AliAnaConvCorrPhotonJet(TString name) :
296f4e9c 46 AliAnaConvCorrBase(name, "Photon Jet"),
e0875dfc 47 fhPtFracGamma(NULL),
48 fhPtFracPion(NULL)
49{
fc7e3b59 50 //consctructor
51}
52
53
54//________________________________________________________________________________
55AliAnaConvCorrPhotonJet::~AliAnaConvCorrPhotonJet() {
56 //destructor
57}
58
fc7e3b59 59
811b0806 60void AliAnaConvCorrPhotonJet::CreateHistograms() {
201850ad 61 //Create histo
811b0806 62 CreateBaseHistograms();
63 fhPtFracGamma = new TH1F("fhPtFracGamma", "fhPtFracGamma", 100, 0, 10);
64 GetHistograms()->Add(fhPtFracGamma);
65 fhPtFracPion = new TH1F("fhPtFracPion", "fhPtFracPion", 100, 0, 10);
66 GetHistograms()->Add(fhPtFracPion);
67
68}
69
70void AliAnaConvCorrPhotonJet::DoJetAnalysisGamma(AliAODJet * jet, const TClonesArray * const photons, const TClonesArray *const pions ) const{
296f4e9c 71 //See header file for documetation
ff747b31 72 Int_t trackIDs[4]={0};
811b0806 73
74 for(Int_t i = 0; i < photons->GetEntriesFast(); i++) {
75 AliAODConversionParticle * photon = dynamic_cast<AliAODConversionParticle*>(photons->At(i));
76 if(photon) {
77 trackIDs[0] = photon->GetLabel1();
78 trackIDs[1] = photon->GetLabel2();
e0875dfc 79 if(IsParticleInJet(jet, 2, trackIDs)){
811b0806 80 fhPtFracGamma->Fill(photon->Pt()/jet->Pt());
81 }
82 }
83 }
84
85
86
87 for(Int_t i = 0; i < pions->GetEntriesFast(); i++) {
88 AliAODConversionParticle * pion = dynamic_cast<AliAODConversionParticle*>(pions->At(i));
89 if(pion) {
2eedd4ed 90 //pion->GetGrandChildren(photons, trackIDs);
e0875dfc 91 if(IsParticleInJet(jet, 4, trackIDs)){
811b0806 92 fhPtFracPion->Fill(pion->Pt()/jet->Pt());
93 }
94 }
95 }
96
97
98
99
100
101}
102
103//________________________________________________________________________________
201850ad 104Bool_t AliAnaConvCorrPhotonJet::IsParticleInJet(const AliAODJet * jet, const Int_t nTracks, const Int_t * trackIds) const {
296f4e9c 105 //See header file for documetation
811b0806 106
107 Int_t mTracks = 0;
108 TRefArray * refTracks = jet->GetRefTracks();
109 for(Int_t jRef = 0; jRef < refTracks->GetEntriesFast(); jRef++) {
110 AliAODTrack * track = dynamic_cast<AliAODTrack*>(refTracks->At(jRef));
111 if(track) {
112 for(Int_t it = 0; it < nTracks; it++) {
113 if (track->GetID() == trackIds[it]) {
114 mTracks++;
115 }
116 }
117 }
118 }
119
120 //cout <<mTracks << " " << (mTracks > 1) << endl;
121 return (mTracks > 1);
122}
123
124
125//________________________________________________________________________________
201850ad 126Double_t AliAnaConvCorrPhotonJet::ExtractFromJet(const AliAODJet * jet, const AliAODConversionParticle * const particle) const {
296f4e9c 127 //See header file for documetation
811b0806 128
129 Float_t jetPt = jet->Pt();
130 cout << "Jet pt before and after: " << jetPt << " ";
131
132 TRefArray * refTracks = jet->GetRefTracks();
133 for(Int_t jRef = 0; jRef < refTracks->GetEntriesFast(); jRef++) {
134 AliAODTrack * track = dynamic_cast<AliAODTrack*>(refTracks->At(jRef));
135 if(track) {
136 if (track->GetID() == particle->GetLabel1() || track->GetID() == particle->GetLabel2()) {
137 cout << " - " << track->Pt() << " ";
138 jetPt = jetPt - track->Pt();
139 } else {
140 //cout << track->Pt() << endl;
141 }
142 } else {
143 cout <<"FUUUUUUUUUUUUUUUUUCJK"<<endl;
144 }
145 }
146
147 cout << jetPt << endl;
148 return jetPt;
149}
150
151
152
153///_______________________________________________________________________________
154void AliAnaConvCorrPhotonJet::CorrelateWithHadrons(const AliAODConversionParticle * const photon, const TClonesArray * const jets, const Bool_t isolated) {
296f4e9c 155 FillTriggerCounters(photon, isolated);
fc7e3b59 156 //See header file for documentation
811b0806 157 if (jets) {
158 for(int ij = 0; ij < jets->GetEntriesFast(); ij++) {
159 AliAODJet * jet = dynamic_cast<AliAODJet*>(jets->At(ij));
fc7e3b59 160 if(jet) {
296f4e9c 161 //Double_t jetPt = ExtractFromJet(jet, photon);
162 //FillHistograms(photon->Pt(), jetPt, GetDPhi(photon->Phi() - jet->Phi()), photon->Eta() - jet->Eta(), isolated);
fc7e3b59 163 }
164 }
165 }
166}