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.14 2002/02/01 08:55:30 morsch
19 Fill map with Et and pT.
21 Revision 1.13 2002/01/31 09:37:36 morsch
22 Geometry parameters in constructor and call of SetCellSize()
24 Revision 1.12 2002/01/23 13:40:23 morsch
25 Fastidious debug print statement removed.
27 Revision 1.11 2002/01/22 17:25:47 morsch
28 Some corrections for event mixing and bg event handling.
30 Revision 1.10 2002/01/22 10:31:44 morsch
31 Some correction for bg mixing.
33 Revision 1.9 2002/01/21 16:28:42 morsch
36 Revision 1.8 2002/01/21 16:05:31 morsch
37 - different phi-bin for hadron correction
38 - provisions for background mixing.
40 Revision 1.7 2002/01/21 15:47:18 morsch
41 Bending radius correctly in cm.
43 Revision 1.6 2002/01/21 12:53:50 morsch
46 Revision 1.5 2002/01/21 12:47:47 morsch
47 Possibility to include K0long and neutrons.
49 Revision 1.4 2002/01/21 11:03:21 morsch
50 Phi propagation introduced in FillFromTracks.
52 Revision 1.3 2002/01/18 05:07:56 morsch
55 - track selection upon EMCAL information
59 //*-- Authors: Andreas Morsch (CERN)
61 //* Aleksei Pavlinov (WSU)
64 #include <TClonesArray.h>
66 #include <TBranchElement.h>
70 #include <TParticle.h>
71 #include <TParticlePDG.h>
74 #include "AliEMCALJetFinder.h"
75 #include "AliEMCALFast.h"
76 #include "AliEMCALGeometry.h"
77 #include "AliEMCALHit.h"
78 #include "AliEMCALDigit.h"
79 #include "AliEMCALDigitizer.h"
80 #include "AliEMCALHadronCorrection.h"
83 #include "AliMagFCM.h"
85 #include "AliHeader.h"
88 // Interface to FORTRAN
92 ClassImp(AliEMCALJetFinder)
94 //____________________________________________________________________________
95 AliEMCALJetFinder::AliEMCALJetFinder()
97 // Default constructor
109 fHadronCorrector = 0;
112 AliEMCALJetFinder::AliEMCALJetFinder(const char* name, const char *title)
116 fJets = new TClonesArray("AliEMCALJet",10000);
118 for (Int_t i = 0; i < 30000; i++)
132 fHadronCorrector = 0;
136 SetMomentumSmearing();
139 SetHadronCorrection();
140 SetSamplingFraction();
144 // Get geometry parameters from EMCAL
146 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
147 AliEMCALGeometry* geom =
148 AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
149 fNbinEta = geom->GetNZ();
150 fNbinPhi = geom->GetNPhi();
151 fPhiMin = geom->GetArm1PhiMin()*TMath::Pi()/180.;
152 fPhiMax = geom->GetArm1PhiMax()*TMath::Pi()/180.;
153 fEtaMin = geom->GetArm1EtaMin();
154 fEtaMax = geom->GetArm1EtaMax();
155 fDphi = (fPhiMax-fPhiMin)/fNbinEta;
156 fDeta = (fEtaMax-fEtaMin)/fNbinEta;
157 fNtot = fNbinPhi*fNbinEta;
159 SetCellSize(fDeta, fDphi);
166 //____________________________________________________________________________
167 AliEMCALJetFinder::~AliEMCALJetFinder()
181 # define jet_finder_ua1 jet_finder_ua1_
183 # define type_of_call
186 # define jet_finder_ua1 J
188 # define type_of_call _stdcall
191 extern "C" void type_of_call
192 jet_finder_ua1(Int_t& ncell, Int_t& ncell_tot,
193 Float_t etc[30000], Float_t etac[30000],
195 Float_t& min_move, Float_t& max_move, Int_t& mode,
196 Float_t& prec_bg, Int_t& ierror);
198 extern "C" void type_of_call hf1(Int_t& id, Float_t& x, Float_t& wgt);
204 void AliEMCALJetFinder::Find(Int_t ncell, Int_t ncell_tot, Float_t etc[30000],
205 Float_t etac[30000], Float_t phic[30000],
206 Float_t min_move, Float_t max_move, Int_t mode,
207 Float_t prec_bg, Int_t ierror)
209 // Wrapper for fortran coded jet finder
210 // Full argument list
211 jet_finder_ua1(ncell, ncell_tot, etc, etac, phic,
212 min_move, max_move, mode, prec_bg, ierror);
213 // Write result to output
217 void AliEMCALJetFinder::Find()
219 // Wrapper for fortran coded jet finder using member data for
222 Float_t min_move = 0;
223 Float_t max_move = 0;
225 Float_t prec_bg = 0.;
228 jet_finder_ua1(fNcell, fNtot, fEtCell, fEtaCell, fPhiCell,
229 min_move, max_move, mode, prec_bg, ierror);
230 // Write result to output
231 Int_t njet = Njets();
233 for (Int_t nj=0; nj<njet; nj++)
237 fJetT[nj] = new AliEMCALJet(JetEnergy(nj),
241 FindTracksInJetCone();
246 Int_t AliEMCALJetFinder::Njets()
248 // Get number of reconstructed jets
249 return EMCALJETS.njet;
252 Float_t AliEMCALJetFinder::JetEnergy(Int_t i)
254 // Get reconstructed jet energy
255 return EMCALJETS.etj[i];
258 Float_t AliEMCALJetFinder::JetPhiL(Int_t i)
260 // Get reconstructed jet phi from leading particle
261 return EMCALJETS.phij[0][i];
264 Float_t AliEMCALJetFinder::JetPhiW(Int_t i)
266 // Get reconstructed jet phi from weighting
267 return EMCALJETS.phij[1][i];
270 Float_t AliEMCALJetFinder::JetEtaL(Int_t i)
272 // Get reconstructed jet eta from leading particles
273 return EMCALJETS.etaj[0][i];
277 Float_t AliEMCALJetFinder::JetEtaW(Int_t i)
279 // Get reconstructed jet eta from weighting
280 return EMCALJETS.etaj[1][i];
283 void AliEMCALJetFinder::SetCellSize(Float_t eta, Float_t phi)
285 // Set grid cell size
286 EMCALCELLGEO.etaCellSize = eta;
287 EMCALCELLGEO.phiCellSize = phi;
290 void AliEMCALJetFinder::SetConeRadius(Float_t par)
292 // Set jet cone radius
293 EMCALJETPARAM.coneRad = par;
297 void AliEMCALJetFinder::SetEtSeed(Float_t par)
299 // Set et cut for seeds
300 EMCALJETPARAM.etSeed = par;
304 void AliEMCALJetFinder::SetMinJetEt(Float_t par)
306 // Set minimum jet et
307 EMCALJETPARAM.ejMin = par;
311 void AliEMCALJetFinder::SetMinCellEt(Float_t par)
313 // Set et cut per cell
314 EMCALJETPARAM.etMin = par;
318 void AliEMCALJetFinder::SetPtCut(Float_t par)
320 // Set pT cut on charged tracks
325 void AliEMCALJetFinder::Test()
328 // Test the finder call
330 const Int_t nmax = 30000;
332 Int_t ncell_tot = 100;
337 Float_t min_move = 0;
338 Float_t max_move = 0;
344 Find(ncell, ncell_tot, etc, etac, phic,
345 min_move, max_move, mode, prec_bg, ierror);
353 void AliEMCALJetFinder::AddJet(const AliEMCALJet& jet)
358 TClonesArray &lrawcl = *fJets;
359 new(lrawcl[fNjets++]) AliEMCALJet(jet);
362 void AliEMCALJetFinder::ResetJets()
371 void AliEMCALJetFinder::WriteJets()
374 // Add all jets to the list
376 const Int_t kBufferSize = 4000;
377 TTree *pK = gAlice->TreeK();
378 const char* file = (pK->GetCurrentFile())->GetName();
380 AliEMCAL* pEMCAL = (AliEMCAL* )gAlice->GetModule("EMCAL");
383 printf("Make Branch - TreeR address %p %p\n",gAlice->TreeR(), pEMCAL);
385 if (fJets && gAlice->TreeR()) {
386 pEMCAL->MakeBranchInTree(gAlice->TreeR(),
392 Int_t njet = Njets();
393 for (Int_t nj = 0; nj < njet; nj++)
399 Int_t nev = gAlice->GetHeader()->GetEvent();
400 gAlice->TreeR()->Fill();
402 sprintf(hname,"TreeR%d", nev);
403 gAlice->TreeR()->Write(hname);
404 gAlice->TreeR()->Reset();
408 void AliEMCALJetFinder::BookLego()
411 // Book histo for discretisation
415 // Don't add histos to the current directory
416 TH2::AddDirectory(0);
419 fLego = new TH2F("legoH","eta-phi",
420 fNbinEta, fEtaMin, fEtaMax,
421 fNbinPhi, fPhiMin, fPhiMax);
424 fLegoB = new TH2F("legoB","eta-phi",
425 fNbinEta, fEtaMin, fEtaMax,
426 fNbinPhi, fPhiMin, fPhiMax);
430 void AliEMCALJetFinder::DumpLego()
433 // Dump lego histo into array
436 for (Int_t i = 1; i < fNbinEta; i++) {
437 for (Int_t j = 1; j < fNbinPhi; j++) {
438 Float_t e = fLego->GetBinContent(i,j);
439 if (e <=0.) continue;
441 TAxis* Xaxis = fLego->GetXaxis();
442 TAxis* Yaxis = fLego->GetYaxis();
443 Float_t eta = Xaxis->GetBinCenter(i);
444 Float_t phi = Yaxis->GetBinCenter(j);
446 fEtaCell[fNcell] = eta;
447 fPhiCell[fNcell] = phi;
454 void AliEMCALJetFinder::ResetMap()
457 // Reset eta-phi array
459 for (Int_t i=0; i<30000; i++)
468 void AliEMCALJetFinder::FillFromTracks(Int_t flag, Int_t ich)
471 // Fill Cells with track information
476 if (!fLego) BookLego();
478 if (flag == 0) fLego->Reset();
480 // Access particle information
481 Int_t npart = (gAlice->GetHeader())->GetNprimary();
485 // 1: selected for jet finding
488 if (fTrackList) delete[] fTrackList;
489 if (fPtT) delete[] fPtT;
490 if (fEtaT) delete[] fEtaT;
491 if (fPhiT) delete[] fPhiT;
493 fTrackList = new Int_t [npart];
494 fPtT = new Float_t[npart];
495 fEtaT = new Float_t[npart];
496 fPhiT = new Float_t[npart];
501 for (Int_t part = 2; part < npart; part++) {
502 TParticle *MPart = gAlice->Particle(part);
503 Int_t mpart = MPart->GetPdgCode();
504 Int_t child1 = MPart->GetFirstDaughter();
505 Float_t pT = MPart->Pt();
506 Float_t p = MPart->P();
507 Float_t phi = MPart->Phi();
508 Float_t eta = MPart->Eta();
509 Float_t theta = MPart->Theta();
513 if (part == 6 || part == 7)
515 printf("\n Simulated Jet (pt, eta, phi): %d %f %f %f\n",
516 part-5, pT, eta, phi);
521 // printf("\n Simulated Jet (pt, eta, phi): %d %d %f %f %f",
522 // part, mpart, pT, eta, phi);
526 fTrackList[part] = 0;
531 if (part < 2) continue;
532 if (pT == 0 || pT < fPtCut) continue;
533 TParticlePDG* pdgP = 0;
534 // charged or neutral
536 pdgP = MPart->GetPDG();
537 if (pdgP->Charge() == 0) {
541 if (mpart != kNeutron &&
542 mpart != kNeutronBar &&
543 mpart != kK0Long) continue;
548 if (TMath::Abs(mpart) <= 6 ||
550 mpart == 92) continue;
552 if (TMath::Abs(eta) > 0.7) continue;
553 if (phi*180./TMath::Pi() > 120.) continue;
555 if (child1 >= 0 && child1 < npart) continue;
558 printf("\n sel:%5d %5d %5d %8.2f %8.2f %8.2f",
559 part, mpart, child1, eta, phi, pT);
562 // phi propagation for hadronic correction
564 Bool_t curls = kFALSE;
565 Float_t dphi = PropagatePhi(pT, pdgP->Charge(), curls);
566 if (fDebug > 1) printf("\n Delta phi %f pT%f", dphi, pT);
567 if (curls && fDebug > 1) printf("\n Track is curling %f", pT);
568 Float_t phiHC = phi + dphi;
570 // Momentum smearing goes here ...
573 p = AliEMCALFast::SmearMomentum(1,p);
576 // Tracking Efficiency and TPC acceptance goes here ...
578 Float_t eff = AliEMCALFast::Efficiency(1,p);
579 if (AliEMCALFast::RandomReject(eff)) continue;
582 // Correction of Hadronic Energy goes here ...
587 if (!fHadronCorrector)
588 Fatal("AliEMCALJetFinder",
589 "Hadronic energy correction required but not defined !");
590 dpH = fHadronCorrector->GetEnergy(p, eta, 7);
593 // More to do ? Just think about it !
595 fTrackList[part] = 1;
599 fLego->Fill(eta, phi, pT);
600 if (fHCorrection && !curls)
601 fLego->Fill(eta, phiHC, -dpH*TMath::Sin(theta));
606 void AliEMCALJetFinder::FillFromHits(Int_t flag)
609 // Fill Cells with hit information
614 if (!fLego) BookLego();
615 // Reset eta-phi map if needed
616 if (flag == 0) fLego->Reset();
617 // Initialize from background event if available
619 // Access hit information
620 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
622 TTree *treeH = gAlice->TreeH();
623 Int_t ntracks = (Int_t) treeH->GetEntries();
630 for (Int_t track=0; track<ntracks;track++) {
632 nbytes += treeH->GetEvent(track);
636 for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
638 mHit=(AliEMCALHit*) pEMCAL->NextHit())
640 Float_t x = mHit->X(); // x-pos of hit
641 Float_t y = mHit->Y(); // y-pos
642 Float_t z = mHit->Z(); // z-pos
643 Float_t eloss = mHit->GetEnergy(); // deposited energy
645 Float_t r = TMath::Sqrt(x*x+y*y);
646 Float_t theta = TMath::ATan2(r,z);
647 Float_t eta = -TMath::Log(TMath::Tan(theta/2.));
648 Float_t phi = TMath::ATan2(y,x);
650 if (fDebug > 1) printf("\n Hit %f %f %f %f", x, y, z, eloss);
652 fLego->Fill(eta, phi, fSamplingF*eloss*TMath::Sin(theta));
658 void AliEMCALJetFinder::FillFromDigits(Int_t flag)
661 // Fill Cells with digit information
666 if (!fLego) BookLego();
667 if (flag == 0) fLego->Reset();
674 TClonesArray* digs = new TClonesArray("AliEMCALDigit", 10000);
675 TTree *treeD = gAlice->TreeD();
676 TBranchElement* branchDg = (TBranchElement*)
677 treeD->GetBranch("EMCAL");
679 if (!branchDg) Fatal("AliEMCALJetFinder",
680 "Reading digits requested but no digits in file !");
682 branchDg->SetAddress(&digs);
683 Int_t nent = (Int_t) branchDg->GetEntries();
687 AliEMCALDigitizer* digr = new AliEMCALDigitizer();
688 TBranchElement* branchDr = (TBranchElement*)
689 treeD->GetBranch("AliEMCALDigitizer");
690 branchDr->SetAddress(&digr);
693 nbytes += branchDg->GetEntry(0);
694 nbytes += branchDr->GetEntry(0);
696 // Get digitizer parameters
697 Float_t towerADCped = digr->GetTowerpedestal();
698 Float_t towerADCcha = digr->GetTowerchannel();
699 Float_t preshoADCped = digr->GetPreShopedestal();
700 Float_t preshoADCcha = digr->GetPreShochannel();
702 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
703 AliEMCALGeometry* geom =
704 AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
707 Int_t ndig = digs->GetEntries();
708 printf("\n Number of Digits: %d %d\n", ndig, nent);
709 printf("\n Parameters: %f %f %f %f\n",
710 towerADCped, towerADCcha, preshoADCped, preshoADCcha );
711 printf("\n Geometry: %d %d\n", geom->GetNEta(), geom->GetNPhi());
718 while ((sdg = (AliEMCALDigit*)(next())))
722 if (sdg->GetId() > (geom->GetNZ() * geom->GetNPhi()))
724 pedestal = preshoADCped;
725 channel = preshoADCcha;
727 pedestal = towerADCped;
728 channel = towerADCcha;
731 Float_t eta = sdg->GetEta();
732 Float_t phi = sdg->GetPhi() * TMath::Pi()/180.;
733 Float_t amp = (Float_t) (channel*(sdg->GetAmp())-pedestal);
735 if (fDebug > 1) printf("\n Digit: eta %8.3f phi %8.3f amp %8.3f %8d",
736 eta, phi, amp, sdg->GetAmp());
738 fLego->Fill(eta, phi, fSamplingF*amp);
746 void AliEMCALJetFinder::FillFromHitFlaggedTracks(Int_t flag)
749 // Fill Cells with hit information
754 if (!fLego) BookLego();
756 if (flag == 0) fLego->Reset();
758 // Flag charged tracks passing through TPC which
759 // are associated to EMCAL Hits
760 BuildTrackFlagTable();
763 // Access particle information
764 TTree *treeH = gAlice->TreeH();
765 Int_t ntracks = (Int_t) treeH->GetEntries();
767 if (fPtT) delete[] fPtT;
768 if (fEtaT) delete[] fEtaT;
769 if (fPhiT) delete[] fPhiT;
771 fPtT = new Float_t[ntracks];
772 fEtaT = new Float_t[ntracks];
773 fPhiT = new Float_t[ntracks];
778 for (Int_t track = 0; track < ntracks; track++) {
779 TParticle *MPart = gAlice->Particle(track);
780 Float_t pT = MPart->Pt();
781 Float_t phi = MPart->Phi();
782 Float_t eta = MPart->Eta();
784 if(fTrackList[track]) {
789 if (track < 2) continue; //Colliding particles?
790 if (pT == 0 || pT < fPtCut) continue;
792 fLego->Fill(eta, phi, pT);
798 void AliEMCALJetFinder::BuildTrackFlagTable() {
800 // Method to generate a lookup table for TreeK particles
801 // which are linked to hits in the EMCAL
803 // --Author: J.L. Klay
805 // Access hit information
806 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
808 TTree *TK = gAlice->TreeK(); // Get the number of entries in the kine tree
809 Int_t nKTrks = (Int_t) TK->GetEntries(); // (Number of particles created somewhere)
811 if(fTrackList) delete[] fTrackList; //Make sure we get rid of the old one
812 fTrackList = new Int_t[nKTrks]; //before generating a new one
814 for (Int_t i = 0; i < nKTrks; i++) { //Initialize members to 0
818 TTree *treeH = gAlice->TreeH();
819 Int_t ntracks = (Int_t) treeH->GetEntries();
825 for (Int_t track=0; track<ntracks;track++) {
827 nbytes += treeH->GetEvent(track);
833 for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
835 mHit=(AliEMCALHit*) pEMCAL->NextHit())
837 Int_t iTrk = mHit->Track(); // track number
838 Int_t idprim = mHit->GetPrimary(); // primary particle
840 //Determine the origin point of this particle - it made a hit in the EMCAL
841 TParticle *trkPart = gAlice->Particle(iTrk);
842 TParticlePDG *trkPdg = trkPart->GetPDG();
843 Int_t trkCode = trkPart->GetPdgCode();
845 if (trkCode < 10000) { //Big Ions cause problems for
846 trkChg = trkPdg->Charge(); //this function. Since they aren't
847 } else { //likely to make it very far, set
848 trkChg = 0.0; //their charge to 0 for the Flag test
850 Float_t vxTrk = trkPart->Vx();
851 Float_t vyTrk = trkPart->Vy();
852 Float_t vrTrk = TMath::Sqrt(vxTrk*vxTrk+vyTrk*vyTrk);
853 fTrackList[iTrk] = SetTrackFlag(vrTrk,trkCode,trkChg);
855 //Loop through the ancestry of the EMCAL entrance particles
856 Int_t ancestor = trkPart->GetFirstMother(); //Get track's Mother
857 while (ancestor != -1) {
858 TParticle *ancPart = gAlice->Particle(ancestor); //get particle info on ancestor
859 TParticlePDG *ancPdg = ancPart->GetPDG();
860 Int_t ancCode = ancPart->GetPdgCode();
862 if (ancCode < 10000) {
863 ancChg = ancPdg->Charge();
867 Float_t vxAnc = ancPart->Vx();
868 Float_t vyAnc = ancPart->Vy();
869 Float_t vrAnc = TMath::Sqrt(vxAnc*vxAnc+vyAnc*vyAnc);
870 fTrackList[ancestor] = SetTrackFlag(vrAnc,ancCode,ancChg);
871 ancestor = ancPart->GetFirstMother(); //Get the next ancestor
874 //Determine the origin point of the primary particle associated with the hit
875 TParticle *primPart = gAlice->Particle(idprim);
876 TParticlePDG *primPdg = primPart->GetPDG();
877 Int_t primCode = primPart->GetPdgCode();
879 if (primCode < 10000) {
880 primChg = primPdg->Charge();
884 Float_t vxPrim = primPart->Vx();
885 Float_t vyPrim = primPart->Vy();
886 Float_t vrPrim = TMath::Sqrt(vxPrim*vxPrim+vyPrim*vyPrim);
887 fTrackList[idprim] = SetTrackFlag(vrPrim,primCode,primChg);
893 Int_t AliEMCALJetFinder
894 ::SetTrackFlag(Float_t radius, Int_t code, Double_t charge) {
900 if (charge == 0) neutral = 1;
902 if (TMath::Abs(code) <= 6 ||
904 code == 92) parton = 1;
906 //It's not a parton, it's charged and it went through the TPC
907 if (!parton && !neutral && radius <= 84.0) flag = 1;
914 void AliEMCALJetFinder::SaveBackgroundEvent()
916 // Saves the eta-phi lego and the tracklist
918 if (fLegoB) fLegoB->Reset();
920 fLego->Copy(*fLegoB);
922 if (fPtB) delete[] fPtB;
923 if (fEtaB) delete[] fEtaB;
924 if (fPhiB) delete[] fPhiB;
925 if (fTrackListB) delete[] fTrackListB;
927 fPtB = new Float_t[fNtS];
928 fEtaB = new Float_t[fNtS];
929 fPhiB = new Float_t[fNtS];
930 fTrackListB = new Int_t [fNtS];
934 for (Int_t i = 0; i < fNt; i++) {
935 if (!fTrackList[i]) continue;
936 fPtB [fNtB] = fPtT [i];
937 fEtaB[fNtB] = fEtaT[i];
938 fPhiB[fNtB] = fPhiT[i];
939 fTrackListB[fNtB] = 1;
945 void AliEMCALJetFinder::InitFromBackground()
949 if (fDebug) printf("\n Initializing from Background");
951 if (fLego) fLego->Reset();
952 fLegoB->Copy(*fLego);
957 void AliEMCALJetFinder::FindTracksInJetCone()
960 // Build list of tracks inside jet cone
963 Int_t njet = Njets();
964 for (Int_t nj = 0; nj < njet; nj++)
966 Float_t etaj = JetEtaW(nj);
967 Float_t phij = JetPhiW(nj);
968 Int_t nT = 0; // number of associated tracks
970 // Loop over particles in current event
971 for (Int_t part = 0; part < fNt; part++) {
972 if (!fTrackList[part]) continue;
973 Float_t phi = fPhiT[part];
974 Float_t eta = fEtaT[part];
975 Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) +
976 (phij-phi)*(phij-phi));
977 if (dr < fConeRadius) {
978 fTrackList[part] = nj+2;
983 // Same for background event if available
986 for (Int_t part = 0; part < fNtB; part++) {
987 Float_t phi = fPhiB[part];
988 Float_t eta = fEtaB[part];
989 Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) +
990 (phij-phi)*(phij-phi));
991 fTrackListB[part] = 1;
993 if (dr < fConeRadius) {
994 fTrackListB[part] = nj+2;
998 } // Background available ?
1000 Int_t nT0 = nT + nTB;
1002 if (nT0 > 50) nT0 = 50;
1004 Float_t* ptT = new Float_t[nT0];
1005 Float_t* etaT = new Float_t[nT0];
1006 Float_t* phiT = new Float_t[nT0];
1010 for (Int_t part = 0; part < fNt; part++) {
1011 if (fTrackList[part] == nj+2) {
1013 for (j=iT-1; j>=0; j--) {
1014 if (fPtT[part] > ptT[j]) {
1019 for (j=iT-1; j>=index; j--) {
1020 ptT [j+1] = ptT [j];
1021 etaT[j+1] = etaT[j];
1022 phiT[j+1] = phiT[j];
1024 ptT [index] = fPtT [part];
1025 etaT[index] = fEtaT[part];
1026 phiT[index] = fPhiT[part];
1028 } // particle associated
1029 if (iT > nT0) break;
1033 for (Int_t part = 0; part < fNtB; part++) {
1034 if (fTrackListB[part] == nj+2) {
1036 for (j=iT-1; j>=0; j--) {
1037 if (fPtB[part] > ptT[j]) {
1043 for (j=iT-1; j>=index; j--) {
1044 ptT [j+1] = ptT [j];
1045 etaT[j+1] = etaT[j];
1046 phiT[j+1] = phiT[j];
1048 ptT [index] = fPtB [part];
1049 etaT[index] = fEtaB[part];
1050 phiT[index] = fPhiB[part];
1052 } // particle associated
1053 if (iT > nT0) break;
1055 } // Background available ?
1057 fJetT[nj]->SetTrackList(nT0, ptT, etaT, phiT);
1064 Float_t AliEMCALJetFinder::PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls)
1066 // Propagates phi angle to EMCAL radius
1070 Float_t b = ((AliMagFCM*) gAlice->Field())->SolenoidField();
1072 Float_t rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance();
1079 Float_t rB = 3335.6 * pt / b; // [cm]
1081 // check if particle is curling below EMCAL
1082 if (2.*rB < rEMCAL) {
1087 // if not calculate delta phi
1088 Float_t phi = TMath::ACos(1.-rEMCAL*rEMCAL/(2.*rB*rB));
1089 dPhi = TMath::ATan2(1.-TMath::Cos(phi), TMath::Sin(phi));
1090 dPhi = -TMath::Sign(dPhi, charge);
1097 void hf1(Int_t& id, Float_t& x, Float_t& wgt)
1099 // dummy for hbook calls