cms-tau-pog / TauFW

Analysis framework for tau analysis at CMS using NanoAOD
9 stars 40 forks source link

WIP: Flexible stitching #34

Closed smonig closed 1 year ago

smonig commented 1 year ago
IzaakWN commented 1 year ago

Hi @smonig, luckily the conflict with the python3 PR seems to be limited to one file. Can you fix this?

After that, do you want to add anything else before we merge?

smonig commented 1 year ago

Hi @smonig, luckily the conflict with the python3 PR seems to be limited to one file. Can you fix this?

After that, do you want to add anything else before we merge?

Hi @IzaakWN , conflicts are resolved. I think it can be merged. However, the stitching does not really work well for the new samples yet for the exclusive sample. But this is not solvable right now with these nano V10... On the other side, for the jet binned samples, it works. Currently, the nano skimming efficiencies are hard-coded. At some point, we should try to make it nicely by looking at the non-selected events tree. This should be done everywhere as it is currently hard-coded also for the cross section calculation. I guess, a nicer solution would be to have all relevant quantities inside a cutflow in the nanoAODs.

IzaakWN commented 9 months ago

@smonig, I just ran into the error that weight_mutaufilter is not defined in the cutflow, because I was using a different module that did not have these defined, so for now I will try to fix it like this https://github.com/cms-tau-pog/TauFW/pull/42/commits/1b2b1f067ee55bcd75c89b428f8f1618ebb0ecb5 in PR https://github.com/cms-tau-pog/TauFW/pull/42. It's not the most beautiful or performant (looking up a string every event iteration), but good enough for now.

Traceback (most recent call last):
  File "/afs/cern.ch/user/i/ineuteli/analysis/CMSSW_12_4_8_g-2/src/TauFW/PicoProducer/python/processors/picojob.py", line 118, in <module>
    p.run()
  File "/afs/cern.ch/user/i/ineuteli/analysis/CMSSW_12_4_8_g-2/python/PhysicsTools/NanoAODTools/postprocessing/framework/postprocessor.py", line 242, in run
    (nall, npass, timeLoop) = eventLoop(
  File "/afs/cern.ch/user/i/ineuteli/analysis/CMSSW_12_4_8_g-2/python/PhysicsTools/NanoAODTools/postprocessing/framework/eventloop.py", line 82, in eventLoop
    ret = m.analyze(e)
  File "/afs/cern.ch/user/i/ineuteli/analysis/CMSSW_12_4_8_g-2/python/TauFW/PicoProducer/analysis/gmin2/ModuleMuMu.py", line 329, in analyze
    if not self.fillhists(event):
  File "/afs/cern.ch/user/i/ineuteli/analysis/CMSSW_12_4_8_g-2/python/TauFW/PicoProducer/analysis/ModuleTauPair.py", line 207, in fillhists
    self.out.cutflow.fill('weight_mutaufilter',event.genWeight*isMuTau)
  File "/afs/cern.ch/user/i/ineuteli/analysis/CMSSW_12_4_8_g-2/python/TauFW/PicoProducer/analysis/Cutflow.py", line 35, in fill
    assert cut in self.cuts, "Did not find cut '%s'! Choose from %s"%(cut,self.cuts)
AssertionError: Did not find cut 'weight_mutaufilter'! Choose from {'none': 0, 'trig': 1, 'muon': 2, 'pair': 3, 'leadTrig': 4, 'weight': 15, 'weight_no0PU': 16}