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 107 of file edmPickEvents.py.

Referenced by setupCrabDict().

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

Subroutines ##.

Definition at line 84 of file edmPickEvents.py.

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

Definition at line 122 of file edmPickEvents.py.

References join(), and split.

123 def guessEmail():
124  return '%s@%s' % (commands.getoutput ('whoami'),
125  '.'.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 126 of file edmPickEvents.py.

References fullCPMpath().

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

Variable Documentation

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

Definition at line 232 of file edmPickEvents.py.

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

Definition at line 316 of file edmPickEvents.py.

tuple edmPickEvents.commentRE = re.compile(r'#.+$')

Definition at line 231 of file edmPickEvents.py.

tuple edmPickEvents.crabDict = setupCrabDict(options)

Definition at line 273 of file edmPickEvents.py.

string edmPickEvents.crabTemplate

Definition at line 148 of file edmPickEvents.py.

string edmPickEvents.default = 'pickevents'

Definition at line 204 of file edmPickEvents.py.

tuple edmPickEvents.email = guessEmail()

Main Program

Definition at line 199 of file edmPickEvents.py.

tuple edmPickEvents.event = Event(piece)

Definition at line 238 of file edmPickEvents.py.

tuple edmPickEvents.eventFiles = getFileNames(event)

Definition at line 296 of file edmPickEvents.py.

list edmPickEvents.eventList = []

Definition at line 233 of file edmPickEvents.py.

list edmPickEvents.eventPurgeList = []

Definition at line 294 of file edmPickEvents.py.

string edmPickEvents.eventsToProcess = '\n'

Definition at line 271 of file edmPickEvents.py.

list edmPickEvents.files = []

Interactive ##.

Definition at line 293 of file edmPickEvents.py.

tuple edmPickEvents.fileSet = set()

Definition at line 306 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 19 of file edmPickEvents.py.

tuple edmPickEvents.json = LumiList(lumis = runsAndLumis)

Definition at line 270 of file edmPickEvents.py.

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

Definition at line 246 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 200 of file edmPickEvents.py.

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

CRAB ##.

Definition at line 269 of file edmPickEvents.py.

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

Definition at line 244 of file edmPickEvents.py.

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

Definition at line 275 of file edmPickEvents.py.

list edmPickEvents.uniqueFiles = []

Definition at line 307 of file edmPickEvents.py.