124 uint64_t tfNumber = mTFNumber;
129 auto collisionsCursor = createTableCursor<McCollisions>(pc);
130 auto particlesCursor = createTableCursor<McParticles>(pc);
131 auto originCursor = createTableCursor<Origins>(pc);
132 auto xSectionCursor = createTableCursor<XSections>(pc);
133 auto pdfInfoCursor = createTableCursor<PdfInfos>(pc);
134 auto heavyIonCursor = createTableCursor<HeavyIons>(pc);
137 std::unique_ptr<MCKinematicsReader> reader;
138 if (not mEnableEmbed) {
140 std::make_unique<MCKinematicsReader>(mSimPrefix,
143 reader = std::make_unique<MCKinematicsReader>(
"collisioncontext.root");
147 using EventInfo = std::vector<std::tuple<int, int, int>>;
154 if (not mEnableEmbed) {
157 int nSources = reader->getNSources();
158 for (
int isrc = 0; isrc < nSources; isrc++) {
159 short generatorID = isrc;
160 int nEvents = reader->getNEvents(isrc);
161 for (
int ievt = 0; ievt <
nEvents; ievt++) {
162 auto& header = reader->getMCEventHeader(isrc, ievt);
163 updateHeader(collisionsCursor.cursor,
164 xSectionCursor.cursor,
165 pdfInfoCursor.cursor,
166 heavyIonCursor.cursor,
174 eventInfo.emplace_back(std::make_tuple(icol, isrc, ievt));
182 int nCollisions = reader->getDigitizationContext()->getNCollisions();
183 const auto& records = reader->getDigitizationContext()->getEventRecords();
184 const auto& parts = reader->getDigitizationContext()->getEventParts();
185 for (
int icol = 0; icol < nCollisions; icol++) {
186 auto& colParts = parts[icol];
187 auto nParts = colParts.size();
188 for (
auto colPart : colParts) {
189 auto eventID = colPart.entryID;
190 auto sourceID = colPart.sourceID;
193 if (nParts == 1 || sourceID == 0) {
195 short generatorID = sourceID;
196 auto& header = reader->getMCEventHeader(sourceID, eventID);
198 updateHeader(collisionsCursor.cursor,
199 xSectionCursor.cursor,
200 pdfInfoCursor.cursor,
201 heavyIonCursor.cursor,
210 eventInfo.emplace_back(std::make_tuple(icol, sourceID, eventID));
216 std::sort(eventInfo.begin(), eventInfo.end(),
217 [](
typename EventInfo::const_reference
left,
218 typename EventInfo::const_reference
right) {
219 return (std::get<0>(left) < std::get<0>(right));
224 for (
auto& colInfo : eventInfo) {
225 int event = std::get<2>(colInfo);
226 int source = std::get<1>(colInfo);
227 int collisionID = std::get<0>(colInfo);
231 offset = updateParticles(particlesCursor.cursor,
242 reader->releaseTracksForSourceAndEvent(
source,
event);
246 originCursor(tfNumber);
251 std::vector<TString> metaDataKeys = {
"DataType",
259 std::vector<TString> metaDataVals = {
"MC",
ConfigParamRegistry const & options()
DataAllocator & outputs()
The data allocator is used to allocate memory for the output data.
ServiceRegistryRef services()
The services registry associated with this processing context.
short updateMCCollisions(const CollisionCursor &cursor, int bcId, float time, o2::dataformats::MCEventHeader const &header, short generatorId=0, int sourceId=0, unsigned int mask=0xFFFFFFF0)