Skip to content

Commit 5d94890

Browse files
committed
Skip non-trackable particles when reading AliRoot kinematics
Generalize GeneratorFromFile to skip non-trackable particles (do not pass them to the primary generator) when reading from an external kinematics file. Later on -- when the MC stack has been improved to deal with non-trackable primaries -- we can make this a real configuration option.
1 parent 8e9dc77 commit 5d94890

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

Generators/include/Generators/GeneratorFromFile.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ class GeneratorFromFile : public FairGenerator
4444
// Set from which event to start
4545
void SetStartEvent(int start);
4646

47+
void SetSkipNonTrackable(bool b) { mSkipNonTrackable = b; }
4748
private:
4849
TFile* mEventFile = nullptr; //! the file containing the persistent events
4950
int mEventCounter = 0;
5051
int mEventsAvailable = 0;
52+
bool mSkipNonTrackable = true; //! whether to pass non-trackable (decayed particles) to the MC stack
5153

5254
ClassDefOverride(GeneratorFromFile, 1);
5355
};

Generators/src/GeneratorFromFile.cxx

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,16 @@ Bool_t GeneratorFromFile::ReadEvent(FairPrimaryGenerator* primGen)
7878
auto vy = primary->Vy();
7979
auto vz = primary->Vz();
8080

81-
auto parent = -1;
82-
bool wanttracking = true;
83-
auto e = primary->Energy();
84-
auto tof = primary->T();
85-
auto weight = primary->GetWeight();
86-
primGen->AddTrack(pdgid, px, py, pz, vx, vy, vz, parent, wanttracking, e, tof, weight);
81+
// a status of 1 means "trackable" in AliRoot kinematics
82+
auto status = primary->GetStatusCode();
83+
bool wanttracking = status == 1;
84+
if (wanttracking || !mSkipNonTrackable) {
85+
auto parent = -1;
86+
auto e = primary->Energy();
87+
auto tof = primary->T();
88+
auto weight = primary->GetWeight();
89+
primGen->AddTrack(pdgid, px, py, pz, vx, vy, vz, parent, wanttracking, e, tof, weight);
90+
}
8791
}
8892
mEventCounter++;
8993
return kTRUE;

0 commit comments

Comments
 (0)