1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
19 // Implementation of the class to calculate the parton energy loss
20 // Based on the "BDMPS" quenching weights by C.A.Salgado and U.A.Wiedemann
22 // C.A.Salgado and U.A.Wiedemann, Phys.Rev.D68 (2003) 014008 [hep-ph/0302184]
23 // A.Dainese, Eur.Phys.J.C, in press, [nucl-ex/0312005]
26 // Origin: C. Loizides constantinos.loizides@cern.ch
27 // A. Dainese andrea.dainese@pd.infn.it
29 //=================== Added by C. Loizides 27/03/04 ===========================
31 // Added support for k-Quenching, where wc=I1*k and R=2I1^2/I0*k
32 // (see the AliFastGlauber class for definition of I0/I1)
33 //-----------------------------------------------------------------------------
35 #include <Riostream.h>
45 #include "AliQuenchingWeights.h"
47 ClassImp(AliQuenchingWeights)
49 // conversion from fm to GeV^-1: 1 fm = fmGeV GeV^-1
50 const Double_t AliQuenchingWeights::fgkConvFmToInvGeV = 1./0.197;
53 const Double_t AliQuenchingWeights::fgkRMax = 1.e6;
56 const Int_t AliQuenchingWeights::fgkBins = 1300;
57 const Double_t AliQuenchingWeights::fgkMaxBin = 1.3;
59 // counter for histogram labels
60 Int_t AliQuenchingWeights::fgCounter = 0;
63 AliQuenchingWeights::AliQuenchingWeights()
65 fInstanceNumber(fgCounter++),
78 fHisto = new TH1F(Form("hhistoqw_%d",fInstanceNumber),"",fgkBins,0.,fgkMaxBin);
79 for(Int_t bin=1;bin<=fgkBins;bin++)
80 fHisto->SetBinContent(bin,0.);
83 AliQuenchingWeights::AliQuenchingWeights(const AliQuenchingWeights& a)
85 fInstanceNumber(fgCounter++),
102 fMultSoft=a.GetMultSoft();;
105 fQTransport=a.GetQTransport();
106 fECMethod=(kECMethod)a.GetECMethod();
107 fLengthMax=a.GetLengthMax();
108 fInstanceNumber=fgCounter++;
110 snprintf(name,100, "hhistoqw_%d",fInstanceNumber);
111 fHisto = new TH1F(name,"",fgkBins,0.,fgkMaxBin);
112 for(Int_t bin=1;bin<=fgkBins;bin++)
113 fHisto->SetBinContent(bin,0.);
115 //Missing in the class is the pathname
116 //to the tables, can be added if needed
119 AliQuenchingWeights::~AliQuenchingWeights()
125 void AliQuenchingWeights::Reset()
127 //reset tables if there were used
130 for(Int_t l=0;l<4*fLengthMaxOld;l++){
131 delete fHistos[0][l];
132 delete fHistos[1][l];
139 void AliQuenchingWeights::SetECMethod(kECMethod type)
141 //set energy constraint method
144 if(fECMethod==kDefault)
145 Info("SetECMethod","Energy Constraint Method set to DEFAULT:\nIf (sampled energy loss > parton energy) then sampled energy loss = parton energy.");
146 else if(fECMethod==kReweight)
147 Info("SetECMethod","Energy Constraint Method set to REWEIGHT:\nRequire sampled energy loss <= parton energy.");
148 else Info("SetECMethod","Energy Constraint Method set to REWEIGHTCONT:\nRequire sampled energy loss <= parton energy (only implemented for FAST method.");
151 Int_t AliQuenchingWeights::InitMult(const Char_t *contall,const Char_t *discall)
153 // read in tables for multiple scattering approximation
154 // path to continuum and to discrete part
156 fTablesLoaded = kFALSE;
160 snprintf(fname,1024, "%s",gSystem->ExpandPathName(contall));
161 //PH ifstream fincont(fname);
162 fstream fincont(fname,ios::in);
163 #if defined(__HP_aCC) || defined(__DECCXX)
164 if(!fincont.rdbuf()->is_open()) return -1;
166 if(!fincont.is_open()) return -1;
170 while(fincont>>fxx[nn]>>fcaq[0][nn]>>fcaq[1][nn]>>fcaq[2][nn]>>fcaq[3][nn]>>
171 fcaq[4][nn]>>fcaq[5][nn]>>fcaq[6][nn]>>fcaq[7][nn]>>fcaq[8][nn]>>
172 fcaq[9][nn]>>fcaq[10][nn]>>fcaq[11][nn]>>fcaq[12][nn]>>fcaq[13][nn]>>
173 fcaq[14][nn]>>fcaq[15][nn]>>fcaq[16][nn]>>fcaq[17][nn]>>fcaq[18][nn]>>
174 fcaq[19][nn]>>fcaq[20][nn]>>fcaq[21][nn]>>fcaq[22][nn]>>fcaq[23][nn]>>
175 fcaq[24][nn]>>fcaq[25][nn]>>fcaq[26][nn]>>fcaq[27][nn]>>fcaq[28][nn]>>
176 fcaq[29][nn]>>fcaq[30][nn]>>fcaq[31][nn]>>fcaq[32][nn]>>fcaq[33][nn])
183 while(fincont>>fxxg[nn]>>fcag[0][nn]>>fcag[1][nn]>>fcag[2][nn]>>fcag[3][nn]>>
184 fcag[4][nn]>>fcag[5][nn]>>fcag[6][nn]>>fcag[7][nn]>>fcag[8][nn]>>
185 fcag[9][nn]>>fcag[10][nn]>>fcag[11][nn]>>fcag[12][nn]>>fcag[13][nn]>>
186 fcag[14][nn]>>fcag[15][nn]>>fcag[16][nn]>>fcag[17][nn]>>fcag[18][nn]>>
187 fcag[19][nn]>>fcag[20][nn]>>fcag[21][nn]>>fcag[22][nn]>>fcag[23][nn]>>
188 fcag[24][nn]>>fcag[25][nn]>>fcag[26][nn]>>fcag[27][nn]>>fcag[28][nn]>>
189 fcag[29][nn]>>fcag[30][nn]>>fcag[31][nn]>>fcag[32][nn]>>fcag[33][nn])
196 snprintf(fname,1024, "%s",gSystem->ExpandPathName(discall));
197 //PH ifstream findisc(fname);
198 fstream findisc(fname,ios::in);
199 #if defined(__HP_aCC) || defined(__DECCXX)
200 if(!findisc.rdbuf()->is_open()) return -1;
202 if(!findisc.is_open()) return -1;
206 while(findisc>>frrr[nn]>>fdaq[nn]) {
211 while(findisc>>frrrg[nn]>>fdag[nn]) {
216 fTablesLoaded = kTRUE;
221 C***************************************************************************
222 C Quenching Weights for Multiple Soft Scattering
227 C Carlos A. Salgado and Urs A. Wiedemann, hep-ph/0302184.
229 C Carlos A. Salgado and Urs A. Wiedemann Phys.Rev.Lett.89:092303,2002.
232 C This package contains quenching weights for gluon radiation in the
233 C multiple soft scattering approximation.
235 C swqmult returns the quenching weight for a quark (ipart=1) or
236 C a gluon (ipart=2) traversing a medium with transport coeficient q and
237 C length L. The input values are rrrr=0.5*q*L^3 and xxxx=w/wc, where
238 C wc=0.5*q*L^2 and w is the energy radiated. The output values are
239 C the continuous and discrete (prefactor of the delta function) parts
240 C of the quenching weights.
242 C In order to use this routine, the files cont.all and disc.all need to be
243 C in the working directory.
245 C An initialization of the tables is needed by doing call initmult before
248 C Please, send us any comment:
250 C urs.wiedemann@cern.ch
251 C carlos.salgado@cern.ch
254 C-------------------------------------------------------------------
256 SUBROUTINE swqmult(ipart,rrrr,xxxx,continuous,discrete)
258 REAL*8 xx(400), daq(34), caq(34,261), rrr(34)
259 COMMON /dataqua/ xx, daq, caq, rrr
261 REAL*8 xxg(400), dag(34), cag(34,261), rrrg(34)
262 COMMON /dataglu/ xxg, dag, cag, rrrg
264 REAL*8 rrrr,xxxx, continuous, discrete
266 INTEGER nrlow, nrhigh, nxlow, nxhigh
267 REAL*8 rrhigh, rrlow, rfraclow, rfrachigh
268 REAL*8 xfraclow, xfrachigh
279 if (rrin.lt.rrr(nr)) then
291 rfraclow = (rrhigh-rrin)/(rrhigh-rrlow)
292 rfrachigh = (rrin-rrlow)/(rrhigh-rrlow)
293 if (rrin.gt.10000d0) then
294 rfraclow = dlog(rrhigh/rrin)/dlog(rrhigh/rrlow)
295 rfrachigh = dlog(rrin/rrlow)/dlog(rrhigh/rrlow)
298 if (ipart.eq.1.and.rrin.ge.rrr(1)) then
305 if (ipart.ne.1.and.rrin.ge.rrrg(1)) then
312 if (xxxx.ge.xx(261)) go to 245
314 nxlow = int(xxin/0.01) + 1
316 xfraclow = (xx(nxhigh)-xxin)/0.01
317 xfrachigh = (xxin - xx(nxlow))/0.01
320 clow = xfraclow*caq(nrlow,nxlow)+xfrachigh*caq(nrlow,nxhigh)
321 chigh = xfraclow*caq(nrhigh,nxlow)+xfrachigh*caq(nrhigh,nxhigh)
323 clow = xfraclow*cag(nrlow,nxlow)+xfrachigh*cag(nrlow,nxhigh)
324 chigh = xfraclow*cag(nrhigh,nxlow)+xfrachigh*cag(nrhigh,nxhigh)
327 continuous = rfraclow*clow + rfrachigh*chigh
332 discrete = rfraclow*daq(nrlow) + rfrachigh*daq(nrhigh)
334 discrete = rfraclow*dag(nrlow) + rfrachigh*dag(nrhigh)
340 REAL*8 xxq(400), daq(34), caq(34,261), rrr(34)
341 COMMON /dataqua/ xxq, daq, caq, rrr
343 REAL*8 xxg(400), dag(34), cag(34,261), rrrg(34)
344 COMMON /dataglu/ xxg, dag, cag, rrrg
346 OPEN(UNIT=20,FILE='contnew.all',STATUS='OLD',ERR=90)
348 read (20,*) xxq(nn), caq(1,nn), caq(2,nn), caq(3,nn),
349 + caq(4,nn), caq(5,nn), caq(6,nn), caq(7,nn), caq(8,nn),
350 + caq(9,nn), caq(10,nn), caq(11,nn), caq(12,nn),
352 + caq(14,nn), caq(15,nn), caq(16,nn), caq(17,nn),
354 + caq(19,nn), caq(20,nn), caq(21,nn), caq(22,nn),
356 + caq(24,nn), caq(25,nn), caq(26,nn), caq(27,nn),
358 + caq(29,nn), caq(30,nn), caq(31,nn), caq(32,nn),
359 + caq(33,nn), caq(34,nn)
362 read (20,*) xxg(nn), cag(1,nn), cag(2,nn), cag(3,nn),
363 + cag(4,nn), cag(5,nn), cag(6,nn), cag(7,nn), cag(8,nn),
364 + cag(9,nn), cag(10,nn), cag(11,nn), cag(12,nn),
366 + cag(14,nn), cag(15,nn), cag(16,nn), cag(17,nn),
368 + cag(19,nn), cag(20,nn), cag(21,nn), cag(22,nn),
370 + cag(24,nn), cag(25,nn), cag(26,nn), cag(27,nn),
372 + cag(29,nn), cag(30,nn), cag(31,nn), cag(32,nn),
373 + cag(33,nn), cag(34,nn)
377 OPEN(UNIT=21,FILE='discnew.all',STATUS='OLD',ERR=91)
379 read (21,*) rrr(nn), daq(nn)
382 read (21,*) rrrg(nn), dag(nn)
387 90 PRINT*, 'input - output error'
388 91 PRINT*, 'input - output error #2'
394 =======================================================================
396 Adapted to ROOT macro by A. Dainese - 13/07/2003
397 Ported to class by C. Loizides - 12/02/2004
398 New version for extended R values added - 06/03/2004
401 Int_t AliQuenchingWeights::CalcMult(Int_t ipart, Double_t rrrr,Double_t xxxx,
402 Double_t &continuous,Double_t &discrete) const
404 // Calculate Multiple Scattering approx.
405 // weights for given parton type,
406 // rrrr=0.5*q*L^3 and xxxx=w/wc, wc=0.5*q*L^2
412 //read-in data before first call
414 Error("CalcMult","Tables are not loaded.");
418 Error("CalcMult","Tables are not loaded for Multiple Scattering.");
422 Double_t rrin = rrrr;
423 Double_t xxin = xxxx;
425 if(xxin>fxx[260]) return -1;
426 Int_t nxlow = (Int_t)(xxin/0.01) + 1;
427 Int_t nxhigh = nxlow + 1;
428 Double_t xfraclow = (fxx[nxhigh-1]-xxin)/0.01;
429 Double_t xfrachigh = (xxin - fxx[nxlow-1])/0.01;
432 if(rrin<=frrr[33]) rrin = 1.05*frrr[33]; // AD
433 if(rrin>=frrr[0]) rrin = 0.95*frrr[0]; // AD
435 Int_t nrlow=0,nrhigh=0;
436 Double_t rrhigh=0,rrlow=0;
437 for(Int_t nr=1; nr<=34; nr++) {
438 if(rrin<frrr[nr-1]) {
441 rrhigh = frrr[nr-1-1];
451 Double_t rfraclow = (rrhigh-rrin)/(rrhigh-rrlow);
452 Double_t rfrachigh = (rrin-rrlow)/(rrhigh-rrlow);
455 rfraclow = TMath::Log2(rrhigh/rrin)/TMath::Log2(rrhigh/rrlow);
456 rfrachigh = TMath::Log2(rrin/rrlow)/TMath::Log2(rrhigh/rrlow);
458 if((ipart==1) && (rrin>=frrr[0]))
465 if((ipart==2) && (rrin>=frrrg[0]))
473 //printf("R = %f,\nRlow = %f, Rhigh = %f,\nRfraclow = %f, Rfrachigh = %f\n",rrin,rrlow,rrhigh,rfraclow,rfrachigh); // AD
475 Double_t clow=0,chigh=0;
477 clow = xfraclow*fcaq[nrlow-1][nxlow-1]+xfrachigh*fcaq[nrlow-1][nxhigh-1];
478 chigh = xfraclow*fcaq[nrhigh-1][nxlow-1]+xfrachigh*fcaq[nrhigh-1][nxhigh-1];
480 clow = xfraclow*fcag[nrlow-1][nxlow-1]+xfrachigh*fcag[nrlow-1][nxhigh-1];
481 chigh = xfraclow*fcag[nrhigh-1][nxlow-1]+xfrachigh*fcag[nrhigh-1][nxhigh-1];
484 continuous = rfraclow*clow + rfrachigh*chigh;
485 //printf("rfraclow %f, clow %f, rfrachigh %f, chigh %f,\n continuous %f\n",
486 //rfraclow,clow,rfrachigh,chigh,continuous);
489 discrete = rfraclow*fdaq[nrlow-1] + rfrachigh*fdaq[nrhigh-1];
491 discrete = rfraclow*fdag[nrlow-1] + rfrachigh*fdag[nrhigh-1];
497 Int_t AliQuenchingWeights::InitSingleHard(const Char_t *contall,const Char_t *discall)
499 // read in tables for Single Hard Approx.
500 // path to continuum and to discrete part
502 fTablesLoaded = kFALSE;
506 snprintf(fname, 1024, "%s",gSystem->ExpandPathName(contall));
507 //PH ifstream fincont(fname);
508 fstream fincont(fname,ios::in);
509 #if defined(__HP_aCC) || defined(__DECCXX)
510 if(!fincont.rdbuf()->is_open()) return -1;
512 if(!fincont.is_open()) return -1;
516 while(fincont>>fxx[nn]>>fcaq[0][nn]>>fcaq[1][nn]>>fcaq[2][nn]>>fcaq[3][nn]>>
517 fcaq[4][nn]>>fcaq[5][nn]>>fcaq[6][nn]>>fcaq[7][nn]>>fcaq[8][nn]>>
518 fcaq[9][nn]>>fcaq[10][nn]>>fcaq[11][nn]>>fcaq[12][nn]>>
520 fcaq[14][nn]>>fcaq[15][nn]>>fcaq[16][nn]>>fcaq[17][nn]>>
522 fcaq[19][nn]>>fcaq[20][nn]>>fcaq[21][nn]>>fcaq[22][nn]>>
524 fcaq[24][nn]>>fcaq[25][nn]>>fcaq[26][nn]>>fcaq[27][nn]>>
533 while(fincont>>fxxg[nn]>>fcag[0][nn]>>fcag[1][nn]>>fcag[2][nn]>>fcag[3][nn]>>
534 fcag[4][nn]>>fcag[5][nn]>>fcag[6][nn]>>fcag[7][nn]>>fcag[8][nn]>>
535 fcag[9][nn]>>fcag[10][nn]>>fcag[11][nn]>>fcag[12][nn]>>
537 fcag[14][nn]>>fcag[15][nn]>>fcag[16][nn]>>fcag[17][nn]>>
539 fcag[19][nn]>>fcag[20][nn]>>fcag[21][nn]>>fcag[22][nn]>>
541 fcag[24][nn]>>fcag[25][nn]>>fcag[26][nn]>>fcag[27][nn]>>
549 snprintf(fname, 1024, "%s",gSystem->ExpandPathName(discall));
550 //PH ifstream findisc(fname);
551 fstream findisc(fname,ios::in);
552 #if defined(__HP_aCC) || defined(__DECCXX)
553 if(!findisc.rdbuf()->is_open()) return -1;
555 if(!findisc.is_open()) return -1;
559 while(findisc>>frrr[nn]>>fdaq[nn]) {
564 while(findisc>>frrrg[nn]>>fdag[nn]) {
570 fTablesLoaded = kTRUE;
575 C***************************************************************************
576 C Quenching Weights for Single Hard Scattering
581 C Carlos A. Salgado and Urs A. Wiedemann, hep-ph/0302184.
583 C Carlos A. Salgado and Urs A. Wiedemann Phys.Rev.Lett.89:092303,2002.
586 C This package contains quenching weights for gluon radiation in the
587 C single hard scattering approximation.
589 C swqlin returns the quenching weight for a quark (ipart=1) or
590 C a gluon (ipart=2) traversing a medium with Debye screening mass mu and
591 C length L. The input values are rrrr=0.5*mu^2*L^2 and xxxx=w/wc, where
592 C wc=0.5*mu^2*L and w is the energy radiated. The output values are
593 C the continuous and discrete (prefactor of the delta function) parts
594 C of the quenching weights.
596 C In order to use this routine, the files contlin.all and disclin.all
597 C need to be in the working directory.
599 C An initialization of the tables is needed by doing call initlin before
602 C Please, send us any comment:
604 C urs.wiedemann@cern.ch
605 C carlos.salgado@cern.ch
608 C-------------------------------------------------------------------
611 SUBROUTINE swqlin(ipart,rrrr,xxxx,continuous,discrete)
613 REAL*8 xx(400), dalq(30), calq(30,261), rrr(30)
614 COMMON /datalinqua/ xx, dalq, calq, rrr
616 REAL*8 xxlg(400), dalg(30), calg(30,261), rrrlg(30)
617 COMMON /datalinglu/ xxlg, dalg, calg, rrrlg
619 REAL*8 rrrr,xxxx, continuous, discrete
621 INTEGER nrlow, nrhigh, nxlow, nxhigh
622 REAL*8 rrhigh, rrlow, rfraclow, rfrachigh
623 REAL*8 xfraclow, xfrachigh
629 nxlow = int(xxin/0.038) + 1
631 xfraclow = (xx(nxhigh)-xxin)/0.038
632 xfrachigh = (xxin - xx(nxlow))/0.038
635 if (rrin.lt.rrr(nr)) then
647 rfraclow = (rrhigh-rrin)/(rrhigh-rrlow)
648 rfrachigh = (rrin-rrlow)/(rrhigh-rrlow)
651 clow = xfraclow*calq(nrlow,nxlow)+xfrachigh*calq(nrlow,nxhigh)
652 chigh = xfraclow*calq(nrhigh,nxlow)+xfrachigh*calq(nrhigh,nxhigh)
654 clow = xfraclow*calg(nrlow,nxlow)+xfrachigh*calg(nrlow,nxhigh)
655 chigh = xfraclow*calg(nrhigh,nxlow)+xfrachigh*calg(nrhigh,nxhigh)
658 continuous = rfraclow*clow + rfrachigh*chigh
661 discrete = rfraclow*dalq(nrlow) + rfrachigh*dalq(nrhigh)
663 discrete = rfraclow*dalg(nrlow) + rfrachigh*dalg(nrhigh)
669 REAL*8 xxlq(400), dalq(30), calq(30,261), rrr(30)
670 COMMON /datalinqua/ xxlq, dalq, calq, rrr
672 REAL*8 xxlg(400), dalg(30), calg(30,261), rrrlg(30)
673 COMMON /datalinglu/ xxlg, dalg, calg, rrrlg
675 OPEN(UNIT=20,FILE='contlin.all',STATUS='OLD',ERR=90)
677 read (20,*) xxlq(nn), calq(1,nn), calq(2,nn), calq(3,nn),
678 + calq(4,nn), calq(5,nn), calq(6,nn), calq(7,nn), calq(8,nn),
679 + calq(9,nn), calq(10,nn), calq(11,nn), calq(12,nn),
681 + calq(14,nn), calq(15,nn), calq(16,nn), calq(17,nn),
683 + calq(19,nn), calq(20,nn), calq(21,nn), calq(22,nn),
685 + calq(24,nn), calq(25,nn), calq(26,nn), calq(27,nn),
687 + calq(29,nn), calq(30,nn)
690 read (20,*) xxlg(nn), calg(1,nn), calg(2,nn), calg(3,nn),
691 + calg(4,nn), calg(5,nn), calg(6,nn), calg(7,nn), calg(8,nn),
692 + calg(9,nn), calg(10,nn), calg(11,nn), calg(12,nn),
694 + calg(14,nn), calg(15,nn), calg(16,nn), calg(17,nn),
696 + calg(19,nn), calg(20,nn), calg(21,nn), calg(22,nn),
698 + calg(24,nn), calg(25,nn), calg(26,nn), calg(27,nn),
700 + calg(29,nn), calg(30,nn)
704 OPEN(UNIT=21,FILE='disclin.all',STATUS='OLD',ERR=91)
706 read (21,*) rrr(nn), dalq(nn)
709 read (21,*) rrrlg(nn), dalg(nn)
714 90 PRINT*, 'input - output error'
715 91 PRINT*, 'input - output error #2'
720 =======================================================================
722 Ported to class by C. Loizides - 17/02/2004
726 Int_t AliQuenchingWeights::CalcSingleHard(Int_t ipart, Double_t rrrr,Double_t xxxx,
727 Double_t &continuous,Double_t &discrete) const
729 // calculate Single Hard approx.
730 // weights for given parton type,
731 // rrrr=0.5*mu^2*L^2 and xxxx=w/wc, wc=0.5*mu^2*L
733 // read-in data before first call
735 Error("CalcSingleHard","Tables are not loaded.");
739 Error("CalcSingleHard","Tables are not loaded for Single Hard Scattering.");
743 Double_t rrin = rrrr;
744 Double_t xxin = xxxx;
746 Int_t nxlow = (Int_t)(xxin/0.038) + 1;
747 Int_t nxhigh = nxlow + 1;
748 Double_t xfraclow = (fxx[nxhigh-1]-xxin)/0.038;
749 Double_t xfrachigh = (xxin - fxx[nxlow-1])/0.038;
752 if(rrin<=frrr[29]) rrin = 1.05*frrr[29]; // AD
753 if(rrin>=frrr[0]) rrin = 0.95*frrr[0]; // AD
755 Int_t nrlow=0,nrhigh=0;
756 Double_t rrhigh=0,rrlow=0;
757 for(Int_t nr=1; nr<=30; nr++) {
758 if(rrin<frrr[nr-1]) {
761 rrhigh = frrr[nr-1-1];
771 Double_t rfraclow = (rrhigh-rrin)/(rrhigh-rrlow);
772 Double_t rfrachigh = (rrin-rrlow)/(rrhigh-rrlow);
774 //printf("R = %f,\nRlow = %f, Rhigh = %f,\nRfraclow = %f, Rfrachigh = %f\n",rrin,rrlow,rrhigh,rfraclow,rfrachigh); // AD
776 Double_t clow=0,chigh=0;
778 clow = xfraclow*fcaq[nrlow-1][nxlow-1]+xfrachigh*fcaq[nrlow-1][nxhigh-1];
779 chigh = xfraclow*fcaq[nrhigh-1][nxlow-1]+xfrachigh*fcaq[nrhigh-1][nxhigh-1];
781 clow = xfraclow*fcag[nrlow-1][nxlow-1]+xfrachigh*fcag[nrlow-1][nxhigh-1];
782 chigh = xfraclow*fcag[nrhigh-1][nxlow-1]+xfrachigh*fcag[nrhigh-1][nxhigh-1];
785 continuous = rfraclow*clow + rfrachigh*chigh;
786 //printf("rfraclow %f, clow %f, rfrachigh %f, chigh %f,\n continuous %f\n",
787 // rfraclow,clow,rfrachigh,chigh,continuous);
790 discrete = rfraclow*fdaq[nrlow-1] + rfrachigh*fdaq[nrhigh-1];
792 discrete = rfraclow*fdag[nrlow-1] + rfrachigh*fdag[nrhigh-1];
798 Int_t AliQuenchingWeights::CalcMult(Int_t ipart,
799 Double_t w,Double_t qtransp,Double_t length,
800 Double_t &continuous,Double_t &discrete) const
802 // Calculate Multiple Scattering approx.
803 // weights for given parton type,
804 // rrrr=0.5*q*L^3 and xxxx=w/wc, wc=0.5*q*L^2
806 Double_t wc=CalcWC(qtransp,length);
807 Double_t rrrr=CalcR(wc,length);
809 return CalcMult(ipart,rrrr,xxxx,continuous,discrete);
812 Int_t AliQuenchingWeights::CalcSingleHard(Int_t ipart,
813 Double_t w,Double_t mu,Double_t length,
814 Double_t &continuous,Double_t &discrete) const
816 // calculate Single Hard approx.
817 // weights for given parton type,
818 // rrrr=0.5*mu^2*L^2 and xxxx=w/wc, wc=0.5*mu^2*L
820 Double_t wcbar=CalcWCbar(mu,length);
821 Double_t rrrr=CalcR(wcbar,length);
822 Double_t xxxx=w/wcbar;
823 return CalcSingleHard(ipart,rrrr,xxxx,continuous,discrete);
826 Double_t AliQuenchingWeights::CalcR(Double_t wc, Double_t l) const
828 //calculate r value and
829 //check if it is less then maximum
831 Double_t r = wc*l*fgkConvFmToInvGeV;
833 Warning("CalcR","Value of r = %.2f; should be less than %.2f", r, fgkRMax);
839 Double_t AliQuenchingWeights::CalcRk(Double_t k, Double_t I0, Double_t I1) const
841 //calculate R value and
842 //check if it is less then maximum
844 Double_t r = fgkRMax-1;
848 Warning("CalcRk","Value of r = %.2f; should be less than %.2f",r,fgkRMax);
854 Double_t AliQuenchingWeights::GetELossRandom(Int_t ipart, Double_t length, Double_t e) const
856 // return DeltaE for MS or SH scattering
857 // for given parton type, length and energy
858 // Dependant on ECM (energy constraint method)
859 // e is used to determine where to set bins to zero.
862 Fatal("GetELossRandom","Call SampleEnergyLoss method before!");
865 if((ipart<1) || (ipart>2)) {
866 Fatal("GetELossRandom","ipart =%d; but has to be 1 (quark) or 2 (gluon)",ipart);
870 Int_t l=GetIndex(length);
873 if(fECMethod==kReweight){
877 ret=fHistos[ipart-1][l-1]->GetRandom();
879 Warning("GetELossRandom",
880 "Aborted reweighting; maximum loss assigned after 1e6 trials.");
887 Double_t ret=fHistos[ipart-1][l-1]->GetRandom();
892 Double_t AliQuenchingWeights::CalcQuenchedEnergy(Int_t ipart, Double_t length, Double_t e) const
894 //return quenched parton energy
895 //for given parton type, length and energy
897 Double_t loss=GetELossRandom(ipart,length,e);
901 Double_t AliQuenchingWeights::GetELossRandom(Int_t ipart, TH1F *hell, Double_t e) const
903 // return DeltaE for MS or SH scattering
904 // for given parton type, length distribution and energy
905 // Dependant on ECM (energy constraint method)
906 // e is used to determine where to set bins to zero.
909 Warning("GetELossRandom","Pointer to length distribution is NULL.");
912 Double_t ell=hell->GetRandom();
913 return GetELossRandom(ipart,ell,e);
916 Double_t AliQuenchingWeights::CalcQuenchedEnergy(Int_t ipart, TH1F *hell, Double_t e) const
918 //return quenched parton energy
919 //for given parton type, length distribution and energy
921 Double_t loss=GetELossRandom(ipart,hell,e);
925 Double_t AliQuenchingWeights::GetELossRandomK(Int_t ipart, Double_t I0, Double_t I1, Double_t e)
927 // return DeltaE for new dynamic version
928 // for given parton type, I0 and I1 value and energy
929 // Dependant on ECM (energy constraint method)
930 // e is used to determine where to set bins to zero.
932 // read-in data before first call
934 Fatal("GetELossRandomK","Tables are not loaded.");
937 if((ipart<1) || (ipart>2)) {
938 Fatal("GetELossRandomK","ipart =%d; but has to be 1 (quark) or 2 (gluon)",ipart);
942 Double_t r=CalcRk(I0,I1);
944 Fatal("GetELossRandomK","R should not be negative");
947 Double_t wc=CalcWCk(I1);
949 Fatal("GetELossRandomK","wc should be greater than zero");
952 if(SampleEnergyLoss(ipart,r)!=0){
953 Fatal("GetELossRandomK","Could not sample energy loss");
957 if(fECMethod==kReweight){
961 ret=fHisto->GetRandom();
963 Warning("GetELossRandomK",
964 "Aborted reweighting; maximum loss assigned after 1e6 trials.");
972 Double_t ret=fHisto->GetRandom()*wc;
977 Double_t AliQuenchingWeights::CalcQuenchedEnergyK(Int_t ipart, Double_t I0, Double_t I1, Double_t e)
979 //return quenched parton energy
980 //for given parton type, I0 and I1 value and energy
982 Double_t loss=GetELossRandomK(ipart,I0,I1,e);
986 Double_t AliQuenchingWeights::GetELossRandomKFast(Int_t ipart, Double_t I0, Double_t I1, Double_t e)
988 // return DeltaE for new dynamic version
989 // for given parton type, I0 and I1 value and energy
990 // Dependant on ECM (energy constraint method)
991 // e is used to determine where to set bins to zero.
992 // method is optimized and should only be used if
993 // all parameters are well within the bounds.
994 // read-in data tables before first call
996 Double_t r=CalcRk(I0,I1);
1001 Double_t wc=CalcWCk(I1);
1006 return GetELossRandomKFastR(ipart,r,wc,e);
1009 Double_t AliQuenchingWeights::GetELossRandomKFastR(Int_t ipart, Double_t r, Double_t wc, Double_t e)
1011 // return DeltaE for new dynamic version
1012 // for given parton type, R and wc value and energy
1013 // Dependant on ECM (energy constraint method)
1014 // e is used to determine where to set bins to zero.
1015 // method is optimized and should only be used if
1016 // all parameters are well within the bounds.
1017 // read-in data tables before first call
1023 Double_t discrete=0.;
1024 Double_t continuous=0.;
1026 Double_t xxxx = fHisto->GetBinCenter(bin);
1028 CalcMult(ipart,r,xxxx,continuous,discrete);
1030 CalcSingleHard(ipart,r,xxxx,continuous,discrete);
1033 return 0.; //no energy loss
1036 fHisto->SetBinContent(bin,continuous);
1037 Int_t kbinmax=fHisto->FindBin(e/wc);
1038 if(kbinmax>=fgkBins) kbinmax=fgkBins-1;
1039 if(kbinmax==1) return e; //maximum energy loss
1042 for(bin=2; bin<=kbinmax; bin++) {
1043 xxxx = fHisto->GetBinCenter(bin);
1044 CalcMult(ipart,r,xxxx,continuous,discrete);
1045 fHisto->SetBinContent(bin,continuous);
1048 for(bin=2; bin<=kbinmax; bin++) {
1049 xxxx = fHisto->GetBinCenter(bin);
1050 CalcSingleHard(ipart,r,xxxx,continuous,discrete);
1051 fHisto->SetBinContent(bin,continuous);
1055 if(fECMethod==kReweight){
1056 fHisto->SetBinContent(kbinmax+1,0);
1057 fHisto->Fill(0.,discrete*fgkBins/fgkMaxBin);
1058 } else if (fECMethod==kReweightCont) {
1059 fHisto->SetBinContent(kbinmax+1,0);
1060 const Double_t kdelta=fHisto->Integral(1,kbinmax);
1061 fHisto->Scale(1./kdelta*(1-discrete));
1062 fHisto->Fill(0.,discrete);
1064 const Double_t kdelta=fHisto->Integral(1,kbinmax);
1065 Double_t val=discrete*fgkBins/fgkMaxBin;
1066 fHisto->Fill(0.,val);
1067 fHisto->SetBinContent(kbinmax+1,(1-discrete)*fgkBins/fgkMaxBin-kdelta);
1069 for(bin=kbinmax+2; bin<=fgkBins; bin++) {
1070 fHisto->SetBinContent(bin,0);
1072 //cout << kbinmax << " " << discrete << " " << fHisto->Integral() << endl;
1073 Double_t ret=fHisto->GetRandom()*wc;
1078 Double_t AliQuenchingWeights::CalcQuenchedEnergyKFast(Int_t ipart, Double_t I0, Double_t I1, Double_t e)
1080 //return quenched parton energy (fast method)
1081 //for given parton type, I0 and I1 value and energy
1083 Double_t loss=GetELossRandomKFast(ipart,I0,I1,e);
1087 Double_t AliQuenchingWeights::GetDiscreteWeight(Int_t ipart, Double_t I0, Double_t I1)
1089 // return discrete weight
1091 Double_t r=CalcRk(I0,I1);
1095 return GetDiscreteWeightR(ipart,r);
1098 Double_t AliQuenchingWeights::GetDiscreteWeightR(Int_t ipart, Double_t r)
1100 // return discrete weight
1106 Double_t discrete=0.;
1107 Double_t continuous=0.;
1109 Double_t xxxx = fHisto->GetBinCenter(bin);
1111 CalcMult(ipart,r,xxxx,continuous,discrete);
1113 CalcSingleHard(ipart,r,xxxx,continuous,discrete);
1117 void AliQuenchingWeights::GetZeroLossProb(Double_t &p,Double_t &prw,Double_t &prwcont,
1118 Int_t ipart,Double_t I0,Double_t I1,Double_t e)
1120 //calculate the probabilty that there is no energy
1121 //loss for different ways of energy constraint
1122 p=1.;prw=1.;prwcont=1.;
1123 Double_t r=CalcRk(I0,I1);
1127 Double_t wc=CalcWCk(I1);
1131 GetZeroLossProbR(p,prw,prwcont,ipart,r,wc,e);
1134 void AliQuenchingWeights::GetZeroLossProbR(Double_t &p,Double_t &prw,Double_t &prwcont,
1135 Int_t ipart, Double_t r,Double_t wc,Double_t e)
1137 //calculate the probabilty that there is no energy
1138 //loss for different ways of energy constraint
1143 Double_t discrete=0.;
1144 Double_t continuous=0.;
1146 Int_t kbinmax=fHisto->FindBin(e/wc);
1147 if(kbinmax>=fgkBins) kbinmax=fgkBins-1;
1149 for(Int_t bin=1; bin<=kbinmax; bin++) {
1150 Double_t xxxx = fHisto->GetBinCenter(bin);
1151 CalcMult(ipart,r,xxxx,continuous,discrete);
1152 fHisto->SetBinContent(bin,continuous);
1155 for(Int_t bin=1; bin<=kbinmax; bin++) {
1156 Double_t xxxx = fHisto->GetBinCenter(bin);
1157 CalcSingleHard(ipart,r,xxxx,continuous,discrete);
1158 fHisto->SetBinContent(bin,continuous);
1162 //non-reweighted P(Delta E = 0)
1163 const Double_t kdelta=fHisto->Integral(1,kbinmax);
1164 Double_t val=discrete*fgkBins/fgkMaxBin;
1165 fHisto->Fill(0.,val);
1166 fHisto->SetBinContent(kbinmax+1,(1-discrete)*fgkBins/fgkMaxBin-kdelta);
1167 Double_t hint=fHisto->Integral(1,kbinmax+1);
1168 p=fHisto->GetBinContent(1)/hint;
1171 hint=fHisto->Integral(1,kbinmax);
1172 prw=fHisto->GetBinContent(1)/hint;
1174 Double_t xxxx = fHisto->GetBinCenter(1);
1175 CalcMult(ipart,r,xxxx,continuous,discrete);
1176 fHisto->SetBinContent(1,continuous);
1177 hint=fHisto->Integral(1,kbinmax);
1178 fHisto->Scale(1./hint*(1-discrete));
1179 fHisto->Fill(0.,discrete);
1180 prwcont=fHisto->GetBinContent(1);
1183 Int_t AliQuenchingWeights::SampleEnergyLoss()
1185 // Has to be called to fill the histograms
1187 // For stored values fQTransport loop over
1188 // particle type and length = 1 to fMaxLength (fm)
1189 // to fill energy loss histos
1191 // Take histogram of continuous weights
1192 // Take discrete_weight
1193 // If discrete_weight > 1, put all channels to 0, except channel 1
1194 // Fill channel 1 with discrete_weight/(1-discrete_weight)*integral
1196 // read-in data before first call
1198 Error("SampleEnergyLoss","Tables are not loaded.");
1203 Int_t lmax=CalcLengthMax(fQTransport);
1204 if(fLengthMax>lmax){
1205 Info("SampleEnergyLoss","Maximum length changed from %d to %d;\nin order to have R < %.f",fLengthMax,lmax,fgkRMax);
1209 Warning("SampleEnergyLoss","Maximum length not checked,\nbecause SingeHard is not yet tested.");
1213 fHistos=new TH1F**[2];
1214 fHistos[0]=new TH1F*[4*fLengthMax];
1215 fHistos[1]=new TH1F*[4*fLengthMax];
1216 fLengthMaxOld=fLengthMax; //remember old value in case
1217 //user wants to reset
1220 Char_t meddesc[100];
1222 medvalue=(Int_t)(fQTransport*1000.);
1223 snprintf(meddesc, 100, "MS");
1225 medvalue=(Int_t)(fMu*1000.);
1226 snprintf(meddesc, 100, "SH");
1229 for(Int_t ipart=1;ipart<=2;ipart++){
1230 for(Int_t l=1;l<=4*fLengthMax;l++){
1232 snprintf(hname, 100, "hDisc-ContQW_%s_%d_%d_%d_%d",meddesc,fInstanceNumber,ipart,medvalue,l);
1234 Double_t wc = CalcWC(len);
1235 fHistos[ipart-1][l-1] = new TH1F(hname,hname,fgkBins,0.,fgkMaxBin*wc);
1236 fHistos[ipart-1][l-1]->SetXTitle("#Delta E [GeV]");
1237 fHistos[ipart-1][l-1]->SetYTitle("p(#Delta E)");
1238 fHistos[ipart-1][l-1]->SetLineColor(4);
1240 Double_t rrrr = CalcR(wc,len);
1241 Double_t discrete=0.;
1242 // loop on histogram channels
1243 for(Int_t bin=1; bin<=fgkBins; bin++) {
1244 Double_t xxxx = fHistos[ipart-1][l-1]->GetBinCenter(bin)/wc;
1245 Double_t continuous;
1247 CalcMult(ipart,rrrr,xxxx,continuous,discrete);
1249 CalcSingleHard(ipart,rrrr,xxxx,continuous,discrete);
1250 fHistos[ipart-1][l-1]->SetBinContent(bin,continuous);
1252 // add discrete part to distribution
1254 for(Int_t bin=2;bin<=fgkBins;bin++)
1255 fHistos[ipart-1][l-1]->SetBinContent(bin,0.);
1257 Double_t val=discrete/(1.-discrete)*fHistos[ipart-1][l-1]->Integral(1,fgkBins);
1258 fHistos[ipart-1][l-1]->Fill(0.,val);
1260 Double_t hint=fHistos[ipart-1][l-1]->Integral(1,fgkBins);
1261 fHistos[ipart-1][l-1]->Scale(1./hint);
1267 Int_t AliQuenchingWeights::SampleEnergyLoss(Int_t ipart, Double_t r)
1269 // Sample energy loss directly for one particle type
1270 // choses R (safe it and keep it until next call of function)
1272 // read-in data before first call
1274 Error("SampleEnergyLoss","Tables are not loaded.");
1278 Double_t discrete=0.;
1279 Double_t continuous=0;;
1281 Double_t xxxx = fHisto->GetBinCenter(bin);
1283 CalcMult(ipart,r,xxxx,continuous,discrete);
1285 CalcSingleHard(ipart,r,xxxx,continuous,discrete);
1288 fHisto->SetBinContent(1,1.);
1289 for(bin=2;bin<=fgkBins;bin++)
1290 fHisto->SetBinContent(bin,0.);
1294 fHisto->SetBinContent(bin,continuous);
1295 for(bin=2; bin<=fgkBins; bin++) {
1296 xxxx = fHisto->GetBinCenter(bin);
1298 CalcMult(ipart,r,xxxx,continuous,discrete);
1300 CalcSingleHard(ipart,r,xxxx,continuous,discrete);
1301 fHisto->SetBinContent(bin,continuous);
1304 Double_t val=discrete/(1.-discrete)*fHisto->Integral(1,fgkBins);
1305 fHisto->Fill(0.,val);
1306 Double_t hint=fHisto->Integral(1,fgkBins);
1308 fHisto->Scale(1./hint);
1310 //cout << discrete << " " << hint << " " << continuous << endl;
1316 const TH1F* AliQuenchingWeights::GetHisto(Int_t ipart,Double_t length) const
1318 //return quenching histograms
1319 //for ipart and length
1322 Fatal("GetELossRandom","Call SampleEnergyLoss method before!");
1325 if((ipart<1) || (ipart>2)) {
1326 Fatal("GetELossRandom","ipart =%d; but has to be 1 (quark) or 2 (gluon)",ipart);
1330 Int_t l=GetIndex(length);
1332 return fHistos[ipart-1][l-1];
1335 TH1F* AliQuenchingWeights::ComputeQWHisto(Int_t ipart,Double_t medval,Double_t length) const
1337 // ipart = 1 for quark, 2 for gluon
1338 // medval a) qtransp = transport coefficient (GeV^2/fm)
1339 // b) mu = Debye mass (GeV)
1340 // length = path length in medium (fm)
1341 // Get from SW tables:
1342 // - continuous weight, as a function of dE/wc
1345 Char_t meddesc[100];
1347 wc=CalcWC(medval,length);
1348 snprintf(meddesc, 100, "MS");
1350 wc=CalcWCbar(medval,length);
1351 snprintf(meddesc, 100, "SH");
1355 snprintf(hname, 100, "hContQWHisto_%s_%d_%d_%d",meddesc,ipart,
1356 (Int_t)(medval*1000.),(Int_t)length);
1358 TH1F *hist = new TH1F("hist",hname,fgkBins,0.,fgkMaxBin*wc);
1359 hist->SetXTitle("#Delta E [GeV]");
1360 hist->SetYTitle("p(#Delta E)");
1361 hist->SetLineColor(4);
1363 Double_t rrrr = CalcR(wc,length);
1364 //loop on histogram channels
1365 for(Int_t bin=1; bin<=fgkBins; bin++) {
1366 Double_t xxxx = hist->GetBinCenter(bin)/wc;
1367 Double_t continuous,discrete;
1369 if(fMultSoft) ret=CalcMult(ipart,rrrr,xxxx,continuous,discrete);
1370 else ret=CalcSingleHard(ipart,rrrr,xxxx,continuous,discrete);
1375 hist->SetBinContent(bin,continuous);
1380 TH1F* AliQuenchingWeights::ComputeQWHistoX(Int_t ipart,Double_t medval,Double_t length) const
1382 // ipart = 1 for quark, 2 for gluon
1383 // medval a) qtransp = transport coefficient (GeV^2/fm)
1384 // b) mu = Debye mass (GeV)
1385 // length = path length in medium (fm)
1386 // Get from SW tables:
1387 // - continuous weight, as a function of dE/wc
1390 Char_t meddesc[100];
1392 wc=CalcWC(medval,length);
1393 snprintf(meddesc, 100, "MS");
1395 wc=CalcWCbar(medval,length);
1396 snprintf(meddesc, 100, "SH");
1400 snprintf(hname, 100, "hContQWHistox_%s_%d_%d_%d",meddesc,ipart,
1401 (Int_t)(medval*1000.),(Int_t)length);
1403 TH1F *histx = new TH1F("histx",hname,fgkBins,0.,fgkMaxBin);
1404 histx->SetXTitle("x = #Delta E/#omega_{c}");
1406 histx->SetYTitle("p(#Delta E/#omega_{c})");
1408 histx->SetYTitle("p(#Delta E/#bar#omega_{c})");
1409 histx->SetLineColor(4);
1411 Double_t rrrr = CalcR(wc,length);
1412 //loop on histogram channels
1413 for(Int_t bin=1; bin<=fgkBins; bin++) {
1414 Double_t xxxx = histx->GetBinCenter(bin);
1415 Double_t continuous,discrete;
1417 if(fMultSoft) ret=CalcMult(ipart,rrrr,xxxx,continuous,discrete);
1418 else ret=CalcSingleHard(ipart,rrrr,xxxx,continuous,discrete);
1423 histx->SetBinContent(bin,continuous);
1428 TH1F* AliQuenchingWeights::ComputeQWHistoX(Int_t ipart,Double_t r) const
1430 // compute P(E) distribution for
1431 // given ipart = 1 for quark, 2 for gluon
1434 Char_t meddesc[100];
1436 snprintf(meddesc, 100, "MS");
1438 snprintf(meddesc, 100, "SH");
1442 snprintf(hname, 100, "hQWHistox_%s_%d_%.2f",meddesc,ipart,r);
1443 TH1F *histx = new TH1F("histx",hname,fgkBins,0.,fgkMaxBin);
1444 histx->SetXTitle("x = #Delta E/#omega_{c}");
1446 histx->SetYTitle("p(#Delta E/#omega_{c})");
1448 histx->SetYTitle("p(#Delta E/#bar#omega_{c})");
1449 histx->SetLineColor(4);
1452 Double_t continuous=0.,discrete=0.;
1453 //loop on histogram channels
1454 for(Int_t bin=1; bin<=fgkBins; bin++) {
1455 Double_t xxxx = histx->GetBinCenter(bin);
1457 if(fMultSoft) ret=CalcMult(ipart,rrrr,xxxx,continuous,discrete);
1458 else ret=CalcSingleHard(ipart,rrrr,xxxx,continuous,discrete);
1463 histx->SetBinContent(bin,continuous);
1466 //add discrete part to distribution
1468 for(Int_t bin=2;bin<=fgkBins;bin++)
1469 histx->SetBinContent(bin,0.);
1471 Double_t val=discrete/(1.-discrete)*histx->Integral(1,fgkBins);
1472 histx->Fill(0.,val);
1474 Double_t hint=histx->Integral(1,fgkBins);
1475 if(hint!=0) histx->Scale(1./hint);
1480 TH1F* AliQuenchingWeights::ComputeELossHisto(Int_t ipart,Double_t medval,Double_t l,Double_t e) const
1482 // compute energy loss histogram for
1483 // parton type, medium value, length and energy
1485 AliQuenchingWeights *dummy=new AliQuenchingWeights(*this);
1487 dummy->SetQTransport(medval);
1490 dummy->SetMu(medval);
1491 dummy->InitSingleHard();
1493 dummy->SampleEnergyLoss();
1498 snprintf(name, 100, "Energy Loss Distribution - Quarks;E_{loss} (GeV);#");
1499 snprintf(hname,100, "hLossQuarks");
1501 snprintf(name, 100, "Energy Loss Distribution - Gluons;E_{loss} (GeV);#");
1502 snprintf(hname, 100, "hLossGluons");
1505 TH1F *h = new TH1F(hname,name,250,0,250);
1506 for(Int_t i=0;i<100000;i++){
1507 //if(i % 1000 == 0) cout << "." << flush;
1508 Double_t loss=dummy->GetELossRandom(ipart,l,e);
1516 TH1F* AliQuenchingWeights::ComputeELossHisto(Int_t ipart,Double_t medval,TH1F *hEll,Double_t e) const
1518 // compute energy loss histogram for
1519 // parton type, medium value,
1520 // length distribution and energy
1522 AliQuenchingWeights *dummy=new AliQuenchingWeights(*this);
1524 dummy->SetQTransport(medval);
1527 dummy->SetMu(medval);
1528 dummy->InitSingleHard();
1530 dummy->SampleEnergyLoss();
1535 snprintf(name, 100, "Energy Loss Distribution - Quarks;E_{loss} (GeV);#");
1536 snprintf(hname,100, "hLossQuarks");
1538 snprintf(name,100, "Energy Loss Distribution - Gluons;E_{loss} (GeV);#");
1539 snprintf(hname, 100, "hLossGluons");
1542 TH1F *h = new TH1F(hname,name,250,0,250);
1543 for(Int_t i=0;i<100000;i++){
1544 //if(i % 1000 == 0) cout << "." << flush;
1545 Double_t loss=dummy->GetELossRandom(ipart,hEll,e);
1553 TH1F* AliQuenchingWeights::ComputeELossHisto(Int_t ipart,Double_t r) const
1555 // compute energy loss histogram for
1556 // parton type and given R
1558 TH1F *dummy = ComputeQWHistoX(ipart,r);
1559 if(!dummy) return 0;
1562 snprintf(hname, 100, "hELossHistox_%d_%.2f",ipart,r);
1563 TH1F *histx = new TH1F("histxr",hname,fgkBins,0.,fgkMaxBin);
1564 for(Int_t i=0;i<100000;i++){
1565 //if(i % 1000 == 0) cout << "." << flush;
1566 Double_t loss=dummy->GetRandom();
1573 Double_t AliQuenchingWeights::GetMeanELoss(Int_t ipart,Double_t medval,Double_t l) const
1575 // compute average energy loss for
1576 // parton type, medium value, length and energy
1578 TH1F *dummy = ComputeELossHisto(ipart,medval,l);
1579 if(!dummy) return 0;
1580 Double_t ret=dummy->GetMean();
1585 Double_t AliQuenchingWeights::GetMeanELoss(Int_t ipart,Double_t medval,TH1F *hEll) const
1587 // compute average energy loss for
1588 // parton type, medium value,
1589 // length distribution and energy
1591 TH1F *dummy = ComputeELossHisto(ipart,medval,hEll);
1592 if(!dummy) return 0;
1593 Double_t ret=dummy->GetMean();
1598 Double_t AliQuenchingWeights::GetMeanELoss(Int_t ipart,Double_t r) const
1600 // compute average energy loss over wc
1601 // for parton type and given R
1603 TH1F *dummy = ComputeELossHisto(ipart,r);
1604 if(!dummy) return 0;
1605 Double_t ret=dummy->GetMean();
1610 void AliQuenchingWeights::PlotDiscreteWeights(Double_t len,Double_t qm) const
1612 // plot discrete weights for given length
1616 c = new TCanvas("cdiscms","Discrete Weight for Multiple Scattering",0,0,500,400);
1618 c = new TCanvas("cdiscsh","Discrete Weight for Single Hard Scattering",0,0,500,400);
1621 TH2F *hframe = new TH2F("hdisc","",2,0,qm+.1,2,0,1.25);
1622 hframe->SetStats(0);
1624 hframe->SetXTitle("#hat{q} [GeV^{2}/fm]");
1626 hframe->SetXTitle("#mu [GeV]");
1627 //hframe->SetYTitle("Probability #Delta E = 0 , p_{0}");
1628 hframe->SetYTitle("p_{0} (discrete weight)");
1631 Int_t points=(Int_t)qm*4;
1632 TGraph *gq=new TGraph(points);
1635 for(Double_t q=0.05;q<=qm+.05;q+=0.25){
1637 CalcMult(1,1.0,q,len,cont,disc);
1638 gq->SetPoint(i,q,disc);i++;
1641 for(Double_t m=0.05;m<=qm+.05;m+=0.25){
1643 CalcSingleHard(1,1.0,m,len,cont, disc);
1644 gq->SetPoint(i,m,disc);i++;
1647 gq->SetMarkerStyle(20);
1648 gq->SetMarkerColor(1);
1649 gq->SetLineStyle(1);
1650 gq->SetLineColor(1);
1653 TGraph *gg=new TGraph(points);
1656 for(Double_t q=0.05;q<=qm+.05;q+=0.25){
1658 CalcMult(2,1.0,q,len,cont,disc);
1659 gg->SetPoint(i,q,disc);i++;
1662 for(Double_t m=0.05;m<=qm+.05;m+=0.25){
1664 CalcSingleHard(2,1.0,m,len,cont,disc);
1665 gg->SetPoint(i,m,disc);i++;
1668 gg->SetMarkerStyle(24);
1669 gg->SetMarkerColor(2);
1670 gg->SetLineStyle(2);
1671 gg->SetLineColor(2);
1674 TLegend *l1a = new TLegend(0.5,0.6,.95,0.8);
1675 l1a->SetFillStyle(0);
1676 l1a->SetBorderSize(0);
1678 snprintf(label, 100, "L = %.1f fm",len);
1679 l1a->AddEntry(gq,label,"");
1680 l1a->AddEntry(gq,"quark projectile","l");
1681 l1a->AddEntry(gg,"gluon projectile","l");
1687 void AliQuenchingWeights::PlotContWeights(Int_t itype,Double_t ell) const
1689 // plot continous weights for
1690 // given parton type and length
1697 snprintf(title, 1024, "Cont. Weight for Multiple Scattering - Quarks");
1699 snprintf(title, 1024, "Cont. Weight for Multiple Scattering - Gluons");
1701 medvals[0]=4;medvals[1]=1;medvals[2]=0.5;
1702 snprintf(name, 1024, "ccont-ms-%d",itype);
1705 snprintf(title, 1024, "Cont. Weight for Single Hard Scattering - Quarks");
1707 snprintf(title, 1024, "Cont. Weight for Single Hard Scattering - Gluons");
1709 medvals[0]=2;medvals[1]=1;medvals[2]=0.5;
1710 snprintf(name, 1024, "ccont-ms-%d",itype);
1713 TCanvas *c = new TCanvas(name,title,0,0,500,400);
1715 TH1F *h1=ComputeQWHisto(itype,medvals[0],ell);
1717 h1->SetTitle(title);
1719 h1->SetLineColor(1);
1721 TH1F *h2=ComputeQWHisto(itype,medvals[1],ell);
1723 h2->SetLineColor(2);
1724 h2->DrawCopy("SAME");
1725 TH1F *h3=ComputeQWHisto(itype,medvals[2],ell);
1727 h3->SetLineColor(3);
1728 h3->DrawCopy("SAME");
1730 TLegend *l1a = new TLegend(0.5,0.6,.95,0.8);
1731 l1a->SetFillStyle(0);
1732 l1a->SetBorderSize(0);
1734 snprintf(label, 100, "L = %.1f fm",ell);
1735 l1a->AddEntry(h1,label,"");
1737 snprintf(label, 100, "#hat{q} = %.1f GeV^{2}/fm",medvals[0]);
1738 l1a->AddEntry(h1,label,"pl");
1739 snprintf(label, 100, "#hat{q} = %.1f GeV^{2}/fm",medvals[1]);
1740 l1a->AddEntry(h2,label,"pl");
1741 snprintf(label, 100, "#hat{q} = %.1f GeV^{2}/fm",medvals[2]);
1742 l1a->AddEntry(h3, label,"pl");
1744 snprintf(label, 100, "#mu = %.1f GeV",medvals[0]);
1745 l1a->AddEntry(h1,label,"pl");
1746 snprintf(label, 100, "#mu = %.1f GeV",medvals[1]);
1747 l1a->AddEntry(h2,label,"pl");
1748 snprintf(label, 100, "#mu = %.1f GeV",medvals[2]);
1749 l1a->AddEntry(h3,label,"pl");
1756 void AliQuenchingWeights::PlotContWeightsVsL(Int_t itype,Double_t medval) const
1758 // plot continous weights for
1759 // given parton type and medium value
1765 snprintf(title,1024, "Cont. Weight for Multiple Scattering - Quarks");
1767 snprintf(title,1024, "Cont. Weight for Multiple Scattering - Gluons");
1769 snprintf(name,1024, "ccont2-ms-%d",itype);
1772 snprintf(title, 1024, "Cont. Weight for Single Hard Scattering - Quarks");
1774 snprintf(title, 1024, "Cont. Weight for Single Hard Scattering - Gluons");
1776 snprintf(name, 1024, "ccont2-sh-%d",itype);
1778 TCanvas *c = new TCanvas(name,title,0,0,500,400);
1780 TH1F *h1=ComputeQWHisto(itype,medval,8);
1782 h1->SetTitle(title);
1784 h1->SetLineColor(1);
1786 TH1F *h2=ComputeQWHisto(itype,medval,5);
1788 h2->SetLineColor(2);
1789 h2->DrawCopy("SAME");
1790 TH1F *h3=ComputeQWHisto(itype,medval,2);
1792 h3->SetLineColor(3);
1793 h3->DrawCopy("SAME");
1795 TLegend *l1a = new TLegend(0.5,0.6,.95,0.8);
1796 l1a->SetFillStyle(0);
1797 l1a->SetBorderSize(0);
1800 snprintf(label, 100, "#hat{q} = %.1f GeV^{2}/fm",medval);
1802 snprintf(label, 100, "#mu = %.1f GeV",medval);
1804 l1a->AddEntry(h1,label,"");
1805 l1a->AddEntry(h1,"L = 8 fm","pl");
1806 l1a->AddEntry(h2,"L = 5 fm","pl");
1807 l1a->AddEntry(h3,"L = 2 fm","pl");
1813 void AliQuenchingWeights::PlotAvgELoss(Double_t len,Double_t qm,Double_t e) const
1815 // plot average energy loss for given length
1816 // and parton energy
1819 Error("PlotAvgELoss","Tables are not loaded.");
1826 snprintf(title, 1024, "Average Energy Loss for Multiple Scattering");
1827 snprintf(name, 1024, "cavgelossms");
1829 snprintf(title, 1024, "Average Energy Loss for Single Hard Scattering");
1830 snprintf(name, 1024, "cavgelosssh");
1833 TCanvas *c = new TCanvas(name,title,0,0,500,400);
1835 TH2F *hframe = new TH2F("avgloss","",2,0,qm+.1,2,0,100);
1836 hframe->SetStats(0);
1838 hframe->SetXTitle("#hat{q} [GeV^{2}/fm]");
1840 hframe->SetXTitle("#mu [GeV]");
1841 hframe->SetYTitle("<E_{loss}> [GeV]");
1844 TGraph *gq=new TGraph(20);
1846 for(Double_t v=0.05;v<=qm+.05;v+=0.25){
1847 TH1F *dummy=ComputeELossHisto(1,v,len,e);
1848 Double_t avgloss=dummy->GetMean();
1849 gq->SetPoint(i,v,avgloss);i++;
1852 gq->SetMarkerStyle(21);
1855 Int_t points=(Int_t)qm*4;
1856 TGraph *gg=new TGraph(points);
1858 for(Double_t v=0.05;v<=qm+.05;v+=0.25){
1859 TH1F *dummy=ComputeELossHisto(2,v,len,e);
1860 Double_t avgloss=dummy->GetMean();
1861 gg->SetPoint(i,v,avgloss);i++;
1864 gg->SetMarkerStyle(20);
1865 gg->SetMarkerColor(2);
1868 TGraph *gratio=new TGraph(points);
1869 for(i=0;i<points;i++){
1871 gg->GetPoint(i,x,y);
1872 gq->GetPoint(i,x2,y2);
1874 gratio->SetPoint(i,x,y/y2*10/2.25);
1875 else gratio->SetPoint(i,x,0);
1877 gratio->SetLineStyle(4);
1879 TLegend *l1a = new TLegend(0.15,0.60,0.50,0.90);
1880 l1a->SetFillStyle(0);
1881 l1a->SetBorderSize(0);
1883 snprintf(label, 100, "L = %.1f fm",len);
1884 l1a->AddEntry(gq,label,"");
1885 l1a->AddEntry(gq,"quark projectile","pl");
1886 l1a->AddEntry(gg,"gluon projectile","pl");
1887 l1a->AddEntry(gratio,"gluon/quark/2.25*10","pl");
1893 void AliQuenchingWeights::PlotAvgELoss(TH1F *hEll,Double_t e) const
1895 // plot average energy loss for given
1896 // length distribution and parton energy
1899 Error("PlotAvgELossVs","Tables are not loaded.");
1906 snprintf(title, 1024, "Average Energy Loss for Multiple Scattering");
1907 snprintf(name, 1024, "cavgelossms2");
1909 snprintf(title, 1024, "Average Energy Loss for Single Hard Scattering");
1910 snprintf(name, 1024, "cavgelosssh2");
1913 TCanvas *c = new TCanvas(name,title,0,0,500,400);
1915 TH2F *hframe = new TH2F("havgloss",title,2,0,5.1,2,0,100);
1916 hframe->SetStats(0);
1918 hframe->SetXTitle("#hat{q} [GeV^{2}/fm]");
1920 hframe->SetXTitle("#mu [GeV]");
1921 hframe->SetYTitle("<E_{loss}> [GeV]");
1924 TGraph *gq=new TGraph(20);
1926 for(Double_t v=0.05;v<=5.05;v+=0.25){
1927 TH1F *dummy=ComputeELossHisto(1,v,hEll,e);
1928 Double_t avgloss=dummy->GetMean();
1929 gq->SetPoint(i,v,avgloss);i++;
1932 gq->SetMarkerStyle(20);
1935 TGraph *gg=new TGraph(20);
1937 for(Double_t v=0.05;v<=5.05;v+=0.25){
1938 TH1F *dummy=ComputeELossHisto(2,v,hEll,e);
1939 Double_t avgloss=dummy->GetMean();
1940 gg->SetPoint(i,v,avgloss);i++;
1943 gg->SetMarkerStyle(24);
1946 TGraph *gratio=new TGraph(20);
1949 gg->GetPoint(i,x,y);
1950 gq->GetPoint(i,x2,y2);
1952 gratio->SetPoint(i,x,y/y2*10/2.25);
1953 else gratio->SetPoint(i,x,0);
1955 gratio->SetLineStyle(4);
1958 TLegend *l1a = new TLegend(0.5,0.6,.95,0.8);
1959 l1a->SetFillStyle(0);
1960 l1a->SetBorderSize(0);
1962 snprintf(label, 100, "<L> = %.2f fm",hEll->GetMean());
1963 l1a->AddEntry(gq,label,"");
1964 l1a->AddEntry(gq,"quark","pl");
1965 l1a->AddEntry(gg,"gluon","pl");
1966 //l1a->AddEntry(gratio,"gluon/quark/2.25*10","pl");
1972 void AliQuenchingWeights::PlotAvgELossVsL(Double_t e) const
1974 // plot average energy loss versus ell
1977 Error("PlotAvgELossVsEll","Tables are not loaded.");
1985 snprintf(title, 1024, "Average Energy Loss for Multiple Scattering");
1986 snprintf(name, 1024, "cavgelosslms");
1989 snprintf(title, 1024, "Average Energy Loss for Single Hard Scattering");
1990 snprintf(name, 1024, "cavgelosslsh");
1994 TCanvas *c = new TCanvas(name,title,0,0,600,400);
1996 TH2F *hframe = new TH2F("avglossell",title,2,0,fLengthMax,2,0,250);
1997 hframe->SetStats(0);
1998 hframe->SetXTitle("length [fm]");
1999 hframe->SetYTitle("<E_{loss}> [GeV]");
2002 TGraph *gq=new TGraph((Int_t)fLengthMax*4);
2004 for(Double_t v=0.25;v<=fLengthMax;v+=0.25){
2005 TH1F *dummy=ComputeELossHisto(1,medval,v,e);
2006 Double_t avgloss=dummy->GetMean();
2007 gq->SetPoint(i,v,avgloss);i++;
2010 gq->SetMarkerStyle(20);
2013 TGraph *gg=new TGraph((Int_t)fLengthMax*4);
2015 for(Double_t v=0.25;v<=fLengthMax;v+=0.25){
2016 TH1F *dummy=ComputeELossHisto(2,medval,v,e);
2017 Double_t avgloss=dummy->GetMean();
2018 gg->SetPoint(i,v,avgloss);i++;
2021 gg->SetMarkerStyle(24);
2024 TGraph *gratio=new TGraph((Int_t)fLengthMax*4);
2025 for(i=0;i<=(Int_t)fLengthMax*4;i++){
2027 gg->GetPoint(i,x,y);
2028 gq->GetPoint(i,x2,y2);
2030 gratio->SetPoint(i,x,y/y2*100/2.25);
2031 else gratio->SetPoint(i,x,0);
2033 gratio->SetLineStyle(1);
2034 gratio->SetLineWidth(2);
2036 TLegend *l1a = new TLegend(0.15,0.65,.60,0.85);
2037 l1a->SetFillStyle(0);
2038 l1a->SetBorderSize(0);
2041 snprintf(label, 100, "#hat{q} = %.2f GeV^{2}/fm",medval);
2043 snprintf(label, 100, "#mu = %.2f GeV",medval);
2044 l1a->AddEntry(gq,label,"");
2045 l1a->AddEntry(gq,"quark","pl");
2046 l1a->AddEntry(gg,"gluon","pl");
2047 l1a->AddEntry(gratio,"gluon/quark/2.25*100","pl");
2050 TF1 *f=new TF1("f","100",0,fLengthMax);
2057 void AliQuenchingWeights::PlotAvgELossVsPt(Double_t medval,Double_t len) const
2059 // plot relative energy loss for given
2060 // length and parton energy versus pt
2063 Error("PlotAvgELossVsPt","Tables are not loaded.");
2070 snprintf(title, 1024, "Relative Energy Loss for Multiple Scattering");
2071 snprintf(name, 1024, "cavgelossvsptms");
2073 snprintf(title, 1024, "Relative Energy Loss for Single Hard Scattering");
2074 snprintf(name, 1024, "cavgelossvsptsh");
2077 TCanvas *c = new TCanvas(name,title,0,0,500,400);
2079 TH2F *hframe = new TH2F("havglossvspt",title,2,0,100,2,0,1);
2080 hframe->SetStats(0);
2081 hframe->SetXTitle("p_{T} [GeV]");
2082 hframe->SetYTitle("<E_{loss}>/p_{T} [GeV]");
2085 TGraph *gq=new TGraph(40);
2087 for(Double_t pt=2.5;pt<=100.05;pt+=2.5){
2088 TH1F *dummy=ComputeELossHisto(1,medval,len,pt);
2089 Double_t avgloss=dummy->GetMean();
2090 gq->SetPoint(i,pt,avgloss/pt);i++;
2093 gq->SetMarkerStyle(20);
2096 TGraph *gg=new TGraph(40);
2098 for(Double_t pt=2.5;pt<=100.05;pt+=2.5){
2099 TH1F *dummy=ComputeELossHisto(2,medval,len,pt);
2100 Double_t avgloss=dummy->GetMean();
2101 gg->SetPoint(i,pt,avgloss/pt);i++;
2104 gg->SetMarkerStyle(24);
2107 TLegend *l1a = new TLegend(0.5,0.6,.95,0.8);
2108 l1a->SetFillStyle(0);
2109 l1a->SetBorderSize(0);
2111 snprintf(label, 100, "L = %.1f fm",len);
2112 l1a->AddEntry(gq,label,"");
2113 l1a->AddEntry(gq,"quark","pl");
2114 l1a->AddEntry(gg,"gluon","pl");
2120 void AliQuenchingWeights::PlotAvgELossVsPt(Double_t medval,TH1F *hEll) const
2122 // plot relative energy loss for given
2123 // length distribution and parton energy versus pt
2126 Error("PlotAvgELossVsPt","Tables are not loaded.");
2133 snprintf(title, 1024, "Relative Energy Loss for Multiple Scattering");
2134 snprintf(name, 1024, "cavgelossvsptms2");
2136 snprintf(title, 1024, "Relative Energy Loss for Single Hard Scattering");
2137 snprintf(name, 1024, "cavgelossvsptsh2");
2139 TCanvas *c = new TCanvas(name,title,0,0,500,400);
2141 TH2F *hframe = new TH2F("havglossvspt",title,2,0,100,2,0,1);
2142 hframe->SetStats(0);
2143 hframe->SetXTitle("p_{T} [GeV]");
2144 hframe->SetYTitle("<E_{loss}>/p_{T} [GeV]");
2147 TGraph *gq=new TGraph(40);
2149 for(Double_t pt=2.5;pt<=100.05;pt+=2.5){
2150 TH1F *dummy=ComputeELossHisto(1,medval,hEll,pt);
2151 Double_t avgloss=dummy->GetMean();
2152 gq->SetPoint(i,pt,avgloss/pt);i++;
2155 gq->SetMarkerStyle(20);
2158 TGraph *gg=new TGraph(40);
2160 for(Double_t pt=2.5;pt<=100.05;pt+=2.5){
2161 TH1F *dummy=ComputeELossHisto(2,medval,hEll,pt);
2162 Double_t avgloss=dummy->GetMean();
2163 gg->SetPoint(i,pt,avgloss/pt);i++;
2166 gg->SetMarkerStyle(24);
2169 TLegend *l1a = new TLegend(0.5,0.6,.95,0.8);
2170 l1a->SetFillStyle(0);
2171 l1a->SetBorderSize(0);
2173 snprintf(label, 100, "<L> = %.2f fm",hEll->GetMean());
2174 l1a->AddEntry(gq,label,"");
2175 l1a->AddEntry(gq,"quark","pl");
2176 l1a->AddEntry(gg,"gluon","pl");
2182 Int_t AliQuenchingWeights::GetIndex(Double_t len) const
2184 //get the index according to length
2185 if(len>fLengthMax) len=fLengthMax;
2187 Int_t l=Int_t(len/0.25);
2188 if((len-l*0.25)>0.125) l++;