1 /* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
2 * See cxx source for full Copyright notice */
3 // Implementation of the interface for THBTprocessor
4 // Author: Piotr Krzysztof Skowronski <Piotr.Skowronski@cern.ch>
5 //////////////////////////////////////////////////////////////////////////////////
6 //Wrapper class for "hbt processor" after burner
7 //The origibal code is written in fortran by Lanny Ray
8 //and is put in the directory $ALICE_ROOT/HBTprocessor
9 //Detailed description is on the top of the file hbt_event_processor.f
11 //This class can be used ONLY with AliGenCocktailAfterBurner wrapper generator
14 // AliGenCocktailAfterBurner = gener = new AliGenCocktailAfterBurner();
15 // gener->SetPhiRange(0, 360); //Set global parameters
16 // gener->SetThetaRange(35., 145.);
17 // AliGenHIJINGpara *hijing = new AliGenHIJINGpara(10000); //Add some generator
18 // hijing->SetMomentumRange(0, 999);
19 // gener->AddGenerator(hijing,"HIJING PARAMETRIZATION",1);
21 // AliGenHBTprocessor *hbtp = new AliGenHBTprocessor(); //create object
22 // hbtp->SetRefControl(2); //set parameters
23 // hbtp->SetSwitch1D(1);
24 // hbtp->SetR0(6);//fm - radius
25 // hbtp->SetLambda(0.7);//chaocity parameter
26 // gener->AddAfterBurner(hbtp,"HBT PROCESSOR",1); //add to the main generator
31 // A) HBT PROCESSOR NEEDS MORE THAN ONE EVENT TO WORK
32 // AS MORE AS IT BETTER WORKS
33 // B) IT IS ABLE TO "ADD" CORRELATIONS ONLY UP TO TWO PARTICLE TYPES AT ONES
34 //////////////////////////////////////////////////////////////////////////////////
36 // 11.11.2001 Piotr Skowronski
37 // Setting seed (date) in RNG in the constructor
39 // 09.10.2001 Piotr Skowronski
41 // Theta - Eta cohernecy facilities added:
42 // AliGenerator::SetThetaRange method overriden
43 // Static methods added
49 // Class description comments put on proper place
51 // 27.09.2001 Piotr Skowronski
52 // removing of redefinition of defaults velues
53 // in method's implementation.
57 #include "AliGenHBTprocessor.h"
59 #include <Riostream.h>
64 #include "TParticle.h"
65 #include "THBTprocessor.h"
66 #include "AliGenCocktailAfterBurner.h"
70 ClassImp(AliGenHBTprocessor)
74 AliGenCocktailAfterBurner* GetGenerator();
75 /*******************************************************************/
76 AliGenHBTprocessor::AliGenHBTprocessor(const AliGenHBTprocessor& in)
79 // AliGenHBTprocessor::AliGenHBTprocessor();
82 AliGenHBTprocessor::AliGenHBTprocessor() : AliGenerator()
85 // Standard constructor
86 // Sets default veues of all parameters
90 SetName("AliGenHBTprocessor");
91 SetTitle("AliGenHBTprocessor");
94 fHBTprocessor = new THBTprocessor();
99 SetTrackRejectionFactor();
119 SetSwitchCoherence();
121 SetSwitchFermiBose();
122 //SetMomentumRange();
135 SetNBins1DFineMesh();
136 SetBinSize1DFineMesh();
137 SetNBins1DCoarseMesh();
138 SetBinSize1DCoarseMesh();
139 SetNBins3DFineMesh();
140 SetBinSize3DFineMesh();
141 SetNBins3DCoarseMesh();
142 SetBinSize3DCoarseMesh();
143 SetNBins3DFineProjectMesh();
146 /*******************************************************************/
149 /*******************************************************************/
151 AliGenHBTprocessor::~AliGenHBTprocessor()
155 if (fHBTprocessor) delete fHBTprocessor; //delete generator
159 /*******************************************************************/
161 void AliGenHBTprocessor::InitStatusCodes()
163 //creates and inits status codes array to zero
164 AliGenCocktailAfterBurner *cab = GetGenerator();
166 if(!cab) Fatal("InitStatusCodes()","Can not find AliGenCocktailAfterBurner generator");
168 Int_t nev = cab->GetNumberOfEvents();
170 fHbtPStatCodes = new Int_t* [nev];
171 for( Int_t i =0; i<nev;i++)
173 Int_t nprim = cab->GetStack(i)->GetNprimary();
174 fHbtPStatCodes[i] = new Int_t[nprim];
175 for (Int_t k =0 ;k<nprim;k++)
176 fHbtPStatCodes[i][k] =0;
181 /*******************************************************************/
183 void AliGenHBTprocessor::CleanStatusCodes()
185 //Cleans up status codes
188 for (Int_t i =0; i<GetGenerator()->GetNumberOfEvents(); i++)
189 delete [] fHbtPStatCodes[i];
190 delete fHbtPStatCodes;
195 /*******************************************************************/
197 void AliGenHBTprocessor::Init()
199 //sets up parameters in generator
201 THBTprocessor *thbtp = fHBTprocessor;
204 thbtp->SetTrackRejectionFactor(fTrackRejectionFactor);
205 thbtp->SetRefControl(fReferenceControl);
207 if ((fPid[0] == fPid[1]) || (fPid[0] == 0) || (fPid[1] == 0))
210 thbtp->SetPIDs(IdFromPDG(fPid[1]) ,0);
212 thbtp->SetPIDs(IdFromPDG(fPid[0]) ,0);
213 thbtp->SetNPIDtypes(1);
216 Warning("AliGenHBTprocessor::Init","\nThere is only one particle type set,\n\
217 and Switch_Type differnt then 1,\n which does not make sense.\n\
218 Setting it to 1.\n");
224 thbtp->SetPIDs(IdFromPDG(fPid[0]) ,IdFromPDG(fPid[1]));
226 thbtp->SetSwitchType(fSwitchType);
229 thbtp->SetMaxIterations(fMaxit);
230 thbtp->SetDelChi(fDelchi);
231 thbtp->SetIRand(fIrand);
232 thbtp->SetLambda(fLambda);
234 thbtp->SetRSide(fRside);
235 thbtp->SetROut(fRout);
236 thbtp->SetRLong(fRlong);
237 thbtp->SetRPerp(fRperp);
238 thbtp->SetRParallel(fRparallel);
241 thbtp->SetSwitch1D(fSwitch1d);
242 thbtp->SetSwitch3D(fSwitch3d);
243 thbtp->SetSwitchType(fSwitchType);
244 thbtp->SetSwitchCoherence(fSwitchCoherence);
245 thbtp->SetSwitchCoulomb(fSwitchCoulomb);
246 thbtp->SetSwitchFermiBose(fSwitchFermiBose);
247 thbtp->SetPtRange(fPtMin,fPtMax);
248 thbtp->SetPxRange(fPxMin,fPxMax);
249 thbtp->SetPyRange(fPyMin,fPyMax);
250 thbtp->SetPzRange(fPzMin,fPzMax);
251 thbtp->SetPhiRange(fPhiMin*180./TMath::Pi(),fPhiMax*180./TMath::Pi());
252 thbtp->SetEtaRange(fEtaMin,fEtaMax);
253 thbtp->SetNPtBins(fNPtBins);
254 thbtp->SetNPhiBins(fNPhiBins);
255 thbtp->SetNEtaBins(fNEtaBins);
256 thbtp->SetNPxBins(fNPxBins);
257 thbtp->SetNPyBins(fNPyBins);
258 thbtp->SetNPzBins(fNPzBins);
259 thbtp->SetNBins1DFineMesh(fN1dFine);
260 thbtp->SetBinSize1DFineMesh(fBinsize1dFine);
261 thbtp->SetNBins1DCoarseMesh(fN1dCoarse);
262 thbtp->SetBinSize1DCoarseMesh(fBinsize1dCoarse);
263 thbtp->SetNBins3DFineMesh(fN3dFine);
264 thbtp->SetBinSize3DFineMesh(fBinsize3dFine);
265 thbtp->SetNBins3DCoarseMesh(fN3dCoarse);
266 thbtp->SetBinSize3DCoarseMesh(fBinsize3dCoarse);
267 thbtp->SetNBins3DFineProjectMesh(fN3dFineProject);
270 /*******************************************************************/
272 void AliGenHBTprocessor::Generate()
275 AliGenCocktailAfterBurner* cab = GetGenerator();
278 Fatal("Generate()","AliGenHBTprocessor needs AliGenCocktailAfterBurner to be main generator");
280 if (cab->GetNumberOfEvents() <2)
283 "HBT Processor needs more than 1 event to work properly,\
284 but there is only %d set", cab->GetNumberOfEvents());
288 fHBTprocessor->Initialize(); //reset all fields of common blocks
289 //in case there are many HBT processors
290 //run one after one (i.e. in AliCocktailAfterBurner)
291 //between Init() called and Generate there might
292 Init(); //be different instance running - be sure that we have our settings
294 InitStatusCodes(); //Init status codes
296 fHBTprocessor->GenerateEvent(); //Generates event
298 CleanStatusCodes(); //Clean Status codes - thet are not needed anymore
301 /*******************************************************************/
304 /*******************************************************************/
305 void AliGenHBTprocessor::GetParticles(TClonesArray * particles) const
310 cout<<"Particles has to be initialized"<<endl;
313 fHBTprocessor->ImportParticles(particles);
316 /*******************************************************************/
318 Int_t AliGenHBTprocessor::GetHbtPStatusCode(Int_t part) const
320 //returns the status code of the given particle in the active event
321 //see SetActiveEvent in the bottom of AliGenHBTprocessor.cxx
322 //and in AliCocktailAfterBurner
323 Int_t activeEvent = GetGenerator()->GetActiveEventNumber();
324 return fHbtPStatCodes[activeEvent][part];
327 /*******************************************************************/
328 void AliGenHBTprocessor::SetHbtPStatusCode(Int_t hbtstatcode, Int_t part)
330 //Sets the given status code to given particle number (part) in the active event
331 Int_t activeEvent = GetGenerator()->GetActiveEventNumber();
332 fHbtPStatCodes[activeEvent][part] = hbtstatcode;
335 /*******************************************************************/
337 void AliGenHBTprocessor::SetTrackRejectionFactor(Float_t trf) //def 1.0
339 //Sets the Track Rejection Factor
340 //variates in range 0.0 <-> 1.0
341 //Describes the factor of particles rejected from the output.
342 //Used only in case of low muliplicity particles e.g. lambdas.
343 //Processor generates addisional particles and builds the
344 //correletions on such a statistics.
345 //At the end these particels are left in the event according
346 //to this factor: 1==all particles are left
347 // 0==all are removed
349 fTrackRejectionFactor=trf;
350 fHBTprocessor->SetTrackRejectionFactor(trf);
352 /*******************************************************************/
354 void AliGenHBTprocessor::SetRefControl(Int_t rc) //default 2
356 //Sets the Refernce Control Switch
357 //switch wether read reference histograms from file =1
358 // compute from input events =2 - default
359 fReferenceControl=rc;
360 fHBTprocessor->SetRefControl(rc);
362 /*******************************************************************/
364 void AliGenHBTprocessor::SetPIDs(Int_t pid1,Int_t pid2)
367 //Sets PDG Codes of particles to be processed, default \\Pi^{+} and \\Pi^{-}
368 //This method accepts PDG codes which is
369 //in opposite to THBBProcessor which accepts GEANT PID
370 if ( (pid1 == 0) && (pid2 == 0) )
372 Error("AliGenHBTprocessor::SetPIDs","Sensless Particle Types setting: 0 0, Ignoring\n");
380 fHBTprocessor->SetPIDs(IdFromPDG(pid1) ,0);
386 fHBTprocessor->SetPIDs(IdFromPDG(pid1) ,IdFromPDG(pid2));
390 /*******************************************************************/
392 void AliGenHBTprocessor::SetNPIDtypes(Int_t npidt)
394 //Number ofparticle types to be processed - default 2
395 //see AliGenHBTprocessor::SetPIDs
398 fHBTprocessor->SetNPIDtypes(npidt);
400 /*******************************************************************/
402 void AliGenHBTprocessor::SetDeltap(Float_t deltp)
405 //maximum range for random momentum shifts in GeV/c;
406 //px,py,pz independent; Default = 0.1 GeV/c.
408 fHBTprocessor->SetDeltap(deltp);
410 /*******************************************************************/
412 void AliGenHBTprocessor::SetMaxIterations(Int_t maxiter)
414 //maximum # allowed iterations thru all the
415 //tracks for each event. Default = 50.
416 //If maxit=0, then calculate the correlations
417 //for the input set of events without doing the
418 //track adjustment procedure.
421 fHBTprocessor->SetMaxIterations(maxiter);
424 /*******************************************************************/
425 void AliGenHBTprocessor::SetDelChi(Float_t dc)
427 //min % change in total chi-square for which
428 //the track adjustment iterations may stop,
432 fHBTprocessor->SetDelChi(dc);
434 /*******************************************************************/
436 void AliGenHBTprocessor::SetIRand(Int_t irnd)
438 //if fact dummy - used only for compatibility
439 //we are using AliRoot built in RNG
440 //dummy in fact since we are using aliroot build-in RNG
441 //Sets renaodom number generator
443 fHBTprocessor->SetIRand(irnd);
445 /*******************************************************************/
447 void AliGenHBTprocessor::SetLambda(Float_t lam)
450 // Sets Chaoticity Parameter
452 fHBTprocessor->SetLambda(lam);
454 /*******************************************************************/
455 void AliGenHBTprocessor::SetR1d(Float_t r)
458 //Sets Spherical source model radius (fm)
460 fHBTprocessor->SetR1d(r);
462 /*******************************************************************/
463 void AliGenHBTprocessor::SetRSide(Float_t rs)
466 //Rside,Rout,Rlong = Non-spherical Bertsch-Pratt source model (fm)
469 fHBTprocessor->SetRSide(rs);
471 /*******************************************************************/
472 void AliGenHBTprocessor::SetROut(Float_t ro)
475 //Rside,Rout,Rlong = Non-spherical Bertsch-Pratt source model (fm)
477 fHBTprocessor->SetROut(ro);
479 /*******************************************************************/
480 void AliGenHBTprocessor::SetRLong(Float_t rl)
483 //Rside,Rout,Rlong = Non-spherical Bertsch-Pratt source model (fm)
485 fHBTprocessor->SetRLong(rl);
487 /*******************************************************************/
488 void AliGenHBTprocessor::SetRPerp(Float_t rp)
491 //Rperp,Rparallel,R0= Non-spherical Yano-Koonin-Podgoretski source model (fm).
493 fHBTprocessor->SetRPerp(rp);
495 /*******************************************************************/
496 void AliGenHBTprocessor::SetRParallel(Float_t rprl)
499 //Rperp,Rparallel,R0= Non-spherical Yano-Koonin-Podgoretski source model (fm).
501 fHBTprocessor->SetRParallel(rprl);
503 /*******************************************************************/
504 void AliGenHBTprocessor::SetR0(Float_t r0)
507 //Rperp,Rparallel,R0= Non-spherical Yano-Koonin-Podgoretski source model (fm).
509 fHBTprocessor->SetR0(r0);
511 /*******************************************************************/
512 void AliGenHBTprocessor::SetQ0(Float_t q0)
515 //Sets Q0 = NA35 Coulomb parameter for finite source size in (GeV/c)
516 // if fSwitchCoulomb = 2
517 // = Spherical Coulomb source radius in (fm)
518 // if switchCoulomb = 3, used to interpolate the
519 // input Pratt/Cramer discrete Coulomb source
522 fHBTprocessor->SetQ0(q0);
525 /*******************************************************************/
526 void AliGenHBTprocessor::SetSwitch1D(Int_t s1d)
530 // = 0 to not compute the 1D two-body //orrelations.
531 // = 1 to compute this using Q-invariant
532 // = 2 to compute this using Q-total
533 // = 3 to compute this using Q-3-ve//tor
536 fHBTprocessor->SetSwitch1D(s1d);
538 /*******************************************************************/
539 void AliGenHBTprocessor::SetSwitch3D(Int_t s3d)
543 // = 0 to not compute the 3D two-body correlations.
544 // = 1 to compute this using the side-out-long form
545 // = 2 to compute this using the Yanno-Koonin-Pogoredskij form.
548 fHBTprocessor->SetSwitch3D(s3d);
550 /*******************************************************************/
551 void AliGenHBTprocessor::SetSwitchType(Int_t st)
554 // Sets switch_type = 1 to fit only the like pair correlations
555 // = 2 to fit only the unlike pair correlations
556 // = 3 to fit both the like and unlike pair correl.
557 //See SetPIDs and Init
558 //If only one particle type is set, unly==1 makes sens
561 fHBTprocessor->SetSwitchType(st);
563 /*******************************************************************/
564 void AliGenHBTprocessor::SetSwitchCoherence(Int_t sc)
567 // switchCoherence = 0 for purely incoherent source (but can have
569 // = 1 for mixed incoherent and coherent source
571 fSwitchCoherence = sc;
572 fHBTprocessor->SetSwitchCoherence(sc);
574 /*******************************************************************/
575 void AliGenHBTprocessor::SetSwitchCoulomb(Int_t scol)
578 // switchCoulomb = 0 no Coulomb correction
579 // = 1 Point source Gamow correction only
580 // = 2 NA35 finite source size correction
581 // = 3 Pratt/Cramer finite source size correction;
582 // interpolated from input tables.
583 fSwitchCoulomb =scol;
584 fHBTprocessor->SetSwitchCoulomb(scol);
586 /*******************************************************************/
587 void AliGenHBTprocessor::SetSwitchFermiBose(Int_t sfb)
590 // switchFermiBose = 1 Boson pairs
591 // = -1 Fermion pairs
593 fSwitchFermiBose = sfb;
594 fHBTprocessor->SetSwitchFermiBose(sfb);
596 /*******************************************************************/
597 void AliGenHBTprocessor::SetPtRange(Float_t ptmin, Float_t ptmax)
599 // default ptmin = 0.1, ptmax = 0.98
600 //Sets Pt range (GeV)
601 AliGenerator::SetPtRange(ptmin,ptmax);
602 fHBTprocessor->SetPtRange(ptmin,ptmax);
605 /*******************************************************************/
606 void AliGenHBTprocessor::SetPxRange(Float_t pxmin, Float_t pxmax)
608 //default pxmin = -1.0, pxmax = 1.0
612 fHBTprocessor->SetPxRange(pxmin,pxmax);
614 /*******************************************************************/
615 void AliGenHBTprocessor::SetPyRange(Float_t pymin, Float_t pymax)
617 //default pymin = -1.0, pymax = 1.0
621 fHBTprocessor->SetPyRange(pymin,pymax);
623 /*******************************************************************/
624 void AliGenHBTprocessor::SetPzRange(Float_t pzmin, Float_t pzmax)
626 //default pzmin = -3.6, pzmax = 3.6
630 fHBTprocessor->SetPzRange(pzmin,pzmax);
632 void AliGenHBTprocessor::SetMomentumRange(Float_t pmin, Float_t pmax)
634 //default pmin=0, pmax=0
635 //Do not use this method!
636 MayNotUse("AliGenHBTprocessor::SetMomentumRange Method is Dummy");
639 /*******************************************************************/
640 void AliGenHBTprocessor::SetPhiRange(Float_t phimin, Float_t phimax)
644 AliGenerator::SetPhiRange(phimin,phimax);
646 fHBTprocessor->SetPhiRange(phimin,phimax);
648 /*******************************************************************/
649 void AliGenHBTprocessor::SetEtaRange(Float_t etamin, Float_t etamax)
651 //default etamin = -1.5, etamax = 1.5
655 fHBTprocessor->SetEtaRange(etamin,etamax);
657 //set the azimothal angle range in the AliGeneraor -
658 //to keep coherency between azimuthal angle and pseudorapidity
659 //DO NOT CALL this->SetThetaRange, because it calls this method (where we are)
660 //which must cause INFINITE LOOP
661 AliGenerator::SetThetaRange(RadiansToDegrees(EtaToTheta(fEtaMin)),
662 RadiansToDegrees(EtaToTheta(fEtaMax)));
665 /*******************************************************************/
666 void AliGenHBTprocessor::SetThetaRange(Float_t thetamin, Float_t thetamax)
668 //default thetamin = 0, thetamax = 180
669 //Azimuthal angle, override AliGenerator method which uses widely (i.e. wrapper generators)
670 //core fortran HBTProcessor uses Eta (pseudorapidity)
671 //so these methods has to be synchronized
673 AliGenerator::SetThetaRange(thetamin,thetamax);
675 SetEtaRange( ThetaToEta(fThetaMin) , ThetaToEta(fThetaMax) );
679 /*******************************************************************/
680 void AliGenHBTprocessor::SetNPtBins(Int_t nptbin)
682 //default nptbin = 50
683 //set number of Pt bins
685 fHBTprocessor->SetNPtBins(nptbin);
687 /*******************************************************************/
688 void AliGenHBTprocessor::SetNPhiBins(Int_t nphibin)
690 //default nphibin = 50
691 //set number of Phi bins
693 fHBTprocessor->SetNPhiBins(nphibin);
695 /*******************************************************************/
696 void AliGenHBTprocessor::SetNEtaBins(Int_t netabin)
698 //default netabin = 50
699 //set number of Eta bins
701 fHBTprocessor->SetNEtaBins(netabin);
703 /*******************************************************************/
704 void AliGenHBTprocessor::SetNPxBins(Int_t npxbin)
706 //default npxbin = 20
707 //set number of Px bins
709 fHBTprocessor->SetNPxBins(npxbin);
711 /*******************************************************************/
712 void AliGenHBTprocessor::SetNPyBins(Int_t npybin)
714 //default npybin = 20
715 //set number of Py bins
717 fHBTprocessor->SetNPyBins(npybin);
719 /*******************************************************************/
720 void AliGenHBTprocessor::SetNPzBins(Int_t npzbin)
722 //default npzbin = 70
723 //set number of Pz bins
725 fHBTprocessor->SetNPzBins(npzbin);
727 /*******************************************************************/
728 void AliGenHBTprocessor::SetNBins1DFineMesh(Int_t n)
731 //Sets the number of bins in the 1D mesh
733 fHBTprocessor->SetNBins1DFineMesh(n);
736 /*******************************************************************/
737 void AliGenHBTprocessor::SetBinSize1DFineMesh(Float_t x)
740 //Sets the bin size in the 1D mesh
742 fHBTprocessor->SetBinSize1DFineMesh(x);
744 /*******************************************************************/
746 void AliGenHBTprocessor::SetNBins1DCoarseMesh(Int_t n)
749 //Sets the number of bins in the coarse 1D mesh
751 fHBTprocessor->SetNBins1DCoarseMesh(n);
753 /*******************************************************************/
754 void AliGenHBTprocessor::SetBinSize1DCoarseMesh(Float_t x)
757 //Sets the bin size in the coarse 1D mesh
759 fHBTprocessor->SetBinSize1DCoarseMesh(x);
761 /*******************************************************************/
763 void AliGenHBTprocessor::SetNBins3DFineMesh(Int_t n)
766 //Sets the number of bins in the 3D mesh
768 fHBTprocessor->SetNBins3DFineMesh(n);
770 /*******************************************************************/
771 void AliGenHBTprocessor::SetBinSize3DFineMesh(Float_t x)
774 //Sets the bin size in the 3D mesh
776 fHBTprocessor->SetBinSize3DFineMesh(x);
778 /*******************************************************************/
780 void AliGenHBTprocessor::SetNBins3DCoarseMesh(Int_t n)
783 //Sets the number of bins in the coarse 3D mesh
786 fHBTprocessor->SetNBins3DCoarseMesh(n);
788 /*******************************************************************/
789 void AliGenHBTprocessor::SetBinSize3DCoarseMesh(Float_t x)
792 //Sets the bin size in the coarse 3D mesh
793 fBinsize3dCoarse = x;
794 fHBTprocessor->SetBinSize3DCoarseMesh(x);
796 /*******************************************************************/
798 void AliGenHBTprocessor::SetNBins3DFineProjectMesh(Int_t n )
801 //Sets the number of bins in the fine project mesh
803 fHBTprocessor->SetNBins3DFineProjectMesh(n);
805 /*******************************************************************/
808 /*******************************************************************/
815 void AliGenHBTprocessor::DefineParticles()
818 // Load standard numbers for GEANT particles and PDG conversion
819 fNPDGCodes = 0; //this is done in the constructor - but in any case ...
821 fPDGCode[fNPDGCodes++]=-99; // 0 = unused location
822 fPDGCode[fNPDGCodes++]=22; // 1 = photon
823 fPDGCode[fNPDGCodes++]=-11; // 2 = positron
824 fPDGCode[fNPDGCodes++]=11; // 3 = electron
825 fPDGCode[fNPDGCodes++]=12; // 4 = neutrino e
826 fPDGCode[fNPDGCodes++]=-13; // 5 = muon +
827 fPDGCode[fNPDGCodes++]=13; // 6 = muon -
828 fPDGCode[fNPDGCodes++]=111; // 7 = pi0
829 fPDGCode[fNPDGCodes++]=211; // 8 = pi+
830 fPDGCode[fNPDGCodes++]=-211; // 9 = pi-
831 fPDGCode[fNPDGCodes++]=130; // 10 = Kaon Long
832 fPDGCode[fNPDGCodes++]=321; // 11 = Kaon +
833 fPDGCode[fNPDGCodes++]=-321; // 12 = Kaon -
834 fPDGCode[fNPDGCodes++]=2112; // 13 = Neutron
835 fPDGCode[fNPDGCodes++]=2212; // 14 = Proton
836 fPDGCode[fNPDGCodes++]=-2212; // 15 = Anti Proton
837 fPDGCode[fNPDGCodes++]=310; // 16 = Kaon Short
838 fPDGCode[fNPDGCodes++]=221; // 17 = Eta
839 fPDGCode[fNPDGCodes++]=3122; // 18 = Lambda
840 fPDGCode[fNPDGCodes++]=3222; // 19 = Sigma +
841 fPDGCode[fNPDGCodes++]=3212; // 20 = Sigma 0
842 fPDGCode[fNPDGCodes++]=3112; // 21 = Sigma -
843 fPDGCode[fNPDGCodes++]=3322; // 22 = Xi0
844 fPDGCode[fNPDGCodes++]=3312; // 23 = Xi-
845 fPDGCode[fNPDGCodes++]=3334; // 24 = Omega-
846 fPDGCode[fNPDGCodes++]=-2112; // 25 = Anti Proton
847 fPDGCode[fNPDGCodes++]=-3122; // 26 = Anti Proton
848 fPDGCode[fNPDGCodes++]=-3222; // 27 = Anti Sigma -
849 fPDGCode[fNPDGCodes++]=-3212; // 28 = Anti Sigma 0
850 fPDGCode[fNPDGCodes++]=-3112; // 29 = Anti Sigma 0
851 fPDGCode[fNPDGCodes++]=-3322; // 30 = Anti Xi 0
852 fPDGCode[fNPDGCodes++]=-3312; // 31 = Anti Xi +
853 fPDGCode[fNPDGCodes++]=-3334; // 32 = Anti Omega +
856 /*******************************************************************/
857 Int_t AliGenHBTprocessor::IdFromPDG(Int_t pdg) const
860 // Return Geant3 code from PDG and pseudo ENDF code
862 for(Int_t i=0;i<fNPDGCodes;++i)
863 if(pdg==fPDGCode[i]) return i;
866 Int_t AliGenHBTprocessor::PDGFromId(Int_t id) const
869 // Return PDG code and pseudo ENDF code from Geant3 code
871 if(id>0 && id<fNPDGCodes) return fPDGCode[id];
874 Double_t AliGenHBTprocessor::ThetaToEta(Double_t arg)
876 //converts etha(azimuthal angle) to Eta (pseudorapidity). Argument in radians
878 if(arg>= TMath::Pi()) return 709.0;//This number is the biggest wich not crashes exp(x)
879 if(arg<= 0.0) return -709.0;//
881 arg -= TMath::Pi()/2.;
884 return -TMath::Log( TMath::Tan(arg/2.)) ;
888 return TMath::Log( TMath::Tan(-arg/2.)) ;
892 /*******************************************************************/
893 /****** ROUTINES USED FOR COMMUNUCATION ********/
894 /******************** WITH FORTRAN ********************/
895 /*******************************************************************/
898 # define hbtpran hbtpran_
899 # define alihbtp_puttrack alihbtp_puttrack_
900 # define alihbtp_gettrack alihbtp_gettrack_
901 # define alihbtp_getnumberevents alihbtp_getnumberevents_
902 # define alihbtp_getnumbertracks alihbtp_getnumbertracks_
903 # define alihbtp_initialize alihbtp_initialize_
904 # define alihbtp_setactiveeventnumber alihbtp_setactiveeventnumber_
905 # define alihbtp_setparameters alihbtp_setparameters_
909 # define hbtpran HBTPRAN
910 # define alihbtp_puttrack ALIHBTP_PUTTRACK
911 # define alihbtp_gettrack ALIHBTP_GETTRACK
912 # define alihbtp_getnumberevents ALIHBTP_GETNUMBEREVENTS
913 # define alihbtp_getnumbertracks ALIHBTP_GETNUMBERTRACKS
914 # define alihbtp_initialize ALIHBTP_INITIALIZE
915 # define alihbtp_setactiveeventnumber ALIHBTP_SETACTIVEEVENTNUMBER
916 # define alihbtp_setparameters ALIHBTP_SETPARAMETERS
917 # define type_ofCall _stdcall
920 #include "AliGenCocktailAfterBurner.h"
922 /*******************************************************************/
924 AliGenCocktailAfterBurner* GetGenerator()
926 // This function has two tasks:
927 // Check if environment is OK (exist gAlice and generator)
928 // Returns pointer to genrator
929 //to be changed with TFolders
933 cout<<endl<<"ERROR: There is NO gALICE! Check what you are doing!"<<endl;
934 gROOT->Fatal("AliGenHBTprocessor.cxx: GetGenerator()",
935 "\nRunning HBT Processor without gAlice... Exiting \n");
938 AliGenerator * gen = gAlice->Generator();
942 gAlice->Fatal("AliGenHBTprocessor.cxx: GetGenerator()",
943 "\nThere is no generator in gAlice, exiting\n");
947 //we do not sure actual type of the genetator
948 //and simple casting is risky - we use ROOT machinery to do safe cast
950 TClass* cabclass = AliGenCocktailAfterBurner::Class(); //get AliGenCocktailAfterBurner TClass
951 TClass* genclass = gen->IsA();//get TClass of the generator we got from galice
952 //use casting implemented in TClass
953 //cast gen to cabclass
954 AliGenCocktailAfterBurner* cab=(AliGenCocktailAfterBurner*)genclass->DynamicCast(cabclass,gen);
956 if (cab == 0x0)//if generator that we got is not AliGenCocktailAfterBurner or its descendant we get null
957 { //then quit with error
958 gAlice->Fatal("AliGenHBTprocessor.cxx: GetGenerator()",
959 "\nThe main Generator is not a AliGenCocktailAfterBurner, exiting\n");
962 // cout<<endl<<"Got generator"<<endl;
966 /*******************************************************************/
968 AliGenHBTprocessor* GetAliGenHBTprocessor()
970 //returns pointer to the current instance of AliGenHBTprocessor in
971 //AliGenCocktailAfterBurner (can be more than one)
973 AliGenCocktailAfterBurner* gen = GetGenerator();
974 AliGenerator* g = gen->GetCurrentGenerator();
977 gAlice->Fatal("AliGenHBTprocessor.cxx: GetAliGenHBTprocessor()",
978 "Can not get the current generator. Exiting");
982 TClass* hbtpclass = AliGenHBTprocessor::Class(); //get AliGenCocktailAfterBurner TClass
983 TClass* gclass = g->IsA();//get TClass of the current generator we got from CAB
984 AliGenHBTprocessor* hbtp = (AliGenHBTprocessor*)gclass->DynamicCast(hbtpclass,g);//try to cast
987 gAlice->Fatal("AliGenHBTprocessor.cxx: GetAliGenHBTprocessor()",
988 "\nCurrernt generator in AliGenCocktailAfterBurner is not a AliGenHBTprocessor, exiting\n");
994 /*******************************************************************/
995 extern "C" void type_ofCall alihbtp_setparameters()
1000 extern "C" void type_ofCall alihbtp_initialize()
1005 /*******************************************************************/
1007 extern "C" void type_ofCall alihbtp_getnumberevents(Int_t &nev)
1009 //passes number of events to the fortran
1010 if(gDebug) cout<<"alihbtp_getnumberevents("<<nev<<") ....";
1011 AliGenCocktailAfterBurner* gen = GetGenerator();
1018 nev = gen->GetNumberOfEvents();
1020 if(gDebug>5) cout<<"EXITED N Ev = "<<nev<<endl;
1024 /*******************************************************************/
1026 extern "C" void type_ofCall alihbtp_setactiveeventnumber(Int_t & nev)
1028 //sets active event in generator (AliGenCocktailAfterBurner)
1030 if(gDebug>5) cout<<"alihbtp_setactiveeventnumber("<<nev<<") ....";
1031 if(gDebug>0) cout<<"Asked for event "<<nev-1<<endl;
1032 AliGenCocktailAfterBurner* gen = GetGenerator();
1034 gen->SetActiveEventNumber(nev - 1); //fortran numerates events from 1 to N
1036 if(gDebug>5) cout<<"EXITED returned "<<nev<<endl;
1039 /*******************************************************************/
1041 extern "C" void type_ofCall alihbtp_getnumbertracks(Int_t &ntracks)
1043 //passes number of particles in active event to the fortran
1044 if(gDebug>5) cout<<"alihbtp_getnumbertracks("<<ntracks<<") ....";
1046 AliGenCocktailAfterBurner* gen = GetGenerator();
1053 ntracks = gen->GetActiveStack()->GetNprimary();
1054 if(gDebug>5) cout<<"EXITED Ntracks = "<<ntracks<<endl;
1057 /*******************************************************************/
1059 extern "C" void type_ofCall
1060 alihbtp_puttrack(Int_t & n,Int_t& flag, Float_t& px,
1061 Float_t& py, Float_t& pz, Int_t& geantpid)
1063 //sets new parameters (momenta) in track number n
1064 // in the active event
1065 // n - number of the track in active event
1066 // flag - flag of the track
1067 // px,py,pz - momenta
1068 // geantpid - type of the particle - Geant Particle ID
1070 if(gDebug>5) cout<<"alihbtp_puttrack("<<n<<") ....";
1072 AliGenCocktailAfterBurner* gen = GetGenerator();
1075 TParticle * track = gen->GetActiveStack()->Particle(n-1);
1077 AliGenHBTprocessor* g = GetAliGenHBTprocessor();
1079 //check to be deleted
1080 if (geantpid != (g->IdFromPDG( track->GetPdgCode() )))
1082 cerr<<endl<<" AliGenHBTprocessor.cxx: alihbtp_puttrack: SOMETHING IS GOING BAD:\n GEANTPIDS ARE NOT THE SAME"<<endl;
1086 if (px != track->Px())
1087 cout<<"Px diff. = "<<px - track->Px()<<endl;
1089 if(gDebug>3) cout<<" track->GetPdgCode() --> "<<track->GetPdgCode()<<endl;
1093 Float_t m = track->GetMass();
1094 Float_t e = TMath::Sqrt(m*m+px*px+py*py+pz*pz);
1095 track->SetMomentum(px,py,pz,e);
1097 g->SetHbtPStatusCode(flag,n-1);
1099 if(gDebug>5) cout<<"EXITED "<<endl;
1102 /*******************************************************************/
1104 extern "C" void type_ofCall
1105 alihbtp_gettrack(Int_t & n,Int_t & flag, Float_t & px,
1106 Float_t & py, Float_t & pz, Int_t & geantpid)
1109 //passes track parameters to the fortran
1110 // n - number of the track in active event
1111 // flag - flag of the track
1112 // px,py,pz - momenta
1113 // geantpid - type of the particle - Geant Particle ID
1115 if(gDebug>5) cout<<"alihbtp_gettrack("<<n<<") ....";
1116 AliGenCocktailAfterBurner* gen = GetGenerator();
1127 TParticle * track = gen->GetActiveStack()->Particle(n-1);
1128 AliGenHBTprocessor* g = GetAliGenHBTprocessor();
1130 flag = g->GetHbtPStatusCode(n-1);
1132 px = (Float_t)track->Px();
1133 py = (Float_t)track->Py();
1134 pz = (Float_t)track->Pz();
1136 geantpid = g->IdFromPDG( track->GetPdgCode() );
1138 if(gDebug>5) cout<<"EXITED "<<endl;
1141 /*******************************************************************/
1142 extern "C" Float_t type_ofCall hbtpran(Int_t &)
1144 //interface to the random number generator
1145 return sRandom->Rndm();
1148 /*******************************************************************/
1151 /*******************************************************************/