]> git.uio.no Git - u/mrichter/AliRoot.git/blame - HBTAN/AliHBTLLWeights.cxx
Bug correction
[u/mrichter/AliRoot.git] / HBTAN / AliHBTLLWeights.cxx
CommitLineData
4fdf4eb3 1#include "AliHBTLLWeights.h"
88cb7938 2/**************************************************************************
3 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * *
5 * Author: The ALICE Off-line Project. *
6 * Contributors are mentioned in the code where appropriate. *
7 * *
8 * Permission to use, copy, modify and distribute this software and its *
9 * documentation strictly for non-commercial purposes is hereby granted *
10 * without fee, provided that the above copyright notice appears in all *
11 * copies and that both the copyright notice and this permission notice *
12 * appear in the supporting documentation. The authors make no claims *
13 * about the suitability of this software for any purpose. It is *
14 * provided "as is" without express or implied warranty. *
15 **************************************************************************/
16
17//_________________________________________________________________________
18///////////////////////////////////////////////////////////////////////////
19//
20// class AliHBTLLWeights
21//
22// This class introduces the weight's calculation
23// according to the Lednicky's algorithm.
24//
25//
26// fsiw.f, fsiini.f
27//
28// Description from fortran code by author R. Lednicky
29//
30// Calculates final state interaction (FSI) weights
31// WEIF = weight due to particle - (effective) nucleus FSI (p-N)
32// WEI = weight due to p-p-N FSI
33// WEIN = weight due to p-p FSI; note that WEIN=WEI if I3C=0;
34// note that if I3C=1 the calculation of
35// WEIN can be skipped by putting J=0
36//.......................................................................
37// Correlation Functions:
38// CF(p-p-N) = sum(WEI)/sum(WEIF)
39// CF(p-p) = sum(WEIN)/sum(1); here the nucleus is completely
40// inactive
41// CF(p-p-"N") = sum(WEIN*WEIF')/sum(WEIF'), where WEIN and WEIF'
42// are not correlated (calculated at different emission
43// points, e.g., for different events);
44// thus here the nucleus affects one-particle
45// spectra but not the correlation
46//.......................................................................
47// User must supply data file <fn> on unit NUNIT (e.g. =11) specifying
48// LL : particle pair
49// NS : approximation used to calculate Bethe-Salpeter amplitude
50// ITEST: test switch
51// If ITEST=1 then also following parameters are required
52// ICH : 1(0) Coulomb interaction between the two particles ON (OFF)
53// IQS : 1(0) quantum statistics for the two particles ON (OFF)
54// ISI : 1(0) strong interaction between the two particles ON (OFF)
55// I3C : 1(0) Coulomb interaction with residual nucleus ON (OFF)
56// This data file can contain other information useful for the user.
57// It is read by subroutines READINT4 and READREA8(4) (or READ_FILE).
58// -------------------------------------------------------------------
59//- LL 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
60//- part. 1: n p n alfa pi+ pi0 pi+ n p pi+ pi+ pi+ pi- K+ K+ K+ K-
61//- part. 2: n p p alfa pi- pi0 pi+ d d K- K+ p p K- K+ p p
62// NS=1 y/n: + + + + + - - - - - - - - - - - -
63// -------------------------------------------------------------------
64//- LL 18 19 20 21 22 23 24 25 26 27 28
65//- part. 1: d d t t K0 K0 d p p p n
66//- part. 2: d alfa t alfa K0 K0b t t alfa lambda lambda
67// NS=1 y/n: - - - - - - - - - + +
68// -------------------------------------------------------------------
69// NS=1 Square well potential,
70// NS=3 not used
71// NS=4 scattered wave approximated by the spherical wave,
72// NS=2 same as NS=4 but the approx. of equal emission times in PRF
73// not required (t=0 approx. used in all other cases).
74// Note: if NS=2,4, the B-S amplitude diverges at zero distance r* in
75// the two-particle c.m.s.; user can specify a cutoff AA in
76// SUBROUTINE FSIINI, for example:
77// IF(NS.EQ.2.OR.NS.EQ.4)AA=5.D0 !! in 1/GeV --> AA=1. fm
78// ------------------------------------------------------------------
79// ITEST=1 any values of parameters ICH, IQS, ISI, I3C are allowed
80// and should be given in data file <fn>
81// ITEST=0 physical values of these parameters are put automatically
82// in FSIINI (their values are not required in data file)
83//=====================================================================
84// At the beginning of calculation user should call FSIINI,
85// which reads LL, NS, ITEST (and eventually ICH, IQS, ISI, I3C)
86// and initializes various parameters.
87// In particular the constants in
88// COMMON/FSI_CONS/PI,PI2,SPI,DR,W
89// may be useful for the user:
90// W=1/.1973D0 ! from fm to 1/GeV
91// PI=4*DATAN(1.D0)
92// PI2=2*PI
93// SPI=DSQRT(PI)
94// DR=180.D0/PI ! from radian to degree
95// _______________________________________________________
96// !! |Important note: all real quantities are assumed REAL*8 | !!
97// -------------------------------------------------------
98// For each event user should fill in the following information
99// in COMMONs (all COMMONs in FSI calculation start with FSI_):
100// ...................................................................
101// COMMON/FSI_POC/AMN,AM1,AM2,CN,C1,C2,AC1,AC2
102// Only
103// AMN = mass of the effective nucleus [GeV/c**2]
104// CN = charge of the effective nucleus [elem. charge units]
105// are required
106// ...................................................................
107// COMMON/FSI_MOM/P1X,P1Y,P1Z,E1,P1, !part. momenta in the rest frame
108// 1 P2X,P2Y,P2Z,E2,P2 !of effective nucleus (NRF)
109// Only the components
110// PiX,PiY,PiZ [GeV/c]
111// in NRF are required.
112// To make the corresponding Lorentz transformation user can use the
113// subroutines LTRAN and LTRANB
114// ...................................................................
115// COMMON/FSI_COOR/X1,Y1,Z1,T1,R1, ! 4-coord. of emission
116// 1 X2,Y2,Z2,T2,R2 ! points in NRF
117// The componets
118// Xi,Yi,Zi [fm]
119// and emission times
120// Ti [fm/c]
121// should be given in NRF with the origin assumed at the center
122// of the effective nucleus. If the effect of residual nucleus is
123// not calculated within FSIW, the NRF can be any fixed frame.
124// --------------------------------------------------------------------
125// Before calling FSIW the user must call
126// CALL LTRAN12
127// Besides Lorentz transformation to pair rest frame:
128// (p1-p2)/2 --> k* it also transforms 4-coordinates of
129// emission points from fm to 1/GeV and calculates Ei,Pi and Ri.
130// Note that |k*|=AK in COMMON/FSI_PRF/
131// --------------------------------------------------------------------
132// After making some additional filtering using k* (say k* < k*max)
133// or direction of vector k*,
134// user can finally call FSIW to calculate the FSI weights
135// to be used to construct the correlation function
136//======================================================================
137
4fdf4eb3 138
7f92929e 139/*******************************************************************/
140/****** ROUTINES USED FOR COMMUNUCATION ********/
141/******************** WITH FORTRAN ********************/
142/*******************************************************************/
143#ifndef WIN32
144# define led_bldata led_bldata_
145# define fsiini fsiini_
146# define ltran12 ltran12_
147# define fsiw fsiw_
88cb7938 148# define setpdist setpdist_
7f92929e 149# define type_of_call
150#else
151# define led_bldata LED_BLDATA
152# define fsiini FSIINI
153# define ltran12 LTRAN12
154# define fsiw FSIW
88cb7938 155# define setpdist SETPDIST
7f92929e 156# define type_of_call _stdcall
157#endif
158/****************************************************************/
159extern "C" void type_of_call led_bldata();
160extern "C" void type_of_call fsiini();
161extern "C" void type_of_call ltran12();
162extern "C" void type_of_call fsiw();
88cb7938 163extern "C" void type_of_call setpdist(Double_t& r);
7f92929e 164/**************************************************************/
165
88cb7938 166#include "AliHBTPair.h"
167#include "AliHBTParticle.h"
168#include "WLedCOMMONS.h"
169#include <TList.h>
170#include <TRandom.h>
171#include <TMath.h>
172#include <TPDGCode.h>
173
174
7f92929e 175ClassImp(AliHBTLLWeights)
7f92929e 176
88cb7938 177AliHBTLLWeights* AliHBTLLWeights::fgLLWeights = 0x0;
178const Double_t AliHBTLLWeights::fgkWcons = 1./0.1973;
7f92929e 179
88cb7938 180AliHBTLLWeights::AliHBTLLWeights():
181 fTest(kTRUE),
182 fColoumbSwitch(kTRUE),
183 fQuantStatSwitch(kTRUE),
184 fStrongInterSwitch(kTRUE),
111e505b 185 fColWithResidNuclSwitch(kFALSE),
88cb7938 186 fNuclMass(0.0),
187 fNuclCharge(0.0),
188 fRandomPosition(kFALSE),
189 fRadius(0.0),
526c2bd5 190 fOneMinusLambda(0.0),
88cb7938 191 fPID1(0),
192 fPID2(0),
193 fSigma(0.0)
7f92929e 194{
88cb7938 195// Default Constructor
7f92929e 196}
88cb7938 197/**************************************************************/
7f92929e 198
111e505b 199AliHBTLLWeights::AliHBTLLWeights(const AliHBTLLWeights &/*source*/):
dd82cadc 200 AliHBTWeights(),
111e505b 201 fTest(kTRUE),
202 fColoumbSwitch(kTRUE),
203 fQuantStatSwitch(kTRUE),
204 fStrongInterSwitch(kTRUE),
205 fColWithResidNuclSwitch(kFALSE),
206 fNuclMass(0.0),
207 fNuclCharge(0.0),
208 fRandomPosition(kFALSE),
209 fRadius(0.0),
526c2bd5 210 fOneMinusLambda(0.0),
111e505b 211 fPID1(0),
212 fPID2(0),
213 fSigma(0.0)
214{
215 //Copy ctor needed by the coding conventions but not used
216 Fatal("AliHBTLLWeights","copy ctor not implemented");
217}
218/************************************************************/
219
220AliHBTLLWeights& AliHBTLLWeights::operator=(const AliHBTLLWeights& /*source*/)
221{
222 //Assignment operator needed by the coding conventions but not used
223 Fatal("AliHBTLLWeights","assignment operator not implemented");
224 return * this;
225}
226/************************************************************/
227
4fdf4eb3 228AliHBTLLWeights* AliHBTLLWeights::Instance()
88cb7938 229{
230// returns instance of class
231 if (fgLLWeights)
232 {
4fdf4eb3 233 return fgLLWeights;
88cb7938 234 }
235 else
236 {
237 fgLLWeights = new AliHBTLLWeights();
238 return fgLLWeights;
239 }
240}
526c2bd5 241/************************************************************/
7f92929e 242
dd82cadc 243void AliHBTLLWeights::Set()
244{
245 //sets this as weighitng class
246 Info("Set","Setting Lednicky-Lyuboshitz as Weighing Class");
247
248 if ( fgWeights == 0x0 )
249 {
250 fgWeights = AliHBTLLWeights::Instance();
251 return;
252 }
253 if ( fgWeights == AliHBTLLWeights::Instance() ) return;
254 delete fgWeights;
255 fgWeights = AliHBTLLWeights::Instance();
256}
257/************************************************************/
258
7f92929e 259Double_t AliHBTLLWeights::GetWeight(const AliHBTPair* partpair)
260{
88cb7938 261// calculates weight for a pair
262 static const Double_t cmtofm = 1.e13;
111e505b 263 static const Double_t cmtoOneOverGeV = cmtofm*fgkWcons;
88cb7938 264
4fdf4eb3 265 AliHBTParticle *part1 = partpair->Particle1();
266 AliHBTParticle *part2 = partpair->Particle2();
2f8eea63 267
4fdf4eb3 268 if ( (part1 == 0x0) || (part2 == 0x0))
88cb7938 269 {
270 Error("GetWeight","Null particle pointer");
271 return 0.0;
272 }
273
274
526c2bd5 275//takes a lot of time
4fdf4eb3 276 if ( (part1->Px() == part2->Px()) &&
277 (part1->Py() == part2->Py()) &&
278 (part1->Pz() == part2->Pz()) )
88cb7938 279 {
280 return 0.0;
281 }
282
4fdf4eb3 283 if ((!fRandomPosition) &&
88cb7938 284 (part1->Vx() == part2->Vx()) &&
285 (part1->Vy() == part2->Vy()) &&
286 (part1->Vz() == part2->Vz()) )
2f8eea63 287 {
4fdf4eb3 288 return 0.0;
2f8eea63 289 }
88cb7938 290
526c2bd5 291 if(fOneMinusLambda)//implemetation of non-zero intetcept parameter
292 {
293 if( gRandom->Rndm() < fOneMinusLambda ) return 1.0;
294 }
295
88cb7938 296 FSI_MOM.P1X = part1->Px();
297 FSI_MOM.P1Y = part1->Py();
298 FSI_MOM.P1Z = part1->Pz();
299
300 FSI_MOM.P2X = part2->Px();
301 FSI_MOM.P2Y = part2->Py();
302 FSI_MOM.P2Z = part2->Pz();
303
111e505b 304 FSI_COOR.X1 = part1->Vx()*cmtoOneOverGeV;
305 FSI_COOR.Y1 = part1->Vy()*cmtoOneOverGeV;
306 FSI_COOR.Z1 = part1->Vz()*cmtoOneOverGeV;
88cb7938 307 FSI_COOR.T1 = part1->T();
308
111e505b 309 FSI_COOR.X2 = part2->Vx()*cmtoOneOverGeV;
310 FSI_COOR.Y2 = part2->Vy()*cmtoOneOverGeV;
311 FSI_COOR.Z2 = part2->Vz()*cmtoOneOverGeV;
88cb7938 312 FSI_COOR.T2 = part2->T();
4fdf4eb3 313
314 ltran12();
7f92929e 315
88cb7938 316 //this must be after ltran12 because it would overwrite what we set below
317 if (fRandomPosition)
318 {
319 Double_t rxcm = fSigma*gRandom->Gaus();
320 Double_t rycm = fSigma*gRandom->Gaus();
321 Double_t rzcm = fSigma*gRandom->Gaus();
322
323 FSI_PRF.X=rxcm*fgkWcons;
324 FSI_PRF.Y=rycm*fgkWcons;
325 FSI_PRF.Z=rzcm*fgkWcons;
326 FSI_PRF.T=0.;
327
328 Double_t rps=rxcm*rxcm+rycm*rycm+rzcm*rzcm;
329 Double_t rp=TMath::Sqrt(rps);
330 setpdist(rp);
331 }
332
333 fsiw();
4fdf4eb3 334 return LEDWEIGHT.WEIN;
335}
7f92929e 336/************************************************************/
88cb7938 337
7f92929e 338void AliHBTLLWeights::Init()
4fdf4eb3 339{
88cb7938 340//initial parameters of model
341
4fdf4eb3 342 FSI_NS.NS = fApproximationModel;
343
88cb7938 344 LEDWEIGHT.ITEST = fTest;
345 if(fTest)
346 {
347 FSI_NS.ICH = fColoumbSwitch;
348 FSI_NS.ISI = fStrongInterSwitch;
349 FSI_NS.IQS = fQuantStatSwitch;
350 FSI_NS.I3C = fColWithResidNuclSwitch;
351 LEDWEIGHT.IRANPOS = fRandomPosition;
352 }
353
4fdf4eb3 354 if ( (fPID1 == 0) || (fPID2 == 0) )
88cb7938 355 {
356 Fatal("Init","Particles types are not set");
357 return;//pro forma
358 }
4fdf4eb3 359 FSI_NS.LL = GetPairCode(fPID1,fPID2);
88cb7938 360
4fdf4eb3 361 if (FSI_NS.LL == 0)
88cb7938 362 {
363 Fatal("Init","Particles types are not supported");
364 return;//pro forma
365 }
366
367
4fdf4eb3 368 TParticlePDG* tpart1 = TDatabasePDG::Instance()->GetParticle(fPID1);
369 if (tpart1 == 0x0)
88cb7938 370 {
371 Fatal("init","We can not find particle with ID=%d in PDG DataBase",fPID1);
372 return;
373 }
374
4fdf4eb3 375 FSI_POC.AM1=tpart1->Mass();
376 FSI_POC.C1=tpart1->Charge();
88cb7938 377
4fdf4eb3 378 TParticlePDG* tpart2 = TDatabasePDG::Instance()->GetParticle(fPID2);
88cb7938 379//lv
4fdf4eb3 380 if (tpart2 == 0x0)
88cb7938 381 {
382 Fatal("init","We can not find particle with ID=%d in our DataBase",fPID2);
383 return;
384 }
385
4fdf4eb3 386 FSI_POC.AM2=tpart2->Mass();
387 FSI_POC.C1=tpart2->Charge();
88cb7938 388
4fdf4eb3 389 led_bldata();
390 fsiini();
88cb7938 391
392
393//constants for radii simulation
394
395 if(fRandomPosition)
396 {
397 fSigma =TMath::Sqrt(2.)*fRadius;
398 }
7f92929e 399}
88cb7938 400/************************************************************/
7f92929e 401
402Int_t AliHBTLLWeights::GetPairCode(const AliHBTPair* partpair)
403{
88cb7938 404//returns Code corresponding to that pair
405 return GetPairCode(partpair->Particle1()->GetPdgCode(),partpair->Particle2()->GetPdgCode());
7f92929e 406}
88cb7938 407/************************************************************/
7f92929e 408
409Int_t AliHBTLLWeights::GetPairCode(Int_t pid1,Int_t pid2)
410{
88cb7938 411// returns code corresponding to the pair of PIDs
412// pairCode 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
413// hpid: n p n alfa pi+ pi0 pi+ n p pi+ pi+ pi+ pi- K+ K+ K+ K- d d t t K0 K0 d p p p n
414// lpid: n p p alfa pi- pi0 pi+ d d K- K+ p p K- K+ p p d alfa t alfa K0 K0b t t alfa lambda lambda
415// NS=1 y/n: + + + + + - - - - - - - - - - - - - - - - - - - - - - -
416
417//alphas, deuterons and tyts are NOT supported here
418
7f92929e 419 Int_t chargefactor = 1;
420 Int_t hpid; //pid in higher row
421 Int_t lpid; //pid in lower row
422 Int_t code; //pairCode
423
424 Bool_t swap;
425
88cb7938 426//determine the order of selcetion in switch
7f92929e 427 if (TMath::Abs(pid1) < TMath::Abs(pid2) )
88cb7938 428 {
429 if (pid1<0) chargefactor=-1;
430 hpid=pid2*chargefactor;
431 lpid=pid1*chargefactor;
432 swap = kFALSE;
433 }
7f92929e 434 else
88cb7938 435 {
436 if (pid2<0) chargefactor=-1;
437 hpid=pid1*chargefactor;
438 lpid=pid2*chargefactor;
439 swap = kTRUE;
440 }
441
442//mlv
443 hpid=pid1;
444 lpid=pid2;
445
446
447//Determine the pair code
7f92929e 448 switch (hpid) //switch on first particle id
88cb7938 449 {
450 case kNeutron:
7f92929e 451 switch (lpid)
88cb7938 452 {
453 case kNeutron:
454 code = 1; //neutron neutron
455 break;
456
457 case kProton:
458 code = 3; //neutron proton
459 break;
460
461 case kLambda0:
462 code = 28; //neutron lambda
463 break;
464
465 default:
466 return 0; //given pair not supported
467 break;
468 }
7f92929e 469 break;
88cb7938 470
471 case kProton:
7f92929e 472 switch (lpid)
88cb7938 473 {
474 case kProton:
475 code = 2; //proton proton
476 break;
477
478 case kLambda0:
479 code = 27;//proton lambda
480 break;
481
482 default:
483 return 0; //given pair not supported
484 break;
485
486 }
7f92929e 487 break;
88cb7938 488
489 case kPiPlus:
490
7f92929e 491 switch (lpid)
88cb7938 492 {
493 case kPiPlus:
494 code = 7; //piplus piplus
495 break;
496
497 case kPiMinus:
498 code = 5; //piplus piminus
499 break;
500
501 case kKMinus:
502 code = 10; //piplus Kminus
503 break;
504
505 case kKPlus:
506 code = 11; //piplus Kplus
507 break;
508
509 case kProton:
510 code = 12; //piplus proton
511 chargefactor*=-1;
512 break;
513
514 default:
515 return 0; //given pair not supported
516 break;
517 }
7f92929e 518 break;
88cb7938 519 case kPi0:
7f92929e 520 switch (lpid)
88cb7938 521 {
522 case kPi0:
523 code = 6;
524 break;
525
526 default:
527 return 0; //given pair not supported
528 break;
529 }
7f92929e 530 break;
531
88cb7938 532 case kKPlus:
7f92929e 533 switch (lpid)
88cb7938 534 {
535 case kKMinus:
536 code = 14; //Kplus Kminus
537 break;
538
539 case kKPlus:
540 code = 15; //Kplus Kplus
541 break;
542
543 case kProton:
544 code = 16; //Kplus proton
545 break;
546
547 default:
548 return 0; //given pair not supported
549 break;
550 }
7f92929e 551 break;
552
88cb7938 553 case kKMinus:
7f92929e 554 switch (lpid)
88cb7938 555 {
556 case kProton:
557 code = 17; //Kminus proton
558 chargefactor*=1;
559 break;
560
561 default:
562 return 0; //given pair not supported
563 break;
564 }
7f92929e 565 break;
566
88cb7938 567 case kK0:
7f92929e 568 switch (lpid)
88cb7938 569 {
570 case kK0:
571 code = 2; //Kzero Kzero
572 break;
573
574 case kK0Bar:
575 code = 17; //Kzero KzeroBar
576 break;
577
578 default:
579 return 0; //given pair not supported
580 break;
581 }
7f92929e 582 break;
88cb7938 583
584 default: return 0;
585 }
7f92929e 586 return code;
587}
88cb7938 588/************************************************************/
589
590void AliHBTLLWeights::SetTest(Bool_t rtest)
591{
592 //Sets fTest member
593 fTest = rtest;
594}
595/************************************************************/
596
597void AliHBTLLWeights::SetColoumb(Bool_t col)
598{
599 // (ICH in fortran code) Coulomb interaction between the two particles ON (OFF)
600 fColoumbSwitch = col;
601}
602/************************************************************/
603
604void AliHBTLLWeights::SetQuantumStatistics(Bool_t qss)
605{
606 //IQS: quantum statistics for the two particles ON (OFF)
607 //if non-identical particles automatically off
608 fQuantStatSwitch = qss;
609}
610/************************************************************/
611
612void AliHBTLLWeights::SetStrongInterSwitch(Bool_t sis)
613{
614 //ISI: strong interaction between the two particles ON (OFF)
615 fStrongInterSwitch = sis;
616}
617/************************************************************/
7f92929e 618
88cb7938 619void AliHBTLLWeights::SetColWithResidNuclSwitch(Bool_t crn)
620{
621 //I3C: Coulomb interaction with residual nucleus ON (OFF)
622 fColWithResidNuclSwitch = crn;
623}
624/************************************************************/
625
626void AliHBTLLWeights::SetApproxModel(Int_t ap)
627{
628 //sets Model of Approximation (NS in Fortran code)
629 fApproximationModel=ap;
630}
631/************************************************************/
632
633void AliHBTLLWeights::SetRandomPosition(Bool_t rp)
634{
635 //ON=kTRUE(OFF=kFALSE)
636 //ON -- calculation of the Gauss source radii
637 //if the generator don't allows the source generation (for example MeVSim)
638 //if ON the following parameters are requested:
639 fRandomPosition = rp;
640}
641/************************************************************/
642
643void AliHBTLLWeights::SetR1dw(Double_t R)
644{
645 //spherical source model radii
646 fRadius=R;
647}
648/************************************************************/
649
650void AliHBTLLWeights::SetParticlesTypes(Int_t pid1, Int_t pid2)
651{
652 //set AliRoot particles types
653 fPID1 = pid1;
654 fPID2 = pid2;
655}
656/************************************************************/
657
658void AliHBTLLWeights::SetNucleusCharge(Double_t ch)
659{
660 // not used now (see comments in fortran code)
661 fNuclCharge=ch;
662}
663/************************************************************/
664
665void AliHBTLLWeights::SetNucleusMass(Double_t mass)
666{
667 // (see comments in fortran code)
668 fNuclMass=mass;
669}