]> git.uio.no Git - u/mrichter/AliRoot.git/blob - PYTHIA6/AliGenPythia.h
EPS09 added.
[u/mrichter/AliRoot.git] / PYTHIA6 / AliGenPythia.h
1 #ifndef ALIGENPYTHIA_H
2 #define ALIGENPYTHIA_H
3 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4  * See cxx source for full Copyright notice                               */
5
6
7 /* $Id$ */
8
9 //
10 // Generator using the TPythia interface (via AliPythia)
11 // to generate pp collisions.
12 // Using SetNuclei() also nuclear modifications to the structure functions
13 // can be taken into account. This makes, of course, only sense for the
14 // generation of the products of hard processes (heavy flavor, jets ...)
15 //
16 // andreas.morsch@cern.ch
17 //
18
19 #include "AliGenMC.h"
20 #include "AliPythia.h"
21
22 class AliPythia;
23 class TParticle;
24 class AliGenPythiaEventHeader;
25 class AliGenEventHeader;
26 class AliStack;
27 class AliRunLoader;
28 class TObjArray; 
29
30 class AliGenPythia : public AliGenMC
31 {
32  public:
33
34     typedef enum {kFlavorSelection, kParentSelection, kHeavyFlavor} StackFillOpt_t;
35     typedef enum {kCountAll, kCountParents, kCountTrackables} CountMode_t;
36     typedef enum {kCluster, kCell} JetRecMode_t;
37           
38     AliGenPythia();
39     AliGenPythia(Int_t npart);
40     virtual ~AliGenPythia();
41     virtual void    Generate();
42     virtual void    Init();
43     // Range of events to be printed
44     virtual void    SetEventListRange(Int_t eventFirst=-1, Int_t eventLast=-1);
45     // Select process type
46     virtual void    SetProcess(Process_t proc = kPyCharm) {fProcess = proc;}
47     virtual void    SetTune(Int_t itune) {fItune = itune;}
48
49     // Select structure function
50     virtual void    SetStrucFunc(StrucFunc_t func =  kCTEQ5L) {fStrucFunc = func;}
51     // Select pt of hard scattering 
52     virtual void    SetPtHard(Float_t ptmin = 0, Float_t ptmax = 1.e10)
53         {fPtHardMin = ptmin; fPtHardMax = ptmax; }
54     // y of hard scattering
55     virtual void    SetYHard(Float_t ymin = -1.e10, Float_t ymax = 1.e10)
56         {fYHardMin = ymin; fYHardMax = ymax; }
57     // Set initial and final state gluon radiation
58     virtual void    SetGluonRadiation(Int_t iIn, Int_t iFin)
59         {fGinit = iIn; fGfinal = iFin;}
60     // Intrinsic kT
61     virtual void    SetPtKick(Float_t kt = 1.)
62         {fPtKick = kt;}
63     // Use the Pythia 6.3 new multiple interations scenario
64     virtual void    UseNewMultipleInteractionsScenario() {fNewMIS = kTRUE;}
65     // Switch off heavy flavors
66     virtual void    SwitchHFOff() {fHFoff = kTRUE;}
67     // Set centre of mass energy
68     virtual void    SetEnergyCMS(Float_t energy = 5500) {fEnergyCMS = energy;}
69     // Treat protons as inside nuclei with mass numbers a1 and a2
70     virtual void    SetNuclei(Int_t a1, Int_t a2, Int_t pdfset = 0);
71     virtual void    SetNuclearPDF(Int_t pdf) {fNucPdf = pdf;}
72     //
73     // Trigger options
74     //
75     // Energy range for jet trigger
76     virtual void    SetJetEtRange(Float_t etmin = 0., Float_t etmax = 1.e4)
77         {fEtMinJet = etmin; fEtMaxJet = etmax;}
78     // Eta range for jet trigger
79     virtual void    SetJetEtaRange(Float_t etamin = -20., Float_t etamax = 20.)
80         {fEtaMinJet = etamin; fEtaMaxJet = etamax;}
81     // Phi range for jet trigger
82     virtual void    SetJetPhiRange(Float_t phimin = 0., Float_t phimax = 360.)
83         {fPhiMinJet = TMath::Pi()*phimin/180.; fPhiMaxJet = TMath::Pi()*phimax/180.;}
84     // Jet reconstruction mode; default is cone algorithm
85     virtual void    SetJetReconstructionMode(Int_t mode = kCell) {fJetReconstruction = mode;}
86     // Eta range for gamma trigger 
87     virtual void    SetGammaEtaRange(Float_t etamin = -20., Float_t etamax = 20.)
88         {fEtaMinGamma = etamin; fEtaMaxGamma = etamax;}
89     // Phi range for gamma trigger
90     virtual void    SetGammaPhiRange(Float_t phimin = 0., Float_t phimax = 360.)
91         {fPhiMinGamma = TMath::Pi()*phimin/180.; fPhiMaxGamma = TMath::Pi()*phimax/180.;}
92    // Select jets with fragmentation photon or pi0 going to PHOS or EMCAL
93     virtual void  SetFragPhotonInCalo(Bool_t b)  {fFragPhotonInCalo = b;}
94     virtual void  SetHadronInCalo    (Bool_t b)  {fHadronInCalo = b;}
95     virtual void  SetPi0InCalo       (Bool_t b)  {fPi0InCalo    = b;}
96     virtual void  SetPhotonInCalo(Bool_t b)      {fPhotonInCalo = b;}
97     virtual void  SetCheckPHOS (Bool_t b)        {fCheckPHOS    = b;}
98     virtual void  SetCheckEMCAL(Bool_t b)        {fCheckEMCAL   = b;}
99     virtual void  SetFragPhotonInEMCAL(Bool_t b) {fCheckEMCAL   = b; fFragPhotonInCalo = b;}
100     virtual void  SetFragPhotonInPHOS(Bool_t b)  {fCheckPHOS    = b; fFragPhotonInCalo = b;}
101     virtual void  SetHadronInEMCAL(Bool_t b)     {fCheckEMCAL   = b; fHadronInCalo     = b;}
102     virtual void  SetHadronInPHOS(Bool_t b)      {fCheckPHOS    = b; fHadronInCalo     = b;}
103     virtual void  SetPi0InEMCAL(Bool_t b)        {fCheckEMCAL   = b; fPi0InCalo        = b;}
104     virtual void  SetPi0InPHOS(Bool_t b)         {fCheckPHOS    = b; fPi0InCalo        = b;}
105     virtual void  SetPhotonInEMCAL(Bool_t b)     {fCheckEMCAL   = b; fPhotonInCalo     = b;}
106     virtual void  SetElectronInEMCAL(Bool_t b)   {fEleInEMCAL   = b;}
107     virtual void  SetPhotonInPHOS(Bool_t b)      {fCheckPHOS    = b; fPhotonInCalo     = b;}
108
109     // Trigger on a minimum multiplicity
110     virtual void  SetTriggerChargedMultiplicity(Int_t multiplicity, Float_t etamax = 0, Float_t ptmin = -1.) 
111     {fTriggerMultiplicity = multiplicity; fTriggerMultiplicityEta = etamax; 
112       fTriggerMultiplicityPtMin = ptmin;}
113         
114     // Calorimeters acceptance
115     // Set Phi in degrees, and Eta coverage, should not be negative
116     virtual void  SetEMCALAcceptance(Float_t phimin, Float_t phimax, Float_t deta) {fEMCALMinPhi = phimin ; fEMCALMaxPhi = phimax ; fEMCALEta = deta ; }
117     virtual void  SetPHOSAcceptance (Float_t phimin, Float_t phimax, Float_t deta) {fPHOSMinPhi  = phimin ; fPHOSMaxPhi  = phimax ; fPHOSEta  = deta ; }
118
119     virtual void  SetPhotonInPHOSeta(Bool_t b)        {fCheckPHOSeta = b; fPhotonInCalo     = b;}
120     virtual void  SetTriggerParticleMinPt(Float_t pt) {fTriggerParticleMinPt = pt;}
121     virtual void  SetPhotonMinPt(Float_t pt)          {fPhotonMinPt = pt;}
122     virtual void  SetElectronMinPt(Float_t pt)        {fElectronMinPt = pt;}
123     // Trigger and rotate event 
124     void RotatePhi(Int_t iphcand, Bool_t& okdd);
125     // Trigger on a single particle
126     virtual void    SetTriggerParticle(Int_t particle = 0, Float_t etamax = 0.9, Float_t ptmin = -1, Float_t ptmax = 1000) 
127         {fTriggerParticle = particle; fTriggerEta = etamax; fTriggerMinPt = ptmin; fTriggerMaxPt = ptmax;}
128
129     //
130     // Heavy flavor options
131     //
132     // Set option for feed down from higher family
133     virtual void SetFeedDownHigherFamily(Bool_t opt) {
134         fFeedDownOpt = opt;
135     }
136     // Set option for selecting particles kept in stack according to flavor
137     // or to parent selection
138     virtual void SetStackFillOpt(StackFillOpt_t opt) {
139         fStackFillOpt = opt;
140     }
141     // Set fragmentation option
142     virtual void SetFragmentation(Bool_t opt) {
143         fFragmentation = opt;
144     }
145     // Set counting mode
146     virtual void SetCountMode(CountMode_t mode) {
147         fCountMode = mode;
148     }
149     //
150     // Quenching
151     //
152     // Set quenching mode 0 = no, 1 = AM, 2 = IL,  3 = NA, 4 = ACS
153     virtual void SetQuench(Int_t flag = 0) {fQuench = flag;}
154     // Set transport coefficient.
155     void SetQhat(Float_t qhat) {fQhat = qhat;}
156     //Set initial medium length.
157     void SetLength(Float_t length) {fLength = length;}
158     //set parameters for pyquen afterburner
159     virtual void SetPyquenPar(Float_t t0=1., Float_t tau0=0.1, Int_t nf=0,Int_t iengl=0, Int_t iangl=3)
160     {fpyquenT = t0; fpyquenTau = tau0; fpyquenNf=nf;fpyquenEloss=iengl;fpyquenAngle=iangl;}
161     virtual void SetHadronisation(Int_t flag = 1) {fHadronisation = flag;}
162     virtual void SetPatchOmegaDalitz(Int_t flag = 1) {fPatchOmegaDalitz = flag;}
163     virtual void SetReadFromFile(const Text_t *filname) {fkFileName = filname;  fReadFromFile = 1;}    
164
165     //
166     // Pile-up
167     //
168     // Get interaction rate for pileup studies
169     virtual void    SetInteractionRate(Float_t rate,Float_t timewindow = 90.e-6);
170     virtual Float_t GetInteractionRate() const {return fInteractionRate;}
171     // get cross section of process
172     virtual Float_t GetXsection() const {return fXsection;}
173     // get triggered jets
174     void GetJets(Int_t& njets, Int_t& ntrig, Float_t jets[4][10]);
175     void RecJetsUA1(Int_t& njets, Float_t jets[4][50]);
176     void SetPycellParameters(Float_t etamax = 2., Int_t neta = 274, Int_t nphi = 432,
177                              Float_t thresh = 0., Float_t etseed = 4.,
178                              Float_t minet = 10., Float_t r = 1.);
179     
180   void LoadEvent(AliStack* stack, Int_t flag = 0, Int_t reHadr = 0);
181   void LoadEvent(const TObjArray* stack, Int_t flag = 0, Int_t reHadr = 0);
182     // Getters
183     virtual Process_t    GetProcess() const {return fProcess;}
184     virtual StrucFunc_t  GetStrucFunc() const {return fStrucFunc;}
185     virtual void         GetPtHard(Float_t& ptmin, Float_t& ptmax) const
186         {ptmin = fPtHardMin; ptmax = fPtHardMax;}
187     virtual void         GetNuclei(Int_t&  a1, Int_t& a2) const
188         {a1 = fAProjectile; a2 = fATarget;}
189     virtual void         GetJetEtRange(Float_t& etamin, Float_t& etamax) const
190         {etamin = fEtaMinJet; etamax = fEtaMaxJet;}
191     virtual void         GetJetPhiRange(Float_t& phimin, Float_t& phimax) const
192         {phimin = fPhiMinJet*180./TMath::Pi(); phimax = fPhiMaxJet*180/TMath::Pi();}
193     virtual void         GetGammaEtaRange(Float_t& etamin, Float_t& etamax) const
194         {etamin = fEtaMinGamma; etamax = fEtaMaxGamma;}
195     virtual void         GetGammaPhiRange(Float_t& phimin, Float_t& phimax) const
196         {phimin = fPhiMinGamma*180./TMath::Pi(); phimax = fPhiMaxGamma*180./TMath::Pi();}
197     //
198     Bool_t IsInEMCAL(Float_t phi, Float_t eta) const;
199     Bool_t IsInPHOS(Float_t phi, Float_t eta) const;
200     Bool_t IsFromHeavyFlavor(Int_t ipart);
201     //
202     virtual void FinishRun();
203     Bool_t CheckTrigger(const TParticle* jet1, const TParticle* jet2);
204     //Used in some processes to selected child properties
205     Bool_t CheckKinematicsOnChild();
206     void     GetSubEventTime();
207
208     void SetTuneForDiff(Bool_t a=kTRUE) {fkTuneForDiff=a;}
209     AliDecayer * GetDecayer(){return fDecayer;}
210
211  protected:
212     // adjust the weight from kinematic cuts
213     void     AdjustWeights() const;
214     Int_t    GenerateMB();
215     void     MakeHeader();    
216     void     GeneratePileup();
217     Process_t   fProcess;           //Process type
218     Int_t       fItune;             // Pythia tune > 6.4
219     StrucFunc_t fStrucFunc;         //Structure Function
220     Float_t     fKineBias;          //!Bias from kinematic selection
221     Int_t       fTrials;            //!Number of trials for current event
222     Int_t       fTrialsRun;         //!Number of trials for run
223     Float_t     fQ;                 //Mean Q
224     Float_t     fX1;                //Mean x1
225     Float_t     fX2;                //Mean x2
226     Float_t     fEventTime;         //Time of the subevent
227     Float_t     fInteractionRate;   //Interaction rate (set by user)
228     Float_t     fTimeWindow;        //Time window for pileup events (set by user)
229     Int_t       fCurSubEvent;       //Index of the current sub-event
230     TArrayF     *fEventsTime;       //Subevents time for pileup
231     Int_t       fNev;               //Number of events 
232     Int_t       fFlavorSelect;      //Heavy Flavor Selection
233     Float_t     fXsection;          //Cross-section
234     AliPythia   *fPythia;           //!Pythia 
235     Float_t     fPtHardMin;         //lower pT-hard cut 
236     Float_t     fPtHardMax;         //higher pT-hard cut
237     Float_t     fYHardMin;          //lower  y-hard cut 
238     Float_t     fYHardMax;          //higher y-hard cut
239     Int_t       fGinit;             //initial state gluon radiation
240     Int_t       fGfinal;            //final state gluon radiation
241     Int_t       fHadronisation;     //hadronisation
242     Bool_t      fPatchOmegaDalitz;  //flag for omega dalitz decay patch
243     Int_t       fNpartons;          //Number of partons before hadronisation
244     Int_t       fReadFromFile;      //read partons from file
245     Int_t       fQuench;            //Flag for quenching
246     Float_t     fQhat;              //Transport coefficient (GeV^2/fm)
247     Float_t     fLength;            //Medium length (fm)
248     Float_t     fpyquenT;           //Pyquen initial temperature 
249     Float_t     fpyquenTau;         //Pyquen initial proper time
250     Int_t       fpyquenNf;          //Pyquen number of flavours into the game
251     Int_t       fpyquenEloss;       //Pyquen type of energy loss 
252     Int_t       fpyquenAngle;       //Pyquen radiation angle for gluons
253     Float_t     fImpact;            //Impact parameter for quenching simulation (q-pythia) 
254     Float_t     fPtKick;            //Transverse momentum kick
255     Bool_t      fFullEvent;         //!Write Full event if true
256     AliDecayer  *fDecayer;          //!Pointer to the decayer instance
257     Int_t       fDebugEventFirst;   //!First event to debug
258     Int_t       fDebugEventLast;    //!Last  event to debug
259     Float_t     fEtMinJet;          //Minimum et of triggered Jet
260     Float_t     fEtMaxJet;          //Maximum et of triggered Jet
261     Float_t     fEtaMinJet;         //Minimum eta of triggered Jet
262     Float_t     fEtaMaxJet;         //Maximum eta of triggered Jet
263     Float_t     fPhiMinJet;         //Minimum phi of triggered Jet
264     Float_t     fPhiMaxJet;         //Maximum phi of triggered Jet
265     Int_t       fJetReconstruction; //Jet Reconstruction mode 
266     Float_t     fEtaMinGamma;       // Minimum eta of triggered gamma
267     Float_t     fEtaMaxGamma;       // Maximum eta of triggered gamma
268     Float_t     fPhiMinGamma;       // Minimum phi of triggered gamma
269     Float_t     fPhiMaxGamma;       // Maximum phi of triggered gamma
270     Float_t     fPycellEtaMax;      // Max. eta for Pycell 
271     Int_t       fPycellNEta;        // Number of eta bins for Pycell 
272     Int_t       fPycellNPhi;        // Number of phi bins for Pycell
273     Float_t     fPycellThreshold;   // Pycell threshold
274     Float_t     fPycellEtSeed;      // Pycell seed
275     Float_t     fPycellMinEtJet;    // Pycell min. jet et
276     Float_t     fPycellMaxRadius;   // Pycell cone radius
277     StackFillOpt_t fStackFillOpt;   // Stack filling with all particles with
278                                     // that flavour or only with selected
279                                     // parents and their decays
280     Bool_t fFeedDownOpt;            // Option to set feed down from higher
281                                     // quark families (e.g. b->c)
282     Bool_t  fFragmentation;         // Option to activate fragmentation by Pythia
283     Bool_t  fSetNuclei;             // Flag indicating that SetNuclei has been called
284     Bool_t  fNewMIS;                // Flag for the new multipple interactions scenario
285     Bool_t  fHFoff;                 // Flag for switching heafy flavor production off
286     Int_t   fNucPdf;                // Nuclear pdf 0: EKS98 1: EPS08
287     Int_t   fTriggerParticle;       // Trigger on this particle ...
288     Float_t fTriggerEta;            // .. within |eta| < fTriggerEta
289     Float_t fTriggerMinPt;          // .. within pt > fTriggerMinPt
290     Float_t fTriggerMaxPt;          // .. within pt < fTriggerMaxPt
291     Int_t       fTriggerMultiplicity;       // Trigger on events with a minimum charged multiplicity
292     Float_t     fTriggerMultiplicityEta;    // in a given eta range
293     Float_t     fTriggerMultiplicityPtMin;  // above this pT 
294     CountMode_t fCountMode;         // Options for counting when the event will be finished.     
295     // fCountMode = kCountAll         --> All particles that end up in the
296     //                                    stack are counted
297     // fCountMode = kCountParents     --> Only selected parents are counted
298     // fCountMode = kCountTrackabless --> Only particles flagged for tracking
299     //                                     are counted
300     //
301     //
302
303     AliGenPythiaEventHeader* fHeader;  //! Event header
304     AliRunLoader*            fRL;      //! Run Loader
305     const Text_t* fkFileName;          //! Name of file to read from
306
307
308     Bool_t fFragPhotonInCalo; // Option to ask for Fragmentation Photon in calorimeters acceptance
309     Bool_t fHadronInCalo;     // Option to ask for hadron (not pi0) in calorimeters acceptance
310     Bool_t fPi0InCalo;        // Option to ask for Pi0 in calorimeters acceptance
311     Bool_t fPhotonInCalo;     // Option to ask for Decay Photon in calorimeter acceptance
312     Bool_t fEleInEMCAL;       // Option to ask for Electron in EMCAL acceptance
313     Bool_t fCheckEMCAL;       // Option to ask for FragPhoton or Pi0 in calorimeters EMCAL acceptance
314     Bool_t fCheckPHOS;        // Option to ask for FragPhoton or Pi0 in calorimeters PHOS acceptance
315     Bool_t fCheckPHOSeta;     // Option to ask for PHOS eta acceptance
316     Float_t fTriggerParticleMinPt; // Minimum momentum of Fragmentation Photon or Pi0 or other hadron
317     Float_t fPhotonMinPt;          // Minimum momentum of Photon 
318     Float_t fElectronMinPt;        // Minimum momentum of Electron 
319     //Calorimeters eta-phi acceptance 
320     Float_t fPHOSMinPhi;           // Minimum phi PHOS, degrees
321     Float_t fPHOSMaxPhi;           // Maximum phi PHOS, degrees
322     Float_t fPHOSEta;              // Minimum eta PHOS, coverage delta eta
323     Float_t fEMCALMinPhi;          // Minimum phi EMCAL, degrees
324     Float_t fEMCALMaxPhi;          // Maximum phi EMCAL, degrees
325     Float_t fEMCALEta;             // Maximum eta EMCAL, coverage delta eta
326
327     Bool_t fkTuneForDiff;    // Pythia tune 
328     Int_t  fProcDiff;
329  private:
330     AliGenPythia(const AliGenPythia &Pythia);
331     AliGenPythia & operator=(const AliGenPythia & rhs);
332
333
334     Bool_t CheckDiffraction();
335     Bool_t GetWeightsDiffraction(Double_t M, Double_t &Mmin, Double_t &Mmax, 
336                                                Double_t &wSD, Double_t &wDD, Double_t &wND);
337
338     ClassDef(AliGenPythia, 13) // AliGenerator interface to Pythia
339 };
340 #endif
341
342
343
344
345