diff --git a/offline/packages/centrality/CentralityReco.cc b/offline/packages/centrality/CentralityReco.cc index 0a45ecb2c1..bc478366a5 100644 --- a/offline/packages/centrality/CentralityReco.cc +++ b/offline/packages/centrality/CentralityReco.cc @@ -13,6 +13,9 @@ #include #include +#include + +#include #include @@ -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; @@ -149,7 +151,7 @@ int CentralityReco::Download_centralityVertexScales(const std::string &dbfile) { cdbttree->Print(); } - + int nvertexbins = cdbttree->GetIntValue(0, "nvertexbins"); @@ -291,7 +293,7 @@ int CentralityReco::GetNodes(PHCompositeNode *topNode) std::cout << __FILE__ << " :: " << __FUNCTION__ << " :: " << __LINE__ << std::endl; } - m_mb_info = findNode::getClass(topNode, "MinimumBiasInfo"); + m_mb_info = findNode::getClass(topNode, m_mb_info_nodename); if (!m_mb_info) { @@ -299,15 +301,7 @@ int CentralityReco::GetNodes(PHCompositeNode *topNode) return Fun4AllReturnCodes::ABORTRUN; } - m_global_vertex_map = findNode::getClass(topNode, "GlobalVertexMap"); - - if (!m_global_vertex_map) - { - std::cout << "no vertex map node " << std::endl; - return Fun4AllReturnCodes::EVENT_OK; - } - - m_central = findNode::getClass(topNode, "CentralityInfo"); + m_central = findNode::getClass(topNode, m_centrality_nodename); if (!m_central) { @@ -315,7 +309,7 @@ int CentralityReco::GetNodes(PHCompositeNode *topNode) return Fun4AllReturnCodes::ABORTRUN; } - m_mbd_container = findNode::getClass(topNode, "MbdPmtContainer"); + m_mbd_container = findNode::getClass(topNode, m_mbd_pmt_nodename); if (!m_mbd_container) { @@ -324,7 +318,7 @@ int CentralityReco::GetNodes(PHCompositeNode *topNode) } - m_mbd_out = findNode::getClass(topNode, "MbdOut"); + m_mbd_out = findNode::getClass(topNode, m_mbd_out_nodename); if (Verbosity()) { std::cout << "Getting MBD Out" << std::endl; @@ -365,7 +359,7 @@ void CentralityReco::CreateNodes(PHCompositeNode *topNode) CentralityInfo *central = new CentralityInfov2(); - PHIODataNode *centralityNode = new PHIODataNode(central, "CentralityInfo", "PHObject"); + PHIODataNode *centralityNode = new PHIODataNode(central, m_centrality_nodename, "PHObject"); detNode->addNode(centralityNode); return; @@ -376,7 +370,6 @@ 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; @@ -384,7 +377,7 @@ float CentralityReco::getVertexScale() { std::cout << "vertexrange : "< v_range.first && mbd_vertex <= v_range.second) { return v_range_scale.second; diff --git a/offline/packages/centrality/CentralityReco.h b/offline/packages/centrality/CentralityReco.h index bc0483d57d..37f97082ef 100644 --- a/offline/packages/centrality/CentralityReco.h +++ b/offline/packages/centrality/CentralityReco.h @@ -8,6 +8,7 @@ #include // for string, allocator // Forward declarations +class TF1; class CentralityInfo; class MinimumBiasInfo; class PHCompositeNode; @@ -51,11 +52,31 @@ 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: @@ -63,9 +84,20 @@ class CentralityReco : public SubsysReco 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{""}; diff --git a/offline/packages/trigger/MinimumBiasClassifier.cc b/offline/packages/trigger/MinimumBiasClassifier.cc index c36a9430e1..f702fe9754 100644 --- a/offline/packages/trigger/MinimumBiasClassifier.cc +++ b/offline/packages/trigger/MinimumBiasClassifier.cc @@ -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(); @@ -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 @@ -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()) @@ -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; @@ -257,7 +269,7 @@ int MinimumBiasClassifier::GetNodes(PHCompositeNode *topNode) std::cout << __FILE__ << " :: " << __FUNCTION__ << " :: " << __LINE__ << std::endl; } - m_mb_info = findNode::getClass(topNode, "MinimumBiasInfo"); + m_mb_info = findNode::getClass(topNode, m_mb_info_nodename); if (!m_mb_info) { @@ -265,7 +277,7 @@ int MinimumBiasClassifier::GetNodes(PHCompositeNode *topNode) return Fun4AllReturnCodes::ABORTRUN; } - m_mbd_container = findNode::getClass(topNode, "MbdPmtContainer"); + m_mbd_container = findNode::getClass(topNode, m_mbd_pmt_nodename); if (Verbosity()) { std::cout << "Getting MBD Tubes" << std::endl; @@ -279,7 +291,7 @@ int MinimumBiasClassifier::GetNodes(PHCompositeNode *topNode) if (!m_issim && m_useZDC) { - m_zdcinfo = findNode::getClass(topNode, "Zdcinfo"); + m_zdcinfo = findNode::getClass(topNode, m_zdc_info_nodename); if (Verbosity()) { std::cout << "Getting ZDC Info" << std::endl; @@ -296,7 +308,7 @@ int MinimumBiasClassifier::GetNodes(PHCompositeNode *topNode) std::cout << "Getting Vertex Map" << std::endl; } - m_global_vertex_map = findNode::getClass(topNode, "GlobalVertexMap"); + m_global_vertex_map = findNode::getClass(topNode, m_global_vertex_nodename); if (!m_global_vertex_map) { @@ -325,9 +337,10 @@ void MinimumBiasClassifier::CreateNodes(PHCompositeNode *topNode) dstNode->addNode(detNode); } + std::string nodename = m_mb_info_nodename; MinimumBiasInfo *mb = new MinimumBiasInfov1(); - PHIODataNode *mbNode = new PHIODataNode(mb, "MinimumBiasInfo", "PHObject"); + PHIODataNode *mbNode = new PHIODataNode(mb, nodename, "PHObject"); detNode->addNode(mbNode); return; diff --git a/offline/packages/trigger/MinimumBiasClassifier.h b/offline/packages/trigger/MinimumBiasClassifier.h index 5f32c10a62..ea235fbc1e 100644 --- a/offline/packages/trigger/MinimumBiasClassifier.h +++ b/offline/packages/trigger/MinimumBiasClassifier.h @@ -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 @@ -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}; @@ -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{""};