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...
 

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)
 
tuple eventFiles = getFileNames(event)
 
list eventList = []
 
list eventPurgeList = []
 
string eventsToProcess = '\n'
 
list files = []
 Interactive ##. More...
 
tuple fileSet = set()
 
string help
 
tuple json = LumiList(lumis = runsAndLumis)
 
tuple line = commentRE.sub('', line)
 
tuple parser
 
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 109 of file edmPickEvents.py.

Referenced by setupCrabDict().

110 def fullCPMpath():
111  base = os.environ.get ('CMSSW_BASE')
112  if not base:
113  raise RuntimeError, "CMSSW Environment not set"
114  retval = "%s/src/PhysicsTools/Utilities/configuration/copyPickMerge_cfg.py" \
115  % base
116  if os.path.exists (retval):
117  return retval
118  base = os.environ.get ('CMSSW_RELEASE_BASE')
119  retval = "%s/src/PhysicsTools/Utilities/configuration/copyPickMerge_cfg.py" \
120  % base
121  if os.path.exists (retval):
122  return retval
123  raise RuntimeError, "Could not find copyPickMerge_cfg.py"
def edmPickEvents.getFileNames (   event)

Subroutines ##.

Definition at line 86 of file edmPickEvents.py.

86 
87 def getFileNames (event):
88  files = []
89  # Query DAS
90  query = "file dataset=%(dataset)s run=%(run)i lumi=%(lumi)i | grep file.name" % event
91  jsondict = das_client.get_data('https://cmsweb.cern.ch', query, 0, 0, False)
92  status = jsondict['status']
93  if status != 'ok':
94  print "DAS query status: %s"%(status)
95  return files
96 
97  mongo_query = jsondict['mongo_query']
98  filters = mongo_query['filters']
99  data = jsondict['data']
100 
101  files = []
102  for row in data:
103  file = [r for r in das_client.get_value(row, filters['grep'])][0]
104  if len(file) > 0 and not file in files:
105  files.append(file)
106 
107  return files
108 
def getFileNames
Subroutines ##.
def edmPickEvents.guessEmail ( )

Definition at line 124 of file edmPickEvents.py.

References join(), and split.

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

Definition at line 128 of file edmPickEvents.py.

References fullCPMpath().

129 def setupCrabDict (options):
130  date = datetime.now().strftime('%Y%m%d_%H%M%S')
131  crab = {}
132  base = options.base
133  crab['runEvent'] = '%s_runEvents.txt' % base
134  crab['copyPickMerge'] = fullCPMpath()
135  crab['output'] = '%s.root' % base
136  crab['crabcfg'] = '%s_crab.py' % base
137  crab['json'] = '%s.json' % base
138  crab['dataset'] = Event.dataset
139  crab['email'] = options.email
140  crab['WorkArea'] = date
141  if options.crabCondor:
142  crab['scheduler'] = 'condor'
143 # crab['useServer'] = ''
144  else:
145  crab['scheduler'] = 'remoteGlidein'
146 # crab['useServer'] = 'use_server = 1'
147  crab['useServer'] = ''
148  return crab
149 
# crab template

Variable Documentation

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

Definition at line 234 of file edmPickEvents.py.

string edmPickEvents.command = 'edmCopyPickMerge outputFile=%s.root \\\n eventsToProcess=%s \\\n inputFiles=%s'

Definition at line 318 of file edmPickEvents.py.

Referenced by optutl::CommandLineParser._runVariableCommandFromString(), TagProbeFitter.createPdf(), SiStripHistoPlotter.createStaticPlot(), 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 233 of file edmPickEvents.py.

tuple edmPickEvents.crabDict = setupCrabDict(options)

Definition at line 275 of file edmPickEvents.py.

string edmPickEvents.crabTemplate

Definition at line 150 of file edmPickEvents.py.

string edmPickEvents.default = 'pickevents'

Definition at line 206 of file edmPickEvents.py.

tuple edmPickEvents.email = guessEmail()

Main Program

Definition at line 201 of file edmPickEvents.py.

tuple edmPickEvents.event = Event(piece)

Definition at line 240 of file edmPickEvents.py.

tuple edmPickEvents.eventFiles = getFileNames(event)

Definition at line 298 of file edmPickEvents.py.

list edmPickEvents.eventList = []

Definition at line 235 of file edmPickEvents.py.

list edmPickEvents.eventPurgeList = []

Definition at line 296 of file edmPickEvents.py.

string edmPickEvents.eventsToProcess = '\n'

Definition at line 273 of file edmPickEvents.py.

list edmPickEvents.files = []

Interactive ##.

Definition at line 295 of file edmPickEvents.py.

tuple edmPickEvents.fileSet = set()

Definition at line 308 of file edmPickEvents.py.

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

string edmPickEvents.help
Initial value:
1 = """
2 How to use:
3 
4 edmPickEvent.py dataset run1:lumi1:event1 run2:lumi2:event2
5 
6 - or -
7 
8 edmPickEvent.py dataset listOfEvents.txt
9 
10 listOfEvents is a text file:
11 # this line is ignored as a comment
12 # since '#' is a valid comment character
13 run1 lumi_section1 event1
14 run2 lumi_section2 event2
15 
16 For example:
17 # run lum event
18 46968 2 4
19 47011 105 23
20 47011 140 12312
21 
22 run, lumi_section, and event are integers that you can get from
23 edm::Event(Auxiliary)
24 
25 dataset: it just a name of the physics dataset, if you don't know exact name
26  you can provide a mask, e.g.: *QCD*RAW
27 
28 For updated information see Wiki:
29 https://twiki.cern.ch/twiki/bin/view/CMSPublic/WorkBookPickEvents
30 """

Definition at line 21 of file edmPickEvents.py.

tuple edmPickEvents.json = LumiList(lumis = runsAndLumis)

Definition at line 272 of file edmPickEvents.py.

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

Definition at line 248 of file edmPickEvents.py.

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

Definition at line 202 of file edmPickEvents.py.

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

CRAB ##.

Definition at line 271 of file edmPickEvents.py.

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

Definition at line 246 of file edmPickEvents.py.

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

Definition at line 277 of file edmPickEvents.py.

list edmPickEvents.uniqueFiles = []

Definition at line 309 of file edmPickEvents.py.