From 45a58699f4de7d0f9a122352abf868b0913801fb Mon Sep 17 00:00:00 2001 From: jklay Date: Tue, 28 Feb 2006 21:56:34 +0000 Subject: [PATCH] moving jetfinder code to subdirectory --- EMCAL/jetfinder/AliEMCALFast.cxx | 113 + EMCAL/jetfinder/AliEMCALFast.h | 23 + EMCAL/jetfinder/AliEMCALFastRecParticle.cxx | 512 +++++ EMCAL/jetfinder/AliEMCALFastRecParticle.h | 102 + EMCAL/jetfinder/AliEMCALGeneratorFactory.cxx | 672 ++++++ EMCAL/jetfinder/AliEMCALGeneratorFactory.h | 79 + EMCAL/jetfinder/AliEMCALHadronCorrection.cxx | 30 + EMCAL/jetfinder/AliEMCALHadronCorrection.h | 27 + .../jetfinder/AliEMCALHadronCorrectionv0.cxx | 78 + EMCAL/jetfinder/AliEMCALHadronCorrectionv0.h | 32 + .../jetfinder/AliEMCALHadronCorrectionv1.cxx | 122 + EMCAL/jetfinder/AliEMCALHadronCorrectionv1.h | 44 + EMCAL/jetfinder/AliEMCALJet.cxx | 80 + EMCAL/jetfinder/AliEMCALJet.h | 57 + EMCAL/jetfinder/AliEMCALJetFinder.cxx | 1975 +++++++++++++++++ EMCAL/jetfinder/AliEMCALJetFinder.h | 217 ++ EMCAL/jetfinder/AliEMCALJetFinderAlgo.cxx | 100 + EMCAL/jetfinder/AliEMCALJetFinderAlgo.h | 46 + EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.cxx | 901 ++++++++ EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.h | 112 + .../AliEMCALJetFinderAlgoUA1Unit.cxx | 71 + .../jetfinder/AliEMCALJetFinderAlgoUA1Unit.h | 57 + EMCAL/jetfinder/AliEMCALJetFinderInput.cxx | 305 +++ EMCAL/jetfinder/AliEMCALJetFinderInput.h | 66 + .../jetfinder/AliEMCALJetFinderInputPrep.cxx | 93 + EMCAL/jetfinder/AliEMCALJetFinderInputPrep.h | 42 + .../AliEMCALJetFinderInputSimPrep.cxx | 688 ++++++ .../jetfinder/AliEMCALJetFinderInputSimPrep.h | 60 + EMCAL/jetfinder/AliEMCALJetFinderOutput.cxx | 196 ++ EMCAL/jetfinder/AliEMCALJetFinderOutput.h | 59 + EMCAL/jetfinder/AliEMCALJetFinderPlots.cxx | 684 ++++++ EMCAL/jetfinder/AliEMCALJetFinderPlots.h | 180 ++ EMCAL/jetfinder/AliEMCALJetFinderTypes.h | 74 + EMCAL/jetfinder/AliEMCALJetMicroDst.cxx | 824 +++++++ EMCAL/jetfinder/AliEMCALJetMicroDst.h | 155 ++ EMCAL/jetfinder/AliEMCALParton.cxx | 83 + EMCAL/jetfinder/AliEMCALParton.h | 42 + EMCAL/jetfinder/AnaJets.C | 102 + EMCAL/jetfinder/Ecommon.h | 47 + EMCAL/jetfinder/anaDst.C | 305 +++ EMCAL/jetfinder/anaDst.h | 18 + EMCAL/jetfinder/jetDst.C | 383 ++++ EMCAL/jetfinder/jetDst.h | 15 + EMCAL/jetfinder/jet_finder_ua1.F | 321 +++ EMCAL/jetfinder/sgpdge.F | 208 ++ EMCAL/jetfinder/testJetFinder.C | 105 + EMCAL/jetfinder/testJetFinderBg.C | 125 ++ 47 files changed, 10630 insertions(+) create mode 100644 EMCAL/jetfinder/AliEMCALFast.cxx create mode 100644 EMCAL/jetfinder/AliEMCALFast.h create mode 100644 EMCAL/jetfinder/AliEMCALFastRecParticle.cxx create mode 100644 EMCAL/jetfinder/AliEMCALFastRecParticle.h create mode 100644 EMCAL/jetfinder/AliEMCALGeneratorFactory.cxx create mode 100644 EMCAL/jetfinder/AliEMCALGeneratorFactory.h create mode 100644 EMCAL/jetfinder/AliEMCALHadronCorrection.cxx create mode 100644 EMCAL/jetfinder/AliEMCALHadronCorrection.h create mode 100644 EMCAL/jetfinder/AliEMCALHadronCorrectionv0.cxx create mode 100644 EMCAL/jetfinder/AliEMCALHadronCorrectionv0.h create mode 100644 EMCAL/jetfinder/AliEMCALHadronCorrectionv1.cxx create mode 100644 EMCAL/jetfinder/AliEMCALHadronCorrectionv1.h create mode 100644 EMCAL/jetfinder/AliEMCALJet.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJet.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinder.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinder.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderAlgo.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderAlgo.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderAlgoUA1Unit.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderAlgoUA1Unit.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderInput.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderInput.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderInputPrep.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderInputPrep.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderInputSimPrep.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderInputSimPrep.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderOutput.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderOutput.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderPlots.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderPlots.h create mode 100644 EMCAL/jetfinder/AliEMCALJetFinderTypes.h create mode 100644 EMCAL/jetfinder/AliEMCALJetMicroDst.cxx create mode 100644 EMCAL/jetfinder/AliEMCALJetMicroDst.h create mode 100644 EMCAL/jetfinder/AliEMCALParton.cxx create mode 100644 EMCAL/jetfinder/AliEMCALParton.h create mode 100644 EMCAL/jetfinder/AnaJets.C create mode 100644 EMCAL/jetfinder/Ecommon.h create mode 100644 EMCAL/jetfinder/anaDst.C create mode 100644 EMCAL/jetfinder/anaDst.h create mode 100644 EMCAL/jetfinder/jetDst.C create mode 100644 EMCAL/jetfinder/jetDst.h create mode 100644 EMCAL/jetfinder/jet_finder_ua1.F create mode 100644 EMCAL/jetfinder/sgpdge.F create mode 100644 EMCAL/jetfinder/testJetFinder.C create mode 100644 EMCAL/jetfinder/testJetFinderBg.C diff --git a/EMCAL/jetfinder/AliEMCALFast.cxx b/EMCAL/jetfinder/AliEMCALFast.cxx new file mode 100644 index 00000000000..2255ac84cc7 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALFast.cxx @@ -0,0 +1,113 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ +//____________________________________________________________________________ +//*-- +//*-- Author: Andreas Morsch (CERN) +//*-- +//*-- +//////////////////////////////////////////////////////////////////////////// + +#include "TMath.h" +#include + +#include "AliEMCALFast.h" + + +ClassImp(AliEMCALFast) + +//____________________________________________________________________________ + + +Float_t AliEMCALFast::SmearMomentum(Int_t ind, Float_t p) +{ +// +// The relative momentum error, i.e. +// (delta p)/p = sqrt (a**2 + (b*p)**2) * 10**-2, +// where typically a = 0.75 and b = 0.16 - 0.24 depending on multiplicity +// (the lower value is for dn/d(eta) about 2000, and the higher one for 8000) +// +// If we include information from TRD b will be by a factor 2/3 smaller. +// +// ind = 1: high multiplicity +// ind = 2: low multiplicity +// ind = 3: high multiplicity + TRD +// ind = 4: low multiplicity + TRD + + Float_t pSmeared; + Float_t a = 0.75; + Float_t b = 0.24; + + if (ind == 1) b = 0.24; + if (ind == 2) b = 0.16; + if (ind == 3) b = 0.16; + if (ind == 4) b = 0.11; + + Float_t sigma = p*TMath::Sqrt(a*a+b*b*p*p)*0.01; + pSmeared = p + gRandom->Gaus(0., sigma); + return pSmeared; +} + + +Float_t AliEMCALFast::Efficiency(Int_t ind, Float_t p) +{ +// Tracking efficiency: +// above pt 0.5 GeV practically constant, between 90 and 95 % (again, +// depending on multplicity) +// below 0.5 GeV goes down to about 70% at 0.2 GeV. +// On top of that there is 90% geometrical acceptance for tracking due +// to TPC (dead zones between readout chambers). +// Tracking +// + Float_t eff = 0.9; + if (ind == 2) eff = 0.95; + if (p < 0.5) eff -= (0.5-p)*0.2/0.3; +// Geometry + eff *= 0.9; +// Acceptance + return eff; +} + +Bool_t AliEMCALFast::EmcalAcceptance(Float_t eta, Float_t phi) +{ +// 27-oct-05 -> should be change +// EMCAL eta-phi acceptance + Bool_t acc = kFALSE; + if (TMath::Abs(eta) < 0.7 && + phi > 60.*TMath::Pi()/180. && + phi < TMath::Pi()) + acc = kTRUE; + return acc; +} + + +Bool_t AliEMCALFast::RandomReject(Float_t eff) +{ +// +// Random rejection + Bool_t rej = kFALSE; + Float_t ran = gRandom->Rndm(); + if (ran > eff) rej = kTRUE; + return rej; +} + + + + + + + diff --git a/EMCAL/jetfinder/AliEMCALFast.h b/EMCAL/jetfinder/AliEMCALFast.h new file mode 100644 index 00000000000..3ec0bd667a5 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALFast.h @@ -0,0 +1,23 @@ +#ifndef ALIEMCALFAST_H +#define ALIEMCALFAST_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ +#include +//*-- Author: Andreas Morsch (CERN) + +class AliEMCALFast : public TObject { + public: + virtual ~AliEMCALFast(){;} + static Float_t SmearMomentum (Int_t ind, Float_t p); + static Float_t Efficiency (Int_t ind, Float_t p); + static Bool_t EmcalAcceptance(Float_t eta, Float_t phi); + static Bool_t RandomReject (Float_t eff); + protected: + ClassDef(AliEMCALFast,1) // Jet for EMCAL +}; + + +#endif // ALIEMCALJet_H diff --git a/EMCAL/jetfinder/AliEMCALFastRecParticle.cxx b/EMCAL/jetfinder/AliEMCALFastRecParticle.cxx new file mode 100644 index 00000000000..f3409908db7 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALFastRecParticle.cxx @@ -0,0 +1,512 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//_________________________________________________________________________ +// A Particle modified by EMCAL response and produced by AliEMCALvFast +//*-- +// To become a general class of AliRoot ? +//*-- +//*-- Author: Yves Schutz (SUBATECH) +//*-- +///////////////////////////////////////////////////////////////////////////// + +// --- ROOT system --- + +// --- Standard library --- + +// --- AliRoot header files --- + +#include "AliEMCALFastRecParticle.h" +#include "TPad.h" +#include "TPaveText.h" + +ClassImp(AliEMCALFastRecParticle) + +//____________________________________________________________________________ +AliEMCALFastRecParticle::AliEMCALFastRecParticle() : TParticle() +{ + // ctor + fType = 0 ; +} + +//____________________________________________________________________________ +AliEMCALFastRecParticle::AliEMCALFastRecParticle(const AliEMCALFastRecParticle & rp) + : TParticle(rp) +{ + // copy ctor + + fType = rp.fType ; + fPdgCode = rp.fPdgCode; + fStatusCode = rp.fStatusCode; + fMother[0] = rp.fMother[0]; + fMother[1] = rp.fMother[1]; + fDaughter[0] = rp.fDaughter[0]; + fDaughter[1] = rp.fDaughter[1]; + fWeight = rp.fWeight; + fCalcMass = rp.fCalcMass; + fPx = rp.fPx; + fPy = rp.fPy; + fPz = rp.fPz; + fE = rp.fE; + fVx = rp.fVx; + fVy = rp.fVy; + fVz = rp.fVz; + fVt = rp.fVt; + fPolarTheta = rp.fPolarTheta; + fPolarPhi = rp.fPolarPhi; + fParticlePDG = rp.fParticlePDG; +} + +//____________________________________________________________________________ + AliEMCALFastRecParticle::AliEMCALFastRecParticle(const TParticle & pp) +{ + // ctor from a TParticle (crummy?!) + + TParticle & pnoconst = (TParticle &)(pp) ; + AliEMCALFastRecParticle & p = (AliEMCALFastRecParticle &)(pnoconst) ; + fType = 0 ; + fPdgCode = p.fPdgCode; + fStatusCode = p.fStatusCode; + fMother[0] = p.fMother[0]; + fMother[1] = p.fMother[1]; + fDaughter[0] = p.fDaughter[0]; + fDaughter[1] = p.fDaughter[1]; + fWeight = p.fWeight; + fCalcMass = p.fCalcMass; + fPx = p.fPx; + fPy = p.fPy; + fPz = p.fPz; + fE = p.fE; + fVx = p.fVx; + fVy = p.fVy; + fVz = p.fVz; + fVt = p.fVt; + fPolarTheta = p.fPolarTheta; + fPolarPhi = p.fPolarPhi; + fParticlePDG = p.fParticlePDG; + +} + +//____________________________________________________________________________ +Int_t AliEMCALFastRecParticle::DistancetoPrimitive(Int_t px, Int_t py) +{ + // Compute distance from point px,py to a AliEMCALFastRecParticle considered as a Tmarker + // Compute the closest distance of approach from point px,py to this marker. + // The distance is computed in pixels units. + + Double_t kRADDEG = 180. / TMath::Pi() ; + Coord_t x = Phi() * kRADDEG ; + Coord_t y = Theta() * kRADDEG ; + const Int_t kMaxDiff = 10; + Int_t pxm = gPad->XtoAbsPixel(x); + Int_t pym = gPad->YtoAbsPixel(y); + Int_t dist = (px-pxm)*(px-pxm) + (py-pym)*(py-pym); + + if (dist > kMaxDiff) return 9999; + return dist; +} + +//___________________________________________________________________________ + void AliEMCALFastRecParticle::Draw(Option_t *option) + { + // Draw this AliEMCALFastRecParticle with its current attributes + + AppendPad(option); + } + +//______________________________________________________________________________ +void AliEMCALFastRecParticle::ExecuteEvent(Int_t event, Int_t /*px*/, Int_t /*py*/) +{ + // Execute action corresponding to one event + // This member function is called when a AliEMCALFastRecParticle is clicked with the locator + + if (!gPad->IsEditable()) + return ; + + static TPaveText * clustertext = 0 ; + + switch (event) { + + case kButton1Down: { + Double_t kRADDEG = 180. / TMath::Pi() ; + Coord_t x = Phi() * kRADDEG ; + Coord_t y = Theta() * kRADDEG ; + clustertext = new TPaveText(x-1, y+1, x+5, y+3, "") ; + Text_t line1[40] ; + Text_t line2[40] ; + sprintf( line1, "PID: %s ", (const char*)Name() ) ; + sprintf( line2, "ENERGY: %f ", Energy() ) ; + clustertext ->AddText(line1) ; + clustertext ->AddText(line2) ; + clustertext ->Draw(""); + gPad->Update() ; + break ; + } + + case kButton1Up: { + delete clustertext ; + clustertext = 0 ; + gPad->Update() ; + break ; + } + } + +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsPhoton(TString purity) const +{ + //FIXME : just a blind copy from PHOS + // Rec.Particle is a photon if it has a photon-like shape, fast and neutral + // photon-like shape is defined with a purity "low", "medium" or "high" + + purity.ToLower(); + Bool_t photonLike = kFALSE; + if (purity == "low" ) photonLike = TestPIDBit(6); + else if (purity == "medium") photonLike = TestPIDBit(7); + else if (purity == "high" ) photonLike = TestPIDBit(8); + if (photonLike && // photon by PCA + (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF + (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))&& // neutral by CPV + !TestPIDBit(14)) // no charged track + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsPi0(TString purity) const +{ + //FIXME : just a blind copy from PHOS + // Rec.Particle is a pi0 if it has a pi0-like shape, fast and neutral + // pi0-like shape is defined with a purity "low", "medium" or "high" + + purity.ToLower(); + Bool_t pi0Like = kFALSE; + if (purity == "low" ) pi0Like = TestPIDBit(9); + else if (purity == "medium") pi0Like = TestPIDBit(10); + else if (purity == "high" ) pi0Like = TestPIDBit(11); + else Error("IsPi0","Wrong purity type: %s",purity.Data()); + if (pi0Like && // pi0 by PCA + (TestPIDBit(5)||TestPIDBit(4)||TestPIDBit(3))&& // fast by TOF + (TestPIDBit(2)||TestPIDBit(1)||TestPIDBit(0))&& // neutral by CPV + !TestPIDBit(14)) // no charged track + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsElectron(TString purity) const +{ + //FIXME : just a blind copy from PHOS + // Rec.Particle is an electron if it has a photon-like shape, fast and charged + // photon-like shape is defined with a purity "low", "medium" or "high" + + purity.ToLower(); + Bool_t photonLike = kFALSE; + if (purity == "low" ) photonLike = TestPIDBit(6); + else if (purity == "medium") photonLike = TestPIDBit(7); + else if (purity == "high" ) photonLike = TestPIDBit(8); + else Error("IsElectron","Wrong purity type: %s",purity.Data()); + + if (photonLike && // photon by PCA + (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& // fast by TOF + (!TestPIDBit(2)||!TestPIDBit(1)||!TestPIDBit(0))&& // charged by CPV + TestPIDBit(14)) // no charged track + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsEleCon(TString purity) const +{ + //FIXME : just a blind copy from PHOS + // Rec.Particle is an electron if it has a photon-like shape, fast and charged + // photon-like shape is defined with a purity "low", "medium" or "high" + + purity.ToLower(); + Bool_t photonLike = kFALSE; + if (purity == "low" ) photonLike = TestPIDBit(6); + else if (purity == "medium") photonLike = TestPIDBit(7); + else if (purity == "high" ) photonLike = TestPIDBit(8); + else Error("IsElectron","Wrong purity type: %s",purity.Data()); + + if (photonLike && // photon by PCA + (TestPIDBit(5)|| TestPIDBit(4)|| TestPIDBit(3))&& // fast by TOF + (!TestPIDBit(2)||!TestPIDBit(1)||!TestPIDBit(0))&& // charged by CPV + !TestPIDBit(14)) // no charged track + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsHardPhoton() const +{ + //FIXME : just a blind copy from PHOS + // Rec.Particle is a hard photon (E > 30 GeV) if its second moment M2x + // corresponds to photons + if (TestPIDBit(12) && !TestPIDBit(14)) + return kTRUE; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsHardPi0() const +{ + //FIXME : just a blind copy from EMCAL + // Rec.Particle is a hard pi0 (E > 30 GeV) if its second moment M2x + // corresponds to pi0 + if (TestPIDBit(13)&& !TestPIDBit(14)) + return kTRUE; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsHadron() const +{ + //FIXME : just a blind copy from EMCAL + // Rec.Particle is an hadron if it does not look like + // a low-purity photon nor low-purity pi0 + + if ( !TestPIDBit(6) && !TestPIDBit(9) ) // not photon nor pi0 + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsChargedHadron() const +{ + //FIXME : just a blind copy from EMCAL + // Rec.Particle is a charged hadron if it does not look like + // a low-purity photon nor low-purity pi0 and is low-purity charged + + if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 + !TestPIDBit(2)) // charged by CPV + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsNeutralHadron() const +{ + //FIXME : just a blind copy from EMCAL + // Rec.Particle is a neutral hadron if it does not look like + // a low-purity photon nor low-purity pi0 and is high-purity neutral + + if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 + TestPIDBit(2)) // neutral by CPV + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsFastChargedHadron() const +{ + //FIXME : just a blind copy from EMCAL + // Rec.Particle is a fast charged hadron if it does not look like + // a low-purity photon nor low-purity pi0, is low-purity charged + // and is high-purity fast + + if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 + !TestPIDBit(2) && // charged by CPV + TestPIDBit(5)) // fast by TOF + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsSlowChargedHadron() const +{ + //FIXME : just a blind copy from EMCAL + // Rec.Particle is a slow neutral hadron if it does not look like + // a low-purity photon nor low-purity pi0, is high-purity neutral + // and is not high-purity fast + + if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 + !TestPIDBit(2) && // charged by CPV + !TestPIDBit(5)) // slow by TOF + return kTRUE ; + else + return kFALSE; + +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsFastNeutralHadron() const +{ + //FIXME : just a blind copy from EMCAL + // Rec.Particle is a fast neutral hadron if it does not look like + // a low-purity photon nor low-purity pi0, is high-purity neutral + // and is high-purity fast + + if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 + TestPIDBit(2) && // neutral by CPV + TestPIDBit(5)) // fast by TOF + return kTRUE ; + else + return kFALSE; +} + +//____________________________________________________________________________ +Bool_t AliEMCALFastRecParticle::IsSlowNeutralHadron() const +{ + //FIXME : just a blind copy from EMCAL + // Rec.Particle is a slow neutral hadron if it does not look like + // a low-purity photon nor low-purity pi0, is high-purity neutral + // and is not high-purity fast + + if ( !TestPIDBit(6) && !TestPIDBit(9) && // not photon nor pi0 + TestPIDBit(2) && // neutral by CPV + !TestPIDBit(5)) // slow by TOF + return kTRUE ; + else + return kFALSE; +} + + +//____________________________________________________________________________ +TString AliEMCALFastRecParticle::Name()const +{ + // Returns the name of the particle type (only valid if PIDv1 is employed) + + TString name ; + + name = "Undefined particle" ; + + if (IsPhoton("low")) + name = "Photon low purity, "; + else if (IsPhoton("medium")) + name = "Photon medium purity, "; + else if (IsPhoton("high")) + name = "Photon high purity, "; + + if (IsPi0("low")) + name += "Pi0 low purity, "; + else if (IsPi0("medium")) + name += "Pi0 medium purity, "; + else if (IsPi0("high")) + name += "Pi0 high purity, "; + + if (IsElectron("low")) + name += "Electron low purity, "; + else if (IsElectron("medium")) + name += "Electron medium purity, "; + else if (IsElectron("high")) + name += "Electron high purity, "; + + if (IsHadron()) { + name = "hadron"; + if (IsChargedHadron()) { + name.Prepend("charged, "); + if (IsFastChargedHadron()) + name.Prepend("fast, "); + else if (IsSlowChargedHadron()) + name.Prepend("slow, "); + } + else if (IsNeutralHadron()) { + name.Prepend("neutral, "); + if (IsFastNeutralHadron()) + name.Prepend("fast, "); + else if (IsSlowNeutralHadron()) + name.Prepend("slow, "); + } + } + + return name ; +} + +//______________________________________________________________________________ +void AliEMCALFastRecParticle::SetType(Int_t type) { + // sets the particle type + // bit-mask of the particle type means the following: + // bits 0,1,2 - neutral particle with low, medium and high purity + // bits 3.4,5 - fast particle with low, medium and high purity + // bits 6.7,8 - photon shower with low, medium and high purity + // bits 9,10,11 - hard-pi0 shower with low, medium and high purity + + fType = type ; + + if((type == 127) || (fType == 511) || (fType == 255) ||(fType == 383)||(fType == 447)){ + fPdgCode = 22 ; + return ; + } + + if ((fType == 63)|| ((fType < 8)&&(fType > 0)) ){ + fPdgCode = 2112 ; + return ; + } + if ( ((fType == 504) || (fType == 505) ||(fType == 248)||(fType == 249)||(fType == 120)||(fType == 121)) ){ + fPdgCode = 11 ; + return ; + } + if ((fType == 448) || (fType == 449) ||(fType == 192)||(fType == 193)||(fType == 64)||(fType == 64)){ + fPdgCode = 13 ; + return ; + } + if((fType == 56)||(fType == 57)){ + fPdgCode = 211 ; + return ; + } + if (fType == 0){ + fPdgCode = 2212 ; + return ; + } + +} + +//______________________________________________________________________________ +void AliEMCALFastRecParticle::Paint(Option_t *) +{ + // Paint this ALiRecParticle in theta,phi coordinate as a TMarker with its current attributes + + Double_t kRADDEG = 180. / TMath::Pi() ; + Coord_t x = Phi() * kRADDEG ; + Coord_t y = Theta() * kRADDEG ; + Color_t markercolor = 1 ; + Size_t markersize = 1. ; + Style_t markerstyle = 5 ; + + if (!gPad->IsBatch()) { + gVirtualX->SetMarkerColor(markercolor) ; + gVirtualX->SetMarkerSize (markersize) ; + gVirtualX->SetMarkerStyle(markerstyle) ; + } + gPad->SetAttMarkerPS(markercolor,markerstyle,markersize) ; + gPad->PaintPolyMarker(1,&x,&y,"") ; +} + +//____________________________________________________________________________ +void AliEMCALFastRecParticle::Print(Option_t * /*opt*/)const +{ + // Print the type, energy and momentum of the reconstructed particle + + printf("Print Summary:") ; + printf("AliEMCALFastRecParticle > type is %s\n", Name().Data()) ; + printf(" Energy = %f\n", fE) ; + printf(" Px = %f\n", fPx) ; + printf(" Py = %f\n", fPy) ; + printf(" Pz = %f\n", fPz) ; +} diff --git a/EMCAL/jetfinder/AliEMCALFastRecParticle.h b/EMCAL/jetfinder/AliEMCALFastRecParticle.h new file mode 100644 index 00000000000..7faa0dd3071 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALFastRecParticle.h @@ -0,0 +1,102 @@ +#ifndef ALIEMCALFASTRECPARTICLE_H +#define ALIEMCALFASTRECPARTICLE_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// A Particle modified by EMCAL response and produced by AliEMCALvFast +// To become a general class of AliRoot ? +// +//*-- Author: Yves Schutz (SUBATECH) + +// --- ROOT system --- + +class TClonesArray; +#include "TParticle.h" + +// --- Standard library --- + +// --- AliRoot header files --- + +class AliEMCALFastRecParticle : public TParticle { + + public: + + AliEMCALFastRecParticle() ; + + AliEMCALFastRecParticle(const AliEMCALFastRecParticle & rp) ; // ctor + AliEMCALFastRecParticle(const TParticle & p) ; // ctor + virtual ~AliEMCALFastRecParticle(){ + // dtor + } + virtual Int_t DistancetoPrimitive(Int_t px, Int_t py) ; + virtual void Draw(Option_t *option) ; + virtual void ExecuteEvent(Int_t event, Int_t px, Int_t py) ; + Int_t GetIndexInList() const { + // returns the index of this in the list + return fIndexInList ; + } + virtual Int_t GetNPrimaries() const {return 0 ;} + virtual const TParticle * GetPrimary(Int_t /*index=0*/) const {return 0 ;} + Int_t GetType() const { + // returns the type of the particle + return fType ; + } + + void SetPIDBit(UInt_t fSet) { + // Set PID bit number fSet + fType |= (1<SetMomentum(100.); + genGG->SetPhi(240.); + genGG->SetTheta(91.); + genGG->SetPart(kGamma); + fGenerator = (AliGenerator*)genGG; + break; + + case kGammaBox: + genB = new AliGenBox(100); + genB->SetMomentumRange(100., 100.1); + genB->SetPhiRange(0,360); + genB->SetThetaRange(45., 135.); + genB->SetPart(kGamma); + fGenerator = (AliGenerator*)genB; + break; + + case kTest50: + genHijParaB = new AliGenHIJINGparaBa(50); + genHijParaB->SetMomentumRange(0, 999999.); + genHijParaB->SetPhiRange(-180., 180.); + // Set pseudorapidity range from -8 to 8. + thmin = EtaToTheta(8); // theta min. <---> eta max + thmax = EtaToTheta(-8); // theta max. <---> eta min + genHijParaB->SetThetaRange(thmin,thmax); + fGenerator = (AliGenerator*)genHijParaB; + break; + + case kParam_8000: + //coment= fComment.Append(":HIJINGparam N=8000"); + genHijPara = new AliGenHIJINGpara(86030); + genHijPara->SetMomentumRange(0, 999999.); + genHijPara->SetPhiRange(-180., 180.); + // Set pseudorapidity range from -8 to 8. + thmin = EtaToTheta(8); // theta min. <---> eta max + thmax = EtaToTheta(-8); // theta max. <---> eta min + genHijPara->SetThetaRange(thmin,thmax); + fGenerator = (AliGenerator*)genHijPara; + break; + case kParam_4000: + genHijPara = new AliGenHIJINGpara(43015); + genHijPara->SetMomentumRange(0, 999999.); + genHijPara->SetPhiRange(-180., 180.); + // Set pseudorapidity range from -8 to 8. + thmin = EtaToTheta(8); // theta min. <---> eta max + thmax = EtaToTheta(-8); // theta max. <---> eta min + genHijPara->SetThetaRange(thmin,thmax); + fGenerator = (AliGenerator*)genHijPara; + break; + case kParam_2000: + (*fComment) = "HIJINGparam N=2000"; + genHijPara = new AliGenHIJINGpara(21507); + genHijPara->SetMomentumRange(0, 999999.); + genHijPara->SetPhiRange(-180., 180.); + // Set pseudorapidity range from -8 to 8. + thmin = EtaToTheta(8); // theta min. <---> eta max + thmax = EtaToTheta(-8); // theta max. <---> eta min + genHijPara->SetThetaRange(thmin,thmax); + fGenerator = (AliGenerator*)genHijPara; + break; + + case kParam_8000_Ecal: + genHijParaB = new AliGenHIJINGparaBa(82534); + genHijParaB->SetMomentumRange(0, 999999.); + genHijParaB->SetPhiRange(-180., 180.); + // Set pseudorapidity range from -8 to 8. + thmin = EtaToTheta( 5); // theta min. <---> eta max + thmax = EtaToTheta(-5); // theta max. <---> eta min + genHijParaB->SetThetaRange(thmin,thmax); + fGenerator = (AliGenerator*)genHijParaB; + break; + + case kParam_4000_Ecal: + genHijParaB = new AliGenHIJINGparaBa(82534/2); + genHijParaB->SetMomentumRange(0, 999999.); + genHijParaB->SetPhiRange(-180., 180.); + // Set pseudorapidity range from -8 to 8. + thmin = EtaToTheta( 5); // theta min. <---> eta max + thmax = EtaToTheta(-5); // theta max. <---> eta min + genHijParaB->SetThetaRange(thmin,thmax); + fGenerator = (AliGenerator*)genHijParaB; + break; +// +// Hijing Central +// + case kHijing_cent1: + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + fGenerator = (AliGenerator*)genHij; + break; + case kHijing_cent2: + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 2.); + fGenerator = (AliGenerator*)genHij; + break; +// +// Hijing Peripheral +// + case kHijing_per1: + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(5., 8.6); + fGenerator = (AliGenerator*)genHij; + break; + case kHijing_per2: + //coment= comment.Append("HIJING per2"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(8.6, 11.2); + fGenerator = (AliGenerator*)genHij; + break; + case kHijing_per3: + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(11.2, 13.2); + fGenerator = (AliGenerator*)genHij; + break; + case kHijing_per4: + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(13.2, 15.); + fGenerator = (AliGenerator*)genHij; + break; + case kHijing_per5: + //coment= comment.Append("HIJING per5"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(15., 100.); + fGenerator = (AliGenerator*)genHij; + break; +// +// Jet-Jet +// + case kHijing_jj25: + //coment= comment.Append("HIJING Jet 25 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(1); + genHij->SetPtJet(25.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + + case kHijing_jj50: + //coment= comment.Append("HIJING Jet 50 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(1); + genHij->SetPtJet(50.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + + case kHijing_jj75: + //coment= comment.Append("HIJING Jet 75 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(1); + genHij->SetPtJet(75.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + + case kHijing_jj100: + //coment= comment.Append("HIJING Jet 100 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(1); + genHij->SetPtJet(100.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + + case kHijing_jj125: + //coment= comment.Append("HIJING Jet 125 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(1); + genHij->SetPtJet(125.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; +// +// Gamma-Jet +// + case kHijing_gj25: + //coment= comment.Append("HIJING Gamma 25 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(2); + genHij->SetPtJet(25.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + + case kHijing_gj50: + //coment= comment.Append("HIJING Gamma 50 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(2); + genHij->SetPtJet(50.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + + case kHijing_gj75: + //coment= comment.Append("HIJING Gamma 75 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(2); + genHij->SetPtJet(75.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + + case kHijing_gj100: + //coment= comment.Append("HIJING Gamma 100 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(2); + genHij->SetPtJet(100.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + + case kHijing_gj125: + //coment= comment.Append("HIJING Gamma 125 GeV"); + genHij = HijingStandard(); +// impact parameter range + genHij->SetImpactParameterRange(0., 5.); + // trigger + genHij->SetTrigger(2); + genHij->SetPtJet(125.); + genHij->SetSimpleJets(1); + genHij->SetRadiation(isw); + genHij->SetJetEtaRange(-0.3,0.3); + genHij->SetJetPhiRange(15.,105.); + fGenerator = (AliGenerator*)genHij; + break; + case kJetPlusBg: + genCoct = new AliGenCocktail(); + genCoct->SetMomentumRange(0, 999999.); + genCoct->SetPhiRange(-180., 180.); + // Set pseudorapidity range from -8 to 8. + thmin = EtaToTheta( 5.); // theta min. <---> eta max + thmax = EtaToTheta(-5.); // theta max. <---> eta min + genCoct->SetThetaRange(thmin,thmax); + +// +// Underlying Event +// +// AliGenHIJINGparaBa *bg = new AliGenHIJINGparaBa(82534); + bg = new AliGenHIJINGparaBa(10); + fBgGenerator = (AliGenerator*)bg; +// +// Jets from Pythia +// + jets = new AliGenPythia(-1); + fSignalGenerator = (AliGenerator*)jets; +// Centre of mass energy + jets->SetEnergyCMS(5500.); +// Process type + jets->SetProcess(kPyJets); +// final state kinematic cuts + jets->SetJetEtaRange(-0.3, 0.3); + jets->SetJetPhiRange(15., 105.); +// Structure function + jets->SetStrucFunc(kGRVLO98); +// +// Pt transfer of the hard scattering + jets->SetPtHard(100.,100.1); +// Decay type (semielectronic, semimuonic, nodecay) + jets->SetForceDecay(kAll); +// +// Add all to cockail ... +// + genCoct->AddGenerator(jets,"Jets",1); + genCoct->AddGenerator(bg,"Underlying Event", 1); + fGenerator = (AliGenerator*)genCoct; + + break; + case kGammaPlusBg: + genCoct = new AliGenCocktail(); + genCoct->SetMomentumRange(0, 999999.); + genCoct->SetPhiRange(-180., 180.); + // Set pseudorapidity range from -8 to 8. + thmin = EtaToTheta( 5.); // theta min. <---> eta max + thmax = EtaToTheta(-5.); // theta max. <---> eta min + genCoct->SetThetaRange(thmin,thmax); +// +// Underlying Event +// + bg = new AliGenHIJINGparaBa(82534); + fBgGenerator = (AliGenerator*)bg; +// +// Jets from Pythia +// + jets = new AliGenPythia(-1); + fSignalGenerator = (AliGenerator*)jets; +// Centre of mass energy + jets->SetEnergyCMS(5500.); +// Process type + jets->SetProcess(kPyDirectGamma); +// final state kinematic cuts + jets->SetJetEtaRange(-0.3, 0.3); + jets->SetJetPhiRange(15., 105.); + jets->SetGammaEtaRange(-0.12, 0.12); + jets->SetGammaPhiRange(220., 320.); +// Structure function + jets->SetStrucFunc(kGRVLO98); +// +// Pt transfer of the hard scattering + jets->SetPtHard(100.,100.1); +// Decay type (semielectronic, semimuonic, nodecay) + jets->SetForceDecay(kAll); +// +// Add all to cockail ... +// + genCoct->AddGenerator(jets,"Jets",1); + genCoct->AddGenerator(bg,"Underlying Event", 1); + fGenerator = (AliGenerator*)genCoct; + + break; + case kJets_50: +// 50 GeV Jets + genPy = PythiaJets(50.); + fGenerator = (AliGenerator*)genPy; + break; + case kJets_75: +// 75 GeV Jets + genPy = PythiaJets(75.); + fGenerator = (AliGenerator*)genPy; + break; + case kJets_100: +// 100 GeV Jets + genPy = PythiaJets(100.); + fGenerator = (AliGenerator*)genPy; + break; + case kJets_200: +// 200 GeV Jets + genPy = PythiaJets(200.); + fGenerator = (AliGenerator*)genPy; + break; + + case kJets_100RadOn: +// 100 GeV Jets with radiation on - 22-mar-2002 +// See AliPythia.cxx for default + genPy = PythiaJets(100.); + // genPy->SetKeyPartonJets(1); // for jet partons + // genPy->DefineParametersForPartonsJets(); + + fGenerator = (AliGenerator*)genPy; + break; + + case kGammaJets_50: +// 50 GeV Jets + Gamma + genPy = PythiaJets(-1); + genPy->SetEnergyCMS(5500.); + genPy->SetProcess(kPyDirectGamma); + genPy->SetJetEtaRange(-0.3,+0.3); + genPy->SetJetPhiRange(15.,105.); + genPy->SetGammaEtaRange(-0.12, 0.12); + genPy->SetGammaPhiRange(220., 320.); + genPy->SetStrucFunc(kGRVLO98); + genPy->SetPtHard(50.,50.001); + genPy->SetForceDecay(kAll); + fGenerator = (AliGenerator*)genPy; + break; + case kGammaJets_75: +// 75 GeV Jets + Gamma + genPy = PythiaJets(-1); + genPy->SetEnergyCMS(5500.); + genPy->SetProcess(kPyDirectGamma); + genPy->SetJetEtaRange(-0.3,+0.3); + genPy->SetJetPhiRange(15.,105.); + genPy->SetGammaEtaRange(-0.12, 0.12); + genPy->SetGammaPhiRange(220., 320.); + genPy->SetStrucFunc(kGRVLO98); + genPy->SetPtHard(75.,75.001); + genPy->SetForceDecay(kAll); + fGenerator = (AliGenerator*)genPy; + break; + case kGammaJets_100: +// 100 GeV Jets + Gamma + genPy = PythiaJets(-1); + genPy->SetEnergyCMS(5500.); + genPy->SetProcess(kPyDirectGamma); + genPy->SetJetEtaRange(-0.3,+0.3); + genPy->SetJetPhiRange(15.,105.); + genPy->SetGammaEtaRange(-0.12, 0.12); + genPy->SetGammaPhiRange(220., 320.); + genPy->SetStrucFunc(kGRVLO98); + genPy->SetPtHard(100.,100.001); + genPy->SetForceDecay(kAll); + fGenerator = (AliGenerator*)genPy; + break; + case kGammaJets_200: +// 200 GeV Jets + Gamma + genPy = PythiaJets(-1); + genPy->SetEnergyCMS(5500.); + genPy->SetProcess(kPyDirectGamma); + genPy->SetJetEtaRange(-0.3,+0.3); + genPy->SetJetPhiRange(15.,105.); + genPy->SetGammaEtaRange(-0.12, 0.12); + genPy->SetGammaPhiRange(220., 320.); + genPy->SetStrucFunc(kGRVLO98); + genPy->SetPtHard(200.,200.001); + genPy->SetForceDecay(kAll); + fGenerator = (AliGenPythia*)genPy; + break; + case kGammaJets_250: +// 250 GeV Jets + Gamma + genPy = PythiaJets(-1); + genPy->SetEnergyCMS(5500.); + genPy->SetProcess(kPyDirectGamma); + genPy->SetJetEtaRange(-0.3,+0.3); + genPy->SetJetPhiRange(15.,105.); + genPy->SetGammaEtaRange(-0.12, 0.12); + genPy->SetGammaPhiRange(220., 320.); + genPy->SetStrucFunc(kGRVLO98); + genPy->SetPtHard(250.,250.001); + genPy->SetForceDecay(kAll); + fGenerator = (AliGenerator*)genPy; + break; + case kGammaJets_300: +// 300 GeV Jets + Gamma + genPy = PythiaJets(-1); + genPy->SetEnergyCMS(5500.); + genPy->SetProcess(kPyDirectGamma); + genPy->SetJetEtaRange(-0.3,+0.3); + genPy->SetJetPhiRange(15.,105.); + genPy->SetGammaEtaRange(-0.12, 0.12); + genPy->SetGammaPhiRange(220., 320.); + genPy->SetStrucFunc(kGRVLO98); + genPy->SetPtHard(300.,300.001); + genPy->SetForceDecay(kAll); + fGenerator = (AliGenerator*)genPy; + break; + default: + printf(" wrong parameter for generator run %i rad %i\n", run, rad); + assert(0); + } + if(fGenerator) fGenerator->SetPtRange(0.,1.e10); // discard the limit on pT + +} + +AliEMCALGeneratorFactory::AliEMCALGeneratorFactory(PprRunFact_t run, Float_t p) +{ + fGenerator = fBgGenerator = fSignalGenerator = 0; + fRunType = run; + fMomentum = p; + + AliGenBox *genB=0; + + switch (run) { + case kGammaBoxOne: + genB = OneParticleWithFixedEnergy(kGamma, p); + break; + case kPi0BoxOne: + genB = OneParticleWithFixedEnergy(kPi0, p); + break; + default: + printf(" wrong parameter for generator run %i \n",run); + assert(0); + } + if(genB) fGenerator = (AliGenerator*)genB; + // if(fGenerator) fGenerator->SetPtRange(0.,1.e10); // discard the limit on pT - 23-aug-04 +} + +AliGenHijing* AliEMCALGeneratorFactory::HijingStandard() +{ + AliGenHijing *gener = new AliGenHijing(-1); +// centre of mass energy + gener->SetEnergyCMS(5500.); +// reference frame + gener->SetReferenceFrame("CMS"); +// projectile + gener->SetProjectile("A", 208, 82); + gener->SetTarget ("A", 208, 82); +// tell hijing to keep the full parent child chain + gener->KeepFullEvent(); +// enable jet quenching + gener->SetJetQuenching(1); +// enable shadowing + gener->SetShadowing(1); +// neutral pion and heavy particle decays switched off + gener->SetDecaysOff(1); +// Don't track spectators + gener->SetSpectators(0); +// kinematic selection + gener->SetSelectAll(0); + return gener; +} + +AliGenPythia* AliEMCALGeneratorFactory::PythiaJets(Float_t energy) +{ + AliGenPythia *gener = new AliGenPythia(-1); +// Centre of mass energy + gener->SetEnergyCMS(5500.); +// Process type + gener->SetProcess(kPyJets); +// final state kinematic cuts + gener->SetJetEtaRange(-0.3, 0.3); + gener->SetJetPhiRange(15., 105.); +// Structure function + gener->SetStrucFunc(kGRVLO98); +// +// Pt transfer of the hard scattering + gener->SetPtHard(energy, energy+0.1); +// Decay type (semielectronic, semimuonic, nodecay) + gener->SetForceDecay(kAll); +// + return gener; +} + + +AliGenPythia* AliEMCALGeneratorFactory::PythiaGamma(Float_t energy) +{ + AliGenPythia *gener = new AliGenPythia(-1); +// Centre of mass energy + gener->SetEnergyCMS(5500.); +// Process type + gener->SetProcess(kPyDirectGamma); +// final state kinematic cuts + gener->SetJetEtaRange(-0.3, 0.3); + gener->SetJetPhiRange(15., 105.); + gener->SetGammaEtaRange(-0.12, 0.12); + gener->SetGammaPhiRange(220., 320.); +// Structure function + gener->SetStrucFunc(kGRVLO98); +// +// Pt transfer of the hard scattering + gener->SetPtHard(energy, energy+0.1); +// Decay type (semielectronic, semimuonic, nodecay) + gener->SetForceDecay(kAll); +// + return gener; +} + +// +// Staff of Aleksei Pavlinov. +// +AliGenBox* AliEMCALGeneratorFactory::OneParticleWithFixedEnergy(Int_t type, Float_t p) +{// one particle in EMCAL acceptance + Float_t thmin = EtaToTheta(0.7), thmax = EtaToTheta(-0.7); + Float_t phimin=0, phimax=120; + Float_t pmin=p, pmax=p+0.01; + + AliGenBox *gen = new AliGenBox(1); + gen->SetPart(type); + gen->SetNumberParticles(1); + gen->SetThetaRange(thmin, thmax); + gen->SetPhiRange(phimin, phimax); + gen->SetMomentumRange(pmin, pmax); + + printf(" AliEMCALGeneratorFactory::OneParticleWithFixedEnergy \n"); + printf(" type of particle -> %i \n", type); + printf(" %6.4f < eta < %6.4f\n", thmin, thmax); + printf(" %6.4f < phi < %6.4f\n", phimin, phimax); + printf(" %7.2f < Momentum < %7.2f\n", pmin, pmax); + printf(" TestBit(kPtRange) %i | TestBit(kMomentumRange) %i\n", + gen->TestBit(BIT(17)), gen->TestBit(BIT(19))); + return gen; +} diff --git a/EMCAL/jetfinder/AliEMCALGeneratorFactory.h b/EMCAL/jetfinder/AliEMCALGeneratorFactory.h new file mode 100644 index 00000000000..252882dcb33 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALGeneratorFactory.h @@ -0,0 +1,79 @@ +#ifndef ALIEMCALGENERATORFACTORY_H +#define ALIEMCALGENERATORFACTORY_H +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// Class for generator factory which used in production for EMCAL. +// Based on Config.C file +//*-- Author: Aleksei Pavlinov (WSU) +#include +#include +#include "AliPDG.h" +// 23-aug-04 for kGamma and kPi0 +#include + +class AliGenerator; +class AliGenHijing; +class AliGenPythia; +class AliGenBox; +class TString; + +enum PprRunFact_t +{ + kTest50, + kParam_8000, kParam_4000, kParam_2000, + kHijing_cent1, kHijing_cent2, + kHijing_per1, kHijing_per2, kHijing_per3, kHijing_per4, kHijing_per5, + kHijing_jj25, kHijing_jj50, kHijing_jj75, kHijing_jj100, kHijing_jj125, + kHijing_gj25, kHijing_gj50, kHijing_gj75, kHijing_gj100, kHijing_gj125, + kJetPlusBg, kGammaPlusBg, + kParam_8000_Ecal, kParam_4000_Ecal, + kJets_50, kJets_75, kJets_100, kJets_200, + kJets_100RadOn, + kGammaJets_50, kGammaJets_75, kGammaJets_100, kGammaJets_200, + kGammaJets_250, kGammaJets_300, + kGammaGun, kGammaBox, + kGammaBoxOne, kPi0BoxOne +}; + +enum PprRadFact_t +{ // Concern only HIJING + kGluonRadiation, kNoGluonRadiation +}; + +class AliEMCALGeneratorFactory : public TObject{ + + public: + explicit AliEMCALGeneratorFactory + (PprRunFact_t run=kJets_50, PprRadFact_t rad = kGluonRadiation); + explicit AliEMCALGeneratorFactory(PprRunFact_t run, Float_t p); + AliGenHijing* HijingStandard(); + AliGenPythia* PythiaJets(Float_t energy); + AliGenPythia* PythiaGamma(Float_t energy); + AliGenBox* OneParticleWithFixedEnergy(Int_t type=kGamma, Float_t p=1.0); + + AliGenerator* GetGenerator() {return fGenerator;} + AliGenerator* GetBgGenerator() {return fBgGenerator;} + AliGenerator* GetSignalGenerator() {return fSignalGenerator;} + PprRunFact_t GetRunType() {return fRunType;} + PprRadFact_t GetRadiation() {return fRadiation;} + + TString* GetComment() {return fComment;} + static Float_t EtaToTheta(Float_t arg) {return (180./TMath::Pi())*2.*atan(exp(-arg));} + +protected: + AliGenerator* fGenerator; //! + AliGenerator* fBgGenerator; //! + AliGenerator* fSignalGenerator; //! + PprRunFact_t fRunType; + PprRadFact_t fRadiation; + Float_t fMomentum; + TString *fComment; //! + + ClassDef(AliEMCALGeneratorFactory,1) // Generator Factory for EMCAL production + +}; +#endif // ALIEMCALGENERATORFACTORY_H diff --git a/EMCAL/jetfinder/AliEMCALHadronCorrection.cxx b/EMCAL/jetfinder/AliEMCALHadronCorrection.cxx new file mode 100644 index 00000000000..5a429ee3b05 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALHadronCorrection.cxx @@ -0,0 +1,30 @@ +/************************************************************************** + * Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ +//-- +//-- +//-- Hadron correction base class +//-- +//-- +//-- + + +#include "AliEMCALHadronCorrection.h" + +ClassImp(AliEMCALHadronCorrection) + +AliEMCALHadronCorrection::AliEMCALHadronCorrection(const char *name,const char *title) +:TNamed(name,title) { } diff --git a/EMCAL/jetfinder/AliEMCALHadronCorrection.h b/EMCAL/jetfinder/AliEMCALHadronCorrection.h new file mode 100644 index 00000000000..c8f580895c7 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALHadronCorrection.h @@ -0,0 +1,27 @@ +#ifndef ALIEMCALHADRONCORRECTION_H +#define ALIEMCALHADRONCORRECTION_H +/* Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// +//*-- Author: Aleksei Pavlinov (WSU) +// This pure abstract class which defines only interface +// +#include "TNamed.h" + +class AliEMCALHadronCorrection : public TNamed { + + public: + AliEMCALHadronCorrection(const char *name="name", const char *title="title"); + virtual ~AliEMCALHadronCorrection() {} + + // Add for particle + virtual Double_t GetEnergy(Double_t pmom, Double_t eta, Int_t gid)=0; + + ClassDef(AliEMCALHadronCorrection,1) // Hadron correction for EMC (abstract class) +}; + +#endif // ALIEMCALHADRONCORRECTION_H diff --git a/EMCAL/jetfinder/AliEMCALHadronCorrectionv0.cxx b/EMCAL/jetfinder/AliEMCALHadronCorrectionv0.cxx new file mode 100644 index 00000000000..39cfbd2ef6e --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALHadronCorrectionv0.cxx @@ -0,0 +1,78 @@ +/************************************************************************** + * Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + +#include "AliEMCALHadronCorrectionv0.h" + +const Int_t maxVariant = 8; // size eta grid +const Int_t nVec = 10; // size momentum grid +const Int_t nPol = 4; // number coefficients of polinom +static Double_t etaGrid[maxVariant]={ 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.67}; +static Double_t pGrid[nVec]={ 0.2, 0.5, 1.0, 2.0, 3.0, 5.0,10.0,15.0,25.0,40.0}; +// c[][] - first index for eta, second for momentum +static Double_t c[maxVariant][nPol] ={ + {1.305705e-01, 3.725653e-01, -1.219962e-02, 1.806235e-04}, + {1.296153e-01, 3.827408e-01, -1.238640e-02, 1.822804e-04}, + {1.337690e-01, 3.797454e-01, -1.245227e-02, 1.848243e-04}, + {1.395796e-01, 3.623994e-01, -9.196803e-03, 1.243278e-04}, + {1.457184e-01, 3.753655e-01, -1.035324e-02, 1.473447e-04}, + {1.329164e-01, 4.219044e-01, -1.310515e-02, 1.948883e-04}, + {8.136581e-02, 4.646087e-01, -1.531917e-02, 2.274749e-04}, + {1.119836e-01, 4.262497e-01, -1.160125e-02, 1.628738e-04} }; + +ClassImp(AliEMCALHadronCorrectionv0) + +AliEMCALHadronCorrectionv0* AliEMCALHadronCorrectionv0::fHadrCorr = 0; + +AliEMCALHadronCorrectionv0::AliEMCALHadronCorrectionv0(const char *name,const char *title) + :AliEMCALHadronCorrection(name, title) +{ + fHadrCorr = this; +} + +AliEMCALHadronCorrectionv0* +AliEMCALHadronCorrectionv0::Instance() +{ + fHadrCorr = new AliEMCALHadronCorrectionv0(); + return fHadrCorr; +} + +Double_t +AliEMCALHadronCorrectionv0::GetEnergy(Double_t pmom, Double_t eta, Int_t /*gid*/) +{ + Int_t iEta=0; // index + Double_t etaw = TMath::Abs(eta); + if(etaw > etaGrid[maxVariant-1]) etaw = etaGrid[maxVariant-1]; + for(Int_t i=0; i=etaGrid[i]) {iEta = i; break;} + + Double_t e[2], y, pw = pmom; + if(pmom > pGrid[nVec-1]) pw = pGrid[nVec-1]; + for(Int_t i=0; i<2; i++){ // e for two eta value + e[i] = c[iEta][0]; + y = 1.; + for(Int_t j=1; jGetSampling(); + cout<<"Setting the sampling fraction to :"<GetName()); + fSamplingFraction = geometry->GetSampling(); + cout<<"Setting the sampling fraction to :"< +//*-- Author: Andreas Morsch (CERN) + + +class AliEMCALJet : public TObject { + public: + AliEMCALJet(); + AliEMCALJet(Float_t energy, Float_t phi, Float_t eta); + virtual ~AliEMCALJet(); + void SetEnergy(Float_t val) {fEnergy = val;} + void SetEMCALEnergy(Float_t val) {fEMCALEnergy = val;} + void SetEMCALEnergyBGSub(Float_t val){fEMCALEnergyBGSub = val;} + void SetTrackEnergy(Float_t val) {fTrackEnergy = val;} + void SetTrackEnergyPtCut(Float_t val){fTrackEnergyPtCut = val;} + void SetHCEnergy(Float_t val) {fHCEnergy = val;} + void SetPhi(Float_t val) {fPhi = val;} + void SetEta(Float_t val) {fEta = val;} + void SetIsWeightedEnergy(Bool_t flag) {fIsWeightedEnergy = flag;} + void SetTrackList(Int_t val, Float_t* pt, Float_t* eta, Float_t* phi, Int_t* pdg); + Float_t Energy() const {return fEnergy;} + Float_t EMCALEnergy() const {return fEMCALEnergy;} + Float_t EMCALEnergyBGSub() const {return fEMCALEnergyBGSub;} + Float_t TrackEnergy() const {return fTrackEnergy;} + Float_t TrackEnergyPtCut() const {return fTrackEnergyPtCut;} + Float_t HCEnergy() const {return fHCEnergy;} + Float_t Phi() const {return fPhi;} + Float_t Eta() const {return fEta;} + Int_t TrackList(Float_t* pt, Float_t* eta, Float_t* phi, Int_t* pdg)const; + Int_t NTracks() const {return fNt;} + +protected: + Float_t fEnergy; // Jet Energy + Float_t fEMCALEnergy; // EMCAL component of Energy inside Jet cone before BG subtraction + Float_t fEMCALEnergyBGSub; // EMCAL component of Energy inside Jet cone after BG subtraction + Float_t fTrackEnergy; // Charge tracks component of Energy inside Jet cone with no pT cut + Float_t fTrackEnergyPtCut; // Charge tracks component of Energy inside Jet cone after pT cut + Float_t fHCEnergy; // HC component of Energy inside Jet cone + Bool_t fIsWeightedEnergy; // Store flag regarding energy calculation + Float_t fEta; // Jet Eta + Float_t fPhi; // Jet Phi + Int_t fNt; // Number of associated tracks + Float_t fPtT [1000]; // Track pt + Float_t fEtaT[1000]; // Track eta + Float_t fPhiT[1000]; // Track phi + Int_t fPdgT[1000]; // Track pdg code + ClassDef(AliEMCALJet,8) // Jet for EMCAL + +} ; + +#endif // ALIEMCALJet_H diff --git a/EMCAL/jetfinder/AliEMCALJetFinder.cxx b/EMCAL/jetfinder/AliEMCALJetFinder.cxx new file mode 100644 index 00000000000..0ea87000354 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinder.cxx @@ -0,0 +1,1975 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//*-- Authors: Andreas Morsch (CERN) +//* J.L. Klay (LBL) +//* Aleksei Pavlinov (WSU) +//-- +//-- +// + +#include +// From root ... +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// From AliRoot ... +#include "AliEMCALJetFinder.h" +#include "AliHeader.h" +#include "AliMagF.h" +#include "AliMagFCM.h" +#include "AliRun.h" +#include "AliGenerator.h" +#include "AliRunLoader.h" +#include "AliEMCAL.h" +#include "AliEMCALLoader.h" +#include "AliEMCALDigit.h" +#include "AliEMCALDigitizer.h" +#include "AliEMCALFast.h" +#include "AliEMCALGeometry.h" +#include "AliEMCALHadronCorrection.h" +#include "AliEMCALHit.h" +#include "AliEMCALJetMicroDst.h" + +// Interface to FORTRAN +#include "Ecommon.h" +#include "AliMC.h" + + +ClassImp(AliEMCALJetFinder) + +//____________________________________________________________________________ +AliEMCALJetFinder::AliEMCALJetFinder() +{ +// Default constructor + fJets = 0; + fNjets = 0; + fLego = 0; + fLegoB = 0; + + fTrackList = 0; + fPtT = 0; + fEtaT = 0; + fPhiT = 0; + fPdgT = 0; + + fTrackListB = 0; + fPtB = 0; + fEtaB = 0; + fPhiB = 0; + fPdgB = 0; + + fHCorrection = 0; + fHadronCorrector = 0; + + fWrite = 0; + fOutFileName = 0; + fOutFile = 0; + fInFile = 0; + fEvent = 0; + + fRandomBg = 0; + + SetParametersForBgSubtraction(); +} + +AliEMCALJetFinder::AliEMCALJetFinder(const char* name, const char *title) + : TTask(name, title) +{ +// Constructor +// Title is used in method GetFileNameForParameters(); +// + fJets = new TClonesArray("AliEMCALJet",10000); + fNjets = 0; + for (Int_t i = 0; i < 30000; i++) + { + fEtCell[i] = 0.; + fEtaCell[i] = 0.; + fPhiCell[i] = 0.; + } + fLego = 0; + fLegoB = 0; + + fTrackList = 0; + fPtT = 0; + fEtaT = 0; + fPhiT = 0; + fPdgT = 0; + + fTrackListB = 0; + fPtB = 0; + fEtaB = 0; + fPhiB = 0; + fPdgB = 0; + + fHCorrection = 0; + fHadronCorrector = 0; + fBackground = 0; + fWrite = 0; + fOutFileName = 0; + fOutFile = 0; + fInFile = 0; + fEvent = 0; +// + SetPtCut(); + SetMomentumSmearing(); + SetEfficiencySim(); + SetDebug(); + SetHadronCorrection(); + SetIncludeK0andN(); + + fRandomBg = 0; + SetParametersForBgSubtraction(); +} + +void AliEMCALJetFinder::SetParametersForBgSubtraction +(Int_t mode, Float_t minMove, Float_t maxMove, Float_t precBg) +{ +// see file /home/pavlinov/cosmic/pythia/jetFinderParamData.inc +// at WSU Linux cluster - 11-feb-2002 +// These parameters must be tuned more carefull !!! + SetMode(mode); + SetMinMove(minMove); + SetMaxMove(maxMove); + SetPrecBg(precBg); +} + +//____________________________________________________________________________ +AliEMCALJetFinder::~AliEMCALJetFinder() +{ +// Destructor +// + if (fJets){ + fJets->Delete(); + delete fJets; + } + delete fLego; + delete fLegoB; + delete fhLegoTracks; + delete fhLegoEMCAL; + delete fhLegoHadrCorr; + delete fhEff; + delete fhCellEt; + delete fhCellEMCALEt; + delete fhTrackPt; + delete fhTrackPtBcut; + delete fhChPartMultInTpc; + + delete[] fTrackList; + delete[] fPtT; + delete[] fEtaT; + delete[] fPhiT; + delete[] fPdgT; + + delete[] fTrackListB; + delete[] fPtB; + delete[] fEtaB; + delete[] fPhiB; + delete[] fPdgB; +} + +#ifndef WIN32 +# define jet_finder_ua1 jet_finder_ua1_ +# define hf1 hf1_ +# define type_of_call + +#else +# define jet_finder_ua1 JET_FINDER_UA1 +# define hf1 HF1 +# define type_of_call _stdcall +#endif + +extern "C" void type_of_call +jet_finder_ua1(Int_t& ncell, Int_t& ncell_tot, + Float_t etc[30000], Float_t etac[30000], + Float_t phic[30000], + Float_t& min_move, Float_t& max_move, Int_t& mode, + Float_t& prec_bg, Int_t& ierror); + +extern "C" void type_of_call hf1(Int_t& id, Float_t& x, Float_t& wgt); + + +void AliEMCALJetFinder::Init() +{ +// +// Geometry and I/O initialization +// +// +// +// Get geometry parameters from EMCAL +// +// +// Geometry + //AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); + AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance(); + +// SetSamplingFraction(geom->GetSampling()); + + fNbinEta = geom->GetNZ(); + fNbinPhi = geom->GetNPhi(); + fPhiMin = geom->GetArm1PhiMin()*TMath::Pi()/180.; + fPhiMax = geom->GetArm1PhiMax()*TMath::Pi()/180.; + fEtaMin = geom->GetArm1EtaMin(); + fEtaMax = geom->GetArm1EtaMax(); + fDphi = (fPhiMax-fPhiMin)/fNbinPhi; + fDeta = (fEtaMax-fEtaMin)/fNbinEta; + fNtot = fNbinPhi*fNbinEta; + fWeightingMethod = kFALSE; + +// + SetCellSize(fDeta, fDphi); +// +// I/O + if (fOutFileName) fOutFile = new TFile(fOutFileName, "recreate"); +// +// +} + +void AliEMCALJetFinder::Find(Int_t ncell, Int_t ncelltot, Float_t etc[30000], + Float_t etac[30000], Float_t phic[30000], + Float_t minmove, Float_t maxmove, Int_t mode, + Float_t precbg, Int_t ierror) +{ +// Wrapper for fortran coded jet finder +// Full argument list + jet_finder_ua1(ncell, ncelltot, etc, etac, phic, + minmove, maxmove, mode, precbg, ierror); + // Write result to output + if(fWrite) WriteJets(); + fEvent++; +} + +void AliEMCALJetFinder::Find() +{ +// Wrapper for fortran coded jet finder using member data for +// argument list + + Float_t minmove = fMinMove; + Float_t maxmove = fMaxMove; + Int_t mode = fMode; + Float_t precbg = fPrecBg; + Int_t ierror; + ResetJets(); // 4-feb-2002 by PAI + + jet_finder_ua1(fNcell, fNtot, fEtCell, fEtaCell, fPhiCell, + minmove, maxmove, mode, precbg, ierror); + fError = ierror; + // Write result to output + Int_t njet = Njets(); + + for (Int_t nj=0; njSetIsWeightedEnergy(fWeightingMethod); + fJetT[nj]->SetEMCALEnergy( EMCALConeEnergy(JetEtaW(nj),JetPhiW(nj)) ); + fJetT[nj]->SetTrackEnergy(TrackConeEnergy( JetEtaW(nj),JetPhiW(nj) )); + + } + + FindTracksInJetCone(); + if(fWrite) WriteJets(); + fEvent++; +} + + +Float_t AliEMCALJetFinder::EMCALConeEnergy(Float_t eta, Float_t phi) +{ +// Calculate the energy in the cone +Float_t newenergy = 0.0; +Float_t bineta,binphi; +TAxis *x = fhLegoEMCAL->GetXaxis(); +TAxis *y = fhLegoEMCAL->GetYaxis(); +for (Int_t i = 0 ; i < fNbinEta ; i++) // x coord + { + for (Int_t j = 0 ; j < fNbinPhi ; j++) // y coord + { + bineta = x->GetBinCenter(i); + binphi = y->GetBinCenter(j); + if ( (bineta-eta)*(bineta-eta) + (binphi-phi)*(binphi-phi) < fConeRadius*fConeRadius) + { + newenergy += fhLegoEMCAL->GetBinContent(i,j); + } + } +} +return newenergy; +} + +Float_t AliEMCALJetFinder::TrackConeEnergy(Float_t eta, Float_t phi) +{ +// Calculate the track energy in the cone +Float_t newenergy = 0.0; +Float_t bineta,binphi; +TAxis *x = fhLegoTracks->GetXaxis(); +TAxis *y = fhLegoTracks->GetYaxis(); +for (Int_t i = 0 ; i < fNbinEta ; i++) // x coord + { + for (Int_t j = 0 ; j < fNbinPhi ; j++) // y coord + { + bineta = x->GetBinCenter(i); + binphi = y->GetBinCenter(j); + if ( (bineta-eta)*(bineta-eta) + (binphi-phi)*(binphi-phi) < fConeRadius*fConeRadius) + { + newenergy += fhLegoTracks->GetBinContent(i,j); + } + } +} +return newenergy; +} + + +Float_t AliEMCALJetFinder::WeightedJetEnergy(Float_t eta, Float_t phi) +{ +// Calculate the weighted jet energy + +Float_t newenergy = 0.0; +Float_t bineta,binphi; +TAxis *x = fhLegoEMCAL->GetXaxis(); +TAxis *y = fhLegoEMCAL->GetYaxis(); + + +for (Int_t i = 0 ; i < fNbinEta ; i++) // x coord +{ + for (Int_t j = 0 ; j < fNbinPhi ; j++) // y coord + { + bineta = x->GetBinCenter(i); + binphi = y->GetBinCenter(j); + if ( (bineta-eta)*(bineta-eta) + (binphi-phi)*(binphi-phi) < fConeRadius*fConeRadius) + { + newenergy += (fEMCALWeight)* fhLegoEMCAL->GetBinContent(i,j) + (fTrackWeight)* fhLegoTracks->GetBinContent(i,j); + } + } +} + +return newenergy; + +} + + +Int_t AliEMCALJetFinder::Njets() const +{ +// Get number of reconstructed jets + return EMCALJETS.njet; +} + +Float_t AliEMCALJetFinder::JetEnergy(Int_t i) const +{ +// Get reconstructed jet energy + return EMCALJETS.etj[i]; +} + +Float_t AliEMCALJetFinder::JetPhiL(Int_t i) const +{ +// Get reconstructed jet phi from leading particle + return EMCALJETS.phij[0][i]; +} + +Float_t AliEMCALJetFinder::JetPhiW(Int_t i) const +{ +// Get reconstructed jet phi from weighting + return EMCALJETS.phij[1][i]; +} + +Float_t AliEMCALJetFinder::JetEtaL(Int_t i) const +{ +// Get reconstructed jet eta from leading particles + return EMCALJETS.etaj[0][i]; +} + + +Float_t AliEMCALJetFinder::JetEtaW(Int_t i) const +{ +// Get reconstructed jet eta from weighting + return EMCALJETS.etaj[1][i]; +} + +void AliEMCALJetFinder::SetCellSize(Float_t eta, Float_t phi) +{ +// Set grid cell size + EMCALCELLGEO.etaCellSize = eta; + EMCALCELLGEO.phiCellSize = phi; +} + +void AliEMCALJetFinder::SetConeRadius(Float_t par) +{ +// Set jet cone radius + EMCALJETPARAM.coneRad = par; + fConeRadius = par; +} + +void AliEMCALJetFinder::SetEtSeed(Float_t par) +{ +// Set et cut for seeds + EMCALJETPARAM.etSeed = par; + fEtSeed = par; +} + +void AliEMCALJetFinder::SetMinJetEt(Float_t par) +{ +// Set minimum jet et + EMCALJETPARAM.ejMin = par; + fMinJetEt = par; +} + +void AliEMCALJetFinder::SetMinCellEt(Float_t par) +{ +// Set et cut per cell + EMCALJETPARAM.etMin = par; + fMinCellEt = par; +} + +void AliEMCALJetFinder::SetPtCut(Float_t par) +{ +// Set pT cut on charged tracks + fPtCut = par; +} + + +void AliEMCALJetFinder::Test() +{ +// +// Test the finder call +// + const Int_t knmax = 30000; + Int_t ncell = 10; + Int_t ncelltot = 100; + + Float_t etc[knmax]; + Float_t etac[knmax]; + Float_t phic[knmax]; + Float_t minmove = 0; + Float_t maxmove = 0; + Int_t mode = 0; + Float_t precbg = 0; + Int_t ierror = 0; + + + Find(ncell, ncelltot, etc, etac, phic, + minmove, maxmove, mode, precbg, ierror); + +} + +// +// I/O +// + +void AliEMCALJetFinder::AddJet(const AliEMCALJet& jet) +{ + // + // Add a jet + // + TClonesArray &lrawcl = *fJets; + new(lrawcl[fNjets++]) AliEMCALJet(jet); +} + +void AliEMCALJetFinder::ResetJets() +{ + // + // Reset Jet List + // + fJets->Clear(); + fNjets = 0; +} + +void AliEMCALJetFinder::WriteJets() +{ +// +// Add all jets to the list +// + const Int_t kBufferSize = 4000; + const char* file = 0; + + Int_t njet = Njets(); + + for (Int_t nj = 0; nj < njet; nj++) + { + AddJet(*fJetT[nj]); + delete fJetT[nj]; + } + +// I/O + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + AliEMCALLoader *emcalLoader = dynamic_cast(rl->GetDetectorLoader("EMCAL")); + + if (!fOutFileName) { +// +// output written to input file +// + AliEMCAL* pEMCAL = (AliEMCAL* )gAlice->GetModule("EMCAL"); + TTree* pK = rl->TreeK(); + file = (pK->GetCurrentFile())->GetName(); + TBranch * jetBranch ; + if (fDebug > 1) + printf("Make Branch - TreeR address %p %p\n",(void*)gAlice->TreeR(), (void*)pEMCAL); + //if (fJets && gAlice->TreeR()) { + if (fJets && emcalLoader->TreeR()) { + // pEMCAL->MakeBranchInTree(gAlice->TreeR(), + jetBranch = emcalLoader->TreeR()->Branch("EMCALJets", &fJets, kBufferSize, 0) ; + //pEMCAL->MakeBranchInTree(gime->TreeR(), + // "EMCALJets", + // &fJets, + // kBufferSize, + // file); + + //Int_t nev = gAlice->GetHeader()->GetEvent(); + //gAlice->TreeR()->Fill(); + jetBranch->Fill(); + //char hname[30]; + //sprintf(hname,"TreeR%d", nev); + //gAlice->TreeR()->Write(hname); + //gAlice->TreeR()->Reset(); + //gime->WriteRecPoints("OVERWRITE"); + emcalLoader->WriteRecPoints("OVERWRITE"); + } + } else { +// +// Output written to user specified output file +// + //TTree* pK = gAlice->TreeK(); + TTree* pK = rl->TreeK(); + fInFile = pK->GetCurrentFile(); + + fOutFile->cd(); + char hname[30]; + sprintf(hname,"TreeR%d", fEvent); + TTree* treeJ = new TTree(hname, "EMCALJets"); + treeJ->Branch("EMCALJets", &fJets, kBufferSize); + treeJ->Fill(); + treeJ->Write(hname); + fInFile->cd(); + } + ResetJets(); +} + +void AliEMCALJetFinder::BookLego() +{ +// +// Book histo for discretization +// + +// +// Don't add histos to the current directory + if(fDebug) printf("\n AliEMCALJetFinder::BookLego() \n"); + + // TH2::AddDirectory(0); // hists wil be put to the list from gROOT + // TH1::AddDirectory(0); + gROOT->cd(); +// +// Signal map + fLego = new TH2F("legoH","eta-phi", + fNbinEta, fEtaMin, fEtaMax, + fNbinPhi, fPhiMin, fPhiMax); +// +// Background map + fLegoB = new TH2F("legoB","eta-phi for BG event", + fNbinEta, fEtaMin, fEtaMax, + fNbinPhi, fPhiMin, fPhiMax); + +// Tracks map + fhLegoTracks = new TH2F("hLegoTracks","eta-phi for Tracks", + fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax); +// EMCAL map + fhLegoEMCAL = new TH2F("hLegoEMCAL","eta-phi for EMCAL", + fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax); +// Hadron correction map + fhLegoHadrCorr = new TH2F("hLegoHadrCorr","eta-phi for Hadron. Correction", + fNbinEta, fEtaMin, fEtaMax, fNbinPhi, fPhiMin, fPhiMax); +// Hists. for tuning jet finder + fhEff = new TH2F("hEff","#epsilon vs momentum ", 100,0.,20., 50,0.5,1.); + + TArrayF eTmp(1101); + eTmp[0] = 0.0; + for(Int_t i=1; i<=1000; i++) eTmp[i] = 0.1*i; // step 100 mev + for(Int_t i=1001; i<=1100; i++) eTmp[i] = eTmp[1000] + 1.0*(i-1000); // step 1GeV + + fhCellEt = new TH1F("hCellEt","Cell E_{T} from fLego", + eTmp.GetSize()-1, eTmp.GetArray()); + fhCellEMCALEt = new TH1F("hCellEMCALEt","Cell E_{T} for EMCAL itself", + eTmp.GetSize()-1, eTmp.GetArray()); + fhTrackPt = new TH1F("hTrackPt","Ch.particles P_{T} ", + eTmp.GetSize()-1, eTmp.GetArray()); + fhTrackPtBcut = new TH1F("hTrackPtBcut","Ch.particles P_{T} + magnetic field cut", + eTmp.GetSize()-1, eTmp.GetArray()); + + fhChPartMultInTpc = new TH1F("hChPartMultInTpc", + "Charge partilcle multiplicity in |%eta|<0.9", 2000, 0, 20000); + + fhSinTheta = new TH1F("fhSinTheta","sin(theta)", fNbinEta, fEtaMin, fEtaMax); + TAxis *xax = fhSinTheta->GetXaxis(); + for(Int_t i=1; i<=fNbinEta; i++) { + Double_t eta = xax->GetBinCenter(i); + fhSinTheta->Fill(eta, 1./TMath::CosH(eta)); // cosh(eta) = 1./sin(theta) + } + + //! first canvas for drawing + fHistsList=AliEMCALJetMicroDst::MoveHistsToList("Hists from AliEMCALJetFinder", kFALSE); +} + +void AliEMCALJetFinder::DumpLego() +{ +// +// Dump lego histo into array +// + fNcell = 0; + TAxis* xaxis = fLego->GetXaxis(); + TAxis* yaxis = fLego->GetYaxis(); + // fhCellEt->Clear(); + Float_t e, eH; + for (Int_t i = 1; i <= fNbinEta; i++) { + for (Int_t j = 1; j <= fNbinPhi; j++) { + + e = fLego->GetBinContent(i,j); + if (fRandomBg) { + if (gRandom->Rndm() < 0.5) { + Float_t ebg = 0.28 * TMath::Abs(gRandom->Gaus(0.,1.)); + e += ebg; + } + } + if (e > 0.0) e -= fMinCellEt; + if (e < 0.0) e = 0.; + Float_t eta = xaxis->GetBinCenter(i); + Float_t phi = yaxis->GetBinCenter(j); + fEtCell[fNcell] = e; + fEtaCell[fNcell] = eta; + fPhiCell[fNcell] = phi; + fNcell++; + fhCellEt->Fill(e); + if(fhLegoEMCAL) { + eH = fhLegoEMCAL->GetBinContent(i,j); + if(eH > 0.0) fhCellEMCALEt->Fill(eH); + } + } // phi + } // eta +// today +// fNcell--; +} + +void AliEMCALJetFinder::ResetMap() +{ +// +// Reset eta-phi array + + for (Int_t i=0; i<30000; i++) + { + fEtCell[i] = 0.; + fEtaCell[i] = 0.; + fPhiCell[i] = 0.; + } +} + + +void AliEMCALJetFinder::FillFromTracks(Int_t flag, Int_t ich) +{ +// Which generator +// + const char* name = gAlice->Generator()->GetName(); + enum {kPythia, kHijing, kHijingPara}; + Int_t genType = 0; + + if (!strcmp(name, "Hijing")){ + genType = kHijing; + } else if (!strcmp(name, "Pythia")) { + genType = kPythia; + } else if (!strcmp(name, "HIJINGpara") ||!strcmp(name, "HIGINGpara")) { + genType = kHijingPara; + } + if (fDebug>=2) + printf("Fill tracks generated by %s %d\n", name, genType); + + +// +// Fill Cells with track information +// + if (fDebug >= 2) + printf("\n AliEMCALJetFinder::FillFromTracks(%i,%i) ",flag,ich); + fNChTpc = 0; + + ResetMap(); + + if (!fLego) BookLego(); +// Reset + if (flag == 0) fLego->Reset(); +// +// Access particle information + Int_t npart = (gAlice->GetHeader())->GetNprimary(); + Int_t ntr = (gAlice->GetHeader())->GetNtrack(); + printf(" : #primary particles %i # tracks %i : (before) Sum.Et %f\n", + npart, ntr, fLego->Integral()); + +// Create track list +// +// 0: not selected +// 1: selected for jet finding +// 2: inside jet +// .... + if (fTrackList) delete[] fTrackList; + if (fPtT) delete[] fPtT; + if (fEtaT) delete[] fEtaT; + if (fPhiT) delete[] fPhiT; + if (fPdgT) delete[] fPdgT; + + fTrackList = new Int_t [npart]; + fPtT = new Float_t[npart]; + fEtaT = new Float_t[npart]; + fPhiT = new Float_t[npart]; + fPdgT = new Int_t[npart]; + + fNt = npart; + fNtS = 0; + Float_t chTmp=0.0; // charge of current particle + // Int_t idGeant; + + // this is for Pythia ?? + for (Int_t part = 0; part < npart; part++) { + TParticle *mPart = gAlice->GetMCApp()->Particle(part); + Int_t mpart = mPart->GetPdgCode(); + Int_t child1 = mPart->GetFirstDaughter(); + Float_t pT = mPart->Pt(); + Float_t p = mPart->P(); + Float_t phi = mPart->Phi(); + Float_t eta = -100.; + if(pT > 0.001) eta = mPart->Eta(); + Float_t theta = mPart->Theta(); + if (fDebug>=2 && mPart->GetStatusCode()==1) { + printf("ind %7i part %7i -> child1 %5i child2 %5i Status %5i\n", + part, mpart, child1, mPart->GetLastDaughter(), mPart->GetStatusCode()); + } + + if (fDebug >= 2 && genType == kPythia) { + if (part == 6 || part == 7) + { + printf("\n Simulated Jet (pt, eta, phi): %d %f %f %f\n", + part-5, pT, eta, phi); + } + } + + fTrackList[part] = 0; + fPtT[part] = pT; // must be change after correction for resolution !!! + fEtaT[part] = eta; + fPhiT[part] = phi; + fPdgT[part] = mpart; + +// final state particles only + + if (genType == kPythia) { + if (mPart->GetStatusCode() != 1) continue; + } else if (genType == kHijing) { + if (child1 >= 0 && child1 < npart) continue; + } + + + TParticlePDG* pdgP = 0; +// charged or neutral + pdgP = mPart->GetPDG(); + chTmp = pdgP->Charge() / 3.; // 13-feb-2001!! + + if (ich == 0) { + if (chTmp == 0) { + if (!fK0N) { + continue; + } else { + if (mpart != kNeutron && + mpart != kNeutronBar && + mpart != kK0Long) continue; + } + } + } else if (ich == 2) { + if (mpart == kNeutron || + mpart == kNeutronBar || + mpart == kK0Long) continue; + } + + if (TMath::Abs(eta)<=0.9) fNChTpc++; +// final state only + if (child1 >= 0 && child1 < npart) continue; +// acceptance cut + if (eta > fEtaMax || eta < fEtaMin) continue; + if (phi > fPhiMax || phi < fPhiMin ) continue; +// + if (fDebug >= 3) + printf("\n=>nsel:%5d mpart %5d child1 %5d eta %6.2f phi %6.2f pT %6.2f ch %3.0f ", + part, mpart, child1, eta, phi, pT, chTmp); +// +// +// Momentum smearing goes here ... +// + fhTrackPt->Fill(pT); + Float_t pw; + if (fSmear && TMath::Abs(chTmp)) { + pw = AliEMCALFast::SmearMomentum(1,p); + // p changed - take into account when calculate pT, + // pz and so on .. ? + pT = (pw/p) * pT; + if(fDebug >= 4) printf("\n Smearing : p %8.4f change to %8.4f ", p, pw); + p = pw; + } +// +// Tracking Efficiency and TPC acceptance goes here ... + Float_t eff; + if (fEffic && TMath::Abs(chTmp)) { + eff = 0.9; // AliEMCALFast::Efficiency(2,p); + if(fhEff) fhEff->Fill(p, eff); + if (AliEMCALFast::RandomReject(eff)) { + if(fDebug >= 5) printf(" reject due to unefficiency "); + continue; + } + } +// +// Correction of Hadronic Energy goes here ... +// +// +// phi propagation for hadronic correction + + Bool_t curls = kFALSE; // hit two the EMCAL (no curl) + Float_t phiHC=0.0, dpH=0.0, dphi=0.0, eTdpH=0; + if(TMath::Abs(chTmp)) { + // hadr. correction only for charge particle + dphi = PropagatePhi(pT, chTmp, curls); + phiHC = phi + dphi; + if (fDebug >= 6) { + printf("\n Delta phi %f pT %f ", dphi, pT); + if (curls) printf("\n !! Track is curling"); + } + if(!curls) fhTrackPtBcut->Fill(pT); + + if (fHCorrection && !curls) { + if (!fHadronCorrector) + Fatal("AliEMCALJetFinder", + "Hadronic energy correction required but not defined !"); + + dpH = fHadronCorrector->GetEnergy(p, eta, 7); + eTdpH = dpH*TMath::Sin(theta); + + if (fDebug >= 7) printf(" phi %f phiHC %f eTcorr %f\n", + phi, phiHC, -eTdpH); // correction is negative + Int_t xbin,ybin; + xbin = fLego->GetXaxis()->FindBin(eta); + ybin = fLego->GetYaxis()->FindBin(phiHC); + cout <<"Hadron Correction affected bin - contents before correction : "<GetBinContent(xbin,ybin)<Fill(eta, phi, -fSamplingF*eTdpH ); + cout <<"Hadron Correction affected bin - contents after correction : "<GetBinContent(xbin,ybin)<Fill(eta, phi, fSamplingF*eTdpH); + } + } +// +// More to do ? Just think about it ! +// + if (phi > fPhiMax || phi < fPhiMin ) continue; + + if(TMath::Abs(chTmp) ) { // charge particle + if (pT > fPtCut && !curls) { + if (fDebug >= 8) printf("Charge : fLego->Fill(%5.2f, %5.2f, %6.2f, %d)\n", + eta , phi, pT, fNtS); + fLego->Fill(eta, phi, pT); + fhLegoTracks->Fill(eta, phi, pT); // 20-feb for checking + fTrackList[part] = 1; + fNtS++; + } + } else if(ich > 0 || fK0N) { + // case of n, nbar and K0L + if (fDebug >= 9) printf("Neutral : fLego->Fill(%5.2f, %5.2f, %6.2f, %d)\n", + eta , phi, pT, fNtS); + fLego->Fill(eta, phi, pT); + fTrackList[part] = 1; + fNtS++; + } + } // primary loop + Float_t etsum = 0.; + for(Int_t i=0; iGetSize(); i++) { + Float_t etc = (*fLego)[i]; + if (etc > fMinCellEt) etsum += etc; + } + + printf("FillFromTracks: Sum above threshold %f -> %f (%f)\n", fMinCellEt, etsum, fLego->Integral()); + printf(" Track selected(fNtS) %i \n", fNtS); + + DumpLego(); +} + +void AliEMCALJetFinder::FillFromHits(Int_t flag) +{ +// +// Fill Cells with hit information +// +// + if (fDebug >= 2) + printf("\n AliEMCALJetFinder::FillFromHits(%i)\n",flag); + + ResetMap(); + + if (!fLego) BookLego(); +// Reset eta-phi maps if needed + if (flag == 0) { // default behavior + fLego->Reset(); + fhLegoTracks->Reset(); + fhLegoEMCAL->Reset(); + fhLegoHadrCorr->Reset(); + } +// Initialize from background event if available +// +// Access hit information + AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); + AliLoader *emcalLoader = AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"); + TTree *treeH = emcalLoader->TreeH(); + Int_t ntracks = (Int_t) treeH->GetEntries(); +// +// Loop over tracks +// + Int_t nbytes = 0; + // Double_t etH = 0.0; + + for (Int_t track=0; trackResetHits(); + nbytes += treeH->GetEvent(track); +// +// Loop over hits +// + for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1); + mHit; + mHit=(AliEMCALHit*) pEMCAL->NextHit()) + { + Float_t x = mHit->X(); // x-pos of hit + Float_t y = mHit->Y(); // y-pos + Float_t z = mHit->Z(); // z-pos + Float_t eloss = mHit->GetEnergy(); // deposited energy + + Float_t r = TMath::Sqrt(x*x+y*y); + Float_t theta = TMath::ATan2(r,z); + Float_t eta = -TMath::Log(TMath::Tan(theta/2.)); + Float_t phi = TMath::ATan2(y,x); + + if (fDebug >= 21) printf("\n Hit %f %f %f %f %f %f %f %f", x, y, z, eloss, r, eta, phi, fSamplingF); + + // etH = fSamplingF*eloss*TMath::Sin(theta); + fLego->Fill(eta, phi, eloss); + } // Hit Loop + } // Track Loop + + // Transition from deposit energy to eT (eT = de*SF*sin(theta)) + Double_t etsum = 0; + for(Int_t i=1; i<=fLego->GetNbinsX(); i++){ // eta + Double_t sinTheta = fhSinTheta->GetBinContent(i), eT=0; + for(Int_t j=1; j<=fLego->GetNbinsY(); j++){ // phi + eT = fLego->GetBinContent(i,j)*fSamplingF*sinTheta; + fLego->SetBinContent(i,j,eT); + // copy content of fLego to fhLegoEMCAL (fLego and fhLegoEMCAL are identical) + fhLegoEMCAL->SetBinContent(i,j,eT); + if (eT > fMinCellEt) etsum += eT; + } + } + + // for(Int_t i=0; iGetSize(); i++) { + // (*fhLegoEMCAL)[i] = (*fLego)[i]; + // Float_t etc = (*fLego)[i]; + // if (etc > fMinCellEt) etsum += etc; + // } + + printf("FillFromHits: Sum above threshold %f -> %f \n ", fMinCellEt, etsum); + // DumpLego(); ?? +} + +void AliEMCALJetFinder::FillFromDigits(Int_t flag) +{ +// +// Fill Cells with digit information +// +// + ResetMap(); + + if (!fLego) BookLego(); + if (flag == 0) fLego->Reset(); + Int_t nbytes=0; + + +// +// Connect digits +// + TClonesArray* digs = new TClonesArray("AliEMCALDigit", 10000); + TTree *treeD = gAlice->TreeD(); + TBranchElement* branchDg = (TBranchElement*) + treeD->GetBranch("EMCAL"); + + if (!branchDg) Fatal("AliEMCALJetFinder", + "Reading digits requested but no digits in file !"); + + branchDg->SetAddress(&digs); + Int_t nent = (Int_t) branchDg->GetEntries(); +// +// Connect digitizer +// + AliEMCALDigitizer* digr = new AliEMCALDigitizer(); + TBranchElement* branchDr = (TBranchElement*) + treeD->GetBranch("AliEMCALDigitizer"); + branchDr->SetAddress(&digr); +// +// + nbytes += branchDg->GetEntry(0); + nbytes += branchDr->GetEntry(0); +// +// Get digitizer parameters + Float_t ecADCped = digr->GetECApedestal(); + Float_t ecADCcha = digr->GetECAchannel(); + + AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); + AliEMCALGeometry* geom = + AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), ""); + + if (fDebug) { + Int_t ndig = digs->GetEntries(); + Info("FillFromDigits","Number of Digits: %d %d\n Parameters: EC: %f %f\n Geometry: %d %d", + ndig, nent, ecADCped, ecADCcha, geom->GetNEta(), geom->GetNPhi()); + } + +// +// Loop over digits + AliEMCALDigit* sdg; + TIter next(digs); + while ((sdg = (AliEMCALDigit*)(next()))) + { + Double_t pedestal = 0.; + Double_t channel = 0.; + if (geom->IsInECA(sdg->GetId())) { + pedestal = ecADCped; + channel = ecADCcha; + } + else + Fatal("FillFromDigits", "unexpected digit is number!") ; + + Float_t eta = sdg->GetEta(); + Float_t phi = sdg->GetPhi() * TMath::Pi()/180.; + Float_t amp = (Float_t) (channel*(sdg->GetAmp())-pedestal); + + if (fDebug > 1) + Info("FillFromDigits", "Digit: eta %8.3f phi %8.3f amp %8.3f %8d", + eta, phi, amp, sdg->GetAmp()); + + fLego->Fill(eta, phi, fSamplingF*amp); + } // digit loop +// +// Dump lego hist + DumpLego(); +} + + +void AliEMCALJetFinder::FillFromHitFlaggedTracks(Int_t flag) +{ +// +// Fill Cells with hit information +// +// + ResetMap(); + + if (!fLego) BookLego(); +// Reset + if (flag == 0) fLego->Reset(); + +// Flag charged tracks passing through TPC which +// are associated to EMCAL Hits + BuildTrackFlagTable(); + +// +// Access particle information + TTree *treeK = gAlice->TreeK(); + Int_t ntracks = (Int_t) treeK->GetEntries(); + + if (fPtT) delete[] fPtT; + if (fEtaT) delete[] fEtaT; + if (fPhiT) delete[] fPhiT; + if (fPdgT) delete[] fPdgT; + + fPtT = new Float_t[ntracks]; + fEtaT = new Float_t[ntracks]; + fPhiT = new Float_t[ntracks]; + fPdgT = new Int_t[ntracks]; + + fNt = ntracks; + fNtS = 0; + + for (Int_t track = 0; track < ntracks; track++) { + TParticle *mPart = gAlice->GetMCApp()->Particle(track); + Float_t pT = mPart->Pt(); + Float_t phi = mPart->Phi(); + Float_t eta = mPart->Eta(); + + if(fTrackList[track]) { + fPtT[track] = pT; + fEtaT[track] = eta; + fPhiT[track] = phi; + fPdgT[track] = mPart->GetPdgCode(); + + if (track < 2) continue; //Colliding particles? + if (pT == 0 || pT < fPtCut) continue; + fNtS++; + fLego->Fill(eta, phi, pT); + } + } // track loop + DumpLego(); +} + +void AliEMCALJetFinder::FillFromParticles() +{ +// 26-feb-2002 PAI - for checking all chain +// Work on particles level; accept all particle (not neutrino ) + + Double_t pX=0, pY=0, pZ=0, energy=0; // checking conservation law + fNChTpc = 0; + + ResetMap(); + if (!fLego) BookLego(); + fLego->Reset(); +// +// Access particles information + Int_t npart = (gAlice->GetHeader())->GetNprimary(); + if (fDebug >= 2 || npart<=0) { + printf(" AliEMCALJetFinder::FillFromParticles : npart %i\n", npart); + if(npart<=0) return; + } + fNt = npart; + fNtS = 0; + RearrangeParticlesMemory(npart); + +// Go through the particles + Int_t mpart, child1, child2, geantPdg; + Float_t pT, phi, eta, e=0, px=0, py=0, pz=0; + TParticle *mPart=0; + for (Int_t part = 0; part < npart; part++) { + + fTrackList[part] = 0; + + mPart = gAlice->GetMCApp()->Particle(part); + mpart = mPart->GetPdgCode(); + child1 = mPart->GetFirstDaughter(); + child2 = mPart->GetLastDaughter(); + pT = mPart->Pt(); + phi = mPart->Phi(); + eta = mPart->Eta(); + + px = mPart->Px(); + py = mPart->Py(); + pz = mPart->Pz(); + e = mPart->Energy(); + +// see pyedit in Pythia's text + geantPdg = mpart; + if (IsThisPartonsOrDiQuark(mpart)) continue; + printf("%5i: %5i(%2i) px %5.1f py %5.1f pz %6.1f e %6.1f childs %5i,%5i \n", + part, mpart, geantPdg, px, py, pz, e, child1, child2); + +// exclude partons (21 - gluon, 92 - string) + + +// exclude neutrinous also ?? + if (fDebug >= 11 && pT>0.01) + printf("\n part:%5d mpart %5d eta %9.2f phi %9.2f pT %9.2f ", + part, mpart, eta, phi, pT); + + fPtT[part] = pT; + fEtaT[part] = eta; + fPhiT[part] = phi; + fPdgT[part] = mpart; + fNtS++; + +// final state only + if (child1 >= 0 && child1 < npart) continue; + + // printf("%4i -> %5i(%3i) px %6.1f py %6.1f pz %7.1f e %8.2f child1 %5i %s\n", + // part, mpart, geantPdg, px, py, pz, e, child1, name.Data()); + pX += px; + pY += py; + pZ += pz; + energy += e; + + + if (TMath::Abs(eta) <= 0.9) fNChTpc++; +// acceptance cut + if (eta > fEtaMax || eta < fEtaMin) continue; + if (phi > fPhiMax || phi < fPhiMin ) continue; +// + if(fK0N==0 ) { // exclude neutral hadrons + if (mpart == kNeutron || mpart == kNeutronBar || mpart == kK0Long) continue; + } + fTrackList[part] = 1; + fLego->Fill(eta, phi, pT); + + } // primary loop + printf("\n PX %8.2f PY %8.2f PZ %8.2f E %8.2f \n", + pX, pY, pZ, energy); + DumpLego(); + if(fhChPartMultInTpc) fhChPartMultInTpc->Fill(fNChTpc); +} + +void AliEMCALJetFinder::FillFromPartons() +{ +// function under construction - 13-feb-2002 PAI + + if (fDebug >= 2) + printf("\n AliEMCALJetFinder::FillFromPartons()\n"); + // + + ResetMap(); + if (!fLego) BookLego(); + fLego->Reset(); +// +// Access particle information + Int_t npart = (gAlice->GetHeader())->GetNprimary(); + if (fDebug >= 2 || npart<=0) + printf("\n AliEMCALJetFinder::FillFromPartons : npart %i\n", npart); + fNt = 0; // for FindTracksInJetCone + fNtS = 0; + +// Go through the partons + Int_t statusCode=0; + for (Int_t part = 8; part < npart; part++) { + TParticle *mPart = gAlice->GetMCApp()->Particle(part); + Int_t mpart = mPart->GetPdgCode(); + // Int_t child1 = MPart->GetFirstDaughter(); + Float_t pT = mPart->Pt(); + // Float_t p = MPart->P(); + Float_t phi = mPart->Phi(); + Float_t eta = mPart->Eta(); + // Float_t theta = MPart->Theta(); + statusCode = mPart->GetStatusCode(); + +// accept partons (21 - gluon, 92 - string) + if (!(TMath::Abs(mpart) <= 6 || mpart == 21 ||mpart == 92)) continue; + if (fDebug > 1 && pT>0.01) + printf("\n part:%5d mpart %5d status %5d eta %8.2f phi %8.2f pT %8.2f ", + part, mpart, statusCode, eta, phi, pT); + // if (fDebug >= 3) MPart->Print(); +// accept partons before fragmentation - p.57 in Pythia manual +// if(statusCode != 1) continue; +// acceptance cut + if (eta > fEtaMax || eta < fEtaMin) continue; + if (phi > fPhiMax || phi < fPhiMin ) continue; +// final state only +// if (child1 >= 0 && child1 < npart) continue; +// +// + fLego->Fill(eta, phi, pT); + + } // primary loop + DumpLego(); +} + +void AliEMCALJetFinder::BuildTrackFlagTable() { + +// Method to generate a lookup table for TreeK particles +// which are linked to hits in the EMCAL +// +// --Author: J.L. Klay +// +// Access hit information + AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); + + TTree *treeK = gAlice->TreeK(); // Get the number of entries in the kine tree + Int_t nKTrks = (Int_t) treeK->GetEntries(); // (Number of particles created somewhere) + + if(fTrackList) delete[] fTrackList; //Make sure we get rid of the old one + fTrackList = new Int_t[nKTrks]; //before generating a new one + + for (Int_t i = 0; i < nKTrks; i++) { //Initialize members to 0 + fTrackList[i] = 0; + } + + AliLoader *emcalLoader = AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL"); + //AliEMCALGetter * gime = AliEMCALGetter::Instance() ; + // TTree *treeH = gAlice->TreeH(); + TTree *treeH = emcalLoader->TreeH(); + Int_t ntracks = (Int_t) treeH->GetEntries(); +// +// Loop over tracks +// + Int_t nbytes = 0; + + for (Int_t track=0; trackResetHits(); + nbytes += treeH->GetEvent(track); + if (pEMCAL) { + +// +// Loop over hits +// + for(AliEMCALHit* mHit=(AliEMCALHit*) pEMCAL->FirstHit(-1); + mHit; + mHit=(AliEMCALHit*) pEMCAL->NextHit()) + { + Int_t iTrk = mHit->Track(); // track number + Int_t idprim = mHit->GetPrimary(); // primary particle + + //Determine the origin point of this particle - it made a hit in the EMCAL + TParticle *trkPart = gAlice->GetMCApp()->Particle(iTrk); + TParticlePDG *trkPdg = trkPart->GetPDG(); + Int_t trkCode = trkPart->GetPdgCode(); + Double_t trkChg; + if (trkCode < 10000) { //Big Ions cause problems for + trkChg = trkPdg->Charge(); //this function. Since they aren't + } else { //likely to make it very far, set + trkChg = 0.0; //their charge to 0 for the Flag test + } + Float_t vxTrk = trkPart->Vx(); + Float_t vyTrk = trkPart->Vy(); + Float_t vrTrk = TMath::Sqrt(vxTrk*vxTrk+vyTrk*vyTrk); + fTrackList[iTrk] = SetTrackFlag(vrTrk,trkCode,trkChg); + + //Loop through the ancestry of the EMCAL entrance particles + Int_t ancestor = trkPart->GetFirstMother(); //Get track's Mother + while (ancestor != -1) { + TParticle *ancPart = gAlice->GetMCApp()->Particle(ancestor); //get particle info on ancestor + TParticlePDG *ancPdg = ancPart->GetPDG(); + Int_t ancCode = ancPart->GetPdgCode(); + Double_t ancChg; + if (ancCode < 10000) { + ancChg = ancPdg->Charge(); + } else { + ancChg = 0.0; + } + Float_t vxAnc = ancPart->Vx(); + Float_t vyAnc = ancPart->Vy(); + Float_t vrAnc = TMath::Sqrt(vxAnc*vxAnc+vyAnc*vyAnc); + fTrackList[ancestor] = SetTrackFlag(vrAnc,ancCode,ancChg); + ancestor = ancPart->GetFirstMother(); //Get the next ancestor + } + + //Determine the origin point of the primary particle associated with the hit + TParticle *primPart = gAlice->GetMCApp()->Particle(idprim); + TParticlePDG *primPdg = primPart->GetPDG(); + Int_t primCode = primPart->GetPdgCode(); + Double_t primChg; + if (primCode < 10000) { + primChg = primPdg->Charge(); + } else { + primChg = 0.0; + } + Float_t vxPrim = primPart->Vx(); + Float_t vyPrim = primPart->Vy(); + Float_t vrPrim = TMath::Sqrt(vxPrim*vxPrim+vyPrim*vyPrim); + fTrackList[idprim] = SetTrackFlag(vrPrim,primCode,primChg); + } // Hit Loop + } //if (pEMCAL) + } // Track Loop +} + +Int_t AliEMCALJetFinder +::SetTrackFlag(Float_t radius, Int_t code, Double_t charge) { +// Set the flag for the track + Int_t flag = 0; + Int_t parton = 0; + Int_t neutral = 0; + + if (charge == 0) neutral = 1; + + if (TMath::Abs(code) <= 6 || + code == 21 || + code == 92) parton = 1; + + //It's not a parton, it's charged and it went through the TPC + if (!parton && !neutral && radius <= 84.0) flag = 1; + + return flag; +} + + + +void AliEMCALJetFinder::SaveBackgroundEvent(const char *name) +{ +// Saves the eta-phi lego and the tracklist and name of file with BG events +// + if (fLegoB) { + fLegoB->Reset(); + (*fLegoB) = (*fLegoB) + (*fLego); + // if(fDebug) + printf("\n AliEMCALJetFinder::SaveBackgroundEvent() (fLegoB) %f = %f(fLego) \n", + fLegoB->Integral(), fLego->Integral()); + } + + if (fPtB) delete[] fPtB; + if (fEtaB) delete[] fEtaB; + if (fPhiB) delete[] fPhiB; + if (fPdgB) delete[] fPdgB; + if (fTrackListB) delete[] fTrackListB; + + fPtB = new Float_t[fNtS]; + fEtaB = new Float_t[fNtS]; + fPhiB = new Float_t[fNtS]; + fPdgB = new Int_t [fNtS]; + fTrackListB = new Int_t [fNtS]; + + fNtB = 0; + + for (Int_t i = 0; i < fNt; i++) { + if (!fTrackList[i]) continue; + fPtB [fNtB] = fPtT [i]; + fEtaB[fNtB] = fEtaT[i]; + fPhiB[fNtB] = fPhiT[i]; + fPdgB[fNtB] = fPdgT[i]; + fTrackListB[fNtB] = 1; + fNtB++; + } + fBackground = 1; + printf(" fNtB %i => fNtS %i #particles %i \n", fNtB, fNtS, fNt); + + if(strlen(name) == 0) { + TSeqCollection *li = gROOT->GetListOfFiles(); + TString nf; + for(Int_t i=0; iGetSize(); i++) { + nf = ((TFile*)li->At(i))->GetName(); + if(nf.Contains("backgorund")) break; + } + fBGFileName = nf; + } else { + fBGFileName = name; + } + printf("BG file name is \n %s\n", fBGFileName.Data()); +} + +void AliEMCALJetFinder::InitFromBackground() +{ +// +// + if (fDebug) printf("\n AliEMCALJetFinder::InitFromBackground() "); + + if (fLego) { + fLego->Reset(); + (*fLego) = (*fLego) + (*fLegoB); + if(fDebug) + printf("\n AliEMCALJetFinder::InitBackgroundEvent() (fLego) %f = %f(fLegoB) \n", + fLego->Integral(), fLegoB->Integral()); + } else { + printf(" => fLego undefined \n"); + } +} + + +void AliEMCALJetFinder::FindTracksInJetCone() +{ +// +// Build list of tracks inside jet cone +// +// Loop over jets + Int_t njet = Njets(); + for (Int_t nj = 0; nj < njet; nj++) + { + Float_t etaj = JetEtaW(nj); + Float_t phij = JetPhiW(nj); + Int_t nT = 0; // number of associated tracks + +// Loop over particles in current event + for (Int_t part = 0; part < fNt; part++) { + if (!fTrackList[part]) continue; + Float_t phi = fPhiT[part]; + Float_t eta = fEtaT[part]; + Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) + + (phij-phi)*(phij-phi)); + if (dr < fConeRadius) { + fTrackList[part] = nj+2; + nT++; + } // < ConeRadius ? + } // particle loop + +// Same for background event if available + Int_t nTB = 0; + if (fBackground) { + for (Int_t part = 0; part < fNtB; part++) { + Float_t phi = fPhiB[part]; + Float_t eta = fEtaB[part]; + Float_t dr = TMath::Sqrt((etaj-eta)*(etaj-eta) + + (phij-phi)*(phij-phi)); + fTrackListB[part] = 1; + + if (dr < fConeRadius) { + fTrackListB[part] = nj+2; + nTB++; + } // < ConeRadius ? + } // particle loop + } // Background available ? + + Int_t nT0 = nT + nTB; + printf("Total number of tracks %d\n", nT0); + + if (nT0 > 1000) nT0 = 1000; + + Float_t* ptT = new Float_t[nT0]; + Float_t* etaT = new Float_t[nT0]; + Float_t* phiT = new Float_t[nT0]; + Int_t* pdgT = new Int_t[nT0]; + + Int_t iT = 0; + Int_t j; + + for (Int_t part = 0; part < fNt; part++) { + if (fTrackList[part] == nj+2) { + Int_t index = 0; + for (j=iT-1; j>=0; j--) { + if (fPtT[part] > ptT[j]) { + index = j+1; + break; + } + } + for (j=iT-1; j>=index; j--) { + ptT [j+1] = ptT [j]; + etaT[j+1] = etaT[j]; + phiT[j+1] = phiT[j]; + pdgT[j+1] = pdgT[j]; + } + ptT [index] = fPtT [part]; + etaT[index] = fEtaT[part]; + phiT[index] = fPhiT[part]; + pdgT[index] = fPdgT[part]; + iT++; + } // particle associated + if (iT > nT0) break; + } // particle loop + + if (fBackground) { + for (Int_t part = 0; part < fNtB; part++) { + if (fTrackListB[part] == nj+2) { + Int_t index = 0; + for (j=iT-1; j>=0; j--) { + if (fPtB[part] > ptT[j]) { + index = j+1; + + break; + } + } + for (j=iT-1; j>=index; j--) { + ptT [j+1] = ptT [j]; + etaT[j+1] = etaT[j]; + phiT[j+1] = phiT[j]; + pdgT[j+1] = pdgT[j]; + } + ptT [index] = fPtB [part]; + etaT[index] = fEtaB[part]; + phiT[index] = fPhiB[part]; + pdgT[index] = fPdgB[part]; + iT++; + } // particle associated + if (iT > nT0) break; + } // particle loop + } // Background available ? + + fJetT[nj]->SetTrackList(nT0, ptT, etaT, phiT, pdgT); + delete[] ptT; + delete[] etaT; + delete[] phiT; + delete[] pdgT; + + } // jet loop loop +} + +Float_t AliEMCALJetFinder::PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls) +{ +// Propagates phi angle to EMCAL radius +// + static Float_t b = 0.0, rEMCAL = -1.0; +// Get field in kGS + b = gAlice->Field()->SolenoidField(); +// Get EMCAL radius in cm + rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance(); + Float_t dPhi = 0.; +// +// +// bending radies +// pt [Gev] +// B [kG] +// + Float_t rB = 3335.6 * pt / b; // [cm] (case of |charge|=1) +// +// check if particle is curling below EMCAL + if (2.*rB < rEMCAL) { + curls = kTRUE; + return dPhi; + } +// +// if not calculate delta phi + Float_t phi = TMath::ACos(1.-rEMCAL*rEMCAL/(2.*rB*rB)); + dPhi = TMath::ATan2(1.-TMath::Cos(phi), TMath::Sin(phi)); + dPhi = -TMath::Sign(dPhi, charge); +// + return dPhi; +} + +void hf1(Int_t& , Float_t& , Float_t& ) +{ +// dummy for hbook calls + ; +} + +void AliEMCALJetFinder::DrawLego(const char *opt) +{ +// Draw lego + if(fLego) fLego->Draw(opt); +} + +void AliEMCALJetFinder::DrawLegoBackground(const char *opt) +{ +// Draw background lego + if(fLegoB) fLegoB->Draw(opt); +} + +void AliEMCALJetFinder::DrawLegoEMCAL(const char *opt) +{ +// Draw EMCAL Lego + if(fhLegoEMCAL) fhLegoEMCAL->Draw(opt); +} + +void AliEMCALJetFinder::DrawHistsForTuning(Int_t mode) +{ +// Draw all hists + static TPaveText *varLabel=0; + if(!fC1) { + fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800); + } + fC1->Clear(); + fC1->Divide(2,2); + fC1->cd(1); + gPad->SetLogy(1); + fhCellEt->Draw(); + + fC1->cd(2); + gPad->SetLogy(1); + fhCellEMCALEt->Draw(); + + fC1->cd(3); + gPad->SetLogy(1); + fhTrackPt->Draw(); + fhTrackPtBcut->SetLineColor(2); + fhTrackPtBcut->Draw("same"); + + fC1->cd(4); + if(!varLabel) { + PrintParameters(1); + varLabel = new TPaveText(0.05,0.5,0.95,0.95,"NDC"); + varLabel->SetTextAlign(12); + varLabel->SetFillColor(19); // see TAttFill + TString tmp(GetTitle()); + varLabel->ReadFile(GetFileNameForParameters()); + } + varLabel->Draw(); + fC1->Update(); + if(mode) { // for saving picture to the file + TString stmp(GetFileNameForParameters()); + stmp.ReplaceAll("_Par.txt",".ps"); + fC1->Print(stmp.Data()); + } +} + +void AliEMCALJetFinder::PrintParameters(Int_t mode) +{ +// Print all parameters out + + FILE *file=0; + if(mode==0) file = stdout; // output to terminal + else { + file = fopen(GetFileNameForParameters(),"w"); + if(file==0) file = stdout; + } + fprintf(file,"==== Filling lego ==== \n"); + fprintf(file,"Sampling fraction %6.3f ", fSamplingF); + fprintf(file,"Smearing %6i ", fSmear); + fprintf(file,"Efficiency %6i\n", fEffic); + fprintf(file,"Hadr.Correct. %6i ", fHCorrection); + fprintf(file,"P_{T} Cut of ch.par. %6.2f\n", fPtCut); + fprintf(file,"==== Jet finding ==== \n"); + fprintf(file,"Cone radius %6.2f ", fConeRadius); + fprintf(file,"Seed E_{T} %6.1f\n", fEtSeed); + fprintf(file,"Min E_{T} of cell %6.1f ", fMinCellEt); + fprintf(file,"Min E_{T} of jet %6.1f\n", fMinJetEt); + if(fMode) { + fprintf(file,"==== Bg subtraction ==== \n"); + fprintf(file,"BG subtraction %6i ", fMode); + fprintf(file,"Min cone move %6.2f\n", fMinMove); + fprintf(file,"Max cone move %6.2f ", fMaxMove); + fprintf(file,"%% change for BG %6.4f\n", fPrecBg); + } else + fprintf(file,"==== No Bg subtraction ==== \n"); + // + printf("BG file name is %s \n", fBGFileName.Data()); + if(file != stdout) fclose(file); +} + +void AliEMCALJetFinder::DrawLegos() +{ +// Draw all legos + if(!fC1) { + fC1 = new TCanvas("C1","Hists. for tunning", 0,25,600,800); + } + fC1->Clear(); + fC1->Divide(2,2); + gStyle->SetOptStat(111111); + + Int_t nent1, nent2, nent3, nent4; + Double_t int1, int2, int3, int4; + nent1 = (Int_t)fLego->GetEntries(); + int1 = fLego->Integral(); + fC1->cd(1); + if(int1) fLego->Draw("lego"); + + nent2 = (Int_t)fhLegoTracks->GetEntries(); + int2 = fhLegoTracks->Integral(); + fC1->cd(2); + if(int2) fhLegoTracks->Draw("lego"); + + nent3 = (Int_t)fhLegoEMCAL->GetEntries(); + int3 = fhLegoEMCAL->Integral(); + fC1->cd(3); + if(int3) fhLegoEMCAL->Draw("lego"); + + nent4 = (Int_t)fhLegoHadrCorr->GetEntries(); + int4 = fhLegoHadrCorr->Integral(); + fC1->cd(4); + if(int4) fhLegoHadrCorr->Draw("lego"); + + // just for checking + printf(" Integrals \n"); + printf("lego %10.3f \ntrack %10.3f \nhits %10.3f \nHCorr %10.3f\n-- %10.3f(must be 0)\n", + int1, int2, int3, int4, int1 - (int2 + int3 - int4)); +} + +const Char_t* AliEMCALJetFinder::GetFileNameForParameters(const char* dir) +{ +// Get paramters from a file + static TString tmp; + if(strlen(dir)) tmp = dir; + tmp += GetTitle(); + tmp += "_Par.txt"; + return tmp.Data(); +} + +void AliEMCALJetFinder::RearrangeParticlesMemory(Int_t npart) +{ + // See FillFromTracks() - npart must be positive + if (fTrackList) delete[] fTrackList; + if (fPtT) delete[] fPtT; + if (fEtaT) delete[] fEtaT; + if (fPhiT) delete[] fPhiT; + if (fPdgT) delete[] fPdgT; + + if(npart>0) { + fTrackList = new Int_t [npart]; + fPtT = new Float_t[npart]; + fEtaT = new Float_t[npart]; + fPhiT = new Float_t[npart]; + fPdgT = new Int_t[npart]; + } else { + printf("AliEMCALJetFinder::RearrangeParticlesMemory : npart = %d\n", npart); + } +} + +Bool_t AliEMCALJetFinder::IsThisPartonsOrDiQuark(Int_t pdg) +{ +// Return quark info + Int_t absPdg = TMath::Abs(pdg); + if(absPdg<=6) return kTRUE; // quarks + if(pdg == 21) return kTRUE; // gluon + if(pdg == 92) return kTRUE; // string + + // see p.51 of Pythia Manual + // Not include diquarks with c and b quark - 4-mar-2002 + // ud_0,sd_0,su_0; dd_1,ud_1,uu_1; sd_1,su_1,ss_1 + static Int_t diquark[9]={2101,3101,3201, 1103,2103,2203, 3103,3203,3303}; + for(Int_t i=0; i<9; i++) if(absPdg == diquark[i]) return kTRUE; // diquarks + + return kFALSE; +} + +void AliEMCALJetFinder::FindChargedJet() +{ +// +// Find jet from charged particle information only +// + +// +// Look for seeds +// + Int_t njets = 0; + Int_t part = 0; + Int_t nseed = 0; + +// +// + ResetJets(); + +// + for (part = 0; part < fNt; part++) { + if (!fTrackList[part]) continue; + if (fPtT[part] > fEtSeed) nseed++; + } + printf("\nThere are %d seeds (%d)\n", nseed, fNtS); + Int_t* iSeeds = new Int_t[nseed]; + nseed = 0; + + for (part = 0; part < fNt; part++) { + if (!fTrackList[part]) continue; + if (fPtT[part] > fEtSeed) iSeeds[nseed++] = part; + } + +// +// Loop over seeds +// + Int_t seed = 0; + Float_t pt; + + while(1){ +// +// Find seed with highest pt +// + Float_t ptmax = -1.; + Int_t index = -1; + Int_t jndex = -1; + for (seed = 0; seed < nseed; seed++) { + if ((pt = fPtT[iSeeds[seed]]) > ptmax && iSeeds[seed] != -1) { + ptmax = pt; + index = seed; + } // ptmax ? + } // seeds + if (ptmax < 0.) break; + jndex = iSeeds[index]; +// +// Remove from the list + iSeeds[index] = -1; + printf("\n Next Seed %d %f", jndex, ptmax); +// +// Find tracks in cone around seed +// + Float_t phiSeed = fPhiT[jndex]; + Float_t etaSeed = fEtaT[jndex]; + Float_t eT = 0.; + Float_t pxJ = 0.; + Float_t pyJ = 0.; + Float_t pzJ = 0.; + + for (part = 0; part < fNt; part++) { + if (!fTrackList[part]) continue; + Float_t deta = fEtaT[part] - etaSeed; + Float_t dphi = fPhiT[part] - phiSeed; + Float_t dR = TMath::Sqrt(deta * deta + dphi * dphi); + if (dR < fConeRadius) { + eT += fPtT[part]; + Float_t theta = 2. * TMath::ATan(TMath::Exp(-fEtaT[part])); + Float_t px = fPtT[part] * TMath::Cos(fPhiT[part]); + Float_t py = fPtT[part] * TMath::Sin(fPhiT[part]); + Float_t pz = fPtT[part] / TMath::Tan(theta); + pxJ += px; + pyJ += py; + pzJ += pz; + // + // if seed, remove it + // + for (seed = 0; seed < nseed; seed++) { + if (part == iSeeds[seed]) iSeeds[seed] = -1; + } // seed ? + } // < cone radius + } // particle loop + +// +// Estimate of jet direction + Float_t phiJ = TMath::ATan2(pyJ, pxJ); + Float_t thetaJ = TMath::ATan2(TMath::Sqrt(pxJ * pxJ + pyJ * pyJ), pzJ); + Float_t etaJ = TMath::Log(TMath::Tan(thetaJ / 2.)); +// Float_t ptJ = TMath::Sqrt(pxJ * pxJ + pyJ * pyJ); + +// +// Sum up all energy +// + Int_t iPhi0 = Int_t((phiJ - fPhiMin) / fDphi); + Int_t iEta0 = Int_t((etaJ - fEtaMin) / fDeta); + Int_t dIphi = Int_t(fConeRadius / fDphi); + Int_t dIeta = Int_t(fConeRadius / fDeta); + Int_t iPhi, iEta; + Float_t sumE = 0; + for (iPhi = iPhi0 -dIphi; iPhi < iPhi0 + dIphi; iPhi++) { + for (iEta = iEta0 - dIeta; iEta < iEta0 + dIeta; iEta++) { + if (iPhi < 0 || iEta < 0) continue; + Float_t dPhi = fPhiMin + iPhi * fDphi; + Float_t dEta = fEtaMin + iEta * fDeta; + if (TMath::Sqrt(dPhi * dPhi + dEta * dEta) < fConeRadius) continue; + sumE += fLego->GetBinContent(iEta, iPhi); + } // eta + } // phi +// +// +// + fJetT[njets++] = new AliEMCALJet(sumE, phiJ, etaJ); + FindTracksInJetCone(); + printf("\n Jet Energy %f %f %f %f %d\n", eT, sumE, fPtT[6], fPtT[7], njets); + printf("\n Jet Phi %f %f %f \n", phiJ, fPhiT[6], fPhiT[7]); + printf("\n Jet Eta %f %f %f \n", etaJ, fEtaT[6], fEtaT[7]); + } // while(1) + EMCALJETS.njet = njets; + if (fWrite) WriteJets(); + fEvent++; +} +// 16-jan-2003 - just for convenience +void AliEMCALJetFinder::Browse(TBrowser* b) +{ +// Add to browser + if(fHistsList) b->Add((TObject*)fHistsList); +} + +Bool_t AliEMCALJetFinder::IsFolder() const +{ +// Return folder status + if(fHistsList) return kTRUE; + else return kFALSE; +} + +const Char_t* AliEMCALJetFinder::GetNameOfVariant() +{ + // generate the literal string with info about jet finder + Char_t name[200]; + sprintf(name, "jF_R%3.2fMinCell%4.1fPtCut%4.1fEtSeed%4.1fMinEt%4.1fBGSubtr%iSF%4.1f", + fConeRadius,fMinCellEt,fPtCut,fEtSeed,fMinJetEt, fMode, fSamplingF); + TString nt(name); + nt.ReplaceAll(" ",""); + if(fBGFileName.Length()) { + Int_t i1 = fBGFileName.Index("kBackground"); + Int_t i2 = fBGFileName.Index("/0000") - 1; + if(i1>=0 && i2>=0) { + TString bg(fBGFileName(i1,i2-i1+1)); + nt += bg; + } + } + printf(" Name of variant %s \n", nt.Data()); + return nt.Data(); +} diff --git a/EMCAL/jetfinder/AliEMCALJetFinder.h b/EMCAL/jetfinder/AliEMCALJetFinder.h new file mode 100644 index 00000000000..890d2d7b3b3 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinder.h @@ -0,0 +1,217 @@ +#ifndef ALIEMCALJETFINDER_H +#define ALIEMCALJETFINDER_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ +//*-- Author: +//*-- Andreas Morsch (CERN) + +#include +#include "AliEMCALJet.h" +#include + +class TClonesArray; +class TH2F; +class TH1F; +class TCanvas; +class TList; +class AliEMCALHadronCorrection; + +class AliEMCALJetFinder : public TTask { + friend class AliEMCALJetMicroDst; //PH Temporary solution + public: + AliEMCALJetFinder(); + AliEMCALJetFinder(const char* name, const char *title); + virtual ~AliEMCALJetFinder(); + virtual void Init(); + virtual void Find(Int_t ncell, Int_t ncelltot, Float_t etc[30000], + Float_t etac[30000], Float_t phic[30000], + Float_t minmove, Float_t maxmove, Int_t mode, + Float_t precbg, Int_t ierror); + virtual void Find(); + virtual void FindChargedJet(); + virtual void FindTracksInJetCone(); + virtual void Test(); + virtual void BuildTrackFlagTable(); + virtual Int_t SetTrackFlag(Float_t radius, Int_t pdgCode, Double_t charge); + // Geometry + virtual void SetCellSize(Float_t eta, Float_t phi); + // Parameters + virtual void SetDebug(Int_t flag = 0) {fDebug = flag;} + virtual void SetConeRadius(Float_t par); + virtual void SetEtSeed(Float_t par); + virtual void SetMinJetEt(Float_t par); + virtual void SetMinCellEt(Float_t par); + virtual void SetPtCut(Float_t par = 1.); + virtual void SetMomentumSmearing(Bool_t flag = kFALSE) {fSmear = flag;} + virtual void SetEfficiencySim(Bool_t flag = kFALSE) {fEffic = flag;} + virtual void SetSamplingFraction(Float_t par) {fSamplingF = par;} + virtual void SetEnergyWeightingFlag(Bool_t flag) {fWeightingMethod = flag;} + virtual void SetEMCALWeight(Float_t par) {fEMCALWeight = par;} + virtual void SetTrackWeight(Float_t par) {fTrackWeight = par;} + virtual void SetIncludeK0andN(Bool_t flag = kFALSE) {fK0N = flag;} + // Correction of hadronic energy + virtual void SetHadronCorrector(AliEMCALHadronCorrection* corr) + {fHadronCorrector = corr;} + virtual void SetHadronCorrection(Int_t flag = 1) {fHCorrection = flag;} + // PAI + void SetWriteKey(Bool_t flag = kFALSE) {fWrite = flag;} + void SetMode(Int_t mode = 0) {fMode = mode;} + void SetMinMove(Float_t minMove = 0.05) {fMinMove = minMove;} + void SetMaxMove(Float_t maxMove = 0.15) {fMaxMove = maxMove;} + void SetPrecBg (Float_t precBg = 0.035) {fPrecBg = precBg;} + void SetParametersForBgSubtraction + (Int_t mode=0, Float_t minMove=0.05, Float_t maxMove=0.15, Float_t precBg=0.035); + // virtual void Print(Option_t* option="") const; // *MENU* + void SetRandomBg(Bool_t flag) {fRandomBg = flag;} + Bool_t GetWriteKey() const {return fWrite;} + //AliEMCALJet* GetJetT() {return fJetT[0];} + AliEMCALJet* GetJetT(Int_t n = 0) {return fJetT[n];} + virtual void DrawHistsForTuning(Int_t mode=0); // *MENU* + virtual void PrintParameters(Int_t mode=0); // *MENU* + virtual const Char_t* GetFileNameForParameters(const char* dir="RES/"); + + // Access to Results + virtual Int_t Njets() const; + virtual Float_t JetEnergy (Int_t count) const; + virtual Float_t JetPhiL (Int_t count) const; + virtual Float_t JetPhiW (Int_t count) const ; + virtual Float_t JetEtaL (Int_t count) const ; + virtual Float_t JetEtaW (Int_t count) const; + TH2F* GetLego() const {return fLego;} + TH2F* GetLegoB() const {return fLegoB;} + TH2F* GetLegoEMCAL() const {return fhLegoEMCAL;} + TH2F* GetLegoTracks() const {return fhLegoTracks;} + TH2F* GethEff() const {return fhEff;} + TH1F* GetCellEt() const {return fhCellEt;} + TH1F* GetCellEMCALEt() const {return fhCellEMCALEt;} + TH1F* GetTrackPt() const {return fhTrackPt;} + TH1F* GetTrackPtBcut() const {return fhTrackPtBcut;} + TList* GetHistsList() const {return fHistsList;} + Int_t GetNChTpc() const {return fNChTpc;} + Bool_t GetEnergyWeightingFlag() const {return fWeightingMethod ;} + Float_t GetEMCALWeight() const {return fEMCALWeight;} + Float_t GetTrackWeight() const {return fTrackWeight;} + void DrawLego(const char *opt="lego"); // *MENU* + void DrawLegoEMCAL(const char *opt="lego"); // *MENU* + void DrawLegos(); // *MENU* + void DrawLegoBackground(const char *opt="lego"); // *MENU* + Bool_t IsThisPartonsOrDiQuark(Int_t pdg); + // I/O + virtual void SetOutputFileName(const char* name) {fOutFileName = name;} + virtual void FillFromHits(Int_t flag = 0); + virtual void FillFromHitFlaggedTracks(Int_t flag = 0); + virtual void FillFromDigits(Int_t flag = 0); + virtual void FillFromTracks(Int_t flag = 0, Int_t ich = 0); + virtual void FillFromParticles(); + virtual void FillFromPartons(); + + virtual void SaveBackgroundEvent(const char *name=""); + virtual void InitFromBackground(); + virtual void AddJet(const AliEMCALJet& jet); + virtual void WriteJets(); + virtual void ResetJets(); + virtual TClonesArray* Jets() const {return fJets;} + const char* GetNameOfVariant(); + + virtual Bool_t IsFolder() const; + virtual void Browse(TBrowser* b); + + + + + protected: + TString fBGFileName; // file name for background + Float_t fEMCALWeight; // EMCal energy weighting + Float_t fTrackWeight; // Track energy weighting + Bool_t fRandomBg; // Flag for Random Background + Bool_t fWrite; // Key for writing + Bool_t fWeightingMethod; // Key for writing + TClonesArray* fJets; //! List of Jets + TH2F* fLego; //! Lego Histo + TH2F* fLegoB; //! Lego Histo Backg + TH2F* fhLegoTracks; //! Lego for Tracks + TH2F* fhLegoEMCAL; //! Lego for EMCAL itself + TH2F* fhLegoHadrCorr; //! Lego for hadron correction + TH2F* fhEff; //! Hist. for controling eff. + TH1F* fhCellEt; //! Et distr. for cells from fLego + TH1F* fhCellEMCALEt; //! Et distr. for cells from fLegoEMCAL + TH1F* fhTrackPt; //! Pt distr. for charge particles + TH1F* fhTrackPtBcut; //! Pt distr. for charge particles + cut due to magnetic field + TH1F* fhChPartMultInTpc;//! Ch. part. multiplicity in TPC acceptance + TH1F* fhSinTheta; //! sin(theta) + TCanvas* fC1; //! first canvas for drawing + TList* fHistsList; //! List of hists - 4-mar-2002 + AliEMCALJet* fJetT[10]; //! Jet temporary storage + AliEMCALHadronCorrection* fHadronCorrector; //! Pointer to hadronic correction + Int_t fHCorrection; // Hadron correction flag + Int_t fDebug; //! Debug flag + Int_t fBackground; //! Background flag + Float_t fConeRadius; // Cone radius + Float_t fPtCut; // Pt cut on charged tracks + Float_t fEtSeed; // Min. Et for seed + Float_t fMinJetEt; // Min Et of jet + Float_t fMinCellEt; // Min Et in one cell + Float_t fSamplingF; // Sampling Fraction + Bool_t fSmear; // Flag for momentum smearing + Bool_t fEffic; // Flag for efficiency simulation + Bool_t fK0N; // Flag for efficiency simulation + Int_t fNjets; //! Number of Jetsp + Float_t fDeta; //! eta cell size + Float_t fDphi; //! phi cell size + Int_t fNcell; //! number of cells + Int_t fNtot; //! total number of cells + Int_t fNbinEta; //! number of cells in eta + Int_t fNbinPhi; //! number of cells in phi + Float_t fEtaMin; //! minimum eta + Float_t fEtaMax; //! maximum eta + Float_t fPhiMin; //! minimun phi + Float_t fPhiMax; //! maximum phi + Float_t fEtCell[30000]; //! Cell Energy + Float_t fEtaCell[30000]; //! Cell eta + Float_t fPhiCell[30000]; //! Cell phi + Int_t fNt; //! number of tracks + Int_t fNChTpc; //! number of ch.part in TPC + + Int_t fNtS; //! number of tracks selected + Int_t* fTrackList; //! List of selected tracks + Float_t* fPtT; //! Pt of tracks + Float_t* fEtaT; //! Eta of tracks + Float_t* fPhiT; //! Phi of tracks + Int_t* fPdgT; //! PDG code of tracks + + Int_t fNtB; //! number of tracks in Bg + Int_t* fTrackListB; //! List of selected tracks in Bg + Float_t* fPtB; //! Pt of tracks in Bg + Float_t* fEtaB; //! Eta of tracks in Bg + Float_t* fPhiB; //! Phi of tracks in Bg + Int_t* fPdgB; //! PDG of tracks in Bg + + // parameter for jet_finder_ua1 + Int_t fMode; // key for BG subtraction + Float_t fMinMove; // min cone move + Float_t fMaxMove; // max cone move + Float_t fPrecBg; // max value of change for BG (in %) + Int_t fError; // error variables + + const char* fOutFileName; //! Output file name + TFile* fOutFile; //! Output file + TFile* fInFile; //! Output file + Int_t fEvent; //! Processed event + private: + virtual void BookLego(); + Float_t WeightedJetEnergy(Float_t eta, Float_t phi); + Float_t EMCALConeEnergy(Float_t eta, Float_t phi); + Float_t TrackConeEnergy(Float_t eta, Float_t phi); + virtual void DumpLego(); + virtual void ResetMap(); + virtual void RearrangeParticlesMemory(Int_t npart); + public: + virtual Float_t PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls); + + ClassDef(AliEMCALJetFinder,5) // JetFinder for EMCAL +} +; +#endif // ALIEMCALJetFinder_H diff --git a/EMCAL/jetfinder/AliEMCALJetFinderAlgo.cxx b/EMCAL/jetfinder/AliEMCALJetFinderAlgo.cxx new file mode 100644 index 00000000000..c176af93502 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderAlgo.cxx @@ -0,0 +1,100 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + +//_________________________________________________________________________ +// Base Class for JetFinder Algorithms +// -- +//*-- Author: Mark Horner (LBL/UCT) +// -- + + + +#include "AliEMCALJetFinderAlgo.h" +#include "AliRun.h" +#include "AliEMCALGeometry.h" +#include "AliMagF.h" +ClassImp(AliEMCALJetFinderAlgo) + +AliEMCALJetFinderAlgo::AliEMCALJetFinderAlgo() +{ + fDebug =0; + fOutputPointer=0; + fInputPointer=0; + fOutputAllocated=kFALSE; +} + +AliEMCALJetFinderAlgo::~AliEMCALJetFinderAlgo() +{ + if (fOutputAllocated) + delete fOutputPointer; +} + +void AliEMCALJetFinderAlgo::SetOutput(AliEMCALJetFinderOutput* output) { + if (fOutputAllocated) + delete fOutputPointer; + fOutputPointer=output; + fOutputAllocated=kFALSE; +} + +void AliEMCALJetFinderAlgo::InitInput(AliEMCALJetFinderInput* input) +{ +// Take input data +if (fDebug>1) Info("InitInput","Beginning InitInput"); + fInputPointer = input; + if (fOutputPointer==0) { + + if (fDebug>1) Info("InitInput","Allocating output object"); + fOutputPointer=new AliEMCALJetFinderOutput(); + fOutputAllocated=kTRUE; + } + fOutputPointer->Reset(kResetAll); + // automatically copy parton and particle info to output object + + for (Int_t counter = 0 ; counter < fInputPointer->GetNPartons();counter++) + { + fOutputPointer->AddParton(fInputPointer->GetParton(counter)); + } + for (Int_t counter = 0 ; counter < fInputPointer->GetNParticles();counter++) + { + fOutputPointer->AddParticle(fInputPointer->GetParticle(counter)); + } +} + +Float_t AliEMCALJetFinderAlgo::PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls) +{ + // Propagates phi angle to EMCAL radius + // // + Float_t b = 0.0, rEMCAL = -1.0; + if(rEMCAL<0) + { + b = gAlice->Field()->SolenoidField(); + rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance(); + } + Float_t dPhi = 0.; + Float_t rB = 3335.6 * pt / b; // [cm] (case of |charge|=1) + if (2.*rB < rEMCAL) + { + curls = kTRUE; + return dPhi; + } + Float_t phi = TMath::ACos(1.-rEMCAL*rEMCAL/(2.*rB*rB)); + dPhi = TMath::ATan2(1.-TMath::Cos(phi), TMath::Sin(phi)); + dPhi = -TMath::Sign(dPhi, charge); + return dPhi; +} + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderAlgo.h b/EMCAL/jetfinder/AliEMCALJetFinderAlgo.h new file mode 100644 index 00000000000..aef09186a63 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderAlgo.h @@ -0,0 +1,46 @@ +#ifndef ALIEMCALJETFINDERALGO_H +#define ALIEMCALJETFINDERALGO_H + + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// Base Class for JetFinder Algorithms +// +//*-- Author: Mark Horner (LBL/UCT) + + +#include "TTask.h" +#include "AliEMCALJetFinderInput.h" +#include "AliEMCALJetFinderOutput.h" + + +class AliEMCALJetFinderAlgo : public TTask +{ +public: + AliEMCALJetFinderAlgo(); + virtual ~AliEMCALJetFinderAlgo(); + virtual void FindJets() = 0 ; + void InitInput(AliEMCALJetFinderInput* input); + void SetDebug(Int_t debug = 0){fDebug = debug; if (fOutputPointer) fOutputPointer->SetDebug(debug);} + AliEMCALJetFinderOutput* GetOutput() { return fOutputPointer;} + void SetOutput(AliEMCALJetFinderOutput *output); + Float_t PropagatePhi(Float_t pt, Float_t charge, Bool_t& curls); + Bool_t GetPythiaComparison(){return fPythiaComparison;} + void SetPythiaComparison(Bool_t value){fPythiaComparison=value;} +protected: + + AliEMCALJetFinderInput* fInputPointer; // pointer to the input object + AliEMCALJetFinderOutput* fOutputPointer; // output object for results + Bool_t fOutputAllocated; // flags if ouputobject is woned by JetFinderAlgo + Int_t fDebug; // debug level + Bool_t fPythiaComparison; // for pyclus comparison + + ClassDef(AliEMCALJetFinderAlgo,4) + +}; +#endif + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.cxx b/EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.cxx new file mode 100644 index 00000000000..990e058fde8 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.cxx @@ -0,0 +1,901 @@ + +//THIS Also includes summing ALL cells in the jetcone towards the jet energy NOT just those above threshold!!!!! + + +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* + +$Log$ +Revision 1.16 2006/02/15 15:11:05 pavlinov +update of Jenn and Marco + +Revision 1.15 2004/11/22 19:52:05 mhorner +Make sure pi0 get through + +Revision 1.14 2004/04/02 17:11:33 mhorner +Marco's bug - fixes implemented + +Revision 1.13 2004/03/26 01:00:38 mhorner +Implementing Marco's optimisations + +Revision 1.12 2004/03/15 19:59:37 mhorner +Pyhtia comparison extended + +Revision 1.11 2004/03/09 17:06:38 mhorner +Made more robust + +Revision 1.10 2004/03/06 01:56:09 mhorner +Pythai comp code + +Revision 1.9 2004/02/23 20:37:32 mhorner +changed geometry call + +Revision 1.8 2004/01/29 23:28:44 mhorner +Jet Finder - hard coded geom parameters removed + +Revision 1.7 2004/01/21 22:27:47 mhorner +Cleaning up coding conventions + +Revision 1.6 2003/10/28 13:54:30 schutz +Compilation warnings fixed + +Revision 1.5 2003/09/23 13:31:41 mhorner +Changed coordinate system + +Revision 1.4 2003/09/19 13:16:20 mhorner +Added additional jet energy info + + +Revision 1.3 2003/09/04 12:49:56 mhorner +Changed hadron correction and added saving EMCAL and track contributions + +*/ + + +//*--Author: Sarah Blyth (LBL) +//*--Based on UA1 jet algorithm from LUND JETSET called from EMC-erj + +#include "TTask.h" +#include "TMath.h" +#include "TParticle.h" +#include "AliRun.h" +#include "AliRunLoader.h" +#include "AliEMCALJetFinderInput.h" +#include "AliEMCALJetFinderOutput.h" +#include "AliEMCALJetFinderAlgo.h" +#include "AliEMCALJetFinderAlgoOmni.h" +#include "AliEMCALJetFinderAlgoUA1Unit.h" +#include "AliEMCALGeometry.h" +#include "AliEMCALLoader.h" +#include "AliEMCAL.h" +#include "AliEMCALDigit.h" +#include "AliEMCALJet.h" + + +ClassImp(AliEMCALJetFinderAlgoOmni) + + AliEMCALJetFinderAlgoOmni::AliEMCALJetFinderAlgoOmni() +{ + //Default constructor +if (fDebug>0) Info("AliEMCALJetFinderAlgoOmni","Beginning Default Constructor"); + AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL"); + fNumIter = 0; + fNumUnits = geom->GetNTowers(); //Number of towers in EMCAL + fESeed = 5.0; //Default value + fConeRad = 0.3; //Default value + fJetEMin = 10.0; //Default value + fEtMin = 0.0; //Default value + fMinMove = 0.05; //From original UA1 JetFinder + fMaxMove = 0.15; //From original UA1 JetFinder + fBGMaxMove = 0.035; //From original UA1 JetFinder + fPtCut = 0; + fHadCorr = 0; + fEBGTotal = 1.0; //Set to 1 so that no div by zero in first FindJets() loop + fEBGTotalOld = 0.0; + fEBGAve = 0.0; + fEnergy = 0.0; + fJetEta = 0.0; + fJetPhi = 0.0; + fEtaInit = 0.0; + fPhiInit = 0.0; + fEtaB = 0.0; + fPhiB = 0.0; + fJetESum = 0.0; + fJetEtaSum = 0.0; + fJetPhiSum = 0.0; + fDEta = 0.0; + fDPhi = 0.0; + fDistP = 0.0; + fDistI = 0.0; + fTempE = 0.0; + fRad = 2.0; //Set to 2 to start + fNumInCone = 0; + fNumJets = 0; + fArrayInitialised = 0; //Set to FALSE to start + fBGType = kRatio; //Set Ratio method as default BG subtraction method + fBGPar = -1.0; //Set to 1 to start +} + + AliEMCALJetFinderAlgoOmni::~AliEMCALJetFinderAlgoOmni() + { + //Destructor + if (fDebug>0) Info("AliEMCALJetFinderAlgoOmni","Beginning Destructor"); + delete[] fUnit; + delete[] fUnitNoCuts; + } + + void AliEMCALJetFinderAlgoOmni::SetJetFindingParameters + (Int_t numUnits, Float_t eSeed, Float_t coneRad, Float_t jetEMin, Float_t etMin, + Float_t minMove, Float_t maxMove, Float_t bgMaxMove) + { + //Sets parameters for the JetFinding algorithm + if (fDebug>1) Info("SetJetFindingParameters","Setting parameters for JetFinding"); + + SetNumUnits(numUnits); + SetJetESeed(eSeed); + SetConeRad(coneRad); + SetJetEMin(jetEMin); + SetEtMin(etMin); + SetMinMove(minMove); + SetMaxMove(maxMove); + SetBGMaxMove(bgMaxMove); + } + + void AliEMCALJetFinderAlgoOmni::SetJetFindingParameters + (Int_t numUnits, Float_t eSeed, Float_t coneRad, Float_t jetEMin, Float_t etMin) + { + //Sets fewer parameters for the JetFinding algorithm + if (fDebug>1) Info("SetJetFindingParameters","Setting parameters for JetFinding"); + + SetNumUnits(numUnits); + SetJetESeed(eSeed); + SetConeRad(coneRad); + SetJetEMin(jetEMin); + SetEtMin(etMin); + SetMinMove(fMinMove); + SetMaxMove(fMaxMove); + SetBGMaxMove(fBGMaxMove); + } + + void AliEMCALJetFinderAlgoOmni::InitUnitArray() + { + //Initialises unit arrays + if(fArrayInitialised) delete [] fUnit; + if(fArrayInitialised) delete [] fUnitNoCuts; + fUnit = new AliEMCALJetFinderAlgoUA1Unit[fNumUnits]; + fUnitNoCuts = new AliEMCALJetFinderAlgoUA1Unit[fNumUnits]; + fArrayInitialised = 1; + } + + void AliEMCALJetFinderAlgoOmni::FillUnitArray(AliEMCALJetFinderAlgoUA1FillUnitFlagType_t flag) + { + // Fill the unit array + if (fDebug>1) Info("FillUnitArray","Beginning FillUnitArray"); + // AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); + // if (pEMCAL){ + // AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), ""); + // }else + // { + + AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance(); + if (geom == 0) + geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL"); + + // } + + AliEMCALJetFinderAlgoUA1FillUnitFlagType_t option = flag; + Int_t numTracks, numDigits; + + //Loops over all elements in the AliEMCALJetFinderAlgoUA1Unit array and + //fills the objects with relevant values from the Data Input object + if (fDebug>10) Info("FillUnitArray","Filling array with Unit objects"); + if (fDebug>15) Info("FillUnitArray","NTracks %i NDigits %i",fInputPointer->GetNTracks(),fInputPointer->GetNDigits()); + numTracks = fInputPointer->GetNTracks(); + numDigits = fInputPointer->GetNDigits(); + TParticle *myPart; + AliEMCALDigit *myDigit; + if (!fPythiaComparison) + { + //Fill units with Track info if appropriate + if(option==kFillTracksOnly || option ==kFillAll) + { + for(Int_t j=0; jGetTrack(j); + Float_t eta = myPart->Eta(); + Float_t phi = myPart->Phi(); + Int_t towerID = geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi); + Float_t pT = myPart->Pt(); + Float_t unitEnergy = fUnit[towerID-1].GetUnitEnergy(); + Float_t unitEnergyNoCuts = fUnitNoCuts[towerID-1].GetUnitEnergy(); + + + //OLD WAY: //Do Hadron Correction + if(fHadCorr != 0) + { + Double_t fullP = myPart->P(); + Double_t hCEnergy = fHadCorr->GetEnergy(fullP, (Double_t)eta); + unitEnergy -= hCEnergy*TMath::Sin(myPart->Theta()); + unitEnergyNoCuts -= hCEnergy*TMath::Sin(myPart->Theta()); + fUnit[towerID-1].SetUnitEnergy(unitEnergy); + fUnitNoCuts[towerID-1].SetUnitEnergy(unitEnergyNoCuts); + } //end Hadron Correction loop + + + /* + //Do Hadron Correction with propagate phi for the track + if(fHadCorr != 0) + { + Bool_t curl = 1; + Float_t deltaPhi; + TParticlePDG *pdg = myPart->GetPDG(); + if(pdg->Charge() < 0) + { + deltaPhi = PropagatePhi(myPart->Pt(), -1.0, curl); + } + else{ + deltaPhi = PropagatePhi(myPart->Pt(), 1.0, curl); + } + phi += deltaPhi; + //Get new tower id for cell that track would curve into + Int_t towerID2; + if(phi>(TMath::Pi()/180.0)*geom->GetArm1PhiMax() || phi<(TMath::Pi()/180.0)*geom->GetArm1PhiMin()) + { + towerID2 = -1; + } + else{ + towerID2 = geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi); + } + + if(towerID2 != -1) + { + //Find unit energy of new tower + Float_t unitEnergy2 = fUnit[towerID2-1].GetUnitEnergy(); + Float_t unitEnergy2NoCuts = fUnitNoCuts[towerID2-1].GetUnitEnergy(); + Double_t fullP = myPart->P(); + Double_t hCEnergy = fHadCorr->GetEnergy(fullP, (Double_t)eta); + unitEnergy2 -= hCEnergy*TMath::Sin(myPart->Theta()); + unitEnergy2NoCuts -= hCEnergy*TMath::Sin(myPart->Theta()); + fUnit[towerID2-1].SetUnitEnergy(unitEnergy2); + fUnitNoCuts[towerID2-1].SetUnitEnergy(unitEnergy2NoCuts); + }//end if for towerID2 + }//end Hadron Correction loop + */ + + fUnitNoCuts[towerID-1].SetUnitEnergy(unitEnergyNoCuts + pT); + //Do Pt cut on tracks + if(fPtCut != 0 && pT < fPtCut) continue; + + fUnit[towerID-1].SetUnitEnergy(unitEnergy+pT); + + }//end tracks loop + }//end Tracks condition + + + //Fill units with Digit info if appropriate + if(option ==kFillDigitsOnly || option ==kFillAll) + { + for(Int_t k=0; kGetDigit(k); + if (fDebug>10) Info("FillUnitArray","getting digits %i %i numdigits",k,numDigits ); + Int_t towerID = myDigit->GetId(); + Int_t amplitude = myDigit->GetAmp(); //Gets the integer valued amplitude of the digit + Float_t amp = (Float_t)amplitude; //Need to typecast to Float_t before doing real energy conversion + Float_t digitEnergy = amp/10000000.0; //Factor of 10 million needed to convert! + Float_t unitEnergy = fUnit[towerID-1].GetUnitEnergy() + digitEnergy; + Float_t unitEnergyNoCuts = fUnitNoCuts[towerID-1].GetUnitEnergy() + digitEnergy; + fUnit[towerID-1].SetUnitEnergy(unitEnergy); + fUnitNoCuts[towerID-1].SetUnitEnergy(unitEnergyNoCuts); + }//end digits loop + }//end digits condition + + //Set all unit flags, Eta, Phi + for(Int_t i=0; i10) Info("FillUnitArray","Setting all units outside jets"); + //Set all units to be outside a jet initially + fUnit[i].SetUnitFlag(kOutJet); + fUnit[i].SetUnitID(i+1); + Float_t eta; + Float_t phi; + geom->EtaPhiFromIndex(fUnit[i].GetUnitID(), eta, phi); + fUnit[i].SetUnitEta(eta); + fUnit[i].SetUnitPhi(phi*TMath::Pi()/180.0); + //Set all units to be outside a jet initially + fUnitNoCuts[i].SetUnitFlag(kOutJet); + fUnitNoCuts[i].SetUnitID(i+1); + eta = 0.0; + phi = 0.0; + geom->EtaPhiFromIndex(fUnitNoCuts[i].GetUnitID(), eta, phi); + fUnitNoCuts[i].SetUnitEta(eta); + fUnitNoCuts[i].SetUnitPhi(phi*TMath::Pi()/180.0); + // if(i>13000) cout<<"!!!!!!!!!!!!!!!!!For unit0, eta="<111) Info("QS","QuickSorting Unit objects"); + + Int_t i; + Int_t j; + AliEMCALJetFinderAlgoUA1Unit unitFirst; + AliEMCALJetFinderAlgoUA1Unit unitSecond; + + i = left; + j = right; + unitFirst = unit[(left+right)/2]; + + do + { + while( (unit[i].GetUnitEnergy() > unitFirst.GetUnitEnergy()) && (i < right)) i++; + while( (unitFirst.GetUnitEnergy() > unit[j].GetUnitEnergy()) && (j > left)) j--; + + if(i <= j) + { + unitSecond = unit[i]; + unit[i] = unit[j]; + unit[j] = unitSecond; + i++; + j--; + }//end if + }while(i <= j); + + if(left < j) QS(unit, left, j); + if(i < right) QS(unit, i, right); + } + + + void AliEMCALJetFinderAlgoOmni::FindBG() + { + if(fBGType == kRatio) RatioBG(); + else if(fBGType == kCone) ConeBG(); + else if(fBGType == kConstant) ConstantBG(); + } + + void AliEMCALJetFinderAlgoOmni::RatioBG() + { + //Finds the background energy for the iteration + //using the Ratio method + if (fDebug>1) Info("FindBG","Finding Average Background"); + //Store BGEperCell from previous iteration! + fEBGTotalOld = fEBGTotal; + fEBGTotal = 0.0; + Int_t numCone = 0; + + //If user has not set fBGPar, set it to the default + //for TPC = 90% efficiency, PtCut = 2GeV/c, timecut = 30ns + if(fBGPar == -1) fBGPar = 0.4685; + + //Loop over all unit objects in the Unit array and link to same + //unit ID in NoCuts Unit array + for(Int_t i=0; i5) Info("FindBG","Average BG is %f: ",fEBGAve); + + for(Int_t count=0; count1) Info("FindBG","Finding Average Background"); + //Store old value of BGEperCell! + fEBGTotalOld = fEBGTotal; + fEBGTotal = 0.0; + Int_t numCone = 0; + + //Loop over all unit objects in the array and sum the energy of those not in a jet + for(Int_t i=0; i5) Info("FindBG","Average BG is %f: ",fEBGAve); + + for(Int_t count=0; count1) Info("FindBG","Finding Average Background"); + + //If user has not set fBGPar, set it to the default + //for TPC = 90% efficiency, PtCut = 2GeV/c, timecut = 30ns + if(fBGPar == -1) fBGPar = 0.03378; + + fEBGAve = fBGPar; + if (fDebug>5) Info("FindBG","Average BG is %f: ",fEBGAve); + + fEBGTotal = 0.0; + Int_t numCone = 0; + for(Int_t count=0; count10) Info("FindJetEtaPhi","Finding Jet Eta and Phi"); + + fDEta = fUnit[counter].GetUnitEta() - fEtaInit; + fDPhi = fUnit[counter].GetUnitPhi() - fPhiInit; + + fEnergy = fUnit[counter].GetUnitEnergy() - fEBGAve; + fJetEtaSum += fEnergy * fDEta; + fJetPhiSum += fEnergy * fDPhi; + fJetESum += fEnergy; + if (fJetESum >1.0e-7) + { + fJetEta = fEtaInit + (fJetEtaSum / fJetESum); + fJetPhi = fPhiInit + (fJetPhiSum / fJetESum); + } + } + + + void AliEMCALJetFinderAlgoOmni::FindJetEnergy() + { + //Finds the energy of the jet after the final axis has been found + if (fDebug>1) Info("FindJetEnergy","Finding Jet Energy"); + + for(Int_t i=0; i1.e-7) + { + rad = TMath::Sqrt( (dEta*dEta) + (dPhi*dPhi) ); + }else + { + rad=0.0; + } + + if(fUnit[i].GetUnitFlag()==kOutJet && rad<= fConeRad) + { + fUnit[i].SetUnitFlag(kInCurrentJet); + Float_t energy = fUnit[i].GetUnitEnergy() - fEBGAve; + fJetESum += energy; + fJetEtaSum += energy * dEta; + fJetPhiSum += energy * dPhi; + fNumInCone++; //Increment the number of cells in the jet cone + }//end if + }//end for + } + + + void AliEMCALJetFinderAlgoOmni::StoreJetInfo() + { + //Stores the resulting jet information in appropriate storage structure (TO BE DECIDED!!!!) + if (fDebug>1) Info("StoreJetInfo","Storing Jet Information"); + AliEMCALGeometry * geom = AliEMCALGeometry::GetInstance(); + if (geom == 0) + geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","EMCAL"); + //Store: + //fJetESum is the final jet energy (background has been subtracted) + //fJetEta is the final jet Eta + //fJetPhi is the final jet Phi + //fNumInCone is the final number of cells included in the jet cone + //fEtaInit is the eta of the initiator cell + //fPhiInit is the phi of the initiator cell + + AliEMCALJet jet(fJetESum,fJetPhi,fJetEta); + + cout<<"For iteration "<" <" <GetNTracks(); + Int_t numberDigits = fInputPointer->GetNDigits(); + AliEMCALDigit *myD; + TParticle *myP; + Int_t numTracksInCone = 0; + Float_t trackEnergy = 0.0; + Float_t trackEnergyPtCut =0.0; + Float_t emcalEnergy = 0.0; + Float_t emcalEnergyBGSub = 0.0; + + for(Int_t counter=0; counterGetTrack(counter); + Float_t eta = myP->Eta(); + Float_t phi = myP->Phi(); + Float_t deta = fJetEta-eta; + Float_t dphi = fJetPhi -phi; + Float_t rad = TMath::Sqrt( (deta*deta) + (dphi*dphi)); + if(rad<=fConeRad) numTracksInCone++; + }//end for + + Float_t *pTArray = new Float_t[numTracksInCone]; + Float_t *etaArray = new Float_t[numTracksInCone]; + Float_t *phiArray = new Float_t[numTracksInCone]; + Int_t *pdgArray = new Int_t[numTracksInCone]; + Int_t index = 0; + + for(Int_t counter2=0; counter2GetTrack(counter2); + Float_t eta = myP->Eta(); + Float_t phi = myP->Phi(); + Float_t deta = fJetEta-eta; + Float_t dphi = fJetPhi -phi; + Float_t rad ; + if ((deta*deta) + (dphi*dphi)>1.e-7) + { + rad = TMath::Sqrt( (deta*deta) + (dphi*dphi) ); + }else + { + rad=0.0; + } + + if(rad<=fConeRad) + { + pTArray[index] = myP->Pt(); + //Calculate track contribution within jetcone + trackEnergy += myP->Pt(); + if(myP->Pt() >= fPtCut) trackEnergyPtCut += myP->Pt(); + etaArray[index] = eta; + phiArray[index] = phi; + pdgArray[index] = myP->GetPdgCode(); + index++; + if(fHadCorr != 0) + { + Double_t fullP = myP->P(); + Double_t hCEnergy = fHadCorr->GetEnergy(fullP, (Double_t)eta); + emcalEnergy -= hCEnergy*TMath::Sin(myP->Theta()); + emcalEnergyBGSub -= hCEnergy*TMath::Sin(myP->Theta()); + } //end Hadron Correction loop + + }//end if + }//end for + + //Loop over digits to find EMCal contribution within jetcone + for(Int_t counter3=0; counter3GetDigit(counter3); + //GET DIGIT ETA, PHI so that can check if inside R! + Float_t eta = 0.0; + Float_t phi = 0.0; + Int_t iID = myD->GetId(); + geom->EtaPhiFromIndex(iID, eta, phi); + Float_t deta = fJetEta-eta; + Float_t dphi = fJetPhi -(TMath::Pi()/180.0)*phi; + //Float_t rad = TMath::Sqrt( (deta*deta) + (dphi*dphi)); + Float_t rad ; + if ((deta*deta) + (dphi*dphi)>1.e-7) + { + rad = TMath::Sqrt( (deta*deta) + (dphi*dphi) ); + }else + { + rad=0.0; + } + + if(rad<=fConeRad) + { + Int_t amplitude = myD->GetAmp(); //Gets the integer valued amplitude of the digit + Float_t amp = (Float_t)amplitude; //Need to typecast to Float_t before doing real energy conversion + Float_t digitEnergy = amp/10000000.0; //Factor of 10 million needed to convert! + emcalEnergy += digitEnergy; + emcalEnergyBGSub += (digitEnergy - fEBGAve); + }//end if + }//end count3 for + + //Save in JET object + jet.SetTrackList(numTracksInCone,pTArray, etaArray, phiArray, pdgArray); + jet.SetEMCALEnergy(emcalEnergy); + jet.SetEMCALEnergyBGSub(emcalEnergyBGSub); + jet.SetTrackEnergy(trackEnergy); + jet.SetTrackEnergyPtCut(trackEnergyPtCut); + fOutputPointer->AddJet(&jet); + delete[] pTArray; + delete[] etaArray; + delete[] phiArray; + delete[] pdgArray; + } + + + void AliEMCALJetFinderAlgoOmni::FindJets() + { + //Runs the complete UA1 JetFinding algorithm to find jets! + if (fDebug>1) Info("FindJets","Starting Jet Finding!!!"); + + //If the array of JetFinderUnit objects has not been initialised then initialise with default settings + if(!fArrayInitialised) + { + InitUnitArray(); + FillUnitArray(kFillAll); + }//end if + if (fDebug>1) Info("FindJets","Unit array filled"); + + //Step 1. Sort the array in descending order of Energy + Sort(fUnit,fNumUnits); + + //Step 2. Set the number of iterations and Number of jets found to zero to start + fNumIter = 0; + fNumJets = 0; + + //Step 3. Begin the iteration loop to find jets + //Need to iterate the algorithm while number of iterations<2 OR number of iterations<10 AND + //the value of the average background has changed more than specified amount + //Min iterations = 2, Max iterations = 10 + //while(fNumIter<2 || (fNumIter <10 && ( (fEBGTotal-fEBGTotalOld)/fEBGTotal) > fBGMaxMove) ) + + while(fNumIter<2 || (fNumIter <10 && ( fEBGTotal-fEBGTotalOld) > fEBGTotal*fBGMaxMove) ) + { + if (fDebug>1) Info("FindJets","Starting BIG iteration ---> %i",fNumIter); + + //Step 4. Find the value of the average background energy + FindBG(); + fOutputPointer->Reset(kResetJets); //Reset output object to store info for new iteration + fNumJets=0; + + //Loop over the array of unit objects and flag those with energy below MinCellEt + Int_t numbelow = 0; + for(Int_t j=0; j5) Info("FindJets","Beginning JET SEED LOOP"); + for(Int_t count=0; countfESeed????????????????????????????? + if(fUnit[count].GetUnitEnergy()>=fESeed && fUnit[count].GetUnitFlag()==kOutJet) + { + fEnergy = fUnit[count].GetUnitEnergy() - fEBGAve; + fJetEta = fUnit[count].GetUnitEta(); + fJetPhi = fUnit[count].GetUnitPhi(); + Int_t seedID = fUnit[count].GetUnitID(); + if (fDebug>5) Info("FindJets","Inside first candidate jet seed loop for time : %i", count); + if (fDebug>5) Info("FindJets","Found candidate energy %f ",fEnergy); + if (fDebug>5) Info("FindJets","Found candidate eta %f ", fJetEta); + if (fDebug>5) Info("FindJets","Found candidate phi %f ", fJetPhi); + if (fDebug>5) Info("FindJets","Found candidate ID %i", seedID); + + fEtaInit = fJetEta; + fPhiInit = fJetPhi; + fEtaB = fJetEta; + fPhiB = fJetPhi; + Int_t testflag = 1; + do + { + fJetESum = 0.0; + fJetEtaSum = 0.0; + fJetPhiSum = 0.0; + + //Step 6. Find Jet Eta and Phi + //Loop over all units in the array to find the ones in the jet cone and determine contrib to Jet eta, phi + for(Int_t count1=0; count11.e-7) + { + fRad = TMath::Sqrt( (fDEta*fDEta) + (fDPhi*fDPhi) ); + }else + { + fRad=0.000; + } + if(fRad <= fConeRad) + { + FindJetEtaPhi(count1); + }//end if + }//end if + }//end for (Jet Eta, Phi LOOP) + + //Find the distance cone centre moved from previous cone centre + if (fDebug>10) Info("FindJets","Checking if cone move small enough"); + if (((fJetEta-fEtaB)*(fJetEta-fEtaB)) + ((fJetPhi-fPhiB)*(fJetPhi-fPhiB)) >1.e-7) + { + fDistP = TMath::Sqrt( ((fJetEta-fEtaB)*(fJetEta-fEtaB)) + ((fJetPhi-fPhiB)*(fJetPhi-fPhiB)) ); + }else + { + fDistP = 0.00; + } + // if(fDistP <= fMinMove) break; + + + //Find the distance cone centre is from initiator cell + if (fDebug>10) Info("FindJets","Checking if cone move too large"); + if ( ((fJetEtaSum)*(fJetEtaSum))+((fJetPhiSum)*(fJetPhiSum)) >1.e-7) + { + fDistI = TMath::Sqrt( ((fJetEtaSum/fJetESum)*(fJetEtaSum/fJetESum)) + ((fJetPhiSum/fJetESum)* + (fJetPhiSum/fJetESum))); + }else + { + fDistI = 0.00; + } + + if(fDistP>fMinMove && fDistIfMinMove && fDistI1) Info("FindJets","Looking for Jet energy"); + fJetESum = 0.0; + fJetEtaSum = 0.0; + fJetPhiSum = 0.0; + fNumInCone = 0; + FindJetEnergy(); + + //cout<<"Number of cells in jet cone is: "< NEED TO CHECK WHICH COMPARISON IS BEST!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + if (fDebug>5) Info("FindJets","Checking cluster is valid jet"); + if(fJetESum < fJetEMin) + { + for(Int_t count2=0; count210) Info("FindJets","NOT a valid jet cell"); + }else + { + for(Int_t count2=0; count25) Info("FindJets","End of BIG iteration number %i",fNumIter); +// this->Dump(); + fNumIter++; + }//end 10 iteration WHILE LOOP + } + + + + + + + + + + + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.h b/EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.h new file mode 100644 index 00000000000..41ceaeed845 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderAlgoOmni.h @@ -0,0 +1,112 @@ + +#ifndef ALIEMCALJETFINDERALGOOMNI_H +#define ALIEMCALJETFINDERALGOOMNI_H + +//THIS IS SARAH'S REVISED UA1 CODE WITH CHANGES FOR ETA/PHI ITERATION INCLUDED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +//THIS Also includes summing ALL cells in the jetcone towards the jet energy NOT just those above threshold!!!!! + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//*--Author: Sarah Blyth (LBL) +//*--Based on UA1 jet algorithm from LUND JETSET called from EMC-erj + + +#include "TTask.h" +#include "AliEMCALJetFinderInput.h" +#include "AliEMCALJetFinderOutput.h" +#include "AliEMCALJetFinderAlgo.h" +#include "AliEMCALJetFinderAlgoUA1Unit.h" +#include "AliEMCALJet.h" +#include "AliEMCALHadronCorrectionv1.h" + + +class AliEMCALJetFinderAlgoOmni : public AliEMCALJetFinderAlgo +{ + +public: + AliEMCALJetFinderAlgoOmni(); + ~AliEMCALJetFinderAlgoOmni(); + void InitUnitArray(); + void SetNumUnits(Int_t numUnits) {fNumUnits = numUnits;} + Int_t GetNumUnits() const {return fNumUnits;} + void SetJetESeed(Float_t eSeed) {fESeed = eSeed;} + Float_t GetJetESeed() const {return fESeed;} + void SetConeRad(Float_t coneRad) {fConeRad = coneRad;} + Float_t GetConeRad() const {return fConeRad;} + void SetJetEMin(Float_t jetEMin) {fJetEMin = jetEMin;} + Float_t GetJetEMin() const {return fJetEMin;} + void SetEtMin(Float_t etMin) {fEtMin = etMin;} + Float_t GetEtMin() const {return fEtMin;} + void SetMinMove(Float_t minMove) {fMinMove = minMove;} + void SetMaxMove(Float_t maxMove) {fMaxMove = maxMove;} + void SetBGMaxMove(Float_t bgMaxMove) {fBGMaxMove = bgMaxMove;} + void SetPtCut(Float_t ptCut) {fPtCut = ptCut;} + Float_t GetPtCut() const {return fPtCut;} + void SetHadronCorrection(AliEMCALHadronCorrectionv1 *hadCorr) {fHadCorr = hadCorr;} + AliEMCALHadronCorrectionv1* GetHadronCorrection() const {return fHadCorr;} + void SetJetFindingParameters(Int_t numUnits, Float_t eSeed, Float_t coneRad, Float_t jetEMin, Float_t etMin, + Float_t minMove, Float_t maxMove, Float_t bgMaxMove); + void SetJetFindingParameters(Int_t numUnits, Float_t eSeed, Float_t coneRad, Float_t jetEMin, Float_t etMin); + void FillUnitArray(AliEMCALJetFinderAlgoUA1FillUnitFlagType_t flag); + void SetBGCalcType(AliEMCALJetFinderAlgoBGCalcType_t flag2, Float_t bgPar = -1) {fBGType = flag2; fBGPar = bgPar;} + void Sort(AliEMCALJetFinderAlgoUA1Unit* unit,Int_t integer); + void FindBG(); + void RatioBG(); + void ConeBG(); + void ConstantBG(); + void FindJetEtaPhi(Int_t counter); + void FindJetEnergy(); + void StoreJetInfo(); + void FindJets(); + void QS(AliEMCALJetFinderAlgoUA1Unit *unit, Int_t left, Int_t right); + AliEMCALJetFinderAlgoUA1Unit* GetUnitArrayPointer() const {return fUnit;} + AliEMCALJetFinderAlgoUA1Unit* GetUnitArrayPointerNoCuts() const {return fUnitNoCuts;} + +protected: + AliEMCALJetFinderAlgoUA1Unit *fUnit; //Array of JetFinder Unit objects (treated as the cells) + AliEMCALJetFinderAlgoUA1Unit *fUnitNoCuts; //Second array of JetFinder Unit objects ('raw data') + AliEMCALHadronCorrectionv1 *fHadCorr; //Pointer to Hadron Correction Object + AliEMCALJetFinderAlgoBGCalcType_t fBGType; //Method of background calculation to be used + Int_t fNumIter; //Number of iterations for entire algorithm + Int_t fNumUnits; //Number of units in the unit object array (same as num towers in EMCAL) + Float_t fESeed; //Minimum energy a cell must have to be considered a jet seed + Float_t fConeRad; //Size of cone radius + Float_t fJetEMin; //Minimum energy a cluster must have to be considered a jet + Float_t fEtMin; //Minimum cell Et cut + Float_t fMinMove; //Minimum move of jet centre from its previous position + Float_t fMaxMove; //Maximum move allowed of jet centre from its initiator cell position + Float_t fBGMaxMove; //Maximum allowed change in background energy between iterations + Float_t fPtCut; //Pt cut for tracks to minimise background contribution + Float_t fBGPar; //Parameter to be used for method of background calculation + + Float_t fEBGTotal; //Total background energy + Float_t fEBGTotalOld; //Old total background energy + Float_t fEBGAve; //Average background energy + Float_t fEnergy; //Energy + Float_t fJetEta; //Jet eta value + Float_t fJetPhi; //Jet phi value + Float_t fEtaInit; //Jet initiate cell eta + Float_t fPhiInit; //Jet initiate cell phi + Float_t fEtaB; //Value of jet eta Before + Float_t fPhiB; //Value of jet phi Before + Float_t fJetESum; //Sum of weighted jet energy + Float_t fJetEtaSum; //Sum of weighted jet eta + Float_t fJetPhiSum; //Sum of weighted jet phi + Float_t fDEta; //Offset of unit from jet eta value + Float_t fDPhi; //Offset of unit from jet phi value + Float_t fDistP; //Distance of new jet axis position from Previous position + Float_t fDistI; //Distance of new jet axis position from Initiator cell position + Float_t fTempE; //Temp E for comparing with JetEMin + Float_t fRad; //Distance of cell from jet cone centre + Int_t fNumInCone; //Number of units in the jet cone + Int_t fNumJets; //Number of jets in an event + Bool_t fArrayInitialised; //To check that array of units is initialised + + ClassDef(AliEMCALJetFinderAlgoOmni,3) + +}; +#endif + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderAlgoUA1Unit.cxx b/EMCAL/jetfinder/AliEMCALJetFinderAlgoUA1Unit.cxx new file mode 100644 index 00000000000..2e398be5382 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderAlgoUA1Unit.cxx @@ -0,0 +1,71 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + +//_________________________________________________________________________ +// Unit used by UA1 algorithm +// -- +//*-- Author: Sarah Blyth (LBL/UCT) +// -- + + +#include "AliEMCALJetFinderAlgoUA1Unit.h" + + +ClassImp(AliEMCALJetFinderAlgoUA1Unit) + +AliEMCALJetFinderAlgoUA1Unit::AliEMCALJetFinderAlgoUA1Unit() +{ + // Default constructor + fUnitEnergy = 0.0; + fUnitEta = 0.0; + fUnitPhi = 0.0; + fUnitID = 0; + fUnitFlag = kOutJet; + } + +AliEMCALJetFinderAlgoUA1Unit::~AliEMCALJetFinderAlgoUA1Unit() +{ + +} + +Bool_t AliEMCALJetFinderAlgoUA1Unit::operator>(AliEMCALJetFinderAlgoUA1Unit unit) const +{ + // Greater than operator used by sort + if( fUnitEnergy > unit.GetUnitEnergy()) + return kTRUE; + else + return kFALSE; +} + +Bool_t AliEMCALJetFinderAlgoUA1Unit::operator<( AliEMCALJetFinderAlgoUA1Unit unit) const +{ + // Less than operator used by sort + if( fUnitEnergy < unit.GetUnitEnergy()) + return kTRUE; + else + return kFALSE; +} + +Bool_t AliEMCALJetFinderAlgoUA1Unit::operator==( AliEMCALJetFinderAlgoUA1Unit unit) const + { + // equality operator used by sort + if( fUnitEnergy == unit.GetUnitEnergy()) + return kTRUE; + else + return kFALSE; + } diff --git a/EMCAL/jetfinder/AliEMCALJetFinderAlgoUA1Unit.h b/EMCAL/jetfinder/AliEMCALJetFinderAlgoUA1Unit.h new file mode 100644 index 00000000000..80c09d1db10 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderAlgoUA1Unit.h @@ -0,0 +1,57 @@ +#ifndef ALIEMCALJETFINDERALGOUA1UNIT_H +#define ALIEMCALJETFINDERALGOUA1UNIT_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// Unit used by UA1 algorithm +// +//*-- Author: Sarah Blyth (LBL/UCT) + + +#include +#include "AliEMCALJetFinderTypes.h" + +class AliEMCALJetFinderAlgoUA1Unit : public TObject +{ + public: + AliEMCALJetFinderAlgoUA1Unit(); + ~AliEMCALJetFinderAlgoUA1Unit(); + void SetUnitEnergy(Float_t energy) {fUnitEnergy = energy;} + Float_t GetUnitEnergy() const { return fUnitEnergy;} + void SetUnitEta(Float_t eta) {fUnitEta = eta;} + Float_t GetUnitEta() const {return fUnitEta;} + void SetUnitPhi(Float_t phi) {fUnitPhi = phi;} + Float_t GetUnitPhi() const {return fUnitPhi;} + void SetUnitID(Int_t id) {fUnitID = id;} + Int_t GetUnitID() const {return fUnitID;} + + void SetUnitFlag(AliEMCALJetFinderAlgoUA1UnitFlagType_t flag) + { + fUnitFlag = flag; + } + + AliEMCALJetFinderAlgoUA1UnitFlagType_t GetUnitFlag() const + { + return fUnitFlag; + } + + Bool_t operator> ( AliEMCALJetFinderAlgoUA1Unit unit1) const; + Bool_t operator< ( AliEMCALJetFinderAlgoUA1Unit unit1) const; + Bool_t operator== ( AliEMCALJetFinderAlgoUA1Unit unit1) const; + + protected: + Float_t fUnitEnergy; // Energy of the unit + Float_t fUnitEta; // Eta of the unit + Float_t fUnitPhi; // Phi of the unit + Int_t fUnitID; // ID of the unit + AliEMCALJetFinderAlgoUA1UnitFlagType_t fUnitFlag; //Flag of the unit + + ClassDef(AliEMCALJetFinderAlgoUA1Unit,3) +}; + +#endif + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderInput.cxx b/EMCAL/jetfinder/AliEMCALJetFinderInput.cxx new file mode 100644 index 00000000000..11e5af8abb1 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderInput.cxx @@ -0,0 +1,305 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + + +//________________________________________________________________________ +// Initial JetFinder input object +// -- +//*-- Author: Mark Horner (LBL/UCT) +// -- +// -- +// -- + + + +#include "AliEMCALJetFinderInput.h" +#include "AliEMCALDigit.h" +#include "AliEMCALGeometry.h" +#include "AliEMCALParton.h" +class TClonesArray; + + +ClassImp(AliEMCALJetFinderInput) + +AliEMCALJetFinderInput::AliEMCALJetFinderInput(): +fDigitsArray(0), +fTracksArray(0), +fPartonsArray(0), +fParticlesArray(0) +{ +// Default constructor +// Defines all TClonesArrays +// Creates full array of Digits - all other arrays will have objects created as necessary + + //if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning Constructor"); + fDebug=0; + fInitialised = kFALSE; + fNDigits = 19152; // This is the number of digits + fNMaxDigits = fNDigits; + fNMaxTracks = 3000; + fNMaxParticles = 2000; + fNMaxPartons = 4; + fNTracks = 0; + fNPartons = 0; + fNParticles = 0; + +} + +void AliEMCALJetFinderInput::InitArrays() +{ +if (fDebug>0) Info("AliEMCALJetFinderInput","Beginning InitArrays"); +fNDigits = 19152; // This is the number of digits +fNMaxDigits = fNDigits; +fNMaxTracks = 3000; +fNMaxParticles = 2000; +fNMaxPartons = 4; + +fDigitsArray = new TClonesArray ("AliEMCALDigit",fNDigits); // This is the digits array for the EMCAL +fTracksArray = new TClonesArray("TParticle",fNMaxTracks); +fPartonsArray = new TClonesArray("AliEMCALParton",fNMaxPartons); +fParticlesArray = new TClonesArray ("TParticle",fNMaxParticles); + +for (Int_t i = 0; i < 19152; i++) +{ + AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1); + tempdigit.SetAmp(0); +// AliEMCALDigit(0,0,i+1,0,1.0,-1) + new((*fDigitsArray)[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero +} +fNTracks = 0; +fNPartons = 0; +fNParticles = 0; +fInitialised = kTRUE; +} + + +AliEMCALJetFinderInput::~AliEMCALJetFinderInput() +{ +// Destructor - + +if (fDebug>0) Info("~AliEMCALJetFinderInput","Beginning Destructor"); +if (fInitialised) + { + fDigitsArray->Delete(); + fTracksArray->Delete(); + fPartonsArray->Delete(); + fParticlesArray->Delete(); + delete fDigitsArray; + delete fTracksArray; + delete fPartonsArray; + delete fParticlesArray; +} + +} + +void AliEMCALJetFinderInput::Reset(AliEMCALJetFinderResetType_t resettype) +{ +// Clears the contents of all the arrays and returns to the state we were in +// after the constructor +if (fDebug>1) Info("Reset","Beginning Reset"); + + if (!fInitialised) InitArrays(); + + if ( resettype == kResetData || + resettype == kResetDigits || + resettype == kResetAll ){ + if (fInitialised) + { + fDigitsArray->Delete(); + fTracksArray->Delete(); + fPartonsArray->Delete(); + fParticlesArray->Delete(); + } + for (Int_t i = 0; i < 19152; i++) + { + AliEMCALDigit tempdigit(0,0,i+1,0,1.0,-1); + tempdigit.SetAmp(0); + new((*fDigitsArray)[i]) AliEMCALDigit(tempdigit); // Default digit amplitude is zero + } + } + if ( resettype == kResetData || + resettype == kResetTracks || + resettype == kResetAll ){ + fNTracks = 0; + } + if ( resettype == kResetData || + resettype == kResetPartons || + resettype == kResetAll ){ + fNPartons=0; + } + if ( resettype == kResetData || + resettype == kResetParticles || + resettype == kResetAll ){ + fNParticles = 0; + } + +} +void AliEMCALJetFinderInput::AddEnergyToDigit(Int_t digitID,Int_t denergy) +{ +// Adds energy to the digit specified - Note these are tower IDs and +// so start at 1! + +if (fDebug>15) Info("AddEnergyToDigit","Beginning AddEnergyToDigit"); + if (!fInitialised) InitArrays(); + + Int_t amp = 0; + AliEMCALDigit *mydigit = (AliEMCALDigit*)(*fDigitsArray)[digitID]; + amp = mydigit->GetAmp(); + mydigit->SetAmp(amp+denergy); +} + +void AliEMCALJetFinderInput::AddTrack(TParticle track) +{ +// Adds a TParticle to the track array + +if (fDebug>5) Info("AddTrack","Beginning AddTrack"); + + if (!fInitialised) InitArrays(); + if (fNTracks < fNMaxTracks){ + new((*fTracksArray)[fNTracks]) TParticle(track); + fNTracks++; + if (fDebug>5) Info("AddTracks","Added Tracks %i",fNTracks); + }else + { + Error("AddTracks","Cannot AddTrack - maximum exceeded"); + } + +} + +void AliEMCALJetFinderInput::AddTrack(TMCParticle *track) +{ +// Adds a TParticle to the particle array + +if (fDebug>5) Info("AddTrack","Beginning AddTrack"); + + if (!fInitialised) InitArrays(); + if (fNTracks < fNMaxTracks){ + new((*fTracksArray)[fNTracks]) + TParticle(track->GetKF(), track->GetKS(), track->GetParent(), 0, + track->GetFirstChild(), track->GetLastChild(), + track->GetPx(), track->GetPy(), track->GetPz(), + track->GetEnergy(), + track->GetVx(), track->GetVy(), track->GetVz(), + track->GetTime()); + fNTracks++; + if (fDebug>5) Info("AddTrack","Added Track %i",fNTracks); + } else { + Error("AddTrack","Cannot AddTrack - maximum exceeded"); + } +} + + +void AliEMCALJetFinderInput::AddParton(AliEMCALParton *parton) +{ +// Adds an AliEMCALParton to the parton array + +if (fDebug>5) Info("AddParton","Beginning AddParton"); + + if (!fInitialised) InitArrays(); + if (fNPartons < fNMaxPartons){ + new((*fPartonsArray)[fNPartons]) AliEMCALParton(*parton); + fNPartons++; + if (fDebug>5) Info("AddParton","Added Parton %i",fNPartons); + }else + { + Error("AddParton","Cannot AddParton - maximum exceeded"); + } +} + +void AliEMCALJetFinderInput::AddParticle(TParticle *particle) +{ +// Adds a TParticle to the particle array + +if (fDebug>5) Info("AddParticle","Beginning AddParticle"); + + if (!fInitialised) InitArrays(); + if (fNParticles < fNMaxParticles){ + new((*fParticlesArray)[fNParticles]) TParticle(*particle); + fNParticles++; + if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles); + }else + { + Error("AddParticle","Cannot AddParticle - maximum exceeded"); + } + +} + +void AliEMCALJetFinderInput::AddParticle(TMCParticle *particle) +{ +// Adds a TParticle to the particle array + +if (fDebug>5) Info("AddParticle","Beginning AddParticle"); + + if (!fInitialised) InitArrays(); + if (fNParticles < fNMaxParticles){ + new((*fParticlesArray)[fNParticles]) + TParticle(particle->GetKF(), particle->GetKS(), particle->GetParent(), 0, + particle->GetFirstChild(), particle->GetLastChild(), + particle->GetPx(), particle->GetPy(), particle->GetPz(), + particle->GetEnergy(), + particle->GetVx(), particle->GetVy(), particle->GetVz(), + particle->GetTime()); + fNParticles++; + if (fDebug>5) Info("AddParticle","Added Particle %i",fNParticles); + } else { + Error("AddParticle","Cannot AddParticle - maximum exceeded"); + } +} + + +AliEMCALDigit* AliEMCALJetFinderInput::GetDigit(Int_t digitID) +{ +// Returns a pointer to an AliEMCALDigit with the given ID + +if (fDebug>15) Info("GetDigit","Beginning GetDigit"); + + if (digitID >= fNDigits) return 0; + return (AliEMCALDigit*)((*fDigitsArray)[digitID]); +} + +TParticle* AliEMCALJetFinderInput::GetTrack(Int_t trackID) +{ +// Returns a pointer to a TParticle specified by the ID + +if (fDebug>15) Info("GetTrack","Beginning GetTrack with trackID %i",trackID); + + if (trackID >= fNTracks) return 0; + return (TParticle*)((*fTracksArray)[trackID]); +} + +AliEMCALParton* AliEMCALJetFinderInput::GetParton(Int_t partonID) +{ +// Returns a pointer to an AliEMCALParton specified by the ID + +if (fDebug>15) Info("GetParton","Beginning GetParton"); + + if (partonID >= fNPartons) return 0; + return (AliEMCALParton*)((*fPartonsArray)[partonID]); +} + +TParticle* AliEMCALJetFinderInput::GetParticle(Int_t particleID) +{ +// Returns a pointer to a TParticle specified by the ID + +if (fDebug>15) Info("GetParticle","Beginning GetParticle"); + + if (particleID >= fNParticles) return 0; + return (TParticle*)((*fParticlesArray)[particleID]); +} + + + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderInput.h b/EMCAL/jetfinder/AliEMCALJetFinderInput.h new file mode 100644 index 00000000000..8c917b89a1e --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderInput.h @@ -0,0 +1,66 @@ +#ifndef ALIEMCALJETFINDERINPUT_H +#define ALIEMCALJETFINDERINPUT_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// Initial input object for jetfinder +// +//*-- Author: Mark Horner (LBL/UCT) +// +// + + +#include "TObject.h" +#include "TParticle.h" +#include "TMCParticle6.h" +#include "TClonesArray.h" +#include "AliEMCALParton.h" +#include "AliEMCALDigit.h" +#include "AliEMCALJetFinderTypes.h" + +class AliEMCALJetFinderInput : public TObject +{ + public: + AliEMCALJetFinderInput(); + ~AliEMCALJetFinderInput(); + void Reset(AliEMCALJetFinderResetType_t resettype); + void SetDebug(Int_t debug=0){fDebug = debug;} + void AddEnergyToDigit(Int_t digitID,Int_t denergy); + void AddTrack(TParticle track); + void AddTrack(TMCParticle *track); + void AddParton(AliEMCALParton *parton); + void AddParticle(TParticle *particle); + void AddParticle(TMCParticle *particle); + AliEMCALDigit* GetDigit(Int_t digitID); + Int_t GetNDigits() const {return fNDigits;} + TParticle* GetTrack(Int_t trackID); + Int_t GetNTracks() const {return fNTracks;} + AliEMCALParton* GetParton(Int_t partonID); + Int_t GetNPartons() const {return fNPartons;} + TParticle* GetParticle(Int_t particleID); + Int_t GetNParticles() const {return fNParticles;} + + private: + void InitArrays(); + TClonesArray* fDigitsArray; //-> This is the digits array for the EMCAL + Int_t fNDigits; // This is the number of digits + Int_t fNMaxDigits; // This is the max number of digits + TClonesArray* fTracksArray; //-> This is the track array + Int_t fNTracks; // This stores the number of tracks + Int_t fNMaxTracks; // This stores the maximum number of tracks + TClonesArray* fPartonsArray; //-> This is the partons array + Int_t fNPartons; // This stores the number of partons + Int_t fNMaxPartons; // This stores the maximum number of partons + TClonesArray* fParticlesArray;//-> This stores the particles + Int_t fNParticles; // This stores the number of particles + Int_t fNMaxParticles; // This stroes the maximum number of particles + Int_t fDebug; // This is the debug value + Bool_t fInitialised; // Stores whether or not the arrays have been initialised + + ClassDef(AliEMCALJetFinderInput,5) +}; +#endif diff --git a/EMCAL/jetfinder/AliEMCALJetFinderInputPrep.cxx b/EMCAL/jetfinder/AliEMCALJetFinderInputPrep.cxx new file mode 100644 index 00000000000..752b8e9ea23 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderInputPrep.cxx @@ -0,0 +1,93 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//_________________________________________________________________________ +// Base Class for JetFinder Input Preparation +// -- +//*-- Author: Mark Horner (LBL/UCT) +// -- + + + +#include +#include +#include +#include +#include "Riostream.h" +//..................... +#include "AliEMCALJet.h" +#include "AliEMCALParton.h" +#include "AliEMCALJetFinderInputPrep.h" +#include "AliEMCALJetFinderInput.h" + +ClassImp(AliEMCALJetFinderInputPrep) + +//________________________________________________________________________ +AliEMCALJetFinderInputPrep::AliEMCALJetFinderInputPrep() +{ + // Default constructor +if (fDebug > 0) Info("AliEMCALJetFinderInputPrep","Beginning Constructor"); + fDebug = 0; + fPythiaComparison = 0; // This requires lots of checks + fInputObject.SetDebug(0); +} +AliEMCALJetFinderInputPrep::~AliEMCALJetFinderInputPrep() +{ + +} + +Int_t AliEMCALJetFinderInputPrep::FillFromFile(TString * /*filename*/, + AliEMCALJetFinderFileType_t /*fileType*/, + Int_t /*EventNumber*/) +{ + return 0; +} +void AliEMCALJetFinderInputPrep::Reset(AliEMCALJetFinderResetType_t resettype) +{ + // Reset data +if (fDebug > 1) Info("Reset","Beginning Reset"); + + switch (resettype){ + case kResetData: + fInputObject.Reset(resettype); + break; + case kResetTracks: + fInputObject.Reset(kResetTracks); + break; + case kResetDigits: + fInputObject.Reset(kResetDigits); + break; + case kResetParameters: + break; + case kResetAll: + fInputObject.Reset(kResetAll); + break; + case kResetPartons: + Warning("FillFromFile", "kResetPartons not implemented") ; + break; + case kResetParticles: + Warning("FillFromFile", "kResetParticles not implemented") ; + break; + case kResetJets: + Warning("FillFromFile", "kResetJets not implemented") ; + break; + }// end switch + +} + + + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderInputPrep.h b/EMCAL/jetfinder/AliEMCALJetFinderInputPrep.h new file mode 100644 index 00000000000..40d44c20548 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderInputPrep.h @@ -0,0 +1,42 @@ +#ifndef ALIEMCALJETFINDERINPUTPREP_H +#define ALIEMCALJETFINDERINPUTPREP_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// Base class for jetfinder input preparation +// +//*-- Author: Mark Horner (LBL/UCT) +// + + + +#include "TTask.h" +#include "AliEMCALJetFinderInput.h" +#include "AliEMCALJetFinderTypes.h" + +class AliEMCALJetFinderInputPrep : public TTask +{ + + public: + AliEMCALJetFinderInputPrep(); + ~AliEMCALJetFinderInputPrep(); + void Reset(AliEMCALJetFinderResetType_t resettype); + void SetDebug(Int_t debug = 0){fDebug = debug; fInputObject.SetDebug(debug-2); } + Int_t FillFromFile(TString *filename, AliEMCALJetFinderFileType_t filetype, Int_t EventNumber); + AliEMCALJetFinderInput* GetJetFinderInput() {return &fInputObject;} + void SetPythiaComparison(Bool_t value) {fPythiaComparison = value;} + Bool_t GetPythiaComparison() {return fPythiaComparison;} + protected: + Int_t fDebug; // The debug flag to be used for messages + AliEMCALJetFinderInput fInputObject; // The JetFinder input object to be filled + Bool_t fPythiaComparison; // Special flag for pyclus comparison + private: + + ClassDef(AliEMCALJetFinderInputPrep,3) + +}; +#endif diff --git a/EMCAL/jetfinder/AliEMCALJetFinderInputSimPrep.cxx b/EMCAL/jetfinder/AliEMCALJetFinderInputSimPrep.cxx new file mode 100644 index 00000000000..df12d77edd8 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderInputSimPrep.cxx @@ -0,0 +1,688 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + +//_________________________________________________________________________ +// Class for JetFinder Input preparation from simulated data +// +//*-- Author: Mark Horner (LBL/UCT) +// + + + +#include "AliEMCALJetFinderInputSimPrep.h" + +#include +#include +#include +#include +#include +#include +#include + + +#include "AliRun.h" +#include "AliRunLoader.h" +#include "AliStack.h" +#include "AliMagF.h" +#include "AliEMCALFast.h" +#include "AliEMCAL.h" +#include "AliEMCALHit.h" +#include "AliEMCALGeometry.h" +#include "AliEMCALLoader.h" +#include "AliGenEventHeader.h" +#include "AliGenPythiaEventHeader.h" +#include "AliGenerator.h" +#include "AliHeader.h" +#include "AliMC.h" + + + +ClassImp(AliEMCALJetFinderInputSimPrep) + +AliEMCALJetFinderInputSimPrep::AliEMCALJetFinderInputSimPrep() +{ + // Default constructor +if (fDebug > 0) Info("AliEMCALJetFinderInputSimPrep","Beginning Constructor"); + + fDebug = 0; + fSmearType = kSmearEffic; + fEMCALType = kHits; + fTrackType = kCharged; + fEfficiency = 0.90; + +} +AliEMCALJetFinderInputSimPrep::~AliEMCALJetFinderInputSimPrep() +{ +if (fDebug > 0) Info("~AliEMCALJetFinderInputSimPrep","Beginning Destructor"); + +} + +void AliEMCALJetFinderInputSimPrep::Reset(AliEMCALJetFinderResetType_t resettype) +{ + // Method to reset data + if (fDebug > 1) Info("Reset","Beginning Reset"); + switch (resettype){ + + case kResetData: + fInputObject.Reset(resettype); + break; + case kResetTracks: + fInputObject.Reset(resettype); + break; + case kResetDigits: + fInputObject.Reset(resettype); + break; + case kResetParameters: + fSmearType = kSmearEffic; + fEMCALType = kHits; + fTrackType = kCharged; + break; + case kResetAll: + fSmearType = kSmearEffic; + fEMCALType = kHits; + fTrackType = kCharged; + fInputObject.Reset(resettype); + break; + case kResetPartons: + Warning("FillFromFile", "kResetPartons not implemented") ; + break; + case kResetParticles: + Warning("FillFromFile", "kResetParticles not implemented") ; + break; + case kResetJets: + Warning("FillFromFile", "kResetJets not implemented") ; + break; + }// end switch + +} + +Int_t AliEMCALJetFinderInputSimPrep::FillFromFile(TString *filename, AliEMCALJetFinderFileType_t filetype,Int_t EventNumber,TString data) +{ + if (fDebug > 1) Info("FillFromFile","Beginning FillFromFile"); + fFileType = filetype; + AliRunLoader *rl=AliRunLoader::Open(filename->Data()); + if (fDebug > 1) Info("FillFromFile","Opened file %s",filename->Data()); + if (data.Contains("S")) + { + rl->LoadKinematics(); + rl->LoadSDigits(); + rl->GetEvent(EventNumber); + }else + { + rl->LoadKinematics(); + rl->LoadHits(); + rl->GetEvent(EventNumber); + } + if (fDebug > 1) Info("FillFromFile","Got event %i with option \"XH\"",EventNumber); + + if ( fEMCALType == kHits || + fEMCALType == kTimeCut ) + { + if (data.Contains("S")) + { + FillSDigits(); + }else + { + FillHits(); + } + } + if ( fTrackType != kNoTracks ) FillTracks(); + if ( fFileType != kData){ + FillPartons(); + } + return 0; +} + +void AliEMCALJetFinderInputSimPrep::FillHits() +{ + // Fill from the hits to input object from simulation +if (fDebug > 1) Info("FillHits","Beginning FillHits"); + +// Access hit information +// AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); +// Info("AliEMCALJetFinderInputSimPrep","Title of the geometry is %s",pEMCAL->GetTitle()); + AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance(); + AliEMCALLoader *emcalLoader = dynamic_cast(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL")); + + // TTree *treeH = AliEMCALGetter::Instance()->TreeH(); +// Int_t ntracks = (Int_t) treeH->GetEntries(); +// +// Loop over tracks +// + Double_t etH = 0.0; + +/* for (Int_t track=0; trackResetHits(); + nbytes += treeH->GetEvent(track);*/ +// +// Loop over hits +// + for(Int_t i =0; i < emcalLoader->Hits()->GetEntries() ;i++) + { + const AliEMCALHit *mHit = emcalLoader->Hit(i); + if (fEMCALType == kTimeCut && + (mHit->GetTime()>fTimeCut) ) continue; + Float_t x = mHit->X(); // x-pos of hit + Float_t y = mHit->Y(); // y-pos + Float_t z = mHit->Z(); // z-pos + Float_t eloss = mHit->GetEnergy(); // deposited energy + + Float_t r = TMath::Sqrt(x*x+y*y); + Float_t theta = TMath::ATan2(r,z); + Float_t eta = -TMath::Log(TMath::Tan(theta/2.)); + Float_t phi = TMath::ATan2(y,x); + etH = eloss*TMath::Sin(theta); + if (fDebug > 10) Info("FillHits","Values of hit energy %i",Int_t(1e7*etH)); + if (geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi) == -1) + { + if (fDebug >5) + { + Error("FillHits","Hit not inside EMCAL!"); + mHit->Dump(); + } + continue; + } + fInputObject.AddEnergyToDigit(geom->TowerIndexFromEtaPhi(eta,180.0/TMath::Pi()*phi)-1,Int_t(1e7*etH)); + } // Hit Loop +// } // Track Loop + + +} +void AliEMCALJetFinderInputSimPrep::FillTracks() +{ + // Fill from particles simulating a TPC to input object from simulation + if (fDebug > 1) Info("FillTracks","Beginning FillTracks"); + + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + TParticlePDG* pdgP = 0; + TParticle *mPart; + Int_t npart = rl->Stack()->GetNprimary(); + if (fDebug > 1) Info("FillTracks","Header says there are %i primaries",npart); + Float_t bfield,rEMCAL; + + if (fDebug > 1) Info("FillTracks","Defining the geometry"); + + AliEMCAL* pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); + AliEMCALGeometry* geom = AliEMCALGeometry::GetInstance(); + if (geom == 0 && pEMCAL) + geom = AliEMCALGeometry::GetInstance(pEMCAL->GetTitle(), ""); + if (geom == 0) + geom = AliEMCALGeometry::GetInstance("EMCAL_55_25","");//","SHISH_77_TRD1_2X2_FINAL_110DEG"); + fEtaMax = geom->GetArm1EtaMax(); + fEtaMin = geom->GetArm1EtaMin(); + fPhiMax = TMath::Pi()/180.0*geom->GetArm1PhiMax(); + fPhiMin = TMath::Pi()/180.0*geom->GetArm1PhiMin(); + + if (fDebug > 1) Info("FillTracks","Starting particle loop"); + + if (fDebug > 1) Info("FillTracks","Particle loop of %i",npart); + for (Int_t part = 0; part < npart; part++) { + mPart = rl->Stack()->Particle(part); + pdgP = mPart->GetPDG(); + + if (fDebug > 5) Info("FillTracks","Checking if track is a primary"); + + if (fFileType == kPythia) { + if (mPart->GetStatusCode() != 1) continue; + } else if (fFileType == kHijing) { + if (mPart->GetFirstDaughter() >= 0 && mPart->GetFirstDaughter() < npart) continue; + } + + if (fDebug > 15) Info("FillTracks","Checking if track (eta - %f, phi - %f) is in acceptance",mPart->Eta(),mPart->Phi()); + if (fDebug > 10) Info("FillTracks","Checking if EMCAL acceptance ( %f < eta < %f, %f < phi < %f) is in acceptance",fEtaMin,fEtaMax,fPhiMin,fPhiMax); + + if ((!fPythiaComparison)&&(mPart->Eta() > fEtaMax || mPart->Eta() < fEtaMin)) continue; + if ((!fPythiaComparison)&&(mPart->Phi() > fPhiMax || mPart->Phi() < fPhiMin)) continue; + +/* + {kProton, kProtonBar, kElectron, kPositron, + kNuE, kNuEBar, kGamma, kNeutron, kNeutronBar, + kMuonPlus, kMuonMinus, kK0Long , kPiPlus, kPiMinus, + kKPlus, kKMinus, kLambda0, kLambda0Bar, kK0Short, + kSigmaMinus, kSigmaPlus, kSigma0, kPi0, kK0, kK0Bar, + 0,kNuMu,kNuMuBar +*/ + + if (fDebug > 15) Info("FillTracks","Checking if track is rejected"); + + if ((fSmearType == kEfficiency || + fSmearType == kSmearEffic) && + pdgP->Charge()!=0) { + if (AliEMCALFast::RandomReject(fEfficiency)) { + continue; + } + } + + if (gAlice && gAlice->Field()) + bfield = gAlice->Field()->SolenoidField(); + else + bfield = 0.4; + rEMCAL = AliEMCALGeometry::GetInstance()->GetIPDistance(); + Float_t rB = 3335.6 * mPart->Pt() / bfield; // [cm] (case of |charge|=1) + if (2.*rB < rEMCAL) continue; // track curls away + + //if (part%10) gObjectTable->Print(); + switch(fTrackType) + { + + case kAllP: // All Stable particles to be included + if (fDebug > 5) Info("FillTracks","Storing track"); + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(Smear(MPart)); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + break; + case kEM: // All Electromagnetic particles + if (mPart->GetPdgCode() == kElectron || + mPart->GetPdgCode() == kMuonPlus || + mPart->GetPdgCode() == kMuonMinus || + mPart->GetPdgCode() == kPositron ){ + if (fDebug > 5) Info("FillTracks","Storing electron or positron"); + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(tmp); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + } + if ( mPart->GetPdgCode() == kGamma ){ + fInputObject.AddTrack(*mPart); + if (fDebug > 5) Info("FillTracks","Storing gamma"); + } + + break; + case kCharged: // All Particles with non-zero charge + if (pdgP->Charge() != 0) { + if (fDebug > 5) Info("FillTracks","Storing charged track"); + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(tmp); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + } + break; + case kNeutral: // All particles with no charge + if (pdgP->Charge() == 0){ + fInputObject.AddTrack(*mPart); + if (fDebug > 5) Info("FillTracks","Storing neutral"); + } + break; + case kHadron: //All hadrons + if (mPart->GetPdgCode() != kElectron && + mPart->GetPdgCode() != kPositron && + mPart->GetPdgCode() != kMuonPlus && + mPart->GetPdgCode() != kMuonMinus && + mPart->GetPdgCode() != kGamma ) + { + if (fDebug > 5) Info("FillTracks","Storing hadron"); + if (pdgP->Charge() == 0){ + fInputObject.AddTrack(*mPart); + }else{ + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(tmp); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + } + } + break; + case kChargedHadron: // only charged hadrons + if (mPart->GetPdgCode() != kElectron && + mPart->GetPdgCode() != kPositron && + mPart->GetPdgCode() != kGamma && + mPart->GetPdgCode() != kMuonPlus && + mPart->GetPdgCode() != kMuonMinus && + pdgP->Charge() != 0 ){ + if (fDebug > 5) Info("FillTracks","Storing charged hadron"); + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(tmp); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + } + break; + case kNoTracks: + break; + case kEMChargedPi0: + if (pdgP->Charge() != 0 || mPart->GetPdgCode() == kPi0 || + mPart->GetPdgCode() == kGamma ) + { + if (fDebug > 5) Info("FillTracks","Storing charged track"); + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(tmp); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + } + break; + case kNoNeutronNeutrinoKlong: + if ( mPart->GetPdgCode() != kNeutron && + mPart->GetPdgCode() != kNeutronBar && + mPart->GetPdgCode() != kK0Long && + mPart->GetPdgCode() != kNuE && + mPart->GetPdgCode() != kNuEBar && + mPart->GetPdgCode() != kNuMu && + mPart->GetPdgCode() != kNuMuBar && + mPart->GetPdgCode() != kNuTau && + mPart->GetPdgCode() != kNuTauBar ) + { + if (fDebug > 5) Info("FillTracks","Storing charged track"); + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(tmp); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + } + break; + default: + break; + // delete mPart; + } //end of switch +// Info("FillTracks","After Particle Storage"); + //if (part%10) gObjectTable->Print(); + + } //end of particle loop + //gObjectTable->Print(); +} + +void AliEMCALJetFinderInputSimPrep::FillPartons() +{ + // Fill partons to + // input object from simulation +if (fDebug > 1) Info("FillPartons","Beginning FillPartons"); + + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + AliGenEventHeader* evHeader = rl->GetHeader()->GenEventHeader(); + Float_t triggerJetValues[4]; + AliEMCALParton tempParton; + + if (fFileType == kPythia) + { + Int_t ntriggerjets = ((AliGenPythiaEventHeader*)evHeader)->NTriggerJets(); + if (fDebug > 1) Info("FillPartons","Number of trigger jets --> %i",ntriggerjets); + for (Int_t jetcounter = 0 ; jetcounter < ntriggerjets; jetcounter++){ + ((AliGenPythiaEventHeader*)evHeader)->TriggerJet(jetcounter,triggerJetValues); + TLorentzVector tempLParton; + tempLParton.SetPxPyPzE(triggerJetValues[0],triggerJetValues[1],triggerJetValues[2],triggerJetValues[3]); + tempParton.SetEnergy(tempLParton.Energy()); + tempParton.SetEta(tempLParton.Eta()); + tempParton.SetPhi(tempLParton.Phi()); + FillPartonTracks(&tempParton); + fInputObject.AddParton(&tempParton); + } + + } +} + +void AliEMCALJetFinderInputSimPrep::FillParticles() +{ + // Fill particles to input object from simulation +if (fDebug > 1) Info("FillParticles","Beginning FillParticles"); + + Int_t npart = (gAlice->GetHeader())->GetNprimary(); + TParticlePDG* pdgP = 0; + + for (Int_t part = 0; part < npart; part++) { + TParticle *mPart = gAlice->GetMCApp()->Particle(part); + pdgP = mPart->GetPDG(); + + if (fDebug > 10) Info("FillParticles","Checking if particle is a primary"); + + if (fFileType == kPythia) { + if (mPart->GetStatusCode() != 1) continue; + } else if (fFileType == kHijing) { + if (mPart->GetFirstDaughter() >= 0 && mPart->GetFirstDaughter() < npart) continue; + } + + if (fDebug > 10) Info("FillParticles","Checking if particle is in acceptance"); + + if ((!fPythiaComparison)&&(mPart->Eta() > fEtaMax || mPart->Eta() < fEtaMin)) continue; + if ((!fPythiaComparison)&&(mPart->Phi() > fPhiMax || mPart->Phi() < fPhiMin)) continue; + + +/* + {kProton, kProtonBar, kElectron, kPositron, + kNuE, kNuEBar, kGamma, kNeutron, kNeutronBar, + kMuonPlus, kMuonMinus, kK0Long , kPiPlus, kPiMinus, + kKPlus, kKMinus, kLambda0, kLambda0Bar, kK0Short, + kSigmaMinus, kSigmaPlus, kSigma0, kPi0, kK0, kK0Bar, + 0,kNuMu,kNuMuBar +*/ + switch(fTrackType) + { + + case kAllP: // All Stable particles to be included + if (fDebug > 5) Info("FillParticles","Storing particle"); + fInputObject.AddParticle(mPart); + break; + case kEM: // All Electromagnetic particles + if (mPart->GetPdgCode() == kElectron || + mPart->GetPdgCode() == kPositron || + mPart->GetPdgCode() == kGamma){ + if (fDebug > 5) Info("FillParticles","Storing electromagnetic particle"); + fInputObject.AddParticle(mPart); + } + break; + case kCharged: // All Particles with non-zero charge + if (pdgP->Charge() != 0) { + if (fDebug > 5) Info("FillParticles","Storing charged particle"); + fInputObject.AddParticle(mPart); + } + break; + case kNeutral: // All particles with no charge + if (pdgP->Charge() == 0){ + if (fDebug > 5) Info("FillParticles","Storing neutral particle"); + fInputObject.AddParticle(mPart); + } + break; + case kHadron: //All hadrons + if (mPart->GetPdgCode() != kElectron && + mPart->GetPdgCode() != kPositron && + mPart->GetPdgCode() != kGamma ) + { + + if (fDebug > 5) Info("FillParticles","Storing hadron"); + fInputObject.AddParticle(mPart); + } + break; + case kChargedHadron: // only charged hadrons + if (mPart->GetPdgCode() != kElectron && + mPart->GetPdgCode() != kPositron && + mPart->GetPdgCode() != kGamma && + pdgP->Charge() != 0 ){ + if (fDebug > 5) Info("FillParticles","Storing charged hadron"); + fInputObject.AddParticle(mPart); + } + break; + case kNoTracks: + break; + case kEMChargedPi0: + if (pdgP->Charge() != 0 || mPart->GetPdgCode() == kPi0 || + mPart->GetPdgCode() == kGamma ) + { + if (fDebug > 5) Info("FillTracks","Storing kEMChargedPi0 track"); + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(tmp); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + } + break; + case kNoNeutronNeutrinoKlong: + if ( mPart->GetPdgCode() != kNeutron && + mPart->GetPdgCode() != kNeutronBar && + mPart->GetPdgCode() != kK0Long && + mPart->GetPdgCode() != kNuE && + mPart->GetPdgCode() != kNuEBar && + mPart->GetPdgCode() != kNuMu && + mPart->GetPdgCode() != kNuMuBar && + mPart->GetPdgCode() != kNuTau && + mPart->GetPdgCode() != kNuTauBar ) + { + if (fDebug > 5) Info("FillTracks","Storing kNoNeutronNeutrinoKlong track"); + if (fSmearType == kSmear || + fSmearType == kSmearEffic ){ + Smear(mPart);/* + TParticle *tmp = Smear(MPart); + fInputObject.AddTrack(tmp); + delete tmp;*/ + }else{ + fInputObject.AddTrack(*mPart); + } + } + break; + default: + break; + } //end of switch + }// end of loop over particles + +} +void AliEMCALJetFinderInputSimPrep::FillDigits() +{ + // Fill digits to input object + +} +void AliEMCALJetFinderInputSimPrep::FillSDigits() +{ +Info("FillSDigits","Beginning FillSDigits"); + AliEMCALLoader *emcalLoader = dynamic_cast(AliRunLoader::GetRunLoader()->GetDetectorLoader("EMCAL")); + + // Fill digits to input object + for (Int_t towerid=0; towerid < emcalLoader->SDigits()->GetEntries(); towerid++) + { + fInputObject.AddEnergyToDigit(emcalLoader->SDigit(towerid)->GetId(), emcalLoader->SDigit(towerid)->GetAmp()); + } + +} + +void AliEMCALJetFinderInputSimPrep::Smear(TParticle *particle) +{ + // Smear particle momentum +if (fDebug > 5) Info("Smear","Beginning Smear"); + + Float_t tmp = AliEMCALFast::SmearMomentum(1,particle->P()); + Float_t tmpt = (tmp/particle->P()) * particle->Pt(); + if (fDebug > 10) Info("Smear","Smearing changed P from %f to %f",particle->Pt(),tmpt); + TLorentzVector tmpvector; + tmpvector.SetPtEtaPhiM(tmpt,particle->Eta(), particle->Phi(), particle->GetMass()); +// create a new particle with smearing momentum - and no daughter or parent information and the same +// vertex + + TParticle tmparticle(particle->GetPdgCode(), 1, 0, 0,0,0, + tmpvector.Px() , tmpvector.Py(), tmpvector.Pz(), tmpvector.Energy(), + particle->Vx(), particle->Vy(), particle->Vz(), particle->T()); + fInputObject.AddTrack(tmparticle); + return; +} + +void AliEMCALJetFinderInputSimPrep::FillPartonTracks(AliEMCALParton *parton) +{ + // Populate parton tracks for input distributions + if (fDebug>1) Info("FillPartonTracks","Beginning FillPartonTracks"); + AliRunLoader *rl = AliRunLoader::GetRunLoader(); + + Int_t npart = rl->Stack()->GetNprimary(); + Int_t ntracks =0; + TParticlePDG *getpdg; + TParticle *tempPart; + for (Int_t part = 0; part < npart; part++) + { + tempPart = rl->Stack()->Particle(part); + if (tempPart->GetStatusCode() != 1) continue; + if ((!fPythiaComparison)&&(tempPart->Eta() > fEtaMax || tempPart->Eta() < fEtaMin || + tempPart->Phi() > fPhiMax || tempPart->Phi() < fPhiMin) ){ + if (fDebug>10) Info("FillPartonTracks","Excluding particle not pointing at the EMCAL"); + continue; + } + getpdg = tempPart->GetPDG(); + if (getpdg->Charge() == 0.0 ) { + if (fDebug>10) Info("FillPartonTracks","Excluding a neutral particle"); + continue; + } + if ( (parton->Eta() - tempPart->Eta())*(parton->Eta() - tempPart->Eta()) + + (parton->Phi() - tempPart->Phi())*(parton->Phi() - tempPart->Phi()) < 1.0 ) ntracks++; + } + Float_t *energy = new Float_t[ntracks]; + Float_t *eta = new Float_t[ntracks]; + Float_t *phi = new Float_t[ntracks]; + Int_t *pdg = new Int_t[ntracks]; + ntracks=0; + for (Int_t part = 0; part < npart; part++) + { + tempPart = rl->Stack()->Particle(part); + if (tempPart->GetStatusCode() != 1) continue; + if ((!fPythiaComparison)&&(tempPart->Eta() > fEtaMax || tempPart->Eta() < fEtaMin || + tempPart->Phi() > fPhiMax || tempPart->Phi() < fPhiMin) ){ + if (fDebug>10) Info("FillPartonTracks","Excluding particle not pointing at the EMCAL"); + continue; + } + if (tempPart->GetStatusCode() != 1) continue; + getpdg = tempPart->GetPDG(); + if (getpdg->Charge() == 0.0 ) { + if (fDebug>10) Info("FillPartonTracks","Excluding a neutral particle"); + continue; + } + if ( (parton->Eta() - tempPart->Eta())*(parton->Eta() - tempPart->Eta()) + + (parton->Phi() - tempPart->Phi())*(parton->Phi() - tempPart->Phi()) < 1.0 ) + { + energy[ntracks] = tempPart->Pt(); + eta[ntracks] = tempPart->Eta(); + phi[ntracks] = tempPart->Phi(); + pdg[ntracks] = tempPart->GetPdgCode(); + ntracks++; + } + } + parton->SetTrackList(ntracks,energy,eta,phi,pdg); + delete[] energy; + delete[] eta; + delete[] phi; + delete[] pdg; +} + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderInputSimPrep.h b/EMCAL/jetfinder/AliEMCALJetFinderInputSimPrep.h new file mode 100644 index 00000000000..28509d475a2 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderInputSimPrep.h @@ -0,0 +1,60 @@ +#ifndef ALIEMCALJETFINDERINPUTSIMPREP_H +#define ALIEMCALJETFINDERINPUTSIMPREP_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// Class for JetFinder Input preparation from simulated data +//*-- Author: Mark Horner (LBL/UCT) +// +// + + +#include "AliEMCALJetFinderInput.h" +#include "AliEMCALJetFinderInputPrep.h" +#include "TTask.h" +#include "AliEMCALJetFinderTypes.h" + +class AliEMCALJetFinderInputSimPrep : public AliEMCALJetFinderInputPrep +{ + public: + AliEMCALJetFinderInputSimPrep(); + ~AliEMCALJetFinderInputSimPrep(); + void Reset(AliEMCALJetFinderResetType_t resettype); + void SetEMCALType(AliEMCALJetFinderEMCALType_t emcaltype ) {fEMCALType = emcaltype;} + //void SetDebug(Int_t debug = 0) {fDebug = debug;} + void SetSmearingType(AliEMCALJetFinderSmearingType_t smeartype ) {fSmearType = smeartype;} + void SetTrackType(AliEMCALJetFinderTrackType_t tracktype){fTrackType = tracktype;} + void SetEfficiency(Float_t efficiency) {fEfficiency = efficiency;} + void SetTimeCut(Float_t timecut) {fTimeCut = timecut; fEMCALType = kTimeCut;} + Int_t FillFromFile(TString *filename, AliEMCALJetFinderFileType_t filetype,Int_t EventNumber,TString data="XH"); + AliEMCALJetFinderInput* GetJetFinderInput(){return &fInputObject;} + private: + void FillHits(); // Fill from the hits to input object from simulation + void FillSDigits(); // Fill from the hits to input object from simulation + void FillTracks(); // Fill from particles simulating a TPC to input object from simulation + void Smear(TParticle *particle); + Bool_t Efficiency(); + void FillPartons(); // Fill partons to input object from simulation + void FillPartonTracks(AliEMCALParton *parton); // Fill partons to input object from simulation + void FillParticles(); // Fill particles to input object from simulation + void FillDigits(); // Fill digits to input object + + AliEMCALJetFinderEMCALType_t fEMCALType; // The EMCAL type set by the user + AliEMCALJetFinderSmearingType_t fSmearType; // The efficiency and smearing for TPC + AliEMCALJetFinderTrackType_t fTrackType; // The Track type set by the user + AliEMCALJetFinderFileType_t fFileType; //! The type of file being processed + Float_t fEfficiency; // The TPC efficiency + Float_t fTimeCut; // User specified time cut + Float_t fEtaMax; // User specified time cut + Float_t fEtaMin; // User specified time cut + Float_t fPhiMax; // User specified time cut + Float_t fPhiMin; // User specified time cut + + ClassDef(AliEMCALJetFinderInputSimPrep,1) + +}; +#endif diff --git a/EMCAL/jetfinder/AliEMCALJetFinderOutput.cxx b/EMCAL/jetfinder/AliEMCALJetFinderOutput.cxx new file mode 100644 index 00000000000..4b213c35fbf --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderOutput.cxx @@ -0,0 +1,196 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + +//_________________________________________________________________________ +// Output object for jetfinder +// -- +//*-- Author: Renan Cabrera (LBL) +// Mark Horner (LBL/UCT) +// -- + + +#include +#include +#include + +//..................... +#include "AliEMCALJet.h" +#include "AliEMCALParton.h" +#include "AliEMCALJetFinderOutput.h" +#include "AliEMCALJetFinderInput.h" + +ClassImp(AliEMCALJetFinderOutput) + +//________________________________________________________________________ +AliEMCALJetFinderOutput::AliEMCALJetFinderOutput(){ + // Default constructor + + fNMaxJets=10; + fNMaxParticles=2000; + fNMaxPartons=4; + fInitialised=kFALSE; + fDebug=0; + fNPartons=0; + fNJets=0; + fNParticles=0; + + fJetsArray=0; + fParticlesArray=0; + fPartonsArray=0; + +if (fDebug>0) Info("AliEMCALJetFinderOutput","Beginning Constructor"); + +} //________________________________________________________________________ +void AliEMCALJetFinderOutput::InitArrays() +{ + // Initialise arrays - legacy from TClones days +if (fDebug>1) Info("AliEMCALJetFinderOutput","Beginning InitArrays"); + fParticlesArray=new TClonesArray("TParticle",fNMaxParticles); + fPartonsArray=new TClonesArray("AliEMCALParton",fNMaxPartons); + fJetsArray=new TClonesArray("AliEMCALJet",fNMaxJets); + //fJetsArray->BypassStreamer(kFALSE); + fInitialised=1; +} + +//_______________________________________________________________________ +AliEMCALJetFinderOutput::~AliEMCALJetFinderOutput() +{ + // Default destrucotr +if (fDebug>0) Info("~AliEMCALJetFinderOutput","Beginning Destructor"); + delete fParticlesArray; + delete fPartonsArray; + delete fJetsArray; +} + +//_______________________________________________________________________ +void AliEMCALJetFinderOutput::Reset(AliEMCALJetFinderResetType_t resettype) +{ +// Reset stored data + +if (fDebug>1) Info("Reset","Beginning Reset"); +if (!fInitialised) InitArrays(); + if ( resettype == kResetAll || + resettype == kResetJets|| + resettype == kResetData ){ + fNJets = 0; + if (fJetsArray) + fJetsArray->Clear(); + } + if ( resettype == kResetAll || + resettype == kResetPartons|| + resettype == kResetData ){ + fNPartons = 0; + if (fPartonsArray) + fPartonsArray->Clear(); + } + if ( resettype == kResetAll || + resettype == kResetParticles|| + resettype == kResetData ){ + fNParticles = 0; + if (fParticlesArray) + fParticlesArray->Clear(); + } +} +//________________________________________________________________________ +void AliEMCALJetFinderOutput::AddJet(AliEMCALJet* jet) +{ +// Add a jet to the array + +if (fDebug>1) Info("AddJet","Beginning AddJet"); +if (!fInitialised) InitArrays(); + + + if (fNJets < fNMaxJets){ + new(fJetsArray->AddrAt(fNJets)) AliEMCALJet( *jet ); + fNJets++; + }else + { + Error("AddJet","Cannot AddJet - maximum exceeded"); + } + +} + + +//_______________________________________________________________________ +void AliEMCALJetFinderOutput::AddParton(AliEMCALParton* parton) +{ +//Add a parton to the array + +if (fDebug>1) Info("AddParton","Beginning AddParton"); +if (!fInitialised) InitArrays(); + + if (fNPartons < fNMaxPartons){ + new(fPartonsArray->AddrAt(fNPartons)) AliEMCALParton( *parton ); + fNPartons++; + }else + { + Error("AddParton","Cannot AddParton - maximum exceeded"); + } + +} + +//_______________________________________________________________________ +void AliEMCALJetFinderOutput::AddParticle(TParticle* particle) +{ +//Add a particle tot he array + +if (fDebug>1) Info("AddParticle","Beginning AddParticle"); +if (!fInitialised) InitArrays(); + + if (fNParticles < fNMaxParticles){ + new(fParticlesArray->AddrAt(fNParticles)) TParticle( *particle ); + fNParticles++; + }else + { + Error("AddParticle","Cannot AddParticle - maximum exceeded"); + } +} + +//______________________________________________________________________ +AliEMCALJet* AliEMCALJetFinderOutput::GetJet(Int_t jetID) +{ + // return a jet +if (fDebug>1) Info("GetJet","Beginning GetJet"); + + if (jetID >= fNJets) return 0; + return (AliEMCALJet*)fJetsArray->At(jetID); + +} + +//______________________________________________________________________ +AliEMCALParton* AliEMCALJetFinderOutput::GetParton(Int_t partonID) +{ + //return a parton +if (fDebug>1) Info("GetParton","Beginning GetParton"); + + if (partonID >= fNPartons) return 0; + return (AliEMCALParton*) fPartonsArray->At(partonID); +} + +//______________________________________________________________________ +TParticle* AliEMCALJetFinderOutput::GetParticle(Int_t particleID) +{ +//return a particle + +if (fDebug>1) Info("GetParticle","Beginning GetParticle"); + + if (particleID >= fNParticles) return 0; + return (TParticle*) fParticlesArray->At(particleID); + +} + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderOutput.h b/EMCAL/jetfinder/AliEMCALJetFinderOutput.h new file mode 100644 index 00000000000..1342348620d --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderOutput.h @@ -0,0 +1,59 @@ +#ifndef ALIEMCALJETFINDEROUTPUT_H +#define ALIEMCALJETFINDEROUTPUT_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// Output object for jetfinder +// +//*-- Author: Renan Cabrera (LBL) +// Mark Horner (LBL/UCT) +// + +class TClonesArray; +#include "TObject.h" +#include "TParticle.h" +#include "AliEMCALParton.h" +#include "AliEMCALJet.h" +#include "AliEMCALJetFinderTypes.h" + +class AliEMCALJetFinderOutput : public TObject +{ + + public: + AliEMCALJetFinderOutput(); + ~AliEMCALJetFinderOutput(); + void Reset(AliEMCALJetFinderResetType_t resettype); + void AddJet(AliEMCALJet *jet); + void AddParton(AliEMCALParton *parton); + void AddParticle(TParticle *particle); + void SetDebug(Int_t debug){fDebug = debug;} + AliEMCALJet* GetJet(Int_t jetID); + Int_t GetNJets() const {return fNJets;} + TClonesArray *GetJets() {return fJetsArray; } + AliEMCALParton* GetParton(Int_t partonID); + Int_t GetNPartons() const {return fNPartons;} + TParticle* GetParticle(Int_t particleID); + TClonesArray *GetParticles() {return fParticlesArray; } + Int_t GetNParticles() const {return fNParticles;} + + ClassDef(AliEMCALJetFinderOutput,5) + private: + void InitArrays(); + TClonesArray *fJetsArray; // Array of jet objects + TClonesArray *fPartonsArray; // Array of parton objects + Int_t fNPartons; // Number of Partons actually stored + Int_t fNJets; // Number of jets actually stored + TClonesArray *fParticlesArray; // Array of particles + Int_t fNParticles; // Number of particles actually stored + Int_t fNMaxJets; // Maximum number of jets + Int_t fNMaxParticles; // Maximum number of primary particles + Int_t fNMaxPartons; // Maximum number of primary particles + Int_t fDebug; // Debug level + Bool_t fInitialised; // stores whether or not the arrays have been initialised + +}; +#endif diff --git a/EMCAL/jetfinder/AliEMCALJetFinderPlots.cxx b/EMCAL/jetfinder/AliEMCALJetFinderPlots.cxx new file mode 100644 index 00000000000..d57d7b4d60b --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderPlots.cxx @@ -0,0 +1,684 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + + +//_________________________________________________________________________ +// Class for Filling JetFinder Plots +// -- +//*-- Author: Mark Horner (LBL/UCT) +// -- +// -- + + +#include "TMath.h" +#include "AliEMCALJetFinderPlots.h" + +ClassImp(AliEMCALJetFinderPlots) + +AliEMCALJetFinderPlots::AliEMCALJetFinderPlots() +{ + // Constructor to initialise variables + fInitialised = kFALSE; + fNominalEnergy = 0.0; + fConeRadius = 0.3; + fDebug = 0; + fOutput=0; + fhFragmFcn=0;// = new TH1F("hFragmFcn","Fragmentation Function",100,0,1); + fhPartonFragmFcn=0;// = new TH1F("hPartonFragmFcn","Fragmentation Function",100,0,1); + fhPartonJT=0;// = new TH1F("hPartonJT","Track Momentum Perpendicular to Parton Axis",100,0.,10.); + fhPartonPL=0;// = new TH1F("hPartonPL","Track Momentum Parallel to Parton Axis ",100,0.,100.); + fhJetJT=0;// = new TH1F("hJetJT","Track Momentum Perpendicular to Jet Axis",100,0.,10.); + fhJetPL=0;// = new TH1F("hJetPL","Track Momentum Parallel to Jet Axis ",100,0.,100.); + fhJetEt=0;// = new TH1F("hJetEt","E_{T}^{reco}",250,0.,250.); + fhJetEta=0;// = new TH1F("hJetEta","#eta_{jet}^{reco}",180,-0.9,0.9); + fhJetPhi=0;// = new TH1F("hJetPhi","#phi_{jet}^{reco}",62,0.,3.1); + fhPartonEta=0;// = new TH1F("hPartonEta","#eta_{Parton}",180,-0.9,0.9); + fhPartonPhi=0;// = new TH1F("hPartonPhi","#phi_{Parton}",62,0.,3.1); + fhEtaDiff=0;// = new TH1F("hEtaDiff","#eta_{jet}^{reco}-#eta_{jet}^{input}",100,-0.5,0.5); + fhPhiDiff=0;// = new TH1F("hPhiDiff","#phi_{jet}^{reco}-#phi_{jet}^{input}",100,-0.5,0.5); + fhNJets=0;// = new TH1F("hNJets","N Reconstructed jets",11,-0.5,10.5); + fhEtaPhiSpread=0; + +fhFragmFcn2=0; // ("hFragmFcn2","Fragmentation Function",100,0,1); +fhPartonFragmFcn2=0;// ("hFragmFcn2","Parton Fragmentation Function",100,0,1); +fhPartonJT2=0; // ("hPartonJT2","Track Momentum Perpendicular to Parton Axis",100,0.,10.); +fhPartonPL2=0; // ("hPartonPL2","Track Momentum Parallel to Parton Axis ",100,0.,100.); +fhJetJT2=0; // ("hJetJT2","Track Momentum Perpendicular to Jet Axis",100,0.,10.); +fhJetPL2=0; // ("hJetPL2","Track Momentum Parallel to Jet Axis ",100,0.,100.); +fhJetEt2=0; // ("hJetEt2","E_{T}^{reco}",250,0.,250.); +fhJetEta2=0; // ("hJetEta2","#eta_{jet}^{reco}",180,-0.9,0.9); +fhJetPhi2=0; // ("hJetPhi2","#phi_{jet}^{reco}",62,0.,3.1); +fhPartonEta2=0; // ("hPartonEta2","#eta_{Parton}",180,-0.9,0.9); +fhPartonPhi2=0; // ("hPartonPhi2","#phi_{Parton}",62,0.,3.1); +fhEtaDiff2=0; // ("hEtaDiff2","#eta_{jet}^{reco}-#eta_{jet}^{input}",100,-0.5,0.5); +fhPhiDiff2=0; // ("hPhiDiff2","#phi_{jet}^{reco}-#phi_{jet}^{input}",100,-0.5,0.5); +fhEtaPhiSpread2=0; // ("hEtaPhiSpread2","#eta - #phi Distribution + //of Reconstructed Jets",192,-0.7,0.7,288,pi/3,pi); +fhNJets2=0; // ("hNJets2","N Reconstructed jets",11,-0.5,10.5); +fhJetEtSecond2=0; //("hJetEtSecond2","E_{T}^{reco}",250,0.,250.); +fhJetEtRatio2=0; //("hJetEtRatio2","Ratio of Second Highest to Highest",100,0,1); +fhEtaPhiDist2=0; //("hEtaPhiDist2","Angular Distance Between First and Second",100,0,3); +fhInputOutput=0; +// TH2F *fhInputOutput; //("hJetEtRatio2","Ratio of Second Highest to Highest",100,0,1); + +fhRecoBinPt=0; // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); +fhRecoBinPtNoBg=0; // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); +fhRecoBinPartonPt=0; // ("fhRecoBinPartonPt","Input Pt Distribution",100,0,1); +fhRecoBinJetEt=0; // ("fhRecoJetEt","E_{T}^{reco}",250,0.,250.); +fhRecoBinInputJetEt=0; // ("fhRecoInputJetEt","E_{T}^{reco}",250,0.,250.); +fhJetPT =0;// new TH1F("hJetPT","P_{T} Distribution",200,0,200); +fhPartonPT =0;// new TH1F("hPartonPT","Parton P_{T} Distribution",200,0,1); +fhJetPT2 =0;// new TH1F("hJetPT","P_{T} Distribution",200,0,200); +fhPartonPT2 =0;// new TH1F("hPartonPT","Parton P_{T} Distribution",200,0,1); +fhRecoBinFragmFcn =0;//new TH1F("fhRecoBinFragmFcn","Reconstructed Frag. Fcn",100,0,1); +fhRecoBinFragmFcnNoBg =0;//new TH1F("fhRecoBinFragmFcn","Reconstructed Frag. Fcn",100,0,1); +fhRecoBinPartonFragmFcn =0;// new TH1F("fhRecoBinPartonFragmFcn","Input Bin Fragm Fcn Distribution",100,0,1); +fhJetInvE=0;// = new TH1F("fhJetInvE","#frac{1}{E_{R}}",100,0,1); +fhJetInvE2=0;// = new TH1F("fhJetInvE","#frac{1}{E_{R}}",100,0,1); +fScaleFactor = 1.0/0.6731; +fhBackHisto=0; + +} + +void AliEMCALJetFinderPlots::InitPlots() +{ +//========================= CASE 1 ======================================= + fhFragmFcn = new TH1F("hFragmFcn","Fragmentation Function",200,0,2); + fhFragmFcn->Sumw2(); + fhJetPT = new TH1F("hJetPT","P_{T} Distribution",200,0,200); + fhJetPT->Sumw2(); + fhPartonPT = new TH1F("hPartonPT","Parton P_{T} Distribution",200,0,200); + fhPartonPT->Sumw2(); + fhPartonFragmFcn = new TH1F("hPartonFragmFcn","Parton Fragmentation Function",200,0,2); + fhPartonFragmFcn->Sumw2(); + fhPartonJT = new TH1F("hPartonJT","Track Momentum Perpendicular to Parton Axis",100,0.,10.); + fhPartonJT->Sumw2(); + fhPartonPL = new TH1F("hPartonPL","Track Momentum Parallel to Parton Axis ",100,0.,100.); + fhPartonPL->Sumw2(); + fhJetJT = new TH1F("hJetJT","Track Momentum Perpendicular to Jet Axis",100,0.,10.); + fhJetJT->Sumw2(); + fhJetPL = new TH1F("hJetPL","Track Momentum Parallel to Jet Axis ",100,0.,100.); + fhJetPL->Sumw2(); + fhJetEt = new TH1F("hJetEt","E_{T}^{reco}",250,0.,250.); + fhJetEt->Sumw2(); + fhJetEtDiff = new TH1F("hJetEtDiff","E_{T}^{reco}-E_{T}^{Parton}",250,-124.,125.); + fhJetEtDiff->Sumw2(); + fhJetEta = new TH1F("hJetEta","#eta_{jet}^{reco}",180,-0.9,0.9); + fhJetEta->Sumw2(); + fhJetPhi = new TH1F("hJetPhi","#phi_{jet}^{reco}",62,0.,3.1); + fhJetPhi->Sumw2(); + fhPartonEta = new TH1F("hPartonEta","#eta_{Parton}",180,-0.9,0.9); + fhPartonEta->Sumw2(); + fhPartonPhi = new TH1F("hPartonPhi","#phi_{Parton}",62,0.,3.1); + fhPartonPhi->Sumw2(); + fhEtaDiff = new TH1F("hEtaDiff","#eta_{jet}^{reco}-#eta_{jet}^{input}",100,-0.5,0.5); + fhEtaDiff->Sumw2(); + fhPhiDiff = new TH1F("hPhiDiff","#phi_{jet}^{reco}-#phi_{jet}^{input}",100,-0.5,0.5); + fhPhiDiff->Sumw2(); + fhNJets = new TH1F("hNJets","N Reconstructed jets",11,-0.5,10.5); + fhNJets->Sumw2(); + fhEtaPhiSpread = new TH2F("hEtaPhiSpread","#eta - #phi Distribution of Reconstructed Jets",100,-0.5,0.5,100,-0.5,0.5); + fhEtaPhiSpread->Sumw2(); + fhNJets->SetXTitle("N_{jets}^{reco}/event"); + fhNJets->SetYTitle("N_{events}"); + + //Jet properties + fhJetEt->SetFillColor(16); + fhJetEt->SetXTitle("E_{T}^{reco}"); + + fhJetEta->SetFillColor(16); + fhJetEta->SetXTitle("#eta_{jet}^{reco}"); + + fhJetPhi->SetFillColor(16); + fhJetPhi->SetXTitle("#phi_{jet}^{reco}"); + + fhPartonEta->SetFillColor(16); + fhPartonEta->SetXTitle("#eta_{parton}"); + + fhPartonPhi->SetFillColor(16); + fhPartonPhi->SetXTitle("#phi_{parton}"); + + fhPartonPL->SetXTitle("p (GeV/c)"); + fhPartonJT->SetXTitle("p (GeV/c)"); + + fhPartonFragmFcn->SetXTitle("Z = p_{T}^{Chg}/E_{T}^{parton}"); + + //Jet component properties + + fhJetPL->SetXTitle("p (GeV/c)"); + fhJetJT->SetXTitle("p (GeV/c)"); + fhFragmFcn->SetXTitle("Z = p_{T}^{Chg}/E_{T}^{reco}"); + fhPartonFragmFcn->SetXTitle("Z = p_{T}^{Chg}/E_{T}^{reco}"); + + fhEtaDiff->SetXTitle("#eta_{jet}^{reco}-#eta_{jet}^{input}"); + fhPhiDiff->SetXTitle("#phi_{jet}^{reco}-#phi_{jet}^{input}"); + fhEtaPhiSpread->SetXTitle("#eta"); + fhEtaPhiSpread->SetYTitle("#phi"); + +//======================= CASE 2 ====================================== + + +fhFragmFcn2 = new TH1F("hFragmFcn2","Fragmentation Function",200,0,2); +fhFragmFcn2->Sumw2(); + fhJetPT2 = new TH1F("hJetPT2","P_{T} Distribution",200,0,200); + fhJetPT2->Sumw2(); + fhPartonPT2 = new TH1F("hPartonPT2","Parton P_{T} Distribution",200,0,1); + fhPartonPT2->Sumw2(); +fhPartonFragmFcn2 = new TH1F("hPartonFragmFcn2","Parton Fragmentation Function",200,0,2); +fhPartonFragmFcn2->Sumw2(); +fhPartonJT2 = new TH1F("hPartonJT2","Track Momentum Perpendicular to Parton Axis",100,0.,10.); +fhPartonJT2->Sumw2(); +fhPartonPL2 = new TH1F("hPartonPL2","Track Momentum Parallel to Parton Axis ",100,0.,100.); +fhPartonPL2->Sumw2(); +fhJetJT2 = new TH1F("hJetJT2","Track Momentum Perpendicular to Jet Axis",100,0.,10.); +fhJetJT2->Sumw2(); +fhJetPL2 = new TH1F("hJetPL2","Track Momentum Parallel to Jet Axis ",100,0.,100.); +fhJetPL2->Sumw2(); +fhJetEt2 = new TH1F("hJetEt2","E_{T}^{reco}",250,0.,250.); +fhJetEt2->Sumw2(); + fhJetEtDiff2 = new TH1F("hJetEtDiff2","E_{T}^{reco}-E_{T}^{Parton}",250,-124.,125.); + fhJetEtDiff2->Sumw2(); +fhJetEta2 = new TH1F("hJetEta2","#eta_{jet}^{reco}",180,-0.9,0.9); +fhJetEta2->Sumw2(); +fhJetPhi2 = new TH1F("hJetPhi2","#phi_{jet}^{reco}",62,0.,3.1); +fhJetPhi2->Sumw2(); +fhPartonEta2 = new TH1F("hPartonEta2","#eta_{Parton}",180,-0.9,0.9); +fhPartonEta2->Sumw2(); +fhPartonPhi2 = new TH1F("hPartonPhi2","#phi_{Parton}",62,0.,3.1); +fhPartonPhi2->Sumw2(); +fhEtaDiff2 = new TH1F("hEtaDiff2","#eta_{jet}^{reco}-#eta_{jet}^{input}",100,-0.5,0.5); +fhEtaDiff2->Sumw2(); +fhPhiDiff2 = new TH1F("hPhiDiff2","#phi_{jet}^{reco}-#phi_{jet}^{input}",100,-0.5,0.5); +fhPhiDiff2->Sumw2(); +fhEtaPhiSpread2 = new TH2F("hEtaPhiSpread2","#eta - #phi Distribution of Reconstructed Jets",100,-0.5,0.5,100,-0.5,0.5); +fhEtaPhiSpread2->Sumw2(); +fhNJets2 = new TH1F("hNJets2","N Reconstructed jets",11,-0.5,10.5); +fhNJets2->Sumw2(); +fhJetEtSecond2 = new TH1F("hJetEtSecond2","E_{T}^{reco}",250,0.,250.); +fhJetEtSecond2->Sumw2(); +fhJetEtRatio2 = new TH1F("hJetEtRatio2","Ratio of Second Highest to Highest",100,0,1); +fhJetEtRatio2->Sumw2(); +fhEtaPhiDist2 = new TH1F("hEtaPhiDist2","Angular Distance Between First and Second",100,0,3); +fhEtaPhiDist2->Sumw2(); + +fhInputOutput= new TH2F("hInputOutput","Input and Reconstruction Correlations;Input;Output",200,0,200,200,0,200); //("hJetEtRatio2","Ratio of Second Highest to Highest",100,0,1); + +//============================== Reconstruction Bin Comparison ============================================ + +fhRecoBinPt =new TH1F("fhRecoBinPt","Reconstructed Pt Distribution",200,0,200); +fhRecoBinPt->Sumw2(); +fhRecoBinPtNoBg =new TH1F("fhRecoBinPtNoBg","Reconstructed Pt Distribution Background Subtracted",200,0,200); +fhRecoBinPtNoBg->Sumw2(); +fhRecoBinPartonPt = new TH1F("fhRecoBinPartonPt","Input Pt Distribution",200,0,200); +fhRecoBinPartonPt->Sumw2(); +fhRecoBinFragmFcn =new TH1F("fhRecoBinFragmFcn","Reconstructed Frag. Fcn",200,0,2); +fhRecoBinFragmFcn->Sumw2(); +fhRecoBinFragmFcnNoBg =new TH1F("fhRecoBinFragmFcnNoBg","Reconstructed Frag. Fcn With Background Removed",200,0,2); +fhRecoBinFragmFcnNoBg->Sumw2(); +fhRecoBinPartonFragmFcn = new TH1F("fhRecoBinPartonFragmFcn","Input Bin Fragm Fcn Distribution",200,0,2); +fhRecoBinPartonFragmFcn->Sumw2(); +fhRecoBinJetEt = new TH1F("fhRecoJetEt","E_{T}^{reco}",250,0.,250.); +fhRecoBinJetEt->Sumw2(); +fhRecoBinInputJetEt = new TH1F("fhRecoInputJetEt","E_{T}^{reco}",250,0.,250.); +fhRecoBinInputJetEt->Sumw2(); + + +fhJetInvE = new TH1F("fhJetInvE","#frac{1}{E_{R}}",100,0,1); +fhJetInvE->Sumw2(); +fhJetInvE2 = new TH1F("fhJetInvE2","#frac{1}{E_{R}}",100,0,1); +fhJetInvE2->Sumw2(); + + + + fInitialised = kTRUE; + +} + +AliEMCALJetFinderPlots::~AliEMCALJetFinderPlots() +{ + // To ensure that all requested memory is returned +delete fhFragmFcn;// = new TH1F("hFragmFcn","Fragmentation Function",100,0,1); +delete fhPartonFragmFcn;// = new TH1F("hFragmFcn","Fragmentation Function",100,0,1); +delete fhPartonJT;// = new TH1F("hPartonJT","Track Momentum Perpendicular to Parton Axis",100,0.,10.); +delete fhPartonPL;// = new TH1F("hPartonPL","Track Momentum Parallel to Parton Axis ",100,0.,100.); +delete fhJetJT;// = new TH1F("hJetJT","Track Momentum Perpendicular to Jet Axis",100,0.,10.); +delete fhJetPL;// = new TH1F("hJetPL","Track Momentum Parallel to Jet Axis ",100,0.,100.); +delete fhJetEt;// = new TH1F("hJetEt","E_{T}^{reco}",250,0.,250.); +delete fhJetEtDiff; // ("hJetEt2","E_{T}^{reco}",250,0.,250.); +delete fhJetEta;// = new TH1F("hJetEta","#eta_{jet}^{reco}",180,-0.9,0.9); +delete fhJetPhi;// = new TH1F("hJetPhi","#phi_{jet}^{reco}",62,0.,3.1); +delete fhPartonEta;// = new TH1F("hPartonEta","#eta_{Parton}",180,-0.9,0.9); +delete fhPartonPhi;// = new TH1F("hPartonPhi","#phi_{Parton}",62,0.,3.1); +delete fhEtaDiff;// = new TH1F("hEtaDiff","#eta_{jet}^{reco}-#eta_{jet}^{input}",100,-0.5,0.5); +delete fhPhiDiff;// = new TH1F("hPhiDiff","#phi_{jet}^{reco}-#phi_{jet}^{input}",100,-0.5,0.5); +delete fhNJets;// = new TH1F("hNJets","N Reconstructed jets",11,-0.5,10.5); +delete fhEtaPhiSpread; + + delete fhFragmFcn2; // ("hFragmFcn2","Fragmentation Function",100,0,1); + delete fhPartonFragmFcn2;// ("hFragmFcn2","Parton Fragmentation Function",100,0,1); + delete fhPartonJT2; // ("hPartonJT2","Track Momentum Perpendicular to Parton Axis",100,0.,10.); + delete fhPartonPL2; // ("hPartonPL2","Track Momentum Parallel to Parton Axis ",100,0.,100.); + delete fhJetJT2; // ("hJetJT2","Track Momentum Perpendicular to Jet Axis",100,0.,10.); + delete fhJetPL2; // ("hJetPL2","Track Momentum Parallel to Jet Axis ",100,0.,100.); + delete fhJetEt2; // ("hJetEt2","E_{T}^{reco}",250,0.,250.); + delete fhJetEtDiff2; // ("hJetEt2","E_{T}^{reco}",250,0.,250.); + delete fhJetEta2; // ("hJetEta2","#eta_{jet}^{reco}",180,-0.9,0.9); + delete fhJetPhi2; // ("hJetPhi2","#phi_{jet}^{reco}",62,0.,3.1); + delete fhPartonEta2; // ("hPartonEta2","#eta_{Parton}",180,-0.9,0.9); + delete fhPartonPhi2; // ("hPartonPhi2","#phi_{Parton}",62,0.,3.1); + delete fhEtaDiff2; // ("hEtaDiff2","#eta_{jet}^{reco}-#eta_{jet}^{input}",100,-0.5,0.5); + delete fhPhiDiff2; // ("hPhiDiff2","#phi_{jet}^{reco}-#phi_{jet}^{input}",100,-0.5,0.5); + delete fhEtaPhiSpread2; // ("hEtaPhiSpread2","#eta - #phi Distribution + //of Reconstructed Jets",192,-0.7,0.7,288,pi/3,pi); + delete fhNJets2; // ("hNJets2","N Reconstructed jets",11,-0.5,10.5); + delete fhJetEtSecond2; //("hJetEtSecond2","E_{T}^{reco}",250,0.,250.); + delete fhJetEtRatio2; //("hJetEtRatio2","Ratio of Second Highest to Highest",100,0,1); + delete fhEtaPhiDist2; //("hEtaPhiDist2","Angular Distance Between First and Second",100,0,3); + + delete fhRecoBinPt; // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + delete fhRecoBinPtNoBg; // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + delete fhRecoBinPartonPt; // ("fhRecoBinPartonPt","Input Pt Distribution",100,0,1); + delete fhRecoBinJetEt; // ("fhRecoJetEt","E_{T}^{reco}",250,0.,250.); + delete fhRecoBinInputJetEt; // ("fhRecoInputJetEt","E_{T}^{reco}",250,0.,250.); + + delete fhJetPT ;// new TH1F("hJetPT","P_{T} Distribution",200,0,200); + delete fhPartonPT ;// new TH1F("hPartonPT","Parton P_{T} Distribution",200,0,1); + delete fhJetPT2 ;// new TH1F("hJetPT","P_{T} Distribution",200,0,200); + delete fhPartonPT2 ;// new TH1F("hPartonPT","Parton P_{T} Distribution",200,0,1); + delete fhRecoBinFragmFcn;//new TH1F("fhRecoBinFragmFcn","Reconstructed Frag. Fcn",100,0,1); + delete fhRecoBinFragmFcnNoBg;//new TH1F("fhRecoBinFragmFcn","Reconstructed Frag. Fcn",100,0,1); + delete fhRecoBinPartonFragmFcn;// new TH1F("fhRecoBinPartonFragmFcn","Input Bin Fragm Fcn Distribution",100,0,1); + delete fhJetInvE;// = new TH1F("fhJetInvE","#frac{1}{E_{R}}",100,0,1); + delete fhJetInvE2;// = new TH1F("fhJetInvE","#frac{1}{E_{R}}",100,0,1); + +} + +void AliEMCALJetFinderPlots::FillFromOutput(AliEMCALJetFinderOutput* output, Float_t weight) +{ + // Fill histograms from an output object +if (!fInitialised) InitPlots(); + fOutput = output; + if (!fOutput) return; +// Make some temporary histograms to make sure we subtract + // background properly +/* +tempFragmFcnNoBg =new TH1F("tempFragmFcnNoBg","Reconstructed Frag. Fcn With Background Removed",200,0,2); +tempPtNoBg =new TH1F("tempPtNoBg","Reconstructed Frag. Fcn With Background Removed",200,0,200); +tempFragmFcnNoBg->Fill(count/(jethighest->Energy()*fScaleFactor),-fhBackHisto->GetBinContent(count)); +tempPtNoBg->AddBinContent(count,-fhBackHisto->GetBinContent(count)); +*/ + + fhNJets->Fill(fOutput->GetNJets()); + Bool_t doesJetMeetBinCriteria = 0; + AliEMCALJet* jethighest=0; + AliEMCALJet* jetsecond=0; + // Find Highest and Second Highest Jet + // (NB!!!!!!!) Pointing into the EMCAL!!!!!! + +// =========================== All cases =================================== + + + // I will make a little array of jet indices for which jets are in + // the EMCAL then my counter can loop from 0 below - but it will + // be the index of the array of applicable jets + + Int_t appjet[4]; + Int_t numappjet=0; + + for (Int_t appc=0;appcGetNJets();appc++) + { // Check all jets for applicability + Float_t eta = fOutput->GetJet(appc)->Eta(); + Float_t phi = fOutput->GetJet(appc)->Phi(); + if (eta > -0.7 && eta < 0.7 && phi > 1./3.*TMath::Pi() && phi < TMath::Pi()) + { // Then jet is applicable + appjet[numappjet]=appc; + numappjet++; + } + } + + +Float_t et=0; +if (numappjet >=1) +{ + Float_t theta = 2.0*atan(exp(-fOutput->GetParton(0)->Eta())); + et = fOutput->GetParton(0)->Energy() * TMath::Sin(theta); + if (fOutput->GetNJets()>1) + { + for (Int_t counter = 0; counterGetJet(appjet[0]); + jetsecond = fOutput->GetJet(appjet[1]); + } + if (counter>0) + { + Float_t energyhighest = jethighest->Energy(); + Float_t energysecond = jetsecond->Energy(); + + if ((fOutput->GetJet(appjet[counter]))->Energy()>energyhighest) + { + jetsecond=jethighest; + jethighest=fOutput->GetJet(appjet[counter]); + }else if ((fOutput->GetJet(appjet[counter]))->Energy()>energysecond) + { + jetsecond=fOutput->GetJet(appjet[counter]); + } + + } + } + }else + { + Float_t eta = fOutput->GetJet(0)->Eta(); + Float_t phi = fOutput->GetJet(0)->Phi(); + if (eta > -0.7 && eta < 0.7 && phi > 1./3.*TMath::Pi() && phi < TMath::Pi()) + { // Then jet is applicable + jethighest=fOutput->GetJet(0); + jetsecond=0; + }else + { + Error("FillFromOutput","There is only one jet and it isn't in the area of applicability"); + } + + } + if ( 95.0 < jethighest->Energy()*fScaleFactor && jethighest->Energy()*fScaleFactor < 105.0 ) + { + doesJetMeetBinCriteria = 1; + fhRecoBinJetEt->Fill(jethighest->Energy()*fScaleFactor,weight); + fhRecoBinInputJetEt->Fill(et,weight); + } + fhInputOutput->Fill(et,jethighest->Energy()); + +} + +if (numappjet > 1) +{ +//========================= CASE 2 =========================== + Int_t nPartons = fOutput->GetNPartons(); + fhNJets2->Fill(fOutput->GetNJets()); + AliEMCALParton* parton; + + // End finding highest and second highest and continue + fhJetEt2->Fill(jethighest->Energy()*fScaleFactor,weight); + fhJetEtDiff2->Fill(jethighest->Energy()*fScaleFactor-et,weight); + fhJetInvE2->Fill(1.0/(jethighest->Energy()*fScaleFactor),weight); + fhJetEta2->Fill(jethighest->Eta(),weight ); + fhJetPhi2->Fill(jethighest->Phi(),weight ); + if (nPartons ==0) return; + parton = fOutput->GetParton(0); + + fhPartonEta2->Fill( parton->Eta(),weight ); + fhPartonPhi2->Fill( parton->Phi(),weight ); + + //hJetEtDiff->Fill( jet->Energy() - parton->Energy() ); + fhEtaDiff2->Fill( jethighest->Eta() - parton->Eta(),weight ); + fhPhiDiff2->Fill( jethighest->Phi() - parton->Phi(),weight ); + fhEtaPhiSpread2->Fill(jethighest->Eta()-parton->Eta(),jethighest->Phi() - parton->Phi()); + fhJetEtSecond2->Fill(jetsecond->Energy()*fScaleFactor,weight); + fhJetEtRatio2->Fill(jetsecond->Energy()/jethighest->Energy(),weight); + fhEtaPhiDist2->Fill( TMath::Sqrt((jethighest->Eta() - jetsecond->Eta())*(jethighest->Eta() - jetsecond->Eta()) + + (jethighest->Phi() - jetsecond->Phi())*(jethighest->Phi() - jetsecond->Phi()) ),weight); + /* + Float_t *pt,*phi,*eta; + Int_t *pdg; + pt = new Float_t[parton->GetNTracks()]; + eta = new Float_t[parton->GetNTracks()]; + phi = new Float_t[parton->GetNTracks()]; + pdg = new Int_t[parton->GetNTracks()];*/ + + + + Float_t pt[2000]; + Float_t eta[2000]; + Float_t phi[2000]; + Int_t pdg[2000]; + + parton->GetTrackList(pt,eta,phi,pdg); + for(Int_t iT=0; iT< parton->GetNTracks() ; iT++ ) + { + if ( (eta[iT]-parton->Eta())*(eta[iT]-parton->Eta())+ + (phi[iT]-parton->Phi())*(phi[iT]-parton->Phi()) >fConeRadius * fConeRadius ) continue; + Double_t tt = 2.0*atan(exp(-eta[iT])); // These names are short to make the equation manageable + Double_t rt = 2.0*atan(exp(-parton->Eta())); + Double_t ctt = cos(tt); + Double_t crt = cos(rt); + Double_t stt = sin(tt); + Double_t srt = sin(rt); + Double_t ctp = cos(phi[iT]); + Double_t crp = cos(parton->Phi()); + Double_t stp = sin(phi[iT]); + Double_t srp = sin(parton->Phi()); + //Double_t alpha = acos(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt); + Double_t alpha; + if (TMath::Abs(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt) > 0.9990) + { + alpha = 0.0; + }else + { + alpha = TMath::ACos(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt); + } + Double_t correctp = pt[iT]/stt; + fhPartonPL2->Fill( correctp*cos(alpha),weight); + if ( (parton->Eta()-eta[iT])*(parton->Eta()-eta[iT]) + + (parton->Phi()-phi[iT])*(parton->Phi()-phi[iT]) < 0.2*0.2 ) + fhPartonJT2->Fill( correctp*sin(alpha),weight); + fhPartonPT2->Fill(correctp*sin(tt),weight); + if (fNominalEnergy == 0.0) { + fhPartonFragmFcn2->Fill( correctp*sin(tt)/parton->Energy(),weight ); + }else + { + fhPartonFragmFcn2->Fill(correctp*sin(tt)/fNominalEnergy,weight); + } + if (doesJetMeetBinCriteria) + { + fhRecoBinPartonPt->Fill(correctp*sin(tt),weight); // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + } + }// loop over tracks + +/* + pt = new Float_t[jet->NTracks()]; + eta = new Float_t[jet->NTracks()]; + phi = new Float_t[jet->NTracks()]; + pdg = new Int_t[jet->NTracks()];*/ + jethighest->TrackList(pt,eta,phi,pdg); + for(Int_t iT=0; iT< jethighest->NTracks() ; iT++ ) + { + Double_t tt = 2.0*atan(exp(-eta[iT])); // These names are short to make the equation manageable + Double_t rt = 2.0*atan(exp(-jethighest->Eta())); + Double_t ctt = cos(tt); + Double_t crt = cos(rt); + Double_t stt = sin(tt); + Double_t srt = sin(rt); + Double_t ctp = cos(phi[iT]); + Double_t crp = cos(jethighest->Phi()); + Double_t stp = sin(phi[iT]); + Double_t srp = sin(jethighest->Phi()); + // Double_t alpha = acos(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt); + Double_t alpha; + if (TMath::Abs(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt) > 0.9990) + { + alpha = 0.0; + }else + { + alpha = TMath::ACos(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt); + } + Double_t correctp = pt[iT]/stt; + fhJetPL2->Fill( correctp*cos(alpha),weight); + if ( (jethighest->Eta()-eta[iT])*(jethighest->Eta()-eta[iT]) + + (jethighest->Phi()-phi[iT])*(jethighest->Phi()-phi[iT]) < 0.2*0.2 ) + fhJetJT2->Fill( correctp*sin(alpha),weight); + fhJetPT2->Fill(correctp*sin(tt),weight); + if (fNominalEnergy==0.0){ + fhFragmFcn2->Fill( correctp*sin(tt)/(jethighest->Energy()*fScaleFactor),weight ); + } else + { + fhFragmFcn2->Fill( correctp*sin(tt)/fNominalEnergy,weight ); + } + if (doesJetMeetBinCriteria) + { + fhRecoBinPt->Fill(correctp*sin(tt),weight); // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + fhRecoBinPtNoBg->Fill(correctp*sin(tt),weight); // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + fhRecoBinFragmFcn->Fill( correctp*sin(tt)/(jethighest->Energy()*fScaleFactor),weight ); // This is the jet fragmentation function + fhRecoBinFragmFcnNoBg->Fill( correctp*sin(tt)/(jethighest->Energy()*fScaleFactor),weight ); // This is the jet fragmentation function + } + }// loop over tracks + } + + if (numappjet == 1) + { + +//========================= CASE 1 =========================== + Int_t nPartons = fOutput->GetNPartons(); + if (fOutput->GetNJets()!=1) return; + AliEMCALParton* parton; + AliEMCALJet* jet; + jet = jethighest;//fOutput->GetJet(0); + fhJetEt->Fill(jet->Energy()*fScaleFactor,weight); + fhJetEtDiff->Fill(jethighest->Energy()*fScaleFactor-et,weight); + fhJetInvE->Fill(1.0/(jethighest->Energy()*fScaleFactor),weight); + fhJetEta->Fill(jet->Eta(),weight ); + fhJetPhi->Fill(jet->Phi(),weight ); + if (nPartons ==0) return; + parton = fOutput->GetParton(0); + + fhPartonEta->Fill( parton->Eta(),weight ); + fhPartonPhi->Fill( parton->Phi(),weight ); + + //hJetEtDiff->Fill( jet->Energy() - parton->Energy() ); + fhEtaDiff->Fill( jet->Eta() - parton->Eta(),weight ); + fhPhiDiff->Fill( jet->Phi() - parton->Phi(),weight ); + fhEtaPhiSpread->Fill(jet->Eta()-parton->Eta(),jet->Phi() - parton->Phi()); + /* + Float_t *pt,*phi,*eta; + Int_t *pdg; + pt = new Float_t[parton->GetNTracks()]; + eta = new Float_t[parton->GetNTracks()]; + phi = new Float_t[parton->GetNTracks()]; + pdg = new Int_t[parton->GetNTracks()];*/ + + + + Float_t pt[2000]; + Float_t eta[2000]; + Float_t phi[2000]; + Int_t pdg[2000]; + + parton->GetTrackList(pt,eta,phi,pdg); + for(Int_t iT=0; iT< parton->GetNTracks() ; iT++ ) + { + if ( (eta[iT]-parton->Eta())*(eta[iT]-parton->Eta())+ + (phi[iT]-parton->Phi())*(phi[iT]-parton->Phi()) >fConeRadius * fConeRadius ) continue; + Double_t tt = 2.0*atan(exp(-eta[iT])); // These names are short to make the equation manageable + Double_t rt = 2.0*atan(exp(-parton->Eta())); + Double_t ctt = cos(tt); + Double_t crt = cos(rt); + Double_t stt = sin(tt); + Double_t srt = sin(rt); + Double_t ctp = cos(phi[iT]); + Double_t crp = cos(parton->Phi()); + Double_t stp = sin(phi[iT]); + Double_t srp = sin(parton->Phi()); + // Double_t alpha = acos(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt); + Double_t alpha; + if (TMath::Abs(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt) > 0.9990) + { + alpha = 0.0; + }else + { + alpha = TMath::ACos(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt); } + Double_t correctp = pt[iT]/stt; + fhPartonPL->Fill( correctp*cos(alpha),weight); + if ( (parton->Eta()-eta[iT])*(parton->Eta()-eta[iT]) + + (parton->Phi()-phi[iT])*(parton->Phi()-phi[iT]) < 0.2*0.2 ) + fhPartonJT->Fill( correctp*sin(alpha),weight); + if (fNominalEnergy == 0.0) { + fhPartonFragmFcn->Fill( correctp*sin(tt)/parton->Energy(),weight ); + fhPartonPT->Fill(correctp*sin(tt),weight); + }else + { + fhPartonFragmFcn->Fill(correctp*sin(tt)/fNominalEnergy,weight); + } + if (doesJetMeetBinCriteria) + { + fhRecoBinPartonPt->Fill(correctp*sin(tt),weight); // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + } + }// loop over tracks + +/* + pt = new Float_t[jet->NTracks()]; + eta = new Float_t[jet->NTracks()]; + phi = new Float_t[jet->NTracks()]; + pdg = new Int_t[jet->NTracks()];*/ + jet->TrackList(pt,eta,phi,pdg); + for(Int_t iT=0; iT< jet->NTracks() ; iT++ ) + { + Double_t tt = 2.0*atan(exp(-eta[iT])); // These names are short to make the equation manageable + Double_t rt = 2.0*atan(exp(-jet->Eta())); + Double_t ctt = cos(tt); + Double_t crt = cos(rt); + Double_t stt = sin(tt); + Double_t srt = sin(rt); + Double_t ctp = cos(phi[iT]); + Double_t crp = cos(jet->Phi()); + Double_t stp = sin(phi[iT]); + Double_t srp = sin(jet->Phi()); + //Info("plots","acos(%1.16f)\nstt=%f\npt=%f",crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt,stt,pt[iT]); + //Info("plots","diff to 1 %f",1.0-crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt); + Double_t alpha; + if (TMath::Abs(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt) > 0.9990) + { + alpha = 0.0; + }else + { + alpha = TMath::ACos(crp*ctp*srt*stt+srp*stp*srt*stt+crt*ctt); + } + Double_t correctp = pt[iT]/stt; + fhJetPL->Fill( correctp*cos(alpha),weight); + if ( (jet->Eta()-eta[iT])*(jet->Eta()-eta[iT]) + + (jet->Phi()-phi[iT])*(jet->Phi()-phi[iT]) < 0.2*0.2 ) + fhJetJT->Fill( correctp*sin(alpha),weight); + fhJetPT->Fill(correctp*sin(tt),weight); + if (fNominalEnergy==0.0){ + fhFragmFcn->Fill( correctp*sin(tt)/(jet->Energy()*fScaleFactor),weight ); // This is the jet fragmentation function + } else + { + fhFragmFcn->Fill( correctp*sin(tt)/fNominalEnergy,weight ); + } + if (doesJetMeetBinCriteria) + { + fhRecoBinPt->Fill(correctp*sin(tt),weight); // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + fhRecoBinPtNoBg->Fill(correctp*sin(tt),weight); // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + fhRecoBinFragmFcn->Fill( correctp*sin(tt)/(jet->Energy()*fScaleFactor),weight ); // This is the jet fragmentation function + fhRecoBinFragmFcnNoBg->Fill( correctp*sin(tt)/(jet->Energy()*fScaleFactor),weight ); // This is the jet fragmentation function + } + }// loop over tracks + } + +if (numappjet>=1 && fhBackHisto != 0 && doesJetMeetBinCriteria) + { + for (Int_t count=1;count<=100;count++) + { + fhRecoBinFragmFcnNoBg->Fill( ((Float_t)count)/(jethighest->Energy()*fScaleFactor),-fhBackHisto->GetBinContent(count)*weight); + fhRecoBinPtNoBg->AddBinContent(count,-fhBackHisto->GetBinContent(count)*weight); + } + } + + +} + + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderPlots.h b/EMCAL/jetfinder/AliEMCALJetFinderPlots.h new file mode 100644 index 00000000000..717f4e6b684 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderPlots.h @@ -0,0 +1,180 @@ +#ifndef ALIEMCALJETFINDERPLOTS_H +#define ALIEMCALJETFINDERPLOTS_H + +/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * * See cxx source for full Copyright notice */ + + +/* $Id$ */ + +//_________________________________________________________________________ +// Class for Filling jetfinder plots +// +//*-- Author: Mark Horner (LBL/UCT) +// +// + + + +#include "TObject.h" +#include "TH1F.h" +#include "TH2F.h" + +#include "AliEMCALJetFinderOutput.h" + +class AliEMCALJetFinderPlots : public TObject +{ + public: + AliEMCALJetFinderPlots(); + ~AliEMCALJetFinderPlots(); + void SetConeRadius(Float_t coneradius){fConeRadius = coneradius;} + void SetNominalEnergy(Float_t energy){fNominalEnergy = energy;} + void SetDebug(Int_t debug){fDebug = debug;} + void SetBackHisto(TH1F* histo){fhBackHisto=histo;} + void FillFromOutput(AliEMCALJetFinderOutput* output,Float_t weight=1.0); + //========================== CASE 1 ======================== + // Only consider events with only 1 jet + TH1F* GetFragmFcn(){return fhFragmFcn;} + TH1F* GetPartonFragmFcn(){return fhPartonFragmFcn;} + TH1F* GetPT(){return fhJetPT;} + TH1F* GetPartonPT(){return fhPartonPT;} + TH1F* GetJetJT(){return fhJetJT;} + TH1F* GetPartonJT(){return fhPartonJT;} + TH1F* GetJetPL(){return fhJetPL;} + TH1F* GetPartonPL(){return fhPartonPL;} + TH1F* GetJetEt(){return fhJetEt;} + TH1F* GetJetEtDiff(){return fhJetEtDiff;} + TH1F* GetJetEta(){return fhJetEta;} + TH1F* GetPartonEta(){return fhPartonEta;} + TH1F* GetPartonPhi(){return fhPartonPhi;} + TH1F* GetJetPhi(){return fhJetPhi;} + TH1F* GetEtaDiff(){return fhEtaDiff;} + TH1F* GetPhiDiff(){return fhPhiDiff;} + TH2F* GetEtaPhiSpread(){return fhEtaPhiSpread;} + TH1F* GetNJets(){return fhNJets;} + + //========================== CASE 2 ======================== + // Only consider events with at least 2 jets + TH1F* GetFragmFcn2(){return fhFragmFcn2;} + TH1F* GetPartonFragmFcn2(){return fhPartonFragmFcn2;} + TH1F* GetPT2(){return fhJetPT2;} + TH1F* GetPartonPT2(){return fhPartonPT2;} + TH1F* GetJetJT2(){return fhJetJT2;} + TH1F* GetPartonJT2(){return fhPartonJT2;} + TH1F* GetJetPL2(){return fhJetPL2;} + TH1F* GetPartonPL2(){return fhPartonPL2;} + TH1F* GetJetEt2(){return fhJetEt2;} + TH1F* GetJetEtDiff2(){return fhJetEtDiff2;} + TH1F* GetJetEta2(){return fhJetEta2;} + TH1F* GetPartonEta2(){return fhPartonEta2;} + TH1F* GetPartonPhi2(){return fhPartonPhi2;} + TH1F* GetJetPhi2(){return fhJetPhi2;} + TH1F* GetEtaDiff2(){return fhEtaDiff2;} + TH1F* GetPhiDiff2(){return fhPhiDiff2;} + TH2F* GetEtaPhiSpread2(){return fhEtaPhiSpread2;} + TH1F* GetNJets2(){return fhNJets2;} + TH1F* GetJetEtSecond2(){return fhJetEtSecond2;} + TH1F* GetJetEtRatio2(){return fhJetEtRatio2;} + TH1F* GetEtaPhiDist2(){return fhEtaPhiDist2;} + + + TH1F* GetJetPt(){return fhJetPT ;} + TH1F* GetPartonPt(){return fhPartonPT ;} + TH1F* GetJetPt2(){return fhJetPT2;} + TH1F* GetPartonPt2(){return fhPartonPT2;} + TH1F* GetRecoBinFragmFcn() {return fhRecoBinFragmFcn;} + TH1F* GetRecoBinFragmFcnNoBg() {return fhRecoBinFragmFcnNoBg;} + TH1F* GetRecoBinPartonFragmFcn() {return fhRecoBinPartonFragmFcn;} + + //============================== ALL CASES ============================================ + + TH2F* GetInputOutput(){return fhInputOutput;} + + //============================== Reconstruction Bin Comparison ============================================ + + TH1F* GetRecoBinPt(){return fhRecoBinPt;} // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + TH1F* GetRecoBinPtNoBg(){return fhRecoBinPtNoBg;} // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + TH1F* GetRecoBinPartonPt(){return fhRecoBinPartonPt;} // ("fhRecoBinPartonPt","Input Pt Distribution",100,0,1); + TH1F* GetRecoBinJetEt(){return fhRecoBinJetEt;} // ("fhRecoJetEt","E_{T}^{reco}",250,0.,250.); + TH1F* GetRecoBinInputJetEt(){return fhRecoBinInputJetEt;} // ("fhRecoInputJetEt","E_{T}^{reco}",250,0.,250.); + + private: + void InitPlots(); + Int_t fDebug; // Debug value + Float_t fConeRadius; // Cone radius to be used in filling + Float_t fNominalEnergy; // Force a nominal energy - specifically for 80+20 jets + AliEMCALJetFinderOutput* fOutput; // Output object to be analysed + //===================== CASE 1 =========================================== + TH1F *fhFragmFcn; // ("hFragmFcn","Fragmentation Function",100,0,1); + TH1F *fhPartonFragmFcn;// ("hFragmFcn","Parton Fragmentation Function",100,0,1); + TH1F *fhPartonJT; // ("hPartonJT","Track Momentum Perpendicular to Parton Axis",100,0.,10.); + TH1F *fhPartonPL; // ("hPartonPL","Track Momentum Parallel to Parton Axis ",100,0.,100.); + TH1F *fhJetJT; // ("hJetJT","Track Momentum Perpendicular to Jet Axis",100,0.,10.); + TH1F *fhJetPL; // ("hJetPL","Track Momentum Parallel to Jet Axis ",100,0.,100.); + TH1F *fhJetEt; // ("hJetEt","E_{T}^{reco}",250,0.,250.); + TH1F *fhJetEtDiff; // ("hJetEt","E_{T}^{reco}",250,0.,250.); + TH1F *fhJetEta; // ("hJetEta","#eta_{jet}^{reco}",180,-0.9,0.9); + TH1F *fhJetPhi; // ("hJetPhi","#phi_{jet}^{reco}",62,0.,3.1); + TH1F *fhPartonEta; // ("hPartonEta","#eta_{Parton}",180,-0.9,0.9); + TH1F *fhPartonPhi; // ("hPartonPhi","#phi_{Parton}",62,0.,3.1); + TH1F *fhEtaDiff; // ("hEtaDiff","#eta_{jet}^{reco}-#eta_{jet}^{input}",100,-0.5,0.5); + TH1F *fhPhiDiff; // ("hPhiDiff","#phi_{jet}^{reco}-#phi_{jet}^{input}",100,-0.5,0.5); + TH2F *fhEtaPhiSpread; // ("hEtaPhiSpread","#eta - #phi Distribution + //of Reconstructed Jets",192,-0.7,0.7,288,pi/3,pi); + TH1F *fhNJets; // ("hNJets","N Reconstructed jets",11,-0.5,10.5); + + //============================== CASE 2 ============================================ + + TH1F *fhFragmFcn2; // ("hFragmFcn2","Fragmentation Function",100,0,1); + TH1F *fhPartonFragmFcn2;// ("hFragmFcn2","Parton Fragmentation Function",100,0,1); + TH1F *fhPartonJT2; // ("hPartonJT2","Track Momentum Perpendicular to Parton Axis",100,0.,10.); + TH1F *fhPartonPL2; // ("hPartonPL2","Track Momentum Parallel to Parton Axis ",100,0.,100.); + TH1F *fhJetJT2; // ("hJetJT2","Track Momentum Perpendicular to Jet Axis",100,0.,10.); + TH1F *fhJetPL2; // ("hJetPL2","Track Momentum Parallel to Jet Axis ",100,0.,100.); + TH1F *fhJetEt2; // ("hJetEt2","E_{T}^{reco}",250,0.,250.); + TH1F *fhJetEtDiff2; // ("hJetEt","E_{T}^{reco}",250,0.,250.); + TH1F *fhJetEta2; // ("hJetEta2","#eta_{jet}^{reco}",180,-0.9,0.9); + TH1F *fhJetPhi2; // ("hJetPhi2","#phi_{jet}^{reco}",62,0.,3.1); + TH1F *fhPartonEta2; // ("hPartonEta2","#eta_{Parton}",180,-0.9,0.9); + TH1F *fhPartonPhi2; // ("hPartonPhi2","#phi_{Parton}",62,0.,3.1); + TH1F *fhEtaDiff2; // ("hEtaDiff2","#eta_{jet}^{reco}-#eta_{jet}^{input}",100,-0.5,0.5); + TH1F *fhPhiDiff2; // ("hPhiDiff2","#phi_{jet}^{reco}-#phi_{jet}^{input}",100,-0.5,0.5); + TH2F *fhEtaPhiSpread2; // ("hEtaPhiSpread2","#eta - #phi Distribution + //of Reconstructed Jets",192,-0.7,0.7,288,pi/3,pi); + TH1F *fhNJets2; // ("hNJets2","N Reconstructed jets",11,-0.5,10.5); + TH1F *fhJetEtSecond2; //("hJetEtSecond2","E_{T}^{reco}",250,0.,250.); + TH1F *fhJetEtRatio2; //("hJetEtRatio2","Ratio of Second Highest to Highest",100,0,1); + TH1F *fhEtaPhiDist2; //("hEtaPhiDist2","Angular Distance Between First and Second",100,0,3); + + //============================== ALL CASES ============================================ + + TH2F *fhInputOutput; //("hJetEtRatio2","Ratio of Second Highest to Highest",100,0,1); + + //============================== Reconstruction Bin Comparison ============================================ + + TH1F *fhRecoBinPt; // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + TH1F *fhRecoBinPtNoBg; // ("fhRecoBinPt","Reconstructed Pt Distribution",100,0,1); + TH1F *fhRecoBinPartonPt; // ("fhRecoBinPartonPt","Input Pt Distribution",100,0,1); + TH1F *fhRecoBinJetEt; // ("fhRecoJetEt","E_{T}^{reco}",250,0.,250.); + TH1F *fhRecoBinInputJetEt; // ("fhRecoInputJetEt","E_{T}^{reco}",250,0.,250.); + TH1F* fhJetPT ;// new TH1F("hJetPT","P_{T} Distribution",200,0,200); + TH1F* fhPartonPT ;// new TH1F("hPartonPT","Parton P_{T} Distribution",200,0,1); + TH1F* fhJetPT2 ;// new TH1F("hJetPT","P_{T} Distribution",200,0,200); + TH1F* fhPartonPT2 ;// new TH1F("hPartonPT","Parton P_{T} Distribution",200,0,1); + TH1F* fhRecoBinFragmFcn;//new TH1F("fhRecoBinFragmFcn","Reconstructed Frag. Fcn",100,0,1); + TH1F* fhRecoBinFragmFcnNoBg;//new TH1F("fhRecoBinFragmFcn","Reconstructed Frag. Fcn",100,0,1); + TH1F* fhRecoBinPartonFragmFcn;// new TH1F("fhRecoBinPartonFragmFcn","Input Bin Fragm Fcn Distribution",100,0,1); + + TH1F* fhJetInvE;// new TH1F("fhJetInvE","#frac{1}{E_{R}}",100,0,1); + TH1F* fhJetInvE2;// new TH1F("fhJetInvE2","#frac{1}{E_{R}}",100,0,1); + + TH1F* fhBackHisto; + Float_t fScaleFactor; //Scaling to get back to correct energy + Bool_t fInitialised; // have histograms been initialised + + + ClassDef(AliEMCALJetFinderPlots,6) + +}; +#endif + diff --git a/EMCAL/jetfinder/AliEMCALJetFinderTypes.h b/EMCAL/jetfinder/AliEMCALJetFinderTypes.h new file mode 100644 index 00000000000..9e2781c004d --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetFinderTypes.h @@ -0,0 +1,74 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + +//_________________________________________________________________________ +// Enumerated types for use in JetFinder classes +// +//*-- Author: Mark Horner (LBL/UCT) +// + +#ifndef ALIEMCALJETFINDERALGOBGCALCTYPE_T +#define ALIEMCALJETFINDERALGOBGCALCTYPE_T + + typedef enum { kRatio, kCone, kConstant + } AliEMCALJetFinderAlgoBGCalcType_t; +#endif + +#ifndef ALIEMCALJETFINDERRESETTYPE_T +#define ALIEMCALJETFINDERRESETTYPE_T + + typedef enum { kResetData, kResetTracks, kResetDigits, kResetParameters, + kResetAll, kResetPartons, kResetParticles, kResetJets + } AliEMCALJetFinderResetType_t; +#endif + +#ifndef ALIEMCALJETFINDERTRACKTYPE_T +#define ALIEMCALJETFINDERTRACKTYPE_T + typedef enum { kAllP, kEM, kCharged, kNeutral, kHadron, kChargedHadron, kNoTracks, kEMChargedPi0, kNoNeutronNeutrinoKlong + } AliEMCALJetFinderTrackType_t; +#endif + +#ifndef ALIEMCALJETFINDERSMEARINGTYPE_T +#define ALIEMCALJETFINDERSMEARINGTYPE_T + typedef enum { kSmear, kEfficiency , kSmearEffic, kPerfectTracks + } AliEMCALJetFinderSmearingType_t; +#endif + +#ifndef ALIEMCALJETFINDEREMCALTYPE_T +#define ALIEMCALJETFINDEREMCALTYPE_T + typedef enum { kHits, kTimeCut,kNoHits + } AliEMCALJetFinderEMCALType_t; +#endif + +#ifndef ALIEMCALJETFINDERFILETYPE_T +#define ALIEMCALJETFINDERFILETYPE_T + typedef enum { kHijing,kPythia,kData + } AliEMCALJetFinderFileType_t; +#endif + +#ifndef ALIEMCALJETFINDERUA1UNITFLAGTYPE_T +#define ALIEMCALJETFINDERUA1UNITFLAGTYPE_T + typedef enum { kInCurrentJet, kInJet, kOutJet, kBelowMinEt + } AliEMCALJetFinderAlgoUA1UnitFlagType_t; +#endif + +#ifndef ALIEMCALJETFINDERUA1FILLUNITFLAGTYPE_T +#define ALIEMCALJETFINDERUA1FILLUNITFLAGTYPE_T + typedef enum { kFillTracksOnly, kFillDigitsOnly, kFillAll + } AliEMCALJetFinderAlgoUA1FillUnitFlagType_t; +#endif diff --git a/EMCAL/jetfinder/AliEMCALJetMicroDst.cxx b/EMCAL/jetfinder/AliEMCALJetMicroDst.cxx new file mode 100644 index 00000000000..79fb831d442 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetMicroDst.cxx @@ -0,0 +1,824 @@ +/************************************************************************** + * Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + + +/* $Id$ */ + +//*-- Authors: Aleksei Pavlinov (WSU) + +//* + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "AliEMCALJetFinder.h" +#include "AliEMCALJetMicroDst.h" +#include "AliGenEventHeader.h" +#include "AliGenHijingEventHeader.h" +#include "AliHeader.h" +#include "AliMC.h" +#include "AliRun.h" + +ClassImp(AliEMCALJetMicroDst) + +TString gAliNameTree("jetMDST"); // 7-feb-2002 + +//TH1F* fhPtPart, *fhNJet, *fhPtJet; +//TH2F* fhEtaPhiPart, *fhEtaPhiJet; +//TH1F* fhNcell, *fhCellId, *fhCellEt, *fhSumEt; +//TH1F* fhNgrid, *fhGridId, *fhGridEt, *fhSumEtGrForJF; + +extern "C" void sgpdge_(Int_t &i, Int_t &pdggea); + +AliEMCALJetMicroDst::AliEMCALJetMicroDst(const char *name, const char *tit) : TNamed(name,tit) +{ + //constructor + fFile = 0; + fTree = 0; + fDebug = 0; + +// Don't add histos to the current directory +// TH1::AddDirectory(0); + gROOT->cd(); + fhPtPart = new TH1F("fhPtPart","P_{T} for partons", 300, 0., 300.); + // 16-jan-2002 - new limit fo phi + fhEtaPhiPart = new TH2F("fhEtaPhiPart","#eta #phi distr.for partons after HSc", + 28, -0.7, 0.7, 21, 0.0, (2.0/3.0)*TMath::Pi()); + + fhNJet = new TH1F("fhNJet","number of jets", 11, -0.5, 10.5); + fhPtJet = new TH1F("fhPtJet","P_{T} for jets", 500, 0., 500.); + fhEtaPhiJet = new TH2F("fhEtaPhiJet","#eta #phi distr.for jets (W)", + 28, -0.7, 0.7, 21, 0.0, (2.0/3.0)*TMath::Pi()); + + fhNcell = new TH1F("fhNcell","#cell with de>0.0 for EMCAL", 1400, 0.0, 14000.); + fhCellId = new TH1F("fhCellId","cell ID with de>0.0 for EMCAL", 1400, 0.0, 14000.); + fhCellEt = new TH1F("fhCellEt","cell Et for EMCAL", 1000, 0.0, 10.); + fhSumEt = new TH1F("fhSumEt","sum Et for EMCAL", 1000, 0.0, 1000.); + + fhNgrid = new TH1F("fhNgrid","#cell with de>0.0 in EMCAL grid for JF", 1400, 0.0, 14000.); + fhGridId = new TH1F("fhGridId","cell ID with de>0.0 in EMCAL grid for JF", 1400, 0.0, 14000.); + fhGridEt = new TH1F("fhGridEt","cell Et in EMCAL grid for JF", 1000, 0.0, 10.); + fhSumEtGrForJF = new TH1F("fhSumEtGrForJF","sum Et in EMCAL grid for JF", 1000, 0.0, 1000.); + + fListHist = MoveHistsToList("Hist For AliEMCALJetMicroDst", kFALSE); +} + +AliEMCALJetMicroDst::~AliEMCALJetMicroDst() +{ + //destructor + if(fFile) fFile->Close(); +} + +Bool_t AliEMCALJetMicroDst::Create(TFile *file) +{ + // Creates the DST file + if(!file) { + Error("Create", "define TFile for output\n"); + return kFALSE; + } + fFile = file; + fFileName = fFile->GetName(); + fFile->cd(); + fTree = new TTree(gAliNameTree.Data(),"Temporary micro DST for jets analysis"); + // for jet calibration - 4-mar-2003 + fTree->Branch("fdecone", &fdecone, "fdecone/F"); + fTree->Branch("fptcone", &fptcone, "fptcone/F"); + // partons + fTree->Branch("fnpart", &fnpart, "fnpart/I"); + fTree->Branch("fxpt", fxpt, "fxpt[fnpart]/F"); + fTree->Branch("fxeta", fxeta, "fxeta[fnpart]/F"); + fTree->Branch("fxphi", fxphi, "fxphi[fnpart]/F"); + // jets + fTree->Branch("fnjet", &fnjet, "fnjet/I"); + fTree->Branch("fjet", fjet, "fjet[fnjet]/F"); + fTree->Branch("fjetaw", fjetaw, "fjetaw[fnjet]/F"); + fTree->Branch("fjphiw", fjphiw, "fjphiw[fnjet]/F"); + fTree->Branch("fjetal", fjetal, "fjetal[fnjet]/F"); + fTree->Branch("fjphil", fjphil, "fjphil[fnjet]/F"); + + // Et in EMCAL itself + fTree->Branch("fncell", &fncell, "fncell/I"); + fTree->Branch("fidcell", fidcell, "fidcell[fncell]/I"); + fTree->Branch("fetcell", fetcell, "fetcell[fncell]/F"); + + // Et in EMCAL grid for JF + fTree->Branch("fngrid", &fngrid, "fngrid/I"); + fTree->Branch("fidgrid", fidgrid, "fidgrid[fngrid]/I"); + fTree->Branch("fetgrid", fetgrid, "fetgrid[fngrid]/F"); + + // charge particle which hit to EMCAL + fTree->Branch("fnchp", &fnchp, "fnchp/I"); + fTree->Branch("fpid", fpid, "fpid[fnchp]/I"); + fTree->Branch("fppt", fppt, "fppt[fnchp]/F"); + fTree->Branch("fpeta", fpeta, "fpeta[fnchp]/F"); + fTree->Branch("fpphi", fpphi, "fpphi[fnchp]/F"); + + return kTRUE; +} + +Bool_t AliEMCALJetMicroDst::Create(const char *fname) +{ + // Create member + TFile *file = new TFile(fname, "RECREATE"); + if(file) { + // fNameFile = fname; + return Create(file); + } else return kFALSE; +} + +Bool_t AliEMCALJetMicroDst::Open(const char *fname) +{ + //Open member + if(fFile && fFile->IsOpen()) fFile->Close(); + if(strlen(fname)) fName = fname; + TFile *file = new TFile(fName.Data(), "READ"); + if(file) { + Bool_t ini = Initialize(file); + Info("Open", "open file %s : initialize TTree %i",fName.Data(), Int_t(ini)); + return ini; + } else { + Error("Open", "can not open file %s",fName.Data()); + return kFALSE; + } +} + +const Char_t* AliEMCALJetMicroDst::DefineName(Int_t mode) +{ + //DefineName member + static TString dir, name; + // dir = "jetDST/"; // 24-jan-2003 + dir = "/auto/alice/pavlinov/jet/microDST/"; // 24-jan-2003 + switch (mode) { + case 1: // for characteristic of BG + name = dir + "mDst1_1.root"; // Bg 2000 - first version + SetTitle("Bg2000"); + break; + case 2: // for characteristic of BG + name = dir + "mDst2_1.root"; // Bg 4000 - first version + SetTitle("Bg4000"); + break; + case 3: // for characteristic of BG + name = dir + "mDst3_1.root"; // Bg 8000 - first version + SetTitle("Bg8000"); + break; + case 4: // Central Hijing - 18-mar-2003 + name = dir + "march/"; + name += "jF_R0.50MinCell1.0PtCut0.0EtSeed4.0MinEt40.0BGSubtr0SF11.6Smear0Eff0HijingCentral.root"; + SetTitle("HijingCentral"); + break; + case 5: // Para Hijing (Dn/Dy=8000) - 21-mar-2003 + name = dir + "march/"; + name += "jF_R0.50MinCell1.0PtCut0.0EtSeed4.0MinEt40.0BGSubtr0SF11.6Smear0Eff0ParaHijing8000.root"; + SetTitle("HIJINGparaDnDy8000"); + break; + case 6: // Para Hijing (Dn/Dy=4000) - 21-mar-2003 + name = dir + "march/"; + name += "jF_R0.50MinCell1.0PtCut0.0EtSeed4.0MinEt40.0BGSubtr0SF11.6Smear0Eff0ParaHijing4000.root"; + SetTitle("HIJINGparaDnDy4000"); + break; + case 7: // Para Hijing (Dn/Dy=2000) - 21-mar-2003 + name = dir + "march/"; + name += "jF_R0.50MinCell1.0PtCut0.0EtSeed4.0MinEt40.0BGSubtr0SF11.6Smear0Eff0ParaHijing2000.root"; + SetTitle("HIJINGparaDnDy2000"); + break; + case 11: // pure PYTHIA with default value of parameters + name = dir + "jF_R0.50MinCell0.0PtCut0.0EtSeed8.0MinEt40.0BGSubtr0SF11.6.root"; + break; + case 12: // 0 + background + name = dir + "jF_R0.50MinCell0.0PtCut0.0EtSeed8.0MinEt40.0BGSubtr0SF11.6kBackground2000.root"; + break; + // calibration case + case 101: + name = dir + "march/"; + name += "Pythia100_1.root"; + SetTitle("Pythia100_1"); + break; + case 102: // 2-apr-2003 + name = dir + "march/"; + name += "Pythia50_1.root"; + SetTitle("Pythia50_1"); + // name = "microDst3th.root"; // 101 + (smearing and eff) - 14-mar-2003 + break; + case 103:// 4-apr-2003 + name = dir + "march/"; + name += "Pythia200_1.root"; + SetTitle("Pythia200_1"); + // name = "microDst4th.root"; // 102 + MinCell= 1.0 + break; + default: + Fatal("DefineName", "NO D E F A U L T : mode %i\n", mode); + } + Info("DefineName", "mode %5i file : %s : Title %s\n", mode, name.Data(), GetTitle()); + return name.Data(); +} + +Bool_t AliEMCALJetMicroDst::Initialize(TFile *file) +{ + // Initialize method + if(file) fFile = file; + fFile->cd(); + fTree = (TTree*)fFile->Get(gAliNameTree.Data()); + if(!fTree) return kFALSE; + // for jet calibration - 4-mar-2003 + fTree->SetBranchAddress("fdecone",&fdecone); + fTree->SetBranchAddress("fptcone",&fptcone); + // partons + fTree->SetBranchAddress("fnpart",&fnpart); + fTree->SetBranchAddress("fxpt", fxpt); + fTree->SetBranchAddress("fxeta", fxeta); + fTree->SetBranchAddress("fxphi", fxphi); + // jets + fTree->SetBranchAddress("fnjet", &fnjet); + fTree->SetBranchAddress("fjet", fjet); + fTree->SetBranchAddress("fjetaw", fjetaw); + fTree->SetBranchAddress("fjphiw", fjphiw); + fTree->SetBranchAddress("fjetal", fjetal); + fTree->SetBranchAddress("fjphil", fjphil); + // eT in EMCAL + fTree->SetBranchAddress("fncell", &fncell); + fTree->SetBranchAddress("fidcell", fidcell); + fTree->SetBranchAddress("fetcell", fetcell); + // eT in EMCAL grid for JF + fTree->SetBranchAddress("fngrid", &fngrid); + fTree->SetBranchAddress("fidgrid", fidgrid); + fTree->SetBranchAddress("fetgrid", fetgrid); + // 28-jan-2003 + fTree->SetBranchAddress("fnchp", &fnchp); + fTree->SetBranchAddress("fpid", fpid); + fTree->SetBranchAddress("fppt", fppt); + fTree->SetBranchAddress("fpeta", fpeta); + fTree->SetBranchAddress("fpphi", fpphi); + + return kTRUE; +} + +void AliEMCALJetMicroDst::Print(Option_t* option) const +{ + // + if(option); + if(fFile) { + fFile->Print(); + if(fTree) fTree->Print(); + else Info("Print", "TRee is zero\n"); + } else { + Info("Print", "File with TRee is closed \n Name of file %s(from fFileName", fFileName.Data()); + } + + Info("Print", "******* Current(last) event *****"); + printf("#partons %2i \n", fnpart); + for(Int_t i=0; i=1 - fill info for EMCAL grid + if(!run) run = gAlice; + AliGenEventHeader* evHeader = run->GetHeader()->GenEventHeader(); + TString tmp(evHeader->ClassName()); + if(tmp.Contains("Hijing")) { + AliGenHijingEventHeader *hijEvHeader = (AliGenHijingEventHeader*)evHeader; + FillPartons(hijEvHeader); + } else if(tmp.Contains("Pythia")) { + FillPartons(); + } else { + Error("Fill", "Wrong type of generator -> %s \n Info about partons will be absent",tmp.Data()); + } + + FillJets(jetFinder); + + if(modeFilling >= 1) { + FillEtForEMCAL(jetFinder); + FillEtForGrid(jetFinder); + FillChargeParticles(jetFinder); + } else { + fncell = 0; // 27-jan-2003 + fngrid = 0; // 27-jan-2003 + fnchp = 0; + // negative - no signal + fdecone = -1.; + fptcone = -1.; + } + + FillJetsControl(); //24-jan-2003 + + fTree->Fill(); +} + +void AliEMCALJetMicroDst::FillPartons(AliGenHijingEventHeader *header) +{ + //Make partons arrays + TLorentzVector parton[4]; + header->GetJets(parton[0], parton[1], parton[2], parton[3]); + + fnpart = 4; // + for(Int_t i=0; i<4; i++){ + fxpt[i] = parton[i].Pt(); + fxeta[i] = parton[i].Eta(); + fxphi[i] = parton[i].Phi(); + } +} + +void AliEMCALJetMicroDst::FillPartons() +{ + // for case of Pythia -> get info from full event record + + fnpart = 2; + TParticle *mPart; + Int_t ind; + for(Int_t i=6; i<8; i++){ + mPart = gAlice->GetMCApp()->Particle(i); + ind = i-6; + fxpt[ind] = mPart->Pt(); + fxeta[ind] = mPart->Eta(); + fxphi[ind] = mPart->Phi(); + } +} + +void AliEMCALJetMicroDst::FillJets(AliEMCALJetFinder* jetFinder) +{ + // Fill Jets + fnjet = 0; + if(fDebug>1) Info("FillJets", "Debug"); + if(!jetFinder) { + if(fDebug>1) Info("FillJets", "jetFinder is zero"); + return; + } + fnjet = jetFinder->Njets(); + if(fnjet>10) { + if(fDebug>1) Warning("FillJets", "wrong value of jetFinder->Njets() %i ", fnjet); + fnjet = 10; + } + // fhNJet->Fill(njet); + if(fDebug>1) Info("FillJets", "njet %i", fnjet); + if(fnjet){ + for(Int_t i=0; iJetEnergy(i); + fjetaw[i] = jetFinder->JetEtaW(i); + fjphiw[i] = jetFinder->JetPhiW(i); + fjetal[i] = jetFinder->JetEtaL(i); + fjphil[i] = jetFinder->JetPhiL(i); + } + } +} + +void AliEMCALJetMicroDst::FillEtForEMCAL(AliEMCALJetFinder* jetFinder) +{ + // Fill Et for EMCAL + fncell = 0; + TH2F *hid = jetFinder->GetLegoEMCAL(); + if(!hid) return; + + Double_t de = 0.; + Int_t neta = hid->GetNbinsX(), nphi = hid->GetNbinsY(); + for(Int_t ieta=1; ieta<=neta; ieta++) { + for(Int_t iphi=1; iphi<=nphi; iphi++) { + de = hid->GetBinContent(ieta,iphi); + if(de > 0.0) { + fetcell[fncell] = Float_t(de); + fidcell[fncell] = nphi*(ieta-1) + iphi; + fncell++; + if(fncell >= 13824) break; + // Info("FillEtForEMCAL", " ncell %i6 id %i6 de %f \n", ncell, idcell[ncell], etcell[ncell]); + } + } + } + if(fnjet == 1) { + // jet energy calculate around LP direction !!! - 10-mar-2003 + fdecone = jetFinder->EMCALConeEnergy(fjetal[0],fjphil[0]); + fptcone = jetFinder->TrackConeEnergy(fjetal[0],fjphil[0]); // get from lego plot fo ch.part + Info("FillEtForEMCAL", " njet %i Emcal in cone %f pt ch.part in cone %f\n", fnjet, fdecone, fptcone); + Info("FillEtForEMCAL", " jet - decone - ptcone : %9.2f\n", fjet[0]-fdecone-fptcone); + } else { + fdecone = -1.; + fptcone = -1.; + } + + Info("FillEtForEMCAL", "neta %3i nphi %3i # array size %i Sum.Et %f\n", + neta,nphi, fncell, hid->Integral()); +} + +void AliEMCALJetMicroDst::FillEtForGrid(AliEMCALJetFinder* jetFinder) +{ + // Fill ET for Grid + TH2F *hid = jetFinder->GetLego(); + if(!hid) return; + + FillArrays(hid, fngrid, fidgrid, fetgrid); +} + +void AliEMCALJetMicroDst::FillArrays(TH2* hid, Int_t &n, Int_t *id, Float_t *et) +{ + // Fill arays + n = 0; + Double_t de = 0.; + Int_t neta = hid->GetNbinsX(), nphi = hid->GetNbinsY(); + for(Int_t ieta=1; ieta<=neta; ieta++) { + for(Int_t iphi=1; iphi<=nphi; iphi++) { + de = hid->GetBinContent(ieta,iphi); + if(de > 0.0) { + et[n] = Float_t(de); + id[n] = nphi*(ieta-1) + iphi; + n++; + if(n >= 13824) break; + } + } + } + Info("FillArrays", "neta %3i nphi %3i # array size %i Sum.Et %f\n", + neta, nphi, n, hid->Integral()); +} + +void AliEMCALJetMicroDst::FillChargeParticles(AliEMCALJetFinder* jetFinder) +{ + // 28-jan-2003 for fullness ; 18-mar - sometimes + fnchp = 0; + Int_t gid=0; + for(Int_t i=0; ifNt; i++) { + // fPdgT[i]; + if(jetFinder->fTrackList[i] >= 1) { + sgpdge_(jetFinder->fPdgT[i], gid); + fpid[fnchp] = gid; + fppt[fnchp] = jetFinder->fPtT[i]; + fpeta[fnchp] = jetFinder->fEtaT[i]; + fpphi[fnchp] = jetFinder->fPhiT[i]; + fnchp++; + } + } + Info("FillChargedParticles", "fNtS %i : nchp %i -> %i\n", jetFinder->fNtS, fnchp, jetFinder->fNtS - fnchp); +} + +void AliEMCALJetMicroDst::FillJetsControl() +{ + // see FillJets(AliEMCALJetFinder* jetFinder) and FillPartons + fhNJet->Fill(fnjet); + for(Int_t i=0; iFill(fjet[i]); + fhEtaPhiJet->Fill(fjetaw[i],fjphiw[i]); + } + + for(Int_t i=0; i < fnpart; i++){ + fhEtaPhiPart->Fill(fxeta[i], fxphi[i]); + fhPtPart->Fill(fxpt[i]); + } + + Double_t sum = 0.0; + fhNcell->Fill(fncell); + for(Int_t i=0; i < fncell; i++){ + fhCellId->Fill(fidcell[i]); + fhCellEt->Fill(fetcell[i]); + sum += Double_t(fetcell[i]); + } + fhSumEt->Fill(sum); + + sum = 0.0; + fhNgrid->Fill(fngrid); + for(Int_t i=0; i < fngrid; i++){ + fhGridId->Fill(fidgrid[i]); + fhGridEt->Fill(fetgrid[i]); + sum += Double_t(fetgrid[i]); + } + fhSumEtGrForJF->Fill(sum); +} + +Int_t AliEMCALJetMicroDst::GetEntry(Int_t entry) +{ + // Read contents of entry. + if (!fTree) { + Error("GetEntry", "define TTree"); + return -1; + } + return fTree->GetEntry(entry); +} + +Bool_t AliEMCALJetMicroDst::GetParton(Int_t i, Float_t& pt, Float_t& eta, Float_t& phi) const +{ + // Get parton + if(i>=0 && i=0 && iGetEntries()); + for(Int_t i=0; iGetEntry(i); + nbytes += nb; + for(Int_t j=0; jFill(fxeta[j], fxphi[j]); + fhPtPart->Fill(fxpt[j]); + } + + fhNJet->Fill(fnjet); + if(fnjet){ + for(Int_t j=0; jFill(fjet[j]); + fhEtaPhiJet->Fill(fjetaw[j],fjphiw[j]); + } + } + } + Info("Test", "Entries %5i Bytes %10i\n", nentries, nbytes); +} + +void AliEMCALJetMicroDst::FillVector(Float_t pt, Float_t eta, Float_t phi, TVector3& vec) +{ + // service function + static Float_t px, py, pz; + + px = pt*TMath::Cos(phi); + py = pt*TMath::Sin(phi); + pz = pt*TMath::SinH(eta); // sinh(eta) = cot(theta) + + vec.SetXYZ(px, py, pz); +} + +void AliEMCALJetMicroDst::GetEtaPhi(Int_t id, Double_t &eta, Double_t &phi) const +{ + // see AliEMCALGeometry + static Int_t ieta, iphi, nphi=144, neta=96; + static Double_t phiMax=(2.0/3.0)*TMath::Pi(), phiMin=0.0; + static Double_t phiStep=(phiMax-phiMin)/nphi, phiBeg = phiMin + phiStep/2.; + static Double_t etaMax=0.7, etaMin=-etaMax; + static Double_t etaStep=(etaMax-etaMin)/neta, etaBeg = etaMin + etaStep/2.; + + ieta = (id-1)/nphi + 1; // id = nphi*(ieta-1) + iphi + iphi = id - nphi*(ieta-1); + if(ieta<=0 || ieta>neta) { + Fatal("GetEtaPhi", "wrong id %i(ieta %i,iphi %i) : nphi %i neta %i", id,iphi,ieta, nphi,neta); + + } + + eta = etaBeg + etaStep*(ieta-1); + phi = phiBeg + phiStep*(iphi-1); +} + +TVector3& AliEMCALJetMicroDst::GetCellVector(Int_t i) const +{ + // Get cell vector + static Double_t eta,phi; + static TVector3 vec; + vec.SetXYZ(0.,0.,0.); + if(i>=0 && i=0 && i rJet) continue; + sum += et[i]; + } + Info("GetSumCone", "Sum %f \n", sum); + return sum; +} + +Double_t AliEMCALJetMicroDst::GetEmcalEtInCone(TVector3 &jet, Double_t cellEtCut, Double_t rJet) +{ + // Get EMCAL Et in cone + Int_t nc = fncell; + if(nc<=0) return 0.; + + Float_t *et=fetcell, *eta=new Float_t[nc], *phi=new Float_t[nc]; + Double_t etaCell=0., phiCell=0., eTotal=0; + + for(Int_t i=0; i=cut) sum += Double_t(ar[i]);} + return sum; +} + +void AliEMCALJetMicroDst::Close() +{ + // Close + fFile->Write(); + fTree->Print(); + fFile->Close(); + fFile = 0; + fTree = 0; +} + +void AliEMCALJetMicroDst::Browse(TBrowser* b) const +{ + // Browse + if(fTree) b->Add((TObject*)fTree); + if(fListHist) b->Add((TObject*)fListHist); + // TObject::Browse(b); +} + +Bool_t AliEMCALJetMicroDst::IsPythiaDst() const +{ + // Is Pythia DST + TString st(GetTitle()); + if(st.Contains("py",TString::kIgnoreCase)||!st.Contains("hijing", TString::kIgnoreCase)) return kTRUE; + else return kFALSE; +} + +Bool_t AliEMCALJetMicroDst::IsFolder() const +{ + // Is folder + if(fTree || fListHist) return kTRUE; + else return kFALSE; +} + +TList* AliEMCALJetMicroDst::MoveHistsToList(const char* name, Bool_t putToBrowser) +{ + // Move HIST to list + gROOT->cd(); + TIter nextHist(gDirectory->GetList()); + TList *list = new TList; + list->SetName(name); + TObject *objHist; + while((objHist=nextHist())){ + if (!objHist->InheritsFrom("TH1")) continue; + ((TH1*)objHist)->SetDirectory(0); // Remove from gROOT + list->Add(objHist); + } + if(putToBrowser) gROOT->GetListOfBrowsables()->Add((TObject*)list); + return list; +} + +void AliEMCALJetMicroDst::FillH1(TList *l, Int_t ind, Double_t x, Double_t w) +{ + static TH1* hid=0; + if(l == 0) return; + if(ind < l->GetSize()){ + hid = (TH1*)l->At(ind); + hid->Fill(x,w); + } +} + +void AliEMCALJetMicroDst::FillH2(TList *l, Int_t ind, Double_t x, Double_t y, Double_t w) +{ + static TH2* hid=0; + if(l == 0) return; + if(ind < l->GetSize()){ + hid = (TH2*)l->At(ind); + hid->Fill(x,y,w); + } +} + +int AliEMCALJetMicroDst::SaveListOfHists(TList *list,const char* name,Bool_t kSingleKey,const char* opt) +{ + printf(" Name of out file |%s|\n", name); + int save = 0; + if(list && list->GetSize() && strlen(name)){ + TString nf(name); + if(nf.Contains(".root") == kFALSE) nf += ".root"; + TFile file(nf.Data(),opt); + TIter nextHist(list); + TObject* objHist=0; + int nh=0; + if(kSingleKey) { + file.cd(); + list->Write(list->GetName(),TObject::kSingleKey); + list->ls(); + save = 1; + } else { + while((objHist=nextHist())) { // loop over list + if(objHist->InheritsFrom("TH1")) { + TH1* hid = (TH1*)objHist; + file.cd(); + hid->Write(); + nh++; + printf("Save hist. %s \n",hid ->GetName()); + } + } + printf("%i hists. save to file -> %s\n", nh,file.GetName()); + if(nh>0) save = 1; + } + file.Close(); + } else { + printf("TAliasPAI::saveListOfHists : N O S A V I N G \n"); + if(list==0) printf("List of object 0 : %p \n", list); + else printf("Size of list %i \n", list->GetSize()); + } + return save; +} + +void AliEMCALJetMicroDst::Sgpdge(Int_t pdgId, Int_t &gId) +{ // 8-nov-05 + sgpdge_(pdgId, gId); +} diff --git a/EMCAL/jetfinder/AliEMCALJetMicroDst.h b/EMCAL/jetfinder/AliEMCALJetMicroDst.h new file mode 100644 index 00000000000..8e972d4ddd5 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALJetMicroDst.h @@ -0,0 +1,155 @@ +#ifndef ALIEMCALJETMICRODST_H +#define ALIEMCALJETMICRODST_H +/* Copyright(c) 1998-2002, ALICE Experiment at CERN, All rights reserved. * + * See cxx source for full Copyright notice */ + +/* $Id$ */ + +//_________________________________________________________________________ +// +//*-- Author: Aleksei Pavlinov (WSU) +#include +class TFile; +class TTree; +class TH1; +class TH1F; +class TH2F; +class TH2; + +class AliGenHijingEventHeader; +class AliRun; +class AliEMCALJetFinder; +class TVector3; +class TBrowser; + +class AliEMCALJetMicroDst: public TNamed { + public: + AliEMCALJetMicroDst(const char *name="jetMicroDst", + const char *tit="jet Micro Dst for preparation of proposal"); + AliEMCALJetMicroDst(const AliEMCALJetMicroDst &) : TNamed("", ""){ + Fatal("cpy ctor", "not implemented") ; } + virtual ~AliEMCALJetMicroDst(); + Bool_t Create(TFile *file); + Bool_t Create(const char *fname); + void Fill(AliRun *run=0, AliEMCALJetFinder* jetFinder=0, Int_t modeFilling=0); + void FillPartons(AliGenHijingEventHeader *header); + void FillPartons(); + void FillJets(AliEMCALJetFinder* jetFinder); + void FillEtForEMCAL(AliEMCALJetFinder* jetFinder); + void FillEtForGrid(AliEMCALJetFinder* jetFinder); + void FillArrays(TH2* hid, Int_t &n, Int_t *id, Float_t *et); + void FillChargeParticles(AliEMCALJetFinder* jetFinder); + + void FillJetsControl(); // 18-jan-2003 + + Bool_t Open(Int_t mode=1) {return Open(DefineName(mode));} // *MENU* + Bool_t Open(const char *fname); // *MENU* + const Char_t* DefineName(Int_t mode=1); // *MENU* + Bool_t Initialize(TFile *file); + void Print(Option_t* option="") const; // *MENU* + Int_t GetEntry(Int_t entry); + void Test(); + Int_t GetNpart() const {return fnpart;} + Bool_t GetParton(Int_t i, Float_t& pt, Float_t& eta, Float_t& phi) const ; + Bool_t GetParton(Int_t i, TVector3& vec) const ; + Int_t GetNjet() const {return fnjet;} + Bool_t GetJet(Int_t i,Int_t mode, Float_t& pt,Float_t& eta,Float_t& phi) const ; + Bool_t GetJet(Int_t i,Int_t mode, TVector3& vec) const ; + static void FillVector(Float_t pt, Float_t eta, Float_t phi, TVector3& vec); + void GetEtaPhi(Int_t id, Double_t &eta, Double_t &phi) const ; + TVector3& GetCellVector(Int_t i) const ; + TVector3& GetGridVector(Int_t i) const ; + // 13-apr-2003 + Double_t GetSumInCone(TVector3 &jet, Int_t nc, Float_t *et,Float_t *eta,Float_t *phi, Double_t cellEtCut, Double_t rJet) const ; + Double_t GetEmcalEtInCone(TVector3 &jet, Double_t cellEtCut=0.0, Double_t rJet=0.5) ; + Double_t GetTpcPtInCone(TVector3 &jet, Double_t cellEtCut=0.0, Double_t rJet=0.5) ; + Double_t GetSum(Int_t n, Float_t *ar, Double_t cut=0.0) const ; + Double_t GetSumEmcal(Double_t cut=0.0) {return GetSum(fncell, fetcell, cut);} + Double_t GetSumTpc(Double_t cut=0.0) {return GetSum(fnchp, fppt, cut);} + + void SetDebug(Int_t flag) {fDebug = flag;} + Float_t GetDebug() const {return fDebug;} + + TTree* GetTree() const {return fTree;} + TFile* GetFile() const {return fFile;} + void Close(); + + Bool_t IsPythiaDst() const ; + virtual Bool_t IsFolder() const; + virtual void Browse(TBrowser* b) const ; + + // service routine + static TList *MoveHistsToList(const char* name="ListOfHists", Bool_t putToBrowser=kTRUE); + static void FillH1(TList *l=0, Int_t ind=0, Double_t x=-99999., Double_t w=1.); + static void FillH2(TList *l=0, Int_t ind=0, Double_t x=-99999., Double_t y=-99999., Double_t w=1.); + static int SaveListOfHists(TList *list=0, const char* name="test", Bool_t kSingleKey=kFALSE, + const char* opt="RECREATE"); + static void Sgpdge(Int_t pdgId, Int_t &gId); + + AliEMCALJetMicroDst & operator = (const AliEMCALJetMicroDst &) { + Fatal("operator =", "not implemented") ; return *this ; } + + private: + + Float_t fpphi[20000]; //[nchp] + Int_t fDebug; // debug flag + TFile* fFile; // filename + TTree* fTree; // Tree pointer + TList* fListHist; //! + TString fFileName; // for convenience + + Float_t fdecone; //! for EMCAL + Float_t fptcone; //! for ch.particles + // For partons after hard scattering + Int_t fnpart; //npartons + Float_t fxpt[4]; //[npart] + Float_t fxeta[4]; //[npart] + Float_t fxphi[4]; //[npart] + // Jet + Int_t fnjet; // number of jets + Float_t fjet[10]; //[njet] + Float_t fjetal[10]; //[njet] + Float_t fjphil[10]; //[njet] + Float_t fjetaw[10]; //[njet] + Float_t fjphiw[10]; //[njet] + // Charge particle in jet ?? + // eT in EMCAL itself - 24-jan-2003 + Int_t fncell; // 96*144 =13824 + Int_t fidcell[13824]; //[ncell] + Float_t fetcell[13824]; //[ncell] : de = det*sf + // eT in EMCAL grid for jet finder + Int_t fngrid; // 96*144 =13824 + Int_t fidgrid[13824]; //[ngrid] + Float_t fetgrid[13824]; //[ngrid] + // charge particle which hit to EMCAL - 28-jan-2003 + Int_t fnchp; //number of charged particles + Int_t fpid[20000]; //[nchp] + Float_t fppt[20000]; //[nchp] + Float_t fpeta[20000]; //[nchp] + TH1F* fhPtPart; //hist + TH1F* fhNJet; //hist + TH1F* fhPtJet; //hist + TH2F* fhEtaPhiPart; //hist + TH2F* fhEtaPhiJet; //hist + TH1F* fhNcell; //hist + TH1F* fhCellId; //hist + TH1F* fhCellEt; //hist + + TH1F* fhSumEt; //hist + TH1F* fhNgrid; //hist + TH1F* fhGridId; //hist + TH1F* fhGridEt; //hist + TH1F* fhSumEtGrForJF; //hist + + + ClassDef(AliEMCALJetMicroDst,3) // Micro Dst for jet analysis +}; + +#endif // AliEMCALJETMICRODST_H + +typedef AliEMCALJetMicroDst sv; // for convinience + +/* +What to do +1. Common info about event + */ diff --git a/EMCAL/jetfinder/AliEMCALParton.cxx b/EMCAL/jetfinder/AliEMCALParton.cxx new file mode 100644 index 00000000000..010614b6cf2 --- /dev/null +++ b/EMCAL/jetfinder/AliEMCALParton.cxx @@ -0,0 +1,83 @@ +/************************************************************************** + * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * + * * + * Author: The ALICE Off-line Project. * + * Contributors are mentioned in the code where appropriate. * + * * + * Permission to use, copy, modify and distribute this software and its * + * documentation strictly for non-commercial purposes is hereby granted * + * without fee, provided that the above copyright notice appears in all * + * copies and that both the copyright notice and this permission notice * + * appear in the supporting documentation. The authors make no claims * + * about the suitability of this software for any purpose. It is * + * provided "as is" without express or implied warranty. * + **************************************************************************/ + +/* $Id$ */ + +//*-- Author: Renan Cabrera (Creighton U.) + +#include "AliEMCALParton.h" +#include "Ecommon.h" +#include +ClassImp(AliEMCALParton) + +//____________________________________________________________________________ +AliEMCALParton::AliEMCALParton() +{ + // Default constructor +// fTrackEnergy = 0; +// fTrackEta = 0; +// fTrackPhi = 0; +// fTrackPDG = 0; + fNTracks = 0; + fPartonCode = 0; +} + +AliEMCALParton::AliEMCALParton(Float_t energy, Float_t phi, Float_t eta) +{ + // Constructor + fEnergy = energy; + fPhi = phi; + fEta = eta; +// fTrackEnergy = 0; +// fTrackEta = 0; +// fTrackPhi = 0; +// fTrackPDG = 0; + fNTracks = 0; + fPartonCode = 0; +} + +void AliEMCALParton::SetTrackList(Int_t NTracks, Float_t* Energy, Float_t* Eta, Float_t* Phi, Int_t* PDG) +{ +// Set the stored tracklist + fNTracks = NTracks; + for (Int_t i=0;i +//*-- Author: Renan Cabrera (Creighton U.) + + +class AliEMCALParton : public TObject { +public: + AliEMCALParton(); + AliEMCALParton(Float_t energy, Float_t phi, Float_t eta); + virtual ~AliEMCALParton(); + void SetEnergy(Float_t val) {fEnergy = val;} + void SetPhi(Float_t val) {fPhi = val;} + void SetEta(Float_t val) {fEta = val;} + void SetTrackList(Int_t num ,Float_t* ar1,Float_t* ar2,Float_t* ar3,Int_t* ar4); + void GetTrackList(Float_t* ar1,Float_t* ar2,Float_t* ar3,Int_t* ar4)const; + + Int_t GetNTracks() const {return fNTracks;} + Float_t Energy() const {return fEnergy;} + Float_t Phi() const {return fPhi;} + Float_t Eta() const {return fEta;} + void SetPartonCode(Int_t code){fPartonCode = code;} + Int_t GetPartonCode()const{return fPartonCode;} +protected: + Float_t fEnergy; // Jet Energy + Float_t fEta; // Jet Phi + Float_t fPhi; // Jet Eta + Int_t fNTracks; // Number of tracks + Float_t fTrackEnergy[1000]; // Jet Tracks Energy + Float_t fTrackEta[1000]; // Jet Tracks Eta + Float_t fTrackPhi[1000]; // Jet Tracks Phi + Int_t fTrackPDG[1000]; // Jet Tracks PDG code + Int_t fPartonCode; // Store the type of parton + ClassDef(AliEMCALParton,7) // Jet for EMCAL + +} ; + +#endif // ALIEMCALParton_H diff --git a/EMCAL/jetfinder/AnaJets.C b/EMCAL/jetfinder/AnaJets.C new file mode 100644 index 00000000000..d503d5ed8b3 --- /dev/null +++ b/EMCAL/jetfinder/AnaJets.C @@ -0,0 +1,102 @@ +void AnaJets(Int_t evNumber1=0, Int_t evNumber2=0) +{ +//*-- Author: Andreas Morsch (CERN) + + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("loadlibs.C"); + loadlibs(); + } +// Connect the Root Galice file containing Geometry, Kine and Hits + + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("jets.root"); + TFile *source = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); + + if (!file) { + printf("\n Creating galice.root \n"); + file = new TFile("jets.root"); + } else { + printf("\n galice.root found in file list"); + } + + if (!source) { + printf("\n Creating galice.root \n"); + source = new TFile("galice.root"); + } else { + printf("\n galice.root found in file list"); + } +// Get AliRun object from file or create it if not on file + // if (!gAlice) { + gAlice = (AliRun*)(source->Get("gAlice")); + if (gAlice) printf("AliRun object found on file\n"); + if (!gAlice) { + printf("\n create new gAlice object"); + gAlice = new AliRun("gAlice","Alice test program"); + } + // } +// Book histos + TH1F *eH = new TH1F("eH","Energy", 200, 0.0, 200.); + TH1F *etaH = new TH1F("eEta","Eta", 180, -0.9, 0.9); + TH1F *phiH = new TH1F("ePhi","Phi", 62, -3.1, 3.1); + TH1F *tH = new TH1F("tH","n tracks", 30, 0.5, 29.5); + TH1F *ptH = new TH1F("ptH","Track pT", 100., 0., 100.); + TH1F *drH = new TH1F("drH","Track dR", 120., 0., 6.); + + Float_t phiT[50], etaT[50], ptT[50]; + + + TClonesArray* jets = new TClonesArray("AliEMCALJet",10000); + + for (int nev=0; nev<= evNumber2; nev++) { + printf("\n Event .............%d", nev); + Int_t nparticles = gAlice->GetEvent(nev); + Int_t nbytes = 0; + AliEMCAL *pEMCAL = (AliEMCAL*) gAlice->GetModule("EMCAL"); + if (pEMCAL) { + TTree *TR =(TTree *)(file->Get("TreeR0")); + + Int_t nent=TR->GetEntries(); + TR->SetBranchAddress("EMCALJets", &jets); + nbytes += TR->GetEntry(0); + Int_t nJet = jets->GetEntries(); + printf("\n Number of Jets %d", nJet); + AliEMCALJet *mJet; + for (Int_t ij=0; ij < nJet; ij++) { + mJet = (AliEMCALJet*)jets->UncheckedAt(ij); + Float_t eta = mJet->Eta(); + + printf("\n Jet:%d E %f phi %f eta %f tracks %d\n", ij, + mJet->Energy(), mJet->Phi(), eta, + mJet->NTracks()); + etaH->Fill(mJet->Eta()); + phiH->Fill(mJet->Phi()); + if (TMath::Abs(eta) < 0.4) + eH->Fill(mJet->Energy()); + tH ->Fill((Float_t)mJet->NTracks()); + + mJet->TrackList(ptT, etaT, phiT); + for (Int_t it = 0; it < mJet->NTracks(); it++) + { + printf(" Track: %5d pT %8.3f eta %8.3f phi %8.3f \n", + it, ptT[it], etaT[it], phiT[it]); + ptH->Fill(ptT[it]); + Float_t dPhi = phiT[it]-mJet->Phi(); + Float_t dEta = etaT[it]-mJet->Eta(); + Float_t dr = TMath::Sqrt(dPhi*dPhi+dEta*dEta); + drH->Fill(dr); + } + } // jet + } // ?EMCAL + } // event + TCanvas *c1 = new TCanvas("c1","Canvas 1",400,10,600,700); + c1->Divide(2,2); + c1->cd(1); eH->Draw(); + c1->cd(2); etaH->Draw(); + c1->cd(3); phiH->Draw(); + c1->cd(4); tH->Draw(); + + TCanvas *c2 = new TCanvas("c2","Canvas 2",400,10,600,700); + c2->Divide(2,2); + c2->cd(1); ptH->Draw(); + c2->cd(2); drH->Draw(); +} + diff --git a/EMCAL/jetfinder/Ecommon.h b/EMCAL/jetfinder/Ecommon.h new file mode 100644 index 00000000000..1108153e46a --- /dev/null +++ b/EMCAL/jetfinder/Ecommon.h @@ -0,0 +1,47 @@ +#ifndef ROOT_ECommon +#define ROOT_ECommon + +#ifndef __CFORTRAN_LOADED +#include "cfortran.h" +#endif + +extern "C" { +// COMMON /EMCALJETS/ NJET, ETJ(100), ETAJ(100,2), PHIJ(100,2), NCELLJ(100) + + typedef struct { + Int_t njet; + Float_t etj[100]; + Float_t etaj[2][100]; + Float_t phij[2][100]; + Int_t ncellj[100]; + } EmcalJetsCommon; + +#define EMCALJETS COMMON_BLOCK(EMCALJETS,emcaljets) +COMMON_BLOCK_DEF(EmcalJetsCommon,EMCALJETS); + +// COMMON /EMCALGEO/ etaCellSize, phiCellSize + + typedef struct { + Float_t etaCellSize; + Float_t phiCellSize; + } EmcalCellGeoCommon; + +#define EMCALCELLGEO COMMON_BLOCK(EMCALCELLGEO,emcalcellgeo) +COMMON_BLOCK_DEF(EmcalCellGeoCommon,EMCALCELLGEO); + +// COMMON /EMCALJETPARAM/ cone_rad, et_seed, ej_min, et_min + typedef struct { + Float_t coneRad; + Float_t etSeed; + Float_t ejMin; + Float_t etMin; + } EmcalJetParamCommon; + +#define EMCALJETPARAM COMMON_BLOCK(EMCALJETPARAM,emcaljetparam) +COMMON_BLOCK_DEF(EmcalJetParamCommon,EMCALJETPARAM); + +} +#endif + + + diff --git a/EMCAL/jetfinder/anaDst.C b/EMCAL/jetfinder/anaDst.C new file mode 100644 index 00000000000..6514c9509ea --- /dev/null +++ b/EMCAL/jetfinder/anaDst.C @@ -0,0 +1,305 @@ +//*-- Author: Aleksei Pavlinov(WSU) +// 8-feb-2002 new version with AliEMCALJetMicroDst +#include "anaDst.h" +#include "jetDst.h" +#if !defined(__CINT__) || defined(__MAKECINT__) +// These files are needed for compilation only +// (see directory /auto/u/pavlinov/macros on PDSF) +// Using with caution if you are not PAI +#include "macroIncludePai.h" +#include "macroIncludeAlice.h" +extern "C++" {void loadlibs();} +#endif + +class TH1F; +TH1F* hJetEt, *hJetEta, *hJetPhi, *hNtracksInJet, *hPtTracksInJet, *hTrackDR, *hNjet; + +class TH2F; TH2F* hPartPt, *hPartEta, *hPartPhi; +TH1F* hPartDiffPt, *hPartDiffEta, * hPartDiffPhi; + +TH1F *hJetPartAng, *hDeta, *hDphi, *hDpt; // Comparing between jet and nearest parton + +class TCanvas; TCanvas *c1, *c2, *c3; +class TPad; TPad *p1; +class TList; TList *lPartons, *lJets, *lCompPJ; + +class TVector3; + +Int_t nparticles, nJet; +Double_t phiMax = TMath::Pi()*120./180.; +Double_t rJet = 0.5; // this default + +TFile *file; +class AliEMCALJetMicroDst; AliEMCALJetMicroDst *jDst=0; +Int_t nevMax = 1000; +TString fname; +// fitting +class TF1 *g1;// gauss + +void +anaDst(Int_t mode) +{ +// Dynamically link some shared libs + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("../macros/loadlibs.C"); + loadlibs(); + } + +//partons after HSC and jet in acceptance. + TVector3 *vJet; + TVector3 *vPart1, *vPart2; + vJet = new TVector3; + vPart1 = new TVector3; + vPart2 = new TVector3; + +// for getting information about nFileOut +//#if !defined(__CINT__) +// gROOT->ProcessLine(".L jetDst.C+"); +//#else +// gROOT->LoadMacro("jetDst.C"); +//#endif + if(!defineMicroDst(mode)) return; + + bookHist1(); + bookHistPartonsAfterHardSc(); + + Float_t phiT[50], etaT[50], ptT[50]; + + Int_t nbytes=0, nb=0, nentries = Int_t(jDst->GetTree()->GetEntries()); + if(nevMax>nentries) nevMax = nentries; + for (int nev=0; nev< nevMax; nev++) { + nb = jDst->GetEntry(nev); + nbytes += nb; + printf("\n Event .............%d bytes %d\n", nev, nb); + // jDst->Print(); + if(nb<0) break; // last event or something wrong + // return; + + Bool_t inEmc = fillInfoForPartons(vPart1, vPart2); + // continue; + + nJet = jDst->GetNjet(); + Double_t et, eta, phi; + + for(Int_t ij=0; ij < nJet; ij++) { + + jDst->GetJet(ij, 1, (*vJet)); // W + + et = vJet->Pt(); + eta = vJet->Eta(); + phi = vJet->Phi(); + + printf("\n Jet:%d E %f phi %f eta %f tracks %d\n", ij, + et, phi, eta, 0); + + // hNtracksInJet->Fill((Float_t)lJet->NTracks()); + // Safe zone - rJet - 13-feb-2002 + if(nJet==1 && TMath::Abs(eta)<(0.7-rJet)&& + phi>rJet && phi<(phiMax-rJet)) { + hJetEt->Fill(et); + hJetEta->Fill(eta); + hJetPhi->Fill(phi); + if(inEmc) compareJetPartons(vJet, vPart1, vPart2); + } + + } // jet + cleanUpEvent(); + } // event + + gStyle->SetOptStat(1111111); + + //drawPartons(); + +#if !defined(__CINT__) + if(hJetPartAng&&hJetPartAng->GetEntries()>2.){ + _drawListOfHist(lCompPJ, 2, 2); + fitGauss(hDpt, 0); + } +#endif + + gROOT->cd(); + // printf("\n Variant %1i : Alice Root file => %s \n", + //mode, nf.Data()); +} + +Bool_t defineMicroDst(Int_t mode) +{ + TString dir("/auto/u/pavlinov/ALICE/RES/FILE/"); + // TString *sTmp = defineInput(mode); // see jetDst.h + switch(mode){ + // case -4: + //if(sTmp) fname = sTmp->Data(); + //else return kFALSE; + //break; + case -3: + fname = dir + "PythiaMode-3R0.5Seed4.0JEt20.0CEt0.0PtCut0.0.root"; + break; + case -2: + fname = dir + "PythiaMode-2R0.5Seed4.0JEt20.0CEt1.0PtCut1.0.root"; + break; + case -1: + fname = dir + "PythiaMode-1R0.5Seed4.0JEt20.0CEt1.0PtCut2.0.root"; + break; + + case 11: + fname = dir + "HijingMode11R0.3Seed4.0JEt40.0CEt1.0PtCut2.0.root"; + break; + default: + printf("\n Wrong input mode => %i\n", mode); + return kFALSE; + } + jDst = new AliEMCALJetMicroDst; + jDst->Open(fname.Data()); + gROOT->GetListOfBrowsables()->Add(jDst); + return kTRUE; +} + +Bool_t fillInfoForPartons(TVector3 *vec1, TVector3 *vec2) +{ + // npart=4 for HIJING and 2 for PYTHIA + Int_t npart = jDst->GetNpart(); + if(!jDst->GetParton(npart-2, (*vec1))||!jDst->GetParton(npart-1, (*vec2)) ) + return kFALSE; + + static Double_t dphi; + + Bool_t inEmc = kFALSE; + TVector3 *vec = vec1; + for (Int_t i=0; i<2; i++) { + Double_t ri = Double_t(i); + hPartPt->Fill(vec->Pt(), ri); + hPartEta->Fill(vec->Eta(), ri); + hPartPhi->Fill(vec->Phi(), ri); + if(fabs(vec->Eta())<0.7 && vec->Phi()>0 && vec->Phi()< phiMax) inEmc=kTRUE; + vec = vec2; + } + hPartDiffPt->Fill(vec1->Pt()-vec2->Pt()); + hPartDiffEta->Fill(vec1->Eta()-vec2->Eta()); + dphi = vec1->Phi() - vec2->Phi(); + dphi = fabs(TVector2::Phi_mpi_pi(dphi)); + hPartDiffPhi->Fill(dphi); + return inEmc; +} + +void compareJetPartons(TVector3 *vecJet, TVector3 *vec1, TVector3 *vec2) +{// 30-jan-2002 + TVector3 *v, *vw; + Double_t ang, angw; + + v = vec1; + ang = vecJet->Angle((*v)); + vw = vec2; + angw = vecJet->Angle((*vw)); + if(ang>angw) { + ang = angw; + v = vw; + } + hJetPartAng->Fill(ang); + hDeta->Fill(vecJet->Eta() - v->Eta()); + hDphi->Fill(vecJet->Phi() - v->Phi()); + hDpt->Fill(vecJet->Pt() - v->Pt()); +} + +void bookHist1() +{ + gROOT->cd(); +// Book histos + hNjet= new TH1F("hNjet","# jets", 11, -0.5, 10.5); + hJetEt = new TH1F("hJetEt","Energy of jet", 150, 0.0, 450.); + hJetEta = new TH1F("hJetEta","#eta of jet", 180, -0.9, 0.9); + hJetPhi = new TH1F("hJetPhi","#phi of jet", 62, -3.1, 3.1); + hNtracksInJet = new TH1F("hNtracksInJet","n tracks", 30, 0.5, 29.5); + hPtTracksInJet = new TH1F("hPtTracksInJet","p_{T} of tracks in jets cone", + 100., 0., 100.); + hTrackDR = new TH1F("hTrackDR","Track dR", 120., 0., 6.); +#if !defined(__CINT__) + lJets = _moveHistsToList("Hist for jets"); +#endif +// QA + hJetPartAng = new TH1F("hJetPartAng","angle between jet and nearest parton", 100,0.0,0.2); + hDeta = new TH1F("hDeta","#eta (jets) - #eta (partons)", 100, -.1, +.1); + hDphi = new TH1F("hDphi","#phi (jets} - #phi (partons)", 100, -.1, +.1); + hDpt = new TH1F("hDpt","E_{t} (jets) - E_{t} (partons)",100, -200., +200.); +#if !defined(__CINT__) + lCompPJ = _moveHistsToList("Hist for jet vs parton"); +#endif +} + +void bookHistPartonsAfterHardSc() +{ + hPartPt = new TH2F("hPartPt","Partons p_{t}", 500, 30., 1030., 2, -0.5, 1.5); + hPartEta = new TH2F("hPartEta","Partons #eta", 100, -5., 5., 2,-0.5,1.5); + hPartPhi = new TH2F("hPartPhi","Partons #phi", 120,-0.2,2.2, 2,-0.5,1.5); + hPartDiffPt = new TH1F("hPartDiffPt","p_{t} difference for partons",100, -100., 100.); + hPartDiffEta = new TH1F("hPartDiffEta","#eta difference for partons",100, -5., 5.); + hPartDiffPhi = new TH1F("hPartDiffPhi","#phi angle for partons",320, 0.0, 3.2); +#if !defined(__CINT__) + lPartons = _moveHistsToList("Hist for partons"); +#endif +} + +void drawPartons() +{ + gStyle->SetOptStat(1111111); + c3 = new TCanvas("c3","Partons canvas",400,10,600,700); + c3->Divide(2,3); + TH1D *hid; + + c3->cd(1); + hid = hPartPt->ProjectionX("_pt1",1,1); _drawHist(hid, 2); + hid = hPartPt->ProjectionX("_pt2",2,2); _drawHist(hid, 1, 2, "same"); + c3->cd(2); _drawHist(hPartDiffPt,2); + + c3->cd(3); + hid = hPartEta->ProjectionX("_eta1",1,1); _drawHist(hid, 2); + hid = hPartEta->ProjectionX("_eta2",2,2); _drawHist(hid, 1, 2, "same"); + c3->cd(4); _drawHist(hPartDiffEta,2); + + c3->cd(5); + hid = hPartPhi->ProjectionX("_phi1",1,1); _drawHist(hid, 2); + hid = hPartPhi->ProjectionX("_phi2",2,2); _drawHist(hid, 1, 2, "same"); + c3->cd(6); _drawHist(hPartDiffPhi,2); +} + +void fitGauss(TH1F* hid, Int_t opt) +{ // see /home/pavlinov/cosmic/pythia/geant/lin.C + Double_t c = 2.5; + Double_t xmax = hid->GetBinCenter(hid->GetMaximumBin()); + Double_t rms = hid->GetRMS(); + Double_t xmi=xmax -c*rms, xma=xmax+c*rms; + _fit(111); + if(!g1) { + g1 = new TF1("g1","gaus", xmi, xma); + } + g1->SetLineColor(2); // red + g1->SetLineWidth(3); + + TString stmp = fname(0,fname.Length()-5); // discard .root + if(!c1) { + c1 = new TCanvas("c1","Jet resolution",400,10,600,700); + p1 = _pad(stmp.Data(),c1); + } + p1->cd(); p1->Clear(); + hid->Fit("g1","R+"); + + if(opt) { + _drawHist(hid, 2); + if(opt>=10) { + stmp += "_res.ps"; + stmp.ReplaceAll("/FILE",""); + p1->Print(stmp.Data()); + } + } +} + +void cleanUpEvent() +{ + /* ??? + if(lPart[0]) { + lPart[0]->Delete(); + lPart[0]=0; + lPart[1]->Delete(); + lPart[1]=0; + } + */ +} diff --git a/EMCAL/jetfinder/anaDst.h b/EMCAL/jetfinder/anaDst.h new file mode 100644 index 00000000000..81484e44f88 --- /dev/null +++ b/EMCAL/jetfinder/anaDst.h @@ -0,0 +1,18 @@ +// +// 8-feb-2002 new version with class AliEMCALJetMicroDst +// +class TH1F; +class TVector3; + +void anaDst(Int_t mode=1); +Bool_t defineMicroDst(Int_t mode); + +void bookHist1(); +void bookHistPartonsAfterHardSc(); +Bool_t fillInfoForPartons(TVector3 *vec1, TVector3 *vec2); +void compareJetPartons(TVector3 *vecJet, TVector3 *vec1, TVector3 *vec2); + +void drawPartons(); +void fitGauss(TH1F* hid, Int_t opt); + +void cleanUpEvent(); diff --git a/EMCAL/jetfinder/jetDst.C b/EMCAL/jetfinder/jetDst.C new file mode 100644 index 00000000000..a2a14ae4f43 --- /dev/null +++ b/EMCAL/jetfinder/jetDst.C @@ -0,0 +1,383 @@ +//*-- Author: Aleksei Pavlinov (WSU) +//*-- +#include "jetDst.h" +#if !defined(__CINT__) || defined(__MAKECINT__) +// These files are needed for compilation only +// (see directory /auto/u/pavlinov/macros on PDSF) +// Using with caution if you are not PAI +#include "macroIncludePai.h" +#include "macroIncludeAlice.h" +extern "C++" {void loadlibs();} +#endif + +// For convinience only +class AliEMCALJetFinder; AliEMCALJetFinder* jetFinder=0; +TH2F *hLego, *hLegoW, *hTrig; +TH1F *hETrigPatch, *hJetPartPt; +TCanvas *c1=0; +// directory with file and number of files +TString dirIn("/auto/alice/sahal/PPR3/11/"), nFileIn; +Int_t file1=1, file2=20, nevMax=0; +// change dirOut if you want. +TString dirOut("RES/FILE/"), nFileOut; +TFile *file=0; +// Default value for jet fineer - 11-feb-2202 +Int_t debugJet=1; +Float_t coneRadius = 0.3; +Float_t etSeed = 4.; +Float_t minJetEt = 40.; +Float_t minCellEt = 1.; // be carefull +Float_t minPtCut = 2.; // for including charge particles to file +// For BG subtraction +Int_t modeSubtraction = 1; +Float_t minMove = 0.05; +Float_t maxMove = 0.15; +Float_t precBg = 0.035; +// key 13-feb-2002 +Bool_t hadronCorrection = kTRUE; +// +class AliEMCALJetMicroDst; AliEMCALJetMicroDst *dst=0; +Int_t nevSum = 0, nevF; +TArrayI nevInFiles(100); + + +void jetDst(Int_t mode, Int_t var, Int_t nmax) +{ +// +// mode - variable for selection input mode (see function defineInput()); +// var - variable for selection jetfinder mode (see function defineJetFinder()). +// +// Dynamically link some shared libs + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("../macros/loadlibs.C"); + loadlibs(); + } + + if(!defineInput(mode)) return; + + dst = new AliEMCALJetMicroDst; + dst->SetDebug(1); + if(!nFileOut.Contains(".root")){ + nFileOut += var; + nFileOut += ".root"; + } + dst->Create(nFileOut.Data()); + gROOT->GetListOfBrowsables()->Add(dst); + + for(Int_t j=file1; j<=file2; j++){ + nevF = 0; + if(file2>1) {// multiple file + nFileIn = dirIn; + if (mode>=11 && mode<=11) { + nFileIn += j; + nFileIn += ("/galice.root"); + } else if(mode>=21 && mode<=51){ + nFileIn += "galice"; + if(j>0) nFileIn += j; + nFileIn += ".root"; + } + } +// Connect the Root Galice file containing Geometry, Kine and Hits + file = new TFile(nFileIn.Data(), "READ"); + printf("\n FILE %i -> %s\n", j, nFileIn.Data()); + + if (file == 0) continue; + +// Get AliRun object from file or create it if not on file + gAlice = 0; + gAlice = (AliRun*)(file->Get("gAlice")); + if(!gAlice) return; + printf("AliRun object found on file\n"); + + defineJetFinder(mode,var); +// +// Loop over events in file +// + +// if(!c1) c1 = new TCanvas("c1","Canvas 1",400,10,600,700); + Int_t nhit=0; + TString sw; + if(nmax>0) nevMax = nmax; + for (Int_t nev = 0; nev<= nevMax; nev++) { + jetFinder->ResetJets(); + Int_t nparticles = gAlice->GetEvent(nev); + if (nparticles <= 0) break; // last event + nevSum++; + nevF++; +// Partons jet +/* + jetFinder->FillFromPartons(); + jetFinder->Find(); + for(Int_t ij=0; ijNjets(); ij++){ + hJetPartPt->Fill(jetFinder->JetEnergy(ij)); + } + jetFinder->ResetJets(); +*/ +// ECAL information + jetFinder->FillFromHits(); + + // gROOT->cd(); be carefull with this staff + hLegoW = new TH2F((*jetFinder->GetLego())); // for saving + sw = hLegoW->GetName(); + sw += nev; + hLegoW->SetName(sw.Data()); + sw = "Energy in ECAL:Event"; + sw += nev; + hLegoW->SetTitle(sw.Data()); + + if(hTrig==0) { + hLego = jetFinder->GetLego(); + hTrig = bookTrigHist(hLego); + } + fillTriggerPatch(hLegoW, hTrig, hETrigPatch); + +// jetFinder->FillFromDigits(); +// TPC information + jetFinder->FillFromTracks(1, 0); +// ^ preserves info from hit + +// TPC information from Hits associated to the EMCAL +// jetFinder->FillFromHitFlaggedTracks(1); +// + jetFinder->Find(); + dst->Fill(gAlice, jetFinder); +// +// Look at results + printf("\n Events : %d Jets : %d \n", nev, jetFinder->Njets()); + Int_t njet = jetFinder->Njets(); + for (Int_t nj=0; njJetEnergy(nj)); + printf("Jet Phi %5d %8.2f %8.2f \n", + nj, jetFinder->JetPhiL(nj), jetFinder->JetPhiW(nj)); + printf("Jet Eta %5d %8.2f %8.2f \n", + nj, jetFinder->JetEtaL(nj), jetFinder->JetEtaW(nj)); + } + + Int_t in; + if (c1 && nev <-10 && njet==1 && jetFinder->JetEnergy(0)>150) { + c1->cd(); + cout << "Event "<< nev <Draw("lego"); + c1->Update(); + cin >> in; + if(in<=0) return; + } + } // event loop + nevInFiles[j-1] = nevF; + if (gAlice) { + delete gAlice; // don't delete after closing file + gAlice = 0; + } + file->Close(); + if(c1) hLego->Draw("lego"); + } // file loop + if(nmax==0) dst->Close(); + nevInFiles.Set(file2); + printf("\n Summ.events %6i -> %6i\n", nevSum, (Int_t) nevInFiles.GetSum()); + + printf("Events "); + for(Int_t j=file1; j<=file2; j++){ + printf(" %i4 ",nevInFiles[j-1]); + if((j-file1)%10==0 && j!=file1) printf("\n "); + } +} + +// ################################################################### +TString* defineInput(Int_t mode) +{// 7-feb-2002 + Char_t ctmp[200]; + switch(mode){ +// case -5 needing for testing after merging + case -5: + case -4: + hadronCorrection = kFALSE; // for checking Tom's idea + case -3: + case -2: + case -1: + if (mode==-2) minPtCut = 1.; + else if(mode<=-3 || mode>=-5) { + minCellEt = 0.0; // 13-feb-2002 + minPtCut = 0.0; + } + + coneRadius = 0.5; + minJetEt = 20.0; + file1=1; + file2=1; + modeSubtraction = 0; + nevMax = 1; + nevMax = 999; + dirIn = "."; + nFileIn = "galice.root"; + sprintf(ctmp,"PythiaMode%iR%3.1fSeed%3.1fJEt%4.1fCEt%3.1fPtCut%3.1f.root", + mode, coneRadius, etSeed, minJetEt, minCellEt, minPtCut); + nFileOut = dirOut + ctmp; + if(!hadronCorrection) nFileOut.ReplaceAll(".root","_NoHadrCorr.root"); + break; + case 1: + nFileOut = dirOut + "dstTest.root"; + break; + + case 11: + // jj100 41 events per file - see Log file + dirIn = "/auto/alice/sahal/PPR4/1/"; + file1 = 1; + file2 = 30; // max 75 + nevMax = 41; + sprintf(ctmp,"HijingMode%iR%3.1fSeed%3.1fJEt%4.1fCEt%3.1fPtCut%3.1f.root", + mode, coneRadius, etSeed, minJetEt, minCellEt, minPtCut); + nFileOut = dirOut + ctmp; + break; + //============================================================= + // central events with jet trigger - 15 feb 2002 + //============================================================= + case 21: + dirIn = "/auto/alice/sahal/kHijing_jj50/"; + file1 = 0; + file2 = 9; + nevMax = 41; + sprintf(ctmp,"Hijing_jj50Mode%iR%3.1fSeed%3.1fJEt%4.1fCEt%3.1fPtCut%3.1f.root", + mode, coneRadius, etSeed, minJetEt, minCellEt, minPtCut); + nFileOut = dirOut + ctmp; + break; + case 22: + dirIn = "/auto/alice/sahal/kHijing_jj75/"; + file1 = 0; + file2 = 9; + nevMax = 41; + sprintf(ctmp,"Hijing_jj75Mode%iR%3.1fSeed%3.1fJEt%4.1fCEt%3.1fPtCut%3.1f.root", + mode, coneRadius, etSeed, minJetEt, minCellEt, minPtCut); + nFileOut = dirOut + ctmp; + break; + case 23: + dirIn = "/auto/alice/sahal/kHijing_jj100/"; + file1 = 0; + file2 = 4; + nevMax = 41; + sprintf(ctmp,"Hijing_jj100Mode%iR%3.1fSeed%3.1fJEt%4.1fCEt%3.1fPtCut%3.1f.root", + mode, coneRadius, etSeed, minJetEt, minCellEt, minPtCut); + nFileOut = dirOut + ctmp; + break; + case 24: + dirIn = "/auto/alice/sahal/kHijing_jj125/"; + file1 = 0; + file2 = 4; + nevMax = 41; + sprintf(ctmp,"Hijing_jj125Mode%iR%3.1fSeed%3.1fJEt%4.1fCEt%3.1fPtCut%3.1f.root", + mode, coneRadius, etSeed, minJetEt, minCellEt, minPtCut); + nFileOut = dirOut + ctmp; + break; + + case 51: + // BG - HIJING events + dirIn = "/auto/alice/sahal/background/"; + file1 = 1; + file2 = 9; + nevMax = 100; // ?? + sprintf(ctmp,"HijingBGMode%iR%3.1fSeed%3.1fJEt%4.1fCEt%3.1fPtCut%3.1f.root", + mode, coneRadius, etSeed, minJetEt, minCellEt, minPtCut); + nFileOut = dirOut + ctmp; + break; + default: + printf("\n Wrong input mode => %i\ncout", mode); + return 0; + } + printf(" dir %s file1 %3i file2 %3i\n", dirIn.Data(), file1, file2); + return &nFileOut; +} + +void defineJetFinder(Int_t mode, Int_t var) +{// 11-feb-2002 +// Create and configure jet finder +// gAlice must be defined already !!! + if(!jetFinder) { + jetFinder = new AliEMCALJetFinder("UA1 Jet Finder", "Pre Production"); + jetFinder->Init(); + + jetFinder->SetDebug(debugJet); + jetFinder->SetConeRadius(coneRadius); + jetFinder->SetEtSeed(etSeed); + jetFinder->SetMinJetEt(minJetEt); + jetFinder->SetMinCellEt(minCellEt); + jetFinder->SetPtCut(minPtCut); + + if(var>=2) jetFinder->SetMomentumSmearing(1); + if(var>=3) jetFinder->SetEfficiencySim(1); + + jetFinder->SetHadronCorrection(0); + if(var>=4 && hadronCorrection) { + jetFinder->SetHadronCorrection(1); + jetFinder->SetHadronCorrector(AliEMCALHadronCorrectionv0::Instance()); + } + if(var>=5) { // 11-feb-2002 + jetFinder->SetParametersForBgSubtraction + (modeSubtraction,minMove,maxMove,precBg); + } + + if(mode<0) jetFinder->SetSamplingFraction(1.);//must use only for PYTHIA file + else jetFinder->SetSamplingFraction(12.9); + gROOT->GetListOfBrowsables()->Add(jetFinder); + } +} + +void testDST(char* fname) +{// 8-feb-2002 + dst = new AliEMCALJetMicroDst; + dst->Open(fname); + dst->Test(); + gROOT->GetListOfBrowsables()->Add(dst); +} + +//----------------- 4-feb-2002 -------------- +TH2F* bookTrigHist(TH2F *hid) +{ + if(hid==0) return 0; + TAxis *xax = hid->GetXaxis(); + Double_t xmin = xax->GetXmin(); + Double_t xmax = xax->GetXmax(); + Int_t nx = 6; + TAxis *yax = hid->GetYaxis(); + Double_t ymin = yax->GetXmin(); + Double_t ymax = yax->GetXmax(); + Int_t ny = 6; + TH2F *hout = new TH2F("hTrig","Energy grid for trigger patch", + nx,xmin,xmax, ny,ymin,ymax); + hout->AddDirectory(0); + + // time solution + hETrigPatch = new TH1F("hETrigPatch","Energy in trigger patch",300, 0.0, 300.); + hJetPartPt = new TH1F("hJetPartPt", "E_{T} for partons jet", 300, 0.0, 300.); + hETrigPatch->AddDirectory(0); + return hout; +} + +void fillTriggerPatch(TH2F *hid, TH2F *htrig, TH1F *hE) +{ + TAxis *xax = hid->GetXaxis(); + TAxis *yax = hid->GetYaxis(); + Int_t nx = xax->GetNbins(); + Int_t ny = yax->GetNbins(); + + htrig->Reset(); + Double_t x, y, e; + for(Int_t ix=1; ix<=nx; ix++){ + x = xax->GetBinCenter(ix); + for(Int_t iy=1; iy<=ny; iy++){ + y = yax->GetBinCenter(iy); + e = hid->GetBinContent(ix, iy); + htrig->Fill(x,y,e); + } + } + + xax = htrig->GetXaxis(); + yax = htrig->GetYaxis(); + nx = xax->GetNbins(); + ny = yax->GetNbins(); + for(Int_t ix=1; ix<=nx; ix++){ + for(Int_t iy=1; iy<=ny; iy++){ + hE->Fill(htrig->GetBinContent(ix, iy)); + } + } +} diff --git a/EMCAL/jetfinder/jetDst.h b/EMCAL/jetfinder/jetDst.h new file mode 100644 index 00000000000..34cf57e0e1a --- /dev/null +++ b/EMCAL/jetfinder/jetDst.h @@ -0,0 +1,15 @@ +// +// 6-feb-2002 by PAI +// +class TH1F; +class TH2F; + +void jetDst(Int_t mode=11, Int_t var=5, Int_t nmax=0); +TString *defineInput(Int_t mode); +void defineJetFinder(Int_t mode, Int_t var); + +void testDST(char* fname="RES/FILE/jet100_1000ev_4.root"); +// by PAI - 4-feb-2002 +TH2F* bookTrigHist(TH2F *hid); +void fillTriggerPatch(TH2F *hid, TH2F *htrig, TH1F* hE); + diff --git a/EMCAL/jetfinder/jet_finder_ua1.F b/EMCAL/jetfinder/jet_finder_ua1.F new file mode 100644 index 00000000000..0780917c2f3 --- /dev/null +++ b/EMCAL/jetfinder/jet_finder_ua1.F @@ -0,0 +1,321 @@ +c +c => Original copy from /star/emc/shester/cl/pams/emc/jet/jet_finer_ua1.F +c +c:>------------------------------------------------------------------ +C:ROUTINE: subroutine jet_finder_ua1 +C:DESCRIPTION: UA1 jet algorithm from LUND JETSET called from EMC_erj +C:ARGUMENTS: emc_energy_h, emc_energy, +C:ARGUMENTS: et_tot, EMC_jetpar, ierror +C:RETURN VALUE: ierror=1 on error +c:>------------------------------------------------------------------ + subroutine jet_finder_ua1( + + ncell, ncell_tot, etc, etac, phic, + + min_move, max_move, mode, prec_bg, ierror) + implicit none ! 5-oct-2001 +c#include "math_constants.inc" +c#include "calorSize.inc" + real C_PI + real C_2PI + real etaCellSize + real phiCellSize + real arg + INTEGER NMAX,JMAX + parameter(NMAX=30000,JMAX=100) ! 10-oct-2201 + integer ncell, ierror, mode, ncell_tot + real etc(NMAX),etac(NMAX),phic(NMAX) + real cone_rad, et_seed, ej_min, et_min + real min_move, max_move, prec_bg + integer flag(NMAX),index(NMAX) + integer n_iter,i,j,k,l,nc + real et_sum,et_ave,et_sum_old + real et,eta,phi,eta0,phi0,etab,phib,ets,etas,phis + real deta,dphi,r_int +! + real occupationAll, occupationInJet ! 3-oct-2001 by PAI + integer maxTowerInJet ! 5-oct-2001 by PAI + save maxTowerInJet ! This is obligatory + integer idPerfomance + data idPerfomance /119/ + save idPerfomance +! print parameter - 27-sep-2001 by PAI + integer kpri + data kpri /0/ + integer njet, ncellj + real etj, etaj, phij +* Results + COMMON /EMCALJETS/ NJET, ETJ(100), ETAJ(100,2), PHIJ(100,2), + + NCELLJ(100) +* Cell Geometry + COMMON /EMCALCELLGEO/ etaCellSize, phiCellSize +* Parameters + COMMON /EMCALJETPARAM/ cone_rad, et_seed, ej_min, et_min + + C_PI = 3.1415926 + C_2PI = 2.*C_PI + + if(kpri.eq.0) then + kpri = 1 +! for add. correction of jet energy if ocupation in jet not 100% !! +! may differ from real number because grid + maxTowerInJet= + + int((C_PI*cone_rad*cone_rad)/(etaCellSize*phiCellSize)+0.5) + print 1, ncell_tot + + ,cone_rad, et_seed, ej_min, et_min + + ,min_move, max_move, mode, prec_bg + + ,maxTowerInJet + 1 format(/ + + ' == jet_finder_UA1 == '/ + + ' ncell_tot ', i5/ + + ' cone rad ', f5.2/ + + ' et_seed ', f5.2,' GeV/C'/ + + ' ej_min ', f5.2,' GeV/C'/ + + ' et_min(tower after bg sub.) ', f5.2,' GeV/C'/ + + ' min_cone_move ', f5.3/ + + ' max_cone_move ', f5.3/ + + ' Mode for BG subtraction ', i5/ + + ' prec_bg ', f5.4/ + + ' -- PAI"s addition --'/ + + ' maxTowerInJet ', i5/ + + ' -- '/ + + ) + if(NMAX .lt. ncell_tot) then + print 2, NMAX, ncell_tot + 2 format(' you must increase memory -> NMAX ',i6 + + ,' ncell_tot ', i6) + endif + endif + call hf1(idPerfomance, 1., 1.) + occupationAll = float(ncell) / float(ncell_tot) + call hf1(111, occupationAll, 1.) +! print parameter - 27-sep-2001 by PAI + ierror =0 + n_iter =0 +c*-sort cells by Et decending order, store the order in index + call sortzv(etc,index,ncell,-1,1,0) +c*-sum up total energy of all cells + if(mode .eq. 1) then + n_iter=1 + et_sum=0.0 + do i=1, ncell + et_sum=et_sum+etc(i) + enddo + et_sum_old=et_sum + et_ave=et_sum/float(ncell_tot) + else + et_ave=0.0 + endif + print *,'Iter ', n_iter, ' et_ave ', et_ave, ' #cells ', ncell +c*-Watch out!!! For mode=1, it can jump back to here for next iteration!!! + 999 continue +c*-kill cells (flag=2) with Et below ET_MIN after background subtraction +cfca call vzero(flag,ncell) + do i=1, ncell + flag(i)=0 + if(etc(i)-et_ave .le. et_min) flag(i)=2 + enddo + njet = 0 +c*-Initiator cell is the one with highest Et of not yet used ones + i=1 + j=index(i) + if(i.eq.1. and. etc(j).lt.et_seed) then + if(mode.eq.0 .or. (mode.eq.1 .and. n_iter.eq.1)) then + call hf1(idPerfomance, 2., 1.) + print *,' no cell with Et higher than et_seed ->', etc(j) + endif + endif + do while(etc(j) .ge. et_seed) + if(flag(j) .eq. 0) then + et =etc(j)-et_ave + eta=etac(j) + phi=phic(j) + eta0=eta + phi0=phi + etab=eta + phib=phi + ets =0.0 + etas=0.0 + phis=0.0 +c*-weighted eta and phi. + do k= 1, ncell + l=index(k) + if(flag(l).eq.0) then + deta=etac(l)-eta +c*-Is the cell is in the cone? + if(abs(deta).le.cone_rad)then + dphi=phic(l)-phi + do while(dphi .gt. C_PI) + dphi=dphi-C_2PI + enddo + do while(dphi .le. -C_PI) + dphi=dphi+C_2PI + enddo + if(abs(dphi).le.cone_rad) then + r_int=sqrt(deta**2+dphi**2) + if(r_int.le.cone_rad)then +c*-calculate offset from initiate cell + deta=etac(l)-eta0 + dphi=phic(l)-phi0 + do while(dphi .gt. C_PI) + dphi=dphi-C_2PI + enddo + do while(dphi .lt. -C_PI) + dphi=dphi+C_2PI + enddo + et=etc(l)-et_ave + etas=etas+abs(et)*deta + phis=phis+abs(et)*dphi + ets =ets +et +c*-New weighted eta and phi including this cell + eta=eta0+etas/ets + phi=phi0+phis/ets +c*-If cone does not move much from previous cone, just go next step + r_int=sqrt((eta-etab)**2+(phi-phib)**2) + if(r_int .le. min_move) then + goto 159 + endif +c*-Cone should not move more than MAX_CONE_MOVE from initiator cell + r_int=sqrt((etas/ets)**2+(phis/ets)**2) + if(r_int .ge. max_move) then + eta=etab + phi=phib + goto 159 + endif +c*-Store this loop information + etab=eta + phib=phi + endif + endif + endif + endif + enddo + 159 continue + +c*-sum up unused cells within required distance of given eta/phi + nc=0 + ets=0.0 + etas=0.0 + phis=0.0 + do k=1,ncell + l=index(k) + if(flag(l) .eq. 0) then + deta=etac(l)-eta + if(abs(deta).le.cone_rad)then + dphi=phic(l)-phi + do while(dphi .gt. C_PI) + dphi=dphi-C_2PI + enddo + do while(dphi .le. -C_PI) + dphi=dphi+C_2PI + enddo + if(abs(dphi).le.cone_rad) then + r_int=sqrt(deta**2+dphi**2) + if(r_int.le.cone_rad)then + flag(l)=-1 + et =etc(l)-et_ave + ets =ets +et + etas=etas+et*deta + phis=phis+et*dphi + nc = nc + 1 + endif + endif + endif + endif + enddo ! do k=1,ncell +! 5-oct-2001 by PAI - remove 20-feb-2002 by PAI +! 20-feb-2002 - it is work if you apply cut on eT before jet finder !!! +! if(maxTowerInJet .gt. nc) then +! ets = ets - et_ave*(maxTowerInJet - nc) +! endif +! 5-oct-2001 by PAI + +c*-reject cluster below minimum Ej_min +c* protection (am) + etas=eta+etas/ets + arg = 0. + if (ets .ne. 0.) then + if (abs(etas/ets) .lt. 23.719) then + arg = ets * cosh(etas/ets) + else + arg = 1.e10 + endif + endif + + if(arg .lt. ej_min) then + do k=1,ncell + if(flag(k).le.0) flag(k)=0 + enddo + if(njet.eq.0) call hf1(idPerfomance, 3., 1.) + else +c*-eles, store flags and jet variables + do k=1,ncell + if(flag(k).eq.-1) flag(k)=1 + enddo + phi=phi+phis/ets + do while(phi .ge. C_2PI) + phi=phi-C_2PI + enddo + do while(phi .lt. 0.0) + phi=phi+C_2PI + enddo + njet=njet+1 + etj(njet) =ets + etaj(njet,1)=eta0 + phij(njet,1)=phi0 + etaj(njet,2)=etas + phij(njet,2)=phi + ncellj(njet)=nc + call hf1(112, float(nc)/float(maxTowerInJet), 1.) ! 8-oct-2001 + endif + endif + i=i+1 + j=index(i) + enddo + +c*-recalculate energy sum excluding used cells. + if(mode.eq.1)then + et_sum=0.0 + nc=0 ! #cells in jets + do i=1,ncell + if(flag(i).ne.1) then ! 1 if cell in jet + et_sum=et_sum+etc(i) + else + nc=nc+1 + endif + enddo +c*-if background level changes more than prec_bg, go next iteration!!! +c*-after 10 iteration, stop working and finish + if( (abs(et_sum-et_sum_old)/et_sum.gt.prec_bg + + .and. n_iter.le.10) + + .or. n_iter.eq.1) then ! minimum 2 iteration - 10-oct-2001 by pai + et_ave=et_sum/float(ncell_tot-nc) + n_iter=n_iter+1 + et_sum_old = et_sum + print *,'End of iteration : et_ave ', et_ave, ' nc ', nc + + , ' Jet energy ', ets + goto 999 +c*-Watch out!!! Here is a big jump!!! + endif + occupationInJet = float(ncell) / float(ncell_tot) + call hf1(111, occupationInJet, 1.) + write(*,*) njet,' jet found in ',n_iter, + + ' iteration(s) : EtSum, EtAve =', + + et_sum,et_sum/float(ncell_tot-nc) + + , ' ncell_tot ', ncell_tot, ' #cell in jet ', nc + + , ' occupationAll ', occupationAll + + , ' occupationInJet ', occupationInJet + endif + + if(njet.gt.100)then + write(*,*)'UA1:Problem:More than 100 jets found!' + ierror = 1 + elseif(njet.eq.0)then + write(*,*)'UA1:Done:No jet found!' + else + write(*,*) + +'UA1:Done:Found ',njet,' jet(s)' + end if + return + end + + + diff --git a/EMCAL/jetfinder/sgpdge.F b/EMCAL/jetfinder/sgpdge.F new file mode 100644 index 00000000000..475c9011f17 --- /dev/null +++ b/EMCAL/jetfinder/sgpdge.F @@ -0,0 +1,208 @@ +* +** 21-feb-2001 get from polar.ihep.su@DATA$STAR:[PAVLINOV.RSC]SGPDGE.CAR +* +*-- Author : David Adams 03/11/90 + SUBROUTINE SGPDGE( I, PDGGEA ) +CA)========================================(begin of short description) +C Converts a PDG particle number to a GEANT particle number. +CB)-----------------------------------------(begin of long description) +C +C Purpose and methods : +C Translates the PDG code I to the GEANT particle code PDGGEA. +C Zero is returned if the PDG code cannot be translated. +C +C Called by: SGGENE +C +C Input arguments : I - PDG particle code +C +C Input/output arguments : none +C +C Output arguments: PDGGEA - GEANT particle code +C +C Side effects (other variables/banks modified, etc.) +C +C Created: dd-mmm-1990 David Adams +C Modified: 19-FEB-1991 David Adams - fixed bugs in particle codes. +C +CC)-------------------------------------------(end of long description) +CD)----------------------------------(declare common blocks, variables) +C Common blocks +C Variables in argument list +C Save variables +C Local variables + INTEGER I, IABS, PDGGEA +C External references +C Statement functions +C Local data statements +CE)===============================================(end of declarations) +C + PDGGEA = 0 + IABS = ABS(I) + +C Leptons + IF ( IABS .LT. 20 ) THEN + +C . e-, e+, nue + IF ( I .EQ. 11 ) THEN + PDGGEA = 3 + ELSEIF ( I .EQ. -11 ) THEN + PDGGEA = 2 + ELSEIF ( IABS .EQ. 12 ) THEN + PDGGEA = 4 + +C . mu-, mu+, numu + ELSEIF ( I .EQ. 13 ) THEN + PDGGEA = 6 + ELSEIF ( I .EQ. -13 ) THEN + PDGGEA = 5 + ELSEIF ( IABS .EQ. 14 ) THEN + PDGGEA = 4 + +C . tau-, tau+, nutau + ELSEIF ( I .EQ. 15 ) THEN + PDGGEA = 34 + ELSEIF ( I .EQ. -15 ) THEN + PDGGEA = 33 + ELSEIF ( IABS .EQ. 16 ) THEN + PDGGEA = 4 + + ENDIF + + RETURN + +C Bosons. + ELSEIF ( IABS .LT. 100 ) THEN + +C . gamma, W+, W-, Z + IF ( I .EQ. 22 ) THEN + PDGGEA = 1 + ELSEIF ( I .EQ. 24 ) THEN + PDGGEA = 42 + ELSEIF ( I .EQ. -24 ) THEN + PDGGEA = 43 + ELSEIF ( I .EQ. 23 ) THEN + PDGGEA = 44 + ENDIF + + RETURN + + +C Mesons + ELSEIF ( IABS .LT. 1000 ) THEN + +C . pi0, pi+, pi- + IF ( I .EQ. 111 ) THEN + PDGGEA = 7 + ELSEIF ( I .EQ. 211 ) THEN + PDGGEA = 8 + ELSEIF ( I .EQ. -211 ) THEN + PDGGEA = 9 + +C . K0L, K0S, K+, K- + ELSEIF ( I .EQ. 130 ) THEN + PDGGEA = 10 + ELSEIF ( I .EQ. 310 ) THEN + PDGGEA = 16 + ELSEIF ( I .EQ. 321 ) THEN + PDGGEA = 11 + ELSEIF ( I .EQ. -321 ) THEN + PDGGEA = 12 + +C . K0L, K0S, K+, K- + ELSEIF ( I .EQ. 130 ) THEN + PDGGEA = 10 + ELSEIF ( I .EQ. 310 ) THEN + PDGGEA = 16 + ELSEIF ( I .EQ. 321 ) THEN + PDGGEA = 11 + ELSEIF ( I .EQ. -321 ) THEN + PDGGEA = 12 + +C . eta + ELSEIF ( I .EQ. 221 ) THEN + PDGGEA = 17 + +C . D+, D-, D0, D0bar + ELSEIF ( I .EQ. 411 ) THEN + PDGGEA = 35 + ELSEIF ( I .EQ. -411 ) THEN + PDGGEA = 36 + ELSEIF ( I .EQ. 421 ) THEN + PDGGEA = 37 + ELSEIF ( I .EQ. -421 ) THEN + PDGGEA = 38 + +C . DS+, DS- (previously F+, F-) + ELSEIF ( I .EQ. 431 ) THEN + PDGGEA = 39 + ELSEIF ( I .EQ. -431 ) THEN + PDGGEA = 40 + + ENDIF + + RETURN + + +C Hadrons + ELSEIF ( IABS .LT. 10000 ) THEN + +C . n, nbar, p, pbar + IF ( I .EQ. 2112 ) THEN + PDGGEA = 13 + ELSEIF ( I .EQ. -2112 ) THEN + PDGGEA = 25 + ELSEIF ( I .EQ. 2212 ) THEN + PDGGEA = 14 + ELSEIF ( I .EQ. -2212 ) THEN + PDGGEA = 15 + +C . lambda, antilambda + ELSEIF ( I .EQ. 3122 ) THEN + PDGGEA = 18 + ELSEIF ( I .EQ. -3122 ) THEN + PDGGEA = 26 + +C . sigma +, 0, -, antisigma -, 0, + + ELSEIF ( I .EQ. 3222 ) THEN + PDGGEA = 19 + ELSEIF ( I .EQ. 3212 ) THEN + PDGGEA = 20 + ELSEIF ( I .EQ. 3112 ) THEN + PDGGEA = 21 + ELSEIF ( I .EQ. -3222 ) THEN + PDGGEA = 27 + ELSEIF ( I .EQ. -3212 ) THEN + PDGGEA = 28 + ELSEIF ( I .EQ. -3112 ) THEN + PDGGEA = 29 + +C . xi 0, xi -, antixi 0, antixi + + ELSEIF ( I .EQ. 3322 ) THEN + PDGGEA = 22 + ELSEIF ( I .EQ. 3312 ) THEN + PDGGEA = 23 + ELSEIF ( I .EQ. -3322 ) THEN + PDGGEA = 30 + ELSEIF ( I .EQ. -3312 ) THEN + PDGGEA = 31 + +C . omega, antiomega + ELSEIF ( I .EQ. 3334 ) THEN + PDGGEA = 24 + ELSEIF ( I .EQ. -3334 ) THEN + PDGGEA = 32 + +C . lambda C + + ELSEIF ( I .EQ. 4122 ) THEN + PDGGEA = 41 + + ENDIF + + RETURN + + + ENDIF + + RETURN + END + diff --git a/EMCAL/jetfinder/testJetFinder.C b/EMCAL/jetfinder/testJetFinder.C new file mode 100644 index 00000000000..c1338454322 --- /dev/null +++ b/EMCAL/jetfinder/testJetFinder.C @@ -0,0 +1,105 @@ +void testJetFinder(Int_t evNumber1=0, Int_t evNumber2=0) +{ +//*-- Author: Andreas Morsch (CERN) +// Dynamically link some shared libs + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("../macros/loadlibs.C"); + loadlibs(); + } +// Connect the Root Galice file containing Geometry, Kine and Hits + + TFile *file = (TFile*)gROOT->GetListOfFiles()->FindObject("galice.root"); + + + if (!file) { + printf("\n Creating galice.root \n"); + file = new TFile("galice.root", "update"); + } else { + printf("\n galice.root found in file list"); + } + +// Get AliRun object from file or create it if not on file + if (!gAlice) { + gAlice = (AliRun*)(file->Get("gAlice")); + if (gAlice) printf("AliRun object found on file\n"); + if (!gAlice) { + printf("\n create new gAlice object"); + gAlice = new AliRun("gAlice","Alice test program"); + } + } +// +// Create and configure jet finder + AliEMCALJetFinder* jetFinder = + new AliEMCALJetFinder("UA1 Jet Finder", "Test"); + jetFinder->SetDebug(1); + jetFinder->SetConeRadius(0.5); + jetFinder->SetEtSeed(4.); + jetFinder->SetMinJetEt(10.); + jetFinder->SetMinCellEt(1.); + jetFinder->SetPtCut(2.); +// jetFinder->SetMomentumSmearing(1); +// jetFinder->SetEfficiencySim(1); + jetFinder->SetHadronCorrection(0); +// jetFinder->SetHadronCorrector(AliEMCALHadronCorrectionv0::Instance()); + jetFinder->SetSamplingFraction(12.9); +// +// I/O + jetFinder->SetOutputFileName("jets.root"); +// +// Initialization + jetFinder->Init(); +// +// Loop over events +// + + Int_t nhit=0; + for (Int_t nev = evNumber1; nev<= evNumber2; nev++) { + file->cd(); + Int_t nparticles = gAlice->GetEvent(nev); + if (nev < evNumber1) continue; + if (nparticles <= 0) return; +// ECAL information + jetFinder->FillFromHits(); +// jetFinder->FillFromDigits(); +// TPC information + jetFinder->FillFromTracks(1, 0); +// ^ preserves info from hit + +// TPC information from Hits associated to the EMCAL +// jetFinder->FillFromHitFlaggedTracks(1); +// + jetFinder->Find(); + +// +// Look at results + printf("\n Test Jets: %d\n", jetFinder->Njets()); + Int_t njet = jetFinder->Njets(); + for (Int_t nj=0; njJetEnergy(nj)); + printf("\n Jet Phi %5d %8.2f %8.2f \n", + nj, jetFinder->JetPhiL(nj), jetFinder->JetPhiW(nj)); + printf("\n Jet Eta %5d %8.2f %8.2f \n", + nj, jetFinder->JetEtaL(nj), jetFinder->JetEtaW(nj)); + } +// TCanvas *c1 = new TCanvas("c1","Canvas 1",400,10,600,700); +// (jetFinder->GetLego())->Draw(); + } // event loop +} + + + + + + + + + + + + + + + + diff --git a/EMCAL/jetfinder/testJetFinderBg.C b/EMCAL/jetfinder/testJetFinderBg.C new file mode 100644 index 00000000000..ca7d4f40b25 --- /dev/null +++ b/EMCAL/jetfinder/testJetFinderBg.C @@ -0,0 +1,125 @@ +void testJetFinderBg(Int_t evNumber1=0, Int_t evNumber2=0) +{ +//*-- Author: Andreas Morsch (CERN) +// Dynamically link some shared libs + if (gClassTable->GetID("AliRun") < 0) { + gROOT->LoadMacro("../macros/loadlibs.C"); + loadlibs(); + } +// +// Create and configure JetFinder +// + AliEMCALJetFinder* jetFinder = + new AliEMCALJetFinder("UA1 Jet Finder", "Test"); +// +// Debug + jetFinder->SetDebug(1); +// +// Input and fast simulation + jetFinder->SetPtCut(2.); + jetFinder->SetIncludeK0andN(0); +// jetFinder->SetMomentumSmearing(1); +// jetFinder->SetEfficiencySim(1); + jetFinder->SetHadronCorrection(0); +// jetFinder->SetHadronCorrector(AliEMCALHadronCorrectionv0::Instance()); + jetFinder->SetSamplingFraction(12.9); +// +// Parameters for jet finding + jetFinder->SetConeRadius(0.5); + jetFinder->SetEtSeed(4.); + jetFinder->SetMinJetEt(10.); + jetFinder->SetMinCellEt(1.); + +//............. +// | +// | +// V +// This part will go into class +// +// Open background file +// +// + printf("\n Opening Background File !!\n"); + + TFile* fileB = new TFile("bg.root"); + gAlice = (AliRun*)(fileB->Get("gAlice")); + Int_t nparticles = gAlice->GetEvent(0); + // Read and save background event + jetFinder->FillFromHits(); + jetFinder->FillFromTracks(); + jetFinder->SaveBackgroundEvent(); + delete gAlice; + + +// +// Open signal file +// + printf("\n Opening Signal file !!\n"); + TFile* fileS = new TFile("galice.root", "update"); + gAlice = (AliRun*)(fileS->Get("gAlice")); + +// +// Loop over signal events +// + + Int_t nhit=0; + for (Int_t nev = evNumber1; nev<= evNumber2; nev++) { + Int_t nparticles = gAlice->GetEvent(nev); + if (nev < evNumber1) continue; + if (nparticles <= 0) return; +// Load background + jetFinder->InitFromBackground(); +// ECAL information + jetFinder->FillFromHits(1); +// ^ preserves info from background +// jetFinder->FillFromDigits(); +// TPC information + jetFinder->FillFromTracks(1, 0); +// ^ preserves info from hit + +// TPC information from Hits associated to the EMCAL +// jetFinder->FillFromHitFlaggedTracks(1); +// + jetFinder->Find(); + +// +// Look at results + printf("\n Test Jets: %d\n", jetFinder->Njets()); + Int_t njet = jetFinder->Njets(); + for (Int_t nj=0; njJetEnergy(nj)); + printf("\n Jet Phi %5d %8.2f %8.2f \n", + nj, jetFinder->JetPhiL(nj), jetFinder->JetPhiW(nj)); + printf("\n Jet Eta %5d %8.2f %8.2f \n", + nj, jetFinder->JetEtaL(nj), jetFinder->JetEtaW(nj)); + } +// TCanvas *c1 = new TCanvas("c1","Canvas 1",400,10,600,700); +// (jetFinder->GetLego())->Draw(); + } // event loop + +// ^ +// | +// | +// | +//............. + fileB->Close(); + fileS->Close(); +} + + + + + + + + + + + + + + + + -- 2.43.0