Restructuring Analyses Code
TL;DR
This text is the current DiHiggsAnalysesAlg, the new proposal is down there
- At first a
std::unordered_map m_higgsVars
is created holding the variables with default values that are written to the tree per event.I think this is a handy way of dealing with all the variables, having them in one place in c++ and it works like a dict in python. On top the treewriter never runs into the problem that it cannot write a value, you also know if sth did not execute.
- Alongside the map the Decorators are created at the initialize stage so they are only created once per alg
At the moment makeResolvedAnalysis (small R jets) and makeBoostedAnalysis (large R jets) are just two large scripts (I tried to minimize the same loops, though they are pointer loops and might not be the bottleneck). It does the following, already some split up suggestions per item:
-
resolved analysis(small R jets, btagging wp, isMC):
- count central jets, count btagged central jets
- if MC: calculate per jet the dR to all truth b's in the event (subject to change anyway)
- keep only btagged jets
- pairing
- make sure we have at least 4 btagged jets
- find leading pt btagged jet
- calculate dR to other jets
- make leading Higgs candidate with leading pt jet and closest jet to this one
Currently there is a HiggsCandidate struct made for only one higgs, but maybe it would be nice to just extend this to all the interesting Higgs related objects like the four jets, from the pairing here, and it can be passed around easily to other methods, or even go earlier and attach the btagged jets also to it for reuse of other methods.
- calculate some four vectors or dR's of jets
- if MC:
- get closest truth b to the higgs candidate jets
- figure if h1jet1 and h1jet2 have the same parent
- write dR (closest B, candidate jet)
-
boosted (Large R jets, vr btagging wp)
- count largeR jets with
jet->pt() > 250000. && std::abs(jet->eta() < 2.0)
- make sure we have 2 large R's
- find leading one
- now per largeR:
- get ghostassociated VR's
- count vr jets
- keep only btagged ones also count the btagged ones
- make sure vr jets don't overlap, otherwise exit
- find leading and subleading vr jets some fourvector calc
- count largeR jets with
At the end the whole set of vars in the map from the beginning are decorated per wp
TODO:
- New general name for everything
- definitely split up into components resolved and boosted analyses
- a central place where all the "tools"/components live
- a lot of the points are quite interdependent, need to make sure that previous ones have been executed
- make it highly configurable