-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Pack triggerobject standalone and photons/muon updated packing for miniaod #18739
Conversation
A new Pull Request was created by @arizzi for master. It involves the following packages: DataFormats/PatCandidates @perrotta, @cmsbuild, @slava77, @monttj, @davidlange6 can you please review it and eventually sign? Thanks. cms-bot commands are listed here |
@cmsbuild please test |
The tests are being triggered in jenkins. |
@@ -25,6 +31,7 @@ TriggerObjectStandAlone::TriggerObjectStandAlone() : | |||
TriggerObject() | |||
{ | |||
filterLabels_.clear(); | |||
filterLabelIndices_.clear(); |
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.
Why are you calling clear
in a constructor?
/// Vector of labels of all HLT filters or names od L1 conditions the trigger objects has been used in | ||
std::vector< std::string > filterLabels_; | ||
/// Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in | ||
mutable std::vector< std::string > filterLabels_; |
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.
This is not thread safe and therefore could not be put into the Event.
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.
See the section on lazy caching for how to do this safely
https://twiki.cern.ch/twiki/bin/view/CMSPublic/FWMultithreadedThreadSafeDataStructures#Use_Atomics
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.
I do not see a classes_def.xml
rule that prevents this from being written out. So if it gets filled in someones job they would pay the storage cost.
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.
well it is cleared before when packing, anyhow this topic of what we should write and when we should compress (what we should make mutable etc. etc..) is still to be finalized.
|
||
//if (0!=(pset=psetRegistry->getMapped(config.parameterSetID()))) { | ||
|
||
edm::pset::Registry* psetRegistry = edm::pset::Registry::instance(); |
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.
This will almost certainly fail if someone attempts to use TTree::Draw
since the registry will not have been filled. I also do not know if fwlite::Event
calls would have filled the Registry.
@@ -49,6 +52,9 @@ namespace pat { | |||
/// The vector is empty for data (size 0), if the according information is not available. | |||
std::vector< bool > pathL3FilterAccepted_; | |||
|
|||
edm::ParameterSetID psetId_; | |||
std::string processName_; |
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.
What is the point of processName_
? It is set but can not be accessed and nothing reads it.
@@ -306,3 +328,120 @@ void TriggerObjectStandAlone::unpackPathNames(const edm::TriggerNames &names) { | |||
pathNames_.swap(paths); | |||
} | |||
|
|||
void TriggerObjectStandAlone::packFilterLabels(const std::vector<std::string> &names) const { | |||
if (!filterLabelIndices_.empty()) { |
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.
This function is not thread safe
@@ -260,6 +274,14 @@ bool TriggerObjectStandAlone::checkIfPathsAreUnpacked(bool throwIfPacked) const | |||
if (!unpacked && throwIfPacked) throw cms::Exception("RuntimeError", "This TriggerObjectStandAlone object has packed trigger path names. Before accessing path names you must call unpackPathNames with an edm::TriggerNames object. You can get the latter from the edm::Event or fwlite::Event and the TriggerResults\n"); | |||
return unpacked; | |||
} | |||
bool TriggerObjectStandAlone::checkIfFiltersAreUnpacked(bool unpack) const { | |||
bool unpacked = filterLabelIndices_.empty(); |
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.
This is not thread safe since filterLabelIndices_
can mutate during a const
call.
@@ -260,6 +274,14 @@ bool TriggerObjectStandAlone::checkIfPathsAreUnpacked(bool throwIfPacked) const | |||
if (!unpacked && throwIfPacked) throw cms::Exception("RuntimeError", "This TriggerObjectStandAlone object has packed trigger path names. Before accessing path names you must call unpackPathNames with an edm::TriggerNames object. You can get the latter from the edm::Event or fwlite::Event and the TriggerResults\n"); | |||
return unpacked; | |||
} | |||
bool TriggerObjectStandAlone::checkIfFiltersAreUnpacked(bool unpack) const { | |||
bool unpacked = filterLabelIndices_.empty(); |
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.
This is not thread safe since filterLabelIndices_
can mutate during a const
call.
std::vector< std::string > filterLabels_; | ||
/// Vector of labels of all HLT filters or names of L1 conditions the trigger objects has been used in | ||
mutable std::vector< std::string > filterLabels_; | ||
mutable std::vector< uint16_t > filterLabelIndices_; |
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.
What is the intended relationship between filterLabels_
and filterLabelIndices_
? On a quick look, it appears you only intend one of these to be filled at a time?
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.
the original design was to have both possibly filled with the first being a fallback when the name cannot be mapped and at the same time acting as the "unpacked" container.
probably we do not need this flexibility and we can stick to one mutable and one persistent but a decision has not been made yet.
|
||
const unsigned int n(triggerNames.size()); | ||
std::set<std::string> saveTags; | ||
for (unsigned int i=0;i!=n; ++i) { |
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.
I'm afraid I do not know what this code is doing.
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.
using namespace trigger; | ||
|
||
const ParameterSet& HLTPSet(pset->getParameterSet("@trigger_paths")); | ||
auto triggerNames= HLTPSet.getParameter<vector<string> >("@trigger_paths"); |
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.
This doesn't seem to match what I see in edm::EventBase::triggerNames_
and edm::TriggerNames::TriggerNames(edm::ParameterSet cons&)
.
edm::pset::Registry* psetRegistry = edm::pset::Registry::instance();
edm::ParameterSet const* pset=0;
if (0!=(pset=psetRegistry->getMapped(triggerResults.parameterSetID()))) {
if (pset->existsAs<std::vector<std::string> >("@trigger_paths", true)) {
TriggerNames triggerNames(*pset);
...
and the constructor does
TriggerNames::TriggerNames(edm::ParameterSet const& pset) {
triggerNames_ = pset.getParameter<Strings>("@trigger_paths");
...
So I think what you want is
auto triggerNames=pset->getParameter<std::vector<std::string>>("@trigger_paths");
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.
this is taken from here:
https://github.com/cms-sw/cmssw/blob/master/HLTrigger/HLTcore/src/HLTConfigData.cc#L91-L95
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.
Your code fragment is correct. What I originally looked at was starting from the PSetID for the trigger results PSet while your code is starting from the top level PSet.
Comparison job queued. |
The mutable are just a temporary fix before we decide the final way to go (i.e. allow both version of the object with packed and unpacked or force one of the two to be only transient) The code in eventBase accesses triggerNames and this is NOT what we need here. Can you comment on how we can be sure that fwlite loads the registry? Is there a way to force it to do so? |
Comparison is ready Comparison Summary:
|
@Dr15Jones we are adapting it (I'll push the commit asap) to get the Event as input so that we are sure it internally calls triggerNames and hence the registry is filled... but... wouldn't it be better if EventBase has some |
I'm actually working on |
@slava77 all set from our side, please trigger the compile and test again |
please test |
The tests are being triggered in jenkins. |
@arizzi |
@gpetruc can you have a look? |
@cmsbuild please test the last attempt failed in the infrastructure somewhere
|
The tests are being triggered in jenkins. |
Comparison job queued. |
Comparison is ready Comparison Summary:
|
@slava77 anything else missing? |
On 5/29/17 2:26 AM, arizzi wrote:
@slava77 <https://github.com/slava77> anything else missing?
I think no, I will check later today.
…
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#18739 (comment)>, or
mute the thread
<https://github.com/notifications/unsubscribe-auth/AEdcbkuLaxQoBbrvsw9YuV_gJh782x4Jks5r-o84gaJpZM4NbPn7>.
|
+1
|
This PR packs further the TriggerObjectStandalone for miniaod (from 6Kb/ev on ttbar to 3.8kb/ev) as well as photon and muon objects.
The label packing in trigger object is now thread-safe and can be eventually further improved once the new function EventBase::getParameterSet is integrated in the release.
We could merge this as-is and then improve the access via the new function once available
@gpetruc @Dr15Jones