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.35 2003/01/15 04:59:38 morsch
19 - TPC eff. from AliEMCALFast
20 - Correction in PropagatePhi()
22 Revision 1.34 2003/01/14 10:50:18 alibrary
23 Cleanup of STEER coding conventions
25 Revision 1.33 2003/01/10 10:48:19 morsch
26 SetSamplingFraction() removed from constructor.
28 Revision 1.32 2003/01/10 10:26:40 morsch
29 Sampling fraction initialized from geometry class.
31 Revision 1.31 2003/01/08 17:13:41 schutz
32 added the HCAL section
34 Revision 1.30 2002/12/09 16:26:28 morsch
35 - Nummber of particles per jet increased to 1000
38 Revision 1.29 2002/11/21 17:01:40 alibrary
39 Removing AliMCProcess and AliMC
41 Revision 1.28 2002/11/20 14:13:16 morsch
42 - FindChargedJets() added.
43 - Destructor corrected.
44 - Geometry cuts taken from AliEMCALGeometry.
46 Revision 1.27 2002/11/15 17:39:10 morsch
47 GetPythiaParticleName removed.
49 Revision 1.26 2002/10/14 14:55:35 hristov
50 Merging the VirtualMC branch to the main development branch (HEAD)
52 Revision 1.20.4.3 2002/10/10 15:07:49 hristov
53 Updating VirtualMC to v3-09-02
55 Revision 1.25 2002/09/13 10:24:57 morsch
58 Revision 1.24 2002/09/13 10:21:13 morsch
61 Revision 1.23 2002/06/27 09:24:26 morsch
62 Uncomment the TH1::AddDirectory statement.
64 Revision 1.22 2002/05/22 13:48:43 morsch
65 Pdg code added to track list.
67 Revision 1.21 2002/04/27 07:43:08 morsch
68 Calculation of fDphi corrected (Renan Cabrera)
70 Revision 1.20 2002/03/12 01:06:23 pavlinov
71 Testin output from generator
73 Revision 1.19 2002/02/27 00:46:33 pavlinov
74 Added method FillFromParticles()
76 Revision 1.18 2002/02/21 08:48:59 morsch
77 Correction in FillFromHitFlaggedTrack. (Jennifer Klay)
79 Revision 1.17 2002/02/14 08:52:53 morsch
80 Major updates by Aleksei Pavlinov:
81 FillFromPartons, FillFromTracks, jetfinder configuration.
83 Revision 1.16 2002/02/08 11:43:05 morsch
84 SetOutputFileName(..) allows to specify an output file to which the
85 reconstructed jets are written. If not set output goes to input file.
86 Attention call Init() before processing.
88 Revision 1.15 2002/02/02 08:37:18 morsch
89 Formula for rB corrected.
91 Revision 1.14 2002/02/01 08:55:30 morsch
92 Fill map with Et and pT.
94 Revision 1.13 2002/01/31 09:37:36 morsch
95 Geometry parameters in constructor and call of SetCellSize()
97 Revision 1.12 2002/01/23 13:40:23 morsch
98 Fastidious debug print statement removed.
100 Revision 1.11 2002/01/22 17:25:47 morsch
101 Some corrections for event mixing and bg event handling.
103 Revision 1.10 2002/01/22 10:31:44 morsch
104 Some correction for bg mixing.
106 Revision 1.9 2002/01/21 16:28:42 morsch
107 Correct sign of dphi.
109 Revision 1.8 2002/01/21 16:05:31 morsch
110 - different phi-bin for hadron correction
111 - provisions for background mixing.
113 Revision 1.7 2002/01/21 15:47:18 morsch
114 Bending radius correctly in cm.
116 Revision 1.6 2002/01/21 12:53:50 morsch
119 Revision 1.5 2002/01/21 12:47:47 morsch
120 Possibility to include K0long and neutrons.
122 Revision 1.4 2002/01/21 11:03:21 morsch
123 Phi propagation introduced in FillFromTracks.
125 Revision 1.3 2002/01/18 05:07:56 morsch
126 - hadronic correction
128 - track selection upon EMCAL information
132 //*-- Authors: Andreas Morsch (CERN)
134 //* Aleksei Pavlinov (WSU)
140 #include <TBranchElement.h>
142 #include <TClonesArray.h>
147 #include <TPDGCode.h>
149 #include <TParticle.h>
150 #include <TParticlePDG.h>
151 #include <TPaveText.h>
152 #include <TPythia6Calls.h>
158 #include "AliEMCAL.h"
159 #include "AliEMCALDigit.h"
160 #include "AliEMCALDigitizer.h"
161 #include "AliEMCALFast.h"
162 #include "AliEMCALGeometry.h"
163 #include "AliEMCALHadronCorrection.h"
164 #include "AliEMCALHit.h"
165 #include "AliEMCALJetFinder.h"
166 #include "AliEMCALJetMicroDst.h"
167 #include "AliHeader.h"
169 #include "AliMagFCM.h"
172 // Interface to FORTRAN
176 ClassImp(AliEMCALJetFinder)
178 //____________________________________________________________________________
179 AliEMCALJetFinder::AliEMCALJetFinder()
181 // Default constructor
200 fHadronCorrector = 0;
208 SetParametersForBgSubtraction();
211 AliEMCALJetFinder::AliEMCALJetFinder(const char* name, const char *title)
215 // Title is used in method GetFileNameForParameters();
217 fJets = new TClonesArray("AliEMCALJet",10000);
219 for (Int_t i = 0; i < 30000; i++)
241 fHadronCorrector = 0;
250 SetMomentumSmearing();
253 SetHadronCorrection();
256 SetParametersForBgSubtraction();
259 void AliEMCALJetFinder::SetParametersForBgSubtraction
260 (Int_t mode, Float_t minMove, Float_t maxMove, Float_t precBg)
262 // see file /home/pavlinov/cosmic/pythia/jetFinderParamData.inc
263 // at WSU Linux cluster - 11-feb-2002
264 // These parameters must be tuned more carefull !!!
271 //____________________________________________________________________________
272 AliEMCALJetFinder::~AliEMCALJetFinder()
284 delete fhLegoHadrCorr;
287 delete fhCellEMCALEt;
289 delete fhTrackPtBcut;
290 delete fhChPartMultInTpc;
298 delete[] fTrackListB;
306 # define jet_finder_ua1 jet_finder_ua1_
308 # define type_of_call
311 # define jet_finder_ua1 JET_FINDER_UA1
313 # define type_of_call _stdcall
316 extern "C" void type_of_call
317 jet_finder_ua1(Int_t& ncell, Int_t& ncell_tot,
318 Float_t etc[30000], Float_t etac[30000],
320 Float_t& min_move, Float_t& max_move, Int_t& mode,
321 Float_t& prec_bg, Int_t& ierror);
323 extern "C" void type_of_call hf1(Int_t& id, Float_t& x, Float_t& wgt);
326 void AliEMCALJetFinder::Init()
329 // Geometry and I/O initialization
333 // Get geometry parameters from EMCAL
337 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
338 AliEMCALGeometry* geom =
339 AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
341 // SetSamplingFraction(geom->GetSampling());
343 fNbinEta = geom->GetNZ();
344 fNbinPhi = geom->GetNPhi();
345 fPhiMin = geom->GetArm1PhiMin()*TMath::Pi()/180.;
346 fPhiMax = geom->GetArm1PhiMax()*TMath::Pi()/180.;
347 fEtaMin = geom->GetArm1EtaMin();
348 fEtaMax = geom->GetArm1EtaMax();
349 fDphi = (fPhiMax-fPhiMin)/fNbinPhi;
350 fDeta = (fEtaMax-fEtaMin)/fNbinEta;
351 fNtot = fNbinPhi*fNbinEta;
353 SetCellSize(fDeta, fDphi);
356 if (fOutFileName) fOutFile = new TFile(fOutFileName, "recreate");
359 void AliEMCALJetFinder::Find(Int_t ncell, Int_t ncell_tot, Float_t etc[30000],
360 Float_t etac[30000], Float_t phic[30000],
361 Float_t min_move, Float_t max_move, Int_t mode,
362 Float_t prec_bg, Int_t ierror)
364 // Wrapper for fortran coded jet finder
365 // Full argument list
366 jet_finder_ua1(ncell, ncell_tot, etc, etac, phic,
367 min_move, max_move, mode, prec_bg, ierror);
368 // Write result to output
369 if(fWrite) WriteJets();
373 void AliEMCALJetFinder::Find()
375 // Wrapper for fortran coded jet finder using member data for
378 Float_t min_move = fMinMove;
379 Float_t max_move = fMaxMove;
381 Float_t prec_bg = fPrecBg;
384 ResetJets(); // 4-feb-2002 by PAI
386 jet_finder_ua1(fNcell, fNtot, fEtCell, fEtaCell, fPhiCell,
387 min_move, max_move, mode, prec_bg, ierror);
389 // Write result to output
390 Int_t njet = Njets();
392 for (Int_t nj=0; nj<njet; nj++)
395 fJetT[nj] = new AliEMCALJet(JetEnergy(nj),
400 FindTracksInJetCone();
401 if(fWrite) WriteJets();
405 Int_t AliEMCALJetFinder::Njets()
407 // Get number of reconstructed jets
408 return EMCALJETS.njet;
411 Float_t AliEMCALJetFinder::JetEnergy(Int_t i)
413 // Get reconstructed jet energy
414 return EMCALJETS.etj[i];
417 Float_t AliEMCALJetFinder::JetPhiL(Int_t i)
419 // Get reconstructed jet phi from leading particle
420 return EMCALJETS.phij[0][i];
423 Float_t AliEMCALJetFinder::JetPhiW(Int_t i)
425 // Get reconstructed jet phi from weighting
426 return EMCALJETS.phij[1][i];
429 Float_t AliEMCALJetFinder::JetEtaL(Int_t i)
431 // Get reconstructed jet eta from leading particles
432 return EMCALJETS.etaj[0][i];
436 Float_t AliEMCALJetFinder::JetEtaW(Int_t i)
438 // Get reconstructed jet eta from weighting
439 return EMCALJETS.etaj[1][i];
442 void AliEMCALJetFinder::SetCellSize(Float_t eta, Float_t phi)
444 // Set grid cell size
445 EMCALCELLGEO.etaCellSize = eta;
446 EMCALCELLGEO.phiCellSize = phi;
449 void AliEMCALJetFinder::SetConeRadius(Float_t par)
451 // Set jet cone radius
452 EMCALJETPARAM.coneRad = par;
456 void AliEMCALJetFinder::SetEtSeed(Float_t par)
458 // Set et cut for seeds
459 EMCALJETPARAM.etSeed = par;
463 void AliEMCALJetFinder::SetMinJetEt(Float_t par)
465 // Set minimum jet et
466 EMCALJETPARAM.ejMin = par;
470 void AliEMCALJetFinder::SetMinCellEt(Float_t par)
472 // Set et cut per cell
473 EMCALJETPARAM.etMin = par;
477 void AliEMCALJetFinder::SetPtCut(Float_t par)
479 // Set pT cut on charged tracks
484 void AliEMCALJetFinder::Test()
487 // Test the finder call
489 const Int_t nmax = 30000;
491 Int_t ncell_tot = 100;
496 Float_t min_move = 0;
497 Float_t max_move = 0;
503 Find(ncell, ncell_tot, etc, etac, phic,
504 min_move, max_move, mode, prec_bg, ierror);
512 void AliEMCALJetFinder::AddJet(const AliEMCALJet& jet)
517 TClonesArray &lrawcl = *fJets;
518 new(lrawcl[fNjets++]) AliEMCALJet(jet);
521 void AliEMCALJetFinder::ResetJets()
530 void AliEMCALJetFinder::WriteJets()
533 // Add all jets to the list
535 const Int_t kBufferSize = 4000;
536 const char* file = 0;
538 Int_t njet = Njets();
540 for (Int_t nj = 0; nj < njet; nj++)
549 // output written to input file
551 AliEMCAL* pEMCAL = (AliEMCAL* )gAlice->GetModule("EMCAL");
552 TTree* pK = gAlice->TreeK();
553 file = (pK->GetCurrentFile())->GetName();
555 printf("Make Branch - TreeR address %p %p\n",gAlice->TreeR(), pEMCAL);
556 if (fJets && gAlice->TreeR()) {
557 pEMCAL->MakeBranchInTree(gAlice->TreeR(),
563 Int_t nev = gAlice->GetHeader()->GetEvent();
564 gAlice->TreeR()->Fill();
566 sprintf(hname,"TreeR%d", nev);
567 gAlice->TreeR()->Write(hname);
568 gAlice->TreeR()->Reset();
571 // Output written to user specified output file
573 TTree* pK = gAlice->TreeK();
574 fInFile = pK->GetCurrentFile();
578 sprintf(hname,"TreeR%d", fEvent);
579 TTree* treeJ = new TTree(hname, "EMCALJets");
580 treeJ->Branch("EMCALJets", &fJets, kBufferSize);
588 void AliEMCALJetFinder::BookLego()
591 // Book histo for discretisation
595 // Don't add histos to the current directory
596 if(fDebug) printf("\n AliEMCALJetFinder::BookLego() \n");
598 TH2::AddDirectory(0);
599 TH1::AddDirectory(0);
603 fLego = new TH2F("legoH","eta-phi",
604 fNbinEta, fEtaMin, fEtaMax,
605 fNbinPhi, fPhiMin, fPhiMax);
608 fLegoB = new TH2F("legoB","eta-phi for BG event",
609 fNbinEta, fEtaMin, fEtaMax,
610 fNbinPhi, fPhiMin, fPhiMax);
613 fhLegoTracks = new TH2F("hLegoTracks","eta-phi for Tracks",
614 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
616 fhLegoEMCAL = new TH2F("hLegoEMCAL","eta-phi for EMCAL",
617 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
618 // Hadron correction map
619 fhLegoHadrCorr = new TH2F("hLegoHadrCorr","eta-phi for Hadron. Correction",
620 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
621 // Hists. for tuning jet finder
622 fhEff = new TH2F("hEff","#epsilon vs momentum ", 100,0.,20., 50,0.5,1.);
626 for(Int_t i=1; i<=1000; i++) eTmp[i] = 0.1*i; // step 100 mev
627 for(Int_t i=1001; i<=1100; i++) eTmp[i] = eTmp[1000] + 1.0*(i-1000); // step 1GeV
629 fhCellEt = new TH1F("hCellEt","Cell E_{T} from fLego",
630 eTmp.GetSize()-1, eTmp.GetArray());
631 fhCellEMCALEt = new TH1F("hCellEMCALEt","Cell E_{T} for EMCAL itself",
632 eTmp.GetSize()-1, eTmp.GetArray());
633 fhTrackPt = new TH1F("hTrackPt","Ch.particles P_{T} ",
634 eTmp.GetSize()-1, eTmp.GetArray());
635 fhTrackPtBcut = new TH1F("hTrackPtBcut","Ch.particles P_{T} + magnetic field cut",
636 eTmp.GetSize()-1, eTmp.GetArray());
638 fhChPartMultInTpc = new TH1F("hChPartMultInTpc",
639 "Charge partilcle multiplicity in |%eta|<0.9", 2000, 0, 20000);
641 //! first canvas for drawing
642 fHistsList=AliEMCALJetMicroDst::MoveHistsToList("Hists from AliEMCALJetFinder", kTRUE);
645 void AliEMCALJetFinder::DumpLego()
648 // Dump lego histo into array
651 TAxis* Xaxis = fLego->GetXaxis();
652 TAxis* Yaxis = fLego->GetYaxis();
653 // fhCellEt->Clear();
655 for (Int_t i = 1; i <= fNbinEta; i++) {
656 for (Int_t j = 1; j <= fNbinPhi; j++) {
657 e = fLego->GetBinContent(i,j);
659 Float_t eta = Xaxis->GetBinCenter(i);
660 Float_t phi = Yaxis->GetBinCenter(j);
662 fEtaCell[fNcell] = eta;
663 fPhiCell[fNcell] = phi;
668 eH = fhLegoEMCAL->GetBinContent(i,j);
669 if(eH > 0.0) fhCellEMCALEt->Fill(eH);
677 void AliEMCALJetFinder::ResetMap()
680 // Reset eta-phi array
682 for (Int_t i=0; i<30000; i++)
691 void AliEMCALJetFinder::FillFromTracks(Int_t flag, Int_t ich)
694 // Fill Cells with track information
697 printf("\n AliEMCALJetFinder::FillFromTracks(%i,%i) ",flag,ich);
702 if (!fLego) BookLego();
704 if (flag == 0) fLego->Reset();
706 // Access particle information
707 Int_t npart = (gAlice->GetHeader())->GetNprimary();
708 Int_t ntr = (gAlice->GetHeader())->GetNtrack();
709 printf(" : #primary particles %i # tracks %i \n", npart, ntr);
714 // 1: selected for jet finding
717 if (fTrackList) delete[] fTrackList;
718 if (fPtT) delete[] fPtT;
719 if (fEtaT) delete[] fEtaT;
720 if (fPhiT) delete[] fPhiT;
721 if (fPdgT) delete[] fPdgT;
723 fTrackList = new Int_t [npart];
724 fPtT = new Float_t[npart];
725 fEtaT = new Float_t[npart];
726 fPhiT = new Float_t[npart];
727 fPdgT = new Int_t[npart];
731 Float_t chTmp=0.0; // charge of current particle
734 // this is for Pythia ??
735 for (Int_t part = 0; part < npart; part++) {
736 TParticle *MPart = gAlice->Particle(part);
737 Int_t mpart = MPart->GetPdgCode();
738 Int_t child1 = MPart->GetFirstDaughter();
739 Float_t pT = MPart->Pt();
740 Float_t p = MPart->P();
741 Float_t phi = MPart->Phi();
743 if(pT > 0.001) eta = MPart->Eta();
744 Float_t theta = MPart->Theta();
746 printf("ind %7i part %7i -> child1 %5i child2 %5i Status %5i\n",
747 part, mpart, child1, MPart->GetLastDaughter(), MPart->GetStatusCode());
751 if (part == 6 || part == 7)
753 printf("\n Simulated Jet (pt, eta, phi): %d %f %f %f\n",
754 part-5, pT, eta, phi);
758 fTrackList[part] = 0;
759 fPtT[part] = pT; // must be change after correction for resolution !!!
764 // if (part < 2) continue;
765 if (MPart->GetStatusCode() != 1) continue;
767 TParticlePDG* pdgP = 0;
768 // charged or neutral
769 pdgP = MPart->GetPDG();
770 chTmp = pdgP->Charge() / 3.; // 13-feb-2001!!
777 if (mpart != kNeutron &&
778 mpart != kNeutronBar &&
779 mpart != kK0Long) continue;
783 if (TMath::Abs(eta)<=0.9) fNChTpc++;
785 if (child1 >= 0 && child1 < npart) continue;
787 if (eta > fEtaMax || eta < fEtaMin) continue;
788 if (phi > fPhiMax || phi < fPhiMin ) continue;
791 printf("\n=>nsel:%5d mpart %5d child1 %5d eta %6.2f phi %6.2f pT %6.2f ch %3.0f ",
792 part, mpart, child1, eta, phi, pT, chTmp);
795 // Momentum smearing goes here ...
799 if (fSmear && TMath::Abs(chTmp)) {
800 pw = AliEMCALFast::SmearMomentum(1,p);
801 // p changed - take into account when calculate pT,
804 if(fDebug >= 4) printf("\n Smearing : p %8.4f change to %8.4f ", p, pw);
808 // Tracking Efficiency and TPC acceptance goes here ...
810 if (fEffic && TMath::Abs(chTmp)) {
811 eff = AliEMCALFast::Efficiency(2,p);
812 if(fhEff) fhEff->Fill(p, eff);
813 if (AliEMCALFast::RandomReject(eff)) {
814 if(fDebug >= 5) printf(" reject due to unefficiency ");
819 // Correction of Hadronic Energy goes here ...
822 // phi propagation for hadronic correction
824 Bool_t curls = kFALSE; // hit two the EMCAL (no curl)
825 Float_t phiHC=0.0, dpH=0.0, dphi=0.0, eTdpH=0;
826 if(TMath::Abs(chTmp)) {
827 // hadr. correction only for charge particle
828 dphi = PropagatePhi(pT, chTmp, curls);
831 printf("\n Delta phi %f pT %f ", dphi, pT);
832 if (curls) printf("\n !! Track is curling");
834 if(!curls) fhTrackPtBcut->Fill(pT);
836 if (fHCorrection && !curls) {
837 if (!fHadronCorrector)
838 Fatal("AliEMCALJetFinder",
839 "Hadronic energy correction required but not defined !");
841 dpH = fHadronCorrector->GetEnergy(p, eta, 7);
842 eTdpH = dpH*TMath::Sin(theta);
844 if (fDebug >= 7) printf(" phi %f phiHC %f eTcorr %f\n",
845 phi, phiHC, -eTdpH); // correction is negative
846 fLego->Fill(eta, phiHC, -eTdpH );
847 fhLegoHadrCorr->Fill(eta, phiHC, eTdpH);
851 // More to do ? Just think about it !
853 if (phi > fPhiMax || phi < fPhiMin ) continue;
855 if(TMath::Abs(chTmp) ) { // charge particle
856 if (pT > fPtCut && !curls) {
857 if (fDebug >= 8) printf("Charge : fLego->Fill(%5.2f, %5.2f, %6.2f, %d)\n",
858 eta , phi, pT, fNtS);
859 fLego->Fill(eta, phi, pT);
860 fhLegoTracks->Fill(eta, phi, pT); // 20-feb for checking
861 fTrackList[part] = 1;
864 } else if(ich == 1 || fK0N) {
865 // case of n, nbar and K0L
866 if (fDebug >= 9) printf("Neutral : fLego->Fill(%5.2f, %5.2f, %6.2f, %d)\n",
867 eta , phi, pT, fNtS);
868 fLego->Fill(eta, phi, pT);
869 fTrackList[part] = 1;
874 for(Int_t i=0; i<fLego->GetSize(); i++) {
875 Float_t etc = (*fLego)[i];
876 if (etc > fMinCellEt) etsum += etc;
879 printf("\nFillFromTracks: Sum above threshold %f %f \n \n", fMinCellEt, etsum);
884 void AliEMCALJetFinder::FillFromHits(Int_t flag)
887 // Fill Cells with hit information
891 printf("\n AliEMCALJetFinder::FillFromHits(%i)\n",flag);
895 if (!fLego) BookLego();
896 // Reset eta-phi maps if needed
897 if (flag == 0) { // default behavior
899 fhLegoTracks->Reset();
900 fhLegoEMCAL->Reset();
901 fhLegoHadrCorr->Reset();
903 // Initialize from background event if available
905 // Access hit information
906 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
907 TTree *treeH = gAlice->TreeH();
908 Int_t ntracks = (Int_t) treeH->GetEntries();
915 for (Int_t track=0; track<ntracks;track++) {
917 nbytes += treeH->GetEvent(track);
921 for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
923 mHit=(AliEMCALHit*) pEMCAL->NextHit())
925 Float_t x = mHit->X(); // x-pos of hit
926 Float_t y = mHit->Y(); // y-pos
927 Float_t z = mHit->Z(); // z-pos
928 Float_t eloss = mHit->GetEnergy(); // deposited energy
930 Float_t r = TMath::Sqrt(x*x+y*y);
931 Float_t theta = TMath::ATan2(r,z);
932 Float_t eta = -TMath::Log(TMath::Tan(theta/2.));
933 Float_t phi = TMath::ATan2(y,x);
935 if (fDebug >= 11) printf("\n Hit %f %f %f %f %f %f %f %f", x, y, z, eloss, r, eta, phi, fSamplingF);
936 // printf("\n Hit %f %f %f %f", x, y, z, eloss);
938 etH = fSamplingF*eloss*TMath::Sin(theta);
939 fLego->Fill(eta, phi, etH);
940 // fhLegoEMCAL->Fill(eta, phi, etH);
943 // copy content of fLego to fhLegoEMCAL (fLego and fhLegoEMCAL are identical)
946 for(Int_t i=0; i<fLego->GetSize(); i++) {
947 (*fhLegoEMCAL)[i] = (*fLego)[i];
948 Float_t etc = (*fLego)[i];
949 if (etc > fMinCellEt) etsum += etc;
952 printf("\nFillFromHits: Sum above threshold %f %f \n \n", fMinCellEt, etsum);
958 void AliEMCALJetFinder::FillFromDigits(Int_t flag)
961 // Fill Cells with digit information
966 if (!fLego) BookLego();
967 if (flag == 0) fLego->Reset();
974 TClonesArray* digs = new TClonesArray("AliEMCALDigit", 10000);
975 TTree *treeD = gAlice->TreeD();
976 TBranchElement* branchDg = (TBranchElement*)
977 treeD->GetBranch("EMCAL");
979 if (!branchDg) Fatal("AliEMCALJetFinder",
980 "Reading digits requested but no digits in file !");
982 branchDg->SetAddress(&digs);
983 Int_t nent = (Int_t) branchDg->GetEntries();
987 AliEMCALDigitizer* digr = new AliEMCALDigitizer();
988 TBranchElement* branchDr = (TBranchElement*)
989 treeD->GetBranch("AliEMCALDigitizer");
990 branchDr->SetAddress(&digr);
993 nbytes += branchDg->GetEntry(0);
994 nbytes += branchDr->GetEntry(0);
996 // Get digitizer parameters
997 Float_t preADCped = digr->GetPREpedestal();
998 Float_t preADCcha = digr->GetPREchannel();
999 Float_t ecADCped = digr->GetECpedestal();
1000 Float_t ecADCcha = digr->GetECchannel();
1001 Float_t hcADCped = digr->GetHCpedestal();
1002 Float_t hcADCcha = digr->GetHCchannel();
1004 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
1005 AliEMCALGeometry* geom =
1006 AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
1009 Int_t ndig = digs->GetEntries();
1010 Info("FillFromDigits","Number of Digits: %d %d\n Parameters: PRE : %f %f EC: %f %f HC: %f %f\n Geometry: %d %d",
1011 ndig, nent, preADCped, preADCcha, ecADCped, ecADCcha, hcADCped, hcADCcha, geom->GetNEta(), geom->GetNPhi());
1018 while ((sdg = (AliEMCALDigit*)(next())))
1020 Double_t pedestal = 0.;
1021 Double_t channel = 0.;
1022 if (geom->IsInPRE(sdg->GetId())) {
1023 pedestal = preADCped;
1024 channel = preADCcha;
1026 else if (geom->IsInECAL(sdg->GetId())) {
1027 pedestal = ecADCped;
1030 else if (geom->IsInHCAL(sdg->GetId())) {
1031 pedestal = hcADCped;
1035 Fatal("FillFromDigits", "unexpected digit is number!") ;
1037 Float_t eta = sdg->GetEta();
1038 Float_t phi = sdg->GetPhi() * TMath::Pi()/180.;
1039 Float_t amp = (Float_t) (channel*(sdg->GetAmp())-pedestal);
1042 Info("FillFromDigits", "Digit: eta %8.3f phi %8.3f amp %8.3f %8d",
1043 eta, phi, amp, sdg->GetAmp());
1045 fLego->Fill(eta, phi, fSamplingF*amp);
1053 void AliEMCALJetFinder::FillFromHitFlaggedTracks(Int_t flag)
1056 // Fill Cells with hit information
1061 if (!fLego) BookLego();
1063 if (flag == 0) fLego->Reset();
1065 // Flag charged tracks passing through TPC which
1066 // are associated to EMCAL Hits
1067 BuildTrackFlagTable();
1070 // Access particle information
1071 TTree *treeK = gAlice->TreeK();
1072 Int_t ntracks = (Int_t) treeK->GetEntries();
1074 if (fPtT) delete[] fPtT;
1075 if (fEtaT) delete[] fEtaT;
1076 if (fPhiT) delete[] fPhiT;
1077 if (fPdgT) delete[] fPdgT;
1079 fPtT = new Float_t[ntracks];
1080 fEtaT = new Float_t[ntracks];
1081 fPhiT = new Float_t[ntracks];
1082 fPdgT = new Int_t[ntracks];
1087 for (Int_t track = 0; track < ntracks; track++) {
1088 TParticle *MPart = gAlice->Particle(track);
1089 Float_t pT = MPart->Pt();
1090 Float_t phi = MPart->Phi();
1091 Float_t eta = MPart->Eta();
1093 if(fTrackList[track]) {
1097 fPdgT[track] = MPart->GetPdgCode();
1099 if (track < 2) continue; //Colliding particles?
1100 if (pT == 0 || pT < fPtCut) continue;
1102 fLego->Fill(eta, phi, pT);
1108 void AliEMCALJetFinder::FillFromParticles()
1110 // 26-feb-2002 PAI - for checking all chain
1111 // Work on particles level; accept all particle (not neutrino )
1113 Double_t PX=0, PY=0, PZ=0, E=0; // checking conservation law
1117 if (!fLego) BookLego();
1120 // Access particles information
1121 Int_t npart = (gAlice->GetHeader())->GetNprimary();
1122 if (fDebug >= 2 || npart<=0) {
1123 printf(" AliEMCALJetFinder::FillFromParticles : npart %i\n", npart);
1124 if(npart<=0) return;
1128 RearrangeParticlesMemory(npart);
1130 // Go through the particles
1131 Int_t mpart, child1, child2, geantPdg;
1132 Float_t pT, phi, eta, e=0, px=0, py=0, pz=0;
1134 for (Int_t part = 0; part < npart; part++) {
1136 fTrackList[part] = 0;
1138 MPart = gAlice->Particle(part);
1139 mpart = MPart->GetPdgCode();
1140 child1 = MPart->GetFirstDaughter();
1141 child2 = MPart->GetLastDaughter();
1149 e = MPart->Energy();
1151 // see pyedit in Pythia's text
1153 if (IsThisPartonsOrDiQuark(mpart)) continue;
1154 printf("%5i: %5i(%2i) px %5.1f py %5.1f pz %6.1f e %6.1f childs %5i,%5i \n",
1155 part, mpart, geantPdg, px, py, pz, e, child1, child2);
1157 // exclude partons (21 - gluon, 92 - string)
1160 // exclude neutrinous also ??
1161 if (fDebug >= 11 && pT>0.01)
1162 printf("\n part:%5d mpart %5d eta %9.2f phi %9.2f pT %9.2f ",
1163 part, mpart, eta, phi, pT);
1168 fPdgT[part] = mpart;
1172 if (child1 >= 0 && child1 < npart) continue;
1174 // printf("%4i -> %5i(%3i) px %6.1f py %6.1f pz %7.1f e %8.2f child1 %5i %s\n",
1175 // part, mpart, geantPdg, px, py, pz, e, child1, name.Data());
1182 if (TMath::Abs(eta) <= 0.9) fNChTpc++;
1184 if (eta > fEtaMax || eta < fEtaMin) continue;
1185 if (phi > fPhiMax || phi < fPhiMin ) continue;
1187 if(fK0N==0 ) { // exclude neutral hadrons
1188 if (mpart == kNeutron || mpart == kNeutronBar || mpart == kK0Long) continue;
1190 fTrackList[part] = 1;
1191 fLego->Fill(eta, phi, pT);
1194 printf("\n PX %8.2f PY %8.2f PZ %8.2f E %8.2f \n",
1197 if(fhChPartMultInTpc) fhChPartMultInTpc->Fill(fNChTpc);
1200 void AliEMCALJetFinder::FillFromPartons()
1202 // function under construction - 13-feb-2002 PAI
1205 printf("\n AliEMCALJetFinder::FillFromPartons()\n");
1209 if (!fLego) BookLego();
1212 // Access particle information
1213 Int_t npart = (gAlice->GetHeader())->GetNprimary();
1214 if (fDebug >= 2 || npart<=0)
1215 printf("\n AliEMCALJetFinder::FillFromPartons : npart %i\n", npart);
1216 fNt = 0; // for FindTracksInJetCone
1219 // Go through the partons
1221 for (Int_t part = 8; part < npart; part++) {
1222 TParticle *MPart = gAlice->Particle(part);
1223 Int_t mpart = MPart->GetPdgCode();
1224 // Int_t child1 = MPart->GetFirstDaughter();
1225 Float_t pT = MPart->Pt();
1226 // Float_t p = MPart->P();
1227 Float_t phi = MPart->Phi();
1228 Float_t eta = MPart->Eta();
1229 // Float_t theta = MPart->Theta();
1230 statusCode = MPart->GetStatusCode();
1232 // accept partons (21 - gluon, 92 - string)
1233 if (!(TMath::Abs(mpart) <= 6 || mpart == 21 ||mpart == 92)) continue;
1234 if (fDebug > 1 && pT>0.01)
1235 printf("\n part:%5d mpart %5d status %5d eta %8.2f phi %8.2f pT %8.2f ",
1236 part, mpart, statusCode, eta, phi, pT);
1237 // if (fDebug >= 3) MPart->Print();
1238 // accept partons before fragmentation - p.57 in Pythia manual
1239 // if(statusCode != 1) continue;
1241 if (eta > fEtaMax || eta < fEtaMin) continue;
1242 if (phi > fPhiMax || phi < fPhiMin ) continue;
1244 // if (child1 >= 0 && child1 < npart) continue;
1247 fLego->Fill(eta, phi, pT);
1253 void AliEMCALJetFinder::BuildTrackFlagTable() {
1255 // Method to generate a lookup table for TreeK particles
1256 // which are linked to hits in the EMCAL
1258 // --Author: J.L. Klay
1260 // Access hit information
1261 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
1263 TTree *TK = gAlice->TreeK(); // Get the number of entries in the kine tree
1264 Int_t nKTrks = (Int_t) TK->GetEntries(); // (Number of particles created somewhere)
1266 if(fTrackList) delete[] fTrackList; //Make sure we get rid of the old one
1267 fTrackList = new Int_t[nKTrks]; //before generating a new one
1269 for (Int_t i = 0; i < nKTrks; i++) { //Initialize members to 0
1273 TTree *treeH = gAlice->TreeH();
1274 Int_t ntracks = (Int_t) treeH->GetEntries();
1280 for (Int_t track=0; track<ntracks;track++) {
1281 gAlice->ResetHits();
1282 nbytes += treeH->GetEvent(track);
1288 for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
1290 mHit=(AliEMCALHit*) pEMCAL->NextHit())
1292 Int_t iTrk = mHit->Track(); // track number
1293 Int_t idprim = mHit->GetPrimary(); // primary particle
1295 //Determine the origin point of this particle - it made a hit in the EMCAL
1296 TParticle *trkPart = gAlice->Particle(iTrk);
1297 TParticlePDG *trkPdg = trkPart->GetPDG();
1298 Int_t trkCode = trkPart->GetPdgCode();
1300 if (trkCode < 10000) { //Big Ions cause problems for
1301 trkChg = trkPdg->Charge(); //this function. Since they aren't
1302 } else { //likely to make it very far, set
1303 trkChg = 0.0; //their charge to 0 for the Flag test
1305 Float_t vxTrk = trkPart->Vx();
1306 Float_t vyTrk = trkPart->Vy();
1307 Float_t vrTrk = TMath::Sqrt(vxTrk*vxTrk+vyTrk*vyTrk);
1308 fTrackList[iTrk] = SetTrackFlag(vrTrk,trkCode,trkChg);
1310 //Loop through the ancestry of the EMCAL entrance particles
1311 Int_t ancestor = trkPart->GetFirstMother(); //Get track's Mother
1312 while (ancestor != -1) {
1313 TParticle *ancPart = gAlice->Particle(ancestor); //get particle info on ancestor
1314 TParticlePDG *ancPdg = ancPart->GetPDG();
1315 Int_t ancCode = ancPart->GetPdgCode();
1317 if (ancCode < 10000) {
1318 ancChg = ancPdg->Charge();
1322 Float_t vxAnc = ancPart->Vx();
1323 Float_t vyAnc = ancPart->Vy();
1324 Float_t vrAnc = TMath::Sqrt(vxAnc*vxAnc+vyAnc*vyAnc);
1325 fTrackList[ancestor] = SetTrackFlag(vrAnc,ancCode,ancChg);
1326 ancestor = ancPart->GetFirstMother(); //Get the next ancestor
1329 //Determine the origin point of the primary particle associated with the hit
1330 TParticle *primPart = gAlice->Particle(idprim);
1331 TParticlePDG *primPdg = primPart->GetPDG();
1332 Int_t primCode = primPart->GetPdgCode();
1334 if (primCode < 10000) {
1335 primChg = primPdg->Charge();
1339 Float_t vxPrim = primPart->Vx();
1340 Float_t vyPrim = primPart->Vy();
1341 Float_t vrPrim = TMath::Sqrt(vxPrim*vxPrim+vyPrim*vyPrim);
1342 fTrackList[idprim] = SetTrackFlag(vrPrim,primCode,primChg);
1348 Int_t AliEMCALJetFinder
1349 ::SetTrackFlag(Float_t radius, Int_t code, Double_t charge) {
1355 if (charge == 0) neutral = 1;
1357 if (TMath::Abs(code) <= 6 ||
1359 code == 92) parton = 1;
1361 //It's not a parton, it's charged and it went through the TPC
1362 if (!parton && !neutral && radius <= 84.0) flag = 1;
1369 void AliEMCALJetFinder::SaveBackgroundEvent()
1371 // Saves the eta-phi lego and the tracklist
1375 (*fLegoB) = (*fLegoB) + (*fLego);
1377 printf("\n AliEMCALJetFinder::SaveBackgroundEvent() (fLegoB) %f = %f(fLego) \n",
1378 fLegoB->Integral(), fLego->Integral());
1381 if (fPtB) delete[] fPtB;
1382 if (fEtaB) delete[] fEtaB;
1383 if (fPhiB) delete[] fPhiB;
1384 if (fPdgB) delete[] fPdgB;
1385 if (fTrackListB) delete[] fTrackListB;
1387 fPtB = new Float_t[fNtS];
1388 fEtaB = new Float_t[fNtS];
1389 fPhiB = new Float_t[fNtS];
1390 fPdgB = new Int_t [fNtS];
1391 fTrackListB = new Int_t [fNtS];
1395 for (Int_t i = 0; i < fNt; i++) {
1396 if (!fTrackList[i]) continue;
1397 fPtB [fNtB] = fPtT [i];
1398 fEtaB[fNtB] = fEtaT[i];
1399 fPhiB[fNtB] = fPhiT[i];
1400 fPdgB[fNtB] = fPdgT[i];
1401 fTrackListB[fNtB] = 1;
1405 printf(" fNtB %i => fNtS %i #particles %i \n", fNtB, fNtS, fNt);
1408 void AliEMCALJetFinder::InitFromBackground()
1412 if (fDebug) printf("\n AliEMCALJetFinder::InitFromBackground() ");
1416 (*fLego) = (*fLego) + (*fLegoB);
1418 printf("\n AliEMCALJetFinder::SaveBackgroundEvent() (fLego) %f = %f(fLegoB) \n",
1419 fLego->Integral(), fLegoB->Integral());
1421 printf(" => fLego undefined \n");
1426 void AliEMCALJetFinder::FindTracksInJetCone()
1429 // Build list of tracks inside jet cone
1432 Int_t njet = Njets();
1433 for (Int_t nj = 0; nj < njet; nj++)
1435 Float_t etaj = JetEtaW(nj);
1436 Float_t phij = JetPhiW(nj);
1437 Int_t nT = 0; // number of associated tracks
1439 // Loop over particles in current event
1440 for (Int_t part = 0; part < fNt; part++) {
1441 if (!fTrackList[part]) continue;
1442 Float_t phi = fPhiT[part];
1443 Float_t eta = fEtaT[part];
1444 Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) +
1445 (phij-phi)*(phij-phi));
1446 if (dr < fConeRadius) {
1447 fTrackList[part] = nj+2;
1452 // Same for background event if available
1455 for (Int_t part = 0; part < fNtB; part++) {
1456 Float_t phi = fPhiB[part];
1457 Float_t eta = fEtaB[part];
1458 Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) +
1459 (phij-phi)*(phij-phi));
1460 fTrackListB[part] = 1;
1462 if (dr < fConeRadius) {
1463 fTrackListB[part] = nj+2;
1467 } // Background available ?
1469 Int_t nT0 = nT + nTB;
1470 printf("Total number of tracks %d\n", nT0);
1472 if (nT0 > 1000) nT0 = 1000;
1474 Float_t* ptT = new Float_t[nT0];
1475 Float_t* etaT = new Float_t[nT0];
1476 Float_t* phiT = new Float_t[nT0];
1477 Int_t* pdgT = new Int_t[nT0];
1482 for (Int_t part = 0; part < fNt; part++) {
1483 if (fTrackList[part] == nj+2) {
1485 for (j=iT-1; j>=0; j--) {
1486 if (fPtT[part] > ptT[j]) {
1491 for (j=iT-1; j>=index; j--) {
1492 ptT [j+1] = ptT [j];
1493 etaT[j+1] = etaT[j];
1494 phiT[j+1] = phiT[j];
1495 pdgT[j+1] = pdgT[j];
1497 ptT [index] = fPtT [part];
1498 etaT[index] = fEtaT[part];
1499 phiT[index] = fPhiT[part];
1500 pdgT[index] = fPdgT[part];
1502 } // particle associated
1503 if (iT > nT0) break;
1507 for (Int_t part = 0; part < fNtB; part++) {
1508 if (fTrackListB[part] == nj+2) {
1510 for (j=iT-1; j>=0; j--) {
1511 if (fPtB[part] > ptT[j]) {
1517 for (j=iT-1; j>=index; j--) {
1518 ptT [j+1] = ptT [j];
1519 etaT[j+1] = etaT[j];
1520 phiT[j+1] = phiT[j];
1521 pdgT[j+1] = pdgT[j];
1523 ptT [index] = fPtB [part];
1524 etaT[index] = fEtaB[part];
1525 phiT[index] = fPhiB[part];
1526 pdgT[index] = fPdgB[part];
1528 } // particle associated
1529 if (iT > nT0) break;
1531 } // Background available ?
1533 fJetT[nj]->SetTrackList(nT0, ptT, etaT, phiT, pdgT);
1542 Float_t AliEMCALJetFinder::PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls)
1544 // Propagates phi angle to EMCAL radius
1546 static Float_t b = 0.0, rEMCAL = -1.0;
1548 b = gAlice->Field()->SolenoidField();
1549 // Get EMCAL radius in cm
1550 rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance();
1558 Float_t rB = 3335.6 * pt / b; // [cm] (case of |charge|=1)
1560 // check if particle is curling below EMCAL
1561 if (2.*rB < rEMCAL) {
1566 // if not calculate delta phi
1567 Float_t phi = TMath::ACos(1.-rEMCAL*rEMCAL/(2.*rB*rB));
1568 dPhi = TMath::ATan2(1.-TMath::Cos(phi), TMath::Sin(phi));
1569 dPhi = -TMath::Sign(dPhi, charge);
1574 void hf1(Int_t& id, Float_t& x, Float_t& wgt)
1576 // dummy for hbook calls
1580 void AliEMCALJetFinder::DrawLego(Char_t *opt)
1583 void AliEMCALJetFinder::DrawLegoEMCAL(Char_t *opt)
1584 {fhLegoEMCAL->Draw(opt);}
1586 void AliEMCALJetFinder::DrawHistsForTuning(Int_t mode)
1588 static TPaveText *varLabel=0;
1590 fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800);
1600 fhCellEMCALEt->Draw();
1605 fhTrackPtBcut->SetLineColor(2);
1606 fhTrackPtBcut->Draw("same");
1611 varLabel = new TPaveText(0.05,0.5,0.95,0.95,"NDC");
1612 varLabel->SetTextAlign(12);
1613 varLabel->SetFillColor(19); // see TAttFill
1614 TString tmp(GetTitle());
1615 varLabel->ReadFile(GetFileNameForParameters());
1619 if(mode) { // for saving picture to the file
1620 TString stmp(GetFileNameForParameters());
1621 stmp.ReplaceAll("_Par.txt",".ps");
1622 fC1->Print(stmp.Data());
1626 void AliEMCALJetFinder::PrintParameters(Int_t mode)
1629 if(mode==0) file = stdout; // output to terminal
1631 file = fopen(GetFileNameForParameters(),"w");
1632 if(file==0) file = stdout;
1634 fprintf(file,"==== Filling lego ==== \n");
1635 fprintf(file,"Smearing %6i ", fSmear);
1636 fprintf(file,"Efficiency %6i\n", fEffic);
1637 fprintf(file,"Hadr.Correct. %6i ", fHCorrection);
1638 fprintf(file,"P_{T} Cut of ch.par. %6.2f\n", fPtCut);
1639 fprintf(file,"==== Jet finding ==== \n");
1640 fprintf(file,"Cone radius %6.2f ", fConeRadius);
1641 fprintf(file,"Seed E_{T} %6.1f\n", fEtSeed);
1642 fprintf(file,"Min E_{T} of cell %6.1f ", fMinCellEt);
1643 fprintf(file,"Min E_{T} of jet %6.1f\n", fMinJetEt);
1645 fprintf(file,"==== Bg subtraction ==== \n");
1646 fprintf(file,"BG subtraction %6i ", fMode);
1647 fprintf(file,"Min cone move %6.2f\n", fMinMove);
1648 fprintf(file,"Max cone move %6.2f ", fMaxMove);
1649 fprintf(file,"%% change for BG %6.4f\n", fPrecBg);
1651 fprintf(file,"==== No Bg subtraction ==== \n");
1652 if(file != stdout) fclose(file);
1655 void AliEMCALJetFinder::DrawLegos()
1658 fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800);
1662 gStyle->SetOptStat(111111);
1664 Int_t nent1, nent2, nent3, nent4;
1665 Double_t int1, int2, int3, int4;
1666 nent1 = (Int_t)fLego->GetEntries();
1667 int1 = fLego->Integral();
1669 if(int1) fLego->Draw("lego");
1671 nent2 = (Int_t)fhLegoTracks->GetEntries();
1672 int2 = fhLegoTracks->Integral();
1674 if(int2) fhLegoTracks->Draw("lego");
1676 nent3 = (Int_t)fhLegoEMCAL->GetEntries();
1677 int3 = fhLegoEMCAL->Integral();
1679 if(int3) fhLegoEMCAL->Draw("lego");
1681 nent4 = (Int_t)fhLegoHadrCorr->GetEntries();
1682 int4 = fhLegoHadrCorr->Integral();
1684 if(int4) fhLegoHadrCorr->Draw("lego");
1686 // just for checking
1687 printf(" Integrals \n");
1688 printf("lego %10.3f \ntrack %10.3f \nhits %10.3f \nHCorr %10.3f\n-- %10.3f(must be 0)\n",
1689 int1, int2, int3, int4, int1 - (int2 + int3 - int4));
1692 const Char_t* AliEMCALJetFinder::GetFileNameForParameters(Char_t* dir)
1695 if(strlen(dir)) tmp = dir;
1701 void AliEMCALJetFinder::RearrangeParticlesMemory(Int_t npart)
1702 { // See FillFromTracks() - npart must be positive
1703 if (fTrackList) delete[] fTrackList;
1704 if (fPtT) delete[] fPtT;
1705 if (fEtaT) delete[] fEtaT;
1706 if (fPhiT) delete[] fPhiT;
1707 if (fPdgT) delete[] fPdgT;
1710 fTrackList = new Int_t [npart];
1711 fPtT = new Float_t[npart];
1712 fEtaT = new Float_t[npart];
1713 fPhiT = new Float_t[npart];
1714 fPdgT = new Int_t[npart];
1716 printf("AliEMCALJetFinder::RearrangeParticlesMemory : npart = %d\n", npart);
1720 Bool_t AliEMCALJetFinder::IsThisPartonsOrDiQuark(Int_t pdg)
1722 Int_t absPdg = TMath::Abs(pdg);
1723 if(absPdg<=6) return kTRUE; // quarks
1724 if(pdg == 21) return kTRUE; // gluon
1725 if(pdg == 92) return kTRUE; // string
1727 // see p.51 of Pythia Manual
1728 // Not include diquarks with c and b quark - 4-mar-2002
1729 // ud_0,sd_0,su_0; dd_1,ud_1,uu_1; sd_1,su_1,ss_1
1730 static Int_t diquark[9]={2101,3101,3201, 1103,2103,2203, 3103,3203,3303};
1731 for(Int_t i=0; i<9; i++) if(absPdg == diquark[i]) return kTRUE; // diquarks
1736 void AliEMCALJetFinder::FindChargedJet()
1739 // Find jet from charged particle information only
1754 for (part = 0; part < fNt; part++) {
1755 if (!fTrackList[part]) continue;
1756 if (fPtT[part] > fEtSeed) nseed++;
1758 printf("\nThere are %d seeds (%d)\n", nseed, fNtS);
1759 Int_t* iSeeds = new Int_t[nseed];
1762 for (part = 0; part < fNt; part++) {
1763 if (!fTrackList[part]) continue;
1764 if (fPtT[part] > fEtSeed) iSeeds[nseed++] = part;
1775 // Find seed with highest pt
1777 Float_t ptmax = -1.;
1780 for (seed = 0; seed < nseed; seed++) {
1781 if ((pt = fPtT[iSeeds[seed]]) > ptmax && iSeeds[seed] != -1) {
1786 if (ptmax < 0.) break;
1787 jndex = iSeeds[index];
1789 // Remove from the list
1791 printf("\n Next Seed %d %f", jndex, ptmax);
1793 // Find tracks in cone around seed
1795 Float_t phiSeed = fPhiT[jndex];
1796 Float_t etaSeed = fEtaT[jndex];
1802 for (part = 0; part < fNt; part++) {
1803 if (!fTrackList[part]) continue;
1804 Float_t deta = fEtaT[part] - etaSeed;
1805 Float_t dphi = fPhiT[part] - phiSeed;
1806 Float_t dR = TMath::Sqrt(deta * deta + dphi * dphi);
1807 if (dR < fConeRadius) {
1809 Float_t theta = 2. * TMath::ATan(TMath::Exp(-fEtaT[part]));
1810 Float_t px = fPtT[part] * TMath::Cos(fPhiT[part]);
1811 Float_t py = fPtT[part] * TMath::Sin(fPhiT[part]);
1812 Float_t pz = fPtT[part] / TMath::Tan(theta);
1817 // if seed, remove it
1819 for (seed = 0; seed < nseed; seed++) {
1820 if (part == iSeeds[seed]) iSeeds[seed] = -1;
1826 // Estimate of jet direction
1827 Float_t phiJ = TMath::ATan2(pyJ, pxJ);
1828 Float_t thetaJ = TMath::ATan2(TMath::Sqrt(pxJ * pxJ + pyJ * pyJ), pzJ);
1829 Float_t etaJ = TMath::Log(TMath::Tan(thetaJ / 2.));
1830 // Float_t ptJ = TMath::Sqrt(pxJ * pxJ + pyJ * pyJ);
1833 // Sum up all energy
1835 Int_t iPhi0 = Int_t((phiJ - fPhiMin) / fDphi);
1836 Int_t iEta0 = Int_t((etaJ - fEtaMin) / fDeta);
1837 Int_t dIphi = Int_t(fConeRadius / fDphi);
1838 Int_t dIeta = Int_t(fConeRadius / fDeta);
1841 for (iPhi = iPhi0 -dIphi; iPhi < iPhi0 + dIphi; iPhi++) {
1842 for (iEta = iEta0 - dIeta; iEta < iEta0 + dIeta; iEta++) {
1843 if (iPhi < 0 || iEta < 0) continue;
1844 Float_t dPhi = fPhiMin + iPhi * fDphi;
1845 Float_t dEta = fEtaMin + iEta * fDeta;
1846 if (TMath::Sqrt(dPhi * dPhi + dEta * dEta) < fConeRadius) continue;
1847 sumE += fLego->GetBinContent(iEta, iPhi);
1853 fJetT[njets++] = new AliEMCALJet(sumE, phiJ, etaJ);
1854 FindTracksInJetCone();
1855 printf("\n Jet Energy %f %f %f %f %d\n", eT, sumE, fPtT[6], fPtT[7], njets);
1856 printf("\n Jet Phi %f %f %f \n", phiJ, fPhiT[6], fPhiT[7]);
1857 printf("\n Jet Eta %f %f %f \n", etaJ, fEtaT[6], fEtaT[7]);
1859 EMCALJETS.njet = njets;
1860 if (fWrite) WriteJets();