Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:15:12

0001 #include "QPileUpToy.h"
0002 #include <string>
0003 
0004 #include "TH3F.h"
0005 #include "TAxis.h"
0006 #include "TFile.h"
0007 #include "TMath.h"
0008 
0009 //=====================
0010 QPileUpToy::QPileUpToy(float gf, float mu, float rt, float eps, float rad) {
0011   fGasFactor = gf;
0012   fMultiplicity = mu;
0013   fDAQRate = rt;
0014   fEPS = eps;
0015   fRad = rad;
0016 }
0017 //=====================
0018 void QPileUpToy::Make() {
0019   InitMaps();
0020 
0021   //------------
0022   //STEER
0023   if(fDebug>0) printf("QPileUp is being computed from TOY MODEL ... ");
0024   float e0 = 8.854187817e-3; //[C]/[Vm]*1e+9
0025   double a=fMultiplicity*fDAQRate*e0*fGasFactor; // [fC]/[m]*1e+9;
0026   float b=100.0/fHalfLength; //[1/m]
0027   float c=2.0/3.0*fEPS;
0028   float d=-fRad;
0029   float f2 = TMath::Power(fOutterRadius/100,-1)/(-1) - TMath::Power(fInnerRadius/100,-1)/(-1);
0030   float fn = TMath::Power(fOutterRadius/100,d+1)/(d+1) - TMath::Power(fInnerRadius/100,d+1)/(d+1);
0031   float fd = f2/fn;
0032   if(fDebug>1) printf("\n2PI*rho(r,z) = a fd (1 - b|z| + c) r^d\n");
0033   if(fDebug>1) printf("a = %f\n",a);
0034   if(fDebug>1) printf("b = %f\n",b);
0035   if(fDebug>1) printf("c = %f\n",c);
0036   if(fDebug>1) printf("fd = %f\n",fd);
0037   if(fDebug>1) printf("d = %f\n",d);
0038   for(int r=0; r!=fNRadialSteps; ++r) {
0039     float dr = fRho->GetXaxis()->GetBinCenter( r+1 )/100.0; //[m]
0040     for(int z=0; z!=fNLongitudinalSteps; ++z) {
0041       float dz = fRho->GetZaxis()->GetBinCenter( z+1 )/100.0; //[m]
0042       for(int p=0; p!=fNAzimuthalSteps; ++p) {
0043     float dp = fRho->GetYaxis()->GetBinCenter( p+1 );
0044     float dRho = a*(1-b*TMath::Abs(dz)+c)*fd*TMath::Power(dr,d); //[fC]/[cm^3]
0045     fRho->SetBinContent(r+1,p+1,z+1,dRho);
0046     if(fDebug>2) printf("@{Ir,Ip,Iz}={%d (%f),%d (%f),%d (%f)}, rho %f\n",r,dr,p,dp,z,dz,dRho);
0047       }
0048     }
0049   }
0050   if(fDebug>0) printf("[DONE]\n");
0051   //------------
0052 
0053   SaveMaps();
0054 }