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

editing histograms made by ReadTriggerInfo #1319

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

obirney450
Copy link

Eliminated MC histograms, updated code to reflect modern conventions, and created new breakdown histograms to graph events' passage/failure of filters and modules.

@FNALbuild
Copy link
Collaborator

Hi @OBlivate450,
You have proposed changes to files in these packages:

  • Trigger

which require these tests: build.

@Mu2e/fnalbuild-users, @Mu2e/write have access to CI actions on main.

⌛ The following tests have been triggered for 359953f: build (Build queue is empty)

About FNALbuild. Code review on Mu2e/Offline.

@FNALbuild
Copy link
Collaborator

☀️ The build tests passed at 359953f.

Test Result Details
test with Command did not list any other PRs to include
merge Merged 359953f at e8fecef
build (prof) Log file. Build time: 08 min 26 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
FIXME, TODO TODO (0) FIXME (0) in 1 files
clang-tidy 🔶 0 errors 583 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 359953f after being merged into the base branch at e8fecef.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@kutschke
Copy link
Collaborator

@OBlivate450 please tell us who you are . I cannot figure it out from the information on GitHub. We ask that everyone put enough information on your own GitHub page for your colleagues to know who you are.

@kutschke kutschke self-assigned this Jul 31, 2024
@obirney450
Copy link
Author

obirney450 commented Jul 31, 2024 via email

@FNALbuild
Copy link
Collaborator

📝 The HEAD of main has changed to b5d3931. Tests are now out of date.

@kutschke
Copy link
Collaborator

kutschke commented Jul 31, 2024 via email

@FNALbuild
Copy link
Collaborator

⌛ The following tests have been triggered for 359953f: build (Build queue is empty)

@FNALbuild
Copy link
Collaborator

☀️ The build tests passed at 359953f.

Test Result Details
test with Command did not list any other PRs to include
merge Merged 359953f at b5d3931
build (prof) Log file. Build time: 04 min 12 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
FIXME, TODO TODO (0) FIXME (0) in 1 files
clang-tidy 🔶 0 errors 583 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 359953f after being merged into the base branch at b5d3931.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

@obirney450
Copy link
Author

@FNALbuild run build test

@FNALbuild
Copy link
Collaborator

⌛ The following tests have been triggered for 359953f: build (Build queue is empty)

@FNALbuild
Copy link
Collaborator

☀️ The build tests passed at 359953f.

Test Result Details
test with Command did not list any other PRs to include
merge Merged 359953f at b5d3931
build (prof) Log file. Build time: 04 min 13 sec
ceSimReco Log file.
g4test_03MT Log file.
transportOnly Log file.
POT Log file.
g4study Log file.
cosmicSimReco Log file.
cosmicOffSpill Log file.
ceSteps Log file.
ceDigi Log file.
muDauSteps Log file.
ceMix Log file.
rootOverlaps Log file.
g4surfaceCheck Log file.
FIXME, TODO TODO (0) FIXME (0) in 1 files
clang-tidy 🔶 0 errors 583 warnings
whitespace check no whitespace errors found

N.B. These results were obtained from a build of this Pull Request at 359953f after being merged into the base branch at b5d3931.

For more information, please check the job page here.
Build artifacts are deleted after 5 days. If this is not desired, select Keep this build forever on the job page.

Copy link
Collaborator

@kutschke kutschke 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 good work.

Most of my comments are about issues that were present before you touched the code but we are using the review process to bring code up to standards. While it's a little unlucky that you get stuck with this, I think that most are straightforward to fix.

Please let me know if you have any questions.

fhicl::Atom<float> nProcess {Name("nEventsProcessed" ), Comment("Number of events processed" ) };
};

explicit ReadTriggerInfo(const art::EDAnalyzer::Table<Config>& config);
virtual ~ReadTriggerInfo() { }
Copy link
Collaborator

Choose a reason for hiding this comment

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

A have a few general clean up comments. I know that these were there when you started this work but we are asking everyone who touches a file to upgrade it to our current standards.

Please remove the line for the destructor. The default compiler written default destructor will do the right thing. Our preference is to simply not write a destructor if the compiler written default destructor is OK.

fhicl::Atom<float> nProcess {Name("nEventsProcessed" ), Comment("Number of events processed" ) };
};

explicit ReadTriggerInfo(const art::EDAnalyzer::Table<Config>& config);
virtual ~ReadTriggerInfo() { }

virtual void beginJob();
Copy link
Collaborator

Choose a reason for hiding this comment

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

This comment is in the same spirit as the first.

Please write this line as

void beginJob() override;

The override is very important. It tells the compiler that this member function overrides a virtual function in the base class. If the signature of the function and the return type do not match a function in the base class, you will get a compile time error. While everything here looks correct, it's important to always use override.

FYI. Declaring a function virtual does NOT do the same as override. The compiler does not know if you intended to override a virtual function in the base class or if you plan to use this class as a base class and the virutal is there because you intend future subclasses to override it.

Once you have used override, the prefix virtual is redundant. So our style is not to include it.

Please do the same for endJob, endSubRun, analyze and beginRun.

void fillCaloCalibTrigInfo (int Index , const CaloCluster* HCl, caloCalibrationHist_ &Hist);
void fillOccupancyInfo (int Index , const StrawDigiCollection*SDCol, const CaloDigiCollection*CDCol, occupancyHist_ &Hist);

void trigValidation_module_cc (int& Index , std::string& PathName, unsigned& IndexLastModule, summaryInfoHist_ &Hist);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please rename this function to remove _module; it's misleading. What is the meaning of _cc here? If it's just c++ then please remove it too. If it's something else please choose a better name.

_trigHelix. resize(_nMaxTrig);
_trigEvtPS. resize(_nMaxTrig);

_trigAll. resize(_nMaxTrig);
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can move all of the vector resizes into the intializer list.

_trigAll(_nMaxTrig);

We recommend that if something can be intialized in the intializer list, it should be.

The default constructor of trigInfo_ will be called for each member (also true with resize).

}
// for (size_t i=0; i< _trigPaths.size(); ++i){
// Hist._hTrigBits->GetXaxis()->SetBinLabel(i+1, _trigPaths[i].c_str());
// }
Copy link
Collaborator

Choose a reason for hiding this comment

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

With a few exceptions, please no not leave commented out code in files. You can use the git history mechanism to see removed code. One exception is if the code is currently under development but not ready to go. If the code is for debug/testing purposes, we prefer that you keep it present but protect it with a run-time configuration varaible named something like debug_level or verbosity, with 0 meaning no output and higher numbers meaning more output. The case for commenting out such code is if it will consume a lot of resources even if you it is never called.

@@ -366,6 +325,11 @@ namespace mu2e {
Hist._h2DTrigInfo[0] = trigInfoDir.make<TH2F>("h2DTrigInfo_map_all" , "Trigger correlation map from all filters" , (_nMaxTrig+2), -0.5, (_nMaxTrig+1.5), (_nMaxTrig+2), -0.5, (_nMaxTrig+1.5));
Hist._h2DTrigInfo[1] = trigInfoDir.make<TH2F>("h2DTrigInfo_map" , "Trigger correlation map" , (_nMaxTrig+2), -0.5, (_nMaxTrig+1.5), (_nMaxTrig+2), -0.5, (_nMaxTrig+1.5));

//add a for loop for creating histograms like
for(int i=0; i<30; ++i){
Copy link
Collaborator

Choose a reason for hiding this comment

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

Don't use literal numbers. Is 30 already defined in an another variable? If not please do:

constexpr int variable_with_a_descriptive_name{30};
for ( int i=0; i<variable_with_a_descriptive_name; ++i){
  // body of the loop
 }

Alternatively, use a simple name but with a descriptive comment.

@@ -1066,7 +766,15 @@ namespace mu2e {
const mu2e::TriggerInfo* trigInfo(0);

for (unsigned int i=0; i< _trigPaths.size(); ++i){
string&path = _trigPaths.at(i);
// std::string&path = _trigPaths.at(i);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove commented out code.

@@ -1066,7 +766,15 @@ namespace mu2e {
const mu2e::TriggerInfo* trigInfo(0);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Use nullptr, not 0, to intialize pointers.

double z_min = std::numeric_limits<double>::max();
double z_max = std::numeric_limits<double>::lowest();
for (const auto& finter : KSeed->intersections()) {
if (finter.position3().z() < z_min) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Prefer:

z_min = std::min( z_min, finter.position3().z());
z_max = std::max( z_max, finter.position3().z());

}

double lambda = fseg.loopHelix().lam();
double pitch = std::abs(lambda)*6.28;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is 6.28 this 2*PI?

constexpr twopi = 2.*M_PI

@kutschke
Copy link
Collaborator

kutschke commented Aug 1, 2024

I should also mention that if you push new commits to the branch in your fork, they will automatically be included in the PR.

@kutschke
Copy link
Collaborator

kutschke commented Aug 2, 2024

@gianipez Olivia tells me that she has completed her summer job. When you are back from vacation let's discuss how to move this forward. All of my change requests are for general cleanup that I ask for whenever we touch older files.

@FNALbuild
Copy link
Collaborator

📝 The HEAD of main has changed to e389271. Tests are now out of date.

@brownd1978 brownd1978 assigned brownd1978 and unassigned kutschke Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants