]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PWGCF/Correlations/JCORRAN/AliJJetJtAnalysis.cxx
5243a577856feced3976f52ae34c2e7e9b49f735
[u/mrichter/AliRoot.git] / PWGCF / Correlations / JCORRAN / AliJJetJtAnalysis.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 // Simple class for the jt anlyais by Beomkyu Kim and Dongjo Kim
23 //===========================================================
24
25 #include <TRandom.h>
26 #include <TMath.h>
27 #include <TRegexp.h>
28 #include <TVector.h>
29 #include "AliJJet.h"
30 #include "AliJEfficiency.h"
31 #include "AliJJetJtAnalysis.h"
32 #include "AliJHistManager.h"
33 #include "TClonesArray.h"
34
35 AliJJetJtAnalysis::AliJJetJtAnalysis():
36         fInputList(NULL)
37         , fJetList(NULL)
38         , fJetListOfList()
39         , fJetBgList(NULL)
40         , fJetBgListOfList()
41     , fJetTriggPtBorders(NULL)
42     , fJetConstPtLowLimits(NULL)
43     , fJetAssocPtBorders(NULL)
44     , fDeltaRBorders(NULL)
45     , nJetContainer(0)
46         , fCard(NULL)
47         , fJJetAnalysis(NULL)
48     , fJetFinderName(0)
49     , fConeSizes(0)
50         , fEfficiency(0x0)
51         , cBin(-1)
52         , fcent(-999)
53         , zBin(-1)
54         , zVert(-999)
55     , fTracks(NULL)
56     , fHMG(NULL)
57     , fJetFinderBin()
58     , fJetTriggerBin()
59     , fTrkPtBin()
60     , fTrkLimPtBin()
61     , fdRBin()
62     , fhJetPt()
63     , fhJetPtBin()
64     , fhZ()
65     , fhZBin()
66     , fhJt()
67     , fhJtBin()
68     , fhJtWeightBin()
69     , fhLogJtWeightBin()
70     , fhJtWithPtCutWeightBinBin()
71     , fhLogJtWithPtCutWeightBinBin()
72     , fhJtBinLimBin()
73     , fhJtWeightBinLimBin()
74     , fhLogJtWeightBinLimBin()
75     , fhJetBgPt()
76     , fhJetBgPtBin()
77     , fhBgZ()
78     , fhBgZBin()
79     , fhBgJt()
80     , fhBgJtBin()
81     , fhBgJtWeightBin()
82     , fhBgLogJtWeightBin()
83     , fhBgJtWithPtCutWeightBinBin()
84     , fhBgLogJtWithPtCutWeightBinBin()
85     , fhdeltaE()
86     , fhdeltaN()
87     , fhFullJetEChJetBin()
88     , fhFullChdRChJetBin()
89 {
90
91 }
92
93 AliJJetJtAnalysis::AliJJetJtAnalysis( AliJCard * card ):
94         fInputList(NULL)
95         , fJetList(NULL)
96         , fJetListOfList()
97         , fJetBgList(NULL)
98         , fJetBgListOfList()
99     , fJetTriggPtBorders(NULL)
100     , fJetConstPtLowLimits(NULL)
101     , fJetAssocPtBorders(NULL)
102     , fDeltaRBorders(NULL)
103     , nJetContainer(0)
104         , fCard(card)
105         , fJJetAnalysis(NULL)
106     , fJetFinderName(0)
107     , fConeSizes(0)
108         , fEfficiency(0x0)
109         , cBin(-1)
110         , fcent(-999)
111         , zBin(-1)
112         , zVert(-999)
113     , fTracks(NULL)
114     , fHMG(NULL)
115     , fJetFinderBin()
116     , fJetTriggerBin()
117     , fTrkPtBin()
118     , fTrkLimPtBin()
119     , fdRBin()
120     , fhJetPt()
121     , fhJetPtBin()
122     , fhZ()
123     , fhZBin()
124     , fhJt()
125     , fhJtBin()
126     , fhJtWeightBin()
127     , fhLogJtWeightBin()
128     , fhJtWithPtCutWeightBinBin()
129     , fhLogJtWithPtCutWeightBinBin()
130     , fhJtBinLimBin()
131     , fhJtWeightBinLimBin()
132     , fhLogJtWeightBinLimBin()
133     , fhJetBgPt()
134     , fhJetBgPtBin()
135     , fhBgZ()
136     , fhBgZBin()
137     , fhBgJt()
138     , fhBgJtBin()
139     , fhBgJtWeightBin()
140     , fhBgLogJtWeightBin()
141     , fhBgJtWithPtCutWeightBinBin()
142     , fhBgLogJtWithPtCutWeightBinBin()
143     , fhdeltaE()
144     , fhdeltaN()
145     , fhFullJetEChJetBin()
146     , fhFullChdRChJetBin()
147 {
148
149 }
150
151 AliJJetJtAnalysis::AliJJetJtAnalysis(const AliJJetJtAnalysis& ap) :
152         fInputList(ap.fInputList)
153         , fJetList(ap.fJetList)
154         , fJetListOfList(ap.fJetListOfList)
155         , fJetBgList(ap.fJetBgList)
156         , fJetBgListOfList(ap.fJetBgListOfList)
157     , fJetTriggPtBorders(ap.fJetTriggPtBorders)
158     , fJetConstPtLowLimits(ap.fJetConstPtLowLimits)
159     , fJetAssocPtBorders(ap.fJetAssocPtBorders)
160     , fDeltaRBorders(ap.fDeltaRBorders)
161     , nJetContainer(ap.nJetContainer)
162         , fCard(ap.fCard)
163         , fJJetAnalysis(ap.fJJetAnalysis)
164     , fJetFinderName(ap.fJetFinderName)
165     , fConeSizes(ap.fConeSizes)
166         , fEfficiency(ap.fEfficiency)
167         , cBin(-1)
168         , fcent(-999)
169         , zBin(-1)
170         , zVert(-999)
171     , fTracks(ap.fTracks)
172     , fHMG(ap.fHMG)
173     , fJetFinderBin(ap.fJetFinderBin)
174     , fJetTriggerBin(ap.fJetTriggerBin)
175     , fTrkPtBin(ap.fTrkPtBin)
176     , fTrkLimPtBin(ap.fTrkLimPtBin)
177     , fdRBin(ap.fdRBin)
178     , fhJetPt(ap.fhJetPt)
179     , fhJetPtBin(ap.fhJetPtBin)
180     , fhZ(ap.fhZ)
181     , fhZBin(ap.fhZBin)
182     , fhJt(ap.fhJt)
183     , fhJtBin(ap.fhJtBin)
184     , fhJtWeightBin(ap.fhJtWeightBin)
185     , fhLogJtWeightBin(ap.fhLogJtWeightBin)
186     , fhJtWithPtCutWeightBinBin(ap.fhJtWithPtCutWeightBinBin)
187     , fhLogJtWithPtCutWeightBinBin(ap.fhLogJtWithPtCutWeightBinBin)
188     , fhJtBinLimBin(ap.fhJtBinLimBin)
189     , fhJtWeightBinLimBin(ap.fhJtWeightBinLimBin)
190     , fhLogJtWeightBinLimBin(ap.fhLogJtWeightBinLimBin)
191     , fhJetBgPt(ap.fhJetBgPt)
192     , fhJetBgPtBin(ap.fhJetBgPtBin)
193     , fhBgZ(ap.fhBgZ)
194     , fhBgZBin(ap.fhBgZBin)
195     , fhBgJt(ap.fhBgJt)
196     , fhBgJtBin(ap.fhBgJtBin)
197     , fhBgJtWeightBin(ap.fhBgJtWeightBin)
198     , fhBgLogJtWeightBin(ap.fhBgLogJtWeightBin)
199     , fhBgJtWithPtCutWeightBinBin(ap.fhBgJtWithPtCutWeightBinBin)
200     , fhBgLogJtWithPtCutWeightBinBin(ap.fhBgLogJtWithPtCutWeightBinBin)
201     , fhdeltaE(ap.fhdeltaE)
202     , fhdeltaN(ap.fhdeltaN)
203     , fhFullJetEChJetBin(ap.fhFullJetEChJetBin)
204     , fhFullChdRChJetBin(ap.fhFullChdRChJetBin)
205 {
206
207 }
208
209 AliJJetJtAnalysis& AliJJetJtAnalysis::operator = (const AliJJetJtAnalysis& ap)
210 {
211         // assignment operator
212
213         this->~AliJJetJtAnalysis();
214         new(this) AliJJetJtAnalysis(ap);
215         return *this;
216 }
217
218
219 AliJJetJtAnalysis::~AliJJetJtAnalysis(){
220
221
222     delete fJJetAnalysis;
223     fJetFinderName.clear();
224     fConeSizes.clear();
225     delete fEfficiency;
226     delete fHMG;
227    
228
229
230 }
231
232
233
234 void AliJJetJtAnalysis::UserCreateOutputObjects(){
235         //fJetListOfList always point one address in the whole time of this analysis.
236     //Thus mustn't be cleared in it's life.     
237     //fJetListOfList.Clear();
238
239
240     fJJetAnalysis = new AliJJetAnalysis();
241
242     fJetTriggPtBorders = fCard->GetVector("JetTriggPtBorders");
243     fJetConstPtLowLimits = fCard->GetVector("JetConstPtLowLimits");
244     fJetAssocPtBorders = fCard->GetVector("JetAssocPtBorders");
245     fDeltaRBorders = fCard->GetVector("DeltaRBorders");
246
247         fEfficiency = new AliJEfficiency();
248         fEfficiency->SetMode( fCard->Get("EfficiencyMode") ); // 0:NoEff, 1:Period 2:RunNum 3:Auto
249         fEfficiency->SetDataPath("alien:///alice/cern.ch/user/d/djkim/legotrain/efficieny/data"); // Efficiency root file location local or alien
250
251     TRegexp reg("R[0-9][0-9][0-9]");
252     TRegexp reg2("[0-9][0-9][0-9]");
253
254     //container name has information of cone size like **R040**
255     //this cone size information will be pulled to a numerical variable
256     nJetContainer = fJetFinderName.size();
257         for (int i=0; i<nJetContainer; i++){
258                 //AliJJetJtHistos *histo = new AliJJetJtHistos(fCard);
259                 //histo->CreateJetJtHistos();
260         //      fHistos.push_back( histo  );
261         TString fullNameOfiJetContainer(fJetFinderName[i]);
262         TString coneSizeName (fullNameOfiJetContainer(reg));
263         TString coneSizeValue (coneSizeName(reg2));
264         fConeSizes.push_back( (double) coneSizeValue.Atoi()/100.);
265         }
266
267
268     int NBINS=150;
269     double LogBinsX[NBINS+1], LimL=0.1, LimH=150;
270     double logBW = (log(LimH)-log(LimL))/NBINS;
271     for(int ij=0;ij<=NBINS;ij++) LogBinsX[ij]=LimL*exp(ij*logBW);
272
273
274
275     fHMG = new AliJHistManager( "AliJJetJtHistManager");
276     fJetFinderBin .Set("JetFinderOrder","NFin","NFin:%d", AliJBin::kSingle).SetBin(nJetContainer);
277     fJetTriggerBin .Set("JetTriggerBin","JetPt","p_{T,jet} : %.1f - %.1f").SetBin(fCard->GetVector("JetTriggPtBorders"));
278     fTrkPtBin .Set("TrkPtBin","TrkPt","p_{T,constituent}:%.1f-%.1f").SetBin(fCard->GetVector("JetAssocPtBorders"));
279     fTrkLimPtBin .Set("TrkLimitPtBin","TrkLimitPt","p_{T,Limit}<%.1f", AliJBin::kSingle).SetBin(fJetConstPtLowLimits->GetNoElements());
280     fdRBin.Set("dRBin","dR","dR : %.1f - %.1f ").SetBin(fCard->GetVector("DeltaRBorders"));
281
282
283     fhJetPt 
284         << TH1D("JetPt","",NBINS, LogBinsX ) << fJetFinderBin
285         <<"END";
286     fhJetPtBin 
287         << TH1D("JetPtBin","",NBINS, LogBinsX ) << fJetFinderBin << fJetTriggerBin
288         <<"END";
289
290     int NBINSZ=150;
291     double LogBinsZ[NBINSZ+1], LimLZ=0.001, LimHZ=1.1;
292     double logBWZ = (TMath::Log(LimHZ)-TMath::Log(LimLZ))/NBINSZ;
293     for(int ij=0;ij<=NBINSZ;ij++) LogBinsZ[ij]=LimLZ*exp(ij*logBWZ);//
294
295     fhZ 
296         << TH1D("Z","",NBINSZ, LogBinsZ ) << fJetFinderBin
297         <<"END";
298     fhZBin 
299         << TH1D("ZBin","",NBINSZ, LogBinsZ ) << fJetFinderBin << fJetTriggerBin
300         <<"END";
301
302     int NBINSJt=150;
303     double LogBinsJt[NBINSJt+1], LimLJt=0.01, LimHJt=10;
304     double logBWJt = (TMath::Log(LimHJt)-TMath::Log(LimLJt))/NBINSJt;
305     for(int ij=0;ij<=NBINSJt;ij++) LogBinsJt[ij]=LimLJt*exp(ij*logBWJt);
306     int NBINSJtW=150;
307     double LimLJtW=TMath::Log(0.01), LimHJtW=TMath::Log(10);
308
309     fhJt 
310         << TH1D("Jt","",NBINSJt, LogBinsJt ) << fJetFinderBin
311         <<"END";
312     fhJtBin 
313         << TH1D("JtBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
314         <<"END";
315     fhJtWeightBin 
316         << TH1D("JtWeightBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
317         <<"END";
318     fhLogJtWeightBin 
319         << TH1D("LogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin
320         <<"END";
321
322     fhJtWithPtCutWeightBinBin 
323         << TH1D("JtWithPtCutWeightBinBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
324         <<"END";
325     fhLogJtWithPtCutWeightBinBin 
326         << TH1D("LogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
327         <<"END";
328
329     fhJtBinLimBin 
330         << TH1D("JtBinLimBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
331         <<"END";
332     fhJtWeightBinLimBin 
333         << TH1D("JtWeightBinLimBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
334         <<"END";
335     fhLogJtWeightBinLimBin 
336         << TH1D("LogJtWeightBinLimBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
337         <<"END";
338
339     fhJetBgPt 
340         << TH1D("JetBgPt","",NBINS, LogBinsX ) << fJetFinderBin
341         <<"END";
342     fhJetBgPtBin 
343         << TH1D("JetBgPtBin","",NBINS, LogBinsX ) << fJetFinderBin << fJetTriggerBin
344         <<"END";
345     fhBgZ 
346         << TH1D("BgZ","",NBINSZ, LogBinsZ ) << fJetFinderBin
347         <<"END";
348     fhBgZBin 
349         << TH1D("BgZBin","",NBINSZ, LogBinsZ ) << fJetFinderBin << fJetTriggerBin
350         <<"END";
351
352
353     fhBgJt 
354         << TH1D("BgJt","",NBINSJt, LogBinsJt ) << fJetFinderBin
355         <<"END";
356     fhBgJtBin 
357         << TH1D("BgJtBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
358         <<"END";
359     fhBgJtWeightBin 
360         << TH1D("BgJtWeightBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
361         <<"END";
362     fhBgLogJtWeightBin 
363         << TH1D("BgLogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin
364         <<"END";
365
366     fhBgJtWithPtCutWeightBinBin 
367         << TH1D("BgJtWithPtCutWeightBinBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
368         <<"END";
369     fhBgLogJtWithPtCutWeightBinBin 
370         << TH1D("BgLogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
371         <<"END";
372
373     
374     int NBINSdeltaN=40;
375     double LimLdeltaN=-19.5, LimHdeltaN=19.5;
376     fhdeltaN
377     << TH1D("hdeltaN","",NBINSdeltaN,LimLdeltaN,LimHdeltaN )
378     << fJetTriggerBin << fdRBin <<"END";
379
380     int NBINSdeltaE=400;
381     double LimLdeltaE=-20, LimHdeltaE=20;
382     fhdeltaE
383     << TH1D("hdeltaE","",NBINSdeltaE,LimLdeltaE,LimHdeltaE )
384     << fJetTriggerBin << fdRBin <<"END";
385
386
387     fhFullJetEChJetBin 
388         << TH1D("hFullJetEChJetBin","",NBINS, LogBinsX )  << fJetTriggerBin
389         <<"END";
390
391     int nDR = 1000;double xDR0= -10; double xDR1 = 10;
392     fhFullChdRChJetBin 
393         << TH1D("hFullChdRChJetBin","",nDR,xDR0,xDR1)  << fJetTriggerBin
394         <<"END";
395
396
397     fHMG->Print();
398     fHMG->WriteConfig();
399
400
401
402
403 }
404
405 void AliJJetJtAnalysis::ClearBeforeEvent(){
406     //fJetListOfList.Clear();
407
408
409 }
410
411 void AliJJetJtAnalysis::UserExec(){
412     for( int i=0;i<fJetListOfList.GetEntries();i++ ){
413         TObjArray * Jets = (TObjArray*) fJetListOfList[i];
414         if(!Jets) {
415             continue;
416         }
417         this->FillJtHistogram(Jets,i);
418     }
419
420
421     int iS1 = 0;
422     int iS2 = 3;
423     TObjArray * jetfinder1 = (TObjArray*) fJetListOfList[iS1];
424     TObjArray * jetfinder2 = (TObjArray*) fJetListOfList[iS2];
425     AliJJet *jet1 = NULL;
426     AliJJet *jet2 = NULL;
427     double deltaeta; 
428     int chEbin=-1, rbin=-1;
429     int dN=-1000;
430     double dE=-1000.;
431     for (int ijet = 0; ijet<jetfinder1->GetEntriesFast(); ijet++){
432         jet1 = dynamic_cast<AliJJet*>( jetfinder1->At(ijet) );
433         if (!jet1) continue;
434         for (int jjet = 0; jjet<jetfinder2->GetEntriesFast(); jjet++){
435             jet2 = dynamic_cast<AliJJet*>( jetfinder2->At(jjet) );
436             if (!jet2) continue;
437             chEbin = GetBin(fJetTriggPtBorders,jet2->Pt());
438             deltaeta = TMath::Abs(jet1->Eta()-jet2->Eta());
439             rbin   = GetBin(fDeltaRBorders,deltaeta); 
440             fJJetAnalysis->CompareTwoJets(jet1, jet2, dE, dN);
441             if (chEbin < 0 || rbin < 0 ) continue;
442             fhdeltaE[chEbin][rbin]->Fill(dE);
443             fhdeltaN[chEbin][rbin]->Fill(dN);
444             if (dN ==0) fhFullJetEChJetBin[chEbin]->Fill(jet1->E());
445             if (dN ==0) fhFullChdRChJetBin[chEbin]->Fill(jet1->DeltaR(*jet2));
446
447         }
448     }
449
450
451 }
452
453 void AliJJetJtAnalysis::WriteHistograms(){
454
455
456     TDirectory * cwd = gDirectory;
457     //const int nJetContainer = fJetListOfList.GetEntries();
458
459
460     for (int i=0; i<nJetContainer; i++){
461         TDirectory *nwd = gDirectory->mkdir(fJetFinderName[i]);
462         nwd->cd();
463         //fHistos[i]->WriteHistograms();
464         cwd->cd();
465     }
466
467
468 }
469
470
471
472 void AliJJetJtAnalysis::FillJtHistogram( TObjArray *Jets , int iContainer)
473 {       
474
475
476
477
478
479     int iBin, iptaBin=0;
480     int jBin=0;
481     double pT = 0;
482     double conPtMax =0;
483
484     double z; double jt;
485     double pta;
486     //double Y , deltaY = 0;
487     //double Phi, deltaPhi;
488     //double deltaR= 0;
489     //cout<<"histogram filling number of jets : "<<Jets->GetEntriesFast()<<endl;
490
491     TLorentzVector  vOrtho;
492
493
494
495     int k = 0;
496     double deltaR = -1;
497     double deltaEta = -999;
498     double deltaPhi = -999;
499     double effCorrection = -1;
500     double thisConeSize = fConeSizes[iContainer] ;
501
502     // iJet loop for an event
503     for (int i = 0; i<Jets->GetEntries(); i++){
504         AliJJet *jet = dynamic_cast<AliJJet*>( Jets->At(i) );
505         pT = jet->Pt();
506         if (pT<(*fJetTriggPtBorders)[1]) continue;
507         iBin = GetBin(fJetTriggPtBorders,pT); // fill jetPt histos
508         if( iBin < 0 ) continue;
509         fhJetPt[iContainer]->Fill( pT );
510         fhJetPtBin[iContainer][iBin]->Fill( pT );
511
512         for (int icon = 0; icon<jet->GetConstituents()->GetEntries(); icon++){
513             AliJBaseTrack *con = jet->GetConstituent(icon);
514             if (con->Pt()>conPtMax) conPtMax = con->Pt();
515         }
516
517         for (int ii = fJetConstPtLowLimits->GetNoElements(); ii >= 1 ; ii--)   {       // could also be done using GetBin( ... )
518             if (conPtMax > (*fJetConstPtLowLimits)[ii]) {               // if JetConstPtLowLimits={a,...,b} -> ConPtBinBorders={a,...,b,c}
519                 jBin = ii-1;                                                              // where c(>>b) is ''sufficiently'' high
520                 break;
521             }
522         }
523
524
525         //iConstituent loop for the iJet
526         //jt, z are calcualted and filled  
527         for (int icon = 0; icon<jet->GetConstituents()->GetEntries(); icon++){
528             AliJBaseTrack *constituent = jet->GetConstituent(icon);
529             z = (constituent->Vect()*jet->Vect().Unit())/jet->P();
530             pta = constituent->Pt();
531             constituent->SetTrackEff( fEfficiency->GetCorrection( pta, 5, fcent) );
532             effCorrection = 1.0/constituent->GetTrackEff();
533             iptaBin = GetBin(fJetAssocPtBorders, pta);
534             if( iptaBin < 0 ) continue;
535
536
537             fhZ[iContainer]->Fill( z , effCorrection);
538             fhZBin[iContainer][iBin]->Fill( z , effCorrection);
539             jt = (constituent->Vect()-z*jet->Vect()).Mag();
540             fhJt[iContainer]->Fill( jt , effCorrection);
541             fhJtBin[iContainer][iBin]->Fill( jt , effCorrection);
542             fhJtWeightBin[iContainer][iBin]->Fill( jt, 1.0/jt * effCorrection );
543             fhLogJtWeightBin[iContainer][iBin]->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
544
545
546
547             if (iptaBin < 0) continue;
548             fhJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]->Fill( jt, 1.0/jt * effCorrection );
549             fhLogJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]->Fill( TMath::Log(jt), 1.0/jt * effCorrection);
550
551             for (int jj = 0; jj <= jBin ; jj++) {
552                 fhJtBinLimBin[iContainer][iBin][jj]->Fill( jt, effCorrection );
553                 fhJtWeightBinLimBin[iContainer][iBin][jj]->Fill( jt, 1.0/jt * effCorrection );
554                 fhLogJtWeightBinLimBin[iContainer][iBin][jj]->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
555                 //histos->fHistosJT[0][0][iBin][jj]->Fill( TMath::Log(jt), 1.0/jt );
556             }
557
558         }
559
560
561
562         vOrtho.SetVect(jet->Vect().Orthogonal());
563         vOrtho.SetE(jet->E());
564         //if (Log) cout<<"Before R caluation, R = "<<TMath::Sqrt(it->area()/TMath::Pi())<<endl;
565         //R_area = TMath::Sqrt(it->area()/TMath::Pi())*Rs[order]/R;
566         //if (Log )cout<<"Rs[order] = "<<Rs[order]<<" R = "<<R<<" Bg R area : "<<R_area<<endl;
567
568         //Background jet (iBgJet) will be produced. This background jet is orthogonal to the iJet.  
569         //If there is another jJet, then iBgJet will be consecutevely moved not to have jJet in the cone size. 
570         if (Jets->GetEntries()>1){
571             for (int j = 0; j<Jets->GetEntries(); j++){
572                 if (i == j) continue;
573                 AliJJet *jet2 = dynamic_cast<AliJJet*>( Jets->At(j) );
574
575                 if (k>15) {
576                     break;
577                 }
578
579
580                 deltaEta = vOrtho.Eta() - jet2->Eta();
581                 deltaPhi = vOrtho.Phi() - jet2->Phi();
582                 deltaR   = TMath::Sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi);
583                 if ( deltaR < thisConeSize) {
584
585                     vOrtho.Rotate(TMath::Pi()/8, jet->Vect());
586                     j=0;
587                     k++;
588                 }
589
590             }
591         }
592
593         // Filling iBgJet,  Bgjt and Bgz
594         // "k<16" means that we will select a iBgJet which hasn't moved 
595         // more than 16 times by the process above
596         if ( k<16 ){
597             pT = vOrtho.Pt(); 
598             if (pT<(*fJetTriggPtBorders)[1]) continue;
599
600             fhJetBgPt[iContainer]->Fill( pT );
601             //bbfHistos[iContainer]->fhJetBgPtWeight->Fill( pT, 1./pT);
602             iBin = GetBin(fJetTriggPtBorders, pT);
603             if( iBin < 0 ) continue;
604             fhJetBgPtBin[iContainer][iBin]->Fill( pT );
605
606
607             for (int icon = 0; icon<fTracks->GetEntries(); icon++){
608                 AliJBaseTrack *track = dynamic_cast<AliJBaseTrack*>(fTracks->At(icon));
609                 if (!track) continue;
610                 deltaEta = vOrtho.Eta() - track->Eta();
611                 deltaPhi = vOrtho.Phi() - track->Phi();
612                 deltaR   = TMath::Sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi);
613                 if ( deltaR > thisConeSize) continue;
614
615                 pta = track->Pt();
616                 track->SetTrackEff( fEfficiency->GetCorrection( pta, 5, fcent) );
617                 effCorrection = 1.0/track->GetTrackEff();
618                 iptaBin = GetBin(fJetAssocPtBorders, pta);
619                 if( iptaBin < 0 ) continue;
620
621
622                 z = (track->Vect()*vOrtho.Vect().Unit())/vOrtho.P();
623                 fhBgZ[iContainer]->Fill( z , effCorrection);
624                 fhBgZBin[iContainer][iBin]->Fill( z , effCorrection);
625
626                 jt = (track->Vect()-z*vOrtho.Vect()).Mag();
627                 fhBgJt[iContainer]->Fill( jt , effCorrection);
628                 fhBgJtBin[iContainer][iBin]->Fill( jt , effCorrection);
629                 fhBgJtWeightBin[iContainer][iBin]->Fill( jt, 1.0/jt * effCorrection );
630                 fhBgLogJtWeightBin[iContainer][iBin]->Fill( TMath::Log(jt), 1.0/jt * effCorrection );
631
632                 if (iptaBin < 0) continue;
633                 fhBgJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]->Fill( jt, 1.0/jt * effCorrection );
634                 fhBgLogJtWithPtCutWeightBinBin[iContainer][iBin][iptaBin]->Fill( TMath::Log(jt), 2.0/jt * effCorrection );
635
636             } 
637         }
638
639
640     }
641 }
642
643
644