From 77414c9023a6645e4a65a299527b6cca3ddabc2b Mon Sep 17 00:00:00 2001 From: schutz Date: Thu, 17 Jul 2003 16:34:06 +0000 Subject: [PATCH] Introducing new class : AliPHOSGammaJet --- PHOS/AliPHOSGammaJet.cxx | 292 +++++++++++++++++++++++++++++++++++++++ PHOS/AliPHOSGammaJet.h | 38 +++++ PHOS/PHOSLinkDef.h | 1 + PHOS/libPHOS.pkg | 3 +- 4 files changed, 333 insertions(+), 1 deletion(-) create mode 100644 PHOS/AliPHOSGammaJet.cxx create mode 100644 PHOS/AliPHOSGammaJet.h diff --git a/PHOS/AliPHOSGammaJet.cxx b/PHOS/AliPHOSGammaJet.cxx new file mode 100644 index 00000000000..26eb861df7f --- /dev/null +++ b/PHOS/AliPHOSGammaJet.cxx @@ -0,0 +1,292 @@ +/************************************************************************** + * 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 the analysis of gamma-jet correlations +// +// +//*-- Author: Gustavo Conesa & Yves Schutz (IFIC, CERN) +////////////////////////////////////////////////////////////////////////////// + + +// --- ROOT system --- + +#include "TString.h" +#include "TFile.h" +#include "TLorentzVector.h" +#include "TList.h" +#include "TTree.h" +#include "TParticle.h" +#include "AliRun.h" +#include "AliPHOSGammaJet.h" +#include "AliPHOSGetter.h" + +ClassImp(AliPHOSGammaJet) + +//____________________________________________________________________________ +AliPHOSGammaJet::AliPHOSGammaJet() { + // ctor +} + +//____________________________________________________________________________ +AliPHOSGammaJet::AliPHOSGammaJet(const TString inputfilename) { + // ctor + AliPHOSGetter::Instance(inputfilename) ; +} + +//____________________________________________________________________________ +AliPHOSGammaJet::AliPHOSGammaJet(const AliPHOSGammaJet * gj) { +} + +//____________________________________________________________________________ +AliPHOSGammaJet::~AliPHOSGammaJet() { +} + +//____________________________________________________________________________ +void AliPHOSGammaJet::Exec(Option_t *option) +{ + // does the job + + AliPHOSGetter * gime = AliPHOSGetter::Instance() ; + Int_t nEvent1 = gime->MaxEvent() ; + Int_t iEvent = 0 ; + for ( iEvent = 0 ; iEvent < nEvent1 ; iEvent++) { + if (iEvent <= 100 || iEvent%10 == 0) + Info("Exec", "Event %d", iEvent) ; + TParticle * particle = 0 ; + //-----------------Fill list with particles-------------------- + TLorentzVector pPi0, pGamma1, pGamma2 ; + Double_t angle = 0 ; + TList particleList ; + Int_t n = -1; + gime->Event(iEvent, "X") ; + Int_t nparticles = gime->NPrimaries() ; + Int_t iParticle=0 ; + for (iParticle=0 ; iParticle < nparticles ; iParticle++) { + //Keep original partons + particle = gime->Primary(iParticle) ; + if((particle->GetStatusCode()== 21)){ + particleList.Add(particle); + n++; + } + //Keep Stable particles within eta range + Float_t etacut = 0. ; + if((particle->GetStatusCode() == 1)&& + (TMath::Abs(particle->Eta())GetPdgCode() != 111){ + particleList.Add(particle); + n++; + } + //Decay Pi0 and keep it with different status name + //Keep decay photons + if(particle->GetPdgCode() == 111) { + //cout<<"Pi0 "<Momentum(pPi0); + Pi0Decay(particle->GetMass(),pPi0,pGamma1,pGamma2,angle); + TParticle * photon1 = new TParticle(22,1,0,0,0,0,pGamma1.Px(),pGamma1.Py(), + pGamma1.Pz(),pGamma1.E(),0,0,0,0); + TParticle * photon2 = new TParticle(22,1,0,0,0,0,pGamma2.Px(),pGamma2.Py(), + pGamma2.Pz(),pGamma2.E(),0,0,0,0); + photon1->SetWeight(1); + photon2->SetWeight(2); + particle->SetStatusCode(2); + particleList.Add(particle); + particleList.Add(photon1); + particleList.Add(photon2); + //photon1->Print(); + //photon2->Print(); + }//if pi0 + }//final particle etacut + }//for (iParticle 2 photons + // p0 is pi0 4-momentum (input) + // p1 and p2 are photon 4-momenta (output) + // cout<<"Boost vector"<Rndm(); + Double_t cosThe = 2 * gRandom->Rndm() - 1; + Double_t cosPhi = TMath::Cos(phi); + Double_t sinPhi = TMath::Sin(phi); + Double_t sinThe = TMath::Sqrt(1-cosThe*cosThe); + Double_t ePi0 = mPi0/2.; + //cout<<"ePi0 "<GetStatusCode(); + Int_t iMother= particle->GetMother(0); + + if (ksCode == 21 && iMother == -1) + if(particle->GetPdgCode()==22){ + id_motherg = iPrimary; + //cout<<"idmother "<GetMother(0)){ + particle->Momentum(gamma); + id = iPrimary; + break; + } + }// kscode == 1 + }// while +} + +//____________________________________________________________________________ +void AliPHOSGammaJet::GetLeadingCharge(TList &particleList, TLorentzVector &charge, Int_t & id) +{ + TParticle *particle = 0x0; + + Int_t iPrimary=-1; + Double_t pt_max = 0, pt_i = 0; + TIter next(&particleList); + while ( (particle = (TParticle*)next()) ) { + iPrimary++; + Int_t ksCode = particle->GetStatusCode(); + + if((ksCode == 1)&&(id != iPrimary) + &&(particle->GetPDG(0)->Charge()!=0)){ + pt_i = particle->Pt(); + if(pt_i> pt_max){ + pt_max = pt_i; + particle->Momentum(charge); + }//pt_max + }// kscode == 1 + }// while +} + +//____________________________________________________________________________ +void AliPHOSGammaJet::GetLeadingPi0(TList &particleList, TLorentzVector &pi0, Int_t & id) +{ + TParticle *particle = 0x0; + + Int_t iPrimary=-1; + Double_t pt_max = 0, pt_i = 0; + TIter next(&particleList); + while ( (particle = (TParticle*)next()) ) { + iPrimary++; + Int_t ksCode = particle->GetStatusCode(); + + if((ksCode == 2)) + //&&(id != iPrimary)&&(particle->GetPdgCode() == 111)) + { + pt_i = particle->Pt(); + if(pt_i> pt_max){ + pt_max = pt_i; + particle->Momentum(pi0); + }//pt_max + }// kscode == 1 + }// while +} + +//____________________________________________________________________________ +void AliPHOSGammaJet::GetLeadingGammaPair(TList &particleList, TLorentzVector &gammapair, Int_t & id, + Double_t & thetacut,Double_t & ratiocut1, Double_t & ratiocut2, + Double_t & invmasscut1,Double_t & invmasscut2) +{ +// TParticle *particle = 0x0; + +// Int_t iPrimary=-1; +// Double_t El = 0, E12 = 0; +// TLorentzVector gamma_i,gamma_j; +// TIter next(&particleList); +// while ( (particle = (TParticle*)next()) ) { +// iPrimary++; +// Int_t ksCode = particle->GetStatusCode(); +// Int_t ksPdg = particle->GetPdgCode(); +// if((ksCode == 1) && (iPrimary != id) && (ksPdg == 22)){ +// particle->Momentum(gamma_i); +// Int_t jPrimary=-1; +// TIter next2(&particleList); +// while ( (particle = (TParticle*)next2()) ) { +// jPrimary++; +// if(jPrimary>iPrimary){ +// ksCode = particle->GetStatusCode(); +// ksPdg = particle->GetPdgCode(); +// if((ksCode == 1) && (iPrimary != id) && (ksPdg == 22)){ +// particle->Momentum(gamma_j); +// if(gamma_j.Angle(gamma_i.Vect())Fill(Eg,invmass); +// if((invmass>invmasscut1) && (invmassEl && (E12/Eg>ratiocut1) && (E12/EgEl && (E12/Eg>0.2 && E12/Eg<1.) +// }//(invmass>0.125) && (invmass<0.145) +// }//gamma_j.Angle(gamma_i.Vect())<0.04 +// }//(ksCode == 1) +// } +// }//while +// // cout<<"jPrimary "<