Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions PWGDQ/TableProducer/tableMakerMC_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ struct TableMakerMC {
if (!(isProcessBCenabled || isBarrelEnabled || isMuonEnabled)) {
LOG(fatal) << "No process function was enabled for TableMakerMC. Check it out!!!";
}

// Define user specified cut
DefineCuts();

Expand Down Expand Up @@ -368,7 +368,6 @@ struct TableMakerMC {
}
}


void skimMCParticles(aod::McParticles const& mcTracks, aod::McCollisions const&)
{
// Select MC particles which fulfill at least one of the user specified MC signals
Expand All @@ -381,7 +380,7 @@ struct TableMakerMC {
fLabelsMapReversed.clear();
fMCFlags.clear();

uint16_t mcflags = static_cast<uint16_t>(0); // flags which will hold the decisions for each MC signal
uint16_t mcflags = static_cast<uint16_t>(0); // flags which will hold the decisions for each MC signal
int trackCounter = 0;

for (auto& mctrack : mcTracks) {
Expand Down Expand Up @@ -451,7 +450,7 @@ struct TableMakerMC {
// Loop over collisions
for (const auto& collision : collisions) {

// Fill the stats event histogram with the event selection bits
// Fill the stats event histogram with the event selection bits
for (int i = 0; i < o2::aod::evsel::kNsel; i++) {
if (collision.selection_bit(i)) {
(reinterpret_cast<TH2I*>(fStatsList->At(0)))->Fill(1.0, static_cast<float>(i));
Expand Down Expand Up @@ -591,7 +590,7 @@ struct TableMakerMC {
continue;
}

// If this track is already present in the index map, it means it was already skimmed,
// If this track is already present in the index map, it means it was already skimmed,
// so we just store the association and we skip the track
if (fTrackIndexMap.find(track.globalIndex()) != fTrackIndexMap.end()) {
trackBarrelAssoc(fCollIndexMap[collision.globalIndex()], fTrackIndexMap[track.globalIndex()]);
Expand All @@ -616,7 +615,7 @@ struct TableMakerMC {
// However, in data analysis one should loop over associations, so this one should not be used.
// In the case of Run2-like analysis, there will be no associations, so this ID will be the one originally assigned in the AO2Ds (updated for the skims)
uint32_t reducedEventIdx = fCollIndexMap[track.collisionId()];

// NOTE: trackBarrelInfo stores the index of the collision as in AO2D (for use in some cases where the analysis on skims is done
// in workflows where the original AO2Ds are also present)
trackBarrelInfo(track.collisionId(), collision.posX(), collision.posY(), collision.posZ(), track.globalIndex());
Expand Down
7 changes: 3 additions & 4 deletions PWGDQ/TableProducer/tableMaker_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,6 @@ struct TableMaker {
fStatsList->AddAt(histZorroSel, kStatsZorroSel);
}


template <uint32_t TEventFillMap, uint32_t TTrackFillMap, typename TEvents, typename TBCs, typename TZdcs, typename TTrackAssoc, typename TTracks>
void skimCollisions(TEvents const& collisions, TBCs const& /*bcs*/, TZdcs const& /*zdcs*/,
TTrackAssoc const& trackAssocs, TTracks const& tracks)
Expand Down Expand Up @@ -703,7 +702,7 @@ struct TableMaker {
continue;
}

// If this track is already present in the index map, it means it was already skimmed,
// If this track is already present in the index map, it means it was already skimmed,
// so we just store the association and we skip the track
if (fTrackIndexMap.find(track.globalIndex()) != fTrackIndexMap.end()) {
trackBarrelAssoc(fCollIndexMap[collision.globalIndex()], fTrackIndexMap[track.globalIndex()]);
Expand Down Expand Up @@ -761,7 +760,7 @@ struct TableMaker {
// If new associations are done with the skimmed data, the track time wrt new collision can then be recomputed based on the
// relative difference in time between the original and the new collision.
uint32_t reducedEventIdx = fCollIndexMap[track.collisionId()]; // This gives the original iD of the track

// NOTE: trackBarrelInfo stores the index of the collision as in AO2D (for use in some cases where the analysis on skims is done
// in workflows where the original AO2Ds are also present)
trackBarrelInfo(collision.globalIndex(), collision.posX(), collision.posY(), collision.posZ(), track.globalIndex());
Expand Down Expand Up @@ -790,7 +789,7 @@ struct TableMaker {
track.trdSignal());
}
fTrackIndexMap[track.globalIndex()] = trackBasic.lastIndex();

// write the skimmed collision - track association
trackBarrelAssoc(fCollIndexMap[collision.globalIndex()], fTrackIndexMap[track.globalIndex()]);
} // end loop over associations
Expand Down
70 changes: 34 additions & 36 deletions PWGDQ/Tasks/dqEfficiency_withAssoc.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ struct AnalysisEventSelection {
fSelMap.clear();
fBCCollMap.clear();


for (auto& event : events) {
// Reset the fValues array and fill event observables
VarManager::ResetValues(0, VarManager::kNEventWiseVariables);
Expand Down Expand Up @@ -255,7 +254,7 @@ struct AnalysisEventSelection {
for (auto bc1It = fBCCollMap.begin(); bc1It != fBCCollMap.end(); ++bc1It) {
uint64_t bc1 = bc1It->first;
auto bc1Events = bc1It->second;

// same bunch event correlations, if more than 1 collisions in this bunch
if (bc1Events.size() > 1) {
for (auto ev1It = bc1Events.begin(); ev1It != bc1Events.end(); ++ev1It) {
Expand All @@ -269,9 +268,9 @@ struct AnalysisEventSelection {
collisionSplittingMap[*ev2It] = true;
}
fHistMan->FillHistClass("SameBunchCorrelations", VarManager::fgValues);
} // end second event loop
} // end first event loop
} // end if BC1 events > 1
} // end second event loop
} // end first event loop
} // end if BC1 events > 1

// loop over the following BCs in the TF
for (auto bc2It = std::next(bc1It); bc2It != fBCCollMap.end(); ++bc2It) {
Expand Down Expand Up @@ -537,8 +536,8 @@ struct AnalysisTrackSelection {
}
}
} // end loop over cuts
} // end loop over MC signals
} // end if (filterMap > 0)
} // end loop over MC signals
} // end if (filterMap > 0)

// count the number of associations per track
if (fConfigPublishAmbiguity && filterMap > 0) {
Expand Down Expand Up @@ -818,18 +817,18 @@ struct AnalysisMuonSelection {
}
}
} // end loop over cuts
} // end loop over MC signals
} // end loop over MC signals

// count the number of associations per track
if (fConfigPublishAmbiguity && filterMap > 0) {
if (fConfigPublishAmbiguity && filterMap > 0) {
if (event.isEventSelected_bit(1)) {
if (fNAssocsInBunch.find(track.globalIndex()) == fNAssocsInBunch.end()) {
std::vector<int64_t> evVector = {event.globalIndex()};
fNAssocsInBunch[track.globalIndex()] = evVector;
} else {
auto& evVector = fNAssocsInBunch[track.globalIndex()];
evVector.push_back(event.globalIndex());
}
}
} else {
if (fNAssocsOutOfBunch.find(track.globalIndex()) == fNAssocsOutOfBunch.end()) {
std::vector<int64_t> evVector = {event.globalIndex()};
Expand All @@ -846,9 +845,9 @@ struct AnalysisMuonSelection {
// TODO: some tracks can be associated to both collisions that have in bunch pileup and collisions from different bunches
// So one could QA these tracks separately
if (fConfigPublishAmbiguity) {
for (auto& [trackIdx, evIndices] : fNAssocsInBunch) {
for (auto& [trackIdx, evIndices] : fNAssocsInBunch) {
if (evIndices.size() == 1) {
continue;
continue;
}
auto track = muons.rawIteratorAt(trackIdx);
VarManager::ResetValues(0, VarManager::kNVars);
Expand All @@ -859,7 +858,7 @@ struct AnalysisMuonSelection {

for (auto& [trackIdx, evIndices] : fNAssocsOutOfBunch) {
if (evIndices.size() == 1) {
continue;
continue;
}
auto track = muons.rawIteratorAt(trackIdx);
VarManager::ResetValues(0, VarManager::kNVars);
Expand Down Expand Up @@ -960,12 +959,12 @@ struct AnalysisPrefilterSelection {
}
}
}
// NOTE: If no prefilter loose cut is specified to be "prefiltered" or no track cuts are asked to be prefiltered,
// NOTE: If no prefilter loose cut is specified to be "prefiltered" or no track cuts are asked to be prefiltered,
// then make a warning. In the processing, the produced table will just lead to a neutral behaviour (no prefilter applied)
if (fPrefilterMask == static_cast<uint32_t>(0) || fPrefilterCutBit < 0) {
LOG(warn) << "No loose cut or track cuts for prefiltering are specified. This task will do nothing.";
}

// setup the prefilter pair cut
fPairCut = new AnalysisCompositeCut(true);
TString pairCutStr = fConfigPrefilterPairCut.value;
Expand Down Expand Up @@ -1042,8 +1041,7 @@ struct AnalysisPrefilterSelection {
// If cuts were not configured, then produce a map with all 1's
if (fPrefilterCutBit < 0 || fPrefilterMask == 0) {
prefilter(mymap);
}
else if (fPrefilterMap.find(track.globalIndex()) != fPrefilterMap.end()) {
} else if (fPrefilterMap.find(track.globalIndex()) != fPrefilterMap.end()) {
// NOTE: publish the bitwise negated bits (~), so there will be zeroes for cuts that failed the prefiltering and 1 everywhere else
mymap = ~fPrefilterMap[track.globalIndex()];
prefilter(mymap);
Expand Down Expand Up @@ -1095,18 +1093,18 @@ struct AnalysisSameEventPairing {
Configurable<std::string> lutPath{"lutPath", "GLO/Param/MatLUT", "Path of the Lut parametrization"};
Configurable<std::string> geoPath{"geoPath", "GLO/Config/GeometryAligned", "Path of the geometry file"};
} fConfigCCDB;

struct : ConfigurableGroup {
Configurable<bool> useRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"};
Configurable<float> magField{"cfgMagField", 5.0f, "Manually set magnetic field"};
Configurable<bool> flatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"};
Configurable<bool> useKFVertexing{"cfgUseKFVertexing", false, "Use KF Particle for secondary vertex reconstruction (DCAFitter is used by default)"};
Configurable<bool> useAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"};
Configurable<bool> propToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"};
Configurable<bool> corrFullGeo{"cfgCorrFullGeo", false, "Use full geometry to correct for MCS effects in track propagation"};
Configurable<bool> noCorr{"cfgNoCorrFwdProp", false, "Do not correct for MCS effects in track propagation"};
Configurable<std::string> collisionSystem{"syst", "pp", "Collision system, pp or PbPb"};
Configurable<float> centerMassEnergy{"energy", 13600, "Center of mass energy in GeV"};
Configurable<bool> useRemoteField{"cfgUseRemoteField", false, "Chose whether to fetch the magnetic field from ccdb or set it manually"};
Configurable<float> magField{"cfgMagField", 5.0f, "Manually set magnetic field"};
Configurable<bool> flatTables{"cfgFlatTables", false, "Produce a single flat tables with all relevant information of the pairs and single tracks"};
Configurable<bool> useKFVertexing{"cfgUseKFVertexing", false, "Use KF Particle for secondary vertex reconstruction (DCAFitter is used by default)"};
Configurable<bool> useAbsDCA{"cfgUseAbsDCA", false, "Use absolute DCA minimization instead of chi^2 minimization in secondary vertexing"};
Configurable<bool> propToPCA{"cfgPropToPCA", false, "Propagate tracks to secondary vertex"};
Configurable<bool> corrFullGeo{"cfgCorrFullGeo", false, "Use full geometry to correct for MCS effects in track propagation"};
Configurable<bool> noCorr{"cfgNoCorrFwdProp", false, "Do not correct for MCS effects in track propagation"};
Configurable<std::string> collisionSystem{"syst", "pp", "Collision system, pp or PbPb"};
Configurable<float> centerMassEnergy{"energy", 13600, "Center of mass energy in GeV"};
} fConfigOptions;

struct : ConfigurableGroup {
Expand Down Expand Up @@ -1246,7 +1244,7 @@ struct AnalysisSameEventPairing {
// NOTE: In the numbering scheme for the map key, we use the number of barrel cuts in the barrel-track selection task
fTrackHistNames[fNCutsBarrel + icut * fNPairCuts + iPairCut] = names;
} // end loop (pair cuts)
} // end if (pair cuts)
} // end if (pair cuts)

// assign hist directories for the MC matched pairs for each (track cut,MCsignal) combination
if (!sigNamesStr.IsNull()) {
Expand Down Expand Up @@ -1324,7 +1322,7 @@ struct AnalysisSameEventPairing {
histNames += Form("%s;%s;%s;", names[0].Data(), names[1].Data(), names[2].Data());
fMuonHistNames[fNCutsMuon + icut * fNCutsMuon + iPairCut] = names;
} // end loop (pair cuts)
} // end if (pair cuts)
} // end if (pair cuts)

// assign hist directories for pairs matched to MC signals for each (muon cut, MCrec signal) combination
if (!sigNamesStr.IsNull()) {
Expand Down Expand Up @@ -1353,7 +1351,7 @@ struct AnalysisSameEventPairing {
}
}
} // end loop over cuts
} // end if (muonCutsStr)
} // end if (muonCutsStr)

// Add histogram classes for each specified MCsignal at the generator level
// TODO: create a std::vector of hist classes to be used at Fill time, to avoid using Form in the process function
Expand Down Expand Up @@ -1745,8 +1743,8 @@ struct AnalysisSameEventPairing {
} // end loop (pair cuts)
}
} // end loop (cuts)
} // end loop over pairs of track associations
} // end loop over events
} // end loop over pairs of track associations
} // end loop over events
}

// Preslice<ReducedMCTracks> perReducedMcEvent = aod::reducedtrackMC::reducedMCeventId;
Expand Down Expand Up @@ -1795,8 +1793,8 @@ struct AnalysisSameEventPairing {
fHistMan->FillHistClass(Form("MCTruthGenPair_%s", sig.GetName()), VarManager::fgValues);
}
} // end loop over MC signals
} // end loop over pairs
} // end loop over events
} // end loop over pairs
} // end loop over events
}
} // end runMCGen

Expand Down Expand Up @@ -1989,7 +1987,7 @@ struct AnalysisDileptonTrack {
DefineHistograms(fHistMan, fHistNamesDileptonTrack[icut], fConfigHistogramSubgroups.value.data()); // define dilepton-track histograms
DefineHistograms(fHistMan, fHistNamesDileptons[icut], "barrel,vertexing"); // define dilepton histograms
std::vector<TString> mcHistNames;

for (auto& sig : fRecMCSignals) {
mcHistNames.push_back(Form("DileptonTrackMCMatched_%s_%s_%s", tempStr.Data(), fConfigTrackCut.value.data(), sig.GetName()));
DefineHistograms(fHistMan, mcHistNames[mcHistNames.size() - 1], fConfigHistogramSubgroups.value.data());
Expand Down
Loading
Loading