Skip to content

Commit 27ac59a

Browse files
committed
Revert "Implementation of simulation inhibit-pause-trigger-continue features (AliceO2Group#5305)"
This reverts commit 004ed9f. Reverting since it breaks existing behaviour. Need to address one issue with Configurable param first.
1 parent 3231e3e commit 27ac59a

21 files changed

Lines changed: 30 additions & 461 deletions

DataFormats/simulation/include/SimulationDataFormat/MCTrack.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -329,8 +329,6 @@ inline MCTrackT<T>::MCTrackT(const TParticle& part)
329329
{
330330
// our convention is to communicate the process as (part) of the unique ID
331331
setProcess(part.GetUniqueID());
332-
// extract storage flag
333-
setStore(part.TestBit(ParticleStatus::kKeep));
334332
// extract toBeDone flag
335333
setToBeDone(part.TestBit(ParticleStatus::kToBeDone));
336334
// extract inhibited flag

DataFormats/simulation/include/SimulationDataFormat/Stack.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ class Stack : public FairGenericStack
9090

9191
void PushTrack(Int_t toBeDone, Int_t parentID, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e,
9292
Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz,
93-
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondParentId, Int_t daughter1Id, Int_t daughter2Id,
94-
TMCProcess proc2);
93+
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondParentId, Int_t daughter1Id, Int_t daughter2Id);
9594

9695
// similar function taking a particle
9796
void PushTrack(Int_t toBeDone, TParticle&);

DataFormats/simulation/src/Stack.cxx

Lines changed: 24 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@ Stack::Stack(Int_t size)
103103
if (!mTransportPrimary) {
104104
LOG(FATAL) << "Failed to retrieve external \'transportPrimary\' function: problem with configuration ";
105105
}
106-
LOG(INFO) << "Successfully retrieve external \'transportPrimary\' frunction: " << param.transportPrimaryFileName;
107106
} else {
108107
LOG(FATAL) << "unsupported \'trasportPrimary\' mode: " << param.transportPrimary;
109108
}
@@ -184,13 +183,12 @@ void Stack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode, Double_t px
184183
Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz,
185184
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondparentId)
186185
{
187-
PushTrack(toBeDone, parentId, pdgCode, px, py, pz, e, vx, vy, vz, time, polx, poly, polz, proc, ntr, weight, is, secondparentId, -1, -1, proc);
186+
PushTrack(toBeDone, parentId, pdgCode, px, py, pz, e, vx, vy, vz, time, polx, poly, polz, proc, ntr, weight, is, secondparentId, -1, -1);
188187
}
189188

190189
void Stack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode, Double_t px, Double_t py, Double_t pz, Double_t e,
191190
Double_t vx, Double_t vy, Double_t vz, Double_t time, Double_t polx, Double_t poly, Double_t polz,
192-
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondparentId, Int_t daughter1Id, Int_t daughter2Id,
193-
TMCProcess proc2)
191+
TMCProcess proc, Int_t& ntr, Double_t weight, Int_t is, Int_t secondparentId, Int_t daughter1Id, Int_t daughter2Id)
194192
{
195193
// printf("Pushing %s toBeDone %5d parentId %5d pdgCode %5d is %5d entries %5d \n",
196194
// proc == kPPrimary ? "Primary: " : "Secondary: ",
@@ -216,38 +214,36 @@ void Stack::PushTrack(Int_t toBeDone, Int_t parentId, Int_t pdgCode, Double_t px
216214
p.SetPolarisation(polx, poly, polz);
217215
p.SetWeight(weight);
218216
p.SetUniqueID(proc); // using the unique ID to transfer process ID
219-
p.SetBit(ParticleStatus::kPrimary, proc == kPPrimary ? 1 : 0); // set primary bit
220-
p.SetBit(ParticleStatus::kToBeDone, toBeDone == 1 ? 1 : 0); // set to be done bit
221217
mNumberOfEntriesInParticles++;
222218

223219
insertInVector(mTrackIDtoParticlesEntry, trackId, (int)(mParticles.size()));
224220

225-
handleTransportPrimary(p); // handle selective transport of primary particles
226-
227221
// Push particle on the stack if toBeDone is set
228-
if (p.TestBit(ParticleStatus::kPrimary)) {
222+
if (proc == kPPrimary) {
229223
// This is a particle from the primary particle generator
230224
//
231225
// SetBit is used to pass information about the primary particle to the stack during transport.
232226
// Sime particles have already decayed or are partons from a shower. They are needed for the
233227
// event history in the stack, but not for transport.
234228
//
235-
236-
// primary particles might have been pushed with a second creation process
237-
// in case we pushed a secondary track of a previous simulation to be continued.
238-
// We save therefore in the UniqueID the correct process
239-
// while the particle will still be treated as a primary given its bit settings
240-
p.SetUniqueID(proc2);
241-
242229
mIndexMap[trackId] = trackId;
243-
p.SetBit(ParticleStatus::kKeep, 1);
244-
if (p.TestBit(ParticleStatus::kToBeDone)) {
245-
mNumberOfPrimariesforTracking++;
230+
p.SetBit(ParticleStatus::kKeep);
231+
p.SetBit(ParticleStatus::kPrimary);
232+
if (toBeDone == 1) {
233+
handleTransportPrimary(p);
234+
} else {
235+
p.SetBit(ParticleStatus::kToBeDone, 0);
246236
}
247237
mNumberOfPrimaryParticles++;
248238
mPrimaryParticles.push_back(p);
249239
mTracks->emplace_back(p);
250240
} else {
241+
p.SetBit(ParticleStatus::kPrimary, 0);
242+
if (toBeDone == 1) {
243+
p.SetBit(ParticleStatus::kToBeDone, 1);
244+
} else {
245+
p.SetBit(ParticleStatus::kToBeDone, 0);
246+
}
251247
mParticles.emplace_back(p);
252248
mCurrentParticle0 = p;
253249
}
@@ -259,11 +255,10 @@ void Stack::handleTransportPrimary(TParticle& p)
259255
// this function tests whether we really want to transport
260256
// this particle and sets the relevant bits accordingly
261257

262-
if (!p.TestBit(ParticleStatus::kToBeDone) || !p.TestBit(ParticleStatus::kPrimary)) {
263-
return;
264-
}
265-
266-
if (!mTransportPrimary(p, mPrimaryParticles)) {
258+
if (mTransportPrimary(p, mPrimaryParticles)) {
259+
p.SetBit(ParticleStatus::kToBeDone, 1);
260+
mNumberOfPrimariesforTracking++;
261+
} else {
267262
p.SetBit(ParticleStatus::kToBeDone, 0);
268263
p.SetBit(ParticleStatus::kInhibited, 1);
269264
}
@@ -276,15 +271,15 @@ void Stack::PushTrack(int toBeDone, TParticle& p)
276271
// This method is called
277272
//
278273
// - during parallel simulation to push primary particles (called by the stack itself)
279-
if (p.TestBit(ParticleStatus::kPrimary)) {
274+
if (p.GetUniqueID() == 0) {
280275
// one to one mapping for primaries
281276
mIndexMap[mNumberOfPrimaryParticles] = mNumberOfPrimaryParticles;
282-
mNumberOfPrimaryParticles++;
283-
mPrimaryParticles.push_back(p);
284277
// Push particle on the stack
285-
if (p.TestBit(ParticleStatus::kToBeDone)) {
286-
mNumberOfPrimariesforTracking++;
278+
if (p.TestBit(ParticleStatus::kPrimary) && p.TestBit(ParticleStatus::kToBeDone)) {
279+
handleTransportPrimary(p);
287280
}
281+
mNumberOfPrimaryParticles++;
282+
mPrimaryParticles.push_back(p);
288283
mStack.push(p);
289284
mTracks->emplace_back(p);
290285
}

Generators/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ o2_add_library(Generators
2727
src/GeneratorTGenerator.cxx
2828
src/GeneratorExternalParam.cxx
2929
src/GeneratorFromFile.cxx
30-
src/GeneratorFromO2KineParam.cxx
3130
src/PDG.cxx
3231
src/PrimaryGenerator.cxx
3332
src/InteractionDiamondParam.cxx
@@ -69,7 +68,6 @@ set(headers
6968
include/Generators/GeneratorTGenerator.h
7069
include/Generators/GeneratorExternalParam.h
7170
include/Generators/GeneratorFromFile.h
72-
include/Generators/GeneratorFromO2KineParam.h
7371
include/Generators/PDG.h
7472
include/Generators/PrimaryGenerator.h
7573
include/Generators/InteractionDiamondParam.h

Generators/include/Generators/GeneratorFromFile.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,11 @@ class GeneratorFromO2Kine : public o2::eventgen::Generator
7878
void SetStartEvent(int start);
7979

8080
private:
81-
/** methods that can be overridden **/
82-
void updateHeader(o2::dataformats::MCEventHeader* eventHeader) override;
83-
8481
TFile* mEventFile = nullptr; //! the file containing the persistent events
8582
TBranch* mEventBranch = nullptr; //! the branch containing the persistent events
8683
int mEventCounter = 0;
8784
int mEventsAvailable = 0;
8885
bool mSkipNonTrackable = true; //! whether to pass non-trackable (decayed particles) to the MC stack
89-
bool mContinueMode = false; //! whether we want to continue simulation of previously inhibited tracks
9086
ClassDefOverride(GeneratorFromO2Kine, 1);
9187
};
9288

Generators/include/Generators/GeneratorFromO2KineParam.h

Lines changed: 0 additions & 39 deletions
This file was deleted.

Generators/src/Generator.cxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ Bool_t
131131
particle.GetStatusCode() == 1,
132132
particle.Energy() * mEnergyUnit,
133133
particle.T() * mTimeUnit,
134-
particle.GetWeight(),
135-
(TMCProcess)particle.GetUniqueID());
134+
particle.GetWeight());
136135
}
137136

138137
/** success **/

Generators/src/GeneratorFromFile.cxx

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
// or submit itself to any jurisdiction.
1010

1111
#include "Generators/GeneratorFromFile.h"
12-
#include "Generators/GeneratorFromO2KineParam.h"
1312
#include "SimulationDataFormat/MCTrack.h"
14-
#include "SimulationDataFormat/MCEventHeader.h"
1513
#include <FairLogger.h>
1614
#include <FairPrimaryGenerator.h>
1715
#include <TBranch.h>
@@ -178,13 +176,6 @@ GeneratorFromO2Kine::GeneratorFromO2Kine(const char* name)
178176
}
179177
}
180178
LOG(ERROR) << "Problem reading events from file " << name;
181-
182-
// read and set params
183-
auto& param = GeneratorFromO2KineParam::Instance();
184-
LOG(INFO) << "Instance \'FromO2Kine\' generator with following parameters";
185-
LOG(INFO) << param;
186-
mSkipNonTrackable = param.skipNonTrackable;
187-
mContinueMode = param.continueMode;
188179
}
189180

190181
void GeneratorFromO2Kine::SetStartEvent(int start)
@@ -210,9 +201,8 @@ bool GeneratorFromO2Kine::importParticles()
210201
mEventBranch->GetEntry(mEventCounter);
211202

212203
for (auto& t : *tracks) {
213-
214-
// in case we do not want to continue, take only primaries
215-
if (!mContinueMode && !t.isPrimary()) {
204+
// I guess we only want primaries (unless later on we continue a simulation)
205+
if (!t.isPrimary()) {
216206
continue;
217207
}
218208

@@ -231,16 +221,9 @@ bool GeneratorFromO2Kine::importParticles()
231221
auto vt = t.T();
232222
auto weight = 1.; // p.GetWeight() ??
233223
auto wanttracking = t.getToBeDone();
234-
235-
if (mContinueMode) { // in case we want to continue, do only inhibited tracks
236-
wanttracking &= t.getInhibited();
237-
}
238-
239224
LOG(DEBUG) << "Putting primary " << pdg;
240225

241226
mParticles.push_back(TParticle(pdg, wanttracking, m1, m2, d1, d2, px, py, pz, e, vx, vy, vz, vt));
242-
mParticles.back().SetUniqueID((unsigned int)t.getProcess()); // we should propagate the process ID
243-
244227
particlecounter++;
245228
}
246229
mEventCounter++;
@@ -257,17 +240,6 @@ bool GeneratorFromO2Kine::importParticles()
257240
return false;
258241
}
259242

260-
void GeneratorFromO2Kine::updateHeader(o2::dataformats::MCEventHeader* eventHeader)
261-
{
262-
/** update header **/
263-
264-
// put information about input file and event number of the current event
265-
266-
eventHeader->putInfo<std::string>("generator", "generatorFromO2Kine");
267-
eventHeader->putInfo<std::string>("inputFile", mEventFile->GetName());
268-
eventHeader->putInfo<int>("inputEventNumber", mEventCounter - 1);
269-
}
270-
271243
} // namespace eventgen
272244
} // end namespace o2
273245

Generators/src/GeneratorFromO2KineParam.cxx

Lines changed: 0 additions & 14 deletions
This file was deleted.

Generators/src/GeneratorsLinkDef.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
#endif
4949
#pragma link C++ class o2::eventgen::GeneratorFromFile + ;
5050
#pragma link C++ class o2::eventgen::GeneratorFromO2Kine + ;
51-
#pragma link C++ class o2::eventgen::GeneratorFromO2KineParam + ;
52-
#pragma link C++ class o2::conf::ConfigurableParamHelper < o2::eventgen::GeneratorFromO2KineParam> + ;
5351
#pragma link C++ class o2::PDG + ;
5452
#pragma link C++ class o2::eventgen::PrimaryGenerator + ;
5553

0 commit comments

Comments
 (0)