Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2024-04-06 12:29:06

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