1 /**************************************************************************
2 * Copyright(c) 1998-2014, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 // Comment describing what this class does needed!
18 //===========================================================
19 // Dummy comment, should be replaced by a real one
22 // Simple class for the jt anlyais by Beomkyu Kim and Dongjo Kim
23 //===========================================================
30 #include "AliJEfficiency.h"
31 #include "AliJJetJtAnalysis.h"
32 #include "AliJHistManager.h"
33 #include "TClonesArray.h"
35 AliJJetJtAnalysis::AliJJetJtAnalysis():
41 , fJetTriggPtBorders(NULL)
42 , fJetConstPtLowLimits(NULL)
43 , fJetAssocPtBorders(NULL)
44 , fDeltaRBorders(NULL)
70 , fhJtWithPtCutWeightBinBin()
71 , fhLogJtWithPtCutWeightBinBin()
73 , fhJtWeightBinLimBin()
74 , fhLogJtWeightBinLimBin()
82 , fhBgLogJtWeightBin()
83 , fhBgJtWithPtCutWeightBinBin()
84 , fhBgLogJtWithPtCutWeightBinBin()
87 , fhFullJetEChJetBin()
88 , fhFullChdRChJetBin()
93 AliJJetJtAnalysis::AliJJetJtAnalysis( AliJCard * card ):
99 , fJetTriggPtBorders(NULL)
100 , fJetConstPtLowLimits(NULL)
101 , fJetAssocPtBorders(NULL)
102 , fDeltaRBorders(NULL)
105 , fJJetAnalysis(NULL)
128 , fhJtWithPtCutWeightBinBin()
129 , fhLogJtWithPtCutWeightBinBin()
131 , fhJtWeightBinLimBin()
132 , fhLogJtWeightBinLimBin()
140 , fhBgLogJtWeightBin()
141 , fhBgJtWithPtCutWeightBinBin()
142 , fhBgLogJtWithPtCutWeightBinBin()
145 , fhFullJetEChJetBin()
146 , fhFullChdRChJetBin()
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)
163 , fJJetAnalysis(ap.fJJetAnalysis)
164 , fJetFinderName(ap.fJetFinderName)
165 , fConeSizes(ap.fConeSizes)
166 , fEfficiency(ap.fEfficiency)
171 , fTracks(ap.fTracks)
173 , fJetFinderBin(ap.fJetFinderBin)
174 , fJetTriggerBin(ap.fJetTriggerBin)
175 , fTrkPtBin(ap.fTrkPtBin)
176 , fTrkLimPtBin(ap.fTrkLimPtBin)
178 , fhJetPt(ap.fhJetPt)
179 , fhJetPtBin(ap.fhJetPtBin)
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)
194 , fhBgZBin(ap.fhBgZBin)
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)
209 AliJJetJtAnalysis& AliJJetJtAnalysis::operator = (const AliJJetJtAnalysis& ap)
211 // assignment operator
213 this->~AliJJetJtAnalysis();
214 new(this) AliJJetJtAnalysis(ap);
219 AliJJetJtAnalysis::~AliJJetJtAnalysis(){
222 delete fJJetAnalysis;
223 fJetFinderName.clear();
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();
240 fJJetAnalysis = new AliJJetAnalysis();
242 fJetTriggPtBorders = fCard->GetVector("JetTriggPtBorders");
243 fJetConstPtLowLimits = fCard->GetVector("JetConstPtLowLimits");
244 fJetAssocPtBorders = fCard->GetVector("JetAssocPtBorders");
245 fDeltaRBorders = fCard->GetVector("DeltaRBorders");
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
251 TRegexp reg("R[0-9][0-9][0-9]");
252 TRegexp reg2("[0-9][0-9][0-9]");
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.);
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);
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"));
284 << TH1D("JetPt","",NBINS, LogBinsX ) << fJetFinderBin
287 << TH1D("JetPtBin","",NBINS, LogBinsX ) << fJetFinderBin << fJetTriggerBin
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);//
296 << TH1D("Z","",NBINSZ, LogBinsZ ) << fJetFinderBin
299 << TH1D("ZBin","",NBINSZ, LogBinsZ ) << fJetFinderBin << fJetTriggerBin
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);
307 double LimLJtW=TMath::Log(0.01), LimHJtW=TMath::Log(10);
310 << TH1D("Jt","",NBINSJt, LogBinsJt ) << fJetFinderBin
313 << TH1D("JtBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
316 << TH1D("JtWeightBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
319 << TH1D("LogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin
322 fhJtWithPtCutWeightBinBin
323 << TH1D("JtWithPtCutWeightBinBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
325 fhLogJtWithPtCutWeightBinBin
326 << TH1D("LogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
330 << TH1D("JtBinLimBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
333 << TH1D("JtWeightBinLimBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
335 fhLogJtWeightBinLimBin
336 << TH1D("LogJtWeightBinLimBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkLimPtBin
340 << TH1D("JetBgPt","",NBINS, LogBinsX ) << fJetFinderBin
343 << TH1D("JetBgPtBin","",NBINS, LogBinsX ) << fJetFinderBin << fJetTriggerBin
346 << TH1D("BgZ","",NBINSZ, LogBinsZ ) << fJetFinderBin
349 << TH1D("BgZBin","",NBINSZ, LogBinsZ ) << fJetFinderBin << fJetTriggerBin
354 << TH1D("BgJt","",NBINSJt, LogBinsJt ) << fJetFinderBin
357 << TH1D("BgJtBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
360 << TH1D("BgJtWeightBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin
363 << TH1D("BgLogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin
366 fhBgJtWithPtCutWeightBinBin
367 << TH1D("BgJtWithPtCutWeightBinBin","",NBINSJt, LogBinsJt ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
369 fhBgLogJtWithPtCutWeightBinBin
370 << TH1D("BgLogJtWeightBin","",NBINSJtW, LimLJtW, LimHJtW ) << fJetFinderBin << fJetTriggerBin << fTrkPtBin
375 double LimLdeltaN=-19.5, LimHdeltaN=19.5;
377 << TH1D("hdeltaN","",NBINSdeltaN,LimLdeltaN,LimHdeltaN )
378 << fJetTriggerBin << fdRBin <<"END";
381 double LimLdeltaE=-20, LimHdeltaE=20;
383 << TH1D("hdeltaE","",NBINSdeltaE,LimLdeltaE,LimHdeltaE )
384 << fJetTriggerBin << fdRBin <<"END";
388 << TH1D("hFullJetEChJetBin","",NBINS, LogBinsX ) << fJetTriggerBin
391 int nDR = 1000;double xDR0= -10; double xDR1 = 10;
393 << TH1D("hFullChdRChJetBin","",nDR,xDR0,xDR1) << fJetTriggerBin
405 void AliJJetJtAnalysis::ClearBeforeEvent(){
406 //fJetListOfList.Clear();
411 void AliJJetJtAnalysis::UserExec(){
412 for( int i=0;i<fJetListOfList.GetEntries();i++ ){
413 TObjArray * Jets = (TObjArray*) fJetListOfList[i];
417 this->FillJtHistogram(Jets,i);
423 TObjArray * jetfinder1 = (TObjArray*) fJetListOfList[iS1];
424 TObjArray * jetfinder2 = (TObjArray*) fJetListOfList[iS2];
425 AliJJet *jet1 = NULL;
426 AliJJet *jet2 = NULL;
428 int chEbin=-1, rbin=-1;
431 for (int ijet = 0; ijet<jetfinder1->GetEntriesFast(); ijet++){
432 jet1 = dynamic_cast<AliJJet*>( jetfinder1->At(ijet) );
434 for (int jjet = 0; jjet<jetfinder2->GetEntriesFast(); jjet++){
435 jet2 = dynamic_cast<AliJJet*>( jetfinder2->At(jjet) );
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));
453 void AliJJetJtAnalysis::WriteHistograms(){
456 TDirectory * cwd = gDirectory;
457 //const int nJetContainer = fJetListOfList.GetEntries();
460 for (int i=0; i<nJetContainer; i++){
461 TDirectory *nwd = gDirectory->mkdir(fJetFinderName[i]);
463 //fHistos[i]->WriteHistograms();
472 void AliJJetJtAnalysis::FillJtHistogram( TObjArray *Jets , int iContainer)
486 //double Y , deltaY = 0;
487 //double Phi, deltaPhi;
489 //cout<<"histogram filling number of jets : "<<Jets->GetEntriesFast()<<endl;
491 TLorentzVector vOrtho;
497 double deltaEta = -999;
498 double deltaPhi = -999;
499 double effCorrection = -1;
500 double thisConeSize = fConeSizes[iContainer] ;
502 // iJet loop for an event
503 for (int i = 0; i<Jets->GetEntries(); i++){
504 AliJJet *jet = dynamic_cast<AliJJet*>( Jets->At(i) );
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 );
512 for (int icon = 0; icon<jet->GetConstituents()->GetEntries(); icon++){
513 AliJBaseTrack *con = jet->GetConstituent(icon);
514 if (con->Pt()>conPtMax) conPtMax = con->Pt();
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
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;
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 );
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);
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 );
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;
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) );
580 deltaEta = vOrtho.Eta() - jet2->Eta();
581 deltaPhi = vOrtho.Phi() - jet2->Phi();
582 deltaR = TMath::Sqrt(deltaEta*deltaEta + deltaPhi*deltaPhi);
583 if ( deltaR < thisConeSize) {
585 vOrtho.Rotate(TMath::Pi()/8, jet->Vect());
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
598 if (pT<(*fJetTriggPtBorders)[1]) continue;
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 );
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;
616 track->SetTrackEff( fEfficiency->GetCorrection( pta, 5, fcent) );
617 effCorrection = 1.0/track->GetTrackEff();
618 iptaBin = GetBin(fJetAssocPtBorders, pta);
619 if( iptaBin < 0 ) continue;
622 z = (track->Vect()*vOrtho.Vect().Unit())/vOrtho.P();
623 fhBgZ[iContainer]->Fill( z , effCorrection);
624 fhBgZBin[iContainer][iBin]->Fill( z , effCorrection);
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 );
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 );