1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
6 // Implementation of the interface for THBTprocessor
7 // Author: Piotr Krzysztof Skowronski <Piotr.Skowronski@cern.ch>
9 // 27.09.2001 Piotr Skowronski
10 // removing of redefinition of defaults velues
11 // in method's implementation.
14 #include "AliGenHBTprocessor.h"
20 #include "TParticle.h"
21 #include "AliGenCocktailAfterBurner.h"
25 const Int_t AliGenHBTprocessor::fgkHBTPMAXPART = 100000;
27 ClassImp(AliGenHBTprocessor)
29 //Wrapper class for "hbt processor" after burner
30 //The origibal code is written in fortran by Lanny Ray
31 //and is put in the directory $ALICE_ROOT/HBTprocessor
32 //Detailed description is on the top of the file hbt_event_processor.f
34 //This class can be used ONLY with AliGenCocktailAfterBurner wrapper generator
37 // AliGenCocktailAfterBurner = gener = new AliGenCocktailAfterBurner();
38 // gener->SetPhiRange(0, 360); //Set global parameters
39 // gener->SetThetaRange(35., 145.);
40 // AliGenHIJINGpara *hijing = new AliGenHIJINGpara(10000); //Add some generator
41 // hijing->SetMomentumRange(0, 999);
42 // gener->AddGenerator(hijing,"HIJING PARAMETRIZATION",1);
44 // AliGenHBTprocessor *hbtp = new AliGenHBTprocessor(); //create object
45 // hbtp->SetRefControl(2); //set parameters
46 // hbtp->SetSwitch1D(1);
47 // hbtp->SetR0(6);//fm - radius
48 // hbtp->SetLambda(0.7);//chaocity parameter
49 // gener->AddAfterBurner(hbtp,"HBT PROCESSOR",1); //add to the main generator
54 // A) HBT PROCESSOR NEEDS MORE THAN ONE EVENT TO WORK
55 // AS MORE AS IT BETTER WORKS
56 // B) IT IS ABLE TO "ADD" CORRELATIONS ONLY UP TO TWO PARTICLE TYPES AT ONES
59 AliGenCocktailAfterBurner* GetGenerator();
60 /*******************************************************************/
62 AliGenHBTprocessor::AliGenHBTprocessor() : AliGenerator(-1)
65 // Standard constructor
66 // Sets default veues of all parameters
67 SetName("AliGenHBTprocessor");
68 SetTitle("AliGenHBTprocessor");
71 fHBTprocessor = new THBTprocessor();
76 SetTrackRejectionFactor();
112 SetNBins1DFineMesh();
113 SetBinSize1DFineMesh();
114 SetNBins1DCoarseMesh();
115 SetBinSize1DCoarseMesh();
116 SetNBins3DFineMesh();
117 SetBinSize3DFineMesh();
118 SetNBins3DCoarseMesh();
119 SetBinSize3DCoarseMesh();
120 SetNBins3DFineProjectMesh();
123 /*******************************************************************/
126 /*******************************************************************/
128 AliGenHBTprocessor::~AliGenHBTprocessor()
132 if (fHBTprocessor) delete fHBTprocessor; //delete generator
136 /*******************************************************************/
138 void AliGenHBTprocessor::InitStatusCodes()
140 //creates and inits status codes array to zero
141 AliGenCocktailAfterBurner *cab = GetGenerator();
143 if(!cab) Fatal("AliGenHBTprocessor::InitStatusCodes()","Can not find AliGenCocktailAfterBurner generator");
145 Int_t nev = cab->GetNumberOfEvents();
147 fHbtPStatCodes = new Int_t* [nev];
148 for( Int_t i =0; i<nev;i++)
150 Int_t nprim = cab->GetStack(i)->GetNprimary();
151 fHbtPStatCodes[i] = new Int_t[nprim];
152 for (Int_t k =0 ;k<nprim;k++)
153 fHbtPStatCodes[i][k] =0;
158 /*******************************************************************/
160 void AliGenHBTprocessor::CleanStatusCodes()
161 {//Cleans up status codes
164 for (Int_t i =0; i<GetGenerator()->GetNumberOfEvents(); i++)
165 delete [] fHbtPStatCodes[i];
166 delete fHbtPStatCodes;
171 /*******************************************************************/
173 void AliGenHBTprocessor::Init()
175 //sets up parameters in generator
176 THBTprocessor *thbtp = fHBTprocessor;
178 thbtp->SetTrackRejectionFactor(fTrackRejectionFactor);
179 thbtp->SetRefControl(fReferenceControl);
181 if ((fPid[0] == fPid[1]) || (fPid[0] == 0) || (fPid[1] == 0))
184 thbtp->SetPIDs(IdFromPDG(fPid[1]) ,0);
186 thbtp->SetPIDs(IdFromPDG(fPid[0]) ,0);
187 thbtp->SetNPIDtypes(1);
189 if (fSwitch_type !=1)
190 Warning("AliGenHBTprocessor::Init","\nThere is only one particle type set,\n\
191 and Switch_Type differnt then 1,\n which does not make sense.\n\
192 Setting it to 1.\n");
198 thbtp->SetPIDs(IdFromPDG(fPid[0]) ,IdFromPDG(fPid[1]));
200 thbtp->SetSwitchType(fSwitch_type);
203 thbtp->SetMaxIterations(fMaxit);
204 thbtp->SetDelChi(fDelchi);
205 thbtp->SetIRand(fIrand);
206 thbtp->SetLambda(fLambda);
207 thbtp->SetR1d(fR_1d);
208 thbtp->SetRSide(fRside);
209 thbtp->SetROut(fRout);
210 thbtp->SetRLong(fRlong);
211 thbtp->SetRPerp(fRperp);
212 thbtp->SetRParallel(fRparallel);
215 thbtp->SetSwitch1D(fSwitch_1d);
216 thbtp->SetSwitch3D(fSwitch_3d);
217 thbtp->SetSwitchType(fSwitch_type);
218 thbtp->SetSwitchCoherence(fSwitch_coherence);
219 thbtp->SetSwitchCoulomb(fSwitch_coulomb);
220 thbtp->SetSwitchFermiBose(fSwitch_fermi_bose);
221 thbtp->SetPtRange(fPtMin,fPtMax);
222 thbtp->SetPxRange(fPx_min,fPx_max);
223 thbtp->SetPyRange(fPy_min,fPy_max);
224 thbtp->SetPzRange(fPz_min,fPz_max);
225 thbtp->SetPhiRange(fPhiMin*180/TMath::Pi(),fPhiMax*180/TMath::Pi());
226 // cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
227 // cout<<fPhiMin<<fPhiMax<<endl;
228 // cout<<"@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n";
229 thbtp->SetEtaRange(fEta_min,fEta_max);
230 thbtp->SetNPtBins(fN_pt_bins);
231 thbtp->SetNPhiBins(fN_phi_bins);
232 thbtp->SetNEtaBins(fN_eta_bins);
233 thbtp->SetNPxBins(fN_px_bins);
234 thbtp->SetNPyBins(fN_py_bins);
235 thbtp->SetNPzBins(fN_pz_bins);
236 thbtp->SetNBins1DFineMesh(fN_1d_fine);
237 thbtp->SetBinSize1DFineMesh(fBinsize_1d_fine);
238 thbtp->SetNBins1DCoarseMesh(fN_1d_coarse);
239 thbtp->SetBinSize1DCoarseMesh(fBinsize_1d_coarse);
240 thbtp->SetNBins3DFineMesh(fN_3d_fine);
241 thbtp->SetBinSize3DFineMesh(fBinsize_3d_fine);
242 thbtp->SetNBins3DCoarseMesh(fN_3d_coarse);
243 thbtp->SetBinSize3DCoarseMesh(fBinsize_3d_coarse);
244 thbtp->SetNBins3DFineProjectMesh(fN_3d_fine_project);
247 /*******************************************************************/
249 void AliGenHBTprocessor::Generate()
253 if (gAlice->GetEventsPerRun() <2)
255 Fatal("AliGenHBTprocessor::Generate()",
256 "HBT Processor needs more than 1 event to work properly,\
257 but there is only %d set", gAlice->GetEventsPerRun());
260 InitStatusCodes(); //Init status codes
262 fHBTprocessor->GenerateEvent(); //Generates event
264 CleanStatusCodes(); //Clean Status codes - thet are not needed anymore
267 /*******************************************************************/
270 /*******************************************************************/
271 void AliGenHBTprocessor::GetParticles(TClonesArray * particles)
275 cout<<"Particles has to be initialized"<<endl;
278 fHBTprocessor->ImportParticles(particles);
281 /*******************************************************************/
283 Int_t AliGenHBTprocessor::GetHbtPStatusCode(Int_t part) const
285 //returns the status code of the given particle in the active event
286 //see SetActiveEvent in the bottom of AliGenHBTprocessor.cxx
287 //and in AliCocktailAfterBurner
288 Int_t ActiveEvent = GetGenerator()->GetActiveEventNumber();
289 return fHbtPStatCodes[ActiveEvent][part];
292 /*******************************************************************/
293 void AliGenHBTprocessor::SetHbtPStatusCode(Int_t hbtstatcode, Int_t part)
295 //Sets the given status code to given particle number (part) in the active event
296 Int_t ActiveEvent = GetGenerator()->GetActiveEventNumber();
297 fHbtPStatCodes[ActiveEvent][part] = hbtstatcode;
300 /*******************************************************************/
302 void AliGenHBTprocessor::SetTrackRejectionFactor(Float_t trf) //def 1.0
304 //Sets the Track Rejection Factor
305 //variates in range 0.0 <-> 1.0
306 //Describes the factor of particles rejected from the output.
307 //Used only in case of low muliplicity particles e.g. lambdas.
308 //Processor generates addisional particles and builds the
309 //correletions on such a statistics.
310 //At the end these particels are left in the event according
311 //to this factor: 1==all particles are left
312 // 0==all are removed
314 fTrackRejectionFactor=trf;
315 fHBTprocessor->SetTrackRejectionFactor(trf);
317 /*******************************************************************/
319 void AliGenHBTprocessor::SetRefControl(Int_t rc) //default 2
321 //Sets the Refernce Control Switch
322 //switch wether read reference histograms from file =1
323 // compute from input events =2 - default
324 fReferenceControl=rc;
325 fHBTprocessor->SetRefControl(rc);
327 /*******************************************************************/
329 void AliGenHBTprocessor::SetPIDs(Int_t pid1,Int_t pid2)
332 //Sets PDG Codes of particles to be processed, default \\Pi^{+} and \\Pi^{-}
333 //This method accepts PDG codes which is
334 //in opposite to THBBProcessor which accepts GEANT PID
335 if ( (pid1 == 0) && (pid2 == 0) )
337 Error("AliGenHBTprocessor::SetPIDs","Sensless Particle Types setting: 0 0, Ignoring\n");
345 fHBTprocessor->SetPIDs(IdFromPDG(pid1) ,0);
351 fHBTprocessor->SetPIDs(IdFromPDG(pid1) ,IdFromPDG(pid2));
355 /*******************************************************************/
357 void AliGenHBTprocessor::SetNPIDtypes(Int_t npidt)
359 //Number ofparticle types to be processed - default 2
360 //see AliGenHBTprocessor::SetPIDs
363 fHBTprocessor->SetNPIDtypes(npidt);
365 /*******************************************************************/
367 void AliGenHBTprocessor::SetDeltap(Float_t deltp)
370 //maximum range for random momentum shifts in GeV/c;
371 //px,py,pz independent; Default = 0.1 GeV/c.
373 fHBTprocessor->SetDeltap(deltp);
375 /*******************************************************************/
377 void AliGenHBTprocessor::SetMaxIterations(Int_t maxiter)
379 //maximum # allowed iterations thru all the
380 //tracks for each event. Default = 50.
381 //If maxit=0, then calculate the correlations
382 //for the input set of events without doing the
383 //track adjustment procedure.
386 fHBTprocessor->SetMaxIterations(maxiter);
389 /*******************************************************************/
390 void AliGenHBTprocessor::SetDelChi(Float_t dc)
392 //min % change in total chi-square for which
393 //the track adjustment iterations may stop,
397 fHBTprocessor->SetDelChi(dc);
399 /*******************************************************************/
401 void AliGenHBTprocessor::SetIRand(Int_t irnd)
403 //if fact dummy - used only for compatibility
404 //we are using AliRoot built in RNG
405 //dummy in fact since we are using aliroot build-in RNG
406 //Sets renaodom number generator
408 fHBTprocessor->SetIRand(irnd);
410 /*******************************************************************/
412 void AliGenHBTprocessor::SetLambda(Float_t lam)
415 // Sets Chaoticity Parameter
417 fHBTprocessor->SetLambda(lam);
419 /*******************************************************************/
420 void AliGenHBTprocessor::SetR1d(Float_t r)
423 //Sets Spherical source model radius (fm)
425 fHBTprocessor->SetR1d(r);
427 /*******************************************************************/
428 void AliGenHBTprocessor::SetRSide(Float_t rs)
431 //Rside,Rout,Rlong = Non-spherical Bertsch-Pratt source model (fm)
434 fHBTprocessor->SetRSide(rs);
436 /*******************************************************************/
437 void AliGenHBTprocessor::SetROut(Float_t ro)
440 //Rside,Rout,Rlong = Non-spherical Bertsch-Pratt source model (fm)
442 fHBTprocessor->SetROut(ro);
444 /*******************************************************************/
445 void AliGenHBTprocessor::SetRLong(Float_t rl)
448 //Rside,Rout,Rlong = Non-spherical Bertsch-Pratt source model (fm)
450 fHBTprocessor->SetRLong(rl);
452 /*******************************************************************/
453 void AliGenHBTprocessor::SetRPerp(Float_t rp)
456 //Rperp,Rparallel,R0= Non-spherical Yano-Koonin-Podgoretski source model (fm).
458 fHBTprocessor->SetRPerp(rp);
460 /*******************************************************************/
461 void AliGenHBTprocessor::SetRParallel(Float_t rprl)
464 //Rperp,Rparallel,R0= Non-spherical Yano-Koonin-Podgoretski source model (fm).
466 fHBTprocessor->SetRParallel(rprl);
468 /*******************************************************************/
469 void AliGenHBTprocessor::SetR0(Float_t r0)
472 //Rperp,Rparallel,R0= Non-spherical Yano-Koonin-Podgoretski source model (fm).
474 fHBTprocessor->SetR0(r0);
476 /*******************************************************************/
477 void AliGenHBTprocessor::SetQ0(Float_t q0)
480 //Sets Q0 = NA35 Coulomb parameter for finite source size in (GeV/c)
481 // if fSwitchCoulomb = 2
482 // = Spherical Coulomb source radius in (fm)
483 // if switch_coulomb = 3, used to interpolate the
484 // input Pratt/Cramer discrete Coulomb source
487 fHBTprocessor->SetQ0(q0);
490 /*******************************************************************/
491 void AliGenHBTprocessor::SetSwitch1D(Int_t s1d)
495 // = 0 to not compute the 3D two-body correlations.
496 // = 1 to compute this using the side-out-long form
497 // = 2 to compute this using the Yanno-Koonin-Pogoredskij form.
500 fHBTprocessor->SetSwitch1D(s1d);
502 /*******************************************************************/
503 void AliGenHBTprocessor::SetSwitch3D(Int_t s3d)
507 // = 0 to not compute the 1D two-body //orrelations.
508 // = 1 to compute this using Q-invariant
509 // = 2 to compute this using Q-total
510 // = 3 to compute this using Q-3-ve//tor
513 fHBTprocessor->SetSwitch3D(s3d);
515 /*******************************************************************/
516 void AliGenHBTprocessor::SetSwitchType(Int_t st)
519 // Sets switch_type = 1 to fit only the like pair correlations
520 // = 2 to fit only the unlike pair correlations
521 // = 3 to fit both the like and unlike pair correl.
522 //See SetPIDs and Init
523 //If only one particle type is set, unly==1 makes sens
526 fHBTprocessor->SetSwitchType(st);
528 /*******************************************************************/
529 void AliGenHBTprocessor::SetSwitchCoherence(Int_t sc)
532 // switch_coherence = 0 for purely incoherent source (but can have
534 // = 1 for mixed incoherent and coherent source
536 fSwitch_coherence = sc;
537 fHBTprocessor->SetSwitchCoherence(sc);
539 /*******************************************************************/
540 void AliGenHBTprocessor::SetSwitchCoulomb(Int_t scol)
543 // switch_coulomb = 0 no Coulomb correction
544 // = 1 Point source Gamow correction only
545 // = 2 NA35 finite source size correction
546 // = 3 Pratt/Cramer finite source size correction;
547 // interpolated from input tables.
548 fSwitch_coulomb =scol;
549 fHBTprocessor->SetSwitchCoulomb(scol);
551 /*******************************************************************/
552 void AliGenHBTprocessor::SetSwitchFermiBose(Int_t sfb)
555 // switch_fermi_bose = 1 Boson pairs
556 // = -1 Fermion pairs
558 fSwitch_fermi_bose = sfb;
559 fHBTprocessor->SetSwitchFermiBose(sfb);
561 /*******************************************************************/
562 void AliGenHBTprocessor::SetPtRange(Float_t ptmin, Float_t ptmax)
564 // default ptmin = 0.1, ptmax = 0.98
565 //Sets Pt range (GeV)
566 AliGenerator::SetPtRange(ptmin,ptmax);
567 fHBTprocessor->SetPtRange(ptmin,ptmax);
570 /*******************************************************************/
571 void AliGenHBTprocessor::SetPxRange(Float_t pxmin, Float_t pxmax)
573 //default pxmin = -1.0, pxmax = 1.0
577 fHBTprocessor->SetPxRange(pxmin,pxmax);
579 /*******************************************************************/
580 void AliGenHBTprocessor::SetPyRange(Float_t pymin, Float_t pymax)
582 //default pymin = -1.0, pymax = 1.0
586 fHBTprocessor->SetPyRange(pymin,pymax);
588 /*******************************************************************/
589 void AliGenHBTprocessor::SetPzRange(Float_t pzmin, Float_t pzmax)
591 //default pzmin = -3.6, pzmax = 3.6
595 fHBTprocessor->SetPzRange(pzmin,pzmax);
597 void AliGenHBTprocessor::SetMomentumRange(Float_t pmin, Float_t pmax)
599 //default pmin=0, pmax=0
600 //Do not use this method!
601 MayNotUse("AliGenHBTprocessor::SetMomentumRange Method is Dummy");
604 /*******************************************************************/
605 void AliGenHBTprocessor::SetPhiRange(Float_t phimin, Float_t phimax)
609 AliGenerator::SetPhiRange(phimin,phimax);
611 fHBTprocessor->SetPhiRange(phimin,phimax);
613 /*******************************************************************/
614 void AliGenHBTprocessor::SetEtaRange(Float_t etamin, Float_t etamax)
616 //default etamin = -1.5, etamax = 1.5
620 fHBTprocessor->SetEtaRange(etamin,etamax);
622 /*******************************************************************/
623 void AliGenHBTprocessor::SetNPtBins(Int_t nptbin)
625 //default nptbin = 50
626 //set number of Pt bins
628 fHBTprocessor->SetNPtBins(nptbin);
630 /*******************************************************************/
631 void AliGenHBTprocessor::SetNPhiBins(Int_t nphibin)
633 //default nphibin = 50
634 //set number of Phi bins
636 fHBTprocessor->SetNPhiBins(nphibin);
638 /*******************************************************************/
639 void AliGenHBTprocessor::SetNEtaBins(Int_t netabin)
641 //default netabin = 50
642 //set number of Eta bins
643 fN_eta_bins = netabin;
644 fHBTprocessor->SetNEtaBins(netabin);
646 /*******************************************************************/
647 void AliGenHBTprocessor::SetNPxBins(Int_t npxbin)
649 //default npxbin = 20
650 //set number of Px bins
652 fHBTprocessor->SetNPxBins(npxbin);
654 /*******************************************************************/
655 void AliGenHBTprocessor::SetNPyBins(Int_t npybin)
657 //default npybin = 20
658 //set number of Py bins
660 fHBTprocessor->SetNPyBins(npybin);
662 /*******************************************************************/
663 void AliGenHBTprocessor::SetNPzBins(Int_t npzbin)
665 //default npzbin = 70
666 //set number of Pz bins
668 fHBTprocessor->SetNPzBins(npzbin);
670 /*******************************************************************/
671 void AliGenHBTprocessor::SetNBins1DFineMesh(Int_t n)
674 //Sets the number of bins in the 1D mesh
676 fHBTprocessor->SetNBins1DFineMesh(n);
679 /*******************************************************************/
680 void AliGenHBTprocessor::SetBinSize1DFineMesh(Float_t x)
683 //Sets the bin size in the 1D mesh
684 fBinsize_1d_fine = x;
685 fHBTprocessor->SetBinSize1DFineMesh(x);
687 /*******************************************************************/
689 void AliGenHBTprocessor::SetNBins1DCoarseMesh(Int_t n)
692 //Sets the number of bins in the coarse 1D mesh
694 fHBTprocessor->SetNBins1DCoarseMesh(n);
696 /*******************************************************************/
697 void AliGenHBTprocessor::SetBinSize1DCoarseMesh(Float_t x)
700 //Sets the bin size in the coarse 1D mesh
701 fBinsize_1d_coarse =x;
702 fHBTprocessor->SetBinSize1DCoarseMesh(x);
704 /*******************************************************************/
706 void AliGenHBTprocessor::SetNBins3DFineMesh(Int_t n)
709 //Sets the number of bins in the 3D mesh
711 fHBTprocessor->SetNBins3DFineMesh(n);
713 /*******************************************************************/
714 void AliGenHBTprocessor::SetBinSize3DFineMesh(Float_t x)
717 //Sets the bin size in the 3D mesh
719 fHBTprocessor->SetBinSize3DFineMesh(x);
721 /*******************************************************************/
723 void AliGenHBTprocessor::SetNBins3DCoarseMesh(Int_t n)
726 //Sets the number of bins in the coarse 3D mesh
729 fHBTprocessor->SetNBins3DCoarseMesh(n);
731 /*******************************************************************/
732 void AliGenHBTprocessor::SetBinSize3DCoarseMesh(Float_t x)
735 //Sets the bin size in the coarse 3D mesh
736 fBinsize_3d_coarse = x;
737 fHBTprocessor->SetBinSize3DCoarseMesh(x);
739 /*******************************************************************/
741 void AliGenHBTprocessor::SetNBins3DFineProjectMesh(Int_t n )
744 //Sets the number of bins in the fine project mesh
745 fN_3d_fine_project = n;
746 fHBTprocessor->SetNBins3DFineProjectMesh(n);
748 /*******************************************************************/
751 /*******************************************************************/
758 void AliGenHBTprocessor::DefineParticles()
761 // Load standard numbers for GEANT particles and PDG conversion
762 fNPDGCodes = 0; //this is done in the constructor - but in any case ...
764 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
765 fPDGCode[fNPDGCodes++]=22; // 1 = photon
766 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
767 fPDGCode[fNPDGCodes++]=11; // 3 = electron
768 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
769 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
770 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
771 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
772 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
773 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
774 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
775 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
776 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
777 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
778 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
779 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
780 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
781 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
782 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
783 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
784 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
785 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
786 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
787 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
788 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
789 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
790 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
791 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
792 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
793 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
794 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
795 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
796 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
799 /*******************************************************************/
800 Int_t AliGenHBTprocessor::IdFromPDG(Int_t pdg) const
803 // Return Geant3 code from PDG and pseudo ENDF code
805 for(Int_t i=0;i<fNPDGCodes;++i)
806 if(pdg==fPDGCode[i]) return i;
809 Int_t AliGenHBTprocessor::PDGFromId(Int_t id) const
812 // Return PDG code and pseudo ENDF code from Geant3 code
814 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
817 /*******************************************************************/
818 /****** ROUTINES USED FOR COMMUNUCATION ********/
819 /******************** WITH FORTRAN ********************/
820 /*******************************************************************/
823 # define hbtpran hbtpran_
824 # define alihbtp_puttrack alihbtp_puttrack_
825 # define alihbtp_gettrack alihbtp_gettrack_
826 # define alihbtp_getnumberevents alihbtp_getnumberevents_
827 # define alihbtp_getnumbertracks alihbtp_getnumbertracks_
828 # define alihbtp_initialize alihbtp_initialize_
829 # define alihbtp_setactiveeventnumber alihbtp_setactiveeventnumber_
830 # define alihbtp_setparameters alihbtp_setparameters_
831 # define type_of_call
834 # define hbtpran HBTPRAN
835 # define alihbtp_puttrack ALIHBTP_PUTTRACK
836 # define alihbtp_gettrack ALIHBTP_GETTRACK
837 # define alihbtp_getnumberevents ALIHBTP_GETNUMBEREVENTS
838 # define alihbtp_getnumbertracks ALIHBTP_GETNUMBERTRACKS
839 # define alihbtp_initialize ALIHBTP_INITIALIZE
840 # define alihbtp_setactiveeventnumber ALIHBTP_SETACTIVEEVENTNUMBER
841 # define alihbtp_setparameters ALIHBTP_SETPARAMETERS
842 # define type_of_call _stdcall
845 #include "AliGenCocktailAfterBurner.h"
847 /*******************************************************************/
849 AliGenCocktailAfterBurner* GetGenerator()
851 // This function has two tasks:
852 // Check if environment is OK (exist gAlice and generator)
853 // Returns pointer to genrator
854 //to be changed with TFolders
858 cout<<endl<<"ERROR: There is NO gALICE! Check what you are doing!"<<endl;
859 gAlice->Fatal("AliGenHBTprocessor.cxx: alihbtp_getnumofev()",
860 "\nRunning HBT Processor without gAlice... Exiting \n");
863 AliGenerator * gen = gAlice->Generator();
867 gAlice->Fatal("AliGenHBTprocessor.cxx: GetGenerator()",
868 "\nThere is no generator in gAlice, exiting\n");
872 const Char_t *genname = gen->GetName();
874 strcpy(name,"AliGenCocktailAfterBurner");
876 if (strcmp(name,genname))
878 gAlice->Fatal("AliGenHBTprocessor.cxx: GetGenerator()",
879 "\nThe main Generator is not a AliGenCocktailAfterBurner, exiting\n");
883 AliGenCocktailAfterBurner* CAB= (AliGenCocktailAfterBurner*) gen;
885 // cout<<endl<<"Got generator"<<endl;
889 /*******************************************************************/
891 AliGenHBTprocessor* GetAliGenHBTprocessor()
893 //returns pointer to the current instance of AliGenHBTprocessor in
894 //AliGenCocktailAfterBurner (can be more than one)
896 AliGenCocktailAfterBurner* gen = GetGenerator();
897 AliGenerator * g = gen->GetCurrentGenerator();
899 const Char_t *genname = g->GetName();
901 strcpy(name,"AliGenHBTprocessor");
903 if (strcmp(name,genname))
905 gAlice->Fatal("AliGenHBTprocessor.cxx: GetAliGenHBTprocessor()",
906 "\nCurrernt generator in AliGenCocktailAfterBurner is not a AliGenHBTprocessor, exiting\n");
910 AliGenHBTprocessor* hbtp = (AliGenHBTprocessor*)g;
914 /*******************************************************************/
915 extern "C" void type_of_call alihbtp_setparameters()
920 extern "C" void type_of_call alihbtp_initialize()
925 /*******************************************************************/
927 extern "C" void type_of_call alihbtp_getnumberevents(Int_t &nev)
929 //passes number of events to the fortran
930 if(gDebug) cout<<"alihbtp_getnumberevents("<<nev<<") ....";
931 AliGenCocktailAfterBurner* gen = GetGenerator();
938 nev = gen->GetNumberOfEvents();
940 if(gDebug>5) cout<<"EXITED N Ev = "<<nev<<endl;
944 /*******************************************************************/
946 extern "C" void type_of_call alihbtp_setactiveeventnumber(Int_t & nev)
948 //sets active event in generator (AliGenCocktailAfterBurner)
950 if(gDebug>5) cout<<"alihbtp_setactiveeventnumber("<<nev<<") ....";
951 if(gDebug>0) cout<<"Asked for event "<<nev-1<<endl;
952 AliGenCocktailAfterBurner* gen = GetGenerator();
954 gen->SetActiveEventNumber(nev - 1); //fortran numerates events from 1 to N
956 if(gDebug>5) cout<<"EXITED returned "<<nev<<endl;
959 /*******************************************************************/
961 extern "C" void type_of_call alihbtp_getnumbertracks(Int_t &ntracks)
963 //passes number of particles in active event to the fortran
964 if(gDebug>5) cout<<"alihbtp_getnumbertracks("<<ntracks<<") ....";
966 AliGenCocktailAfterBurner* gen = GetGenerator();
973 ntracks = gen->GetActiveStack()->GetNprimary();
974 if(gDebug>5) cout<<"EXITED Ntracks = "<<ntracks<<endl;
977 /*******************************************************************/
979 extern "C" void type_of_call
980 alihbtp_puttrack(Int_t & n,Int_t& flag, Float_t& px,
981 Float_t& py, Float_t& pz, Int_t& geantpid)
983 //sets new parameters (momenta) in track number n
984 // in the active event
985 // n - number of the track in active event
986 // flag - flag of the track
987 // px,py,pz - momenta
988 // geantpid - type of the particle - Geant Particle ID
990 if(gDebug>5) cout<<"alihbtp_puttrack("<<n<<") ....";
992 AliGenCocktailAfterBurner* gen = GetGenerator();
995 TParticle * track = gen->GetActiveStack()->Particle(n-1);
997 AliGenHBTprocessor* g = GetAliGenHBTprocessor();
999 //check to be deleted
1000 if (geantpid != (g->IdFromPDG( track->GetPdgCode() )))
1002 cout<<endl<<" AliGenHBTprocessor.cxx: alihbtp_puttrack: SOMETHING IS GOING BAD:\n GEANTPIDS ARE NOT THE SAME"<<endl;
1006 if (px != track->Px())
1007 cout<<"Px diff. = "<<px - track->Px()<<endl;
1009 if(gDebug>3) cout<<" track->GetPdgCode() --> "<<track->GetPdgCode()<<endl;
1013 Float_t m = track->GetMass();
1014 Float_t E = TMath::Sqrt(m*m+px*px+py*py+pz*pz);
1015 track->SetMomentum(px,py,pz,E);
1017 g->SetHbtPStatusCode(flag,n-1);
1019 if(gDebug>5) cout<<"EXITED "<<endl;
1022 /*******************************************************************/
1024 extern "C" void type_of_call
1025 alihbtp_gettrack(Int_t & n,Int_t & flag, Float_t & px,
1026 Float_t & py, Float_t & pz, Int_t & geantpid)
1029 //passes track parameters to the fortran
1030 // n - number of the track in active event
1031 // flag - flag of the track
1032 // px,py,pz - momenta
1033 // geantpid - type of the particle - Geant Particle ID
1035 if(gDebug>5) cout<<"alihbtp_gettrack("<<n<<") ....";
1036 AliGenCocktailAfterBurner* gen = GetGenerator();
1047 TParticle * track = gen->GetActiveStack()->Particle(n-1);
1048 AliGenHBTprocessor* g = GetAliGenHBTprocessor();
1050 flag = g->GetHbtPStatusCode(n-1);
1052 px = (Float_t)track->Px();
1053 py = (Float_t)track->Py();
1054 pz = (Float_t)track->Pz();
1056 geantpid = g->IdFromPDG( track->GetPdgCode() );
1058 if(gDebug>5) cout<<"EXITED "<<endl;
1061 /*******************************************************************/
1062 extern "C" Float_t type_of_call hbtpran(Int_t &)
1064 //interface to the random number generator
1065 return sRandom->Rndm();
1068 /*******************************************************************/
1071 /*******************************************************************/