Permalink
Browse files

Protect Template Analyzer from merge counter messages

  • Loading branch information...
1 parent bbce753 commit 646019fe7ad1cad8712ee5176d8529161317014b Samvel Khalatyan committed Apr 7, 2012
Showing with 17 additions and 5 deletions.
  1. +2 −0 interface/TemplateAnalyzer.h
  2. +15 −5 src/TemplateAnalyzer.cc
View
2 interface/TemplateAnalyzer.h
@@ -323,6 +323,8 @@ namespace bsm
WDecay decayType(const GenParticle &) const;
WDecay wdecayType(const GenParticle &) const;
+ void invalidate_cache();
+
boost::shared_ptr<SynchSelector> _synch_selector;
boost::shared_ptr<SynchSelector> _synch_selector_with_inverted_htlep;
View
20 src/TemplateAnalyzer.cc
@@ -1226,6 +1226,9 @@ bsm::BtagDelegate *TemplateAnalyzer::getBtagDelegate() const
void TemplateAnalyzer::didCounterAdd(const Counter *counter)
{
+ if (_event_weight.is_invalid())
+ return;
+
if (_counters.end() != _counters.find(counter))
cutflow()->fill(_counters[counter], _event_weight.get());
@@ -1500,15 +1503,16 @@ void TemplateAnalyzer::process(const Event *event)
if (_synch_selector_with_inverted_htlep->reconstruction(resonance.valid)
&& _synch_selector_with_inverted_htlep->ltop(pt(resonance.ltop)))
{
- htlep()->fill(htlepValue(), _event_weight.get());
- htlepBeforeHtlep()->fill(htlepValue(), _event_weight.get());
+ htlep()->fill(htlepValue(), _event_weight_inverted_htlep.get());
+ htlepBeforeHtlep()->fill(htlepValue(),
+ _event_weight_inverted_htlep.get());
htlepBeforeHtlepNoWeight()->fill(htlepValue());
- mttbarBeforeHtlep()->fill(mass(mttbar().mttbar) / 1000, _event_weight.get());
+ mttbarBeforeHtlep()->fill(mass(mttbar().mttbar) / 1000,
+ _event_weight_inverted_htlep.get());
}
}
- _event_weight.invalidate();
- _event_weight_inverted_htlep.invalidate();
+ invalidate_cache();
}
uint32_t TemplateAnalyzer::id() const
@@ -1755,3 +1759,9 @@ WDecay TemplateAnalyzer::wdecayType(const GenParticle &particle) const
return decay;
}
+
+void TemplateAnalyzer::invalidate_cache()
+{
+ _event_weight.invalidate();
+ _event_weight_inverted_htlep.invalidate();
+}

0 comments on commit 646019f

Please sign in to comment.