CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
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 ##. More...
 
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

More...
 
tuple event = Event(piece)
 
list eventList = []
 
string eventsToProcess = '\n'
 
list files = []
 Interactive ##. More...
 
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 ##. More...
 
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.

Referenced by setupCrabDict().

138 def fullCPMpath():
139  base = os.environ.get ('CMSSW_BASE')
140  if not base:
141  raise RuntimeError, "CMSSW Environment not set"
142  retval = "%s/src/PhysicsTools/Utilities/configuration/copyPickMerge_cfg.py" \
143  % base
144  if os.path.exists (retval):
145  return retval
146  base = os.environ.get ('CMSSW_RELEASE_BASE')
147  retval = "%s/src/PhysicsTools/Utilities/configuration/copyPickMerge_cfg.py" \
148  % base
149  if os.path.exists (retval):
150  return retval
151  raise RuntimeError, "Could not find copyPickMerge_cfg.py"
def edmPickEvents.getFileNames (   event,
  dbsOptions = {} 
)

Subroutines ##.

Definition at line 112 of file edmPickEvents.py.

113 def getFileNames (event, dbsOptions = {}):
114  # Query DBS
115  try:
116  api = DbsApi (dbsOptions)
117  query = "find file where dataset=%(dataset)s and run=%(run)i and lumi=%(lumi)i" % event
118 
119  xmldata = api.executeQuery(query)
120  except DbsApiException, ex:
121  print "Caught API Exception %s: %s " % (ex.getClassName(), ex.getErrorMessage() )
122  if ex.getErrorCode() not in (None, ""):
123  print "DBS Exception Error Code: ", ex.getErrorCode()
124 
125  # Parse the resulting xml output.
126  files = []
127  try:
128  handler = Handler()
129  xml.sax.parseString (xmldata, handler)
130  except SAXParseException, ex:
131  msg = "Unable to parse XML response from DBS Server"
132  msg += "\n Server has not responded as desired, try setting level=DBSDEBUG"
133  raise DbsBadXMLData(args=msg, code="5999")
134 
135  return handler.files
136 
def getFileNames
Subroutines ##.
XML parser class ##.
def edmPickEvents.guessEmail ( )

Definition at line 152 of file edmPickEvents.py.

References join(), and split.

153 def guessEmail():
154  return '%s@%s' % (commands.getoutput ('whoami'),
155  '.'.join(commands.getoutput('hostname').split('.')[-2:]))
156 
static std::string join(char **cmd)
Definition: RemoteFile.cc:18
double split
Definition: MVATrainer.cc:139
def edmPickEvents.setupCrabDict (   options)

Definition at line 157 of file edmPickEvents.py.

References fullCPMpath().

158 def setupCrabDict (options):
159  crab = {}
160  base = options.base
161  crab['runEvent'] = '%s_runEvents.txt' % base
162  crab['copyPickMerge'] = fullCPMpath()
163  crab['output'] = '%s.root' % base
164  crab['crabcfg'] = '%s_crab.config' % base
165  crab['json'] = '%s.json' % base
166  crab['dataset'] = Event.dataset
167  crab['email'] = options.email
168  if options.crabCondor:
169  crab['scheduler'] = 'condor'
170  crab['useServer'] = ''
171  else:
172  crab['scheduler'] = 'glite'
173  crab['useServer'] = 'use_server = 1'
174  return crab
175 
176 
# 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'

Definition at line 321 of file edmPickEvents.py.

Referenced by optutl::CommandLineParser._runVariableCommandFromString(), evf::Vulture.analyze(), evf::StateMachine.commandCallback(), ME_MAP.create_gif(), TagProbeFitter.createPdf(), SiPixelHistoPlotter.createStaticPlot(), SiStripHistoPlotter.createStaticPlot(), evf::soaputils.extractParameters(), stor::soaputils.extractParameters(), dqm::StateMachine.fireEvent(), xmas2dqm::wse::XmasToDQM.fireEvent(), evf::iDie.fsmCallback(), smproxy::SMProxyServer.handleFSMSoapMessage(), evf::FUResourceBroker.handleFSMSoapMessage(), stor::StorageManager.handleFSMSoapMessage(), makePSetsFromFile(), makePSetsFromString(), GenParticlePruner.parse(), TrackerMap.printall(), TrackerMap.printonline(), edm.pythonFileToConfigure(), PythonProcessDesc.readFile(), FWConfigurationManager.readFromOldFile(), PythonProcessDesc.readString(), PedeSteerer.runPede(), TrackerMap.save(), TrackerMap.save_as_fectrackermap(), TrackerMap.save_as_fedtrackermap(), TrackerMap.save_as_HVtrackermap(), TrackerMap.save_as_psutrackermap(), L1RCTLutWriter.writeEicLutFile(), L1RCTLutWriter.writeJscLutFile(), and L1RCTLutWriter.writeRcLutFile().

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.

string edmPickEvents.crabTemplate

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.

list edmPickEvents.eventList = []

Definition at line 248 of file edmPickEvents.py.

string edmPickEvents.eventsToProcess = '\n'

Definition at line 282 of file edmPickEvents.py.

list edmPickEvents.files = []

Interactive ##.

Definition at line 304 of file edmPickEvents.py.

tuple edmPickEvents.fileSet = set()

Definition at line 311 of file edmPickEvents.py.

Referenced by TauDQMFileLoader.endRun(), and TauDQMFileLoader.TauDQMFileLoader().

string edmPickEvents.help

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.

list edmPickEvents.uniqueFiles = []

Definition at line 312 of file edmPickEvents.py.