]>
Commit | Line | Data |
---|---|---|
e40b9538 | 1 | /************************************************************************** |
2 | * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | * * | |
4 | * Author: The ALICE Off-line Project. * | |
5 | * Contributors are mentioned in the code where appropriate. * | |
6 | * * | |
7 | * Permission to use, copy, modify and distribute this software and its * | |
8 | * documentation strictly for non-commercial purposes is hereby granted * | |
9 | * without fee, provided that the above copyright notice appears in all * | |
10 | * copies and that both the copyright notice and this permission notice * | |
11 | * appear in the supporting documentation. The authors make no claims * | |
12 | * about the suitability of this software for any purpose. It is * | |
13 | * provided "as is" without express or implied warranty. * | |
14 | **************************************************************************/ | |
15 | ||
16 | /* $Id: AliGenEMCocktail.cxx 40702 2010-04-26 13:09:52Z morsch $ */ | |
17 | ||
4ae1c9f0 | 18 | // Class to create the cocktail for physics with electrons, di-electrons, |
e40b9538 | 19 | // and photons from the decay of the following sources: |
20 | // pizero, eta, rho, omega, etaprime, phi | |
21 | // Kinematic distributions of the sources are taken from AliGenEMlib. | |
22 | // Decay channels can be selected via the method SetDecayMode. | |
23 | // Particles can be generated flat in pT with weights according to the | |
24 | // chosen pT distributions from AliGenEMlib (weighting mode: kNonAnalog), | |
25 | // or they are generated according to the pT distributions themselves | |
26 | // (weighting mode: kAnalog) | |
27 | ||
4ae1c9f0 | 28 | |
e40b9538 | 29 | #include <TObjArray.h> |
30 | #include <TParticle.h> | |
31 | #include <TF1.h> | |
32 | #include <TVirtualMC.h> | |
33 | #include <TPDGCode.h> | |
71443190 | 34 | #include <TDatabasePDG.h> |
e40b9538 | 35 | #include "AliGenCocktailEventHeader.h" |
36 | ||
37 | #include "AliGenCocktailEntry.h" | |
38 | #include "AliGenEMCocktail.h" | |
39 | #include "AliGenEMlib.h" | |
40 | #include "AliGenBox.h" | |
41 | #include "AliGenParam.h" | |
42 | #include "AliMC.h" | |
43 | #include "AliRun.h" | |
44 | #include "AliStack.h" | |
45 | #include "AliDecayer.h" | |
46 | #include "AliDecayerPythia.h" | |
47 | #include "AliLog.h" | |
48 | #include "AliGenCorrHF.h" | |
49 | ||
50 | ClassImp(AliGenEMCocktail) | |
51 | ||
52 | //________________________________________________________________________ | |
53 | AliGenEMCocktail::AliGenEMCocktail() | |
4ae1c9f0 | 54 | :AliGenCocktail(), |
e40b9538 | 55 | fDecayer(0), |
56 | fDecayMode(kAll), | |
57 | fWeightingMode(kNonAnalog), | |
58 | fNPart(1000), | |
4ae1c9f0 | 59 | fYieldArray(), |
60 | fPtSelect(0), | |
61 | fCentrality(0), | |
62 | fV2Systematic(0), | |
63 | fForceConv(kFALSE), | |
6a8b015a | 64 | fSelectedParticles(kGenHadrons) |
e40b9538 | 65 | { |
4ae1c9f0 | 66 | // Constructor |
e40b9538 | 67 | |
68 | } | |
69 | ||
70 | //_________________________________________________________________________ | |
71 | AliGenEMCocktail::~AliGenEMCocktail() | |
72 | { | |
4ae1c9f0 | 73 | // Destructor |
e40b9538 | 74 | |
75 | } | |
76 | ||
77 | //_________________________________________________________________________ | |
78 | void AliGenEMCocktail::CreateCocktail() | |
79 | { | |
4ae1c9f0 | 80 | // create and add sources to the cocktail |
e40b9538 | 81 | |
82 | fDecayer->SetForceDecay(fDecayMode); | |
83 | fDecayer->ForceDecay(); | |
84 | ||
4ae1c9f0 | 85 | // Set kinematic limits |
e40b9538 | 86 | Double_t ptMin = fPtMin; |
87 | Double_t ptMax = fPtMax; | |
88 | Double_t yMin = fYMin;; | |
89 | Double_t yMax = fYMax;; | |
90 | Double_t phiMin = fPhiMin*180./TMath::Pi(); | |
91 | Double_t phiMax = fPhiMax*180./TMath::Pi(); | |
92 | AliInfo(Form("Ranges pT:%4.1f : %4.1f GeV/c, y:%4.2f : %4.2f, Phi:%5.1f : %5.1f degres",ptMin,ptMax,yMin,yMax,phiMin,phiMax)); | |
93 | AliInfo(Form("the parametrised sources uses the decay mode %d",fDecayMode)); | |
94 | ||
4ae1c9f0 | 95 | //Initialize user selection for Pt Parameterization and centrality: |
96 | AliGenEMlib::SelectParams(fPtSelect,fCentrality,fV2Systematic); | |
97 | ||
98 | // Create and add electron sources to the generator | |
4ae1c9f0 | 99 | // pizero |
6a8b015a | 100 | if(fSelectedParticles&kGenPizero){ |
4ae1c9f0 | 101 | AliGenParam *genpizero=0; |
e40b9538 | 102 | Char_t namePizero[10]; |
4ae1c9f0 | 103 | snprintf(namePizero,10,"Pizero"); |
71443190 | 104 | genpizero = new AliGenParam(fNPart/0.925, new AliGenEMlib(), AliGenEMlib::kPizero, "DUMMY"); |
105 | genpizero->SetYRange(fYMin/0.925, fYMax/0.925); | |
e40b9538 | 106 | AddSource2Generator(namePizero,genpizero); |
107 | TF1 *fPtPizero = genpizero->GetPt(); | |
faf00b0d | 108 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) |
6a8b015a | 109 | fYieldArray[kPizero] = fPtPizero->Integral(fPtMin,fPtMax,1.e-6); |
faf00b0d | 110 | #else |
6a8b015a | 111 | fYieldArray[kPizero] = fPtPizero->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
faf00b0d | 112 | #endif |
6a8b015a | 113 | } |
4ae1c9f0 | 114 | |
115 | // eta | |
6a8b015a | 116 | if(fSelectedParticles&kGenEta){ |
4ae1c9f0 | 117 | AliGenParam *geneta=0; |
e40b9538 | 118 | Char_t nameEta[10]; |
4ae1c9f0 | 119 | snprintf(nameEta,10,"Eta"); |
71443190 | 120 | geneta = new AliGenParam(fNPart/0.825, new AliGenEMlib(), AliGenEMlib::kEta, "DUMMY"); |
121 | geneta->SetYRange(fYMin/0.825, fYMax/0.825); | |
e40b9538 | 122 | AddSource2Generator(nameEta,geneta); |
123 | TF1 *fPtEta = geneta->GetPt(); | |
4ae1c9f0 | 124 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) |
6a8b015a | 125 | fYieldArray[kEta] = fPtEta->Integral(fPtMin,fPtMax,1.e-6); |
4ae1c9f0 | 126 | #else |
6a8b015a | 127 | fYieldArray[kEta] = fPtEta->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
faf00b0d | 128 | #endif |
6a8b015a | 129 | } |
4ae1c9f0 | 130 | |
131 | // rho | |
6a8b015a | 132 | if(fSelectedParticles&kGenRho){ |
4ae1c9f0 | 133 | AliGenParam *genrho=0; |
e40b9538 | 134 | Char_t nameRho[10]; |
4ae1c9f0 | 135 | snprintf(nameRho,10,"Rho"); |
71443190 | 136 | genrho = new AliGenParam(fNPart/0.775, new AliGenEMlib(), AliGenEMlib::kRho, "DUMMY"); |
137 | genrho->SetYRange(fYMin/0.775, fYMax/0.775); | |
e40b9538 | 138 | AddSource2Generator(nameRho,genrho); |
139 | TF1 *fPtRho = genrho->GetPt(); | |
faf00b0d | 140 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) |
6a8b015a | 141 | fYieldArray[kRho] = fPtRho->Integral(fPtMin,fPtMax,1.e-6); |
faf00b0d | 142 | #else |
6a8b015a | 143 | fYieldArray[kRho] = fPtRho->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
faf00b0d | 144 | #endif |
6a8b015a | 145 | } |
4ae1c9f0 | 146 | |
147 | // omega | |
6a8b015a | 148 | if(fSelectedParticles&kGenOmega){ |
4ae1c9f0 | 149 | AliGenParam *genomega=0; |
e40b9538 | 150 | Char_t nameOmega[10]; |
4ae1c9f0 | 151 | snprintf(nameOmega,10,"Omega"); |
71443190 | 152 | genomega = new AliGenParam(fNPart/0.775, new AliGenEMlib(), AliGenEMlib::kOmega, "DUMMY"); |
153 | genomega->SetYRange(fYMin/0.775, fYMax/0.775); | |
e40b9538 | 154 | AddSource2Generator(nameOmega,genomega); |
155 | TF1 *fPtOmega = genomega->GetPt(); | |
faf00b0d | 156 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) |
6a8b015a | 157 | fYieldArray[kOmega] = fPtOmega->Integral(fPtMin,fPtMax,1.e-6); |
faf00b0d | 158 | #else |
6a8b015a | 159 | fYieldArray[kOmega] = fPtOmega->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
faf00b0d | 160 | #endif |
6a8b015a | 161 | } |
4ae1c9f0 | 162 | |
163 | // etaprime | |
6a8b015a | 164 | if(fSelectedParticles&kGenEtaprime){ |
4ae1c9f0 | 165 | AliGenParam *genetaprime=0; |
e40b9538 | 166 | Char_t nameEtaprime[10]; |
4ae1c9f0 | 167 | snprintf(nameEtaprime,10,"Etaprime"); |
71443190 | 168 | genetaprime = new AliGenParam(fNPart/0.725, new AliGenEMlib(), AliGenEMlib::kEtaprime, "DUMMY"); |
169 | genetaprime->SetYRange(fYMin/0.725, fYMax/0.725); | |
e40b9538 | 170 | AddSource2Generator(nameEtaprime,genetaprime); |
171 | TF1 *fPtEtaprime = genetaprime->GetPt(); | |
faf00b0d | 172 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) |
6a8b015a | 173 | fYieldArray[kEtaprime] = fPtEtaprime->Integral(fPtMin,fPtMax,1.e-6); |
faf00b0d | 174 | #else |
6a8b015a | 175 | fYieldArray[kEtaprime] = fPtEtaprime->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
faf00b0d | 176 | #endif |
6a8b015a | 177 | } |
4ae1c9f0 | 178 | |
179 | // phi | |
6a8b015a | 180 | if(fSelectedParticles&kGenPhi){ |
4ae1c9f0 | 181 | AliGenParam *genphi=0; |
e40b9538 | 182 | Char_t namePhi[10]; |
4ae1c9f0 | 183 | snprintf(namePhi,10,"Phi"); |
71443190 | 184 | genphi = new AliGenParam(fNPart/0.725, new AliGenEMlib(), AliGenEMlib::kPhi, "DUMMY"); |
185 | genphi->SetYRange(fYMin/0.725, fYMax/0.725); | |
e40b9538 | 186 | AddSource2Generator(namePhi,genphi); |
187 | TF1 *fPtPhi = genphi->GetPt(); | |
faf00b0d | 188 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) |
6a8b015a | 189 | fYieldArray[kPhi] = fPtPhi->Integral(fPtMin,fPtMax,1.e-6); |
faf00b0d | 190 | #else |
6a8b015a | 191 | fYieldArray[kPhi] = fPtPhi->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
faf00b0d | 192 | #endif |
6a8b015a | 193 | } |
4ae1c9f0 | 194 | |
195 | // jpsi | |
6a8b015a | 196 | if(fSelectedParticles&kGenJpsi){ |
4ae1c9f0 | 197 | AliGenParam *genjpsi=0; |
198 | Char_t nameJpsi[10]; | |
199 | snprintf(nameJpsi,10,"Jpsi"); | |
71443190 | 200 | genjpsi = new AliGenParam(fNPart/0.525, new AliGenEMlib(), AliGenEMlib::kJpsi, "DUMMY"); |
201 | genjpsi->SetYRange(fYMin/0.525, fYMax/0.525); | |
4ae1c9f0 | 202 | AddSource2Generator(nameJpsi,genjpsi); |
203 | TF1 *fPtJpsi = genjpsi->GetPt(); | |
204 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) | |
6a8b015a | 205 | fYieldArray[kJpsi] = fPtJpsi->Integral(fPtMin,fPtMax,1.e-6); |
4ae1c9f0 | 206 | #else |
6a8b015a | 207 | fYieldArray[kJpsi] = fPtJpsi->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
71443190 | 208 | #endif |
6a8b015a | 209 | } |
71443190 | 210 | |
6a8b015a | 211 | // direct gamma |
212 | if(fDecayMode!=kGammaEM) return; | |
213 | if(fSelectedParticles&kGenDirectRealGamma){ | |
214 | AliGenParam *genDirectRealG=0; | |
215 | Char_t nameDirectRealG[10]; | |
216 | snprintf(nameDirectRealG,10,"DirectRealGamma"); | |
217 | genDirectRealG = new AliGenParam(fNPart, new AliGenEMlib(), AliGenEMlib::kDirectRealGamma, "DUMMY"); | |
218 | genDirectRealG->SetYRange(fYMin, fYMax); | |
219 | AddSource2Generator(nameDirectRealG,genDirectRealG); | |
220 | TF1 *fPtDirectRealG = genDirectRealG->GetPt(); | |
71443190 | 221 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) |
6a8b015a | 222 | fYieldArray[kDirectRealGamma] = fPtDirectRealG->Integral(fPtMin,fPtMax,1.e-6); |
71443190 | 223 | #else |
6a8b015a | 224 | fYieldArray[kDirectRealGamma] = fPtDirectRealG->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
71443190 | 225 | #endif |
6a8b015a | 226 | } |
71443190 | 227 | |
6a8b015a | 228 | if(fSelectedParticles&kGenDirectVirtGamma){ |
229 | TDatabasePDG::Instance()->AddParticle("DirectVirtGamma","DirectVirtGamma",0,true,0,0,"GaugeBoson",220000); | |
230 | AliGenParam *genDirectVirtG=0; | |
231 | Char_t nameDirectVirtG[10]; | |
232 | snprintf(nameDirectVirtG,10,"DirectVirtGamma"); | |
233 | genDirectVirtG = new AliGenParam(fNPart/0.775, new AliGenEMlib(), AliGenEMlib::kDirectVirtGamma, "DUMMY"); | |
234 | genDirectVirtG->SetYRange(fYMin/0.775, fYMax/0.775); | |
235 | AddSource2Generator(nameDirectVirtG,genDirectVirtG); | |
236 | TF1 *fPtDirectVirtG = genDirectVirtG->GetPt(); | |
71443190 | 237 | #if ROOT_VERSION_CODE >= ROOT_VERSION(5,99,0) |
6a8b015a | 238 | fYieldArray[kDirectVirtGamma] = fPtDirectVirtG->Integral(fPtMin,fPtMax,1.e-6); |
71443190 | 239 | #else |
6a8b015a | 240 | fYieldArray[kDirectVirtGamma] = fPtDirectVirtG->Integral(fPtMin,fPtMax,(Double_t *)0,1.e-6); |
71443190 | 241 | #endif |
242 | } | |
e40b9538 | 243 | } |
244 | ||
245 | //------------------------------------------------------------------- | |
246 | void AliGenEMCocktail::AddSource2Generator(Char_t* nameSource, | |
247 | AliGenParam* const genSource) | |
248 | { | |
249 | // add sources to the cocktail | |
250 | Double_t phiMin = fPhiMin*180./TMath::Pi(); | |
251 | Double_t phiMax = fPhiMax*180./TMath::Pi(); | |
252 | ||
253 | genSource->SetPtRange(fPtMin, fPtMax); | |
e40b9538 | 254 | genSource->SetPhiRange(phiMin, phiMax); |
255 | genSource->SetWeighting(fWeightingMode); | |
4ae1c9f0 | 256 | genSource->SetForceGammaConversion(fForceConv); |
e40b9538 | 257 | if (!gMC) genSource->SetDecayer(fDecayer); |
258 | genSource->Init(); | |
259 | ||
260 | AddGenerator(genSource,nameSource,1.); // Adding Generator | |
261 | } | |
262 | ||
263 | //------------------------------------------------------------------- | |
264 | void AliGenEMCocktail::Init() | |
265 | { | |
4ae1c9f0 | 266 | // Initialisation |
e40b9538 | 267 | TIter next(fEntries); |
268 | AliGenCocktailEntry *entry; | |
269 | if (fStack) { | |
270 | while((entry = (AliGenCocktailEntry*)next())) { | |
271 | entry->Generator()->SetStack(fStack); | |
272 | } | |
273 | } | |
274 | } | |
275 | ||
276 | //_________________________________________________________________________ | |
277 | void AliGenEMCocktail::Generate() | |
278 | { | |
4ae1c9f0 | 279 | // Generate event |
e40b9538 | 280 | TIter next(fEntries); |
281 | AliGenCocktailEntry *entry = 0; | |
282 | AliGenCocktailEntry *preventry = 0; | |
283 | AliGenerator* gen = 0; | |
284 | ||
285 | if (fHeader) delete fHeader; | |
286 | fHeader = new AliGenCocktailEventHeader("Electromagnetic Cocktail Header"); | |
287 | ||
288 | const TObjArray *partArray = gAlice->GetMCApp()->Particles(); | |
289 | ||
4ae1c9f0 | 290 | // Generate the vertex position used by all generators |
e40b9538 | 291 | if(fVertexSmear == kPerEvent) Vertex(); |
292 | ||
4ae1c9f0 | 293 | //Reseting stack |
e40b9538 | 294 | AliRunLoader * runloader = AliRunLoader::Instance(); |
295 | if (runloader) | |
296 | if (runloader->Stack()) | |
297 | runloader->Stack()->Clean(); | |
298 | ||
4ae1c9f0 | 299 | // Loop over generators and generate events |
e40b9538 | 300 | Int_t igen = 0; |
6078e216 | 301 | Float_t evPlane; |
302 | Rndm(&evPlane,1); | |
303 | evPlane*=TMath::Pi()*2; | |
e40b9538 | 304 | while((entry = (AliGenCocktailEntry*)next())) { |
305 | gen = entry->Generator(); | |
e40b9538 | 306 | gen->SetVertex(fVertex.At(0), fVertex.At(1), fVertex.At(2)); |
307 | ||
308 | if (fNPart > 0) { | |
309 | igen++; | |
310 | if (igen == 1) entry->SetFirst(0); | |
311 | else entry->SetFirst((partArray->GetEntriesFast())+1); | |
6078e216 | 312 | gen->SetEventPlane(evPlane); |
e40b9538 | 313 | gen->Generate(); |
314 | entry->SetLast(partArray->GetEntriesFast()); | |
315 | preventry = entry; | |
316 | } | |
317 | } | |
318 | next.Reset(); | |
319 | ||
4ae1c9f0 | 320 | // Setting weights for proper absolute normalization |
e40b9538 | 321 | Int_t iPart, iMother; |
322 | Int_t pdgMother = 0; | |
323 | Double_t weight = 0.; | |
324 | Double_t dNdy = 0.; | |
325 | Int_t maxPart = partArray->GetEntriesFast(); | |
326 | for(iPart=0; iPart<maxPart; iPart++){ | |
327 | TParticle *part = gAlice->GetMCApp()->Particle(iPart); | |
328 | iMother = part->GetFirstMother(); | |
329 | TParticle *mother = 0; | |
330 | if (iMother>=0){ | |
331 | mother = gAlice->GetMCApp()->Particle(iMother); | |
332 | pdgMother = mother->GetPdgCode(); | |
333 | } | |
334 | else | |
335 | pdgMother = part->GetPdgCode(); | |
71443190 | 336 | |
e40b9538 | 337 | switch (pdgMother){ |
338 | case 111: | |
6a8b015a | 339 | dNdy = fYieldArray[kPizero]; |
e40b9538 | 340 | break; |
341 | case 221: | |
6a8b015a | 342 | dNdy = fYieldArray[kEta]; |
e40b9538 | 343 | break; |
344 | case 113: | |
6a8b015a | 345 | dNdy = fYieldArray[kRho]; |
e40b9538 | 346 | break; |
347 | case 223: | |
6a8b015a | 348 | dNdy = fYieldArray[kOmega]; |
e40b9538 | 349 | break; |
350 | case 331: | |
6a8b015a | 351 | dNdy = fYieldArray[kEtaprime]; |
e40b9538 | 352 | break; |
353 | case 333: | |
6a8b015a | 354 | dNdy = fYieldArray[kPhi]; |
e40b9538 | 355 | break; |
4ae1c9f0 | 356 | case 443: |
6a8b015a | 357 | dNdy = fYieldArray[kJpsi]; |
358 | break; | |
359 | case 22: | |
360 | dNdy = fYieldArray[kDirectRealGamma]; | |
4ae1c9f0 | 361 | break; |
6a8b015a | 362 | case 220000: |
363 | dNdy = fYieldArray[kDirectVirtGamma]; | |
364 | break; | |
365 | ||
e40b9538 | 366 | default: |
367 | dNdy = 0.; | |
368 | } | |
71443190 | 369 | |
e40b9538 | 370 | weight = dNdy*part->GetWeight(); |
371 | part->SetWeight(weight); | |
372 | } | |
373 | ||
374 | fHeader->SetNProduced(maxPart); | |
375 | ||
376 | ||
377 | TArrayF eventVertex; | |
378 | eventVertex.Set(3); | |
379 | for (Int_t j=0; j < 3; j++) eventVertex[j] = fVertex[j]; | |
380 | ||
381 | fHeader->SetPrimaryVertex(eventVertex); | |
382 | ||
383 | gAlice->SetGenEventHeader(fHeader); | |
384 | } |