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

Splitmerge #28

Merged
merged 63 commits into from
Sep 28, 2016
Merged

Splitmerge #28

merged 63 commits into from
Sep 28, 2016

Conversation

alicerobson
Copy link
Contributor

Hi Colin
Here we go. Ran the tests and I think it should be OK.
I figured out this morning worry (had wrong number of events in test) so everything now matches to my satisfaction.
Let me know what you think.
Alice
PS your new tutorial test is super cool (had a good look it in trying to understand the random seed problems)

GaelTouquet and others added 30 commits June 2, 2016 11:59
Copy link
Owner

@cbernet cbernet left a comment

Choose a reason for hiding this comment

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

Hi again Alice,

This is excellent. In addition to your new features I appreciate the effort to clean things up.

My comments are really mostly about cosmetics. I only request a few changes before approval.

I guess the main thing is : again, what did we decide with pfinput.py? are you going to remove it later?


class PDebugger(Analyzer):
''' Module to output physics debug output
'''
Copy link
Owner

@cbernet cbernet Sep 27, 2016

Choose a reason for hiding this comment

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

Could you please add documentation for this module?
the documentation should include an example configuration fragment, as done in other analyzers, e.g.
https://github.com/cbernet/heppy/blob/master/analyzers/Filter.py


#turn on output to stdout if requested
if hasattr(self.cfg_ana, 'output_to_stdout') and self.cfg_ana.output_to_stdout:
pdebugging.set_stream(sys.stdout,level=logging.INFO)
Copy link
Owner

Choose a reason for hiding this comment

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

the log level could be passed through cfg_ana

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we discuss?

Copy link
Owner

Choose a reason for hiding this comment

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

fine

pdebugging.pdebugger.setLevel(logging.INFO)
pass

def process(self, event):
Copy link
Owner

Choose a reason for hiding this comment

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

not clear what this analyzer is doing. from the process method, i see that it only prints the event number, but the docstrings seem to imply that it's much more than that.
The documentation should explain why this analyzer is necessary.
For instance, mention that this analyzer:

  • sets up the pdebugging tool, a separate logger for physics
  • logs for each event the number of event
    Then, explain that the pdebugging module should be used wherever the user wants a physics debug output.
    no need to repeat the pdebugging documentation, the documentation for this module should be therein

if hasattr(self.cfg_ana, 'debug_filename'):
pdebugging.set_file(self.cfg_ana.debug_filename)
pdebugging.pdebugger.setLevel(logging.INFO)
pass
Copy link
Owner

Choose a reason for hiding this comment

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

please review the whole code and remove all unecessary pass statements


def process(self, event):
pdebugging.pdebugger.info(str('Event: {}'.format(event.iEv)))
pass
Copy link
Owner

Choose a reason for hiding this comment

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

unecessary .. last mention of it


# these lines moved earlier in order to match cpp logic
if ptc.q()!=0:
pdebugger.info("Made " + ptc.track.__str__())
Copy link
Owner

Choose a reason for hiding this comment

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

string concatenation with + is inefficient, please use join.

self.propagate(ptc)
if ptc.q()!=0:
pdebugger.info("Made " + ptc.track.__str__())
Copy link
Owner

Choose a reason for hiding this comment

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

string concatenation with + is inefficient, please use join.

ecal = self.detector.elements['ecal']
self.prop_helix.propagate_one(ptc,
ecal.volume.inner,
self.detector.elements['field'].magnitude )
if ptc.q()!=0:
pdebugger.info("Made " + ptc.track.__str__())
Copy link
Owner

Choose a reason for hiding this comment

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

string concatenation with + is inefficient, please use join.

for gen_ptc in ptcs:
ptc = pfsimparticle(gen_ptc)
if ptc.pdgid() == 22:
self.simulate_photon(ptc)
elif abs(ptc.pdgid()) == 11:
elif abs(ptc.pdgid()) == 11: #check with colin
Copy link
Owner

Choose a reason for hiding this comment

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

what to check?
maybe remove these comments (with the one below for muons)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My last code contained smear_electron(ptc) instead of propagate electron. Similarly for Muons. Was wanting to understand why the change and what implications (if any) it has.

@@ -42,7 +42,7 @@ def __str__(self):
q = self.q(),
p4 = super(Particle, self).__str__()
)

Copy link
Owner

Choose a reason for hiding this comment

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

remove

@alicerobson
Copy link
Contributor Author

Hi Colin
I have been through all of your comments and addressed all but the ones that I have queried.
I have also played around with pylint and tidied up one or two files to some extent.
I have not merged with your latest master but can do so if you wish.
The tests run OK.
Best Wishes
Alice

@cbernet cbernet merged commit 6d0797a into cbernet:master Sep 28, 2016
selvaggi pushed a commit to selvaggi/heppy that referenced this pull request Dec 19, 2016
@alicerobson alicerobson deleted the splitmerge branch November 15, 2017 14:14
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.

3 participants