Skip to content

Commit 4c2cf28

Browse files
committed
Add Anton's changes
1 parent 8a8426f commit 4c2cf28

1 file changed

Lines changed: 41 additions & 45 deletions

File tree

ALICE3/TableProducer/OTF/onTheFlyDecayer.cxx

Lines changed: 41 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717

1818
#include "ALICE3/Core/Decayer.h"
1919
#include "ALICE3/Core/OTFParticle.h"
20-
#include "ALICE3/DataModel/tracksAlice3.h"
2120
#include "ALICE3/Core/TrackUtilities.h"
21+
#include "ALICE3/DataModel/tracksAlice3.h"
2222

2323
#include <Framework/AnalysisDataModel.h>
2424
#include <Framework/AnalysisHelpers.h>
@@ -40,7 +40,6 @@
4040
#include <array>
4141
#include <cmath>
4242
#include <cstdlib>
43-
#include <map>
4443
#include <string>
4544
#include <vector>
4645

@@ -67,8 +66,10 @@ static const std::vector<int> pdgCodes{PDG_t::kK0Short,
6766
PDG_t::kOmegaMinus,
6867
PDG_t::kOmegaPlusBar};
6968

70-
// Witchcraft
71-
namespace o2::aod { O2ORIGIN("TMP"); }
69+
namespace o2::aod
70+
{
71+
O2ORIGIN("TMP");
72+
}
7273

7374
struct OnTheFlyDecayer {
7475
Produces<aod::McCollisions_001> tableMcCollisions;
@@ -121,7 +122,7 @@ struct OnTheFlyDecayer {
121122
void decayParticles(const int start, const int stop)
122123
{
123124
int ndau = 0;
124-
for (int i = start; i < stop; i++) {
125+
for (int i = start; i < stop; ++i) {
125126
o2::upgrade::OTFParticle& particle = allParticles[i];
126127
if (particle.isFromMcParticles()) {
127128
particle.setBitOn(o2::upgrade::DecayerBits::IsPrimary);
@@ -169,49 +170,44 @@ struct OnTheFlyDecayer {
169170
decayParticles(stop, stop + ndau);
170171
}
171172

172-
void process(aod::McCollisions_001From<aod::Hash<"TMP"_h>> const& mcCollisions, aod::McParticles_001From<aod::Hash<"TMP"_h>> const& mcParticles)
173+
void process(aod::McCollisions_001From<aod::Hash<"TMP"_h>>::iterator const& collision, aod::McParticles_001From<aod::Hash<"TMP"_h>> const& mcParticles)
173174
{
174-
for (const auto& collision : mcCollisions) {
175-
allParticles.clear();
176-
177-
// Reproduce collision table to have AOD origin
178-
mCollisionId = collision.globalIndex();
179-
tableMcCollisions(collision.bcId(),
180-
collision.generatorsID(),
181-
collision.posX(),
182-
collision.posY(),
183-
collision.posZ(),
184-
collision.t(),
185-
collision.weight(),
186-
collision.impactParameter(),
187-
collision.eventPlaneAngle());
188-
189-
// First we copy the particles from the table into a vector that is extendable
190-
for (int index{0}; index < static_cast<int>(mcParticles.size()); ++index) {
191-
const auto& mcParticle = mcParticles.rawIteratorAt(index);
192-
allParticles.push_back(o2::upgrade::OTFParticle{mcParticle});
193-
}
175+
allParticles.clear();
176+
177+
// Reproduce collision table to have AOD origin
178+
mCollisionId = collision.globalIndex();
179+
tableMcCollisions(collision.bcId(),
180+
collision.generatorsID(),
181+
collision.posX(),
182+
collision.posY(),
183+
collision.posZ(),
184+
collision.t(),
185+
collision.weight(),
186+
collision.impactParameter(),
187+
collision.eventPlaneAngle());
188+
189+
// First we copy the particles from the table into a vector that is extendable
190+
for (const auto& particle : mcParticles) {
191+
allParticles.emplace_back(o2::upgrade::OTFParticle{particle});
192+
}
193+
194+
// Do all decays
195+
decayParticles(0, allParticles.size());
194196

195-
// Do all decays
196-
decayParticles(0, allParticles.size());
197-
198-
// Fill output table
199-
for (int index{0}; index < static_cast<int>(allParticles.size()); ++index) {
200-
const auto& otfParticle = allParticles[index];
201-
202-
if (otfParticle.hasNaN()) {
203-
histos.fill(HIST("hNaNBookkeeping"), 1);
204-
} else {
205-
histos.fill(HIST("hNaNBookkeeping"), 0);
206-
}
207-
208-
// todo: status codes
209-
tableOTFDecayerBits(otfParticle.getBitsValue());
210-
tableMcParticles(otfParticle.collisionId(), otfParticle.pdgCode(), otfParticle.statusCode(), otfParticle.flags(),
211-
otfParticle.getMotherSpan(), otfParticle.getDaughters().data(), otfParticle.weight(),
212-
otfParticle.px(), otfParticle.py(), otfParticle.pz(), otfParticle.e(),
213-
otfParticle.vx(), otfParticle.vy(), otfParticle.vz(), otfParticle.vt());
197+
// Fill output table
198+
for (const auto& otfParticle : allParticles) {
199+
if (otfParticle.hasNaN()) {
200+
histos.fill(HIST("hNaNBookkeeping"), 1);
201+
} else {
202+
histos.fill(HIST("hNaNBookkeeping"), 0);
214203
}
204+
205+
// todo: status codes
206+
tableOTFDecayerBits(otfParticle.getBitsValue());
207+
tableMcParticles(otfParticle.collisionId(), otfParticle.pdgCode(), otfParticle.statusCode(), otfParticle.flags(),
208+
otfParticle.getMotherSpan(), otfParticle.getDaughters().data(), otfParticle.weight(),
209+
otfParticle.px(), otfParticle.py(), otfParticle.pz(), otfParticle.e(),
210+
otfParticle.vx(), otfParticle.vy(), otfParticle.vz(), otfParticle.vt());
215211
}
216212
}
217213
};

0 commit comments

Comments
 (0)