} else {
printf("\n Opening of file %s failed, %p ! \n ", fFileName.Data(), (void*)fFile);
}
+
+ if (fNskip > 0) {
+ // Skip the first fNskip events
+ SkipEvents();
+ }
//
//
//
static Bool_t first = kTRUE;
static Int_t oldID = -1;
//
- if (first) {
- ReadNextParticle();
- first = kFALSE;
- oldID = fLossID;
- }
-
-
+
+ if (first && (fNskip == 0)) ReadNextParticle();
+ first = kFALSE;
+ oldID = fLossID;
while(1) {
// Push particle to stack
mass = TDatabasePDG::Instance()->GetParticle(fPdg)->Mass();
- p0 = TMath::Sqrt(fEkin * fEkin + 2.* mass * fEkin);
+ 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);
}
+
p[0] = p0 * fDX;
p[1] = p0 * fDY;
p[2] = p0 * tz;
origin[1] = fYS;
origin[2] = 1950.;
- PushTrack(fTrackIt , -1, fPdg , p, origin, polar, fTS, kPNoProcess, nt, fWS);
-
+ PushTrack(fTrackIt , -1, fPdg , p, origin, polar, fTS - 1950./2.9979e10, kPNoProcess, nt, fWS);
+
Int_t nc = ReadNextParticle();
if (fLossID != oldID || nc == 0) {
fTS *= 1.e-9;
return (ncols);
}
+
+void AliGenHalo::SkipEvents()
+{
+ //
+ // Skip the first fNskip events
+ Int_t skip = fNskip;
+ Int_t oldID = -1;
+
+ while (skip >= 0)
+ {
+ ReadNextParticle();
+ if (oldID != fLossID) {
+ oldID = fLossID;
+ skip--;
+ }
+ }
+}
+void AliGenHalo::CountEvents()
+{
+ 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);
+}
+
+