-
Notifications
You must be signed in to change notification settings - Fork 225
Separate luminosity calculation #4317
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| #include "StreamingBcoCheck.h" | ||
|
|
||
| //#include "BcoInfo.h" | ||
| #include "StreamingBcoInfo.h" | ||
| #include "StreamingLumiInfo.h" | ||
| //#include "BcoStreamingLumiInfov1.h" | ||
|
|
||
|
|
||
| #include <ffaobjects/SyncDefs.h> | ||
| #include <ffaobjects/SyncObject.h> | ||
|
|
||
| #include <ffarawobjects/Gl1Packet.h> | ||
|
|
||
| #include <fun4all/Fun4AllReturnCodes.h> | ||
| #include <fun4all/SubsysReco.h> // for SubsysReco | ||
| #include <fun4all/Fun4AllHistoManager.h> | ||
| #include <fun4all/Fun4AllServer.h> | ||
|
|
||
|
|
||
| #include <phool/PHCompositeNode.h> | ||
| #include <phool/PHNode.h> // for PHNode | ||
| #include <phool/PHNodeIterator.h> // for PHNodeIterator | ||
| #include <phool/getClass.h> | ||
| #include <phool/phool.h> // for PHWHERE | ||
|
|
||
|
|
||
| #include <iostream> | ||
|
|
||
| StreamingBcoCheck::StreamingBcoCheck(const std::string &name) | ||
| : SubsysReco(name) | ||
| { | ||
| return; | ||
| } | ||
|
|
||
| int StreamingBcoCheck::Init(PHCompositeNode *topNode) | ||
| { | ||
| int iret = CreateNodeTree(topNode); | ||
|
|
||
| return iret; | ||
| } | ||
|
|
||
| int StreamingBcoCheck::CreateNodeTree(PHCompositeNode *topNode) | ||
| { | ||
| PHNodeIterator iter(topNode); | ||
| PHCompositeNode *dstNode; | ||
| dstNode = dynamic_cast<PHCompositeNode *>(iter.findFirst("PHCompositeNode", "DST")); | ||
| if (!dstNode) | ||
| { | ||
| std::cout << PHWHERE << " DST Node is missing doing nothing" << std::endl; | ||
| return Fun4AllReturnCodes::ABORTRUN; | ||
| } | ||
| return Fun4AllReturnCodes::EVENT_OK; | ||
| } | ||
|
|
||
| int StreamingBcoCheck::process_event(PHCompositeNode *topNode) | ||
| { | ||
| StreamingBcoInfo *streaming_bco_info = findNode::getClass<StreamingBcoInfo>(topNode, "STREAMINGBCOINFO"); | ||
| if (streaming_bco_info) | ||
| { | ||
| if (Verbosity() > 1) | ||
| { | ||
| std::cout << "bco : " << streaming_bco_info->get_bco() << std::endl; | ||
| std::cout << "usable bco tag : " << streaming_bco_info->get_usable_bco_tag() << std::endl; | ||
| std::cout << "bco streaming window : (" << streaming_bco_info->get_bco_streaming_window().first << ", " << streaming_bco_info->get_bco_streaming_window().second << ")" << std::endl; | ||
| } | ||
| } | ||
|
|
||
| return Fun4AllReturnCodes::EVENT_OK; | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| #ifndef BCOLUMICOUNT_STREAMINGBCOCHECK_H | ||
| #define BCOLUMICOUNT_STREAMINGBCOCHECK_H | ||
|
|
||
| #include <fun4all/SubsysReco.h> | ||
| #include <fun4all/Fun4AllHistoManager.h> | ||
|
|
||
| #include <string> | ||
|
|
||
| #include <TH1.h> | ||
|
|
||
|
|
||
| class StreamingBcoCheck : public SubsysReco | ||
| { | ||
| public: | ||
| StreamingBcoCheck(const std::string &name = "BCOCHECKSTREAMINGOUTPUT"); | ||
| ~StreamingBcoCheck() override = default; | ||
|
|
||
| int Init(PHCompositeNode *topNode) override; | ||
| int process_event(PHCompositeNode *topNode) override; | ||
|
|
||
| private: | ||
| static int CreateNodeTree(PHCompositeNode *topNode); | ||
| }; | ||
|
|
||
| #endif // BCOLUMICOUNT_STREAMINGBCOCHECK_H |
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #ifndef BCOLUMICOUNT_STREAMINGBCORECO_H | ||
| #define BCOLUMICOUNT_STREAMINGBCORECO_H | ||
|
|
||
| #include <fun4all/SubsysReco.h> | ||
| #include <fun4all/Fun4AllHistoManager.h> | ||
|
|
||
| #include <string> | ||
| #include <utility> | ||
| #include <array> | ||
|
|
||
| class TH1; | ||
|
|
||
| class StreamingBcoReco : public SubsysReco | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is replacing
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I did not use the cleanest workflow here. I started with the I believe you are right and we can
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After double checking, it looks like all the correct files are already there with no extras, though it looks very confusing how git decided to rename vs remove / add files. Ignoring the small changes to the |
||
| { | ||
| public: | ||
| StreamingBcoReco(const std::string &name = "STREAMINGBCOLUMIRECO"); | ||
| ~StreamingBcoReco() override = default; | ||
|
|
||
| int Init(PHCompositeNode *topNode) override; | ||
| int process_event(PHCompositeNode *topNode) override; | ||
|
|
||
| virtual int get_evtno() const { return m_evtno; } | ||
|
|
||
| virtual uint64_t get_bco() const { return m_bco; } | ||
|
|
||
| virtual bool get_usable_bco_tag() const { return m_usable_bco_tag; } | ||
|
|
||
| virtual std::pair<uint64_t, uint64_t> get_bco_streaming_window() const { return m_bco_streaming_window; } | ||
|
|
||
| virtual void set_default_positive_window_length(int val) { m_default_positive_window_length = val; } | ||
| virtual void set_default_negative_window_length(int val) { m_default_negative_window_length = val; } | ||
|
Comment on lines
+30
to
+31
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Reject negative window lengths at the API boundary. These setters take Source: Path instructions |
||
|
|
||
|
|
||
|
|
||
| private: | ||
| static int CreateNodeTree(PHCompositeNode *topNode); | ||
| const int trigbits = 40; | ||
| Fun4AllHistoManager *hm = nullptr; | ||
| TH1 *h_bco_diff = nullptr; | ||
| TH1 *h_bco_diff_trigbits[40] = {nullptr}; | ||
| TH1 *h_bco_tag = nullptr; | ||
|
|
||
| uint64_t m_bco{0}; | ||
| int m_bunches = 120; | ||
| int m_evtno{0}; | ||
| bool m_usable_bco_tag = false; | ||
| std::pair<uint64_t, uint64_t> m_bco_streaming_window; | ||
| unsigned int m_default_positive_window_length{340}; | ||
| unsigned int m_default_negative_window_length{20}; | ||
| }; | ||
|
|
||
| #endif // BCOLUMICOUNT_STREAMINGBCORECO_H | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Fail fast when
STREAMINGBCOINFOis missing.This checker currently returns
EVENT_OKeven when its required input node is absent, so a brokenStreamingBcoReco/checker wiring silently looks healthy.StreamingBcoReco's downstream contract treats a missingSTREAMINGBCOINFOas an abort condition, so the validator should do the same here.Suggested fix
int StreamingBcoCheck::process_event(PHCompositeNode *topNode) { StreamingBcoInfo *streaming_bco_info = findNode::getClass<StreamingBcoInfo>(topNode, "STREAMINGBCOINFO"); - if (streaming_bco_info) - { - if (Verbosity() > 1) - { - std::cout << "bco : " << streaming_bco_info->get_bco() << std::endl; - std::cout << "usable bco tag : " << streaming_bco_info->get_usable_bco_tag() << std::endl; - std::cout << "bco streaming window : (" << streaming_bco_info->get_bco_streaming_window().first << ", " << streaming_bco_info->get_bco_streaming_window().second << ")" << std::endl; - } - } + if (!streaming_bco_info) + { + std::cout << PHWHERE << " STREAMINGBCOINFO node missing" << std::endl; + return Fun4AllReturnCodes::ABORTEVENT; + } + + if (Verbosity() > 1) + { + std::cout << "bco : " << streaming_bco_info->get_bco() << std::endl; + std::cout << "usable bco tag : " << streaming_bco_info->get_usable_bco_tag() << std::endl; + std::cout << "bco streaming window : (" << streaming_bco_info->get_bco_streaming_window().first + << ", " << streaming_bco_info->get_bco_streaming_window().second << ")" << std::endl; + } return Fun4AllReturnCodes::EVENT_OK; }As per path instructions, this code path should prioritize correctness and error handling.
📝 Committable suggestion
Source: Path instructions