Skip to content

Commit

Permalink
Merge pull request #98 from RD0407/RD0407-patch-32
Browse files Browse the repository at this point in the history
[PWGLF] Update spectraTOF.cxx
  • Loading branch information
RD0407 authored Dec 10, 2024
2 parents d6a76e6 + d5af53c commit eabeeda
Showing 1 changed file with 71 additions and 91 deletions.
162 changes: 71 additions & 91 deletions PWGLF/Tasks/Nuspex/spectraTOF.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -1338,107 +1338,87 @@ struct tofSpectra {
return;
}
int occupancy = collision.trackOccupancyInTimeRange();
const float multiplicity = collision.centFT0C();
const float multiplicity = getMultiplicity(collision);
histos.fill(HIST("nsigmatpc/test_occupancy/Mult_vs_Occupancy"), multiplicity, occupancy);
for (const auto& track : tracks) {
if (!isTrackSelected<true>(track, collision)) {
continue;
}
if (std::abs(track.rapidity(PID::getMass(2))) > trkselOptions.cfgCutY) {
return;
}
if (std::abs(track.rapidity(PID::getMass(3))) > trkselOptions.cfgCutY) {
return;
}
if (std::abs(track.rapidity(PID::getMass(4))) > trkselOptions.cfgCutY) {
return;
}
if (includeCentralityToTracks) {

if (track.sign() > 0) {
if (track.hasITS() && track.hasTPC() && track.hasTOF()) {
histos.fill(HIST("Data/cent/pos/pt/its_tpc_tof"), track.pt(), collision.centFT0C(), occupancy);
}
if (track.hasITS() && track.hasTOF()) {
histos.fill(HIST("Data/cent/pos/pt/its_tof"), track.pt(), collision.centFT0C(), occupancy);
}
if (track.hasITS() && track.hasTPC()) {
histos.fill(HIST("Data/cent/pos/pt/its_tpc"), track.pt(), collision.centFT0C(), occupancy);
}
} else {
if (track.hasITS() && track.hasTPC() && track.hasTOF()) {
histos.fill(HIST("Data/cent/neg/pt/its_tpc_tof"), track.pt(), collision.centFT0C(), occupancy);
}
if (track.hasITS() && track.hasTPC()) {
histos.fill(HIST("Data/cent/neg/pt/its_tpc"), track.pt(), collision.centFT0C(), occupancy);
}
if (track.hasITS() && track.hasTOF()) {
histos.fill(HIST("Data/cent/neg/pt/its_tof"), track.pt(), collision.centFT0C(), occupancy);
const auto& nsigmaTPCPi = o2::aod::pidutils::tpcNSigma<2>(track);
const auto& nsigmaTPCKa = track.tpcNSigmaKa();//o2::aod::pidutils::tpcNSigma<3>(track);
const auto& nsigmaTPCPr = o2::aod::pidutils::tpcNSigma<4>(track);
const auto& nsigmaTOFPi = o2::aod::pidutils::tofNSigma<2>(track);
const auto& nsigmaTOFKa = o2::aod::pidutils::tofNSigma<3>(track);
const auto& nsigmaTOFPr = o2::aod::pidutils::tofNSigma<4>(track);
// Apply PID cuts
bool isTPCPion = fabs(nsigmaTPCPi) < 10;
bool isTPCKaon = fabs(nsigmaTPCKa) < 10;
bool isTPCProton = fabs(nsigmaTPCPr) < 10;
bool isTOFPion = fabs(nsigmaTOFPi) < 10;
bool isTOFKaon = fabs(nsigmaTOFKa) < 10;
bool isTOFProton = fabs(nsigmaTOFPr) < 10;
if (isTPCPion) {
if (std::abs(track.rapidity(PID::getMass(2)) >= trkselOptions.cfgCutY)) {
continue;
}
if (track.sign() > 0) {
histos.fill(HIST("nsigmatpc/test_occupancy/pos/pi"), track.pt(), nsigmaTPCPi, multiplicity, occupancy);
} else {
histos.fill(HIST("nsigmatpc/test_occupancy/neg/pi"), track.pt(), nsigmaTPCPi, multiplicity, occupancy);
}
} else if (isTPCKaon) {
if (std::abs(track.rapidity(PID::getMass(3)) >= trkselOptions.cfgCutY)) {
continue;
}
if (track.sign() > 0) {
histos.fill(HIST("nsigmatpc/test_occupancy/pos/ka"), track.pt(), nsigmaTPCKa, multiplicity, occupancy);
} else {
histos.fill(HIST("nsigmatpc/test_occupancy/neg/ka"), track.pt(), nsigmaTPCKa, multiplicity, occupancy);
}
} else if (isTPCProton) {
if (std::abs(track.rapidity(PID::getMass(4)) >=trkselOptions.cfgCutY)) {
continue;
}
if (track.sign() > 0) {
histos.fill(HIST("nsigmatpc/test_occupancy/pos/pr"), track.pt(), nsigmaTPCPr, multiplicity, occupancy);
} else {
histos.fill(HIST("nsigmatpc/test_occupancy/neg/pr"), track.pt(), nsigmaTPCPr, multiplicity, occupancy);
}
}
if (track.hasTOF()) {
if (isTOFPion) {
if (std::abs(track.rapidity(PID::getMass(2)) >= trkselOptions.cfgCutY)) {
continue;
}
}
if (track.sign() > 0) {
histos.fill(HIST("nsigmatpc/test_occupancy/pos/pi"), track.pt(), track.tpcNSigmaPi(), multiplicity, occupancy);
histos.fill(HIST("nsigmatpc/test_occupancy/pos/ka"), track.pt(), track.tpcNSigmaKa(), multiplicity, occupancy);
histos.fill(HIST("nsigmatpc/test_occupancy/pos/pr"), track.pt(), track.tpcNSigmaPr(), multiplicity, occupancy);
} else if (track.sign() < 0) {
histos.fill(HIST("nsigmatpc/test_occupancy/neg/pi"), track.pt(), track.tpcNSigmaPi(), multiplicity, occupancy);
histos.fill(HIST("nsigmatpc/test_occupancy/neg/ka"), track.pt(), track.tpcNSigmaKa(), multiplicity, occupancy);
histos.fill(HIST("nsigmatpc/test_occupancy/neg/pr"), track.pt(), track.tpcNSigmaPr(), multiplicity, occupancy);
}
if (!track.hasTOF()) {
return;
}
if (track.sign() > 0) {
histos.fill(HIST("nsigmatof/test_occupancy/pos/pi"), track.pt(), track.tofNSigmaPi(), multiplicity, occupancy);
histos.fill(HIST("nsigmatof/test_occupancy/pos/ka"), track.pt(), track.tofNSigmaKa(), multiplicity, occupancy);
histos.fill(HIST("nsigmatof/test_occupancy/pos/pr"), track.pt(), track.tofNSigmaPr(), multiplicity, occupancy);
} else if (track.sign() < 0) {
histos.fill(HIST("nsigmatof/test_occupancy/neg/pi"), track.pt(), track.tofNSigmaPi(), multiplicity, occupancy);
histos.fill(HIST("nsigmatof/test_occupancy/neg/ka"), track.pt(), track.tofNSigmaKa(), multiplicity, occupancy);
histos.fill(HIST("nsigmatof/test_occupancy/neg/pr"), track.pt(), track.tofNSigmaPr(), multiplicity, occupancy);
}
} // track
if (track.sign() > 0) {
histos.fill(HIST("nsigmatof/test_occupancy/pos/pi"), track.pt(), nsigmaTOFPi, multiplicity, occupancy);
} else {
histos.fill(HIST("nsigmatof/test_occupancy/neg/pi"), track.pt(), nsigmaTOFPi, multiplicity, occupancy);
}
} else if (isTOFKaon) {
if (std::abs(track.rapidity(PID::getMass(3)) >= trkselOptions.cfgCutY)) {
continue;
}
if (track.sign() > 0) {
histos.fill(HIST("nsigmatof/test_occupancy/pos/ka"), track.pt(), nsigmaTOFKa, multiplicity, occupancy);
} else {
histos.fill(HIST("nsigmatof/test_occupancy/neg/ka"), track.pt(), nsigmaTOFKa, multiplicity, occupancy);
}
} else if (isTOFProton) {
if (std::abs(track.rapidity(PID::getMass(4)) >= trkselOptions.cfgCutY)) {
continue;
}
if (track.sign() > 0) {
histos.fill(HIST("nsigmatof/test_occupancy/pos/pr"), track.pt(), nsigmaTOFPr, multiplicity, occupancy);
} else {
histos.fill(HIST("nsigmatof/test_occupancy/neg/pr"), track.pt(), nsigmaTOFPr, multiplicity, occupancy);
}
}
}//TOF
} // track
} // process function
PROCESS_SWITCH(tofSpectra, processOccupancy, "check for occupancy plots", false);

void processStandard(CollisionCandidates::iterator const& collision,
TrackCandidates const& tracks)
{
if (!isEventSelected<true, true>(collision)) {
return;
}
hMultiplicityvsPercentile->Fill(getMultiplicity(collision), collision.multNTracksPV());
for (const auto& track : tracks) {
if (!isTrackSelected<true>(track, collision)) {
continue;
}
}
} // end of the process function
PROCESS_SWITCH(tofSpectra, processStandard, "Standard processor from AO2D", true);

Preslice<aod::SpTracks> spPerCol = aod::spectra::collisionId;
SliceCache cacheTrk;
void processDerived(aod::SpColls const& collisions,
aod::SpTracks const& tracks)
{
for (const auto& collision : collisions) {
if (!isEventSelected<true, true>(collision)) {
return;
}
const auto& tracksInCollision = tracks.sliceByCached(aod::spectra::collisionId, collision.globalIndex(), cacheTrk);
for (const auto& track : tracksInCollision) {
if (!isTrackSelected<true>(track, collision)) {
continue;
}
fillParticleHistos<false, PID::Pion>(track, collision);
fillParticleHistos<false, PID::Kaon>(track, collision);
fillParticleHistos<false, PID::Proton>(track, collision);
}
}
} // end of the process function
PROCESS_SWITCH(tofSpectra, processDerived, "Derived data processor", false);

#define makeProcessFunction(processorName, inputPid, particleId, isFull, tofTable, tpcTable) \
void process##processorName##inputPid(CollisionCandidates::iterator const& collision, \
soa::Join<TrackCandidates, \
Expand Down

0 comments on commit eabeeda

Please sign in to comment.