Skip to content

Accelerate HIJetDRAssociationTool by shortening the loop over constituents

Tomasz Bold requested to merge tbold/athena:speedup-HIJetDRAssociationTool into 23.0

This MR accelerates the execution of HIJetDRAssociationTool used in HI HLT chains. The trick is simple, instead of double loops over long list of towers and jets the tool projects the towers first into 2D eta-phi grid and then for each jet only tries to include the towers in cell where it is found and the adjacent ones.

The timing of the items for JetRecAlg as is now:

jetrecalg_copy_HLT_AntiKt2HIJets_seed0.copier copier deep copy time 0.172915
jetrecalg_copy_HLT_AntiKt2HIJets_seed0.copier copier getAndRecord 0.217933
jetrecalg_copy_HLT_AntiKt2HIJets_seed0jetrecalg_copy_HLT_AntiKt2HIJets_seed0.HIJetDRAssociation time 65.4981 <<<--- this is the one
jetrecalg_copy_HLT_AntiKt2HIJets_seed0jetrecalg_copy_HLT_AntiKt2HIJets_seed0.HIJetMaxOverMean time 0.603965
jetrecalg_copy_HLT_AntiKt2HIJets_seed0jetrecalg_copy_HLT_AntiKt2HIJets_seed0.HIJetDiscriminator time 0.401778
jetrecalg_copy_HLT_AntiKt2HIJets_seed0jetrecalg_copy_HLT_AntiKt2HIJets_seed0.jetptfilter_5000 time 0.011844
jetrecalg_copy_HLT_AntiKt2HIJets_seed0total time 66.782

after the change:

jetrecalg_copy_HLT_AntiKt2HIJets_seed0.copier copier deep copy time 0.183458
jetrecalg_copy_HLT_AntiKt2HIJets_seed0.copier copier getAndRecord 0.228894
jetrecalg_copy_HLT_AntiKt2HIJets_seed0jetrecalg_copy_HLT_AntiKt2HIJets_seed0.HIJetDRAssociation time 6.84362 <<<--- this is the one
jetrecalg_copy_HLT_AntiKt2HIJets_seed0jetrecalg_copy_HLT_AntiKt2HIJets_seed0.HIJetMaxOverMean time 0.451896
jetrecalg_copy_HLT_AntiKt2HIJets_seed0jetrecalg_copy_HLT_AntiKt2HIJets_seed0.HIJetDiscriminator time 0.095276
jetrecalg_copy_HLT_AntiKt2HIJets_seed0jetrecalg_copy_HLT_AntiKt2HIJets_seed0.jetptfilter_5000 time 0.008923
jetrecalg_copy_HLT_AntiKt2HIJets_seed0total time 7.65191

It looks like factor of about 10 speedup but varaies from event to event (I guess depending on the number of jets). One can probably play with the grid size a bit to optimize it further.

I have checked chain counts on 1000 events. They are the same.

Tagging @stapiaar @mrybar @angerami - plese tag others who wpould be interested to have a look at the code and maybe spot some mistake.

In any case we would need to reprocess some larger sample to make sure the counts are unchanged.

Merge request reports

Loading