File indexing completed on 2024-11-26 02:34:21
0001
0002
0003
0004
0005
0006
0007
0008 import ROOT
0009 import sys
0010 from DataFormats.FWLite import Events, Handle
0011
0012
0013
0014
0015
0016
0017 events = Events (["input.root"])
0018 handle = Handle ("trigger::TriggerFilterObjectWithRefs")
0019
0020
0021 ROOT.gROOT.ProcessLine("std::vector<reco::ElectronRef> electrons;")
0022
0023
0024 TriggerElectron = +82
0025
0026
0027 label = ("hltL1NonIsoHLTNonIsoSingleElectronEt22TighterEleIdOneOEMinusOneOPFilter")
0028
0029 numElectronsSeen = 0
0030 numEventsWithElectron = 0
0031
0032
0033 for event in events:
0034
0035 event.getByLabel (label, handle)
0036
0037 trigobjs = handle.product()
0038
0039 trigobjs.getObjects(TriggerElectron, ROOT.electrons)
0040 print("number of electrons in this event:",len(ROOT.electrons))
0041
0042 bestOneOverEminusOneOverP = None
0043
0044 numElectronsSeen += len(ROOT.electrons)
0045
0046 if len(ROOT.electrons) > 0:
0047 numEventsWithElectron += 1
0048 else:
0049 continue
0050
0051 for eleindex, electron in enumerate(ROOT.electrons):
0052
0053 print("electron",eleindex)
0054
0055
0056 tracks = electron.track().product()
0057
0058 superClusters = electron.superCluster().product()
0059
0060 print(" number of tracks:",len(tracks))
0061 print(" number of superclusters:",len(superClusters))
0062
0063 for track in tracks:
0064 momentum = track.p()
0065
0066 for superCluster in superClusters:
0067 energy = superCluster.energy()
0068
0069 thisOneOverEminusOneOverP = abs(1/energy - 1/momentum)
0070
0071 print(" momentum=",momentum,"energy=",energy,"E/P=",energy/momentum,"1/E-1/p=",thisOneOverEminusOneOverP)
0072
0073
0074 if bestOneOverEminusOneOverP == None or thisOneOverEminusOneOverP < bestOneOverEminusOneOverP:
0075 bestOneOverEminusOneOverP = thisOneOverEminusOneOverP
0076
0077
0078
0079
0080
0081
0082
0083 print("best value:",bestOneOverEminusOneOverP)
0084
0085
0086
0087 print("total number of electrons:",numElectronsSeen)
0088 print("events with at least one electron:",numEventsWithElectron)