本文整理汇总了Python中DataFormats.FWLite.Events.eventAuxiliary方法的典型用法代码示例。如果您正苦于以下问题:Python Events.eventAuxiliary方法的具体用法?Python Events.eventAuxiliary怎么用?Python Events.eventAuxiliary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataFormats.FWLite.Events
的用法示例。
在下文中一共展示了Events.eventAuxiliary方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from DataFormats.FWLite import Events [as 别名]
# 或者: from DataFormats.FWLite.Events import eventAuxiliary [as 别名]
#.........这里部分代码省略.........
files.extend(map(lambda x: 'root://eoscms/'+ x, getFileListFromEOS(args.eosdir)) )
else:
print 'No input given, quitting'
sys.exit(1)
total_files = 0
if MAX_FILES_TO_PROCESS < 0:
total_files = len(files)
else:
total_files = min(MAX_FILES_TO_PROCESS, len(files))
analyzed_files = 0
start_cumulative_time = time()
start_time = start_cumulative_time
end_time = start_cumulative_time
file_count = -1
for input_file in files:
file_count += 1
analyzed_files += 1
if MAX_FILES_TO_PROCESS > 0 and analyzed_files > MAX_FILES_TO_PROCESS:
break
print "\n", input_file
events = Events(input_file)
total_events = float(events.size())
analized_events = 0.
for e in range(events.size()):
analized_events += 1.0
if analized_events*100./total_events == 100:
end_time = time()
if not args.debug:
sys.stdout.write("\r %d/%d --> %4.1f [%4.1f m / %6f s] ETA: %4.1f m ==> LS: %d" % (file_count, total_files,
analized_events*100./total_events,
(end_time-start_time)/60.,(end_time-start_time),
(end_time-start_cumulative_time)/(60.*analyzed_files) * (total_files - analyzed_files),
events.eventAuxiliary().luminosityBlock()))
start_time = end_time
sys.stdout.flush()
a = events.to(e)
if args.lumi:
if not events.eventAuxiliary().luminosityBlock() in numerical_lumi:
continue
if len(numerical_bn) !=0 and not events.eventAuxiliary().bunchCrossing() in numerical_bn:
continue
a = events.getByLabel("generalTracks", tracks_h)
a = events.getByLabel("offlinePrimaryVertices", pv_h)
good_vertices = getNumberOfGoodVertices(pv_h)
if good_vertices < 1:
continue
for track in range(tracks_h.product().size()):
t = tracks_h.product()[track]
if not t.quality(t.qualityByName("highPurity")):
continue
if t.pt() < 1.0 or t.dxy() > 0.1:
continue
hp = t.hitPattern()
if args.debug:
print "\n\n"
for category in hit_category.keys():
if args.debug:
print hit_category[category], "pt, eta, phi, dxy, originalAlgo-4", t.pt(), t.eta(), t.phi(), t.dxy(), t.originalAlgo()-4
for hit in range(0, hp.numberOfHits(category)):
pattern = hp.getHitPattern(category, hit)
valid = hp.validHitFilter(pattern)
missing = hp.missingHitFilter(pattern)
inactive = hp.inactiveHitFilter(pattern)
bad = hp.badHitFilter(pattern)
hit_type = -1
示例2: Events
# 需要导入模块: from DataFormats.FWLite import Events [as 别名]
# 或者: from DataFormats.FWLite.Events import eventAuxiliary [as 别名]
print "Running over files:",inputFiles
print "plotDir:",options.plotDir
handles={k:Handle(edmCollections[k][0]) for k in edmCollections.keys()}
res={}
events = Events(inputFiles)
events.toBegin()
products={}
size=events.size() #if not small else 2000
missingCollections=[]
for nev in range(size):
if nev%1000==0:print nev,'/',size
events.to(nev)
eaux=events.eventAuxiliary()
run=eaux.run()
if options.run>0 and not run==options.run:
# print run, options.run
continue
for k in [ x for x in edmCollections.keys() if x not in missingCollections]:
try:
events.getByLabel(edmCollections[k][1:],handles[k])
products[k]=handles[k].product()
except:
products[k]=None
print "Not found:",k
missingCollections.append(k)
d={}
# print "Event",nev,'size',products['pfCandidates'].size()
示例3: Handle
# 需要导入模块: from DataFormats.FWLite import Events [as 别名]
# 或者: from DataFormats.FWLite.Events import eventAuxiliary [as 别名]
tracksRef = Handle("std::vector<reco::Track>")
label = "generalTracks"
#label = "globalMuons"
quality = "highPurity"
#quality = "tight"
#quality = "loose"
def format(x) :
return '{:.2f}'.format(x)
for i in range(0, eventsRef.size()):
#for i in range(0, 200):
a= eventsRef.to(i)
ev = eventsRef.eventAuxiliary().event()
# print "Event", i
a=eventsRef.getByLabel(label, tracksRef)
trVal = []
for track in tracksRef.product():
# if (track.phi()<0) : continue
# if (track.eta()<0) : continue
if (track.pt()<1) : continue
# if (track.qoverpError()*track.p()>2) : continue
# if (not track.quality(track.qualityByName(quality))) : continue
# pattern = track.hitPattern()
# if (pattern.numberOfValidHits() != (pattern.numberOfValidPixelHits()+pattern.numberOfValidStripHits())) :
# print pattern.numberOfValidHits(),pattern.numberOfValidPixelHits(),pattern.numberOfValidStripHits(), pattern.numberOfValidPixelHits()+pattern.numberOfValidStripHits()
trVal.append([i, ev, 10*int(100*track.eta())+track.phi(), ver, format(track.eta()), format(track.phi()), format(track.pt()), format(track.qoverpError()*track.p()),
track.numberOfValidHits() , track.hitPattern().numberOfValidPixelHits(),
track.numberOfLostHits(), format(track.validFraction()), track.ndof(),format(track.chi2()),track.algo()-4,track.originalAlgo()-4,track.quality(track.qualityByName("highPurity"))])