X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=EVGEN%2FAliGenHaloProtvino.cxx;h=4466a194e37e2ee9f556687316d333efa80215ca;hb=397fe27aede6f10ed94c3481faa0faa25dcc42d6;hp=900ddda3ec78773f3932c28041d648c14937cb63;hpb=1c56e3114fc17d10b32a74e05c8ff88b22cda902;p=u%2Fmrichter%2FAliRoot.git diff --git a/EVGEN/AliGenHaloProtvino.cxx b/EVGEN/AliGenHaloProtvino.cxx index 900ddda3ec7..4466a194e37 100644 --- a/EVGEN/AliGenHaloProtvino.cxx +++ b/EVGEN/AliGenHaloProtvino.cxx @@ -29,6 +29,7 @@ #include #include +#include "AliLog.h" #include "AliGenHaloProtvino.h" #include "AliRun.h" @@ -81,25 +82,6 @@ AliGenHaloProtvino::AliGenHaloProtvino(Int_t npart) SetAnalog(0); } -AliGenHaloProtvino::AliGenHaloProtvino(const AliGenHaloProtvino & HaloProtvino): - AliGenerator(HaloProtvino), - fFile(0), - fFileName(0), - fSide(1), - fRunPeriod(kY3D90), - fTimePerEvent(1.e-4), - fNskip(0), - fZ1(0), - fZ2(0), - fG1(0), - fG2(0), - fGPASize(0) -{ -// Copy constructor - HaloProtvino.Copy(*this); -} - - //____________________________________________________________ AliGenHaloProtvino::~AliGenHaloProtvino() { @@ -142,8 +124,13 @@ void AliGenHaloProtvino::Init() Fatal("Init()", "No gas pressure file for given run period !"); } + FILE* file = 0; + if (name) file = fopen(name, "r"); + if (!file) { + AliError("No gas pressure file"); + return; + } - FILE* file = fopen(name, "r"); Float_t z; Int_t i; Float_t p[5]; @@ -152,6 +139,7 @@ void AliGenHaloProtvino::Init() const Float_t kFlux = 1.e11 / 25.e-9; // protons/s Float_t pFlux[5] = {0.2, 0.2, 0.3, 0.3, 1.0}; + Int_t ncols = 0; if (fRunPeriod < 5) { // // Ring 1 @@ -159,7 +147,9 @@ void AliGenHaloProtvino::Init() for (i = 0; i < fGPASize; i++) { - fscanf(file, "%f %f %f %f %f %f", &z, &p[0], &p[1], &p[2] , &p[3], &p[4]); + ncols = fscanf(file, "%f %f %f %f %f %f", &z, &p[0], &p[1], &p[2] , &p[3], &p[4]); + if (ncols<0) break; + fG1[i] = p[fRunPeriod]; if (i > 0) { @@ -173,7 +163,9 @@ void AliGenHaloProtvino::Init() // for (i = 0; i < fGPASize; i++) { - fscanf(file, "%f %f %f %f %f %f", &z, &p[0], &p[1], &p[2] , &p[3], &p[4]); + ncols = fscanf(file, "%f %f %f %f %f %f", &z, &p[0], &p[1], &p[2] , &p[3], &p[4]); + if (ncols<0) break; + fG2[i] = p[fRunPeriod]; if (i > 0) { fZ2[i] = fZ2[i-1] + z; @@ -193,7 +185,9 @@ void AliGenHaloProtvino::Init() } else { for (i = 0; i < fGPASize; i++) { - fscanf(file, "%f %e %e %e %e %e", &z, &p[0], &p[1], &p[2], &p[3], &p[4]); + ncols = fscanf(file, "%f %e %e %e %e %e", &z, &p[0], &p[1], &p[2], &p[3], &p[4]); + if (ncols<0) break; + z /= 1000.; fG1[i] = p[4] * kCrossSection * kFlux; // 1/m/s // 1/3 of nominal intensity at startup @@ -215,18 +209,18 @@ void AliGenHaloProtvino::Init() Float_t sum1 = 0.; Float_t sum2 = 0.; - for (Int_t i = 0; i < 300; i++) { - Float_t z = 20.+i*1.; - z*=100; - Float_t wgt1 = GasPressureWeight(z); - Float_t wgt2 = GasPressureWeight(-z); -// printf("weight: %f %f %f %f %f \n", z, wgt1, wgt2, fZ1[20], fZ2[20]); + for (Int_t iz = 0; iz < 300; iz++) { + Float_t zpos = 20. + iz * 1.; + zpos *= 100; + Float_t wgt1 = GasPressureWeight( zpos); + Float_t wgt2 = GasPressureWeight(-zpos); sum1 += wgt1; sum2 += wgt2; } sum1/=250.; sum2/=250.; printf("\n %f %f \n \n", sum1, sum2); + delete file; } //____________________________________________________________ @@ -278,12 +272,15 @@ void AliGenHaloProtvino::Generate() } // Count tracks nread++; - if (fNpart !=-1 && nread > fNpart) break; + if (fNpart !=-1 && nread >= fNpart) break; } // // Mean time between interactions // - Float_t dT = fTimePerEvent/nInt; // sec + + Float_t dT = 0.; // sec + if (nInt > 0) + dT = fTimePerEvent/nInt; Float_t t = 0; // sec // @@ -385,15 +382,6 @@ void AliGenHaloProtvino::Generate() } -AliGenHaloProtvino& AliGenHaloProtvino::operator=(const AliGenHaloProtvino& rhs) -{ -// Assignment operator - rhs.Copy(*this); - return *this; -} - - - Float_t AliGenHaloProtvino::GasPressureWeight(Float_t zPrimary) { // @@ -453,15 +441,6 @@ void AliGenHaloProtvino::Draw(Option_t *) } -void AliGenHaloProtvino::Copy(TObject&) const -{ - // - // Copy - // - Fatal("Copy","Not implemented!\n"); -} - - /* # Title: README file for the sources of IR8 machine induced background # Author: Vadim Talanov