Opened 10 years ago
Last modified 4 years ago
#377 new Task
When modifying Candidate class, change constructor, Copy(), & Clear()
Reported by: | Keith Pedersen | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | Delphes code | Version: | Delphes 3 |
Keywords: | Candidate NewCandidate constructor initialize initialization default value clear copy | Cc: |
Description
Hello,
I am currently writing a new Delphes module to address some process specific needs. This module required adding 3 Float_t
fields to the Candidate class (which I know is big enough already, but there's no alternative). One of my fields is used as a flag before it is used as storage, so it needs a specific default value. As such, I altered the Candidate constructor to properly initialize my new fields.
However, I was not aware that:
factory->NewCandidate()
re-uses previously allocated Candidates when it can, re-initializing them with the function Candidate::Clear()
. Thus, when my module stopped working after the first event, it took me a little while to figure out why.
Based on my experience, I think it would be helpful to add a small comment to the top of the Candidate class definition in DelphesClasses.h, reminding users that, if they add a new field to Candidate, they should change the Clear()
and Copy()
functions in addition to the constructor.
Thanks again,
Keith