Skip to content
Merged
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
2 changes: 1 addition & 1 deletion PWGUD/DataModel/TauThreeProngEventTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ DECLARE_SOA_COLUMN(True6DaugPx, true6DaugPx, float[6]);
DECLARE_SOA_COLUMN(True6DaugPy, true6DaugPy, float[6]);
DECLARE_SOA_COLUMN(True6DaugPz, true6DaugPz, float[6]);
DECLARE_SOA_COLUMN(True6DaugPdgCode, true6DaugPdgCode, int[6]);
DECLARE_SOA_COLUMN(Problem, problem, int8_t);
DECLARE_SOA_COLUMN(Problem, problem, uint8_t);
DECLARE_SOA_COLUMN(IsRec, isRec, int8_t);
} // namespace tautree

Expand Down
110 changes: 99 additions & 11 deletions PWGUD/TableProducer/tauThreeProngEventTableProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ enum MyRecoProblem {
TOO_MANY_DAUGHTERS = 2, // more than 6 daughters from 2 taus
TWO_TRACKS = 3, // more than 1 associated track to MC particle (tau daughter)
NO_TRACK = 4, // No associated track to MC particle (tau daughter)
MIXED_TRACKS = 5 // 4 (or 6) tracks reconstructed but from 2 collisions
MIXED_TRACKS = 5, // 4 (or 6) tracks reconstructed but from 2 collisions
BAD_GAP = 6, // rapidity gap out of range 0-2
GAP_NE_2 = 7, // rapidity gap != 2
FIT_VETO = 8 // FIT not empty (with thresholds)
};

enum MyParticle {
Expand Down Expand Up @@ -185,7 +188,7 @@ struct TauThreeProngEventTableProducer {
// Configurable<float> maxNsigmaPrVetocut{"maxNsigmaPrVetocut", 3., "max Nsigma for Proton veto cut"};
// Configurable<float> maxNsigmaKaVetocut{"maxNsigmaKaVetocut", 3., "max Nsigma for Kaon veto cut"};
// Configurable<float> minPtEtrkcut{"minPtEtrkcut", 0.25, "min Pt for El track cut"};
Configurable<float> minTrkPtcut{"minTrkPtcut", 0.1, "min Pt for each charged track cut, default=100MeV/c"};
Configurable<float> minTrkPtcut{"minTrkPtcut", 0.10, "min Pt for each charged track cut, default=100MeV/c"};
Configurable<int> nPVtrackscut{"nPVtrackscut", 4, "number of PV contributors, default=4"};
Configurable<bool> mFITvetoFlag{"mFITvetoFlag", true, "To apply FIT veto"};
Configurable<int> mFITvetoWindow{"mFITvetoWindow", 2, "FIT veto window"};
Expand Down Expand Up @@ -219,7 +222,7 @@ struct TauThreeProngEventTableProducer {
////using FullSGUDCollisions = soa::Join<aod::UDCollisions, aod::UDCollisionsSels, aod::UDCollisionSelExtras, aod::SGCollisions, aod::UDZdcsReduced>;
////using FullSGUDCollision = FullSGUDCollisions::iterator;
using FullMCUDTracks = soa::Join<aod::UDTracks, aod::UDTracksExtra, aod::UDTracksDCA, aod::UDTracksPID, aod::UDTracksFlags, aod::UDMcTrackLabels>;
using FullMCSGUDCollisions = soa::Join<aod::UDCollisions, aod::UDCollisionsSels, aod::UDCollisionSelExtras, aod::SGCollisions, aod::UDMcCollsLabels>;
using FullMCSGUDCollisions = soa::Join<aod::UDCollisions, aod::UDCollisionsSels, aod::UDCollisionSelExtras, aod::SGCollisions, aod::UDMcCollsLabels, aod::UDZdcsReduced>;
// using FullMCSGUDCollision = FullMCSGUDCollisions::iterator;

// init
Expand Down Expand Up @@ -1136,6 +1139,11 @@ struct TauThreeProngEventTableProducer {
if (verbose)
LOGF(info, "<MC> UDMcCollision size %d, Collisions size %d, UDtracks %d, UDMcParticles %d", mcCollisions.size(), collisions.size(), tracks.size(), mcParticles.size());

// temporary variables needed for reconstruction
int gapSide = -10;
int truegapSide = -10;
bool isFITveto = false;

// temporary variables
// float tmpRapidity = -999.;
float trueTauRapidity[2] = {-999., -999.};
Expand Down Expand Up @@ -1388,7 +1396,9 @@ struct TauThreeProngEventTableProducer {
float trueDaugZ[6] = {-998., -998., -998., -998., -998., -998.};
int trueDaugPdgCode[6] = {-999, -999, -999, -999, -999, -999};

MyRecoProblem problem = NO_PROBLEM;
int8_t problemBits[8] = {-99, -99, -99, -99, -99, -99, -99, -99};
uint8_t problemBitsFlag = 0;
// MyRecoProblem problem = NO_PROBLEM;
registrySkim.get<TH1>(HIST("skim/problemMC"))->Fill(NO_PROBLEM);

// tau tau event type
Expand Down Expand Up @@ -1445,20 +1455,86 @@ struct TauThreeProngEventTableProducer {
// LOGF(info, "Truth collision has more than 1 reco collision. Skipping this event.");
// histos.get<TH1>(HIST("Truth/hTroubles"))->Fill(1);
// problem = true;
problem = MANY_RECO;
problemBits[MANY_RECO - 1] = true;
// problem = MANY_RECO;
registrySkim.get<TH1>(HIST("skim/problemMC"))->Fill(MANY_RECO);
// continue;
} else {
if (verbose)
LOGF(info, "---- Truth collision has 1 reco collision. Record event.");
}

// To fill bcFlags and problemFlags
const int offset = 1;

// grab reco-level collision
for (const auto& collFromMcColl : collFromMcColls) {
if (verbose) {
LOGF(info, "---- ###### Collision %d #########", collFromMcColl.index());
LOGF(info, "---- Coll GID %d, Vertex (%f,%f,%f)", collFromMcColl.globalIndex(), collFromMcColl.posX(), collFromMcColl.posY(), collFromMcColl.posZ());
}

//
// part neede to mimic reconstruction selection criteria
//
gapSide = collFromMcColl.gapSide();
// registrySkim.get<TH1>(HIST("skim/gapSide"))->Fill(gapSide);
if (gapSide < o2::aod::sgselector::SingleGapA || gapSide > o2::aod::sgselector::DoubleGap) { // if (gapSide < 0 || gapSide > 2)
problemBits[BAD_GAP - 1] = true;
}
// return;
// registrySkim.get<TH1>(HIST("skim/efficiency"))->Fill(1., 1.);

truegapSide = sgSelector.trueGap(collFromMcColl, cutFV0, cutFT0A, cutFT0C, cutZDC);
gapSide = truegapSide;
// registrySkim.get<TH1>(HIST("skim/trueGapSide"))->Fill(gapSide);
if (gapSide != mGapSide) {
problemBits[GAP_NE_2 - 1] = true;
}
// return;
// registrySkim.get<TH1>(HIST("skim/efficiency"))->Fill(2., 1.);

// n PV contributors
// if (PVContributors.size() != nPVtrackscut) // 4 or 6
// return;
// if (nEtaIn15 != nPVtrackscut) // 4 or 6
// return;
// registrySkim.get<TH1>(HIST("skim/efficiency"))->Fill(4., 1.);
//
// if (npT100 != nPVtrackscut) // 4 or 6
// return;
// registrySkim.get<TH1>(HIST("skim/efficiency"))->Fill(5., 1.);
//
// registrySkim.get<TH1>(HIST("skim/nTof"))->Fill(nTofTrk);
// if (nTofTrk < nTofTrkMinCut)
// return;
// registrySkim.get<TH1>(HIST("skim/efficiency"))->Fill(6., 1.);

//
// FIT informaton
//
auto bitMin = 16 - mFITvetoWindow; // default is +- 2 bc (2 bit)
auto bitMax = 16 + mFITvetoWindow;
isFITveto = false;
// check FIT information
for (auto bit = bitMin; bit <= bitMax; bit++) {
if (TESTBIT(collFromMcColl.bbFT0Apf(), bit))
isFITveto = true;
if (TESTBIT(collFromMcColl.bbFT0Cpf(), bit))
isFITveto = true;
if (useFV0ForVeto && TESTBIT(collFromMcColl.bbFV0Apf(), bit))
isFITveto = true;
if (useFDDAForVeto && TESTBIT(collFromMcColl.bbFDDApf(), bit))
isFITveto = true;
if (useFDDCForVeto && TESTBIT(collFromMcColl.bbFDDCpf(), bit))
isFITveto = true;
} // end of loop over FIT bits
if (mFITvetoFlag && isFITveto) {
problemBits[FIT_VETO - 1] = true;
}
// return;
// registrySkim.get<TH1>(HIST("skim/efficiency"))->Fill(7., 1.);

// auto const& collFromMcColl = collFromMcColls.iteratorAt(0);
// grab tracks from the reco-level collision to get info to match measured data tables (processDataSG function)
auto const& trksFromColl = tracks.sliceBy(trackPerCollision, collFromMcColl.globalIndex());
Expand Down Expand Up @@ -1498,7 +1574,7 @@ struct TauThreeProngEventTableProducer {
bcSels[6] = collFromMcColl.zVtxFT0vPV();
bcSels[7] = collFromMcColl.vtxITSTPC();

const int offset = 1;
// const int offset = 1;
bcSelBits = bcSels[0]; // initialization
for (int ibit = 1; ibit < nBitsMax; ibit++) {
bcSelBits = (bcSelBits << offset); // shift by 1 position towards left
Expand Down Expand Up @@ -1556,7 +1632,9 @@ struct TauThreeProngEventTableProducer {
LOGF(info, "------ Truth collision has more than 6 charged daughters from 2 taus. Breaking the daughter loop.");
// histos.get<TH1>(HIST("Truth/hTroubles"))->Fill(3);
// problem = true;
problem = TOO_MANY_DAUGHTERS;

problemBits[TOO_MANY_DAUGHTERS - 1] = true;
// problem = TOO_MANY_DAUGHTERS;
registrySkim.get<TH1>(HIST("skim/problemMC"))->Fill(TOO_MANY_DAUGHTERS);

break;
Expand Down Expand Up @@ -1602,15 +1680,18 @@ struct TauThreeProngEventTableProducer {
if (counter > 1) {
if (verbose)
LOGF(info, "------ Daughter has more than 1 associated track. Ntracks = %d. Skipping this daughter.", counter);
problem = TWO_TRACKS;

problemBits[TWO_TRACKS - 1] = true;
// problem = TWO_TRACKS;
registrySkim.get<TH1>(HIST("skim/problemMC"))->Fill(TWO_TRACKS);
continue;
}
} else if (tracksFromDaughter.size() < 1) {
// what if no track is associated to mc particle???
if (verbose)
LOGF(info, "----- Daughter has no associated track. Ntracks = %d. Skipping this daughter.", tracksFromDaughter.size());
problem = NO_TRACK;
problemBits[NO_TRACK - 1] = true;
// problem = NO_TRACK;
registrySkim.get<TH1>(HIST("skim/problemMC"))->Fill(NO_TRACK);
continue;
}
Expand Down Expand Up @@ -1659,6 +1740,13 @@ struct TauThreeProngEventTableProducer {
} // end of loop over MC particles
} // end of loop over collisions associated to MC collision

// set up problem bits
problemBitsFlag = problemBits[0]; // initialization
for (int ibit = 1; ibit < nBitsMax; ibit++) {
problemBitsFlag = (problemBitsFlag << offset); // shift by 1 position towards left
problemBitsFlag += problemBits[ibit]; // add next bit to the pool
}

// decide the channel and set the variable.
trueChannel = trueChannel + countPi0 * 10 + zerothTau * 100;

Expand Down Expand Up @@ -1695,7 +1783,7 @@ struct TauThreeProngEventTableProducer {
mccoll.posZ(),
// trueTauX, trueTauY, trueTauZ,
trueDaugX, trueDaugY, trueDaugZ,
trueDaugPdgCode, problem);
trueDaugPdgCode, problemBitsFlag);
} else if (nChargedDaughtersTau[0] + nChargedDaughtersTau[1] == sixTracks) { // 6
trueTauSixTracks(runNumber,
bc, // is it necessary
Expand Down Expand Up @@ -1727,7 +1815,7 @@ struct TauThreeProngEventTableProducer {
mccoll.posZ(),
// trueTauX, trueTauY, trueTauZ,
trueDaugX, trueDaugY, trueDaugZ,
trueDaugPdgCode, problem);
trueDaugPdgCode, problemBitsFlag);
} // end of saving the output

} else { // get only the truth information. The reco-level info is left on default
Expand Down
Loading