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

Adding the photon kinematics for the EMCal clusters QA type plots #3175

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

aahanab
Copy link

@aahanab aahanab commented Oct 8, 2024

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • [ x] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work for users)
  • Requiring change in macros repository (Please provide links to the macros pull request in the last section)
  • I am a member of GitHub organization of sPHENIX Collaboration, EIC, or ECCE (contact Chris Pinkenburg to join)

What kind of change does this PR introduce? (Bug fix, feature, ...)

Adding the photon kinematics plots (eta, phi, energy and chi squared) for the EMCal clusters.
comment: <> ( What does this PR do? Linking to talk in software meeting encouraged )

TODOs (if applicable)

Links to other PRs in macros and calibration repositories (if applicable)

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 43fe149177589c3fb82a28e2ced30407ef85061b:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

Copy link
Contributor

@ruse-traveler ruse-traveler left a comment

Choose a reason for hiding this comment

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

This is very nice to see! Thank you for the work on this!!

In general, things are in very good shape, but there's a some work to do to get it working within the QA environment. I've written out all of my suggestions in the review comments!

The only other thing is to make sure to add your .h and .cc files to the Makefile!

private:
std::string outfilename;
TFile *outfile;

Copy link
Contributor

Choose a reason for hiding this comment

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

We'll want to add a few members here for bookkeeping:

  • 1st is that we'll need to keep the module name on hand for making histogram names: this will help us keep track of what histograms are coming from which modules!
  • 2nd is that we might need to change the input node.
  • 3rd is that we might need to add a tag to a histogram.
  • And then we'll need to know if we're selecting triggers (doTrgSelect) and, if we are, which one (trgToSelect).
Suggested change
std::string modulename;
std::string inputnode;
std::string histtag;
uint32_t trgToSelect;
bool doTrgSelect;

int Reset(PHCompositeNode * /*topNode*/) override;

void Print(const std::string &what = "ALL") const override;

Copy link
Contributor

Choose a reason for hiding this comment

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

Just in case we want to check this as a function of trigger type (e.g. Photon5), we'll need some way to set which trigger to select.

Suggested change
/// specifies a trigger to select
void SetTrgToSelect(const uitn32_t trig = JetQADefs::GL1::MBDNSPhoton1)
{
doTrgSelect = true;
trgToSelect = trig;
}

public:


photonjetskinematics(const std::string &outputfilename = "output");
Copy link
Contributor

Choose a reason for hiding this comment

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

While we won't need to specify an output file (since this is managed by the QA histogram manager), we will need to provide the module name since that will be added to the histogram names! And while we probably won't need to change the input node, building in the ability to do so can't hurt...

Suggested change
photonjetskinematics(const std::string &outputfilename = "output");
photonjetskinematics(const std::string &modulename = "photonjetskinematics", const std:string &inputnode = "CLUSTERINFO_CEMC");

int Reset(PHCompositeNode * /*topNode*/) override;

void Print(const std::string &what = "ALL") const override;

Copy link
Contributor

Choose a reason for hiding this comment

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

We'll want to be able to add additional tags to histogram names to label things (e.g. if we're selecting a particular trigger), so we'll need to add a setter.

Suggested change
/// set histogram tag
void SetHistTag(const std::string& tag)
{
histtag = tag;
}

Comment on lines 35 to 40
photonjetskinematics::photonjetskinematics(const std::string &outputfilename):
SubsysReco("photonjetskinematics")
, outfilename(outputfilename)
{
std::cout << "photonjetskinematics::photonjetskinematics(const std::string &name, const std::string&outputfilename) Calling ctor" << std::endl;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In line with the suggestion in the header; here we can set the module name and input node. We can also hide some of the output messages behind a couple levels of verbosity to keep log files from getting too big!

Suggested change
photonjetskinematics::photonjetskinematics(const std::string &outputfilename):
SubsysReco("photonjetskinematics")
, outfilename(outputfilename)
{
std::cout << "photonjetskinematics::photonjetskinematics(const std::string &name, const std::string&outputfilename) Calling ctor" << std::endl;
}
photonjetskinematics::photonjetskinematics(const std::string &modulename, const std::string &inputnode):
SubsysReco(modulename)
, modulename(modulename)
, inputnode(inputnode)
, histtag("AllTrig")
, trgToSelect(JetQADefs::GL1::MBDNSJet1)
, doTrgSelect(false)
{
if (Verbosity() > 1) std::cout << "photonjetskinematics::photonjetskinematics(const std::string &name, const std::string&outputfilename) Calling ctor" << std::endl;
}

Comment on lines 155 to 157
PHTFileServer::get().cd(outfilename);

//outfile->cd("photonjetskinematics");
Copy link
Contributor

Choose a reason for hiding this comment

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

The manager will handle all histogram saving...

Suggested change
PHTFileServer::get().cd(outfilename);
//outfile->cd("photonjetskinematics");

Comment on lines 160 to 164
h_emcal_cluster_eta_phi->Write("h_emcal_cluster_eta_phi");
h_emcal_cluster_energy->Write("h_emcal_cluster_energy");
h_emcal_cluster_chi2->Write("h_emcal_cluster_chi2");
h_emcal_cluster_eta->Write("h_emcal_cluster_eta"); // Save 1D eta plot
h_emcal_cluster_phi->Write("h_emcal_cluster_phi"); // Save 1D phi plot
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we instead register the output histograms with the manager rather than save them to a particular file.

Suggested change
h_emcal_cluster_eta_phi->Write("h_emcal_cluster_eta_phi");
h_emcal_cluster_energy->Write("h_emcal_cluster_energy");
h_emcal_cluster_chi2->Write("h_emcal_cluster_chi2");
h_emcal_cluster_eta->Write("h_emcal_cluster_eta"); // Save 1D eta plot
h_emcal_cluster_phi->Write("h_emcal_cluster_phi"); // Save 1D phi plot
manager->registerHisto(h_emcal_cluster_eta_phi);
manager->registerHisto(h_emcal_cluster_energy);
manager->registerHisto(h_emcal_cluster_chi2);
manager->registerHisto(h_emcal_cluster_eta); // Save 1D eta plot
manager->registerHisto(h_emcal_cluster_phi); // Save 1D phi plot

h_emcal_cluster_eta->Write("h_emcal_cluster_eta"); // Save 1D eta plot
h_emcal_cluster_phi->Write("h_emcal_cluster_phi"); // Save 1D phi plot

std::cout << "photonjetskinematics::End(PHCompositeNode *topNode) This is the End..." << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::cout << "photonjetskinematics::End(PHCompositeNode *topNode) This is the End..." << std::endl;
if (Verbosity() > 1) std::cout << "photonjetskinematics::End(PHCompositeNode *topNode) This is the End..." << std::endl;

//____________________________________________________________________________..
int photonjetskinematics::Reset(PHCompositeNode *topNode)
{
std::cout << "photonjetskinematics::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::cout << "photonjetskinematics::Reset(PHCompositeNode *topNode) being Reset" << std::endl;
if (Verbosity() > 1) std::cout << "photonjetskinematics::Reset(PHCompositeNode *topNode) being Reset" << std::endl;

//____________________________________________________________________________..
void photonjetskinematics::Print(const std::string &what) const
{
std::cout << "photonjetskinematics::Print(const std::string &what) const Printing info for " << what << std::endl;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
std::cout << "photonjetskinematics::Print(const std::string &what) const Printing info for " << what << std::endl;
if (Verbosity() > 1) std::cout << "photonjetskinematics::Print(const std::string &what) const Printing info for " << what << std::endl;

@aahanab aahanab marked this pull request as ready for review October 14, 2024 21:50
@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 3646d30039ff4d912afcfb7412b59222afc27d9a:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

Copy link
Contributor

@ruse-traveler ruse-traveler left a comment

Choose a reason for hiding this comment

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

Thanks for the changes!! For some reason I can't mark my previous suggestions as resolved, but I'm happy with this as-is!

The only other comment is a minor one about using m_ prefixes, but I'll leave it up to you whether or not to implement it. (I can always implement it later in a subsequent editing pass.)

#include <vector>
//____________________________________________________________________________..

photonjetskinematics::photonjetskinematics(const std::string &m_modulename, const std::string &m_inputnode) :
Copy link
Contributor

Choose a reason for hiding this comment

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

Apologies! I should've been more clear: the m_ is for variables that are class members (e.g. the ones starting at line 75 of the .h file), and then the arguments here usually aren't prefixed by anything😅

Merge remote-tracking branch 'upstream/master' into photonQA
@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 36228822f427411b894cc2d48fef1c9b29ceee6b:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

…he build

Merge remote-tracking branch 'upstream/master' into photonQA
@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 0dbc266a27b7e64074505a21b5ac52f0cc3ae997:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

@sphenix-jenkins-ci
Copy link

Build & test report

Report for commit 4a11793dcfe19ef80d6a217922717b8a5ae5b338:
Jenkins on fire


Automatically generated by sPHENIX Jenkins continuous integration
sPHENIX             jenkins.io

Copy link
Contributor

@ruse-traveler ruse-traveler left a comment

Choose a reason for hiding this comment

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

Looks like Jenkins still isn't happy... The only issues are some clang-tidy warnings that aren't related to this PR and cpp-check, which is throwing an error about manager not being initialized in the constructor. Otherwise, all other checks are passed!

I've left a couple of comments in the code about how to fix the cpp-check issue...

// TFile *outfile;
// hist manager

Fun4AllHistoManager* manager;
Copy link
Contributor

Choose a reason for hiding this comment

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

So (hopefully 🤞) this is the last issue: manager not being initialized in the constructor is throwing a warning on Jenkins... I'll add a comment where this needs to be added.

Comment on lines +48 to +53
SubsysReco(m_modulename)
, modulename(m_modulename)
, inputnode(m_inputnode)
, histtag("AllTrig")
, trgToSelect(JetQADefs::GL1::MBDNSJet1)
, doTrgSelect(false)
Copy link
Contributor

Choose a reason for hiding this comment

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

Here we'll need to initialize manager, so something like so:

Suggested change
SubsysReco(m_modulename)
, modulename(m_modulename)
, inputnode(m_inputnode)
, histtag("AllTrig")
, trgToSelect(JetQADefs::GL1::MBDNSJet1)
, doTrgSelect(false)
SubsysReco(m_modulename)
, modulename(m_modulename)
, inputnode(m_inputnode)
, histtag("AllTrig")
, trgToSelect(JetQADefs::GL1::MBDNSJet1)
, doTrgSelect(false)
, manager(nullptr)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants