Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-11-27 03:18:06

0001 #! /usr/bin/env python
0002 #
0003 #
0004 # Francisco Yumiceva
0005 # yumiceva@fnal.gov
0006 #
0007 # Fermilab, 2010
0008 #
0009 #____________________________________________________________
0010 
0011 
0012 import configparser as ConfigParser
0013 import ROOT
0014 import sys
0015 import math
0016 from array import array
0017 
0018 from DataFormats.FWLite import Events, Handle
0019 
0020 
0021 def main():
0022 
0023     preFnal = 'dcache:/pnfs/cms/WAX/11'
0024     preCern = 'rfio:/castor/cern.ch/cms'
0025     pre = preCern
0026     
0027     files = [pre+'/store/express/Run2010A/ExpressPhysics/FEVT/v4/000/138/737/FEC10B07-5281-DF11-B3D2-0030487A3DE0.root']
0028     
0029     events = Events (files)
0030 
0031     handleBSpot  = Handle ("reco::BeamSpot")
0032 
0033     label    = ("offlineBeamSpot")
0034 
0035     #f = ROOT.TFile("analyzerPython.root", "RECREATE")
0036     #f.cd()
0037 
0038     #muonPt  = ROOT.TH1F("muonPt", "pt",    100,  0.,300.)
0039     
0040     # loop over events
0041     i = 0
0042     
0043     for event in events:
0044         i = i + 1
0045         if i%10 == 0:
0046             print(i)
0047 
0048         event.getByLabel (label, handleBSpot)
0049         # get the product
0050         spot = handleBSpot.product()
0051 
0052         print(" x = "+str(spot.x0()))
0053                         
0054         if i==10: break
0055                                                                                     
0056     #f.Close()
0057 
0058 if __name__ == '__main__':
0059     main()