Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QPileUpToy.cxx
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file QPileUpToy.cxx
1 #include "QPileUpToy.h"
2 #include <string>
3 
4 #include "TH3F.h"
5 #include "TAxis.h"
6 #include "TFile.h"
7 #include "TMath.h"
8 
9 //=====================
10 QPileUpToy::QPileUpToy(float gf, float mu, float rt, float eps, float rad) {
11  fGasFactor = gf;
12  fMultiplicity = mu;
13  fDAQRate = rt;
14  fEPS = eps;
15  fRad = rad;
16 }
17 //=====================
19  InitMaps();
20 
21  //------------
22  //STEER
23  if(fDebug>0) printf("QPileUp is being computed from TOY MODEL ... ");
24  float e0 = 8.854187817e-3; //[C]/[Vm]*1e+9
25  double a=fMultiplicity*fDAQRate*e0*fGasFactor; // [fC]/[m]*1e+9;
26  float b=100.0/fHalfLength; //[1/m]
27  float c=2.0/3.0*fEPS;
28  float d=-fRad;
29  float f2 = TMath::Power(fOutterRadius/100,-1)/(-1) - TMath::Power(fInnerRadius/100,-1)/(-1);
30  float fn = TMath::Power(fOutterRadius/100,d+1)/(d+1) - TMath::Power(fInnerRadius/100,d+1)/(d+1);
31  float fd = f2/fn;
32  if(fDebug>1) printf("\n2PI*rho(r,z) = a fd (1 - b|z| + c) r^d\n");
33  if(fDebug>1) printf("a = %f\n",a);
34  if(fDebug>1) printf("b = %f\n",b);
35  if(fDebug>1) printf("c = %f\n",c);
36  if(fDebug>1) printf("fd = %f\n",fd);
37  if(fDebug>1) printf("d = %f\n",d);
38  for(int r=0; r!=fNRadialSteps; ++r) {
39  float dr = fRho->GetXaxis()->GetBinCenter( r+1 )/100.0; //[m]
40  for(int z=0; z!=fNLongitudinalSteps; ++z) {
41  float dz = fRho->GetZaxis()->GetBinCenter( z+1 )/100.0; //[m]
42  for(int p=0; p!=fNAzimuthalSteps; ++p) {
43  float dp = fRho->GetYaxis()->GetBinCenter( p+1 );
44  float dRho = a*(1-b*TMath::Abs(dz)+c)*fd*TMath::Power(dr,d); //[fC]/[cm^3]
45  fRho->SetBinContent(r+1,p+1,z+1,dRho);
46  if(fDebug>2) printf("@{Ir,Ip,Iz}={%d (%f),%d (%f),%d (%f)}, rho %f\n",r,dr,p,dp,z,dz,dRho);
47  }
48  }
49  }
50  if(fDebug>0) printf("[DONE]\n");
51  //------------
52 
53  SaveMaps();
54 }