1 /**************************************************************************
2 * Copyright(c) 1998-1999, 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 **************************************************************************/
18 Revision 1.30 2002/12/09 16:26:28 morsch
19 - Nummber of particles per jet increased to 1000
22 Revision 1.29 2002/11/21 17:01:40 alibrary
23 Removing AliMCProcess and AliMC
25 Revision 1.28 2002/11/20 14:13:16 morsch
26 - FindChargedJets() added.
27 - Destructor corrected.
28 - Geometry cuts taken from AliEMCALGeometry.
30 Revision 1.27 2002/11/15 17:39:10 morsch
31 GetPythiaParticleName removed.
33 Revision 1.26 2002/10/14 14:55:35 hristov
34 Merging the VirtualMC branch to the main development branch (HEAD)
36 Revision 1.20.4.3 2002/10/10 15:07:49 hristov
37 Updating VirtualMC to v3-09-02
39 Revision 1.25 2002/09/13 10:24:57 morsch
42 Revision 1.24 2002/09/13 10:21:13 morsch
45 Revision 1.23 2002/06/27 09:24:26 morsch
46 Uncomment the TH1::AddDirectory statement.
48 Revision 1.22 2002/05/22 13:48:43 morsch
49 Pdg code added to track list.
51 Revision 1.21 2002/04/27 07:43:08 morsch
52 Calculation of fDphi corrected (Renan Cabrera)
54 Revision 1.20 2002/03/12 01:06:23 pavlinov
55 Testin output from generator
57 Revision 1.19 2002/02/27 00:46:33 pavlinov
58 Added method FillFromParticles()
60 Revision 1.18 2002/02/21 08:48:59 morsch
61 Correction in FillFromHitFlaggedTrack. (Jennifer Klay)
63 Revision 1.17 2002/02/14 08:52:53 morsch
64 Major updates by Aleksei Pavlinov:
65 FillFromPartons, FillFromTracks, jetfinder configuration.
67 Revision 1.16 2002/02/08 11:43:05 morsch
68 SetOutputFileName(..) allows to specify an output file to which the
69 reconstructed jets are written. If not set output goes to input file.
70 Attention call Init() before processing.
72 Revision 1.15 2002/02/02 08:37:18 morsch
73 Formula for rB corrected.
75 Revision 1.14 2002/02/01 08:55:30 morsch
76 Fill map with Et and pT.
78 Revision 1.13 2002/01/31 09:37:36 morsch
79 Geometry parameters in constructor and call of SetCellSize()
81 Revision 1.12 2002/01/23 13:40:23 morsch
82 Fastidious debug print statement removed.
84 Revision 1.11 2002/01/22 17:25:47 morsch
85 Some corrections for event mixing and bg event handling.
87 Revision 1.10 2002/01/22 10:31:44 morsch
88 Some correction for bg mixing.
90 Revision 1.9 2002/01/21 16:28:42 morsch
93 Revision 1.8 2002/01/21 16:05:31 morsch
94 - different phi-bin for hadron correction
95 - provisions for background mixing.
97 Revision 1.7 2002/01/21 15:47:18 morsch
98 Bending radius correctly in cm.
100 Revision 1.6 2002/01/21 12:53:50 morsch
103 Revision 1.5 2002/01/21 12:47:47 morsch
104 Possibility to include K0long and neutrons.
106 Revision 1.4 2002/01/21 11:03:21 morsch
107 Phi propagation introduced in FillFromTracks.
109 Revision 1.3 2002/01/18 05:07:56 morsch
110 - hadronic correction
112 - track selection upon EMCAL information
116 //*-- Authors: Andreas Morsch (CERN)
118 //* Aleksei Pavlinov (WSU)
123 #include <TClonesArray.h>
125 #include <TBranchElement.h>
133 #include <TPaveText.h>
136 #include <TParticle.h>
137 #include <TParticlePDG.h>
138 #include <TPythia6Calls.h>
141 #include "AliEMCALJetFinder.h"
142 #include "AliEMCALFast.h"
143 #include "AliEMCALGeometry.h"
144 #include "AliEMCALHit.h"
145 #include "AliEMCALDigit.h"
146 #include "AliEMCALDigitizer.h"
147 #include "AliEMCALHadronCorrection.h"
148 #include "AliEMCALJetMicroDst.h"
151 #include "AliMagFCM.h"
152 #include "AliEMCAL.h"
153 #include "AliHeader.h"
156 // Interface to FORTRAN
160 ClassImp(AliEMCALJetFinder)
162 //____________________________________________________________________________
163 AliEMCALJetFinder::AliEMCALJetFinder()
165 // Default constructor
184 fHadronCorrector = 0;
192 SetParametersForBgSubtraction();
195 AliEMCALJetFinder::AliEMCALJetFinder(const char* name, const char *title)
199 // Title is used in method GetFileNameForParameters();
201 fJets = new TClonesArray("AliEMCALJet",10000);
203 for (Int_t i = 0; i < 30000; i++)
225 fHadronCorrector = 0;
234 SetMomentumSmearing();
237 SetHadronCorrection();
238 SetSamplingFraction();
241 SetParametersForBgSubtraction();
244 void AliEMCALJetFinder::SetParametersForBgSubtraction
245 (Int_t mode, Float_t minMove, Float_t maxMove, Float_t precBg)
247 // see file /home/pavlinov/cosmic/pythia/jetFinderParamData.inc
248 // at WSU Linux cluster - 11-feb-2002
249 // These parameters must be tuned more carefull !!!
256 //____________________________________________________________________________
257 AliEMCALJetFinder::~AliEMCALJetFinder()
269 delete fhLegoHadrCorr;
272 delete fhCellEMCALEt;
274 delete fhTrackPtBcut;
275 delete fhChPartMultInTpc;
283 delete[] fTrackListB;
291 # define jet_finder_ua1 jet_finder_ua1_
293 # define type_of_call
296 # define jet_finder_ua1 JET_FINDER_UA1
298 # define type_of_call _stdcall
301 extern "C" void type_of_call
302 jet_finder_ua1(Int_t& ncell, Int_t& ncell_tot,
303 Float_t etc[30000], Float_t etac[30000],
305 Float_t& min_move, Float_t& max_move, Int_t& mode,
306 Float_t& prec_bg, Int_t& ierror);
308 extern "C" void type_of_call hf1(Int_t& id, Float_t& x, Float_t& wgt);
311 void AliEMCALJetFinder::Init()
314 // Geometry and I/O initialization
318 // Get geometry parameters from EMCAL
322 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
323 AliEMCALGeometry* geom =
324 AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
325 fNbinEta = geom->GetNZ();
326 fNbinPhi = geom->GetNPhi();
327 fPhiMin = geom->GetArm1PhiMin()*TMath::Pi()/180.;
328 fPhiMax = geom->GetArm1PhiMax()*TMath::Pi()/180.;
329 fEtaMin = geom->GetArm1EtaMin();
330 fEtaMax = geom->GetArm1EtaMax();
331 fDphi = (fPhiMax-fPhiMin)/fNbinPhi;
332 fDeta = (fEtaMax-fEtaMin)/fNbinEta;
333 fNtot = fNbinPhi*fNbinEta;
335 SetCellSize(fDeta, fDphi);
338 if (fOutFileName) fOutFile = new TFile(fOutFileName, "recreate");
341 void AliEMCALJetFinder::Find(Int_t ncell, Int_t ncell_tot, Float_t etc[30000],
342 Float_t etac[30000], Float_t phic[30000],
343 Float_t min_move, Float_t max_move, Int_t mode,
344 Float_t prec_bg, Int_t ierror)
346 // Wrapper for fortran coded jet finder
347 // Full argument list
348 jet_finder_ua1(ncell, ncell_tot, etc, etac, phic,
349 min_move, max_move, mode, prec_bg, ierror);
350 // Write result to output
351 if(fWrite) WriteJets();
355 void AliEMCALJetFinder::Find()
357 // Wrapper for fortran coded jet finder using member data for
360 Float_t min_move = fMinMove;
361 Float_t max_move = fMaxMove;
363 Float_t prec_bg = fPrecBg;
366 ResetJets(); // 4-feb-2002 by PAI
368 jet_finder_ua1(fNcell, fNtot, fEtCell, fEtaCell, fPhiCell,
369 min_move, max_move, mode, prec_bg, ierror);
371 // Write result to output
372 Int_t njet = Njets();
374 for (Int_t nj=0; nj<njet; nj++)
377 fJetT[nj] = new AliEMCALJet(JetEnergy(nj),
382 FindTracksInJetCone();
383 if(fWrite) WriteJets();
387 Int_t AliEMCALJetFinder::Njets()
389 // Get number of reconstructed jets
390 return EMCALJETS.njet;
393 Float_t AliEMCALJetFinder::JetEnergy(Int_t i)
395 // Get reconstructed jet energy
396 return EMCALJETS.etj[i];
399 Float_t AliEMCALJetFinder::JetPhiL(Int_t i)
401 // Get reconstructed jet phi from leading particle
402 return EMCALJETS.phij[0][i];
405 Float_t AliEMCALJetFinder::JetPhiW(Int_t i)
407 // Get reconstructed jet phi from weighting
408 return EMCALJETS.phij[1][i];
411 Float_t AliEMCALJetFinder::JetEtaL(Int_t i)
413 // Get reconstructed jet eta from leading particles
414 return EMCALJETS.etaj[0][i];
418 Float_t AliEMCALJetFinder::JetEtaW(Int_t i)
420 // Get reconstructed jet eta from weighting
421 return EMCALJETS.etaj[1][i];
424 void AliEMCALJetFinder::SetCellSize(Float_t eta, Float_t phi)
426 // Set grid cell size
427 EMCALCELLGEO.etaCellSize = eta;
428 EMCALCELLGEO.phiCellSize = phi;
431 void AliEMCALJetFinder::SetConeRadius(Float_t par)
433 // Set jet cone radius
434 EMCALJETPARAM.coneRad = par;
438 void AliEMCALJetFinder::SetEtSeed(Float_t par)
440 // Set et cut for seeds
441 EMCALJETPARAM.etSeed = par;
445 void AliEMCALJetFinder::SetMinJetEt(Float_t par)
447 // Set minimum jet et
448 EMCALJETPARAM.ejMin = par;
452 void AliEMCALJetFinder::SetMinCellEt(Float_t par)
454 // Set et cut per cell
455 EMCALJETPARAM.etMin = par;
459 void AliEMCALJetFinder::SetPtCut(Float_t par)
461 // Set pT cut on charged tracks
466 void AliEMCALJetFinder::Test()
469 // Test the finder call
471 const Int_t nmax = 30000;
473 Int_t ncell_tot = 100;
478 Float_t min_move = 0;
479 Float_t max_move = 0;
485 Find(ncell, ncell_tot, etc, etac, phic,
486 min_move, max_move, mode, prec_bg, ierror);
494 void AliEMCALJetFinder::AddJet(const AliEMCALJet& jet)
499 TClonesArray &lrawcl = *fJets;
500 new(lrawcl[fNjets++]) AliEMCALJet(jet);
503 void AliEMCALJetFinder::ResetJets()
512 void AliEMCALJetFinder::WriteJets()
515 // Add all jets to the list
517 const Int_t kBufferSize = 4000;
518 const char* file = 0;
520 Int_t njet = Njets();
522 for (Int_t nj = 0; nj < njet; nj++)
531 // output written to input file
533 AliEMCAL* pEMCAL = (AliEMCAL* )gAlice->GetModule("EMCAL");
534 TTree* pK = gAlice->TreeK();
535 file = (pK->GetCurrentFile())->GetName();
537 printf("Make Branch - TreeR address %p %p\n",gAlice->TreeR(), pEMCAL);
538 if (fJets && gAlice->TreeR()) {
539 pEMCAL->MakeBranchInTree(gAlice->TreeR(),
545 Int_t nev = gAlice->GetHeader()->GetEvent();
546 gAlice->TreeR()->Fill();
548 sprintf(hname,"TreeR%d", nev);
549 gAlice->TreeR()->Write(hname);
550 gAlice->TreeR()->Reset();
553 // Output written to user specified output file
555 TTree* pK = gAlice->TreeK();
556 fInFile = pK->GetCurrentFile();
560 sprintf(hname,"TreeR%d", fEvent);
561 TTree* treeJ = new TTree(hname, "EMCALJets");
562 treeJ->Branch("EMCALJets", &fJets, kBufferSize);
570 void AliEMCALJetFinder::BookLego()
573 // Book histo for discretisation
577 // Don't add histos to the current directory
578 if(fDebug) printf("\n AliEMCALJetFinder::BookLego() \n");
580 TH2::AddDirectory(0);
581 TH1::AddDirectory(0);
585 fLego = new TH2F("legoH","eta-phi",
586 fNbinEta, fEtaMin, fEtaMax,
587 fNbinPhi, fPhiMin, fPhiMax);
590 fLegoB = new TH2F("legoB","eta-phi for BG event",
591 fNbinEta, fEtaMin, fEtaMax,
592 fNbinPhi, fPhiMin, fPhiMax);
595 fhLegoTracks = new TH2F("hLegoTracks","eta-phi for Tracks",
596 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
598 fhLegoEMCAL = new TH2F("hLegoEMCAL","eta-phi for EMCAL",
599 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
600 // Hadron correction map
601 fhLegoHadrCorr = new TH2F("hLegoHadrCorr","eta-phi for Hadron. Correction",
602 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
603 // Hists. for tuning jet finder
604 fhEff = new TH2F("hEff","#epsilon vs momentum ", 100,0.,20., 50,0.5,1.);
608 for(Int_t i=1; i<=1000; i++) eTmp[i] = 0.1*i; // step 100 mev
609 for(Int_t i=1001; i<=1100; i++) eTmp[i] = eTmp[1000] + 1.0*(i-1000); // step 1GeV
611 fhCellEt = new TH1F("hCellEt","Cell E_{T} from fLego",
612 eTmp.GetSize()-1, eTmp.GetArray());
613 fhCellEMCALEt = new TH1F("hCellEMCALEt","Cell E_{T} for EMCAL itself",
614 eTmp.GetSize()-1, eTmp.GetArray());
615 fhTrackPt = new TH1F("hTrackPt","Ch.particles P_{T} ",
616 eTmp.GetSize()-1, eTmp.GetArray());
617 fhTrackPtBcut = new TH1F("hTrackPtBcut","Ch.particles P_{T} + magnetic field cut",
618 eTmp.GetSize()-1, eTmp.GetArray());
620 fhChPartMultInTpc = new TH1F("hChPartMultInTpc",
621 "Charge partilcle multiplicity in |%eta|<0.9", 2000, 0, 20000);
623 //! first canvas for drawing
624 fHistsList=AliEMCALJetMicroDst::MoveHistsToList("Hists from AliEMCALJetFinder", kTRUE);
627 void AliEMCALJetFinder::DumpLego()
630 // Dump lego histo into array
633 TAxis* Xaxis = fLego->GetXaxis();
634 TAxis* Yaxis = fLego->GetYaxis();
635 // fhCellEt->Clear();
637 for (Int_t i = 1; i <= fNbinEta; i++) {
638 for (Int_t j = 1; j <= fNbinPhi; j++) {
639 e = fLego->GetBinContent(i,j);
641 Float_t eta = Xaxis->GetBinCenter(i);
642 Float_t phi = Yaxis->GetBinCenter(j);
644 fEtaCell[fNcell] = eta;
645 fPhiCell[fNcell] = phi;
650 eH = fhLegoEMCAL->GetBinContent(i,j);
651 if(eH > 0.0) fhCellEMCALEt->Fill(eH);
658 void AliEMCALJetFinder::ResetMap()
661 // Reset eta-phi array
663 for (Int_t i=0; i<30000; i++)
672 void AliEMCALJetFinder::FillFromTracks(Int_t flag, Int_t ich)
675 // Fill Cells with track information
678 printf("\n AliEMCALJetFinder::FillFromTracks(%i,%i) ",flag,ich);
683 if (!fLego) BookLego();
685 if (flag == 0) fLego->Reset();
687 // Access particle information
688 Int_t npart = (gAlice->GetHeader())->GetNprimary();
689 Int_t ntr = (gAlice->GetHeader())->GetNtrack();
690 printf(" : #primary particles %i # tracks %i \n", npart, ntr);
695 // 1: selected for jet finding
698 if (fTrackList) delete[] fTrackList;
699 if (fPtT) delete[] fPtT;
700 if (fEtaT) delete[] fEtaT;
701 if (fPhiT) delete[] fPhiT;
702 if (fPdgT) delete[] fPdgT;
704 fTrackList = new Int_t [npart];
705 fPtT = new Float_t[npart];
706 fEtaT = new Float_t[npart];
707 fPhiT = new Float_t[npart];
708 fPdgT = new Int_t[npart];
712 Float_t chTmp=0.0; // charge of current particle
715 // this is for Pythia ??
716 for (Int_t part = 0; part < npart; part++) {
717 TParticle *MPart = gAlice->Particle(part);
718 Int_t mpart = MPart->GetPdgCode();
719 Int_t child1 = MPart->GetFirstDaughter();
720 Float_t pT = MPart->Pt();
721 Float_t p = MPart->P();
722 Float_t phi = MPart->Phi();
724 if(pT > 0.001) eta = MPart->Eta();
725 Float_t theta = MPart->Theta();
727 printf("ind %7i part %7i -> child1 %5i child2 %5i Status %5i\n",
728 part, mpart, child1, MPart->GetLastDaughter(), MPart->GetStatusCode());
732 if (part == 6 || part == 7)
734 printf("\n Simulated Jet (pt, eta, phi): %d %f %f %f\n",
735 part-5, pT, eta, phi);
740 // printf("\n Simulated Jet (pt, eta, phi): %d %d %f %f %f",
741 // part, mpart, pT, eta, phi);
744 fTrackList[part] = 0;
745 fPtT[part] = pT; // must be change after correction for resolution !!!
751 if (part < 2) continue;
753 // move to fLego->Fill because hadron correction must apply
754 // if particle hit to EMCAL - 11-feb-2002
755 // if (pT == 0 || pT < fPtCut) continue;
756 TParticlePDG* pdgP = 0;
757 // charged or neutral
758 pdgP = MPart->GetPDG();
759 chTmp = pdgP->Charge() / 3.; // 13-feb-2001!!
766 if (mpart != kNeutron &&
767 mpart != kNeutronBar &&
768 mpart != kK0Long) continue;
774 if (TMath::Abs(mpart) <= 6 ||
776 mpart == 92) continue;
778 if (TMath::Abs(eta)<=0.9) fNChTpc++;
780 if (child1 >= 0 && child1 < npart) continue;
782 if (eta > fEtaMax || eta < fEtaMin) continue;
783 if (phi > fPhiMax || phi < fPhiMin ) continue;
786 printf("\n=>nsel:%5d mpart %5d child1 %5d eta %6.2f phi %6.2f pT %6.2f ch %3.0f ",
787 part, mpart, child1, eta, phi, pT, chTmp);
790 // Momentum smearing goes here ...
794 if (fSmear && TMath::Abs(chTmp)) {
795 pw = AliEMCALFast::SmearMomentum(1,p);
796 // p changed - take into account when calculate pT,
799 if(fDebug >= 4) printf("\n Smearing : p %8.4f change to %8.4f ", p, pw);
803 // Tracking Efficiency and TPC acceptance goes here ...
805 if (fEffic && TMath::Abs(chTmp)) {
806 // eff = AliEMCALFast::Efficiency(1,p);
807 eff = 0.95; // for testing 25-feb-2002
808 if(fhEff) fhEff->Fill(p, eff);
809 if (AliEMCALFast::RandomReject(eff)) {
810 if(fDebug >= 5) printf(" reject due to unefficiency ");
815 // Correction of Hadronic Energy goes here ...
818 // phi propagation for hadronic correction
820 Bool_t curls = kFALSE; // hit two the EMCAL (no curl)
821 Float_t phiHC=0.0, dpH=0.0, dphi=0.0, eTdpH=0;
822 if(TMath::Abs(chTmp)) {
823 // hadr. correction only for charge particle
824 dphi = PropagatePhi(pT, chTmp, curls);
827 printf("\n Delta phi %f pT %f ", dphi, pT);
828 if (curls) printf("\n !! Track is curling");
830 if(!curls) fhTrackPtBcut->Fill(pT);
832 if (fHCorrection && !curls) {
833 if (!fHadronCorrector)
834 Fatal("AliEMCALJetFinder",
835 "Hadronic energy correction required but not defined !");
837 dpH = fHadronCorrector->GetEnergy(p, eta, 7);
838 eTdpH = dpH*TMath::Sin(theta);
840 if (fDebug >= 7) printf(" phi %f phiHC %f eTcorr %f\n",
841 phi, phiHC, -eTdpH); // correction is negative
842 fLego->Fill(eta, phiHC, -eTdpH);
843 fhLegoHadrCorr->Fill(eta, phiHC, eTdpH);
847 // More to do ? Just think about it !
849 if (phi > fPhiMax || phi < fPhiMin ) continue;
851 if(TMath::Abs(chTmp) ) { // charge particle
852 if (pT > fPtCut && !curls) {
853 if (fDebug >= 8) printf("Charge : fLego->Fill(%5.2f, %5.2f, %6.2f, %d)\n",
854 eta , phi, pT, fNtS);
855 fLego->Fill(eta, phi, pT);
856 fhLegoTracks->Fill(eta, phi, pT); // 20-feb for checking
857 fTrackList[part] = 1;
860 } else if(ich==0 && fK0N) {
861 // case of n, nbar and K0L
862 if (fDebug >= 9) printf("Neutral : fLego->Fill(%5.2f, %5.2f, %6.2f, %d)\n",
863 eta , phi, pT, fNtS);
864 fLego->Fill(eta, phi, pT);
865 fTrackList[part] = 1;
873 void AliEMCALJetFinder::FillFromHits(Int_t flag)
876 // Fill Cells with hit information
880 printf("\n AliEMCALJetFinder::FillFromHits(%i)\n",flag);
884 if (!fLego) BookLego();
885 // Reset eta-phi maps if needed
886 if (flag == 0) { // default behavior
888 fhLegoTracks->Reset();
889 fhLegoEMCAL->Reset();
890 fhLegoHadrCorr->Reset();
892 // Initialize from background event if available
894 // Access hit information
895 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
896 TTree *treeH = gAlice->TreeH();
897 Int_t ntracks = (Int_t) treeH->GetEntries();
904 for (Int_t track=0; track<ntracks;track++) {
906 nbytes += treeH->GetEvent(track);
910 for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
912 mHit=(AliEMCALHit*) pEMCAL->NextHit())
914 Float_t x = mHit->X(); // x-pos of hit
915 Float_t y = mHit->Y(); // y-pos
916 Float_t z = mHit->Z(); // z-pos
917 Float_t eloss = mHit->GetEnergy(); // deposited energy
919 Float_t r = TMath::Sqrt(x*x+y*y);
920 Float_t theta = TMath::ATan2(r,z);
921 Float_t eta = -TMath::Log(TMath::Tan(theta/2.));
922 Float_t phi = TMath::ATan2(y,x);
924 if (fDebug >= 11) printf("\n Hit %f %f %f %f", x, y, z, eloss);
925 // printf("\n Hit %f %f %f %f", x, y, z, eloss);
927 etH = fSamplingF*eloss*TMath::Sin(theta);
928 fLego->Fill(eta, phi, etH);
929 // fhLegoEMCAL->Fill(eta, phi, etH);
932 // copy content of fLego to fhLegoEMCAL (fLego and fhLegoEMCAL are identical)
933 for(Int_t i=0; i<fLego->GetSize(); i++) (*fhLegoEMCAL)[i] = (*fLego)[i];
937 void AliEMCALJetFinder::FillFromDigits(Int_t flag)
940 // Fill Cells with digit information
945 if (!fLego) BookLego();
946 if (flag == 0) fLego->Reset();
953 TClonesArray* digs = new TClonesArray("AliEMCALDigit", 10000);
954 TTree *treeD = gAlice->TreeD();
955 TBranchElement* branchDg = (TBranchElement*)
956 treeD->GetBranch("EMCAL");
958 if (!branchDg) Fatal("AliEMCALJetFinder",
959 "Reading digits requested but no digits in file !");
961 branchDg->SetAddress(&digs);
962 Int_t nent = (Int_t) branchDg->GetEntries();
966 AliEMCALDigitizer* digr = new AliEMCALDigitizer();
967 TBranchElement* branchDr = (TBranchElement*)
968 treeD->GetBranch("AliEMCALDigitizer");
969 branchDr->SetAddress(&digr);
972 nbytes += branchDg->GetEntry(0);
973 nbytes += branchDr->GetEntry(0);
975 // Get digitizer parameters
976 Float_t preADCped = digr->GetPREpedestal();
977 Float_t preADCcha = digr->GetPREchannel();
978 Float_t ecADCped = digr->GetECpedestal();
979 Float_t ecADCcha = digr->GetECchannel();
980 Float_t hcADCped = digr->GetHCpedestal();
981 Float_t hcADCcha = digr->GetHCchannel();
983 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
984 AliEMCALGeometry* geom =
985 AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
988 Int_t ndig = digs->GetEntries();
989 Info("FillFromDigits","Number of Digits: %d %d\n Parameters: PRE : %f %f EC: %f %f HC: %f %f\n Geometry: %d %d",
990 ndig, nent, preADCped, preADCcha, ecADCped, ecADCcha, hcADCped, hcADCcha, geom->GetNEta(), geom->GetNPhi());
997 while ((sdg = (AliEMCALDigit*)(next())))
999 Double_t pedestal = 0.;
1000 Double_t channel = 0.;
1001 if (geom->IsInPRE(sdg->GetId())) {
1002 pedestal = preADCped;
1003 channel = preADCcha;
1005 else if (geom->IsInECAL(sdg->GetId())) {
1006 pedestal = ecADCped;
1009 else if (geom->IsInHCAL(sdg->GetId())) {
1010 pedestal = hcADCped;
1014 Fatal("FillFromDigits", "unexpected digit is number!") ;
1016 Float_t eta = sdg->GetEta();
1017 Float_t phi = sdg->GetPhi() * TMath::Pi()/180.;
1018 Float_t amp = (Float_t) (channel*(sdg->GetAmp())-pedestal);
1021 Info("FillFromDigits", "Digit: eta %8.3f phi %8.3f amp %8.3f %8d",
1022 eta, phi, amp, sdg->GetAmp());
1024 fLego->Fill(eta, phi, fSamplingF*amp);
1032 void AliEMCALJetFinder::FillFromHitFlaggedTracks(Int_t flag)
1035 // Fill Cells with hit information
1040 if (!fLego) BookLego();
1042 if (flag == 0) fLego->Reset();
1044 // Flag charged tracks passing through TPC which
1045 // are associated to EMCAL Hits
1046 BuildTrackFlagTable();
1049 // Access particle information
1050 TTree *treeK = gAlice->TreeK();
1051 Int_t ntracks = (Int_t) treeK->GetEntries();
1053 if (fPtT) delete[] fPtT;
1054 if (fEtaT) delete[] fEtaT;
1055 if (fPhiT) delete[] fPhiT;
1056 if (fPdgT) delete[] fPdgT;
1058 fPtT = new Float_t[ntracks];
1059 fEtaT = new Float_t[ntracks];
1060 fPhiT = new Float_t[ntracks];
1061 fPdgT = new Int_t[ntracks];
1066 for (Int_t track = 0; track < ntracks; track++) {
1067 TParticle *MPart = gAlice->Particle(track);
1068 Float_t pT = MPart->Pt();
1069 Float_t phi = MPart->Phi();
1070 Float_t eta = MPart->Eta();
1072 if(fTrackList[track]) {
1076 fPdgT[track] = MPart->GetPdgCode();
1078 if (track < 2) continue; //Colliding particles?
1079 if (pT == 0 || pT < fPtCut) continue;
1081 fLego->Fill(eta, phi, pT);
1087 void AliEMCALJetFinder::FillFromParticles()
1089 // 26-feb-2002 PAI - for checking all chain
1090 // Work on particles level; accept all particle (not neutrino )
1092 Double_t PX=0, PY=0, PZ=0, E=0; // checking conservation law
1096 if (!fLego) BookLego();
1099 // Access particles information
1100 Int_t npart = (gAlice->GetHeader())->GetNprimary();
1101 if (fDebug >= 2 || npart<=0) {
1102 printf(" AliEMCALJetFinder::FillFromParticles : npart %i\n", npart);
1103 if(npart<=0) return;
1107 RearrangeParticlesMemory(npart);
1109 // Go through the particles
1110 Int_t mpart, child1, child2, geantPdg;
1111 Float_t pT, phi, eta, e=0, px=0, py=0, pz=0;
1113 for (Int_t part = 0; part < npart; part++) {
1115 fTrackList[part] = 0;
1117 MPart = gAlice->Particle(part);
1118 mpart = MPart->GetPdgCode();
1119 child1 = MPart->GetFirstDaughter();
1120 child2 = MPart->GetLastDaughter();
1128 e = MPart->Energy();
1130 // see pyedit in Pythia's text
1132 if (IsThisPartonsOrDiQuark(mpart)) continue;
1133 printf("%5i: %5i(%2i) px %5.1f py %5.1f pz %6.1f e %6.1f childs %5i,%5i \n",
1134 part, mpart, geantPdg, px, py, pz, e, child1, child2);
1136 // exclude partons (21 - gluon, 92 - string)
1139 // exclude neutrinous also ??
1140 if (fDebug >= 11 && pT>0.01)
1141 printf("\n part:%5d mpart %5d eta %9.2f phi %9.2f pT %9.2f ",
1142 part, mpart, eta, phi, pT);
1147 fPdgT[part] = mpart;
1151 if (child1 >= 0 && child1 < npart) continue;
1153 // printf("%4i -> %5i(%3i) px %6.1f py %6.1f pz %7.1f e %8.2f child1 %5i %s\n",
1154 // part, mpart, geantPdg, px, py, pz, e, child1, name.Data());
1161 if (TMath::Abs(eta) <= 0.9) fNChTpc++;
1163 if (eta > fEtaMax || eta < fEtaMin) continue;
1164 if (phi > fPhiMax || phi < fPhiMin ) continue;
1166 if(fK0N==0 ) { // exclude neutral hadrons
1167 if (mpart == kNeutron || mpart == kNeutronBar || mpart == kK0Long) continue;
1169 fTrackList[part] = 1;
1170 fLego->Fill(eta, phi, pT);
1173 printf("\n PX %8.2f PY %8.2f PZ %8.2f E %8.2f \n",
1176 if(fhChPartMultInTpc) fhChPartMultInTpc->Fill(fNChTpc);
1179 void AliEMCALJetFinder::FillFromPartons()
1181 // function under construction - 13-feb-2002 PAI
1184 printf("\n AliEMCALJetFinder::FillFromPartons()\n");
1188 if (!fLego) BookLego();
1191 // Access particle information
1192 Int_t npart = (gAlice->GetHeader())->GetNprimary();
1193 if (fDebug >= 2 || npart<=0)
1194 printf("\n AliEMCALJetFinder::FillFromPartons : npart %i\n", npart);
1195 fNt = 0; // for FindTracksInJetCone
1198 // Go through the partons
1200 for (Int_t part = 8; part < npart; part++) {
1201 TParticle *MPart = gAlice->Particle(part);
1202 Int_t mpart = MPart->GetPdgCode();
1203 // Int_t child1 = MPart->GetFirstDaughter();
1204 Float_t pT = MPart->Pt();
1205 // Float_t p = MPart->P();
1206 Float_t phi = MPart->Phi();
1207 Float_t eta = MPart->Eta();
1208 // Float_t theta = MPart->Theta();
1209 statusCode = MPart->GetStatusCode();
1211 // accept partons (21 - gluon, 92 - string)
1212 if (!(TMath::Abs(mpart) <= 6 || mpart == 21 ||mpart == 92)) continue;
1213 if (fDebug > 1 && pT>0.01)
1214 printf("\n part:%5d mpart %5d status %5d eta %8.2f phi %8.2f pT %8.2f ",
1215 part, mpart, statusCode, eta, phi, pT);
1216 // if (fDebug >= 3) MPart->Print();
1217 // accept partons before fragmentation - p.57 in Pythia manual
1218 // if(statusCode != 1) continue;
1220 if (eta > fEtaMax || eta < fEtaMin) continue;
1221 if (phi > fPhiMax || phi < fPhiMin ) continue;
1223 // if (child1 >= 0 && child1 < npart) continue;
1226 fLego->Fill(eta, phi, pT);
1232 void AliEMCALJetFinder::BuildTrackFlagTable() {
1234 // Method to generate a lookup table for TreeK particles
1235 // which are linked to hits in the EMCAL
1237 // --Author: J.L. Klay
1239 // Access hit information
1240 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
1242 TTree *TK = gAlice->TreeK(); // Get the number of entries in the kine tree
1243 Int_t nKTrks = (Int_t) TK->GetEntries(); // (Number of particles created somewhere)
1245 if(fTrackList) delete[] fTrackList; //Make sure we get rid of the old one
1246 fTrackList = new Int_t[nKTrks]; //before generating a new one
1248 for (Int_t i = 0; i < nKTrks; i++) { //Initialize members to 0
1252 TTree *treeH = gAlice->TreeH();
1253 Int_t ntracks = (Int_t) treeH->GetEntries();
1259 for (Int_t track=0; track<ntracks;track++) {
1260 gAlice->ResetHits();
1261 nbytes += treeH->GetEvent(track);
1267 for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
1269 mHit=(AliEMCALHit*) pEMCAL->NextHit())
1271 Int_t iTrk = mHit->Track(); // track number
1272 Int_t idprim = mHit->GetPrimary(); // primary particle
1274 //Determine the origin point of this particle - it made a hit in the EMCAL
1275 TParticle *trkPart = gAlice->Particle(iTrk);
1276 TParticlePDG *trkPdg = trkPart->GetPDG();
1277 Int_t trkCode = trkPart->GetPdgCode();
1279 if (trkCode < 10000) { //Big Ions cause problems for
1280 trkChg = trkPdg->Charge(); //this function. Since they aren't
1281 } else { //likely to make it very far, set
1282 trkChg = 0.0; //their charge to 0 for the Flag test
1284 Float_t vxTrk = trkPart->Vx();
1285 Float_t vyTrk = trkPart->Vy();
1286 Float_t vrTrk = TMath::Sqrt(vxTrk*vxTrk+vyTrk*vyTrk);
1287 fTrackList[iTrk] = SetTrackFlag(vrTrk,trkCode,trkChg);
1289 //Loop through the ancestry of the EMCAL entrance particles
1290 Int_t ancestor = trkPart->GetFirstMother(); //Get track's Mother
1291 while (ancestor != -1) {
1292 TParticle *ancPart = gAlice->Particle(ancestor); //get particle info on ancestor
1293 TParticlePDG *ancPdg = ancPart->GetPDG();
1294 Int_t ancCode = ancPart->GetPdgCode();
1296 if (ancCode < 10000) {
1297 ancChg = ancPdg->Charge();
1301 Float_t vxAnc = ancPart->Vx();
1302 Float_t vyAnc = ancPart->Vy();
1303 Float_t vrAnc = TMath::Sqrt(vxAnc*vxAnc+vyAnc*vyAnc);
1304 fTrackList[ancestor] = SetTrackFlag(vrAnc,ancCode,ancChg);
1305 ancestor = ancPart->GetFirstMother(); //Get the next ancestor
1308 //Determine the origin point of the primary particle associated with the hit
1309 TParticle *primPart = gAlice->Particle(idprim);
1310 TParticlePDG *primPdg = primPart->GetPDG();
1311 Int_t primCode = primPart->GetPdgCode();
1313 if (primCode < 10000) {
1314 primChg = primPdg->Charge();
1318 Float_t vxPrim = primPart->Vx();
1319 Float_t vyPrim = primPart->Vy();
1320 Float_t vrPrim = TMath::Sqrt(vxPrim*vxPrim+vyPrim*vyPrim);
1321 fTrackList[idprim] = SetTrackFlag(vrPrim,primCode,primChg);
1327 Int_t AliEMCALJetFinder
1328 ::SetTrackFlag(Float_t radius, Int_t code, Double_t charge) {
1334 if (charge == 0) neutral = 1;
1336 if (TMath::Abs(code) <= 6 ||
1338 code == 92) parton = 1;
1340 //It's not a parton, it's charged and it went through the TPC
1341 if (!parton && !neutral && radius <= 84.0) flag = 1;
1348 void AliEMCALJetFinder::SaveBackgroundEvent()
1350 // Saves the eta-phi lego and the tracklist
1354 (*fLegoB) = (*fLegoB) + (*fLego);
1356 printf("\n AliEMCALJetFinder::SaveBackgroundEvent() (fLegoB) %f = %f(fLego) \n",
1357 fLegoB->Integral(), fLego->Integral());
1360 if (fPtB) delete[] fPtB;
1361 if (fEtaB) delete[] fEtaB;
1362 if (fPhiB) delete[] fPhiB;
1363 if (fPdgB) delete[] fPdgB;
1364 if (fTrackListB) delete[] fTrackListB;
1366 fPtB = new Float_t[fNtS];
1367 fEtaB = new Float_t[fNtS];
1368 fPhiB = new Float_t[fNtS];
1369 fPdgB = new Int_t [fNtS];
1370 fTrackListB = new Int_t [fNtS];
1374 for (Int_t i = 0; i < fNt; i++) {
1375 if (!fTrackList[i]) continue;
1376 fPtB [fNtB] = fPtT [i];
1377 fEtaB[fNtB] = fEtaT[i];
1378 fPhiB[fNtB] = fPhiT[i];
1379 fPdgB[fNtB] = fPdgT[i];
1380 fTrackListB[fNtB] = 1;
1384 printf(" fNtB %i => fNtS %i #particles %i \n", fNtB, fNtS, fNt);
1387 void AliEMCALJetFinder::InitFromBackground()
1391 if (fDebug) printf("\n AliEMCALJetFinder::InitFromBackground() ");
1395 (*fLego) = (*fLego) + (*fLegoB);
1397 printf("\n AliEMCALJetFinder::SaveBackgroundEvent() (fLego) %f = %f(fLegoB) \n",
1398 fLego->Integral(), fLegoB->Integral());
1400 printf(" => fLego undefined \n");
1405 void AliEMCALJetFinder::FindTracksInJetCone()
1408 // Build list of tracks inside jet cone
1411 Int_t njet = Njets();
1412 for (Int_t nj = 0; nj < njet; nj++)
1414 Float_t etaj = JetEtaW(nj);
1415 Float_t phij = JetPhiW(nj);
1416 Int_t nT = 0; // number of associated tracks
1418 // Loop over particles in current event
1419 for (Int_t part = 0; part < fNt; part++) {
1420 if (!fTrackList[part]) continue;
1421 Float_t phi = fPhiT[part];
1422 Float_t eta = fEtaT[part];
1423 Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) +
1424 (phij-phi)*(phij-phi));
1425 if (dr < fConeRadius) {
1426 fTrackList[part] = nj+2;
1431 // Same for background event if available
1434 for (Int_t part = 0; part < fNtB; part++) {
1435 Float_t phi = fPhiB[part];
1436 Float_t eta = fEtaB[part];
1437 Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) +
1438 (phij-phi)*(phij-phi));
1439 fTrackListB[part] = 1;
1441 if (dr < fConeRadius) {
1442 fTrackListB[part] = nj+2;
1446 } // Background available ?
1448 Int_t nT0 = nT + nTB;
1449 printf("Total number of tracks %d\n", nT0);
1451 if (nT0 > 1000) nT0 = 1000;
1453 Float_t* ptT = new Float_t[nT0];
1454 Float_t* etaT = new Float_t[nT0];
1455 Float_t* phiT = new Float_t[nT0];
1456 Int_t* pdgT = new Int_t[nT0];
1461 for (Int_t part = 0; part < fNt; part++) {
1462 if (fTrackList[part] == nj+2) {
1464 for (j=iT-1; j>=0; j--) {
1465 if (fPtT[part] > ptT[j]) {
1470 for (j=iT-1; j>=index; j--) {
1471 ptT [j+1] = ptT [j];
1472 etaT[j+1] = etaT[j];
1473 phiT[j+1] = phiT[j];
1474 pdgT[j+1] = pdgT[j];
1476 ptT [index] = fPtT [part];
1477 etaT[index] = fEtaT[part];
1478 phiT[index] = fPhiT[part];
1479 pdgT[index] = fPdgT[part];
1481 } // particle associated
1482 if (iT > nT0) break;
1486 for (Int_t part = 0; part < fNtB; part++) {
1487 if (fTrackListB[part] == nj+2) {
1489 for (j=iT-1; j>=0; j--) {
1490 if (fPtB[part] > ptT[j]) {
1496 for (j=iT-1; j>=index; j--) {
1497 ptT [j+1] = ptT [j];
1498 etaT[j+1] = etaT[j];
1499 phiT[j+1] = phiT[j];
1500 pdgT[j+1] = pdgT[j];
1502 ptT [index] = fPtB [part];
1503 etaT[index] = fEtaB[part];
1504 phiT[index] = fPhiB[part];
1505 pdgT[index] = fPdgB[part];
1507 } // particle associated
1508 if (iT > nT0) break;
1510 } // Background available ?
1512 fJetT[nj]->SetTrackList(nT0, ptT, etaT, phiT, pdgT);
1521 Float_t AliEMCALJetFinder::PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls)
1523 // Propagates phi angle to EMCAL radius
1525 static Float_t b = 0.0, rEMCAL = -1.0;
1528 b = gAlice->Field()->SolenoidField();
1529 // Get EMCAL radius in cm
1530 rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance();
1531 printf("\nMagnetic field %f rEMCAL %f ", b, rEMCAL);
1540 Float_t rB = 3335.6 * pt / b; // [cm] (case of |charge|=1)
1542 // check if particle is curling below EMCAL
1543 if (2.*rB < rEMCAL) {
1548 // if not calculate delta phi
1549 Float_t phi = TMath::ACos(1.-rEMCAL*rEMCAL/(2.*rB*rB));
1550 dPhi = TMath::ATan2(1.-TMath::Cos(phi), TMath::Sin(phi));
1551 dPhi = -TMath::Sign(dPhi, charge);
1556 void hf1(Int_t& id, Float_t& x, Float_t& wgt)
1558 // dummy for hbook calls
1562 void AliEMCALJetFinder::DrawLego(Char_t *opt)
1565 void AliEMCALJetFinder::DrawLegoEMCAL(Char_t *opt)
1566 {fhLegoEMCAL->Draw(opt);}
1568 void AliEMCALJetFinder::DrawHistsForTuning(Int_t mode)
1570 static TPaveText *varLabel=0;
1572 fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800);
1582 fhCellEMCALEt->Draw();
1587 fhTrackPtBcut->SetLineColor(2);
1588 fhTrackPtBcut->Draw("same");
1593 varLabel = new TPaveText(0.05,0.5,0.95,0.95,"NDC");
1594 varLabel->SetTextAlign(12);
1595 varLabel->SetFillColor(19); // see TAttFill
1596 TString tmp(GetTitle());
1597 varLabel->ReadFile(GetFileNameForParameters());
1601 if(mode) { // for saving picture to the file
1602 TString stmp(GetFileNameForParameters());
1603 stmp.ReplaceAll("_Par.txt",".ps");
1604 fC1->Print(stmp.Data());
1608 void AliEMCALJetFinder::PrintParameters(Int_t mode)
1611 if(mode==0) file = stdout; // output to terminal
1613 file = fopen(GetFileNameForParameters(),"w");
1614 if(file==0) file = stdout;
1616 fprintf(file,"==== Filling lego ==== \n");
1617 fprintf(file,"Smearing %6i ", fSmear);
1618 fprintf(file,"Efficiency %6i\n", fEffic);
1619 fprintf(file,"Hadr.Correct. %6i ", fHCorrection);
1620 fprintf(file,"P_{T} Cut of ch.par. %6.2f\n", fPtCut);
1621 fprintf(file,"==== Jet finding ==== \n");
1622 fprintf(file,"Cone radius %6.2f ", fConeRadius);
1623 fprintf(file,"Seed E_{T} %6.1f\n", fEtSeed);
1624 fprintf(file,"Min E_{T} of cell %6.1f ", fMinCellEt);
1625 fprintf(file,"Min E_{T} of jet %6.1f\n", fMinJetEt);
1627 fprintf(file,"==== Bg subtraction ==== \n");
1628 fprintf(file,"BG subtraction %6i ", fMode);
1629 fprintf(file,"Min cone move %6.2f\n", fMinMove);
1630 fprintf(file,"Max cone move %6.2f ", fMaxMove);
1631 fprintf(file,"%% change for BG %6.4f\n", fPrecBg);
1633 fprintf(file,"==== No Bg subtraction ==== \n");
1634 if(file != stdout) fclose(file);
1637 void AliEMCALJetFinder::DrawLegos()
1640 fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800);
1644 gStyle->SetOptStat(111111);
1646 Int_t nent1, nent2, nent3, nent4;
1647 Double_t int1, int2, int3, int4;
1648 nent1 = (Int_t)fLego->GetEntries();
1649 int1 = fLego->Integral();
1651 if(int1) fLego->Draw("lego");
1653 nent2 = (Int_t)fhLegoTracks->GetEntries();
1654 int2 = fhLegoTracks->Integral();
1656 if(int2) fhLegoTracks->Draw("lego");
1658 nent3 = (Int_t)fhLegoEMCAL->GetEntries();
1659 int3 = fhLegoEMCAL->Integral();
1661 if(int3) fhLegoEMCAL->Draw("lego");
1663 nent4 = (Int_t)fhLegoHadrCorr->GetEntries();
1664 int4 = fhLegoHadrCorr->Integral();
1666 if(int4) fhLegoHadrCorr->Draw("lego");
1668 // just for checking
1669 printf(" Integrals \n");
1670 printf("lego %10.3f \ntrack %10.3f \nhits %10.3f \nHCorr %10.3f\n-- %10.3f(must be 0)\n",
1671 int1, int2, int3, int4, int1 - (int2 + int3 - int4));
1674 const Char_t* AliEMCALJetFinder::GetFileNameForParameters(Char_t* dir)
1677 if(strlen(dir)) tmp = dir;
1683 void AliEMCALJetFinder::RearrangeParticlesMemory(Int_t npart)
1684 { // See FillFromTracks() - npart must be positive
1685 if (fTrackList) delete[] fTrackList;
1686 if (fPtT) delete[] fPtT;
1687 if (fEtaT) delete[] fEtaT;
1688 if (fPhiT) delete[] fPhiT;
1689 if (fPdgT) delete[] fPdgT;
1692 fTrackList = new Int_t [npart];
1693 fPtT = new Float_t[npart];
1694 fEtaT = new Float_t[npart];
1695 fPhiT = new Float_t[npart];
1696 fPdgT = new Int_t[npart];
1698 printf("AliEMCALJetFinder::RearrangeParticlesMemory : npart = %d\n", npart);
1702 Bool_t AliEMCALJetFinder::IsThisPartonsOrDiQuark(Int_t pdg)
1704 Int_t absPdg = TMath::Abs(pdg);
1705 if(absPdg<=6) return kTRUE; // quarks
1706 if(pdg == 21) return kTRUE; // gluon
1707 if(pdg == 92) return kTRUE; // string
1709 // see p.51 of Pythia Manual
1710 // Not include diquarks with c and b quark - 4-mar-2002
1711 // ud_0,sd_0,su_0; dd_1,ud_1,uu_1; sd_1,su_1,ss_1
1712 static Int_t diquark[9]={2101,3101,3201, 1103,2103,2203, 3103,3203,3303};
1713 for(Int_t i=0; i<9; i++) if(absPdg == diquark[i]) return kTRUE; // diquarks
1718 void AliEMCALJetFinder::FindChargedJet()
1721 // Find jet from charged particle information only
1736 for (part = 0; part < fNt; part++) {
1737 if (!fTrackList[part]) continue;
1738 if (fPtT[part] > fEtSeed) nseed++;
1740 printf("\nThere are %d seeds (%d)\n", nseed, fNtS);
1741 Int_t* iSeeds = new Int_t[nseed];
1744 for (part = 0; part < fNt; part++) {
1745 if (!fTrackList[part]) continue;
1746 if (fPtT[part] > fEtSeed) iSeeds[nseed++] = part;
1757 // Find seed with highest pt
1759 Float_t ptmax = -1.;
1762 for (seed = 0; seed < nseed; seed++) {
1763 if ((pt = fPtT[iSeeds[seed]]) > ptmax && iSeeds[seed] != -1) {
1768 if (ptmax < 0.) break;
1769 jndex = iSeeds[index];
1771 // Remove from the list
1773 printf("\n Next Seed %d %f", jndex, ptmax);
1775 // Find tracks in cone around seed
1777 Float_t phiSeed = fPhiT[jndex];
1778 Float_t etaSeed = fEtaT[jndex];
1784 for (part = 0; part < fNt; part++) {
1785 if (!fTrackList[part]) continue;
1786 Float_t deta = fEtaT[part] - etaSeed;
1787 Float_t dphi = fPhiT[part] - phiSeed;
1788 Float_t dR = TMath::Sqrt(deta * deta + dphi * dphi);
1789 if (dR < fConeRadius) {
1791 Float_t theta = 2. * TMath::ATan(TMath::Exp(-fEtaT[part]));
1792 Float_t px = fPtT[part] * TMath::Cos(fPhiT[part]);
1793 Float_t py = fPtT[part] * TMath::Sin(fPhiT[part]);
1794 Float_t pz = fPtT[part] / TMath::Tan(theta);
1799 // if seed, remove it
1801 for (seed = 0; seed < nseed; seed++) {
1802 if (part == iSeeds[seed]) iSeeds[seed] = -1;
1808 // Estimate of jet direction
1809 Float_t phiJ = TMath::ATan2(pyJ, pxJ);
1810 Float_t thetaJ = TMath::ATan2(TMath::Sqrt(pxJ * pxJ + pyJ * pyJ), pzJ);
1811 Float_t etaJ = TMath::Log(TMath::Tan(thetaJ / 2.));
1812 // Float_t ptJ = TMath::Sqrt(pxJ * pxJ + pyJ * pyJ);
1815 // Sum up all energy
1817 Int_t iPhi0 = Int_t((phiJ - fPhiMin) / fDphi);
1818 Int_t iEta0 = Int_t((etaJ - fEtaMin) / fDeta);
1819 Int_t dIphi = Int_t(fConeRadius / fDphi);
1820 Int_t dIeta = Int_t(fConeRadius / fDeta);
1823 for (iPhi = iPhi0 -dIphi; iPhi < iPhi0 + dIphi; iPhi++) {
1824 for (iEta = iEta0 - dIeta; iEta < iEta0 + dIeta; iEta++) {
1825 if (iPhi < 0 || iEta < 0) continue;
1826 Float_t dPhi = fPhiMin + iPhi * fDphi;
1827 Float_t dEta = fEtaMin + iEta * fDeta;
1828 if (TMath::Sqrt(dPhi * dPhi + dEta * dEta) < fConeRadius) continue;
1829 sumE += fLego->GetBinContent(iEta, iPhi);
1835 fJetT[njets++] = new AliEMCALJet(sumE, phiJ, etaJ);
1836 FindTracksInJetCone();
1837 printf("\n Jet Energy %f %f %f %f %d\n", eT, sumE, fPtT[6], fPtT[7], njets);
1838 printf("\n Jet Phi %f %f %f \n", phiJ, fPhiT[6], fPhiT[7]);
1839 printf("\n Jet Eta %f %f %f \n", etaJ, fEtaT[6], fEtaT[7]);
1841 EMCALJETS.njet = njets;
1842 if (fWrite) WriteJets();