]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGGA/GammaConv/ConvCorrelations/AliAnaConvCorrPhotonJet.cxx
fixing rule violations
[u/mrichter/AliRoot.git] / PWGGA / GammaConv / ConvCorrelations / AliAnaConvCorrPhotonJet.cxx
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
26 #include "TRefArray.h"
27 #include "TH1F.h"
28 #include <iostream>
29 // Gamma - jet correlation analysis task
30 // Authors: Svein Lindal
31
32
33 using namespace std;
34 ClassImp(AliAnaConvCorrPhotonJet)
35
36 //________________________________________________________________________________
37 AliAnaConvCorrPhotonJet::AliAnaConvCorrPhotonJet() :
38 AliAnaConvCorrBase("photonJet", "Photon Jet"),
39   fhPtFracGamma(NULL), 
40   fhPtFracPion(NULL)
41 {
42   //consctructor
43 }
44 //________________________________________________________________________________
45 AliAnaConvCorrPhotonJet::AliAnaConvCorrPhotonJet(TString name) :
46   AliAnaConvCorrBase(name, "Photon Jet"),
47   fhPtFracGamma(NULL), 
48   fhPtFracPion(NULL)
49 {
50   //consctructor
51 }
52
53
54 //________________________________________________________________________________
55 AliAnaConvCorrPhotonJet::~AliAnaConvCorrPhotonJet() {
56   //destructor
57 }
58
59
60 void AliAnaConvCorrPhotonJet::CreateHistograms() {
61   //Create histo
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
70 void AliAnaConvCorrPhotonJet::DoJetAnalysisGamma(AliAODJet * jet, const TClonesArray * const photons, const  TClonesArray *const pions ) const{
71   //See header file for documetation
72   Int_t trackIDs[4]={0};
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();
79       if(IsParticleInJet(jet, 2, trackIDs)){
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) {
90       //pion->GetGrandChildren(photons, trackIDs);
91       if(IsParticleInJet(jet, 4, trackIDs)){
92         fhPtFracPion->Fill(pion->Pt()/jet->Pt());
93       }
94     }
95   }
96   
97   
98   
99
100   
101 }
102
103 //________________________________________________________________________________
104 Bool_t AliAnaConvCorrPhotonJet::IsParticleInJet(const AliAODJet * jet, const Int_t nTracks, const Int_t * trackIds) const {
105   //See header file for documetation
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 //________________________________________________________________________________
126 Double_t AliAnaConvCorrPhotonJet::ExtractFromJet(const AliAODJet * jet, const AliAODConversionParticle * const particle) const {
127   //See header file for documetation
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 ///_______________________________________________________________________________
154 void AliAnaConvCorrPhotonJet::CorrelateWithHadrons(const AliAODConversionParticle * const photon, const TClonesArray * const jets, const Bool_t isolated) {
155   FillTriggerCounters(photon, isolated);
156   //See header file for documentation
157   if (jets) {
158     for(int ij = 0; ij < jets->GetEntriesFast(); ij++) {
159       AliAODJet * jet = dynamic_cast<AliAODJet*>(jets->At(ij));
160       if(jet) {
161                 //Double_t jetPt = ExtractFromJet(jet, photon);
162                 //FillHistograms(photon->Pt(), jetPt, GetDPhi(photon->Phi() - jet->Phi()), photon->Eta() - jet->Eta(), isolated);
163       }
164     }
165   }
166 }