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.32 2003/01/10 10:26:40 morsch
19 Sampling fraction initialized from geometry class.
21 Revision 1.31 2003/01/08 17:13:41 schutz
22 added the HCAL section
24 Revision 1.30 2002/12/09 16:26:28 morsch
25 - Nummber of particles per jet increased to 1000
28 Revision 1.29 2002/11/21 17:01:40 alibrary
29 Removing AliMCProcess and AliMC
31 Revision 1.28 2002/11/20 14:13:16 morsch
32 - FindChargedJets() added.
33 - Destructor corrected.
34 - Geometry cuts taken from AliEMCALGeometry.
36 Revision 1.27 2002/11/15 17:39:10 morsch
37 GetPythiaParticleName removed.
39 Revision 1.26 2002/10/14 14:55:35 hristov
40 Merging the VirtualMC branch to the main development branch (HEAD)
42 Revision 1.20.4.3 2002/10/10 15:07:49 hristov
43 Updating VirtualMC to v3-09-02
45 Revision 1.25 2002/09/13 10:24:57 morsch
48 Revision 1.24 2002/09/13 10:21:13 morsch
51 Revision 1.23 2002/06/27 09:24:26 morsch
52 Uncomment the TH1::AddDirectory statement.
54 Revision 1.22 2002/05/22 13:48:43 morsch
55 Pdg code added to track list.
57 Revision 1.21 2002/04/27 07:43:08 morsch
58 Calculation of fDphi corrected (Renan Cabrera)
60 Revision 1.20 2002/03/12 01:06:23 pavlinov
61 Testin output from generator
63 Revision 1.19 2002/02/27 00:46:33 pavlinov
64 Added method FillFromParticles()
66 Revision 1.18 2002/02/21 08:48:59 morsch
67 Correction in FillFromHitFlaggedTrack. (Jennifer Klay)
69 Revision 1.17 2002/02/14 08:52:53 morsch
70 Major updates by Aleksei Pavlinov:
71 FillFromPartons, FillFromTracks, jetfinder configuration.
73 Revision 1.16 2002/02/08 11:43:05 morsch
74 SetOutputFileName(..) allows to specify an output file to which the
75 reconstructed jets are written. If not set output goes to input file.
76 Attention call Init() before processing.
78 Revision 1.15 2002/02/02 08:37:18 morsch
79 Formula for rB corrected.
81 Revision 1.14 2002/02/01 08:55:30 morsch
82 Fill map with Et and pT.
84 Revision 1.13 2002/01/31 09:37:36 morsch
85 Geometry parameters in constructor and call of SetCellSize()
87 Revision 1.12 2002/01/23 13:40:23 morsch
88 Fastidious debug print statement removed.
90 Revision 1.11 2002/01/22 17:25:47 morsch
91 Some corrections for event mixing and bg event handling.
93 Revision 1.10 2002/01/22 10:31:44 morsch
94 Some correction for bg mixing.
96 Revision 1.9 2002/01/21 16:28:42 morsch
99 Revision 1.8 2002/01/21 16:05:31 morsch
100 - different phi-bin for hadron correction
101 - provisions for background mixing.
103 Revision 1.7 2002/01/21 15:47:18 morsch
104 Bending radius correctly in cm.
106 Revision 1.6 2002/01/21 12:53:50 morsch
109 Revision 1.5 2002/01/21 12:47:47 morsch
110 Possibility to include K0long and neutrons.
112 Revision 1.4 2002/01/21 11:03:21 morsch
113 Phi propagation introduced in FillFromTracks.
115 Revision 1.3 2002/01/18 05:07:56 morsch
116 - hadronic correction
118 - track selection upon EMCAL information
122 //*-- Authors: Andreas Morsch (CERN)
124 //* Aleksei Pavlinov (WSU)
129 #include <TClonesArray.h>
131 #include <TBranchElement.h>
139 #include <TPaveText.h>
142 #include <TParticle.h>
143 #include <TParticlePDG.h>
144 #include <TPythia6Calls.h>
147 #include "AliEMCALJetFinder.h"
148 #include "AliEMCALFast.h"
149 #include "AliEMCALGeometry.h"
150 #include "AliEMCALHit.h"
151 #include "AliEMCALDigit.h"
152 #include "AliEMCALDigitizer.h"
153 #include "AliEMCALHadronCorrection.h"
154 #include "AliEMCALJetMicroDst.h"
157 #include "AliMagFCM.h"
158 #include "AliEMCAL.h"
159 #include "AliHeader.h"
162 // Interface to FORTRAN
166 ClassImp(AliEMCALJetFinder)
168 //____________________________________________________________________________
169 AliEMCALJetFinder::AliEMCALJetFinder()
171 // Default constructor
190 fHadronCorrector = 0;
198 SetParametersForBgSubtraction();
201 AliEMCALJetFinder::AliEMCALJetFinder(const char* name, const char *title)
205 // Title is used in method GetFileNameForParameters();
207 fJets = new TClonesArray("AliEMCALJet",10000);
209 for (Int_t i = 0; i < 30000; i++)
231 fHadronCorrector = 0;
240 SetMomentumSmearing();
243 SetHadronCorrection();
246 SetParametersForBgSubtraction();
249 void AliEMCALJetFinder::SetParametersForBgSubtraction
250 (Int_t mode, Float_t minMove, Float_t maxMove, Float_t precBg)
252 // see file /home/pavlinov/cosmic/pythia/jetFinderParamData.inc
253 // at WSU Linux cluster - 11-feb-2002
254 // These parameters must be tuned more carefull !!!
261 //____________________________________________________________________________
262 AliEMCALJetFinder::~AliEMCALJetFinder()
274 delete fhLegoHadrCorr;
277 delete fhCellEMCALEt;
279 delete fhTrackPtBcut;
280 delete fhChPartMultInTpc;
288 delete[] fTrackListB;
296 # define jet_finder_ua1 jet_finder_ua1_
298 # define type_of_call
301 # define jet_finder_ua1 JET_FINDER_UA1
303 # define type_of_call _stdcall
306 extern "C" void type_of_call
307 jet_finder_ua1(Int_t& ncell, Int_t& ncell_tot,
308 Float_t etc[30000], Float_t etac[30000],
310 Float_t& min_move, Float_t& max_move, Int_t& mode,
311 Float_t& prec_bg, Int_t& ierror);
313 extern "C" void type_of_call hf1(Int_t& id, Float_t& x, Float_t& wgt);
316 void AliEMCALJetFinder::Init()
319 // Geometry and I/O initialization
323 // Get geometry parameters from EMCAL
327 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
328 AliEMCALGeometry* geom =
329 AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
331 SetSamplingFraction(geom->GetSampling());
333 fNbinEta = geom->GetNZ();
334 fNbinPhi = geom->GetNPhi();
335 fPhiMin = geom->GetArm1PhiMin()*TMath::Pi()/180.;
336 fPhiMax = geom->GetArm1PhiMax()*TMath::Pi()/180.;
337 fEtaMin = geom->GetArm1EtaMin();
338 fEtaMax = geom->GetArm1EtaMax();
339 fDphi = (fPhiMax-fPhiMin)/fNbinPhi;
340 fDeta = (fEtaMax-fEtaMin)/fNbinEta;
341 fNtot = fNbinPhi*fNbinEta;
343 SetCellSize(fDeta, fDphi);
346 if (fOutFileName) fOutFile = new TFile(fOutFileName, "recreate");
349 void AliEMCALJetFinder::Find(Int_t ncell, Int_t ncell_tot, Float_t etc[30000],
350 Float_t etac[30000], Float_t phic[30000],
351 Float_t min_move, Float_t max_move, Int_t mode,
352 Float_t prec_bg, Int_t ierror)
354 // Wrapper for fortran coded jet finder
355 // Full argument list
356 jet_finder_ua1(ncell, ncell_tot, etc, etac, phic,
357 min_move, max_move, mode, prec_bg, ierror);
358 // Write result to output
359 if(fWrite) WriteJets();
363 void AliEMCALJetFinder::Find()
365 // Wrapper for fortran coded jet finder using member data for
368 Float_t min_move = fMinMove;
369 Float_t max_move = fMaxMove;
371 Float_t prec_bg = fPrecBg;
374 ResetJets(); // 4-feb-2002 by PAI
376 jet_finder_ua1(fNcell, fNtot, fEtCell, fEtaCell, fPhiCell,
377 min_move, max_move, mode, prec_bg, ierror);
379 // Write result to output
380 Int_t njet = Njets();
382 for (Int_t nj=0; nj<njet; nj++)
385 fJetT[nj] = new AliEMCALJet(JetEnergy(nj),
390 FindTracksInJetCone();
391 if(fWrite) WriteJets();
395 Int_t AliEMCALJetFinder::Njets()
397 // Get number of reconstructed jets
398 return EMCALJETS.njet;
401 Float_t AliEMCALJetFinder::JetEnergy(Int_t i)
403 // Get reconstructed jet energy
404 return EMCALJETS.etj[i];
407 Float_t AliEMCALJetFinder::JetPhiL(Int_t i)
409 // Get reconstructed jet phi from leading particle
410 return EMCALJETS.phij[0][i];
413 Float_t AliEMCALJetFinder::JetPhiW(Int_t i)
415 // Get reconstructed jet phi from weighting
416 return EMCALJETS.phij[1][i];
419 Float_t AliEMCALJetFinder::JetEtaL(Int_t i)
421 // Get reconstructed jet eta from leading particles
422 return EMCALJETS.etaj[0][i];
426 Float_t AliEMCALJetFinder::JetEtaW(Int_t i)
428 // Get reconstructed jet eta from weighting
429 return EMCALJETS.etaj[1][i];
432 void AliEMCALJetFinder::SetCellSize(Float_t eta, Float_t phi)
434 // Set grid cell size
435 EMCALCELLGEO.etaCellSize = eta;
436 EMCALCELLGEO.phiCellSize = phi;
439 void AliEMCALJetFinder::SetConeRadius(Float_t par)
441 // Set jet cone radius
442 EMCALJETPARAM.coneRad = par;
446 void AliEMCALJetFinder::SetEtSeed(Float_t par)
448 // Set et cut for seeds
449 EMCALJETPARAM.etSeed = par;
453 void AliEMCALJetFinder::SetMinJetEt(Float_t par)
455 // Set minimum jet et
456 EMCALJETPARAM.ejMin = par;
460 void AliEMCALJetFinder::SetMinCellEt(Float_t par)
462 // Set et cut per cell
463 EMCALJETPARAM.etMin = par;
467 void AliEMCALJetFinder::SetPtCut(Float_t par)
469 // Set pT cut on charged tracks
474 void AliEMCALJetFinder::Test()
477 // Test the finder call
479 const Int_t nmax = 30000;
481 Int_t ncell_tot = 100;
486 Float_t min_move = 0;
487 Float_t max_move = 0;
493 Find(ncell, ncell_tot, etc, etac, phic,
494 min_move, max_move, mode, prec_bg, ierror);
502 void AliEMCALJetFinder::AddJet(const AliEMCALJet& jet)
507 TClonesArray &lrawcl = *fJets;
508 new(lrawcl[fNjets++]) AliEMCALJet(jet);
511 void AliEMCALJetFinder::ResetJets()
520 void AliEMCALJetFinder::WriteJets()
523 // Add all jets to the list
525 const Int_t kBufferSize = 4000;
526 const char* file = 0;
528 Int_t njet = Njets();
530 for (Int_t nj = 0; nj < njet; nj++)
539 // output written to input file
541 AliEMCAL* pEMCAL = (AliEMCAL* )gAlice->GetModule("EMCAL");
542 TTree* pK = gAlice->TreeK();
543 file = (pK->GetCurrentFile())->GetName();
545 printf("Make Branch - TreeR address %p %p\n",gAlice->TreeR(), pEMCAL);
546 if (fJets && gAlice->TreeR()) {
547 pEMCAL->MakeBranchInTree(gAlice->TreeR(),
553 Int_t nev = gAlice->GetHeader()->GetEvent();
554 gAlice->TreeR()->Fill();
556 sprintf(hname,"TreeR%d", nev);
557 gAlice->TreeR()->Write(hname);
558 gAlice->TreeR()->Reset();
561 // Output written to user specified output file
563 TTree* pK = gAlice->TreeK();
564 fInFile = pK->GetCurrentFile();
568 sprintf(hname,"TreeR%d", fEvent);
569 TTree* treeJ = new TTree(hname, "EMCALJets");
570 treeJ->Branch("EMCALJets", &fJets, kBufferSize);
578 void AliEMCALJetFinder::BookLego()
581 // Book histo for discretisation
585 // Don't add histos to the current directory
586 if(fDebug) printf("\n AliEMCALJetFinder::BookLego() \n");
588 TH2::AddDirectory(0);
589 TH1::AddDirectory(0);
593 fLego = new TH2F("legoH","eta-phi",
594 fNbinEta, fEtaMin, fEtaMax,
595 fNbinPhi, fPhiMin, fPhiMax);
598 fLegoB = new TH2F("legoB","eta-phi for BG event",
599 fNbinEta, fEtaMin, fEtaMax,
600 fNbinPhi, fPhiMin, fPhiMax);
603 fhLegoTracks = new TH2F("hLegoTracks","eta-phi for Tracks",
604 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
606 fhLegoEMCAL = new TH2F("hLegoEMCAL","eta-phi for EMCAL",
607 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
608 // Hadron correction map
609 fhLegoHadrCorr = new TH2F("hLegoHadrCorr","eta-phi for Hadron. Correction",
610 fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax);
611 // Hists. for tuning jet finder
612 fhEff = new TH2F("hEff","#epsilon vs momentum ", 100,0.,20., 50,0.5,1.);
616 for(Int_t i=1; i<=1000; i++) eTmp[i] = 0.1*i; // step 100 mev
617 for(Int_t i=1001; i<=1100; i++) eTmp[i] = eTmp[1000] + 1.0*(i-1000); // step 1GeV
619 fhCellEt = new TH1F("hCellEt","Cell E_{T} from fLego",
620 eTmp.GetSize()-1, eTmp.GetArray());
621 fhCellEMCALEt = new TH1F("hCellEMCALEt","Cell E_{T} for EMCAL itself",
622 eTmp.GetSize()-1, eTmp.GetArray());
623 fhTrackPt = new TH1F("hTrackPt","Ch.particles P_{T} ",
624 eTmp.GetSize()-1, eTmp.GetArray());
625 fhTrackPtBcut = new TH1F("hTrackPtBcut","Ch.particles P_{T} + magnetic field cut",
626 eTmp.GetSize()-1, eTmp.GetArray());
628 fhChPartMultInTpc = new TH1F("hChPartMultInTpc",
629 "Charge partilcle multiplicity in |%eta|<0.9", 2000, 0, 20000);
631 //! first canvas for drawing
632 fHistsList=AliEMCALJetMicroDst::MoveHistsToList("Hists from AliEMCALJetFinder", kTRUE);
635 void AliEMCALJetFinder::DumpLego()
638 // Dump lego histo into array
641 TAxis* Xaxis = fLego->GetXaxis();
642 TAxis* Yaxis = fLego->GetYaxis();
643 // fhCellEt->Clear();
645 for (Int_t i = 1; i <= fNbinEta; i++) {
646 for (Int_t j = 1; j <= fNbinPhi; j++) {
647 e = fLego->GetBinContent(i,j);
649 Float_t eta = Xaxis->GetBinCenter(i);
650 Float_t phi = Yaxis->GetBinCenter(j);
652 fEtaCell[fNcell] = eta;
653 fPhiCell[fNcell] = phi;
658 eH = fhLegoEMCAL->GetBinContent(i,j);
659 if(eH > 0.0) fhCellEMCALEt->Fill(eH);
666 void AliEMCALJetFinder::ResetMap()
669 // Reset eta-phi array
671 for (Int_t i=0; i<30000; i++)
680 void AliEMCALJetFinder::FillFromTracks(Int_t flag, Int_t ich)
683 // Fill Cells with track information
686 printf("\n AliEMCALJetFinder::FillFromTracks(%i,%i) ",flag,ich);
691 if (!fLego) BookLego();
693 if (flag == 0) fLego->Reset();
695 // Access particle information
696 Int_t npart = (gAlice->GetHeader())->GetNprimary();
697 Int_t ntr = (gAlice->GetHeader())->GetNtrack();
698 printf(" : #primary particles %i # tracks %i \n", npart, ntr);
703 // 1: selected for jet finding
706 if (fTrackList) delete[] fTrackList;
707 if (fPtT) delete[] fPtT;
708 if (fEtaT) delete[] fEtaT;
709 if (fPhiT) delete[] fPhiT;
710 if (fPdgT) delete[] fPdgT;
712 fTrackList = new Int_t [npart];
713 fPtT = new Float_t[npart];
714 fEtaT = new Float_t[npart];
715 fPhiT = new Float_t[npart];
716 fPdgT = new Int_t[npart];
720 Float_t chTmp=0.0; // charge of current particle
723 // this is for Pythia ??
724 for (Int_t part = 0; part < npart; part++) {
725 TParticle *MPart = gAlice->Particle(part);
726 Int_t mpart = MPart->GetPdgCode();
727 Int_t child1 = MPart->GetFirstDaughter();
728 Float_t pT = MPart->Pt();
729 Float_t p = MPart->P();
730 Float_t phi = MPart->Phi();
732 if(pT > 0.001) eta = MPart->Eta();
733 Float_t theta = MPart->Theta();
735 printf("ind %7i part %7i -> child1 %5i child2 %5i Status %5i\n",
736 part, mpart, child1, MPart->GetLastDaughter(), MPart->GetStatusCode());
740 if (part == 6 || part == 7)
742 printf("\n Simulated Jet (pt, eta, phi): %d %f %f %f\n",
743 part-5, pT, eta, phi);
748 // printf("\n Simulated Jet (pt, eta, phi): %d %d %f %f %f",
749 // part, mpart, pT, eta, phi);
752 fTrackList[part] = 0;
753 fPtT[part] = pT; // must be change after correction for resolution !!!
759 if (part < 2) continue;
761 // move to fLego->Fill because hadron correction must apply
762 // if particle hit to EMCAL - 11-feb-2002
763 // if (pT == 0 || pT < fPtCut) continue;
764 TParticlePDG* pdgP = 0;
765 // charged or neutral
766 pdgP = MPart->GetPDG();
767 chTmp = pdgP->Charge() / 3.; // 13-feb-2001!!
774 if (mpart != kNeutron &&
775 mpart != kNeutronBar &&
776 mpart != kK0Long) continue;
782 if (TMath::Abs(mpart) <= 6 ||
784 mpart == 92) continue;
786 if (TMath::Abs(eta)<=0.9) fNChTpc++;
788 if (child1 >= 0 && child1 < npart) continue;
790 if (eta > fEtaMax || eta < fEtaMin) continue;
791 if (phi > fPhiMax || phi < fPhiMin ) continue;
794 printf("\n=>nsel:%5d mpart %5d child1 %5d eta %6.2f phi %6.2f pT %6.2f ch %3.0f ",
795 part, mpart, child1, eta, phi, pT, chTmp);
798 // Momentum smearing goes here ...
802 if (fSmear && TMath::Abs(chTmp)) {
803 pw = AliEMCALFast::SmearMomentum(1,p);
804 // p changed - take into account when calculate pT,
807 if(fDebug >= 4) printf("\n Smearing : p %8.4f change to %8.4f ", p, pw);
811 // Tracking Efficiency and TPC acceptance goes here ...
813 if (fEffic && TMath::Abs(chTmp)) {
814 // eff = AliEMCALFast::Efficiency(1,p);
815 eff = 0.95; // for testing 25-feb-2002
816 if(fhEff) fhEff->Fill(p, eff);
817 if (AliEMCALFast::RandomReject(eff)) {
818 if(fDebug >= 5) printf(" reject due to unefficiency ");
823 // Correction of Hadronic Energy goes here ...
826 // phi propagation for hadronic correction
828 Bool_t curls = kFALSE; // hit two the EMCAL (no curl)
829 Float_t phiHC=0.0, dpH=0.0, dphi=0.0, eTdpH=0;
830 if(TMath::Abs(chTmp)) {
831 // hadr. correction only for charge particle
832 dphi = PropagatePhi(pT, chTmp, curls);
835 printf("\n Delta phi %f pT %f ", dphi, pT);
836 if (curls) printf("\n !! Track is curling");
838 if(!curls) fhTrackPtBcut->Fill(pT);
840 if (fHCorrection && !curls) {
841 if (!fHadronCorrector)
842 Fatal("AliEMCALJetFinder",
843 "Hadronic energy correction required but not defined !");
845 dpH = fHadronCorrector->GetEnergy(p, eta, 7);
846 eTdpH = dpH*TMath::Sin(theta);
848 if (fDebug >= 7) printf(" phi %f phiHC %f eTcorr %f\n",
849 phi, phiHC, -eTdpH); // correction is negative
850 fLego->Fill(eta, phiHC, -eTdpH);
851 fhLegoHadrCorr->Fill(eta, phiHC, eTdpH);
855 // More to do ? Just think about it !
857 if (phi > fPhiMax || phi < fPhiMin ) continue;
859 if(TMath::Abs(chTmp) ) { // charge particle
860 if (pT > fPtCut && !curls) {
861 if (fDebug >= 8) printf("Charge : fLego->Fill(%5.2f, %5.2f, %6.2f, %d)\n",
862 eta , phi, pT, fNtS);
863 fLego->Fill(eta, phi, pT);
864 fhLegoTracks->Fill(eta, phi, pT); // 20-feb for checking
865 fTrackList[part] = 1;
868 } else if(ich==0 && fK0N) {
869 // case of n, nbar and K0L
870 if (fDebug >= 9) printf("Neutral : fLego->Fill(%5.2f, %5.2f, %6.2f, %d)\n",
871 eta , phi, pT, fNtS);
872 fLego->Fill(eta, phi, pT);
873 fTrackList[part] = 1;
881 void AliEMCALJetFinder::FillFromHits(Int_t flag)
884 // Fill Cells with hit information
888 printf("\n AliEMCALJetFinder::FillFromHits(%i)\n",flag);
892 if (!fLego) BookLego();
893 // Reset eta-phi maps if needed
894 if (flag == 0) { // default behavior
896 fhLegoTracks->Reset();
897 fhLegoEMCAL->Reset();
898 fhLegoHadrCorr->Reset();
900 // Initialize from background event if available
902 // Access hit information
903 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
904 TTree *treeH = gAlice->TreeH();
905 Int_t ntracks = (Int_t) treeH->GetEntries();
912 for (Int_t track=0; track<ntracks;track++) {
914 nbytes += treeH->GetEvent(track);
918 for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
920 mHit=(AliEMCALHit*) pEMCAL->NextHit())
922 Float_t x = mHit->X(); // x-pos of hit
923 Float_t y = mHit->Y(); // y-pos
924 Float_t z = mHit->Z(); // z-pos
925 Float_t eloss = mHit->GetEnergy(); // deposited energy
927 Float_t r = TMath::Sqrt(x*x+y*y);
928 Float_t theta = TMath::ATan2(r,z);
929 Float_t eta = -TMath::Log(TMath::Tan(theta/2.));
930 Float_t phi = TMath::ATan2(y,x);
932 if (fDebug >= 11) printf("\n Hit %f %f %f %f", x, y, z, eloss);
933 // printf("\n Hit %f %f %f %f", x, y, z, eloss);
935 etH = fSamplingF*eloss*TMath::Sin(theta);
936 fLego->Fill(eta, phi, etH);
937 // fhLegoEMCAL->Fill(eta, phi, etH);
940 // copy content of fLego to fhLegoEMCAL (fLego and fhLegoEMCAL are identical)
941 for(Int_t i=0; i<fLego->GetSize(); i++) (*fhLegoEMCAL)[i] = (*fLego)[i];
945 void AliEMCALJetFinder::FillFromDigits(Int_t flag)
948 // Fill Cells with digit information
953 if (!fLego) BookLego();
954 if (flag == 0) fLego->Reset();
961 TClonesArray* digs = new TClonesArray("AliEMCALDigit", 10000);
962 TTree *treeD = gAlice->TreeD();
963 TBranchElement* branchDg = (TBranchElement*)
964 treeD->GetBranch("EMCAL");
966 if (!branchDg) Fatal("AliEMCALJetFinder",
967 "Reading digits requested but no digits in file !");
969 branchDg->SetAddress(&digs);
970 Int_t nent = (Int_t) branchDg->GetEntries();
974 AliEMCALDigitizer* digr = new AliEMCALDigitizer();
975 TBranchElement* branchDr = (TBranchElement*)
976 treeD->GetBranch("AliEMCALDigitizer");
977 branchDr->SetAddress(&digr);
980 nbytes += branchDg->GetEntry(0);
981 nbytes += branchDr->GetEntry(0);
983 // Get digitizer parameters
984 Float_t preADCped = digr->GetPREpedestal();
985 Float_t preADCcha = digr->GetPREchannel();
986 Float_t ecADCped = digr->GetECpedestal();
987 Float_t ecADCcha = digr->GetECchannel();
988 Float_t hcADCped = digr->GetHCpedestal();
989 Float_t hcADCcha = digr->GetHCchannel();
991 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
992 AliEMCALGeometry* geom =
993 AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), "");
996 Int_t ndig = digs->GetEntries();
997 Info("FillFromDigits","Number of Digits: %d %d\n Parameters: PRE : %f %f EC: %f %f HC: %f %f\n Geometry: %d %d",
998 ndig, nent, preADCped, preADCcha, ecADCped, ecADCcha, hcADCped, hcADCcha, geom->GetNEta(), geom->GetNPhi());
1005 while ((sdg = (AliEMCALDigit*)(next())))
1007 Double_t pedestal = 0.;
1008 Double_t channel = 0.;
1009 if (geom->IsInPRE(sdg->GetId())) {
1010 pedestal = preADCped;
1011 channel = preADCcha;
1013 else if (geom->IsInECAL(sdg->GetId())) {
1014 pedestal = ecADCped;
1017 else if (geom->IsInHCAL(sdg->GetId())) {
1018 pedestal = hcADCped;
1022 Fatal("FillFromDigits", "unexpected digit is number!") ;
1024 Float_t eta = sdg->GetEta();
1025 Float_t phi = sdg->GetPhi() * TMath::Pi()/180.;
1026 Float_t amp = (Float_t) (channel*(sdg->GetAmp())-pedestal);
1029 Info("FillFromDigits", "Digit: eta %8.3f phi %8.3f amp %8.3f %8d",
1030 eta, phi, amp, sdg->GetAmp());
1032 fLego->Fill(eta, phi, fSamplingF*amp);
1040 void AliEMCALJetFinder::FillFromHitFlaggedTracks(Int_t flag)
1043 // Fill Cells with hit information
1048 if (!fLego) BookLego();
1050 if (flag == 0) fLego->Reset();
1052 // Flag charged tracks passing through TPC which
1053 // are associated to EMCAL Hits
1054 BuildTrackFlagTable();
1057 // Access particle information
1058 TTree *treeK = gAlice->TreeK();
1059 Int_t ntracks = (Int_t) treeK->GetEntries();
1061 if (fPtT) delete[] fPtT;
1062 if (fEtaT) delete[] fEtaT;
1063 if (fPhiT) delete[] fPhiT;
1064 if (fPdgT) delete[] fPdgT;
1066 fPtT = new Float_t[ntracks];
1067 fEtaT = new Float_t[ntracks];
1068 fPhiT = new Float_t[ntracks];
1069 fPdgT = new Int_t[ntracks];
1074 for (Int_t track = 0; track < ntracks; track++) {
1075 TParticle *MPart = gAlice->Particle(track);
1076 Float_t pT = MPart->Pt();
1077 Float_t phi = MPart->Phi();
1078 Float_t eta = MPart->Eta();
1080 if(fTrackList[track]) {
1084 fPdgT[track] = MPart->GetPdgCode();
1086 if (track < 2) continue; //Colliding particles?
1087 if (pT == 0 || pT < fPtCut) continue;
1089 fLego->Fill(eta, phi, pT);
1095 void AliEMCALJetFinder::FillFromParticles()
1097 // 26-feb-2002 PAI - for checking all chain
1098 // Work on particles level; accept all particle (not neutrino )
1100 Double_t PX=0, PY=0, PZ=0, E=0; // checking conservation law
1104 if (!fLego) BookLego();
1107 // Access particles information
1108 Int_t npart = (gAlice->GetHeader())->GetNprimary();
1109 if (fDebug >= 2 || npart<=0) {
1110 printf(" AliEMCALJetFinder::FillFromParticles : npart %i\n", npart);
1111 if(npart<=0) return;
1115 RearrangeParticlesMemory(npart);
1117 // Go through the particles
1118 Int_t mpart, child1, child2, geantPdg;
1119 Float_t pT, phi, eta, e=0, px=0, py=0, pz=0;
1121 for (Int_t part = 0; part < npart; part++) {
1123 fTrackList[part] = 0;
1125 MPart = gAlice->Particle(part);
1126 mpart = MPart->GetPdgCode();
1127 child1 = MPart->GetFirstDaughter();
1128 child2 = MPart->GetLastDaughter();
1136 e = MPart->Energy();
1138 // see pyedit in Pythia's text
1140 if (IsThisPartonsOrDiQuark(mpart)) continue;
1141 printf("%5i: %5i(%2i) px %5.1f py %5.1f pz %6.1f e %6.1f childs %5i,%5i \n",
1142 part, mpart, geantPdg, px, py, pz, e, child1, child2);
1144 // exclude partons (21 - gluon, 92 - string)
1147 // exclude neutrinous also ??
1148 if (fDebug >= 11 && pT>0.01)
1149 printf("\n part:%5d mpart %5d eta %9.2f phi %9.2f pT %9.2f ",
1150 part, mpart, eta, phi, pT);
1155 fPdgT[part] = mpart;
1159 if (child1 >= 0 && child1 < npart) continue;
1161 // printf("%4i -> %5i(%3i) px %6.1f py %6.1f pz %7.1f e %8.2f child1 %5i %s\n",
1162 // part, mpart, geantPdg, px, py, pz, e, child1, name.Data());
1169 if (TMath::Abs(eta) <= 0.9) fNChTpc++;
1171 if (eta > fEtaMax || eta < fEtaMin) continue;
1172 if (phi > fPhiMax || phi < fPhiMin ) continue;
1174 if(fK0N==0 ) { // exclude neutral hadrons
1175 if (mpart == kNeutron || mpart == kNeutronBar || mpart == kK0Long) continue;
1177 fTrackList[part] = 1;
1178 fLego->Fill(eta, phi, pT);
1181 printf("\n PX %8.2f PY %8.2f PZ %8.2f E %8.2f \n",
1184 if(fhChPartMultInTpc) fhChPartMultInTpc->Fill(fNChTpc);
1187 void AliEMCALJetFinder::FillFromPartons()
1189 // function under construction - 13-feb-2002 PAI
1192 printf("\n AliEMCALJetFinder::FillFromPartons()\n");
1196 if (!fLego) BookLego();
1199 // Access particle information
1200 Int_t npart = (gAlice->GetHeader())->GetNprimary();
1201 if (fDebug >= 2 || npart<=0)
1202 printf("\n AliEMCALJetFinder::FillFromPartons : npart %i\n", npart);
1203 fNt = 0; // for FindTracksInJetCone
1206 // Go through the partons
1208 for (Int_t part = 8; part < npart; part++) {
1209 TParticle *MPart = gAlice->Particle(part);
1210 Int_t mpart = MPart->GetPdgCode();
1211 // Int_t child1 = MPart->GetFirstDaughter();
1212 Float_t pT = MPart->Pt();
1213 // Float_t p = MPart->P();
1214 Float_t phi = MPart->Phi();
1215 Float_t eta = MPart->Eta();
1216 // Float_t theta = MPart->Theta();
1217 statusCode = MPart->GetStatusCode();
1219 // accept partons (21 - gluon, 92 - string)
1220 if (!(TMath::Abs(mpart) <= 6 || mpart == 21 ||mpart == 92)) continue;
1221 if (fDebug > 1 && pT>0.01)
1222 printf("\n part:%5d mpart %5d status %5d eta %8.2f phi %8.2f pT %8.2f ",
1223 part, mpart, statusCode, eta, phi, pT);
1224 // if (fDebug >= 3) MPart->Print();
1225 // accept partons before fragmentation - p.57 in Pythia manual
1226 // if(statusCode != 1) continue;
1228 if (eta > fEtaMax || eta < fEtaMin) continue;
1229 if (phi > fPhiMax || phi < fPhiMin ) continue;
1231 // if (child1 >= 0 && child1 < npart) continue;
1234 fLego->Fill(eta, phi, pT);
1240 void AliEMCALJetFinder::BuildTrackFlagTable() {
1242 // Method to generate a lookup table for TreeK particles
1243 // which are linked to hits in the EMCAL
1245 // --Author: J.L. Klay
1247 // Access hit information
1248 AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL");
1250 TTree *TK = gAlice->TreeK(); // Get the number of entries in the kine tree
1251 Int_t nKTrks = (Int_t) TK->GetEntries(); // (Number of particles created somewhere)
1253 if(fTrackList) delete[] fTrackList; //Make sure we get rid of the old one
1254 fTrackList = new Int_t[nKTrks]; //before generating a new one
1256 for (Int_t i = 0; i < nKTrks; i++) { //Initialize members to 0
1260 TTree *treeH = gAlice->TreeH();
1261 Int_t ntracks = (Int_t) treeH->GetEntries();
1267 for (Int_t track=0; track<ntracks;track++) {
1268 gAlice->ResetHits();
1269 nbytes += treeH->GetEvent(track);
1275 for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1);
1277 mHit=(AliEMCALHit*) pEMCAL->NextHit())
1279 Int_t iTrk = mHit->Track(); // track number
1280 Int_t idprim = mHit->GetPrimary(); // primary particle
1282 //Determine the origin point of this particle - it made a hit in the EMCAL
1283 TParticle *trkPart = gAlice->Particle(iTrk);
1284 TParticlePDG *trkPdg = trkPart->GetPDG();
1285 Int_t trkCode = trkPart->GetPdgCode();
1287 if (trkCode < 10000) { //Big Ions cause problems for
1288 trkChg = trkPdg->Charge(); //this function. Since they aren't
1289 } else { //likely to make it very far, set
1290 trkChg = 0.0; //their charge to 0 for the Flag test
1292 Float_t vxTrk = trkPart->Vx();
1293 Float_t vyTrk = trkPart->Vy();
1294 Float_t vrTrk = TMath::Sqrt(vxTrk*vxTrk+vyTrk*vyTrk);
1295 fTrackList[iTrk] = SetTrackFlag(vrTrk,trkCode,trkChg);
1297 //Loop through the ancestry of the EMCAL entrance particles
1298 Int_t ancestor = trkPart->GetFirstMother(); //Get track's Mother
1299 while (ancestor != -1) {
1300 TParticle *ancPart = gAlice->Particle(ancestor); //get particle info on ancestor
1301 TParticlePDG *ancPdg = ancPart->GetPDG();
1302 Int_t ancCode = ancPart->GetPdgCode();
1304 if (ancCode < 10000) {
1305 ancChg = ancPdg->Charge();
1309 Float_t vxAnc = ancPart->Vx();
1310 Float_t vyAnc = ancPart->Vy();
1311 Float_t vrAnc = TMath::Sqrt(vxAnc*vxAnc+vyAnc*vyAnc);
1312 fTrackList[ancestor] = SetTrackFlag(vrAnc,ancCode,ancChg);
1313 ancestor = ancPart->GetFirstMother(); //Get the next ancestor
1316 //Determine the origin point of the primary particle associated with the hit
1317 TParticle *primPart = gAlice->Particle(idprim);
1318 TParticlePDG *primPdg = primPart->GetPDG();
1319 Int_t primCode = primPart->GetPdgCode();
1321 if (primCode < 10000) {
1322 primChg = primPdg->Charge();
1326 Float_t vxPrim = primPart->Vx();
1327 Float_t vyPrim = primPart->Vy();
1328 Float_t vrPrim = TMath::Sqrt(vxPrim*vxPrim+vyPrim*vyPrim);
1329 fTrackList[idprim] = SetTrackFlag(vrPrim,primCode,primChg);
1335 Int_t AliEMCALJetFinder
1336 ::SetTrackFlag(Float_t radius, Int_t code, Double_t charge) {
1342 if (charge == 0) neutral = 1;
1344 if (TMath::Abs(code) <= 6 ||
1346 code == 92) parton = 1;
1348 //It's not a parton, it's charged and it went through the TPC
1349 if (!parton && !neutral && radius <= 84.0) flag = 1;
1356 void AliEMCALJetFinder::SaveBackgroundEvent()
1358 // Saves the eta-phi lego and the tracklist
1362 (*fLegoB) = (*fLegoB) + (*fLego);
1364 printf("\n AliEMCALJetFinder::SaveBackgroundEvent() (fLegoB) %f = %f(fLego) \n",
1365 fLegoB->Integral(), fLego->Integral());
1368 if (fPtB) delete[] fPtB;
1369 if (fEtaB) delete[] fEtaB;
1370 if (fPhiB) delete[] fPhiB;
1371 if (fPdgB) delete[] fPdgB;
1372 if (fTrackListB) delete[] fTrackListB;
1374 fPtB = new Float_t[fNtS];
1375 fEtaB = new Float_t[fNtS];
1376 fPhiB = new Float_t[fNtS];
1377 fPdgB = new Int_t [fNtS];
1378 fTrackListB = new Int_t [fNtS];
1382 for (Int_t i = 0; i < fNt; i++) {
1383 if (!fTrackList[i]) continue;
1384 fPtB [fNtB] = fPtT [i];
1385 fEtaB[fNtB] = fEtaT[i];
1386 fPhiB[fNtB] = fPhiT[i];
1387 fPdgB[fNtB] = fPdgT[i];
1388 fTrackListB[fNtB] = 1;
1392 printf(" fNtB %i => fNtS %i #particles %i \n", fNtB, fNtS, fNt);
1395 void AliEMCALJetFinder::InitFromBackground()
1399 if (fDebug) printf("\n AliEMCALJetFinder::InitFromBackground() ");
1403 (*fLego) = (*fLego) + (*fLegoB);
1405 printf("\n AliEMCALJetFinder::SaveBackgroundEvent() (fLego) %f = %f(fLegoB) \n",
1406 fLego->Integral(), fLegoB->Integral());
1408 printf(" => fLego undefined \n");
1413 void AliEMCALJetFinder::FindTracksInJetCone()
1416 // Build list of tracks inside jet cone
1419 Int_t njet = Njets();
1420 for (Int_t nj = 0; nj < njet; nj++)
1422 Float_t etaj = JetEtaW(nj);
1423 Float_t phij = JetPhiW(nj);
1424 Int_t nT = 0; // number of associated tracks
1426 // Loop over particles in current event
1427 for (Int_t part = 0; part < fNt; part++) {
1428 if (!fTrackList[part]) continue;
1429 Float_t phi = fPhiT[part];
1430 Float_t eta = fEtaT[part];
1431 Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) +
1432 (phij-phi)*(phij-phi));
1433 if (dr < fConeRadius) {
1434 fTrackList[part] = nj+2;
1439 // Same for background event if available
1442 for (Int_t part = 0; part < fNtB; part++) {
1443 Float_t phi = fPhiB[part];
1444 Float_t eta = fEtaB[part];
1445 Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) +
1446 (phij-phi)*(phij-phi));
1447 fTrackListB[part] = 1;
1449 if (dr < fConeRadius) {
1450 fTrackListB[part] = nj+2;
1454 } // Background available ?
1456 Int_t nT0 = nT + nTB;
1457 printf("Total number of tracks %d\n", nT0);
1459 if (nT0 > 1000) nT0 = 1000;
1461 Float_t* ptT = new Float_t[nT0];
1462 Float_t* etaT = new Float_t[nT0];
1463 Float_t* phiT = new Float_t[nT0];
1464 Int_t* pdgT = new Int_t[nT0];
1469 for (Int_t part = 0; part < fNt; part++) {
1470 if (fTrackList[part] == nj+2) {
1472 for (j=iT-1; j>=0; j--) {
1473 if (fPtT[part] > ptT[j]) {
1478 for (j=iT-1; j>=index; j--) {
1479 ptT [j+1] = ptT [j];
1480 etaT[j+1] = etaT[j];
1481 phiT[j+1] = phiT[j];
1482 pdgT[j+1] = pdgT[j];
1484 ptT [index] = fPtT [part];
1485 etaT[index] = fEtaT[part];
1486 phiT[index] = fPhiT[part];
1487 pdgT[index] = fPdgT[part];
1489 } // particle associated
1490 if (iT > nT0) break;
1494 for (Int_t part = 0; part < fNtB; part++) {
1495 if (fTrackListB[part] == nj+2) {
1497 for (j=iT-1; j>=0; j--) {
1498 if (fPtB[part] > ptT[j]) {
1504 for (j=iT-1; j>=index; j--) {
1505 ptT [j+1] = ptT [j];
1506 etaT[j+1] = etaT[j];
1507 phiT[j+1] = phiT[j];
1508 pdgT[j+1] = pdgT[j];
1510 ptT [index] = fPtB [part];
1511 etaT[index] = fEtaB[part];
1512 phiT[index] = fPhiB[part];
1513 pdgT[index] = fPdgB[part];
1515 } // particle associated
1516 if (iT > nT0) break;
1518 } // Background available ?
1520 fJetT[nj]->SetTrackList(nT0, ptT, etaT, phiT, pdgT);
1529 Float_t AliEMCALJetFinder::PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls)
1531 // Propagates phi angle to EMCAL radius
1533 static Float_t b = 0.0, rEMCAL = -1.0;
1536 b = gAlice->Field()->SolenoidField();
1537 // Get EMCAL radius in cm
1538 rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance();
1539 printf("\nMagnetic field %f rEMCAL %f ", b, rEMCAL);
1548 Float_t rB = 3335.6 * pt / b; // [cm] (case of |charge|=1)
1550 // check if particle is curling below EMCAL
1551 if (2.*rB < rEMCAL) {
1556 // if not calculate delta phi
1557 Float_t phi = TMath::ACos(1.-rEMCAL*rEMCAL/(2.*rB*rB));
1558 dPhi = TMath::ATan2(1.-TMath::Cos(phi), TMath::Sin(phi));
1559 dPhi = -TMath::Sign(dPhi, charge);
1564 void hf1(Int_t& id, Float_t& x, Float_t& wgt)
1566 // dummy for hbook calls
1570 void AliEMCALJetFinder::DrawLego(Char_t *opt)
1573 void AliEMCALJetFinder::DrawLegoEMCAL(Char_t *opt)
1574 {fhLegoEMCAL->Draw(opt);}
1576 void AliEMCALJetFinder::DrawHistsForTuning(Int_t mode)
1578 static TPaveText *varLabel=0;
1580 fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800);
1590 fhCellEMCALEt->Draw();
1595 fhTrackPtBcut->SetLineColor(2);
1596 fhTrackPtBcut->Draw("same");
1601 varLabel = new TPaveText(0.05,0.5,0.95,0.95,"NDC");
1602 varLabel->SetTextAlign(12);
1603 varLabel->SetFillColor(19); // see TAttFill
1604 TString tmp(GetTitle());
1605 varLabel->ReadFile(GetFileNameForParameters());
1609 if(mode) { // for saving picture to the file
1610 TString stmp(GetFileNameForParameters());
1611 stmp.ReplaceAll("_Par.txt",".ps");
1612 fC1->Print(stmp.Data());
1616 void AliEMCALJetFinder::PrintParameters(Int_t mode)
1619 if(mode==0) file = stdout; // output to terminal
1621 file = fopen(GetFileNameForParameters(),"w");
1622 if(file==0) file = stdout;
1624 fprintf(file,"==== Filling lego ==== \n");
1625 fprintf(file,"Smearing %6i ", fSmear);
1626 fprintf(file,"Efficiency %6i\n", fEffic);
1627 fprintf(file,"Hadr.Correct. %6i ", fHCorrection);
1628 fprintf(file,"P_{T} Cut of ch.par. %6.2f\n", fPtCut);
1629 fprintf(file,"==== Jet finding ==== \n");
1630 fprintf(file,"Cone radius %6.2f ", fConeRadius);
1631 fprintf(file,"Seed E_{T} %6.1f\n", fEtSeed);
1632 fprintf(file,"Min E_{T} of cell %6.1f ", fMinCellEt);
1633 fprintf(file,"Min E_{T} of jet %6.1f\n", fMinJetEt);
1635 fprintf(file,"==== Bg subtraction ==== \n");
1636 fprintf(file,"BG subtraction %6i ", fMode);
1637 fprintf(file,"Min cone move %6.2f\n", fMinMove);
1638 fprintf(file,"Max cone move %6.2f ", fMaxMove);
1639 fprintf(file,"%% change for BG %6.4f\n", fPrecBg);
1641 fprintf(file,"==== No Bg subtraction ==== \n");
1642 if(file != stdout) fclose(file);
1645 void AliEMCALJetFinder::DrawLegos()
1648 fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800);
1652 gStyle->SetOptStat(111111);
1654 Int_t nent1, nent2, nent3, nent4;
1655 Double_t int1, int2, int3, int4;
1656 nent1 = (Int_t)fLego->GetEntries();
1657 int1 = fLego->Integral();
1659 if(int1) fLego->Draw("lego");
1661 nent2 = (Int_t)fhLegoTracks->GetEntries();
1662 int2 = fhLegoTracks->Integral();
1664 if(int2) fhLegoTracks->Draw("lego");
1666 nent3 = (Int_t)fhLegoEMCAL->GetEntries();
1667 int3 = fhLegoEMCAL->Integral();
1669 if(int3) fhLegoEMCAL->Draw("lego");
1671 nent4 = (Int_t)fhLegoHadrCorr->GetEntries();
1672 int4 = fhLegoHadrCorr->Integral();
1674 if(int4) fhLegoHadrCorr->Draw("lego");
1676 // just for checking
1677 printf(" Integrals \n");
1678 printf("lego %10.3f \ntrack %10.3f \nhits %10.3f \nHCorr %10.3f\n-- %10.3f(must be 0)\n",
1679 int1, int2, int3, int4, int1 - (int2 + int3 - int4));
1682 const Char_t* AliEMCALJetFinder::GetFileNameForParameters(Char_t* dir)
1685 if(strlen(dir)) tmp = dir;
1691 void AliEMCALJetFinder::RearrangeParticlesMemory(Int_t npart)
1692 { // See FillFromTracks() - npart must be positive
1693 if (fTrackList) delete[] fTrackList;
1694 if (fPtT) delete[] fPtT;
1695 if (fEtaT) delete[] fEtaT;
1696 if (fPhiT) delete[] fPhiT;
1697 if (fPdgT) delete[] fPdgT;
1700 fTrackList = new Int_t [npart];
1701 fPtT = new Float_t[npart];
1702 fEtaT = new Float_t[npart];
1703 fPhiT = new Float_t[npart];
1704 fPdgT = new Int_t[npart];
1706 printf("AliEMCALJetFinder::RearrangeParticlesMemory : npart = %d\n", npart);
1710 Bool_t AliEMCALJetFinder::IsThisPartonsOrDiQuark(Int_t pdg)
1712 Int_t absPdg = TMath::Abs(pdg);
1713 if(absPdg<=6) return kTRUE; // quarks
1714 if(pdg == 21) return kTRUE; // gluon
1715 if(pdg == 92) return kTRUE; // string
1717 // see p.51 of Pythia Manual
1718 // Not include diquarks with c and b quark - 4-mar-2002
1719 // ud_0,sd_0,su_0; dd_1,ud_1,uu_1; sd_1,su_1,ss_1
1720 static Int_t diquark[9]={2101,3101,3201, 1103,2103,2203, 3103,3203,3303};
1721 for(Int_t i=0; i<9; i++) if(absPdg == diquark[i]) return kTRUE; // diquarks
1726 void AliEMCALJetFinder::FindChargedJet()
1729 // Find jet from charged particle information only
1744 for (part = 0; part < fNt; part++) {
1745 if (!fTrackList[part]) continue;
1746 if (fPtT[part] > fEtSeed) nseed++;
1748 printf("\nThere are %d seeds (%d)\n", nseed, fNtS);
1749 Int_t* iSeeds = new Int_t[nseed];
1752 for (part = 0; part < fNt; part++) {
1753 if (!fTrackList[part]) continue;
1754 if (fPtT[part] > fEtSeed) iSeeds[nseed++] = part;
1765 // Find seed with highest pt
1767 Float_t ptmax = -1.;
1770 for (seed = 0; seed < nseed; seed++) {
1771 if ((pt = fPtT[iSeeds[seed]]) > ptmax && iSeeds[seed] != -1) {
1776 if (ptmax < 0.) break;
1777 jndex = iSeeds[index];
1779 // Remove from the list
1781 printf("\n Next Seed %d %f", jndex, ptmax);
1783 // Find tracks in cone around seed
1785 Float_t phiSeed = fPhiT[jndex];
1786 Float_t etaSeed = fEtaT[jndex];
1792 for (part = 0; part < fNt; part++) {
1793 if (!fTrackList[part]) continue;
1794 Float_t deta = fEtaT[part] - etaSeed;
1795 Float_t dphi = fPhiT[part] - phiSeed;
1796 Float_t dR = TMath::Sqrt(deta * deta + dphi * dphi);
1797 if (dR < fConeRadius) {
1799 Float_t theta = 2. * TMath::ATan(TMath::Exp(-fEtaT[part]));
1800 Float_t px = fPtT[part] * TMath::Cos(fPhiT[part]);
1801 Float_t py = fPtT[part] * TMath::Sin(fPhiT[part]);
1802 Float_t pz = fPtT[part] / TMath::Tan(theta);
1807 // if seed, remove it
1809 for (seed = 0; seed < nseed; seed++) {
1810 if (part == iSeeds[seed]) iSeeds[seed] = -1;
1816 // Estimate of jet direction
1817 Float_t phiJ = TMath::ATan2(pyJ, pxJ);
1818 Float_t thetaJ = TMath::ATan2(TMath::Sqrt(pxJ * pxJ + pyJ * pyJ), pzJ);
1819 Float_t etaJ = TMath::Log(TMath::Tan(thetaJ / 2.));
1820 // Float_t ptJ = TMath::Sqrt(pxJ * pxJ + pyJ * pyJ);
1823 // Sum up all energy
1825 Int_t iPhi0 = Int_t((phiJ - fPhiMin) / fDphi);
1826 Int_t iEta0 = Int_t((etaJ - fEtaMin) / fDeta);
1827 Int_t dIphi = Int_t(fConeRadius / fDphi);
1828 Int_t dIeta = Int_t(fConeRadius / fDeta);
1831 for (iPhi = iPhi0 -dIphi; iPhi < iPhi0 + dIphi; iPhi++) {
1832 for (iEta = iEta0 - dIeta; iEta < iEta0 + dIeta; iEta++) {
1833 if (iPhi < 0 || iEta < 0) continue;
1834 Float_t dPhi = fPhiMin + iPhi * fDphi;
1835 Float_t dEta = fEtaMin + iEta * fDeta;
1836 if (TMath::Sqrt(dPhi * dPhi + dEta * dEta) < fConeRadius) continue;
1837 sumE += fLego->GetBinContent(iEta, iPhi);
1843 fJetT[njets++] = new AliEMCALJet(sumE, phiJ, etaJ);
1844 FindTracksInJetCone();
1845 printf("\n Jet Energy %f %f %f %f %d\n", eT, sumE, fPtT[6], fPtT[7], njets);
1846 printf("\n Jet Phi %f %f %f \n", phiJ, fPhiT[6], fPhiT[7]);
1847 printf("\n Jet Eta %f %f %f \n", etaJ, fEtaT[6], fEtaT[7]);
1849 EMCALJETS.njet = njets;
1850 if (fWrite) WriteJets();