#include "AliGenHalo.h"
#include "AliRun.h"
+#include "AliLog.h"
ClassImp(AliGenHalo)
printf("\n File %s opened for reading, %p ! \n ", fFileName.Data(), (void*)fFile);
} else {
printf("\n Opening of file %s failed, %p ! \n ", fFileName.Data(), (void*)fFile);
+ return;
}
if (fNskip > 0) {
Fatal("Init()", "No gas pressure file for given run period !");
}
-
- FILE* file = fopen(name, "r");
+
+ FILE* file = 0;
+ if (name) file = fopen(name, "r");
+ if (!file) {
+ AliError("No gas pressure file");
+ return;
+ }
+
Float_t z;
Int_t i;
Float_t p[5];
sum1/=250.;
sum2/=250.;
printf("\n %f %f \n \n", sum1, sum2);
+ delete file;
}
//____________________________________________________________
mass = TDatabasePDG::Instance()->GetParticle(fPdg)->Mass();
p0 = TMath::Sqrt(fEkin * fEkin + 2. * mass * fEkin);
txy = TMath::Sqrt(fDX * fDX + fDY * fDY);
- if (txy == 1.) {
- tz = 0;
+ if (txy > 1.) {
+ tz = 0.;
} else {
tz = - TMath::Sqrt(1. - txy);
}
}
}
}
+void AliGenHalo::CountEvents()
+{
+ // Count total number of events
+ Int_t nev = 0;
+ Int_t oldID = -1;
+ Int_t nc = 1;
+ while (nc != -1)
+ {
+ nc = ReadNextParticle();
+ if (oldID != fLossID) {
+ oldID = fLossID;
+ nev++;
+ printf("Number of events %10d %10d \n", nev, oldID);
+ }
+ }
+
+
+ rewind(fFile);
+}
+
+