Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please consider the following formatting changes to #4306 #217

Merged
merged 1 commit into from
Jan 14, 2024
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
36 changes: 19 additions & 17 deletions PWGLF/TableProducer/cascadebuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@ struct cascadeBuilder {
ConfigurableAxis axisTopoVarDCAToPV{"axisTopoVarDCAToPV", {200, -1, 1.0}, "single track DCA to PV (cm)"};
ConfigurableAxis axisTopoVarDCAV0ToPV{"axisTopoVarDCAV0ToPV", {200, 0, 5.0}, "V0 DCA to PV (cm)"};

// round some V0 core variables up to a certain level of precision if requested
// round some V0 core variables up to a certain level of precision if requested
// useful to keep derived data sizes under control
// variables that are rounded include the DCAs but not the CosPA (precision needed)
// variables that are rounded include the DCAs but not the CosPA (precision needed)
Configurable<bool> roundDCAVariables{"roundDCAVariables", false, "round topological variables"};
Configurable<float> precisionDCAs{"precisionDCAs", 0.01f, "precision to keep the DCAs with"};

Expand Down Expand Up @@ -279,21 +279,23 @@ struct cascadeBuilder {
{"hNegativeITSClusters", "hNegativeITSClusters", {HistType::kTH1D, {{10, -0.5f, 9.5f}}}},
{"hBachelorITSClusters", "hBachelorITSClusters", {HistType::kTH1D, {{10, -0.5f, 9.5f}}}}}};

float roundToPrecision( float number, float step = 0.01){
float roundToPrecision(float number, float step = 0.01)
{
// this function rounds a certain number in an axis that is quantized by
// the variable 'step'; the rounded number is placed halfway between
// n*step and (n+1)*step such that analysis can be done with absolutely
// no issue with precision 'step'.
return step*static_cast<float>(static_cast<int>((number)/step))+TMath::Sign(1.0f,number)*(0.5f)*step;
return step * static_cast<float>(static_cast<int>((number) / step)) + TMath::Sign(1.0f, number) * (0.5f) * step;
}

void roundCascadeCandidateVariables(){
// Do not round actual cascade (pseudo-)track DCAs -> consider they may be tracked, high precision
cascadecandidate.dcacascdau = roundToPrecision ( cascadecandidate.dcacascdau , precisionDCAs);
cascadecandidate.v0dcadau = roundToPrecision ( cascadecandidate.v0dcadau , precisionDCAs);
cascadecandidate.v0dcanegtopv = roundToPrecision ( cascadecandidate.v0dcanegtopv , precisionDCAs);
cascadecandidate.v0dcapostopv = roundToPrecision ( cascadecandidate.v0dcapostopv , precisionDCAs);
cascadecandidate.bachDCAxy = roundToPrecision ( cascadecandidate.bachDCAxy , precisionDCAs);
void roundCascadeCandidateVariables()
{
// Do not round actual cascade (pseudo-)track DCAs -> consider they may be tracked, high precision
cascadecandidate.dcacascdau = roundToPrecision(cascadecandidate.dcacascdau, precisionDCAs);
cascadecandidate.v0dcadau = roundToPrecision(cascadecandidate.v0dcadau, precisionDCAs);
cascadecandidate.v0dcanegtopv = roundToPrecision(cascadecandidate.v0dcanegtopv, precisionDCAs);
cascadecandidate.v0dcapostopv = roundToPrecision(cascadecandidate.v0dcapostopv, precisionDCAs);
cascadecandidate.bachDCAxy = roundToPrecision(cascadecandidate.bachDCAxy, precisionDCAs);
}

void resetHistos()
Expand Down Expand Up @@ -1311,8 +1313,8 @@ struct cascadeBuilder {
continue; // doesn't pass cascade selections

// round the DCA variables to a certain precision if asked
if ( roundDCAVariables )
roundCascadeCandidateVariables();
if (roundDCAVariables)
roundCascadeCandidateVariables();

cascidx(/*cascadecandidate.v0Id, */ cascade.globalIndex(),
cascadecandidate.positiveId, cascadecandidate.negativeId,
Expand Down Expand Up @@ -1374,8 +1376,8 @@ struct cascadeBuilder {
continue; // doesn't pass cascade selections

// round the DCA variables to a certain precision if asked
if ( roundDCAVariables )
roundCascadeCandidateVariables();
if (roundDCAVariables)
roundCascadeCandidateVariables();

registry.fill(HIST("hKFParticleStatistics"), 2.0f);

Expand Down Expand Up @@ -1441,8 +1443,8 @@ struct cascadeBuilder {
continue; // doesn't pass cascade selections

// round the DCA variables to a certain precision if asked
if ( roundDCAVariables )
roundCascadeCandidateVariables();
if (roundDCAVariables)
roundCascadeCandidateVariables();

// fill regular tables (no strangeness tracking)
cascidx(/*cascadecandidate.v0Id, */ cascade.globalIndex(),
Expand Down
24 changes: 13 additions & 11 deletions PWGLF/TableProducer/lambdakzerobuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ struct lambdakzeroBuilder {
Configurable<std::string> mVtxPath{"mVtxPath", "GLO/Calib/MeanVertex", "Path of the mean vertex file"};
Configurable<bool> skipGRPOquery{"skipGRPOquery", true, "skip grpo query"};

// round some V0 core variables up to a certain level of precision if requested
// round some V0 core variables up to a certain level of precision if requested
// useful to keep derived data sizes under control
// variables that are rounded include the DCAs but not the CosPA (precision needed)
// variables that are rounded include the DCAs but not the CosPA (precision needed)
Configurable<bool> roundDCAVariables{"roundDCAVariables", false, "round topological variables"};
Configurable<float> precisionDCAs{"precisionDCAs", 0.01f, "precision to keep the DCAs with"};

Expand Down Expand Up @@ -244,19 +244,21 @@ struct lambdakzeroBuilder {
return std::sqrt((std::pow((pvY - Y) * Pz - (pvZ - Z) * Py, 2) + std::pow((pvX - X) * Pz - (pvZ - Z) * Px, 2) + std::pow((pvX - X) * Py - (pvY - Y) * Px, 2)) / (Px * Px + Py * Py + Pz * Pz));
}

float roundToPrecision( float number, float step = 0.01){
float roundToPrecision(float number, float step = 0.01)
{
// this function rounds a certain number in an axis that is quantized by
// the variable 'step'; the rounded number is placed halfway between
// n*step and (n+1)*step such that analysis can be done with absolutely
// no issue with precision 'step'.
return step*static_cast<float>(static_cast<int>((number)/step))+TMath::Sign(1.0f,number)*(0.5f)*step;
return step * static_cast<float>(static_cast<int>((number) / step)) + TMath::Sign(1.0f, number) * (0.5f) * step;
}

void roundV0CandidateVariables(){
v0candidate.dcaV0dau = roundToPrecision ( v0candidate.dcaV0dau , precisionDCAs);
v0candidate.posDCAxy = roundToPrecision ( v0candidate.posDCAxy , precisionDCAs);
v0candidate.negDCAxy = roundToPrecision ( v0candidate.negDCAxy , precisionDCAs);
v0candidate.dcav0topv = roundToPrecision ( v0candidate.dcav0topv , precisionDCAs);
void roundV0CandidateVariables()
{
v0candidate.dcaV0dau = roundToPrecision(v0candidate.dcaV0dau, precisionDCAs);
v0candidate.posDCAxy = roundToPrecision(v0candidate.posDCAxy, precisionDCAs);
v0candidate.negDCAxy = roundToPrecision(v0candidate.negDCAxy, precisionDCAs);
v0candidate.dcav0topv = roundToPrecision(v0candidate.dcav0topv, precisionDCAs);
}

void resetHistos()
Expand Down Expand Up @@ -817,8 +819,8 @@ struct lambdakzeroBuilder {
}

// round the DCA variables to a certain precision if asked
if ( roundDCAVariables )
roundV0CandidateVariables();
if (roundDCAVariables)
roundV0CandidateVariables();

// V0 logic reminder
// 0: v0 saved for the only due to the cascade, 1: standalone v0, 3: standard v0 with photon-only test
Expand Down
25 changes: 13 additions & 12 deletions PWGLF/TableProducer/strangederivedbuilder.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ struct strangederivedbuilder {

Configurable<bool> fillEmptyCollisions{"fillEmptyCollisions", false, "fill collision entries without candidates"};

// round Nsigma variables up to a certain level of precision if requested
// round Nsigma variables up to a certain level of precision if requested
// useful to keep derived data sizes under control
// variables that are rounded include the DCAs but not the CosPA (precision needed)
// variables that are rounded include the DCAs but not the CosPA (precision needed)
Configurable<bool> roundNSigmaVariables{"roundNSigmaVariables", false, "round NSigma variables"};
Configurable<float> precisionNSigmas{"precisionNSigmas", 0.1f, "precision to keep NSigmas"};

Expand All @@ -138,12 +138,13 @@ struct strangederivedbuilder {

int64_t currentCollIdx;

float roundToPrecision( float number, float step = 0.01){
float roundToPrecision(float number, float step = 0.01)
{
// this function rounds a certain number in an axis that is quantized by
// the variable 'step'; the rounded number is placed halfway between
// n*step and (n+1)*step such that analysis can be done with absolutely
// no issue with precision 'step'.
return step*static_cast<float>(static_cast<int>((number)/step))+TMath::Sign(1.0f,number)*(0.5f)*step;
return step * static_cast<float>(static_cast<int>((number) / step)) + TMath::Sign(1.0f, number) * (0.5f) * step;
}

void init(InitContext& context)
Expand Down Expand Up @@ -345,14 +346,14 @@ struct strangederivedbuilder {
tr.tpcNClsFound(), tr.tpcNClsCrossedRows());

// round if requested
if( roundNSigmaVariables ){
dauTrackTPCPIDs(tr.tpcSignal(),
roundToPrecision ( tr.tpcNSigmaEl(), precisionNSigmas ),
roundToPrecision ( tr.tpcNSigmaPi(), precisionNSigmas ),
roundToPrecision ( tr.tpcNSigmaKa(), precisionNSigmas ),
roundToPrecision ( tr.tpcNSigmaPr(), precisionNSigmas ),
roundToPrecision ( tr.tpcNSigmaHe(), precisionNSigmas ));
}else{
if (roundNSigmaVariables) {
dauTrackTPCPIDs(tr.tpcSignal(),
roundToPrecision(tr.tpcNSigmaEl(), precisionNSigmas),
roundToPrecision(tr.tpcNSigmaPi(), precisionNSigmas),
roundToPrecision(tr.tpcNSigmaKa(), precisionNSigmas),
roundToPrecision(tr.tpcNSigmaPr(), precisionNSigmas),
roundToPrecision(tr.tpcNSigmaHe(), precisionNSigmas));
} else {
dauTrackTPCPIDs(tr.tpcSignal(), tr.tpcNSigmaEl(),
tr.tpcNSigmaPi(), tr.tpcNSigmaKa(),
tr.tpcNSigmaPr(), tr.tpcNSigmaHe());
Expand Down