]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/Correlations/JCORRAN/AliJJetCORRAnalysis.cxx
Update on JCORRAN:Dong Jo Kim
[u/mrichter/AliRoot.git] / PWGCF / Correlations / JCORRAN / AliJJetCORRAnalysis.cxx
1 /**************************************************************************
2  * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
3  *                                                                        *
4  * Author: The ALICE Off-line Project.                                    *
5  * Contributors are mentioned in the code where appropriate.              *
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 // Comment describing what this class does needed!
17
18 //===========================================================
19 // Dummy comment, should be replaced by a real one
20 // comment
21 // comment
22 //===========================================================
23
24 #include <TRandom.h>
25 #include <TMath.h>
26
27 #include "AliJBaseTrack.h"
28 #include "AliJCorrelations.h"
29 #include "AliJEventPool.h"
30 #include "AliJHistos.h"
31 #include "AliJEfficiency.h"
32
33 #include "AliJJet.h"
34 #include "AliJJetCORRAnalysis.h"
35 #include "AliJHistManager.h"
36
37 AliJJetCORRAnalysis::AliJJetCORRAnalysis():
38     fInputList(NULL),
39     fJetList(NULL),
40     fJetListOfList(),
41     fIsFullAcceptance(0),
42     fJetEtaRange(0),
43     fTrackJetMap(NULL),
44     fJetPtBins(NULL),
45     fJetPtMinCut(0),
46     fCard(0x0),
47     fHistos(0x0),
48     fEfficiency(0x0),
49     ftriggList(0x0),
50     fassocList(0x0),
51     fcorrelations(0x0),
52     fassocPool(0x0),
53     cBin(-1),
54         fcent(-999),
55     zBin(-1),
56         zVert(-999),
57     fevt(0),
58         fTargetJetIndex(0),
59     fDebugMode(0)
60 {
61     // Constaractor
62 }
63    
64 AliJJetCORRAnalysis::AliJJetCORRAnalysis( AliJCard * card ):
65     fInputList(NULL),
66     fJetList(NULL),
67     fJetListOfList(),
68     fIsFullAcceptance(0),
69     fJetEtaRange(0),
70     fTrackJetMap(NULL),
71     fJetPtBins(NULL),
72     fJetPtMinCut(0),
73     fCard(card),
74     fHistos(0x0),
75     fEfficiency(0x0),
76     ftriggList(0x0),
77     fassocList(0x0),
78     fcorrelations(0x0),
79     fassocPool(0x0),
80     cBin(-1),
81         fcent(-999),
82     zBin(-1),
83         zVert(-999),
84     fevt(0),
85         fTargetJetIndex(0),
86     fDebugMode(0)
87 {
88     // Constaractor
89 }
90
91 AliJJetCORRAnalysis::AliJJetCORRAnalysis( const AliJJetCORRAnalysis & obj ):
92     fInputList(obj.fInputList),
93     fJetList(obj.fJetList),
94     fJetListOfList(obj.fJetListOfList),
95     fIsFullAcceptance(obj.fIsFullAcceptance),
96     fJetEtaRange(obj.fJetEtaRange),
97     fTrackJetMap(obj.fTrackJetMap),
98     fJetPtBins(obj.fJetPtBins),
99         fJetPtMinCut(obj.fJetPtMinCut),
100     fCard(obj.fCard),
101     fHistos(obj.fHistos),
102     fEfficiency(obj.fEfficiency),
103     ftriggList(obj.ftriggList),
104     fassocList(obj.fassocList),
105     fcorrelations(obj.fcorrelations),
106     fassocPool(obj.fassocPool),
107     cBin(-1),
108         fcent(-999),
109     zBin(-1),
110         zVert(-999),
111     fevt(0),
112         fTargetJetIndex(0),
113     fDebugMode(0)
114 {
115     // Constaractor
116 }
117
118 AliJJetCORRAnalysis& AliJJetCORRAnalysis::operator=(const AliJJetCORRAnalysis & obj){
119     if( this != &obj ){
120         this->~AliJJetCORRAnalysis();
121         new(this) AliJJetCORRAnalysis(obj);
122     }
123     return *this;
124 }
125
126 AliJJetCORRAnalysis::~AliJJetCORRAnalysis(){
127   // destructor
128         delete fInputList;
129         delete ftriggList;
130         delete fassocList;
131         delete fHistos;
132         delete fcorrelations;
133         delete fassocPool;
134         delete fEfficiency;
135         
136 }
137
138 void AliJJetCORRAnalysis::UserCreateOutputObjects(){
139     // comment needed
140     fJetPtBins = fCard->GetVector("Jet:PtBins");
141     fJetPtMinCut = fCard->Get("Jet:PtMinCut");
142
143     fInputList  = new TClonesArray("AliJBaseTrack",1500);
144     fInputList->SetOwner(kTRUE);
145     ftriggList  = new TClonesArray("AliJBaseTrack",1500);
146     fassocList  = new TClonesArray("AliJBaseTrack",1500);
147
148         fHistos = new AliJHistos(fCard);
149         fHistos->CreateEventTrackHistos();
150         fHistos->CreateAzimuthCorrHistos();
151         fHistos->CreateIAAMoons();
152         fHistos->CreateXEHistos();
153         fHistos->CreateXtHistos();
154         fHistos->CreatePairPtCosThetaStar();
155
156         fHistos->fHMG->Print();
157
158         fcorrelations = new AliJCorrelations(fCard, fHistos);
159         fassocPool   = new AliJEventPool( fCard, fHistos, fcorrelations, kJHadron);
160
161         fEfficiency = new AliJEfficiency();
162         fEfficiency->SetMode( fCard->Get("EfficiencyMode") ); // 0:NoEff, 1:Period 2:RunNum 3:Auto
163         fEfficiency->SetDataPath("alien:///alice/cern.ch/user/d/djkim/legotrain/efficieny/data"); // Efficiency root file location local or alien
164
165         fHistos->fHMG->WriteConfig();
166
167 }
168
169 void AliJJetCORRAnalysis::ClearBeforeEvent(){
170
171 }
172
173 void AliJJetCORRAnalysis::UserExec(){
174         fevt++;
175         TObjArray *jets = (TObjArray*) fJetListOfList[fTargetJetIndex]; // only for one jet finder
176         if(!jets)       return;
177         ftriggList->Clear();
178         fassocList->Clear();
179         //Make Trigger list and assocList
180         int noTrigg=0,noAssoc=0;
181         for(int ii=0;ii<jets->GetEntriesFast();ii++) {
182                 AliJJet *jet = (AliJJet*)jets->At(ii);
183                 jet->SetTriggBin( fCard->GetBin(kTriggType, jet->Pt()) );
184                 jet->SetTrackEff( 1.0 ); 
185                 if( jet->GetTriggBin() > -1 ) { new ((*ftriggList)[noTrigg++]) AliJBaseTrack(*jet); }
186
187                 TObjArray *constituents = (TObjArray*)jet->GetConstituents();
188                 for(int jj=0;jj<constituents->GetEntriesFast();jj++) {
189                         AliJBaseTrack *con = (AliJBaseTrack*)constituents->At(jj);
190                         con->SetAssocBin( fCard->GetBin(kAssocType, con->Pt()) );
191                         con->SetParticleType(kJHadron);
192                         double pt = con->Pt();
193                         con->SetTrackEff( fEfficiency->GetCorrection(pt, 5, fcent) ); // only here for hybrid cut = 5
194                         if( con->GetAssocBin() > -1 ) { new ((*fassocList)[noAssoc++]) AliJBaseTrack(*con); }
195                         if(con->GetAssocBin() > -1){
196                                 int ipta  = con->GetAssocBin();
197                                 double effCorrection = 1.0/con->GetTrackEff();
198                                 fHistos->fhIphiAssoc[cBin][ipta]->Fill( con->Phi(), effCorrection);
199                                 fHistos->fhIetaAssoc[cBin][ipta]->Fill( con->Eta(), effCorrection);
200                         }
201                 }
202         }
203     // correlation loop
204     if(fDebugMode) cout << "Start of Correlation Loop noTrigg = "<< ftriggList->GetEntriesFast()<<"\t noAssoc="<<fassocList->GetEntriesFast()<<endl;
205     if(fassocList->GetEntriesFast()>0 ) fassocPool->AcceptList(fassocList, fcent, zVert, fInputList->GetEntriesFast(), fevt);
206     PlayCorrelation(ftriggList, fassocList);
207     fassocPool->Mix(ftriggList, kAzimuthFill, fcent, zVert, fInputList->GetEntriesFast(), fevt);
208 }
209 void AliJJetCORRAnalysis::Terminate() const{
210         // comment needed
211 }
212
213
214 void AliJJetCORRAnalysis::FillHistosJets(TObjArray *Jets){
215         for(int i=0; i<Jets->GetEntries();i++) {
216                 AliJJet *jet = (AliJJet*)Jets->At(i);
217                 jet->Print();
218         }
219 }
220
221 void AliJJetCORRAnalysis::CreateHistos(){
222         // Create Histograms
223 }
224
225
226 //________________________________________________________________________
227 void AliJJetCORRAnalysis::PlayCorrelation(TClonesArray *triggList, TClonesArray *assocList){
228         int noTrigg = triggList->GetEntries();
229         int noAssoc = assocList->GetEntries();
230
231         fHistos->fhAssocMult->Fill(noAssoc);
232         //------------------------------------------------------------------
233         //==== Correlation Loop
234         //------------------------------------------------------------------
235         for(int ii=0;ii<noTrigg;ii++){ // trigger loop
236                 AliJBaseTrack * triggTr = (AliJBaseTrack*)triggList->At(ii);
237                 int iptt   = triggTr->GetTriggBin();
238                 if( iptt < 0 ) continue;
239                 double effCorr = 1.0/triggTr->GetTrackEff();
240                 fHistos->fhTriggPtBin[cBin][zBin][iptt]->Fill(triggTr->Pt(), effCorr);//inclusive
241                 for(int jj=0;jj<noAssoc;jj++){ // assoc loop
242                         AliJBaseTrack  *assocTr = (AliJBaseTrack*)assocList->At(jj);
243                         fcorrelations->FillAzimuthHistos(kReal, cBin, zBin, triggTr, assocTr); // cBin and zBin from the members in header vis setter from TaskCode.
244                 }
245         } // end of trigg
246 }