Skip to content

Commit

Permalink
Please consider the following formatting changes
Browse files Browse the repository at this point in the history
  • Loading branch information
alibuild committed Mar 5, 2024
1 parent a9218a2 commit 15c826e
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 68 deletions.
2 changes: 1 addition & 1 deletion PWGUD/Core/SGCutParHolder.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class SGCutParHolder
float minPt = 0., float maxPt = 1000.,
float minEta = -1.0, float maxEta = 1.0,
float maxFITtime = 4,
float minRgtrwTOF = 0.,
float minRgtrwTOF = 0.,
std::vector<float> FITAmpLimits = {0., 0., 0., 0., 0.}) : mNDtcoll{ndtcoll}, mMinNBCs{nMinBCs}, mWithFwdTracks{withFwdTracks}, mGlobalTracksOnly{globalTracksOnly}, mITSOnlyTracks{ITSonlyTracks}, mMinNTracks{MinNTracks}, mMaxNTracks{MaxNTracks}, mPidHypo{pidHypo}, mMinVertexPosz{MinPosz}, mMaxVertexPosz{MaxPosz}, mMinPt{minPt}, mMaxPt{maxPt}, mMinEta{minEta}, mMaxEta{maxEta}, mMaxFITtime{maxFITtime}, mMinRgtrwTOF{minRgtrwTOF}, mFITAmpLimits{FITAmpLimits}
{
}
Expand Down
122 changes: 71 additions & 51 deletions PWGUD/Core/SGSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,71 +8,91 @@
#include "PWGUD/Core/UDHelpers.h"
#include "PWGUD/Core/SGCutParHolder.h"

Check failure on line 10 in PWGUD/Core/SGSelector.h

View workflow job for this annotation

GitHub Actions / PR formatting / copyright headers

Missing or malformed copyright notice

This source file is missing the correct copyright notice.
class SGSelector {
public:
SGSelector() : fPDG(TDatabasePDG::Instance()) {}
class SGSelector
{
public:
SGSelector() : fPDG(TDatabasePDG::Instance()) {}

template <typename CC, typename BCs, typename TCs, typename FWs>
int Print(SGCutParHolder diffCuts, CC& collision, BCs& bcRange, TCs& tracks, FWs& fwdtracks) {
LOGF(info, "Size of array %i", collision.size());
return 1;
}
template <typename CC, typename BCs, typename TCs, typename FWs>
int Print(SGCutParHolder diffCuts, CC& collision, BCs& bcRange, TCs& tracks, FWs& fwdtracks)
{
LOGF(info, "Size of array %i", collision.size());
return 1;
}

template <typename CC, typename BCs>
//int IsSelected(SGCutParHolder diffCuts, CC& collision, BCs& bcRange, TCs& tracks, FWs& fwdtracks) {
int IsSelected(SGCutParHolder diffCuts, CC& collision, BCs& bcRange) {
LOGF(debug, "Collision %f", collision.collisionTime());
LOGF(debug, "Number of close BCs: %i", bcRange.size());
template <typename CC, typename BCs>
// int IsSelected(SGCutParHolder diffCuts, CC& collision, BCs& bcRange, TCs& tracks, FWs& fwdtracks) {
int IsSelected(SGCutParHolder diffCuts, CC& collision, BCs& bcRange)
{
LOGF(debug, "Collision %f", collision.collisionTime());
LOGF(debug, "Number of close BCs: %i", bcRange.size());

bool gA = true, gC = true;
int bA = 0, bC = 0;
int64_t bcA[5], bcC[5];
for (auto const& bc : bcRange) {
bcA[bA] = 0;
bcC[bC] = 0;
if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) {gA = false; bcA[bA] = bc.globalBC(); bA++;}
if (!udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) {gC = false; bcC[bC] = bc.globalBC(); bC++;}
}
if (!gA && !gC) return 3;
if (bA > 1 || bC > 1){
LOGF(info, "Number of BCs with FT0 signal: %i, %i", bA, bC);
for (int i = 0; i < bA; i++){
LOGF(info, "Busy BC A-side: %i", bcA[i]);
}
for (int i = 0; i < bC; i++){
LOGF(info, "Busy BC C-side: %i", bcC[i]);
}
}
if (collision.numContrib() < diffCuts.minNTracks() || collision.numContrib() > diffCuts.maxNTracks()) {
return 4;
}
return gA && gC ? 2 : (gA ? 0 : 1);
}
template <typename TFwdTrack>
int FwdTrkSelector(TFwdTrack const& fwdtrack) {
if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3) return 1;
else return 0;
bool gA = true, gC = true;
int bA = 0, bC = 0;
int64_t bcA[5], bcC[5];
for (auto const& bc : bcRange) {
bcA[bA] = 0;
bcC[bC] = 0;
if (!udhelpers::cleanFITA(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) {
gA = false;
bcA[bA] = bc.globalBC();
bA++;
}
if (!udhelpers::cleanFITC(bc, diffCuts.maxFITtime(), diffCuts.FITAmpLimits())) {
gC = false;
bcC[bC] = bc.globalBC();
bC++;
}
}
if (!gA && !gC)
return 3;
if (bA > 1 || bC > 1) {
LOGF(info, "Number of BCs with FT0 signal: %i, %i", bA, bC);
for (int i = 0; i < bA; i++) {
LOGF(info, "Busy BC A-side: %i", bcA[i]);
}
for (int i = 0; i < bC; i++) {
LOGF(info, "Busy BC C-side: %i", bcC[i]);
}
}
if (collision.numContrib() < diffCuts.minNTracks() || collision.numContrib() > diffCuts.maxNTracks()) {
return 4;
}
return gA && gC ? 2 : (gA ? 0 : 1);
}
template <typename TFwdTrack>
int FwdTrkSelector(TFwdTrack const& fwdtrack)
{
if (fwdtrack.trackType() == 0 || fwdtrack.trackType() == 3)
return 1;
else
return 0;
}
template <typename TTrack>
int TrkSelector(SGCutParHolder diffCuts, TTrack const& track) {
int TrkSelector(SGCutParHolder diffCuts, TTrack const& track)
{
auto mass2Use = 0.;
TParticlePDG* pdgparticle = fPDG->GetParticle(diffCuts.pidHypothesis());
if (pdgparticle != nullptr) {
mass2Use = pdgparticle->Mass();
}
auto lvtmp = TLorentzVector();
if (!track.isPVContributor()) return 1;
if (!track.isPVContributor())
return 1;
lvtmp.SetXYZM(track.px(), track.py(), track.pz(), mass2Use);
if (lvtmp.Perp() < diffCuts.minPt() || lvtmp.Perp() > diffCuts.maxPt()) return 2;
if (lvtmp.Eta() < diffCuts.minEta() || lvtmp.Eta() > diffCuts.maxEta()) return 3;
if (diffCuts.globalTracksOnly() && !track.isGlobalTrack()) return 4;
if (!diffCuts.ITSOnlyTracks() && !track.hasTPC()) return 5;
if (lvtmp.Perp() < diffCuts.minPt() || lvtmp.Perp() > diffCuts.maxPt())
return 2;
if (lvtmp.Eta() < diffCuts.minEta() || lvtmp.Eta() > diffCuts.maxEta())
return 3;
if (diffCuts.globalTracksOnly() && !track.isGlobalTrack())
return 4;
if (!diffCuts.ITSOnlyTracks() && !track.hasTPC())
return 5;
return 0;
}
}

private:
TDatabasePDG* fPDG;
private:
TDatabasePDG* fPDG;
};

#endif // PWGUD_CORE_SGSELECTOR_H_

35 changes: 19 additions & 16 deletions PWGUD/TableProducer/SGCandProducer.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -152,21 +152,23 @@ struct SGCandProducer {

// obtain slice of compatible BCs
auto bcRange = udhelpers::compatibleBCs(collision, sameCuts.NDtcoll(), bcs, sameCuts.minNBCs());
auto isSGEvent = sgSelector.IsSelected(sameCuts, collision, bcRange);
auto isSGEvent = sgSelector.IsSelected(sameCuts, collision, bcRange);
registry.get<TH1>(HIST("reco/Stat"))->Fill(0., 1.);
registry.get<TH1>(HIST("reco/Stat"))->Fill(isSGEvent + 1, 1.);
if (isSGEvent <= 2) {
if (isSGEvent < 2) LOGF(info, "Current BC: %i, %i", bc.globalBC(), isSGEvent);
if (sameCuts.minRgtrwTOF()){
if (udhelpers::rPVtrwTOF<true>(tracks, collision.numContrib()) < sameCuts.minRgtrwTOF()) return;
if (isSGEvent < 2)
LOGF(info, "Current BC: %i, %i", bc.globalBC(), isSGEvent);
if (sameCuts.minRgtrwTOF()) {
if (udhelpers::rPVtrwTOF<true>(tracks, collision.numContrib()) < sameCuts.minRgtrwTOF())
return;
}
upchelpers::FITInfo fitInfo{};
udhelpers::getFITinfo(fitInfo, bc.globalBC(), bcs, ft0s, fv0as, fdds);
// update SG candidates tables
outputCollisions(bc.globalBC(), bc.runNumber(),
collision.posX(), collision.posY(), collision.posZ(),
collision.numContrib(), udhelpers::netCharge<true>(tracks),
1.);//rtrwTOF); //omit the calculation to speed up the things while skimming
1.); // rtrwTOF); //omit the calculation to speed up the things while skimming
outputSGCollisions(isSGEvent);
outputCollisionsSels(fitInfo.ampFT0A, fitInfo.ampFT0C, fitInfo.timeFT0A, fitInfo.timeFT0C,
fitInfo.triggerMaskFT0,
Expand All @@ -178,22 +180,23 @@ struct SGCandProducer {
fitInfo.BBFDDApf, fitInfo.BBFDDCpf, fitInfo.BGFDDApf, fitInfo.BGFDDCpf);
outputCollsLabels(collision.globalIndex());
if (bc.has_zdc()) {
auto zdc = bc.zdc();
udZdcsReduced(outputCollisions.lastIndex(), zdc.timeZNA(), zdc.timeZNC(), zdc.energyCommonZNA(), zdc.energyCommonZNC());
}
else{
udZdcsReduced(outputCollisions.lastIndex(), -999, -999, -999, -999);
auto zdc = bc.zdc();
udZdcsReduced(outputCollisions.lastIndex(), zdc.timeZNA(), zdc.timeZNC(), zdc.energyCommonZNA(), zdc.energyCommonZNC());
} else {
udZdcsReduced(outputCollisions.lastIndex(), -999, -999, -999, -999);
}
// update SGTracks tables
for (auto& track : tracks) {
if (!sgSelector.TrkSelector(sameCuts, track)) updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC());
if (!sgSelector.TrkSelector(sameCuts, track))
updateUDTrackTables(outputCollisions.lastIndex(), track, bc.globalBC());
}

// update SGFwdTracks tables
if (sameCuts.withFwdTracks()){
for (auto& fwdtrack : fwdtracks) {
if (!sgSelector.FwdTrkSelector(fwdtrack)) updateUDFwdTrackTables(fwdtrack, bc.globalBC());
}
if (sameCuts.withFwdTracks()) {
for (auto& fwdtrack : fwdtracks) {
if (!sgSelector.FwdTrkSelector(fwdtrack))
updateUDFwdTrackTables(fwdtrack, bc.globalBC());
}
}
}
}
Expand Down

0 comments on commit 15c826e

Please sign in to comment.