cms-l1-dpg / Phase2-L1Nano

NanoAOD ntupler for Phase-2 L1 Objects
Apache License 2.0
1 stars 5 forks source link

Add BtagScore to Nano #3

Closed artlbv closed 10 months ago

artlbv commented 10 months ago

The seededCone Jet Btag score is stored separately from the jet collection in a value map: cms.InputTag("l1tBJetProducerPuppiCorrectedEmulator", "L1PFBJets")

In the old ntupler this value was added like that to the SC jet collection: https://github.com/artlbv/cmssw/blob/Phase2_prototypeSnapshot_3_CMSSW_13_1/L1Trigger/L1TNtuples/src/L1AnalysisPhaseIIStep1.cc#L527-L530

We need to find a way to do the same for the nano ntupler.

In principle, since this is a flat ntuple we could just dump that collection separately/independently from the scJets -> this requires that the object/jet ordering is the same.

Otherwise we could get some inspiration from the PATJetUserDataEmbedder? Example usage here: https://github.com/cms-sw/cmssw/blob/master/PhysicsTools/NanoAOD/python/custom_jme_cff.py#L504-L509

artlbv commented 10 months ago

@EmyrClement found the built-in solution - external variables, e.g. https://github.com/cms-sw/cmssw/blob/83fdb701c65dcb86807248847bc26aa51708152b/PhysicsTools/NanoAOD/python/particlelevel_cff.py#L70

So this code does work now:

scExtJetTable = scJetTable.clone(
    src = cms.InputTag('l1tSCPFL1PuppiExtendedCorrectedEmulator'),
    name = cms.string("L1scExtJet"),
    doc = cms.string("SeededCone 0.4 Puppi jet from extended Puppi"),
    externalVariables = cms.PSet(
        btagScore = ExtVar(cms.InputTag("l1tBJetProducerPuppiCorrectedEmulator", "L1PFBJets"),float, doc="NNBtag score"),
    ),
)

Producing:

 L1scExtJet_pt   = 97.75, 
                  68, 46.75, 44, 43.5, 28, 
                  27.5, 22.5, 14.25, 9.75
 L1scExtJet_z0   = 0, 
                  0, 0, 0, 0, 0, 
                  0, 0, 0, 0
 L1scExtJet_btagScore = 0.451799, 
                  0.773158, 0.399172, 0.819793, 0.55219, 0.644735, 
                  -1, -1, -1, -1

Will close issue once the PR is done.