CMS 3D CMS Logo

Classes | Functions | Variables

edmPickEvents Namespace Reference

Classes

class  Event
 Event helper class ##. More...
class  Handler
 XML parser class ##. More...

Functions

def fullCPMpath
def getFileNames
 Subroutines ##.
def guessEmail
def setupCrabDict

Variables

tuple colonRE = re.compile(r':')
string command = 'edmCopyPickMerge outputFile=%s.root \\\n eventsToProcess=%s \\\n inputFiles=%s'
tuple commentRE = re.compile(r'#.+$')
tuple crabDict = setupCrabDict(options)
string crabTemplate
string default = 'pickevents'
tuple email = guessEmail()
 ################## ## ## Main Program ## ## ################## ##
tuple event = Event(piece)
list eventList = []
string eventsToProcess = '\n'
list files = []
 Interactive ##.
tuple fileSet = set()
string help
tuple json = LumiList(lumis = runsAndLumis)
tuple line = commentRE.sub('', line)
tuple parser = optparse.OptionParser("Usage: %prog [options] dataset events_or_events.txt", description='''This program facilitates picking specific events from a data set. For full details, please visit https://twiki.cern.ch/twiki/bin/view/CMS/PickEvents ''')
list runsAndLumis = [ (event.run, event.lumi) for event in eventList]
 CRAB ##.
tuple source = open(args[0], 'r')
tuple target = open(crabDict['runEvent'], 'w')
list uniqueFiles = []

Function Documentation

def edmPickEvents::fullCPMpath ( )

Definition at line 137 of file edmPickEvents.py.

00138                  :
00139     base = os.environ.get ('CMSSW_BASE')
00140     if not base:
00141         raise RuntimeError, "CMSSW Environment not set"
00142     retval = "%s/src/PhysicsTools/Utilities/configuration/copyPickMerge_cfg.py" \
00143              % base
00144     if os.path.exists (retval):
00145         return retval
00146     base = os.environ.get ('CMSSW_RELEASE_BASE')
00147     retval = "%s/src/PhysicsTools/Utilities/configuration/copyPickMerge_cfg.py" \
00148              % base
00149     if os.path.exists (retval):
00150         return retval
00151     raise RuntimeError, "Could not find copyPickMerge_cfg.py"

def edmPickEvents::getFileNames (   event,
  dbsOptions = {} 
)

Subroutines ##.

Definition at line 112 of file edmPickEvents.py.

00112                                       {}):
00113     # Query DBS
00114     try:
00115         api = DbsApi (dbsOptions)
00116         query = "find file where dataset=%(dataset)s and run=%(run)i and lumi=%(lumi)i" % event
00117 
00118         xmldata = api.executeQuery(query)
00119     except DbsApiException, ex:
00120         print "Caught API Exception %s: %s "  % (ex.getClassName(), ex.getErrorMessage() )
00121         if ex.getErrorCode() not in (None, ""):
00122             print "DBS Exception Error Code: ", ex.getErrorCode()
00123 
00124     # Parse the resulting xml output.
00125     files = []
00126     try:
00127         handler = Handler()
00128         xml.sax.parseString (xmldata, handler)
00129     except SAXParseException, ex:
00130         msg = "Unable to parse XML response from DBS Server"
00131         msg += "\n  Server has not responded as desired, try setting level=DBSDEBUG"
00132         raise DbsBadXMLData(args=msg, code="5999")
00133 
00134     return handler.files
00135 
00136 
def edmPickEvents::guessEmail ( )

Definition at line 152 of file edmPickEvents.py.

00153                 :
00154     return '%s@%s' % (commands.getoutput ('whoami'),
00155                       '.'.join(commands.getoutput('hostname').split('.')[-2:]))
00156 

def edmPickEvents::setupCrabDict (   options)

Definition at line 157 of file edmPickEvents.py.

00158                            :
00159     crab = {}
00160     base = options.base
00161     crab['runEvent']      = '%s_runEvents.txt' % base
00162     crab['copyPickMerge'] = fullCPMpath()
00163     crab['output']        = '%s.root' % base
00164     crab['crabcfg']       = '%s_crab.config' % base
00165     crab['json']          = '%s.json' % base
00166     crab['dataset']       = Event.dataset
00167     crab['email']         = options.email
00168     if options.crabCondor:
00169         crab['scheduler'] = 'condor'
00170         crab['useServer'] = ''
00171     else:
00172         crab['scheduler'] = 'glite'
00173         crab['useServer'] = 'use_server              = 1'
00174     return crab
00175 
00176 
# crab template

Variable Documentation

tuple edmPickEvents::colonRE = re.compile(r':')

Definition at line 247 of file edmPickEvents.py.

string edmPickEvents::command = 'edmCopyPickMerge outputFile=%s.root \\\n eventsToProcess=%s \\\n inputFiles=%s'
tuple edmPickEvents::commentRE = re.compile(r'#.+$')

Definition at line 246 of file edmPickEvents.py.

tuple edmPickEvents::crabDict = setupCrabDict(options)

Definition at line 284 of file edmPickEvents.py.

Definition at line 177 of file edmPickEvents.py.

string edmPickEvents::default = 'pickevents'

Definition at line 222 of file edmPickEvents.py.

tuple edmPickEvents::email = guessEmail()

################## ## ## Main Program ## ## ################## ##

Definition at line 219 of file edmPickEvents.py.

tuple edmPickEvents::event = Event(piece)

Definition at line 253 of file edmPickEvents.py.

Definition at line 248 of file edmPickEvents.py.

Definition at line 282 of file edmPickEvents.py.

Interactive ##.

Definition at line 304 of file edmPickEvents.py.

tuple edmPickEvents::fileSet = set()

Definition at line 311 of file edmPickEvents.py.

Referenced by DQMFileLoader::DQMFileLoader(), and DQMFileLoader::endJob().

Definition at line 23 of file edmPickEvents.py.

tuple edmPickEvents::json = LumiList(lumis = runsAndLumis)

Definition at line 281 of file edmPickEvents.py.

tuple edmPickEvents::line = commentRE.sub('', line)

Definition at line 261 of file edmPickEvents.py.

tuple edmPickEvents::parser = optparse.OptionParser("Usage: %prog [options] dataset events_or_events.txt", description='''This program facilitates picking specific events from a data set. For full details, please visit https://twiki.cern.ch/twiki/bin/view/CMS/PickEvents ''')

Definition at line 220 of file edmPickEvents.py.

list edmPickEvents::runsAndLumis = [ (event.run, event.lumi) for event in eventList]

CRAB ##.

Definition at line 280 of file edmPickEvents.py.

string edmPickEvents::source = open(args[0], 'r')

Definition at line 259 of file edmPickEvents.py.

tuple edmPickEvents::target = open(crabDict['runEvent'], 'w')

Definition at line 286 of file edmPickEvents.py.

Definition at line 312 of file edmPickEvents.py.