From: morsch Date: Fri, 27 Jan 2012 14:50:00 +0000 (+0000) Subject: Pair generator X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=67bfd92bb6bb7f4916259ebc5fdcc6aae01e84e9;p=u%2Fmrichter%2FAliRoot.git Pair generator Markus Koehler --- diff --git a/EVGEN/AliGenPairFlat.cxx b/EVGEN/AliGenPairFlat.cxx new file mode 100644 index 00000000000..ac801fd096f --- /dev/null +++ b/EVGEN/AliGenPairFlat.cxx @@ -0,0 +1,245 @@ +/************************************************************************** + * 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. * + **************************************************************************/ + + +// Generator for particle pairs in a preset +// kinematic range +// ranges can be set for invariant mass, pair pT, pair rapidity +// and pair azimuth + +// +// Comments and suggestions: markus.konrad.kohler@cern.ch +// + +#include "TPDGCode.h" +#include +#include "AliGenEventHeader.h" +#include "TF1.h" + +#include "AliGenPairFlat.h" + +ClassImp(AliGenPairFlat) + +//_____________________________________________________________________________ +AliGenPairFlat::AliGenPairFlat() + :AliGenerator(), + fPairNpart(10), + fPairYMin(-10.), + fPairYMax(10.), + fPairPhiMin(0.), + fPairPhiMax(TMath::TwoPi()), + fPairPtMin(0.001), + fPairPtMax(50.), + fPairMassMin(0.), + fPairMassMax(10.), + fLegPdg1(11), + fLegPdg2(-11), + fAlpha(0.), + fDebug(0) +{ + // + // Default constructor + // +} + +//_____________________________________________________________________________ +void AliGenPairFlat::Generate() +{ + // + // Generate a random pair of particles + // + + Float_t polar[3]= {0,0,0}; + Float_t origin[3]; + Float_t time; + + Float_t p[3]; + Int_t i, j, nt; + Double_t phi, y, mass, mt, e, pt; + Float_t weight = 1.; + Double_t pt1, pt2, y1, y2; + + TLorentzVector mother, dau1, dau2; + Float_t random[6]; + +// TF1* fPol = new TF1("fPol","1.+[0]*x*x",-1.,1.); + TF1 fPol("fPol","1.+[0]*x*x",-1.,1.); + fPol.SetParameter(0,fAlpha); + + + for (j=0;j<3;j++) origin[j]=fOrigin[j]; + time = fTimeOrigin; + if(fVertexSmear==kPerEvent) { + Vertex(); + for (j=0;j<3;j++) origin[j]=fVertex[j]; + time = fTime; + } + + printf("\n\n------------------GENERATOR SETTINGS------------------\n\n"); + printf("You choosed for the mother the Mass range %f - %f \n",fPairMassMin,fPairMassMax); + printf("You choosed for the mother the transverse Momentum range %f - %f \n",fPairPtMin,fPairPtMax); + printf("You choosed for the mother the Phi range %f - %f \n",fPairPhiMin,fPairPhiMax); + printf("The Particle will decay in (pdg) %i and %i\n \n",fLegPdg1, fLegPdg2); + printf("The rest Mass of first daughter (%s) is %f \n", + TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->GetTitle(), + TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->Mass()); + printf("The rest Mass of second daughter (%s) is %f \n", + TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->GetTitle(), + TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->Mass()); + printf("polarization factor is alpha == %lf \n",fAlpha); + printf("vertex is at x == %f || y == %f || z == %f \n",origin[0],origin[1],origin[2]); + printf("\n----------------------------------------------------------\n"); + + + for(i=0;iid=%+3d, p = (%+11.4e,%+11.4e,%+11.4e) GeV || pt = %+11.4e || weight=%+11.4e || E= %+11.4e\n",fLegPdg1,p[0],p[1],p[2],pt1,weight,e); + + //second daughter + p[0] = dau2.Px(); + p[1] = dau2.Py(); + p[2] = dau2.Pz(); + e = dau2.E(); + + if(fVertexSmear==kPerTrack) { + Rndm(random,6); + for (j=0;j<3;j++) { + origin[j]=fOrigin[j]+fOsigma[j]*TMath::Cos(2*random[2*j]*TMath::Pi())* + TMath::Sqrt(-2*TMath::Log(random[2*j+1])); + } + + Rndm(random,2); + time = fTimeOrigin + fOsigma[2]/TMath::Ccgs()* + TMath::Cos(2*random[0]*TMath::Pi())* + TMath::Sqrt(-2*TMath::Log(random[1])); + } + + PushTrack(fTrackIt,-1,fLegPdg2,p,origin,polar,time,kPPrimary,nt,weight); + if (fDebug == 2) printf("dau2-->id=%+3d, p = (%+11.4e,%+11.4e,%+11.4e) GeV || pt = %+11.4e || weight=%+11.4e || E= %+11.4e\n",fLegPdg2,p[0],p[1],p[2],pt2, weight,e); + + }//particle loop + +} + +//_____________________________________________________________________________ + +void AliGenPairFlat::Init() +{ + // + // Init + // + + printf("AliGenPairFlat::Init() not implemented!!!\n"); + +} + + +//_____________________________________________________________________________ + + +Bool_t AliGenPairFlat::Decay(TLorentzVector mother, TLorentzVector &dau1, TLorentzVector &dau2, TF1 polfactor) +{ + // + // decay procedure + // + + Double_t mp, md1, md2, ed1, ed2, pd1, pd2; + Double_t costheta, sintheta, phi; + + mp = mother.M(); + md1 = TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg1))->Mass(); + md2 = TDatabasePDG::Instance()->GetParticle(TMath::Abs(fLegPdg2))->Mass(); + + if(mp < md1+md2){ + printf("Daughters are heavier than Mother!! Check Kinematics!! \n"); + return 0; + } + + ed1 = (mp*mp + md1*md1 - md2*md2)/(2.*mp); + ed2 = mp-ed1; + pd1 = TMath::Sqrt((ed1+md1)*(ed1-md1)); + pd2 = TMath::Sqrt((mp*mp-(md1+md2)*(md1+md2))*(mp*mp -(md1-md2)*(md1-md2)))/(2.*mp); + + costheta = polfactor.GetRandom(); //polarization + sintheta = TMath::Sqrt((1.+costheta)*(1.-costheta)); + phi = 2.0*TMath::Pi()*gRandom->Rndm(); + + dau1.SetPxPyPzE(pd1*sintheta*TMath::Cos(phi), + pd1*sintheta*TMath::Sin(phi), + pd1*costheta, + ed1); + + dau2.SetPxPyPzE((-1.)*pd1*sintheta*TMath::Cos(phi), + (-1.)*pd1*sintheta*TMath::Sin(phi), + (-1.)*pd1*costheta, + ed2); + + TVector3 boost = mother.BoostVector(); + + dau1.Boost(boost); + dau2.Boost(boost); + + return 1; + +} + + + diff --git a/EVGEN/AliGenPairFlat.h b/EVGEN/AliGenPairFlat.h new file mode 100644 index 00000000000..2bd9abebba6 --- /dev/null +++ b/EVGEN/AliGenPairFlat.h @@ -0,0 +1,61 @@ +#ifndef ALIGENPAIRFLAT_H +#define ALIGENPAIRFLAT_H + + +// Generator for particle pairs in a preset +// kinematic range +// ranges can be set for invariant mass, pair pT, pair rapidity +// and pair azimuth + +// Comments and suggestions: markus.konrad.kohler@cern.ch + + +#include "AliGenerator.h" + +class TF1; + +class AliGenPairFlat : public AliGenerator +{ + public: + AliGenPairFlat(); + virtual ~AliGenPairFlat(){ } + virtual void Generate(); + virtual void Init(); + + virtual void SetPairNPart(Int_t npart) {fPairNpart=npart;} + virtual void SetPairYRange(Float_t Ymin, Float_t Ymax) + {fPairYMin = Ymin; fPairYMax = Ymax;} + virtual void SetPairPhiRange(Float_t phimin, Float_t phimax) + {fPairPhiMin = phimin; fPairPhiMax = phimax;} + virtual void SetPairPtRange(Float_t ptmin, Float_t ptmax) + {fPairPtMin = ptmin; fPairPtMax = ptmax;} + virtual void SetPairMassRange(Float_t massmin, Float_t massmax) + {fPairMassMin = massmin; fPairMassMax = massmax;} + virtual void SetLegPdg(Int_t pdg1, Int_t pdg2) + {fLegPdg1 = pdg1; fLegPdg2 = pdg2;} + virtual void SetPolarization(Float_t Alpha) + {fAlpha = Alpha;} + void SetDebug(Int_t debug) {fDebug=debug;} + +protected: + + Int_t fPairNpart; //Number of generated pairs + Float_t fPairYMin; // Minimum eta + Float_t fPairYMax; // Maximum eta + Float_t fPairPhiMin; // Minimum phi + Float_t fPairPhiMax; // Maximum phi + Float_t fPairPtMin; // Minimum pt + Float_t fPairPtMax; // Maximum pt + Float_t fPairMassMin; // Minimum mass + Float_t fPairMassMax; // Maximum mass + Int_t fLegPdg1; // pdg code of first daughter + Int_t fLegPdg2; // pdg code of second daughter + Float_t fAlpha; // Polarization factor + Int_t fDebug; // debug level + + Bool_t Decay(TLorentzVector mother, TLorentzVector &dau1, TLorentzVector &dau2 , TF1 fPol); + + ClassDef(AliGenPairFlat,1) // Flat random pair generator +}; + +#endif diff --git a/EVGEN/CMakelibEVGEN.pkg b/EVGEN/CMakelibEVGEN.pkg index c0604f0c364..5a96cb56d40 100644 --- a/EVGEN/CMakelibEVGEN.pkg +++ b/EVGEN/CMakelibEVGEN.pkg @@ -33,6 +33,7 @@ set ( SRCS AliGenFixed.cxx AliGenCocktail.cxx AliGenCocktailAfterBurner.cxx + AliGenPairFlat.cxx AliGenLib.cxx AliGenMUONlib.cxx AliGenHMPIDlib.cxx diff --git a/EVGEN/EVGENLinkDef.h b/EVGEN/EVGENLinkDef.h index 8b0400d994f..573e81ae5c8 100644 --- a/EVGEN/EVGENLinkDef.h +++ b/EVGEN/EVGENLinkDef.h @@ -19,6 +19,7 @@ #pragma link C++ class AliGenThetaSlice+; #pragma link C++ class AliGenParam+; #pragma link C++ class AliGenCocktail+; +#pragma link C++ class AliGenPairFlat+; #pragma link C++ class AliGenMUONCocktail+; #pragma link C++ class AliGenMUONCocktailpp+; #pragma link C++ class AliGenEMCocktail+;