Skip to content
Open
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
35 changes: 14 additions & 21 deletions offline/packages/centrality/CentralityReco.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@

#include <ffamodules/CDBInterface.h>
#include <cdbobjects/CDBTTree.h>
#include <cdbobjects/CDBTF.h>

#include <TF1.h>

#include <fun4all/Fun4AllReturnCodes.h>

Expand Down Expand Up @@ -62,18 +65,17 @@ int CentralityReco::InitRun(PHCompositeNode *topNode)
{
return Fun4AllReturnCodes::ABORTRUN;
}

std::string vertexscale_url = m_cdb->getUrl("CentralityVertexScale");
if (m_overwrite_vtx)
{
vertexscale_url = m_overwrite_url_vtx;
std::cout << " Overwriting Vtx to " << m_overwrite_url_vtx << std::endl;
}

if (Download_centralityVertexScales(vertexscale_url))
{
return Fun4AllReturnCodes::ABORTRUN;
}
{
return Fun4AllReturnCodes::ABORTRUN;
}

CreateNodes(topNode);
return Fun4AllReturnCodes::EVENT_OK;
Expand Down Expand Up @@ -149,7 +151,7 @@ int CentralityReco::Download_centralityVertexScales(const std::string &dbfile)
{
cdbttree->Print();
}

int nvertexbins = cdbttree->GetIntValue(0, "nvertexbins");


Expand Down Expand Up @@ -291,31 +293,23 @@ int CentralityReco::GetNodes(PHCompositeNode *topNode)
std::cout << __FILE__ << " :: " << __FUNCTION__ << " :: " << __LINE__ << std::endl;
}

m_mb_info = findNode::getClass<MinimumBiasInfo>(topNode, "MinimumBiasInfo");
m_mb_info = findNode::getClass<MinimumBiasInfo>(topNode, m_mb_info_nodename);

if (!m_mb_info)
{
std::cout << "no mb_info node " << std::endl;
return Fun4AllReturnCodes::ABORTRUN;
}

m_global_vertex_map = findNode::getClass<GlobalVertexMap>(topNode, "GlobalVertexMap");

if (!m_global_vertex_map)
{
std::cout << "no vertex map node " << std::endl;
return Fun4AllReturnCodes::EVENT_OK;
}

m_central = findNode::getClass<CentralityInfo>(topNode, "CentralityInfo");
m_central = findNode::getClass<CentralityInfo>(topNode, m_centrality_nodename);

if (!m_central)
{
std::cout << "no centrality node " << std::endl;
return Fun4AllReturnCodes::ABORTRUN;
}

m_mbd_container = findNode::getClass<MbdPmtContainer>(topNode, "MbdPmtContainer");
m_mbd_container = findNode::getClass<MbdPmtContainer>(topNode, m_mbd_pmt_nodename);

if (!m_mbd_container)
{
Expand All @@ -324,7 +318,7 @@ int CentralityReco::GetNodes(PHCompositeNode *topNode)
}


m_mbd_out = findNode::getClass<MbdOut>(topNode, "MbdOut");
m_mbd_out = findNode::getClass<MbdOut>(topNode, m_mbd_out_nodename);
if (Verbosity())
{
std::cout << "Getting MBD Out" << std::endl;
Expand Down Expand Up @@ -365,7 +359,7 @@ void CentralityReco::CreateNodes(PHCompositeNode *topNode)

CentralityInfo *central = new CentralityInfov2();

PHIODataNode<PHObject> *centralityNode = new PHIODataNode<PHObject>(central, "CentralityInfo", "PHObject");
PHIODataNode<PHObject> *centralityNode = new PHIODataNode<PHObject>(central, m_centrality_nodename, "PHObject");
detNode->addNode(centralityNode);

return;
Expand All @@ -376,15 +370,14 @@ float CentralityReco::getVertexScale()


float mbd_vertex = m_mbd_out->get_zvtx();

for (auto v_range_scale : m_vertex_scales)
{
auto v_range = v_range_scale.first;
if (Verbosity())
{
std::cout << "vertexrange : "<<v_range.first<<"-"<<v_range.second << std::endl;
}

if (mbd_vertex > v_range.first && mbd_vertex <= v_range.second)
{
return v_range_scale.second;
Expand Down
32 changes: 32 additions & 0 deletions offline/packages/centrality/CentralityReco.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <string> // for string, allocator

// Forward declarations
class TF1;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Is m_use_vtx_function actually read anywhere?
rg -nP '\bm_use_vtx_function\b' -C2

# Is TF1 or CDBTF used anywhere in the centrality package?
rg -nP '\bTF1\b|\bCDBTF\b' -C2 -g 'offline/packages/centrality/**'

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1242


🏁 Script executed:

# Search for any actual usage/assignment of m_use_vtx_function (not just declaration)
rg -n 'm_use_vtx_function' offline/packages/centrality/ -A2 -B2

# Search for actual instantiation or usage of TF1 objects
rg -n 'TF1\s*[\(\[]|new\s+TF1|\..*TF1' offline/packages/centrality/ -C2

# Search for CDBTF usage
rg -n 'CDBTF\s*[\(\[]|new\s+CDBTF|CDBTF::' offline/packages/centrality/ -C2

# Check the full CentralityReco.cc to see the complete implementation context
wc -l offline/packages/centrality/CentralityReco.cc

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 467


🏁 Script executed:

# Read the full CentralityReco.cc to check for actual usage
cat -n offline/packages/centrality/CentralityReco.cc | head -50

# Also check if there are any setter/getter methods for m_use_vtx_function
rg -n 'use_vtx_function|UseVtxFunction|setUseVtxFunction' offline/packages/centrality/

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 1630


🏁 Script executed:

# Read more of the implementation to see if TF1 or m_use_vtx_function are used anywhere
sed -n '41,200p' offline/packages/centrality/CentralityReco.cc | cat -n

# Check process method and remaining code
sed -n '200,388p' offline/packages/centrality/CentralityReco.cc | cat -n

Repository: sPHENIX-Collaboration/coresoftware

Length of output: 10825


Remove the unused TF1 forward-declaration, includes, and member toggle, or complete the implementation.

The class TF1; forward-decl (line 11), #include <TF1.h>, #include <cdbobjects/CDBTF.h>, and the m_use_vtx_function{true} member (line 96) are present but completely unused in the implementation. Shipping a public member variable that defaults to true but has no effect risks users mistaking it for working functionality and complicates future real implementation efforts.

Either complete the vertex function feature in this PR or defer it by removing these declarations until the implementation is ready.

class CentralityInfo;
class MinimumBiasInfo;
class PHCompositeNode;
Expand Down Expand Up @@ -51,21 +52,52 @@ class CentralityReco : public SubsysReco
m_overwrite_url_scale = url;
m_overwrite_scale = true;
}

void setOverwriteVtx(const std::string &url)
{
m_overwrite_url_vtx = url;
m_overwrite_vtx = true;
}

void set_minbiasNodeName(const std::string &name)
{
m_mb_info_nodename = name;
}
void set_mbdOutNodeName(const std::string &name)
{
m_mbd_out_nodename = name;
}
void set_centralityNodeName(const std::string &name)
{
m_centrality_nodename = name;
}
void set_mbdPmtNodeName(const std::string &name)
{
m_mbd_pmt_nodename = name;
}


private:


float getVertexScale();

std::string m_dbfilename;

std::string m_mb_info_nodename{"MinimumBiasInfo"};

std::string m_mbd_out_nodename{"MbdOut"};

std::string m_centrality_nodename{"CentralityInfo"};

std::string m_mbd_pmt_nodename{"MbdPmtContainer"};


bool m_use_vtx_function{true};
bool m_overwrite_divs{false};
bool m_overwrite_scale{false};
bool m_overwrite_vtx{false};

std::string m_overwrite_url_divs{""};
std::string m_overwrite_url_scale{""};
std::string m_overwrite_url_vtx{""};
Expand Down
41 changes: 27 additions & 14 deletions offline/packages/trigger/MinimumBiasClassifier.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,28 +125,31 @@ int MinimumBiasClassifier::FillMinimumBiasInfo()
// return Fun4AllReturnCodes::EVENT_OK;
// }


if (m_global_vertex_map->empty())
{
m_mb_info->setIsAuAuMinimumBias(false);
return Fun4AllReturnCodes::EVENT_OK;
if (m_abortEvents) return 1;
return 0;
}

GlobalVertex *vtx = m_global_vertex_map->begin()->second;
if (!vtx)
{
m_mb_info->setIsAuAuMinimumBias(false);
return Fun4AllReturnCodes::EVENT_OK;
if (m_abortEvents) return 1;
return 0;
}

if (!vtx->isValid())
{
m_mb_info->setIsAuAuMinimumBias(false);
return Fun4AllReturnCodes::EVENT_OK;
if (m_abortEvents) return 1;
return 0;
}

bool minbiascheck = true;
;


m_vertex = vtx->get_z();

m_vertex_scale = getVertexScale();
Expand All @@ -160,7 +163,8 @@ int MinimumBiasClassifier::FillMinimumBiasInfo()
if (!m_zdcinfo)
{
m_mb_info->setIsAuAuMinimumBias(false);
return Fun4AllReturnCodes::EVENT_OK;
if (m_abortEvents) return 1;
return 0;
}
}
// Z vertex is within range
Expand Down Expand Up @@ -226,9 +230,13 @@ int MinimumBiasClassifier::FillMinimumBiasInfo()
}

m_mb_info->setIsAuAuMinimumBias(minbiascheck);

return Fun4AllReturnCodes::EVENT_OK;
if (!minbiascheck && m_abortEvents)
{
return 1;
}
return 0;
}

int MinimumBiasClassifier::process_event(PHCompositeNode *topNode)
{
if (Verbosity())
Expand All @@ -244,7 +252,11 @@ int MinimumBiasClassifier::process_event(PHCompositeNode *topNode)

if (FillMinimumBiasInfo())
{
return Fun4AllReturnCodes::EVENT_OK;
if (Verbosity())
{
std::cout << "MinimumBiasClassifier::process_event Aborting Event - not minbias" << std::endl;
}
return Fun4AllReturnCodes::ABORTEVENT;
}

return Fun4AllReturnCodes::EVENT_OK;
Expand All @@ -257,15 +269,15 @@ int MinimumBiasClassifier::GetNodes(PHCompositeNode *topNode)
std::cout << __FILE__ << " :: " << __FUNCTION__ << " :: " << __LINE__ << std::endl;
}

m_mb_info = findNode::getClass<MinimumBiasInfo>(topNode, "MinimumBiasInfo");
m_mb_info = findNode::getClass<MinimumBiasInfo>(topNode, m_mb_info_nodename);

if (!m_mb_info)
{
std::cout << "no minimum bias node " << std::endl;
return Fun4AllReturnCodes::ABORTRUN;
}

m_mbd_container = findNode::getClass<MbdPmtContainer>(topNode, "MbdPmtContainer");
m_mbd_container = findNode::getClass<MbdPmtContainer>(topNode, m_mbd_pmt_nodename);
if (Verbosity())
{
std::cout << "Getting MBD Tubes" << std::endl;
Expand All @@ -279,7 +291,7 @@ int MinimumBiasClassifier::GetNodes(PHCompositeNode *topNode)

if (!m_issim && m_useZDC)
{
m_zdcinfo = findNode::getClass<Zdcinfo>(topNode, "Zdcinfo");
m_zdcinfo = findNode::getClass<Zdcinfo>(topNode, m_zdc_info_nodename);
if (Verbosity())
{
std::cout << "Getting ZDC Info" << std::endl;
Expand All @@ -296,7 +308,7 @@ int MinimumBiasClassifier::GetNodes(PHCompositeNode *topNode)
std::cout << "Getting Vertex Map" << std::endl;
}

m_global_vertex_map = findNode::getClass<GlobalVertexMap>(topNode, "GlobalVertexMap");
m_global_vertex_map = findNode::getClass<GlobalVertexMap>(topNode, m_global_vertex_nodename);

if (!m_global_vertex_map)
{
Expand Down Expand Up @@ -325,9 +337,10 @@ void MinimumBiasClassifier::CreateNodes(PHCompositeNode *topNode)
dstNode->addNode(detNode);
}

std::string nodename = m_mb_info_nodename;
MinimumBiasInfo *mb = new MinimumBiasInfov1();

PHIODataNode<PHObject> *mbNode = new PHIODataNode<PHObject>(mb, "MinimumBiasInfo", "PHObject");
PHIODataNode<PHObject> *mbNode = new PHIODataNode<PHObject>(mb, nodename, "PHObject");
detNode->addNode(mbNode);

return;
Expand Down
27 changes: 26 additions & 1 deletion offline/packages/trigger/MinimumBiasClassifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class MinimumBiasClassifier : public SubsysReco
~MinimumBiasClassifier() override = default;

int InitRun(PHCompositeNode *) override;
static void CreateNodes(PHCompositeNode *);
void CreateNodes(PHCompositeNode *);
int GetNodes(PHCompositeNode *);

//! event processing method
Expand Down Expand Up @@ -60,8 +60,28 @@ class MinimumBiasClassifier : public SubsysReco
void setIsSim(const bool sim) { m_issim = sim; }

void setSpecies(MinimumBiasInfo::SPECIES spec) { m_species = spec; };

void abortEvents(const bool abort) { m_abortEvents = abort; };

void set_minbiasNodeName(const std::string &name)
{
m_mb_info_nodename = name;
}
void set_mbdPmtNodeName(const std::string &name)
{
m_mbd_pmt_nodename = name;
}
void set_zdcInfoNodeName(const std::string &name)
{
m_zdc_info_nodename = name;
}
void set_globalvertexNodeName(const std::string &name)
{
m_global_vertex_nodename = name;
}

private:
bool m_abortEvents{false};
bool m_issim{false};
bool m_useZDC{true};
bool m_box_cut{true};
Expand All @@ -73,6 +93,11 @@ class MinimumBiasClassifier : public SubsysReco
float getVertexScale();
std::string m_dbfilename;

std::string m_mb_info_nodename{"MinimumBiasInfo"};
std::string m_mbd_pmt_nodename{"MbdPmtContainer"};
std::string m_zdc_info_nodename{"Zdcinfo"};
std::string m_global_vertex_nodename{"GlobalVertexMap"};

bool m_overwrite_scale{false};
bool m_overwrite_vtx{false};
std::string m_overwrite_url_scale{""};
Expand Down